:root {
    --gold-primary: #f2c75c;
    --gold-dark: #b88a32;
    --gold-light: #fff5c5;
    --bg-dark: #121212;
    --bg-card: #0a0a0a;
    --font-header: 'Cinzel', serif;
    --font-number: 'Oswald', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-number);
    background: #000;
    background-image: url('bg-luxury.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gold-light);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Center layout horizontally and vertically if content is short, 
       but for this dashboard min-height handles it. */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 2rem;
}

header h1 {
    font-family: var(--font-header);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to bottom, #fff5c5 0%, #d4af37 40%, #8a6e2f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    text-shadow: 0px 0px 20px rgba(212, 175, 55, 0.5);
    letter-spacing: 2px;
}

header .sub {
    color: #88703a;
    font-size: 1rem;
    margin-top: 0.5rem;
    letter-spacing: 1px;
    font-family: var(--font-number);
    text-transform: uppercase;
}

.ticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* Card Design */
.ticker-card {
    background: #050505;
    border: 2px solid transparent;
    border-radius: 8px;
    /* Slightly rounded */
    padding: 2px;
    /* For double border effect workaround locally or just simple usage */
    position: relative;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.1);

    /* Golden double border look using standard border and pseudo-element or boxShadow */
    border-image: linear-gradient(to bottom, #d4af37, #6e5518) 1;
    /* border-image doesn't support radius well, so fallback to box-shadow/border technique for rounded corners usually.
       Let's stick to simple solid gold border for robustness or complex svg border. 
       Simpler approach: */
    border: 2px solid #b88a32;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.8);
}

/* Inner card content wrapper if needed, but styling directly is fine */
.ticker-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.2rem;
    background: linear-gradient(180deg, #1a1508 0%, #050505 100%);
}

.ticker-card::before {
    /* Top ornamental line simulation */
    content: '';
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #b88a32, transparent);
}

.ticker-card .label {
    font-family: var(--font-number);
    font-size: 1rem;
    color: #ccc;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(184, 138, 50, 0.3);
    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Arrow indicator place */
.ticker-card .direction {
    font-size: 1.2rem;
    color: var(--gold-primary);
    width: 20px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticker-card.up .direction {
    color: #4caf50;
}

/* Keep green for up */
.ticker-card.down .direction {
    color: #f44336;
}

/* Keep red for down */

.ticker-card .price {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ticker-card .price .buy-row,
.ticker-card .price .sell-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Labels A: / S: handling */
.ticker-card .price span::before {
    content: attr(data-type);
    font-size: 0.9rem;
    color: #88703a;
    margin-right: 10px;
    font-weight: 400;
}

/* We need to update HTML JS to add data-type attribute or cleaner CSS classes? 
   Current JS puts labels inside textContent directly "A: ...". 
   Let's just style specifically or update JS. 
   For now, styling the text directly as is. */
.ticker-card .price .lbl {
    color: #88703a;
    font-size: 0.9rem;
    margin-right: 8px;
    font-weight: 400;
}

.ticker-card .price .val {
    color: var(--gold-primary);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.ticker-card .buy,
.ticker-card .sell {
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Split-Flap Styles */
.flap-container {
    display: flex;
    gap: 2px;
}

.flap {
    position: relative;
    width: 22px;
    height: 36px;
    background-color: #1a1a1a;
    border-radius: 4px;
    font-family: var(--font-number);
    font-size: 24px;
    font-weight: 600;
    line-height: 36px;
    text-align: center;
    color: var(--gold-primary);
    perspective: 100px;
}

.flap>div {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background-color: #1a1a1a;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flap .top {
    top: 0;
    border-radius: 4px 4px 0 0;
    z-index: 2;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.5);
}

.flap .bottom {
    bottom: 0;
    border-radius: 0 0 4px 4px;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.flap .leaf {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 3;
    background-color: #1a1a1a;
    transform-origin: bottom;
    transition: transform 0.4s ease-in;
    border-radius: 4px 4px 0 0;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.5);
}

.flap .leaf.flipping {
    transform: rotateX(-180deg);
}

.flap .leaf-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 2;
    background-color: #1a1a1a;
    transform-origin: top;
    transform: rotateX(180deg);
    transition: transform 0.4s ease-out;
    border-radius: 0 0 4px 4px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.flap .leaf-bottom.flipping {
    transform: rotateX(0deg);
}

/* Dots and commas don't flip, they just sit there */
.flap.static {
    background: transparent;
    width: auto;
    padding: 0 2px;
}

.status-container {
    margin-top: 3rem;
    text-align: center;
}

.status {
    display: inline-block;
    padding: 8px 25px;
    background: linear-gradient(180deg, #2e2e2e 0%, #000 100%);
    border: 1px solid #484848;
    border-radius: 50px;
    color: #fff;
    font-size: 0.9rem;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    position: relative;
}

.status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #555;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 5px #555;
}

.status.connected {
    border-color: #2e5c18;
}

.status.connected::before {
    background-color: #76ff03;
    box-shadow: 0 0 8px #76ff03;
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8rem;
    }

    .ticker-grid {
        grid-template-columns: 1fr;
    }
}