/*
VOICE   trading desk terminal: calm, exact, nothing shouts except the walls
IDEA    an exchange depth ladder turned sideways: price on the right axis, money stacked at each strike
PICTURE candle chart with labelled put/call walls on the price axis + an OI profile hugging the axis
COLOUR  deep ink ground; put = coral, call = mint, max pain = amber, expected move = violet, one cobalt accent
TYPE    Pretendard, tabular numerals everywhere
*/
:root {
  --bg: #0a0e17; --bg2: #0d1220; --card: #111726; --card2: #161d2f; --line: #1f2739; --line2: #2a3550;
  --ink: #e8ecf4; --mute: #8a96ad; --dim: #5d6880;
  --put: #ff5c6c; --put-d: rgba(255, 92, 108, .14); --call: #2ed3a0; --call-d: rgba(46, 211, 160, .14);
  --mp: #ffc247; --em: #a78bfa; --acc: #5b8cff; --acc-d: rgba(91, 140, 255, .14);
  --r: 14px; --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
html { scroll-padding-top: 70px; -webkit-text-size-adjust: 100%; }
body { font: 14px/1.5 'Pretendard Variable', Pretendard, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; overflow-x: clip; -webkit-font-smoothing: antialiased; }
b, td, .kpi b, .chip b, .wl .v { font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.up { color: var(--call); } .dn { color: var(--put); } .mp { color: var(--mp); } .mute { color: var(--mute); font-weight: 500; }
.warn { color: var(--mp); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

/* header */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px max(2.2vw, 14px); padding-top: max(10px, env(safe-area-inset-top)); background: rgba(10, 14, 23, .82); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.live { margin-left: auto; display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--mute); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--call); animation: pulse 2.4s infinite; }
.dot.warn { background: var(--mp); animation: none; } .dot.err { background: var(--put); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46, 211, 160, .5); } 70% { box-shadow: 0 0 0 7px rgba(46, 211, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 211, 160, 0); } }
.icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--mute); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.icon:hover { color: var(--ink); border-color: var(--line2); }
.icon:active { transform: scale(.94); }
.btn { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card2); cursor: pointer; white-space: nowrap; font-weight: 600; transition: background .2s, border-color .2s; }
.btn:hover { border-color: var(--acc); }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 40; pointer-events: none; overflow: hidden; }
.progress::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--acc), transparent); transform: translateX(-100%); opacity: 0; }
body:has(#app.loading) .progress::after { opacity: 1; animation: load 1.1s var(--ease) infinite; }
@keyframes load { to { transform: translateX(100%); } }

/* ticker strip */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px max(2.2vw, 14px); border-bottom: 1px solid var(--line); scrollbar-width: none; background: var(--bg2); }
.strip::-webkit-scrollbar { display: none; }
.strip:empty { min-height: 47px; }
.chip { flex: none; display: flex; gap: 7px; align-items: baseline; padding: 6px 11px; border-radius: 9px; background: transparent; border: 1px solid var(--line); cursor: pointer; font-size: 12.5px; white-space: nowrap; transition: border-color .2s, background .2s; }
.chip:hover { background: var(--card); border-color: var(--line2); }
.chip span { color: var(--mute); } .chip em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }

main { padding: 14px max(2.2vw, 14px) 48px; max-width: 1680px; margin: 0 auto; display: grid; gap: 14px; }

