/* 밸류레이더 화면 스타일.
   색 규칙: 빨강·파랑 = 오직 가격 오르내림 / 보라 = 엔진 점수 / 주황+▲ = 주의 / 무채색+✓ = 괜찮음 */
:root {
  --bg: #0E1014; --card: #171A21; --sub: #1E222B; --line: #2A2F3A; --line2: #3A404C;
  --tx: #ECEEF2; --tx2: #C9CDD5; --tx3: #A3A9B5; --tx4: #7D8491;
  --up: #FF5A5F; --down: #4D8DFF; --score: #8E86FF; --score2: #B9B3FF; --warn: #FFB870; --warn2: #FFA94D;
  --r: 18px; --nav: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--tx); }
body {
  font-family: 'IBM Plex Sans KR', system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums; font-size: 15px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
a { color: #A9A3FF; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.app { max-width: 560px; margin: 0 auto; padding: 0 0 calc(var(--nav) + 40px + env(safe-area-inset-bottom)); min-height: 100vh; }
@media (min-width: 900px) { .app { max-width: 720px; } }

/* 머리 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 4px; min-height: 56px; }
.top h1 { font-size: 22px; font-weight: 700; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.asof { font-size: 12px; color: var(--tx3); }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--tx); cursor: pointer; border-radius: 12px; }
.iconbtn:active { background: var(--sub); }
.lead { padding: 0 16px; color: var(--tx2); font-size: 14px; }

/* 카드 */
.card { margin: 14px 16px 0; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.card.hi { border-color: var(--line2); }
.card h2 { font-size: 18px; font-weight: 700; }
.card .desc { margin-top: 4px; font-size: 14px; color: var(--tx3); }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin: 26px 16px 0; }
.sec-h h2 { font-size: 18px; font-weight: 700; }
.sec-h a { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
.sub { padding: 14px; background: var(--sub); border-radius: 12px; }
.muted { color: var(--tx3); } .muted2 { color: var(--tx2); }
.small { font-size: 13px; } .big { font-size: 22px; font-weight: 700; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--tx2); }
.sc { color: var(--score2); font-weight: 700; }
.warn { color: var(--warn); }
.banner { margin: 10px 16px 0; padding: 10px 14px; border-radius: 12px; background: rgba(255,184,112,.1); color: var(--warn); font-size: 13px; line-height: 1.5; }
.foot { margin: 20px 20px 0; font-size: 12px; color: var(--tx3); line-height: 1.55; }

/* 행 목록 */
.rows { margin: 0; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 52px; color: var(--tx); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .meta { font-size: 13px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.self { background: rgba(142,134,255,.12); margin: 0 -12px; padding: 12px; border-radius: 10px; border-bottom: 0; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--tx2); } .kv dd { margin: 0; font-weight: 700; font-size: 16px; text-align: right; }

/* 추천 카드 */
.rec { display: block; margin: 12px 16px 0; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--tx); }
.rec.first { border-color: var(--score); }
.rec .head { display: flex; align-items: center; gap: 12px; }
.rank { width: 28px; height: 28px; border-radius: 50%; background: var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex: none; }
.rec.first .rank { background: var(--score); color: var(--bg); }
.rec .why { margin-top: 8px; font-size: 14px; color: var(--tx2); line-height: 1.55; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.trio > div { padding: 10px; background: var(--sub); border-radius: 10px; }
.trio span { display: block; font-size: 12px; color: var(--tx3); }
.trio b { font-size: 14px; white-space: nowrap; }
.trio.wide { grid-template-columns: minmax(0,1.7fr) minmax(0,1fr) minmax(0,1fr); }
.trio.wide > div:first-child b { font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--sub); color: var(--tx2); font-size: 12px; margin: 6px 6px 0 0; }
.tag.new { background: rgba(142,134,255,.18); color: var(--score2); }

/* 종목 상세 */
.verdict { font-size: 24px; font-weight: 700; margin-top: 6px; }
.qa { margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; }
.qa dt { font-size: 13px; color: var(--tx3); }
.qa dd { margin: 4px 0 0; font-size: 16px; font-weight: 600; line-height: 1.5; }
.qa dd.s { font-size: 14px; color: var(--tx2); font-weight: 400; margin-top: 2px; }
.btn { width: 100%; min-height: 52px; border: 0; border-radius: 14px; background: var(--score); color: var(--bg); font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 14px; }
.btn.ghost { background: var(--sub); color: var(--tx); border: 1px solid var(--line2); }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid rgba(255,184,112,.4); }
.btn:disabled { opacity: .5; }
.bars { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.bar-l { display: flex; justify-content: space-between; font-size: 15px; }
.track { position: relative; height: 12px; background: var(--line); border-radius: 6px; margin-top: 6px; overflow: hidden; }
.fill { height: 12px; border-radius: 6px; }
.zero { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--tx4); }
.limit { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: .8; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 14px 16px 0; }
.two .card { margin: 0; padding: 16px; }
.two ul { margin: 8px 0 0; padding-left: 16px; font-size: 14px; color: var(--tx2); line-height: 1.6; }
.toggle { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--tx); font-size: 15px; font-weight: 600; cursor: pointer; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
.tbl th { text-align: right; font-weight: 500; color: var(--tx3); font-size: 12px; padding: 6px 0; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 10px 0; border-top: 1px solid var(--line); }
.check { display: flex; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--tx2); }
.check .ok { color: var(--tx3); } .check .no { color: var(--warn); }
.chart { width: 100%; height: auto; display: block; margin-top: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--tx3); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.seg { display: flex; gap: 6px; margin: 12px 16px 0; padding: 4px; background: var(--card); border-radius: 12px; border: 1px solid var(--line); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--tx3); font-weight: 600; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--line); color: var(--tx); }

/* 폼 */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field label { font-size: 14px; color: var(--tx2); }
.field input, .field select { min-height: 48px; padding: 0 14px; background: var(--sub); border: 1px solid var(--line2); border-radius: 12px; color: var(--tx); font-size: 16px; width: 100%; }
.field input:focus { outline: 2px solid var(--score); outline-offset: 0; border-color: transparent; }
.hint { font-size: 13px; color: var(--tx3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--sub); border: 1px solid var(--line2); color: var(--tx2); cursor: pointer; font-size: 14px; display: inline-flex; align-items: center; }
.empty { padding: 28px 18px; text-align: center; color: var(--tx3); font-size: 14px; line-height: 1.6; }

/* 하단 메뉴 */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: rgba(14,16,20,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom .in { display: flex; width: 100%; max-width: 560px; }
nav.bottom a { flex: 1; height: var(--nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--tx3); font-size: 11px; font-weight: 500; }
nav.bottom a[aria-current="page"] { color: var(--tx); }
nav.bottom svg { width: 22px; height: 22px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #2A2F3A; color: var(--tx); padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 20; box-shadow: 0 6px 24px rgba(0,0,0,.4); max-width: calc(100% - 32px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--score); outline-offset: 2px; }

/* 실시간 */
.live { font-size: 12px; color: var(--tx3); white-space: nowrap; }
.live.on { color: var(--tx2); }
.live .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--score); margin-right: 5px; vertical-align: 1px; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live .dot { animation: none; } }
.zone { display: block; margin-top: 10px; font-size: 13px; }
.zone:empty { display: none; }
