:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #15181d;
  --ink2: #3b424c;
  --mute: #5b6470;
  --line: #eef0f3;
  --line2: #d5dae1;
  --chip: #f0f2f5;
  --buy: #c2410c;
  --sell: #1d4ed8;
  --up: #e5484d;
  --down: #3b6fd8;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'Noto Sans KR', system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* 위 검색 줄 */
.top { position: relative; z-index: 20; background: var(--card); border-bottom: 1px solid #e3e7ec; padding: 10px 16px; }
.search { display: flex; gap: 8px; align-items: center; }
.home { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--chip); color: var(--ink2); }
.q { flex-grow: 1; display: flex; align-items: center; gap: 8px; background: var(--chip); border-radius: 12px; padding: 0 14px; height: 44px; }
.q input { border: none; background: transparent; font-size: 16px; font-family: inherit; color: var(--ink); flex-grow: 1; outline: none; min-width: 0; }
.results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 60vh; overflow: auto; }
.results a { display: flex; justify-content: space-between; padding: 12px 6px; border-top: 1px solid var(--line); text-decoration: none; font-size: 15px; }
.results small { color: var(--mute); font-size: 12px; }

.loading, .err { padding: 40px 16px; text-align: center; color: var(--mute); font-size: 14px; }

/* 지도 화면 */
.mapbar { background: var(--card); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid #e3e7ec; }
.mapbar h1 { margin: 0; font-size: 17px; font-weight: 800; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.date { font-size: 12px; color: var(--mute); }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; height: 40px; border: none; border-radius: 10px; background: var(--chip); color: var(--ink2); font-size: 13px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { height: 34px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; font-size: 12px; color: var(--ink2); }
.chips button[aria-pressed="true"] { border-color: var(--ink); font-weight: 700; color: var(--ink); }
.chips button:disabled { color: #8a94a3; cursor: default; }
.mkt { display: flex; gap: 12px; font-size: 12px; color: var(--ink2); flex-wrap: wrap; }
.mkt b { font-weight: 700; }

.mapwrap { padding: 12px; }
.zoomback { text-decoration: none; display: flex; align-items: center; gap: 6px; margin: 0 0 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 700; color: var(--ink); }
.tm { position: relative; width: 100%; background: var(--ink); border-radius: 8px; overflow: hidden; }
.sec { position: absolute; }
.sec-h { position: absolute; left: 0; top: 0; right: 0; height: 20px; padding: 0 6px; border: none; background: transparent; color: #fff; font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 20px; }
.box { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; overflow: hidden; border-radius: 2px; line-height: 1.15; text-align: center; }
.box span { display: block; max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box .nm { font-weight: 700; }
.legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--mute); margin-top: 10px; padding: 0 4px; }
.legend i { width: 26px; height: 10px; border-radius: 2px; display: block; }
.legend .sp { margin-left: auto; }
.guide { margin: 10px 4px 0; background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--ink2); line-height: 1.6; }
.foot { padding: 12px 16px 28px; font-size: 11px; color: var(--mute); line-height: 1.6; }

/* 종목 리포트 */
.wrap { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 700; }
.ch { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ch small { font-size: 11px; color: var(--mute); }
.title { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.title h1 { margin: 0; font-size: 20px; font-weight: 800; }
.sub { font-size: 12px; color: var(--mute); margin-top: 3px; }
.px { font-size: 15px; font-weight: 700; margin-top: 6px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef0f3; color: var(--ink2); white-space: nowrap; }
.badge.warn { background: #fde2e2; color: #9f1c1c; }
.badge.caution { background: #fdf0d5; color: #8a5300; }
.badge.good { background: #dcf3e6; color: #17603a; }
.sum { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border-radius: 12px; padding: 14px; }
.sum div { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.55; }
.sum i { width: 10px; height: 10px; border-radius: 5px; margin-top: 6px; flex-shrink: 0; }
.sum b { font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--bg); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile span:nth-child(1) { font-size: 12px; color: var(--mute); }
.tile span:nth-child(2) { font-size: 18px; font-weight: 800; }
.tile span:nth-child(3) { font-size: 11px; color: var(--mute); }
.bars { display: grid; grid-template-columns: 66px 1fr 1fr; gap: 8px 10px; align-items: center; font-size: 12px; }
.bars .hd { color: var(--mute); text-align: center; }
.bars .lb { font-size: 13px; font-weight: 700; }
.bar { display: flex; align-items: center; gap: 4px; }
.bar .l, .bar .r { flex: 1; display: flex; }
.bar .l { justify-content: flex-end; }
.bar .axis { width: 1px; height: 18px; background: var(--ink); }
.bar .fill { height: 12px; }
.bar .l .fill { border-radius: 3px 0 0 3px; }
.bar .r .fill { border-radius: 0 3px 3px 0; }
.bar .v { width: 32px; text-align: right; font-weight: 700; }
.notes { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.notes div { font-size: 13px; line-height: 1.55; }
.notes b { font-weight: 700; }
.hint { font-size: 11px; color: var(--mute); line-height: 1.6; }

.kv { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-of-type { border-bottom: none; }
.kv b { font-weight: 700; }
.buy { color: var(--buy); }
.sell { color: var(--sell); }
.say { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.55; }
.mat { display: grid; grid-template-columns: 44px 1fr; gap: 10px 12px; font-size: 14px; align-items: start; line-height: 1.5; }
.mat span:nth-child(odd) { font-size: 12px; font-weight: 700; color: var(--mute); padding-top: 2px; }
.titles { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink2); line-height: 1.6; }

.more { padding: 6px 18px; gap: 0; }
.more h2 { padding: 12px 0 8px; }
.acc { border-top: 1px solid var(--line); }
.acc > button { width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: 48px; border: none; background: transparent; font-size: 14px; color: var(--ink); padding: 0; text-align: left; }
.acc > button span:last-child { color: var(--mute); font-size: 13px; }
.acc > button:disabled { cursor: default; color: #8a94a3; }
.acc .body { padding: 0 0 12px; }
.acc .grp { font-size: 12px; font-weight: 700; color: var(--mute); margin: 10px 0 2px; }
.acc .kv { font-size: 13px; padding: 6px 0; }

.asof { font-size: 13px; font-weight: 700; color: var(--ink); background: #fff3c4; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.sizes { display: flex; gap: 6px; align-items: center; }
.sizes span { font-size: 12px; color: var(--mute); margin-right: 2px; }
.sizes button { height: 34px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink2); }
.sizes button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }

.zlist { margin: 12px 4px 0; background: #fff; border-radius: 12px; padding: 4px 14px; }
.zlist .zh { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); padding: 10px 0 6px; }
.zlist a { display: flex; justify-content: space-between; align-items: center; min-height: 44px; border-top: 1px solid var(--line); text-decoration: none; font-size: 14px; }
.zlist b { font-weight: 700; }

.asof.live { background: #fde2e2; color: #9f1c1c; }
.livenote { margin: 8px 4px 0; font-size: 12px; color: #8a5300; background: #fdf0d5; border-radius: 8px; padding: 8px 10px; }

.sec-h .cnt { font-weight: 500; opacity: .85; }
.sub .thm { color: var(--sell); text-decoration: none; font-weight: 700; }
