/* Pretendard (OFL, see fonts/Pretendard-LICENSE.txt) — same font as the Android app. */
@font-face { font-family: "Pretendard"; font-weight: 400; font-display: swap; src: url("fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 500 600; font-display: swap; src: url("fonts/Pretendard-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 700 900; font-display: swap; src: url("fonts/Pretendard-Bold.woff2") format("woff2"); }

:root {
  --bg: #f2f4f6;
  --card: #ffffff;
  --text: #191f28;
  --sub: #4e5968;
  --line: #e5e8eb;
  --field: #f2f4f6;
  --primary: #00a878;
  --primary-ink: #ffffff;
  --primary-soft: #dff6ee;
  --up: #f04452;
  --down: #3182f6;
  --ok: #15803d;
  --warn: #b45309;
  --err: #c2410c;
  --muted: #6b7684;
  --shadow: 0 2px 8px rgba(0, 27, 55, 0.05);
  --chip-ok-bg: #dcfce7; --chip-ok: #14532d;
  --chip-warn-bg: #fef3c7; --chip-warn: #78350f;
  --chip-err-bg: #fee2e2; --chip-err: #7f1d1d;
  --chip-info-bg: #dbeafe; --chip-info: #1e3a8a;
  --chip-idle-bg: #eef1f5; --chip-idle: #374151;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e11;
    --card: #1e2329;
    --text: #eaecef;
    --sub: #b7bdc6;
    --line: #2b3139;
    --field: #2b3139;
    --primary: #3ddca6;
    --primary-ink: #03241a;
    --primary-soft: #123528;
    --up: #f6465d;
    --down: #4a9fff;
    --ok: #4ade80;
    --warn: #fbbf24;
    --err: #fb923c;
    --muted: #848e9c;
    --shadow: none;
    --chip-ok-bg: #12351f; --chip-ok: #bbf7d0;
    --chip-warn-bg: #3d2c08; --chip-warn: #fde68a;
    --chip-err-bg: #3f1414; --chip-err: #fecaca;
    --chip-info-bg: #13274a; --chip-info: #bfdbfe;
    --chip-idle-bg: #22262d; --chip-idle: #d1d5db;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0e11;
  --card: #1e2329;
  --text: #eaecef;
  --sub: #b7bdc6;
  --line: #2b3139;
  --field: #2b3139;
  --primary: #3ddca6;
  --primary-ink: #03241a;
  --primary-soft: #123528;
  --up: #f6465d;
  --down: #4a9fff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #fb923c;
  --muted: #848e9c;
  --shadow: none;
  --chip-ok-bg: #12351f; --chip-ok: #bbf7d0;
  --chip-warn-bg: #3d2c08; --chip-warn: #fde68a;
  --chip-err-bg: #3f1414; --chip-err: #fecaca;
  --chip-info-bg: #13274a; --chip-info: #bfdbfe;
  --chip-idle-bg: #22262d; --chip-idle: #d1d5db;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.sub { color: var(--sub); font-size: 14px; }
.muted { color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-size: 22px; font-weight: 800; letter-spacing: -0.6px; color: var(--text); text-decoration: none; }
.brand b { color: var(--primary); font-weight: 800; }
.brand-mark { width: 32px; height: 26px; flex: none; }
.mode { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.mode.paper { background: var(--chip-warn-bg); color: var(--chip-warn); }
.mode.live { background: var(--chip-err-bg); color: var(--chip-err); }
.mode[hidden] { display: none; }
.top-right { display: flex; align-items: center; gap: 8px; }

.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(700px, calc(100% - 24px)); display: flex; background: var(--card); border-radius: 22px;
  box-shadow: 0 4px 18px rgba(20, 30, 60, 0.12); padding: 6px; z-index: 20;
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 12px; color: var(--muted); border-radius: 16px; }
.bottom-nav a svg { width: 22px; height: 22px; fill: currentColor; }
.bottom-nav a.on { color: var(--primary); background: var(--field); }

main { padding: 0 12px; }
.card { background: var(--card); border-radius: 14px; padding: 16px; margin: 10px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 15px; }
.kv > :last-child { font-weight: 600; }
.kv span:first-child { color: var(--sub); }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 14px; color: var(--sub); font-weight: 700; margin: 20px 4px 8px; }

.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 -12px; padding: 0 12px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.tabs button { flex: 1; background: none; border: 0; padding: 12px 0 10px; color: var(--sub); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button.on { color: var(--primary); border-color: var(--primary); }
.seg { display: flex; gap: 6px; margin: 10px 0; }
.seg button { flex: 1; border: 0; border-radius: 10px; padding: 9px 0; background: var(--field); color: var(--sub); font-weight: 600; }
.seg button.on { background: var(--primary); color: var(--primary-ink); }

.search { width: 100%; border: 0; border-radius: 12px; background: var(--card); padding: 12px 14px; font: inherit; color: var(--text); margin: 6px 0; box-shadow: var(--shadow); }
.mkt { display: grid; grid-template-columns: 1fr auto auto 28px; gap: 10px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.mkt:last-child { border-bottom: 0; }
.mkt .r { text-align: right; }
.mkt .name { font-weight: 600; }
.star { background: none; border: 0; font-size: 18px; color: var(--line); padding: 0; }
.star.on { color: #f5b301; }
.mkt-head { display: grid; grid-template-columns: 1fr auto auto 28px; gap: 10px; font-size: 12px; color: var(--sub); padding: 6px 4px; }

.legend { display: flex; gap: 12px; font-size: 12px; color: var(--sub); align-items: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.badges { display: flex; gap: 4px; }
.badge { min-width: 30px; text-align: center; color: #fff; font-weight: 700; border-radius: 4px; padding: 2px 6px; font-size: 14px; }
.b-total { background: #15803d; } .b-wait { background: #4b5563; } .b-active { background: #b45309; } .b-err { background: #b91c1c; }

.toggles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 12px; color: var(--sub); }
.sw { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; } /* 긴 설명 옆에서 줄어들지 않게 */
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: var(--line); border-radius: 26px; transition: 0.15s; }
.sw span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--ok); }
.sw input:checked + span::before { transform: translateX(18px); }
.sw input:disabled + span { opacity: 0.5; }

.fab { position: fixed; right: max(16px, calc(50% - 344px)); bottom: calc(92px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--primary); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 16px rgba(0, 168, 120, 0.35); z-index: 15; }

.empty { text-align: center; color: var(--sub); padding: 36px 0; }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 15px; }
.btn.ghost { background: var(--field); color: var(--text); }
.btn.danger { background: #fde8e8; color: #c62828; }
.btn.sm { display: inline-block; width: auto; padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

label.f { display: block; font-size: 13px; color: var(--sub); margin: 12px 0 5px; }
.field { width: 100%; border: 0; background: var(--field); border-radius: 10px; padding: 12px; font: inherit; color: var(--text); }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--sub) 50%), linear-gradient(135deg, var(--sub) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.f-head { display: flex; justify-content: space-between; align-items: center; margin: 12px 0 5px; font-size: 13px; color: var(--sub); }
.unit { border: 0; background: var(--primary); color: var(--primary-ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; } /* 설명 글이 스위치에 붙지 않게 */
.opt .desc { font-size: 12px; color: var(--sub); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.tier { border-radius: 12px; }
.st { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: #fff; }
.st-waitforbuy { background: #8e96a8; } .st-buyorder { background: #e77b2e; } .st-bought { background: #3b6cf6; } .st-sellorder { background: #8a4fe0; } .st-complete { background: #22b357; }
.st-error { background: #e5383b; }
.pill { display: inline-block; font-size: 12px; border-radius: 999px; padding: 3px 9px; background: var(--field); color: var(--sub); margin: 0 4px 4px 0; }
.pill.on { background: var(--chip-ok-bg); color: var(--chip-ok); font-weight: 700; }
.errline { background: var(--field); border-radius: 8px; padding: 6px 10px; font-size: 13px; margin-top: 8px; color: var(--up); }
.menu-btn { background: none; border: 0; font-size: 20px; padding: 0 4px; color: var(--sub); }

.back { display: flex; align-items: center; gap: 10px; padding: 6px 0 4px; font-size: 18px; font-weight: 700; }
.back button { background: none; border: 0; font-size: 22px; padding: 0 6px 0 0; }

table.prev { width: 100%; border-collapse: collapse; font-size: 14px; }
table.prev th { font-size: 12px; color: var(--sub); font-weight: 600; text-align: right; padding: 8px 4px; background: var(--field); }
table.prev th:first-child, table.prev td:first-child { text-align: left; }
table.prev td { padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: right; }
table.prev tr.hot td { background: rgba(229, 56, 59, 0.08); }

.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 24, 0.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--card); border-radius: 16px; width: min(420px, 100%); padding: 20px; max-height: 85vh; overflow: auto; }
.modal h2 { margin-bottom: 10px; text-align: center; }
.modal p { white-space: pre-line; text-align: center; color: var(--sub); margin: 0 0 16px; }
.sheet-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 13px 4px; border-bottom: 1px solid var(--line); font-size: 15px; }
.sheet-item:last-child { border-bottom: 0; }
.sheet-item.danger { color: var(--up); }
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #1f2633; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 60; }
#toast.on { opacity: 1; }
.log { font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.log .ev { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.log .ev:last-child { border-bottom: 0; }
.log .ev-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; background: var(--line); }
.log .ev.warn .ev-dot { background: #f5a623; } .log .ev.error .ev-dot { background: var(--up); }
.log .ev.error .ev-msg { color: var(--up); }
.log .ev-msg { flex: 1; min-width: 0; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.log .ev-time { flex: none; color: var(--sub); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.halt-btn { flex: none; margin-left: 12px; min-width: 56px; }

/* 상단 아이콘 버튼 (앱이 넣는 알림·설정) */
.top-right { display: flex; align-items: center; gap: 4px; }
.theme-btn { width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; color: var(--text); padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.theme-btn:active { background: var(--field); }
.theme-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }

/* 더보기: 메뉴 행과 접히는 섹션 */
.card.menu { padding: 4px 16px; }
.menu-row { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 14px 0; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; font-size: 16px; color: var(--text); text-decoration: none; text-align: left; cursor: pointer; }
.menu-row:last-child { border-bottom: 0; }
.chev { color: var(--sub); font-size: 20px; line-height: 1; transition: transform .15s; }
details.fold { padding: 0; }
details.fold > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary .chev { transform: rotate(90deg); }
.fold-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fold-t b { font-size: 16px; }
.fold-t small { color: var(--sub); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-body { padding: 0 16px 16px; }
details.fold:has(> .fold-body:empty), details.fold:has(.fold-body > div:empty:only-child) { display: none; }

/* 투자현황 필터 줄: 페이지 배경 위라 카드색으로 */
.grid2 > .select-btn, .grid2 > .view-toggle { background: var(--card); border-radius: 12px; }
.picker-list { max-height: 50vh; overflow: auto; margin-top: 8px; }

/* status chips: tinted background + darkest text of the same hue, readable in both themes */
.chip { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.chip.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.chip.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.chip.err { background: var(--chip-err-bg); color: var(--chip-err); }
.chip.info { background: var(--chip-info-bg); color: var(--chip-info); }
.chip.idle { background: var(--chip-idle-bg); color: var(--chip-idle); }
.ev-hint { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--sub); }
.ev-hint.serious { color: var(--up); }
.ev-buy { color: var(--up); font-weight: 700; }
.ev-sell { color: var(--primary); font-weight: 700; }
.trail-opt { gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.trail-opt .desc { font-size: 13px; color: var(--sub); margin-top: 2px; }
.chip.vtag { font-size: 11px; padding: 1px 7px; vertical-align: 1px; }
.chip.upbit { background: rgba(9, 54, 135, .1); color: #093687; }
:root[data-theme="dark"] .chip.upbit { background: rgba(120, 160, 255, .16); color: #9db8ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.upbit { background: rgba(120, 160, 255, .16); color: #9db8ff; } }

/* ESP target ladder */
.ladder { display: grid; gap: 6px; }
.rung { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-variant-numeric: tabular-nums; }
.rung .t { font-weight: 800; font-size: 15px; }
.rung .px { font-size: 15px; }
.rung .px small { display: block; color: var(--sub); font-size: 13px; }
.rung.idle { border-style: dashed; }
.rung.held { border: 2px solid var(--ok); }
.rung.armed { border: 2px solid var(--up); }
.rung.lock { border: 2px solid var(--warn); background: var(--chip-warn-bg); }
.rung.done { opacity: 0.6; }
.now-line { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.now-line::before, .now-line::after { content: ""; flex: 1; height: 2px; background: var(--text); }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Toss × Binance: roomy rounded cards and big bold headline numbers (Toss), dense aligned figures (Binance). */
.card { border-radius: 20px; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; color: var(--sub); }
.num, .kv b, table, .prev, .tier, .mkt { font-variant-numeric: tabular-nums; }
.btn { border-radius: 14px; font-weight: 700; letter-spacing: -0.2px; }
.btn.ghost { background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .btn.ghost { color: var(--primary); }
.btn.ghost.danger, .btn.danger { background: rgba(240, 68, 82, 0.12); color: var(--up); }
/* Market list: name column never collapses below ~5 Korean chars; long names ellipsize instead of stacking. */
.mkt, .mkt-head { grid-template-columns: minmax(84px, 1fr) auto auto 24px; gap: 8px; }
.mkt > div:first-child { min-width: 0; }
.mkt .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .mkt { font-size: 14px; } .mkt .sub, .mkt small { font-size: 11px; } }
.seg.sm { display: inline-flex; width: auto; margin: 0; }
.seg.sm button { padding: 4px 10px; font-size: 12px; }
.chart-area svg { display: block; }
.rep-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 8px; }
.rep-tile { border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.rep-tile span { font-size: 12.5px; font-weight: 600; }
.rep-tile b { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.rep-tile.ok { background: var(--chip-ok-bg); color: var(--chip-ok); }
.rep-tile.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.rep-tile.err { background: var(--chip-err-bg); color: var(--chip-err); }
.rep-stack { display: flex; gap: 3px; height: 6px; border-radius: 3px; overflow: hidden; }
.rep-stack i { border-radius: 3px; opacity: .55; }
.rep-stack i.ok { background: var(--chip-ok); } .rep-stack i.warn { background: var(--chip-warn); } .rep-stack i.err { background: var(--chip-err); }
.rep-note { margin: 8px 0 4px; font-size: 12.5px; }
.rep-row { display: flex; gap: 12px; padding: 14px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.rep-row:first-of-type { border-top: 0; }
.coin.sm { width: 34px; height: 34px; font-size: 15px; }
.rep-main { flex: 1; min-width: 0; }
.rep-main .row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-gauge { position: relative; height: 6px; margin: 10px 0 8px; border-radius: 3px; background: var(--field); }
.rep-gauge.none { opacity: .5; }
.rep-gauge .mid { position: absolute; left: 50%; top: -3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--muted); }
.rep-gauge .fill { position: absolute; top: 0; height: 100%; border-radius: 3px; opacity: .35; }
.rep-gauge .dot { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid var(--card); }
.rep-gauge .pos { background: var(--up); } .rep-gauge .neg { background: var(--down); }
.rep-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; }
.rep-advice { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.rep-advice.ok { background: var(--field); color: var(--sub); }
.rep-advice.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.rep-advice.err { background: var(--chip-err-bg); color: var(--chip-err); }
.rep-legend { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; }
.standby { display: block; margin: 0 16px 6px; padding: 12px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-size: 14px; text-decoration: none; }
.standby b { float: right; }
.standby[hidden] { display: none; }
.halt-bar { display: block; margin: 0 16px 6px; padding: 12px 14px; border-radius: 14px; background: #f04452; color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.halt-bar b { float: right; }
.halt-bar[hidden] { display: none; }
.halt-card { border: 1.5px solid #f04452; }
.btn.stop { background: #f04452; color: #fff; }
.slist .srow { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.slist .srow:last-child { border-bottom: 0; }
.slist .srow b { font-weight: 600; }
.view-toggle { min-width: 0; }
.date-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.date-row input { flex: 1; min-width: 0; }
/* Phones zoom in when an input's text is under 16px; keep every field at 16px. Also stop double-tap zoom. */
input, select, textarea, .field { font-size: 16px; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
.chart-area { position: relative; }
.chart-area svg { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-tip { position: absolute; left: 0; right: 0; top: -2px; z-index: 2; font-size: 12px; padding: 6px 8px; border-radius: 10px; background: var(--field); color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip[hidden] { display: none; }

/* Strategy card (Toss-style): coin avatar, big P&L, tier fill bar, distance to the next fills, compact flag chips. */
.scard { padding: 18px; }
.scard [data-open] { cursor: pointer; }
.scard-head { display: flex; align-items: center; gap: 12px; }
.coin { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; background: hsl(var(--h) 55% 48%); }
.scard-title { flex: 1; min-width: 0; }
.scard-title b { font-size: 17px; letter-spacing: -0.3px; }
.scard-title .sub { margin-top: 2px; font-size: 13px; }
.scard-pnl { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 10px; }
.scard-pnl b { font-size: 22px; letter-spacing: -0.5px; }
.scard-pnl small { font-size: 14px; font-weight: 600; margin-left: 4px; }
.ladder-bar { display: flex; gap: 3px; height: 8px; }
.ladder-bar i { flex: 1; border-radius: 3px; background: var(--field); }
.ladder-bar i.on { background: var(--primary); }
.ladder-bar i.wait { background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.scard-meta { margin-top: 6px; font-size: 12.5px; }
.scard-next { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 12px; }
.scard-next > div { background: var(--field); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.scard-next b { font-size: 16px; }
.scard-next small { font-size: 12px; font-weight: 600; }
.scard-next .sub { font-size: 12px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-chip input { display: none; }
.flag-chip span { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--field); color: var(--muted); cursor: pointer; }
.flag-chip input:checked + span { background: var(--primary-soft); color: var(--primary); }
/* Ladder rows: one line per tier, colored left accent instead of heavy borders. */
.rung { grid-template-columns: 40px 1fr auto; border: 0; border-left: 4px solid var(--line); background: var(--field); padding: 9px 12px; }
.rung .px { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rung .px small { font-size: 11.5px; margin-top: 1px; }
.rung .t { font-size: 14px; color: var(--sub); }
.rung.idle { border-style: solid; border-left-color: var(--line); }
.rung.held { border: 0; border-left: 4px solid var(--primary); }
.rung.armed { border: 0; border-left: 4px solid var(--down); }
.rung.lock { border: 0; border-left: 4px solid var(--warn); }
.now-line { font-size: 13px; }

/* Strategy wizard */
.wiz-steps { display: flex; gap: 6px; margin: 4px 0 0; }
.wiz-steps span { flex: 1; text-align: center; font-size: 12px; font-weight: 600; padding: 6px 0; border-radius: 999px; background: var(--field); color: var(--muted); }
.wiz-steps span.on { background: var(--primary); color: var(--primary-ink); }
.wiz-steps span.done { background: var(--primary-soft); color: var(--primary); }
.wiz-coin { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.wiz-coin:last-child { border-bottom: 0; }
.wiz-coin-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wiz-coin-name small, .wiz-coin-px small { font-size: 12px; color: var(--muted); }
.wiz-coin-px { display: flex; flex-direction: column; align-items: flex-end; }
.wiz-coin .coin { width: 34px; height: 34px; font-size: 15px; }
.wiz-big { font-size: 24px !important; font-weight: 700; padding: 14px; }
.wiz-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.wiz-chips .flag-chip { border: 0; background: none; padding: 0; }
.wiz-style { display: block; width: 100%; text-align: left; border: 2px solid transparent; }
.wiz-style.on { border-color: var(--primary); }
.wiz-basket { display: block; width: 100%; text-align: left; border: 2px solid var(--primary); background: var(--card); cursor: pointer; }
.wiz-style .sub { margin-top: 4px; }
details.card summary { cursor: pointer; }
.eq-big { margin: 12px 0 2px; }
.eq-big b { font-size: 26px; letter-spacing: -0.6px; }
.eq-big span { font-size: 15px; font-weight: 600; margin-left: 4px; }
.eq-stat { background: var(--field); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.eq-stat .sub { font-size: 12px; }
.eq-stat b { font-size: 16px; }
.seg.sm button { white-space: nowrap; }
.tv-chart { position: relative; height: 300px; margin-top: 4px; touch-action: pan-y; }
.tv-legend { min-height: 18px; margin-top: 8px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.venue-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.venue-row:first-child { border-top: 0; padding-top: 0; }
.venue-main { flex: 1; min-width: 0; }
.venue-main .sub { font-size: 13px; }

/* 코인 뉴스 */
.news { padding: 4px 16px; }
.news-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line, rgba(127,127,127,.15)); }
.news-item:last-child { border-bottom: 0; }
.news-item b { font-weight: 600; line-height: 1.4; }
.news-lead { font-size: 14px; line-height: 1.5; color: var(--sub); }
.news-item .sub { font-size: 12px; }

/* 로그인 (여러 사용자용 서버) */
body.signed-out .bottom-nav, body.signed-out #standby { display: none; }
.signin { max-width: 420px; margin: 8vh auto 0; padding: 0 4px; }
.signin h2 { font-size: 24px; margin: 0 0 6px; }
.signin .btn { width: 100%; }
.signin-err { color: var(--red, #f04452); margin: 12px 0 0; font-size: 14px; }
.signin-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--sub); font-size: 13px; }
.signin-or::before, .signin-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.nt-dc { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* 선택 시트 (시스템 드롭다운 대신) */
select.field[hidden] { display: none; }
.select-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; color: var(--text); }
.select-btn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-btn .caret { color: var(--sub); font-size: 12px; flex: none; }
.modal-bg.bottom { align-items: flex-end; padding: 0; }
.modal-bg.bottom .modal { width: min(560px, 100%); border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 70vh; display: flex; flex-direction: column; }
.modal-bg.bottom .modal h2 { text-align: left; font-size: 18px; margin-bottom: 6px; }
.pick-list { overflow: auto; }
.pick-item { display: flex; width: 100%; justify-content: space-between; align-items: center; background: none; border: 0; padding: 14px 4px; font-size: 16px; color: var(--text); text-align: left; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-item:last-child { border-bottom: 0; }
.pick-item.on { color: var(--primary); font-weight: 700; }
.pick-check { font-weight: 700; }
.wiz-group { font-size: 12px; color: var(--sub); font-weight: 600; padding: 12px 2px 4px; }
.wild { color: #e8590c; font-weight: 700; }
.venue-seg { display: inline-flex; gap: 4px; padding: 3px; margin: 2px 0 8px; background: var(--field); border-radius: 10px; }
.venue-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; color: var(--sub); cursor: pointer; }
.venue-seg button.on { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cash-note { border: 1px solid var(--line); }
.cash-note.warn { border-color: var(--chip-warn); background: var(--chip-warn-bg); }
.cash-note b { display: block; margin-bottom: 4px; }
.stocks-frame { display: block; width: 100%; min-height: 70vh; border: 0; background: transparent; }

/* 투자현황 카드가 링크 */
.ov-row { display: block; color: inherit; text-decoration: none; }
.flag-chip.on span { background: var(--primary); color: var(--primary-ink); }

/* 추세추종 내 수익 표 */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--sub); font-weight: 600; font-size: 12px; }
.tbl-wrap { overflow-x: auto; }
