:root {
    color-scheme: dark;
    --bg: #060807;
    --panel: #111513;
    --panel-2: #151b1a;
    --panel-3: #101722;
    --line: rgba(255, 255, 255, .10);
    --line-strong: rgba(255, 255, 255, .18);
    --text: #f2f6f1;
    --muted: #9facaa;
    --faint: #687672;
    --green: #29df91;
    --red: #ff6175;
    --amber: #f4c354;
    --cyan: #68d8ff;
    --blue: #78a8ff;
    --violet: #b99cff;
    --mono: "Cascadia Mono", "Roboto Mono", Consolas, monospace;
    --sans: "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

body {
    background: linear-gradient(135deg, #060807 0%, #0b1210 42%, #080a0d 100%);
}

.viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.stage {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3840px;
    height: 2160px;
    padding: 32px;
    display: grid;
    grid-template-rows: 178px 154px minmax(0, 1fr) 214px;
    gap: 18px;
    transform: translate(-50%, -50%) scale(var(--stage-scale, 1));
    transform-origin: center center;
}

.panel,
.topbar,
.metric-card,
.score-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(21, 27, 26, .98), rgba(13, 17, 17, .98));
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.topbar {
    display: grid;
    grid-template-columns: 720px minmax(0, 1fr) 540px 500px;
    align-items: center;
    gap: 22px;
    padding: 22px 26px;
}

.brand,
.status-cluster {
    min-width: 0;
    display: flex;
    align-items: center;
}

.brand {
    gap: 22px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 104px;
    height: 104px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1f7a5c, #286fec);
    color: #fff;
    font-family: var(--mono);
    font-size: 38px;
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.brand strong {
    display: block;
    overflow: hidden;
    font-size: 48px;
    line-height: 1.05;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand span:not(.brand-mark) {
    display: block;
    margin-top: 10px;
    color: var(--muted);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.status-cluster {
    justify-content: end;
    gap: 14px;
}

.clock-box {
    min-width: 0;
    display: grid;
    justify-items: end;
    gap: 10px;
}

.clock-box strong {
    display: block;
    max-width: 100%;
    font-family: var(--mono);
    font-size: 64px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
}

.clock-box span {
    display: block;
    max-width: 100%;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 24px;
    white-space: nowrap;
}

.connection-pill,
.state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 148px;
    max-width: 100%;
    height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(104, 216, 255, .36);
    border-radius: 8px;
    background: rgba(104, 216, 255, .10);
    color: var(--cyan);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .05em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-pill::before,
.state-badge::before {
    content: "";
    width: 12px;
    height: 12px;
    margin-right: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 20px currentColor;
}

.connection-pill.waiting,
.state-badge.waiting {
    border-color: rgba(244, 195, 84, .42);
    background: rgba(244, 195, 84, .11);
    color: var(--amber);
}

.connection-pill.offline,
.state-badge.offline {
    border-color: rgba(255, 97, 117, .44);
    background: rgba(255, 97, 117, .10);
    color: var(--red);
}

.live-price-card {
    width: 100%;
    min-height: 100px;
    padding: 13px 18px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 18px;
    border: 1px solid rgba(104, 216, 255, .36);
    border-radius: 8px;
    background: rgba(104, 216, 255, .08);
}

.live-price-card span {
    color: var(--muted);
    font-size: 21px;
    font-weight: 900;
    letter-spacing: .08em;
}

.live-price-card strong {
    justify-self: end;
    overflow: hidden;
    color: var(--text);
    font-family: var(--mono);
    font-size: 48px;
    line-height: 1;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-price-card b {
    grid-column: 1 / -1;
    justify-self: end;
    overflow: hidden;
    max-width: 100%;
    margin-top: 6px;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 25px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-price-card em {
    grid-column: 1 / -1;
    justify-self: end;
    overflow: hidden;
    max-width: 100%;
    margin-top: 8px;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 19px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-price-card.up {
    border-color: rgba(41, 223, 145, .48);
    background: rgba(41, 223, 145, .09);
}

.live-price-card.down {
    border-color: rgba(255, 97, 117, .50);
    background: rgba(255, 97, 117, .09);
}

.live-price-card.up strong,
.live-price-card.up b,
.up {
    color: var(--green);
}

.live-price-card.down strong,
.live-price-card.down b,
.down {
    color: var(--red);
}

.live-price-card.beat {
    animation: live-price-beat .72s ease;
}

.metric-tape {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    min-width: 0;
    padding: 16px 18px;
    display: grid;
    align-content: center;
}

.metric-card span,
.score-card span,
.combo-card span,
.paper-totals span {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-card strong {
    display: block;
    overflow: hidden;
    margin-top: 12px;
    font-family: var(--mono);
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-card em,
.score-card em,
.combo-card em {
    display: block;
    overflow: hidden;
    margin-top: 7px;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 18px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: 960px 1540px 1240px;
    grid-template-rows: 900px minmax(0, 1fr);
    grid-template-areas:
        "signal chart right"
        "score activity right";
    gap: 18px;
}

.left-stack,
.middle-stack,
.right-stack {
    min-height: 0;
    display: grid;
    gap: 18px;
}

.left-stack {
    display: contents;
}

.middle-stack {
    display: contents;
}

.right-stack {
    grid-area: right;
    grid-template-rows: 526px minmax(0, 1fr);
}

.panel {
    min-width: 0;
    overflow: hidden;
}

.panel-head {
    min-height: 110px;
    padding: 22px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}

.compact-head {
    min-height: 92px;
    padding: 18px 22px;
}

.eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1;
    letter-spacing: 0;
}

h1 {
    font-size: 54px;
}

h2 {
    overflow: hidden;
    font-size: 34px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-panel {
    grid-area: chart;
    display: grid;
    grid-template-rows: 112px minmax(0, 1fr);
}

.chart-meta {
    min-width: 0;
    display: grid;
    justify-items: end;
    gap: 9px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 19px;
}

.chart-frame {
    position: relative;
    min-height: 0;
    margin: 10px 12px 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111722;
}

#tv-chart {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.chart-fallback {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: var(--faint);
    font-family: var(--mono);
    font-size: 28px;
}

.score-grid {
    grid-area: score;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 14px;
}

.score-card {
    min-width: 0;
    padding: 22px;
    display: grid;
    align-content: center;
}

.score-card.wide {
    grid-column: 1 / -1;
}

.score-card strong {
    display: block;
    overflow: hidden;
    margin-top: 12px;
    font-family: var(--mono);
    font-size: 38px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.five-minute-signals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.five-minute-card {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
}

.five-minute-card strong {
    margin-top: 0;
    font-size: 32px;
}

.five-minute-card em {
    font-size: 17px;
}

.signal-panel {
    grid-area: signal;
    display: grid;
    grid-template-rows: 112px 210px minmax(0, 1fr);
}

.combo-strip {
    padding: 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.combo-card {
    min-width: 0;
    padding: 22px 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
}

.combo-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 7px;
    background: var(--green);
}

.combo-card.red::before {
    background: var(--red);
}

.combo-card strong {
    display: block;
    overflow: hidden;
    margin-top: 18px;
    font-family: var(--mono);
    font-size: 50px;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bubble-grid {
    min-height: 0;
    padding: 0 18px 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.bubble {
    min-width: 0;
    padding: 18px;
    display: grid;
    align-content: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .032);
}

.bubble-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bubble-lamp {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--faint);
}

.bubble.on-green {
    border-color: rgba(41, 223, 145, .34);
    background: rgba(41, 223, 145, .055);
}

.bubble.on-red {
    border-color: rgba(255, 97, 117, .38);
    background: rgba(255, 97, 117, .055);
}

.bubble.on-green .bubble-lamp {
    background: var(--green);
    box-shadow: 0 0 28px var(--green);
}

.bubble.on-red .bubble-lamp {
    background: var(--red);
    box-shadow: 0 0 28px var(--red);
}

.bubble.signal-live,
.five-minute-card.signal-live {
    border-color: rgba(104, 216, 255, .42);
}

.bubble.signal-live .bubble-lamp {
    background: var(--cyan);
    box-shadow: 0 0 28px var(--cyan);
}

.bubble.signal-recent,
.five-minute-card.signal-recent {
    border-color: rgba(41, 223, 145, .30);
}

.bubble.signal-recent .bubble-lamp {
    background: var(--green);
}

.bubble.signal-stale,
.five-minute-card.signal-stale {
    border-color: rgba(244, 195, 84, .34);
    background: rgba(244, 195, 84, .035);
}

.bubble.signal-stale .bubble-lamp {
    background: var(--amber);
}

.bubble.signal-expired,
.five-minute-card.signal-expired {
    border-color: rgba(255, 97, 117, .24);
    background: rgba(255, 97, 117, .026);
}

.bubble.signal-expired .bubble-lamp {
    background: rgba(255, 97, 117, .62);
}

.bubble.signal-no-data,
.five-minute-card.signal-no-data {
    opacity: .74;
}

.bubble-symbol,
.bubble-price {
    overflow: hidden;
    font-family: var(--mono);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bubble-symbol {
    color: var(--text);
    font-size: 30px;
}

.bubble-price {
    font-size: 38px;
}

.bubble-state {
    overflow: hidden;
    color: var(--muted);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .06em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-panel {
    grid-area: activity;
    display: grid;
    grid-template-rows: 92px minmax(0, 1fr);
}

#activity-count,
#news-count,
#mover-count {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 900;
}

.activity-list,
.paper-list,
.news-list,
.mover-list,
.watch-list {
    min-height: 0;
    padding: 16px;
    display: grid;
    align-content: start;
    gap: 10px;
    overflow: hidden;
}

.activity-row,
.paper-row,
.news-row,
.mover-row,
.watch-row {
    min-width: 0;
    min-height: 64px;
    padding: 12px 14px;
    display: grid;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .032);
}

.activity-row {
    grid-template-columns: 112px 116px minmax(0, 1fr);
}

.activity-row span,
.activity-row strong,
.paper-row strong,
.paper-row span,
.paper-row em,
.news-row span,
.news-row strong,
.mover-row span,
.mover-row strong,
.watch-row span,
.watch-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-row span,
.paper-row span,
.news-row span,
.mover-row span,
.watch-row span {
    color: var(--muted);
    font-size: 18px;
}

.activity-row strong,
.paper-row strong,
.news-row strong,
.mover-row strong,
.watch-row strong {
    color: var(--text);
    font-size: 22px;
}

.activity-row span:first-child,
.paper-row em,
.mover-row em {
    font-family: var(--mono);
}

.paper-panel {
    display: grid;
    grid-template-rows: 92px 50px 116px minmax(0, 1fr);
}

.paper-session {
    margin: 12px 16px 0;
    padding: 10px 14px;
    border: 1px solid rgba(244, 195, 84, .22);
    border-radius: 8px;
    background: rgba(244, 195, 84, .07);
    color: var(--muted);
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paper-totals {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.paper-totals article {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
}

.paper-totals strong {
    display: block;
    overflow: hidden;
    margin-top: 9px;
    font-family: var(--mono);
    font-size: 28px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paper-list {
    padding-top: 0;
}

.paper-row {
    min-height: 58px;
    grid-template-columns: minmax(0, 1fr) 144px;
}

.paper-row strong {
    display: block;
    font-size: 20px;
}

.paper-row span {
    display: block;
    margin-top: 3px;
    font-size: 17px;
}

.paper-row em {
    justify-self: end;
    font-size: 21px;
    font-style: normal;
    font-weight: 900;
}

.intel-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
}

.news-list-panel {
    grid-row: 1 / -1;
    display: grid;
    grid-template-rows: 92px minmax(0, 1fr);
}

.mover-panel,
.watch-panel {
    display: grid;
    grid-template-rows: 92px minmax(0, 1fr);
}

.news-row {
    min-height: 72px;
    grid-template-columns: 72px minmax(0, 1fr);
}

.news-row strong {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.28;
}

.news-row span:first-child {
    justify-self: start;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    color: var(--amber);
    font-size: 16px;
    font-weight: 900;
}

.news-row span:first-child.sentiment-good,
.ticker-track em.sentiment-good {
    color: var(--green);
}

.news-row span:first-child.sentiment-bad,
.ticker-track em.sentiment-bad {
    color: var(--red);
}

.news-row span:first-child.sentiment-neutral,
.ticker-track em.sentiment-neutral {
    color: var(--amber);
}

.news-row span:first-child.sentiment-good {
    background: rgba(41, 223, 145, .10);
}

.news-row span:first-child.sentiment-bad {
    background: rgba(255, 97, 117, .10);
}

.news-row span:first-child.sentiment-neutral {
    background: rgba(244, 195, 84, .10);
}

.mover-row {
    min-height: 74px;
    grid-template-columns: 92px minmax(0, 1fr) 86px;
}

.mover-row strong {
    font-family: var(--mono);
    font-size: 24px;
}

.mover-row em {
    justify-self: end;
    font-size: 20px;
    font-style: normal;
    font-weight: 900;
}

.watch-row {
    min-height: 72px;
    grid-template-columns: 82px minmax(0, 1fr);
}

.watch-row strong {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.25;
}

.watch-row span:first-child {
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(120, 168, 255, .10);
    color: var(--blue);
    font-size: 16px;
    font-weight: 900;
    text-align: center;
}

.news-ticker-panel {
    min-width: 0;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    overflow: hidden;
}

.ticker-label {
    display: grid;
    place-items: center;
    border-right: 1px solid var(--line);
    background: rgba(104, 216, 255, .10);
    color: var(--cyan);
    font-size: 31px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ticker-window {
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.ticker-track {
    display: inline-flex;
    align-items: center;
    gap: 54px;
    white-space: nowrap;
    animation: ticker 96s linear infinite;
}

.ticker-track span {
    color: var(--text);
    font-size: 34px;
    font-weight: 800;
}

.ticker-track em {
    margin-right: 14px;
    color: var(--amber);
    font-style: normal;
}

.toast-stack {
    position: absolute;
    right: 54px;
    bottom: 250px;
    z-index: 30;
    width: 780px;
    display: grid;
    gap: 14px;
    pointer-events: none;
}

.toast {
    padding: 22px 26px;
    border: 1px solid var(--line-strong);
    border-left: 8px solid var(--cyan);
    border-radius: 8px;
    background: rgba(10, 13, 13, .98);
    box-shadow: 0 24px 64px rgba(0, 0, 0, .50);
    animation: toast-in .25s ease forwards, toast-out .28s ease forwards 5.6s;
}

.toast.good {
    border-left-color: var(--green);
}

.toast.bad {
    border-left-color: var(--red);
}

.toast strong {
    display: block;
    font-size: 28px;
}

.toast span {
    display: block;
    margin-top: 9px;
    color: var(--muted);
    font-size: 22px;
    line-height: 1.35;
}

.flash {
    animation: flash-value .9s ease;
}

.pulse {
    animation: pulse-card 1.1s ease;
}

.empty {
    padding: 24px;
    color: var(--faint);
    font-size: 22px;
    text-align: center;
}

@keyframes ticker {
    to {
        transform: translateX(-50%);
    }
}

@keyframes flash-value {
    0% {
        color: var(--amber);
        text-shadow: 0 0 30px rgba(244, 195, 84, .75);
    }
    100% {
        text-shadow: none;
    }
}

@keyframes live-price-beat {
    0% {
        box-shadow: 0 0 0 0 rgba(104, 216, 255, .35);
    }
    42% {
        box-shadow: 0 0 34px rgba(104, 216, 255, .34);
    }
    100% {
        box-shadow: none;
    }
}

@keyframes pulse-card {
    0% {
        box-shadow: inset 0 0 0 2px rgba(244, 195, 84, .72), 0 0 38px rgba(244, 195, 84, .30);
    }
    100% {
        box-shadow: none;
    }
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}