/* asset bar */
.bar { display: flex; gap: 10px; align-items: center; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; height: 34px; padding: 0 13px; border-radius: 9px; border: 0; background: transparent; color: var(--mute); cursor: pointer; font-weight: 700; transition: background .25s var(--ease), color .2s; }
.tab small { font-weight: 500; margin-left: 5px; opacity: .8; }
.tab:hover { color: var(--ink); }
.tab.on { background: var(--acc); color: #fff; box-shadow: 0 4px 14px rgba(91, 140, 255, .35); }
.sep { flex: none; width: 1px; margin: 7px 3px; background: var(--line2); }
.search { display: flex; gap: 6px; flex: 0 1 300px; }
.search input { flex: 1; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 16px; text-transform: uppercase; transition: border-color .2s; }
.search input::placeholder { text-transform: none; color: var(--dim); font-size: 14px; }
.search input:focus { border-color: var(--acc); outline: none; }

/* hero sentence */
.hero { display: grid; gap: 4px; padding: 2px 2px 0; }
.hero h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.1; letter-spacing: -.025em; font-weight: 800; }
.hero h1 span { color: var(--mute); font-weight: 600; font-size: .62em; margin-left: 6px; letter-spacing: -.01em; }
.hero p { margin: 0; color: #c6cede; font-size: clamp(14px, 1.3vw, 16px); min-height: 24px; text-wrap: balance; }
.dotsep { color: var(--dim); margin: 0 9px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; transition: border-color .3s; animation: rise .4s var(--ease) both; }
.kpi:hover { border-color: var(--line2); }
.kpi label { display: block; color: var(--mute); font-size: 12px; margin-bottom: 3px; }
.kpi b { display: block; font-size: clamp(18px, 1.7vw, 23px); font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi em { display: block; font-style: normal; color: var(--mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .kpi, .wl { animation: none !important; } .dot { animation: none; } }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ch { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ch h2 { margin: 0; font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.hint { color: var(--mute); font-size: 12px; }
.grow { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 0 11px; height: 28px; border-radius: 7px; cursor: pointer; color: var(--mute); white-space: nowrap; font-weight: 600; font-size: 13px; transition: background .2s var(--ease), color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card2); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 8px rgba(0, 0, 0, .25); }
.seg button.on.p { color: var(--put); background: var(--put-d); } .seg button.on.c { color: var(--call); background: var(--call-d); }
.seg.sm button { height: 26px; padding: 0 9px; font-size: 12.5px; }
.popwrap { position: relative; }
.pop { position: absolute; right: 0; top: 42px; z-index: 20; width: 270px; padding: 14px; display: grid; gap: 12px; background: #141b2c; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5); animation: rise .18s var(--ease); }
.pop[hidden] { display: none; }
.pop label { display: grid; gap: 5px; font-size: 12.5px; color: var(--mute); }
.pop label.chk { display: flex; align-items: center; gap: 8px; color: var(--ink); cursor: pointer; }
.pop input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc); }
select { height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg); padding: 0 10px; color: var(--ink); font-size: 14px; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.chartbox { position: relative; height: min(64vh, 620px); min-height: 380px; }
.chartbox #chart { position: absolute; inset: 0; }
.chartbox canvas.ov { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.legend { position: absolute; left: 12px; top: 10px; z-index: 4; font-size: 12px; color: var(--mute); pointer-events: none; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.legend .lh { color: var(--ink); font-size: 13px; padding: 3px 8px; border-radius: 7px; background: rgba(10, 14, 23, .7); }
.sw { display: inline-block; width: 10px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); z-index: 5; text-align: center; padding: 20px; background: var(--card); }
.empty[hidden] { display: none; }
.empty b { color: var(--ink); } .empty p { margin: 6px 0 14px; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--acc); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* expiry chips */
.exps { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; border-bottom: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.exps:empty { display: none; }
.exps button { position: relative; flex: none; display: flex; align-items: baseline; gap: 5px; border: 1px solid var(--line); background: var(--bg); color: var(--mute); border-radius: 9px; padding: 5px 10px 7px; cursor: pointer; font-size: 12.5px; white-space: nowrap; overflow: hidden; transition: border-color .2s, color .2s, background .2s; }
.exps button span { font-weight: 700; }
.exps button small { color: var(--dim); font-size: 11px; }
.exps button i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--line2); transition: background .2s; }
.exps button:hover { color: var(--ink); }
.exps button.on { color: var(--ink); border-color: var(--acc); background: var(--acc-d); }
.exps button.on i { background: var(--acc); }

/* wall list */
.walls { position: sticky; top: 72px; }
.wallist { max-height: calc(min(64vh, 620px) + 52px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.wl { display: grid; grid-template-columns: 38px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 14px 8px; border-bottom: 1px solid var(--line); animation: rise .35s var(--ease) both; }
.wl:last-child { border-bottom: 0; }
.wl:hover { background: var(--card2); }
.wl .tag { font-size: 11px; font-weight: 800; padding: 3px 0; border-radius: 6px; text-align: center; }
.wl .tag.p { background: var(--put-d); color: var(--put); } .wl .tag.c { background: var(--call-d); color: var(--call); }
.wl .k { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.wl .k .mute { font-size: 12px; margin-left: 2px; }
.wl .k small { display: block; font-weight: 500; color: var(--mute); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl .v { text-align: right; font-weight: 800; white-space: nowrap; }
.wl .v small { display: block; color: var(--mute); font-weight: 500; font-size: 11.5px; }
.wl .bar { grid-column: 1 / -1; height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.wl .bar i { display: block; height: 100%; border-radius: 2px; transition: width .5s var(--ease); }
.none { color: var(--mute); padding: 20px 14px; margin: 0; }

/* strike chart */
.sbox { position: relative; height: 330px; }
.sbox canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.tip { position: absolute; z-index: 6; pointer-events: none; background: rgba(12, 17, 30, .96); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; font-size: 12px; min-width: 190px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.tip[hidden] { display: none; }
.tip h4 { margin: 0 0 6px; font-size: 14px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; white-space: nowrap; line-height: 1.6; }
.tip .sub { color: var(--mute); font-size: 11px; line-height: 1.2; margin-bottom: 2px; }
.tip hr { border: 0; border-top: 1px solid var(--line2); margin: 7px 0; }

/* table */
.two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; }
.scroll { overflow-x: auto; }
.tablewrap { max-height: 330px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { color: var(--mute); font-weight: 600; font-size: 12px; position: sticky; top: 0; background: var(--card); z-index: 1; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; }
th:first-child { z-index: 2; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover, tbody tr:hover td:first-child { background: var(--card2); }
tbody tr.on, tbody tr.on td:first-child { background: #17213a; }
.cell { display: inline-flex; align-items: center; gap: 6px; }
.pb { display: inline-block; height: 5px; border-radius: 3px; min-width: 2px; }

/* sources */
.sources { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; }
.src { display: flex; gap: 8px; align-items: center; padding: 7px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; cursor: pointer; transition: opacity .2s, border-color .2s; }
.src:disabled { cursor: default; }
.src:not(:disabled):hover { border-color: var(--line2); }
.src span { color: var(--mute); }
.src.off { opacity: .45; }
.src i { width: 8px; height: 8px; border-radius: 50%; background: var(--call); }
.src.bad i { background: var(--put); } .src.off i { background: var(--dim); }
.srcmeta { color: var(--dim); font-size: 12px; margin-left: auto; }
.foot { color: var(--dim); font-size: 12.5px; line-height: 1.7; padding: 0 2px; max-width: 980px; }
.foot p { margin: 0 0 6px; } .foot b { color: var(--mute); }

/* skeleton + toast */
.sk { display: inline-block; height: 1em; border-radius: 6px; background: linear-gradient(90deg, var(--card2) 0%, #1d2740 50%, var(--card2) 100%); background-size: 200% 100%; animation: sh 1.3s linear infinite; vertical-align: middle; }
@keyframes sh { to { background-position: -200% 0; } }
.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 50; max-width: min(92vw, 520px); padding: 11px 16px; border-radius: 12px; background: #1b2338; border: 1px solid var(--line2); color: var(--ink); font-size: 13.5px; box-shadow: 0 14px 34px rgba(0, 0, 0, .5); opacity: 0; transition: opacity .3s, transform .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1240px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid { grid-template-columns: minmax(0, 1fr); } .walls { position: static; } .wallist { max-height: 420px; } .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  main { gap: 12px; padding-top: 12px; }
  .bar { flex-direction: column; align-items: stretch; }
  .search { flex: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .chartbox { height: 60vh; min-height: 360px; }
  .toolbar { gap: 6px; padding: 8px; }
  .seg button { padding: 0 8px; font-size: 12.5px; }
  .legend .lk { display: none; }
  .sbox { height: 280px; }
  th, td { padding: 7px 8px; font-size: 12px; }
  .live span { display: none; }
  .srcmeta { margin-left: 0; width: 100%; }
  .dotsep { display: block; height: 0; overflow: hidden; margin: 0; }
}
