:root {
  color-scheme: dark;
  --bg: #071016;
  --panel: #0c171e;
  --panel-2: #101d25;
  --line: #1d303a;
  --line-soft: rgba(158, 190, 203, .12);
  --text: #ecf5f5;
  --muted: #88a0aa;
  --cyan: #28d7bd;
  --cyan-2: #7cead8;
  --orange: #ffad32;
  --yellow: #f8d84a;
  --green: #42d678;
  --purple: #c65cf5;
  --blue: #4a8cff;
  --red: #ff6174;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 66% -10%, rgba(40, 215, 189, .08), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button { font: inherit; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 99; background: var(--text); color: #061015; padding: .6rem 1rem; border-radius: .4rem; }
.skip-link:focus { top: 1rem; }
.topbar {
  height: 68px;
  padding: 0 clamp(1rem, 2.2vw, 2.3rem);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 16, 22, .9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: .75rem; letter-spacing: .04em; }
.brand-mark { width: 36px; height: 36px; border: 1px solid rgba(40, 215, 189, .5); border-radius: 10px; display: grid; place-items: center; background: rgba(40, 215, 189, .07); transform: rotate(45deg); }
.brand-mark span { display: block; width: 12px; height: 12px; border: 2px solid var(--orange); border-radius: 3px; }
.brand strong { display: block; font-size: .95rem; }
.brand small { display: block; color: var(--muted); font-size: .68rem; letter-spacing: .13em; }
.top-status { display: flex; align-items: center; gap: 1.25rem; color: var(--muted); font-size: .82rem; }
.mode-pill { border: 1px solid rgba(40,215,189,.28); background: rgba(40,215,189,.07); color: var(--cyan-2); padding: .4rem .7rem; border-radius: 999px; }
.mode-pill i, .connection i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); margin-right: .4rem; box-shadow: 0 0 12px var(--cyan); }
.connection i { background: var(--orange); box-shadow: none; }
.connection.live { color: var(--cyan-2); }
.connection.live i { background: var(--cyan); box-shadow: 0 0 10px rgba(40,215,189,.65); }
.connection.stale { color: var(--orange); }
.dashboard { width: min(1880px, 100%); margin: 0 auto; padding: 1.3rem clamp(1rem, 2.2vw, 2.3rem) 2rem; }
.market-strip { display: flex; justify-content: space-between; align-items: end; margin-bottom: 1rem; }
.eyebrow, .panel-kicker { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.price-row { display: flex; align-items: baseline; gap: .8rem; margin-top: .1rem; }
.price-row strong { font-variant-numeric: tabular-nums; font-size: clamp(1.65rem, 2.5vw, 2.4rem); line-height: 1.1; letter-spacing: -.04em; }
.positive { color: var(--cyan-2) !important; }
.negative { color: var(--red); }
.freshness-group { display: flex; gap: 2.4rem; }
.freshness-group div { display: grid; gap: .12rem; }
.freshness-group span { color: var(--muted); font-size: .75rem; }
.freshness-group strong { font-size: .88rem; font-variant-numeric: tabular-nums; }
.panel { background: linear-gradient(145deg, rgba(16, 29, 37, .96), rgba(10, 21, 28, .98)); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 60px rgba(0, 0, 0, .16); }
.workspace { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(320px, .8fr); gap: 1rem; }
.chart-panel { min-width: 0; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line-soft); }
.panel-head h1, .panel-head h2 { margin: .15rem 0 0; font-size: 1rem; letter-spacing: -.01em; }
.panel-head p { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; }
.chart-head { align-items: center; }
.range-tabs { display: flex; gap: .25rem; background: rgba(0,0,0,.2); padding: .25rem; border-radius: 8px; }
.range-tabs button { appearance: none; border: 0; background: transparent; color: var(--muted); padding: .4rem .65rem; border-radius: 6px; cursor: pointer; font-size: .76rem; }
.range-tabs button:hover { color: var(--text); }
.range-tabs button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.range-tabs button.active { background: #1b3039; color: var(--text); }
.chart-info-shell { display: flex; align-items: center; gap: .75rem; min-height: 70px; padding: .55rem 1rem; border-bottom: 1px solid var(--line-soft); background: #0a151c; }
.chart-info-main { min-width: 0; flex: 1; display: grid; gap: .38rem; }
.chart-info-shell.collapsed { min-height: 38px; justify-content: flex-end; padding-top: .3rem; padding-bottom: .3rem; }
.chart-info-shell.collapsed .chart-info-main { display: none; }
.chart-info-toggle { flex: 0 0 auto; align-self: flex-start; border: 1px solid #28424e; border-radius: 5px; background: #101f27; color: #9db2bb; padding: .35rem .6rem; cursor: pointer; font-size: .7rem; }
.chart-info-toggle:hover { color: var(--text); border-color: #3b5e6d; }
.chart-info-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.chart-wrap { position: relative; height: 500px; border-bottom: 1px solid var(--line-soft); background: linear-gradient(rgba(255,255,255,.012), transparent); overflow: hidden; }
#marketChart { width: 100%; height: 100%; display: block; }
#cloudOverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.trade-tooltip { position: absolute; z-index: 8; display: none; min-width: 168px; max-width: 240px; padding: .6rem .7rem; border: 1px solid #36515d; border-radius: 7px; background: rgba(6, 15, 20, .96); box-shadow: 0 10px 28px rgba(0,0,0,.38); pointer-events: none; color: var(--text); font-size: .72rem; line-height: 1.45; }
.trade-tooltip.visible { display: block; }
.trade-tooltip strong { display: block; margin-bottom: .18rem; font-size: .78rem; }
.trade-tooltip span { display: block; color: var(--muted); font-variant-numeric: tabular-nums; }
.trade-tooltip .positive { color: #62ddbc; }
.trade-tooltip .negative { color: #ff7284; }
.crosshair-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .85rem; min-height: 28px; color: var(--muted); font-size: .72rem; pointer-events: none; }
.crosshair-legend strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
#legendCloud { flex-basis: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .75rem; font-size: .7rem; color: var(--muted); pointer-events: none; }
.legend span { display: flex; align-items: center; gap: .3rem; }
.legend i { width: 14px; height: 3px; display: inline-block; border-radius: 2px; }
.line-price { background: var(--cyan); }
.cloud-orange { background: var(--orange); }
.cloud-yellow { background: var(--yellow); }
.cloud-green { background: var(--green); }
.cloud-blue { background: var(--blue); }
.cloud-purple { background: var(--purple); }
.line-target { background: var(--blue); }
.trade-buy, .trade-sell { width: 8px !important; height: 8px !important; border-radius: 50% !important; }
.trade-buy { background: #82e6a8; }
.trade-sell { background: #ff5b70; }
.chart-tools { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 1.2rem; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: .69rem; }
.chart-tools div { display: flex; gap: .35rem; }
.chart-tools .chart-context { display: grid; gap: .05rem; }
.chart-context small { color: #607d89; font-size: .64rem; }
.chart-tools button { border: 1px solid #28424e; border-radius: 5px; background: #101f27; color: #9db2bb; padding: .35rem .6rem; cursor: pointer; font-size: .69rem; }
.chart-tools button:hover { color: var(--text); border-color: #3b5e6d; }
.chart-tools button.active { color: var(--cyan-2); border-color: rgba(40,215,189,.3); background: rgba(40,215,189,.07); }
.chart-tools button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.decision-track { padding: .85rem 1.2rem 1rem; }
.track-labels, .track-times { display: flex; justify-content: space-between; color: var(--muted); font-size: .68rem; }
.track-bar { height: 25px; display: flex; overflow: hidden; border-radius: 5px; margin: .45rem 0 .25rem; background: #0a141b; }
.track-bar .state { display: grid; place-items: center; color: rgba(255,255,255,.85); font-size: .65rem; border-right: 1px solid rgba(0,0,0,.2); white-space: nowrap; overflow: hidden; }
.state.monitor { background: #28414d; }.state.ready { background: #9b6e17; }.state.open { background: #157c6e; }.state.protect { background: #6d3e8b; }
.decision-panel { overflow: hidden; }
.decision-hero { padding: 1.2rem; border-bottom: 1px solid var(--line-soft); background: radial-gradient(circle at 95% 0%, rgba(255,173,50,.1), transparent 13rem); }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; margin-right: .4rem; }
.status-dot.amber { background: var(--orange); box-shadow: 0 0 12px rgba(255,173,50,.5); }
.decision-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: .7rem; margin-top: .65rem; }
.decision-title-row h2 { font-size: 1.55rem; margin: 0; letter-spacing: -.04em; }
.decision-title-row p { margin: .05rem 0 0; color: var(--orange); font-size: .82rem; }
.side-badge { font-size: .7rem; padding: .35rem .55rem; border-radius: 5px; font-weight: 700; }
.side-badge.short { color: #ffc6cd; background: rgba(255,97,116,.12); border: 1px solid rgba(255,97,116,.24); }
.side-badge.long { color: #9bf3e4; background: rgba(40,215,189,.11); border: 1px solid rgba(40,215,189,.24); }
.side-badge.wait { color: #c4d4db; background: rgba(113,144,159,.12); border: 1px solid rgba(113,144,159,.24); }
.score-wrap { margin-top: 1.2rem; }
.score-label { display: flex; align-items: baseline; justify-content: space-between; color: var(--muted); font-size: .76rem; }
.score-label strong { color: var(--text); font-size: 1rem; font-variant-numeric: tabular-nums; }
.score-bar { height: 5px; margin: .4rem 0; border-radius: 10px; background: #192932; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #ffd17c); border-radius: inherit; }
.score-wrap small { font-size: .67rem; color: var(--muted); }
.decision-facts { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line-soft); }
.decision-facts div { padding: .8rem 1.1rem; display: grid; gap: .15rem; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.decision-facts div:nth-child(even) { border-right: 0; }
.decision-facts div:nth-child(n+3) { border-bottom: 0; }
.decision-facts span { color: var(--muted); font-size: .7rem; }.decision-facts strong { font-size: .84rem; }.decision-facts .low { color: var(--orange); }
.reason-card { margin: 1rem; padding: .9rem; border-radius: 9px; }
.reason-card.warning { border: 1px solid rgba(255,173,50,.22); background: rgba(255,173,50,.07); }
.reason-card span, .next-check span { display: block; color: var(--orange); font-size: .7rem; font-weight: 700; margin-bottom: .3rem; }
.reason-card strong { font-size: .88rem; line-height: 1.45; }.reason-card p, .next-check p { color: var(--muted); font-size: .75rem; line-height: 1.55; margin: .35rem 0 0; }
.next-check { padding: 0 1.1rem 1rem; }
.next-check span { color: var(--cyan-2); }
.route-list { border-top: 1px solid var(--line-soft); padding: .65rem 1rem .8rem; }
.route-row { display: flex; justify-content: space-between; align-items: center; padding: .5rem .4rem; color: var(--muted); font-size: .72rem; }
.route-row strong { color: var(--text); font-variant-numeric: tabular-nums; }
.route-row.primary { color: var(--text); background: rgba(255,255,255,.025); border-radius: 6px; }
.lower-grid { display: grid; grid-template-columns: 1.08fr 1fr .84fr; gap: 1rem; margin-top: 1rem; }
.position-card, .event-card, .health-card { min-width: 0; }
.live-tag { color: var(--cyan-2); background: rgba(40,215,189,.08); border: 1px solid rgba(40,215,189,.18); font-size: .7rem; padding: .25rem .5rem; border-radius: 5px; }
.position-return-guide { margin: .18rem 0 0; color: var(--muted); font-size: .67rem; }
.position-values { display: grid; grid-template-columns: 1fr 1fr 1.25fr; border-bottom: 1px solid var(--line-soft); }
.position-values div { display: grid; gap: .15rem; padding: .8rem 1rem; border-right: 1px solid var(--line-soft); }
.position-values div:last-child { border-right: 0; }
.position-values span { color: var(--muted); font-size: .68rem; }.position-values strong { font-size: .86rem; font-variant-numeric: tabular-nums; }
.levels { padding: .75rem 1rem .45rem; display: grid; gap: .35rem; }
.level { display: grid; grid-template-columns: 1fr auto minmax(92px, auto); align-items: center; gap: .8rem; padding: .48rem .6rem; border-left: 3px solid #3c5360; background: rgba(255,255,255,.02); font-size: .73rem; }
.level strong { font-variant-numeric: tabular-nums; }.level em { color: var(--muted); font-size: .67rem; font-style: normal; text-align: right; }
.level.stop { border-left-color: var(--red); }.level.current { border-left-color: var(--cyan); }.level.target { border-left-color: var(--blue); }
.target-note { display: flex; gap: .5rem; padding: .55rem 1rem 1rem; color: var(--muted); font-size: .69rem; }
.target-note i { flex: 0 0 auto; width: 6px; height: 6px; margin-top: .35rem; border-radius: 50%; background: var(--blue); }
.text-button { border: 0; background: none; color: var(--cyan-2); cursor: pointer; font-size: .7rem; padding: .2rem; }
.text-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.event-list { list-style: none; padding: .75rem 1rem 1rem; margin: 0; }
.event-list li { display: grid; grid-template-columns: 72px 12px 1fr; gap: .55rem; padding: .55rem 0; align-items: flex-start; }
.event-list time { color: var(--muted); font-size: .66rem; font-variant-numeric: tabular-nums; padding-top: .08rem; }
.event-list strong { display: block; font-size: .76rem; }.event-list p { margin: .05rem 0 0; color: var(--muted); font-size: .68rem; }
.event-icon { width: 9px; height: 9px; border-radius: 50%; margin-top: .25rem; position: relative; }
.event-icon::after { content: ""; position: absolute; top: 9px; left: 4px; height: 36px; width: 1px; background: var(--line); }
.event-list li:last-child .event-icon::after { display: none; }
.event-icon.reject { background: var(--orange); }.event-icon.ready { background: var(--cyan); }.event-icon.watch { background: #71909f; }.event-icon.protect { background: var(--purple); }
.event-list .extra { display: none; }.event-list.expanded .extra { display: grid; }
.health-pulse { width: 10px; height: 10px; margin-top: .4rem; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 0 5px rgba(40,215,189,.08), 0 0 16px rgba(40,215,189,.4); }
.health-pulse.error { background: var(--red); box-shadow: 0 0 0 5px rgba(239,83,104,.08), 0 0 16px rgba(239,83,104,.35); }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; }
.health-grid div { display: grid; gap: .05rem; padding: .8rem 1rem; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.health-grid div:nth-child(even) { border-right: 0; }
.health-grid span, .safety-list span { color: var(--muted); font-size: .68rem; }.health-grid strong { font-size: 1rem; font-variant-numeric: tabular-nums; }.health-grid small { color: #5f7b87; font-size: .63rem; }
.safety-list { padding: .65rem 1rem .9rem; }
.safety-list div { display: flex; justify-content: space-between; padding: .42rem .25rem; font-size: .72rem; }.safety-list strong { color: var(--cyan-2); }
footer { display: flex; justify-content: space-between; gap: 1rem; color: #66808c; font-size: .68rem; padding: 1.1rem .2rem 0; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .decision-panel { display: grid; grid-template-columns: 1.15fr .85fr; }
  .decision-hero, .decision-facts { border-bottom: 0; }
  .decision-facts { align-content: start; }
  .reason-card, .next-check, .route-list { grid-column: span 2; }
  .lower-grid { grid-template-columns: 1fr 1fr; }
  .health-card { grid-column: span 2; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 64px; padding-top: .65rem; padding-bottom: .65rem; }
  .connection, .top-status time { display: none; }
  .mode-pill { font-size: .68rem; }
  .market-strip { align-items: flex-start; gap: 1rem; }
  .freshness-group { gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
  .freshness-group div:nth-child(3) { display: none; }
  .chart-head { align-items: flex-start; flex-direction: column; }
  .chart-wrap { height: 420px; }
  .chart-tools { align-items: flex-start; flex-direction: column; }
  .chart-info-shell { align-items: flex-start; }
  .decision-panel { display: block; }
  .reason-card, .next-check, .route-list { grid-column: auto; }
  .lower-grid { grid-template-columns: 1fr; }
  .health-card { grid-column: auto; }
  .position-values { grid-template-columns: 1fr 1fr; }
  .position-values div:nth-child(2) { border-right: 0; }
  .position-values div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .position-values div:last-child { grid-column: span 2; }
  footer { flex-direction: column; }
}
@media (max-width: 470px) {
  .brand small { display: none; }
  .dashboard { padding-left: .7rem; padding-right: .7rem; }
  .market-strip { display: block; }
  .freshness-group { justify-content: flex-start; margin-top: .8rem; }
  .range-tabs { width: 100%; }.range-tabs button { flex: 1; }
  .chart-wrap { height: 380px; }
  .chart-info-shell { padding-left: .7rem; padding-right: .7rem; }
  .crosshair-legend { flex-wrap: wrap; gap: .25rem .7rem; }
  .legend { gap: .5rem .7rem; }
  .decision-title-row h2 { font-size: 1.35rem; }
  .level { grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .7rem; }
  .level em { display: block; grid-column: 2; justify-self: end; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
