/* 양양경제 정보방 — 미니앱 스타일
   톤: 영상의 신문 지면(따뜻한 종이색 바탕 + 먹색 글자 + 형광 밑줄). 색 값은 factory/press/template/style.css 와 맞췄다.
   규칙(docs/RULES.md, 벤치마킹 2부):
     - 상승은 빨강, 하락은 파랑. 0 은 색을 뺀다. 어두운 화면에서는 둘 다 한 단계 밝힌다(같은 값이면 파랑이 묻힌다).
     - 빨강·파랑은 '방향'에만 쓴다. 투자 주체(개인·외국인·기관)는 다른 색을 쓴다.
     - 숫자는 고정폭 숫자. 한 줄에서 색이 들어가는 숫자는 하나(등락률)뿐이다.
     - 본문 16px 이상, 누르는 곳은 44px 이상. */

:root {
  --paper: #efe9dd;
  --paper-2: #e6dfd0;
  --card: #f8f4ea;
  --ink: #1b1814;
  --ink-2: #4e463a;
  --ink-3: #6b6153;
  --rule: #c9bea9;
  --rule-2: #ddd4c2;
  --amber: #f0bd2e;
  --amber-soft: rgba(240, 189, 46, 0.5);
  --up: #c8322a;
  --down: #21609f;
  --flat: #6b6153;
  --up-soft: rgba(200, 50, 42, 0.1);
  --down-soft: rgba(33, 96, 159, 0.1);
  --who-ind: #8a7f6d;
  --who-for: #0e6a6f;
  --who-inst: #9a6b12;
  --btn: #1b1814;
  --btn-ink: #f8f4ea;
  --banner: #1b1814;
  --banner-ink: #f8f4ea;
  --seg-on: #f8f4ea;
  --ed-morning: #1d3f6e;
  --ed-closing: #c8322a;
  --ed-stock: #0e6a6f;
  --ed-usopen: #3d3a8c;
  --ed-weekly: #7a1f2b;
  --ok: #2f7d4f;
  --shadow: 0 -8px 30px rgba(27, 24, 20, 0.18);
  --scrim: rgba(27, 24, 20, 0.42);
  --tab-h: 58px;
  --pad: 16px;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "맑은 고딕", sans-serif;
  --serif: "Noto Serif KR", "Noto Serif CJK KR", "Nanum Myeongjo", AppleMyungjo, Batang, "바탕", serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #14120f;
  --paper-2: #1c1915;
  --card: #221f1a;
  --ink: #efe9dd;
  --ink-2: #cdc4b3;
  --ink-3: #a39887;
  --rule: #40392f;
  --rule-2: #2f2a23;
  --amber: #f0bd2e;
  --amber-soft: rgba(240, 189, 46, 0.3);
  --up: #f2685c;
  --down: #62a5ea;
  --flat: #a39887;
  --up-soft: rgba(242, 104, 92, 0.14);
  --down-soft: rgba(98, 165, 234, 0.14);
  --who-ind: #a39887;
  --who-for: #45b8b0;
  --who-inst: #d8a640;
  --btn: #efe9dd;
  --btn-ink: #1b1814;
  --banner: #2f2a21;
  --banner-ink: #efe9dd;
  --seg-on: #40392e;
  --ed-morning: #7fb0ee;
  --ed-closing: #f2685c;
  --ed-stock: #5fd0c8;
  --ed-usopen: #aaa7f7;
  --ed-weekly: #ea8e98;
  --ok: #6cc08d;
  --shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { background: var(--paper); }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 700; line-height: 1.3; }
.num, .tn { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--ink-3); }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }

/* ───────── 뼈대 */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }
#view { padding: 0 var(--pad) calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 28px); }
.page-head { padding: 18px 0 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-family: var(--serif); font-size: 24px; letter-spacing: -0.02em; white-space: nowrap; flex: none; }
.page-head .sub { font-size: 13px; color: var(--ink-3); text-align: right; line-height: 1.4; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: 6px 0 0 -8px; padding: 0 10px 0 4px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.back svg { width: 20px; height: 20px; }

/* ───────── 제호(오늘 탭 맨 위) */
.folio { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.02em; }
.masthead { font-family: var(--serif); font-weight: 700; font-size: 30px; letter-spacing: 0.08em; text-align: center; padding: 6px 0 8px; line-height: 1.2; }
.mast-rule { border: 0; border-top: 3px double var(--ink); margin: 0; }
.market-line { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 0 2px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.on { background: var(--ok); }

/* ───────── 묶음(블록) — 제목 → 한 문장 → 칩 → 그림 → 목록 → 단서 */
.block { margin-top: 22px; }
.block-head { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.block-head h2 { font-size: 19px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.block-head h2::before { content: ""; width: 9px; height: 9px; background: var(--ink); flex: none; }
.block-head .asof { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 500; text-align: right; white-space: nowrap; }
.block-head .more { margin-left: auto; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; }
.block-head .more svg { width: 16px; height: 16px; }
.asof-line { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sentence { font-size: 17px; font-weight: 600; line-height: 1.5; margin: 8px 0 10px; letter-spacing: -0.01em; }
mark { background: linear-gradient(transparent 52%, var(--amber-soft) 52%, var(--amber-soft) 92%, transparent 92%); color: inherit; padding: 0 1px; }
.foot { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin-top: 10px; }
.disclaimer { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--rule-2); }

.card { background: var(--card); border: 1px solid var(--rule-2); border-radius: 12px; padding: 16px; margin-top: 10px; }
.card.flush { padding: 4px 16px; }
.card.tight { padding: 12px 14px; }
.card h3 { font-size: 16px; }

/* 꼬리표: 색은 네 가지 이내(상태·분류·강조·방향) */
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: -0.01em; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; flex: none; }
.tag.line { background: transparent; box-shadow: inset 0 0 0 1px var(--rule); }
.tag.hot { background: var(--amber); color: #1b1814; }
.tag.ink { background: var(--ink); color: var(--paper); }
.tag.up { background: var(--up-soft); color: var(--up); }
.tag.down { background: var(--down-soft); color: var(--down); }
.tag.warn { background: transparent; box-shadow: inset 0 0 0 1px var(--up); color: var(--up); }

/* 양양 생각 — 사실(제목·숫자)과 구분되는 해설 한 줄 */
.think { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.think p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.think .think-tag { background: var(--amber-soft); color: var(--ink); margin-top: 1px; }

/* 물음표(정의·기준·한계 세 줄) */
.help { width: 44px; height: 44px; margin: -8px -10px -8px -8px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); flex: none; }
.help span { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; line-height: 1; }

/* ───────── 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 18px; border-radius: 10px; font-size: 16px; font-weight: 700; background: var(--btn); color: var(--btn-ink); text-decoration: none; }
.btn.block-w { display: flex; width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn:disabled { opacity: 0.45; }
.btn:active { transform: scale(0.985); }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.btn-row .btn { flex: 1; }
.link { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

/* ───────── 전환 칩(회색 통 안에서 고른 것만 밝은 알약) */
.seg { display: flex; background: var(--paper-2); border-radius: 10px; padding: 3px; gap: 2px; margin-top: 10px; }
.seg button { flex: 1; min-height: 44px; border-radius: 8px; font-size: 15px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 0 6px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 2px rgba(27, 24, 20, 0.12); }
.seg-row { display: flex; gap: 8px; }
.seg-row .seg { flex: 1; }
.seg-row .seg.narrow { flex: 0 0 42%; }

/* 화면 위에 붙어 따라오는 가로 칩 */
.chipbar { position: sticky; top: 0; z-index: 5; background: var(--paper); margin: 0 calc(var(--pad) * -1); padding: 6px var(--pad); display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule-2); }
.chipbar::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 2px; display: inline-flex; align-items: center; }
.chip span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 17px; font-size: 15px; font-weight: 600; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); white-space: nowrap; }
.chip[aria-pressed="true"] span { background: var(--ink); color: var(--paper); box-shadow: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.kw { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 13px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--paper-2); }

/* ───────── 지수 띠 */
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 10px calc(var(--pad) * -1) 0; padding: 0 var(--pad) 2px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-left: var(--pad); }
.strip::-webkit-scrollbar { display: none; }
.idx { flex: none; width: 152px; background: var(--card); border: 1px solid var(--rule-2); border-radius: 12px; padding: 11px 12px 10px; scroll-snap-align: start; }
.idx .nm { font-size: 13.5px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.idx .val { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.idx .chg { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.idx .why { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
.idx svg { width: 46px; height: 22px; flex: none; }

/* ───────── 영상 카드 */
.vcard { background: var(--card); border: 1px solid var(--rule-2); border-left: 4px solid var(--ed, var(--ink)); border-radius: 12px; padding: 14px 14px 14px 13px; margin-top: 10px; }
.vcard.flash { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--amber); } 100% { box-shadow: 0 0 0 3px transparent; } }
.vhead { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ed, var(--ink-2)); }
.vhead .when { color: var(--ink-3); font-weight: 600; }
.vhead .tag { margin-left: auto; }
.vtitle { font-family: var(--serif); font-size: 18px; font-weight: 700; line-height: 1.4; letter-spacing: -0.02em; margin-top: 7px; }
.vsum { margin-top: 8px; font-size: 16px; color: var(--ink-2); line-height: 1.55; }
.vsum li { position: relative; padding-left: 13px; }
.vsum li + li { margin-top: 3px; }
.vsum li::before { content: ""; position: absolute; left: 1px; top: 0.72em; width: 5px; height: 2px; background: var(--ink-3); }
.vsum li.anchor { color: var(--ink); font-weight: 600; }
.vsum li.anchor::before { width: 5px; height: 5px; top: 0.6em; background: var(--amber); }
.vnotice { display: flex; gap: 10px; align-items: flex-start; }
.vnotice p { font-size: 16px; color: var(--ink-2); line-height: 1.5; margin-top: 6px; }
.ed-morning { --ed: var(--ed-morning); }
.ed-closing { --ed: var(--ed-closing); }
.ed-stock { --ed: var(--ed-stock); }
.ed-usopen { --ed: var(--ed-usopen); }
.ed-weekly { --ed: var(--ed-weekly); }

/* ───────── 알림 띠(투표 진행 중 등) */
.banner { display: flex; align-items: center; gap: 12px; width: 100%; text-decoration: none; margin-top: 14px; padding: 13px 14px; border-radius: 12px; background: var(--banner); color: var(--banner-ink); box-shadow: inset 0 0 0 1px var(--amber-soft); }
.banner .tx { flex: 1; min-width: 0; }
.banner .t1 { font-size: 12.5px; font-weight: 700; color: var(--amber); display: flex; gap: 6px; align-items: center; }
.banner .t2 { font-size: 16px; font-weight: 700; margin-top: 2px; line-height: 1.4; }
.banner svg { width: 22px; height: 22px; flex: none; opacity: 0.8; }

/* ───────── 목록 한 줄(두 줄짜리, 56~64px) */
.rows > li, .row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 9px 0; }
.rows > li + li { border-top: 1px solid var(--rule-2); }
.rows > li.tap { cursor: pointer; }
.row-rank { width: 22px; flex: none; font-size: 15px; font-weight: 700; color: var(--ink-3); text-align: center; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13.5px; color: var(--ink-3); line-height: 1.45; margin-top: 1px; }
.row-sub.wrap { white-space: normal; }
.row-right { text-align: right; flex: none; }
.row-val { font-size: 16px; font-weight: 700; white-space: nowrap; }
.row-val2 { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.col-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); font-weight: 600; padding: 12px 0 4px; }

/* ───────── 온도계 */
.thermo { display: flex; align-items: center; gap: 14px; }
.thermo .big { font-size: 44px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.thermo .lv { font-size: 17px; font-weight: 700; }
.thermo .delta { font-size: 13.5px; color: var(--ink-3); font-weight: 600; }
.gauge { position: relative; height: 10px; border-radius: 5px; margin: 16px 0 6px; background: linear-gradient(90deg, var(--paper-2) 0%, var(--rule) 35%, var(--amber) 100%); }
.gauge i { position: absolute; top: -5px; width: 4px; height: 20px; background: var(--ink); border-radius: 2px; transform: translateX(-2px); box-shadow: 0 0 0 2px var(--card); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.comp { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.comp + .comp { border-top: 1px solid var(--rule-2); }
.comp .nm { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.comp .nt { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.comp .bar { width: 64px; height: 6px; border-radius: 3px; background: var(--paper-2); overflow: hidden; flex: none; }
.comp .bar i { display: block; height: 100%; background: var(--ink-2); }
.comp .sc { width: 26px; text-align: right; font-size: 14px; font-weight: 700; }
details.fold > summary { list-style: none; min-height: 44px; display: flex; align-items: center; gap: 4px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary svg { width: 16px; height: 16px; transition: transform 0.15s; }
details.fold[open] > summary svg { transform: rotate(90deg); }

/* ───────── 일정 */
.sched > li { display: flex; gap: 12px; padding: 11px 0; align-items: flex-start; }
.sched > li + li { border-top: 1px solid var(--rule-2); }
.sched .tm { width: 62px; flex: none; font-size: 14.5px; font-weight: 700; color: var(--ink-2); line-height: 1.5; }
.sched .tm small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.sched .tt { font-size: 16px; font-weight: 600; line-height: 1.45; }
.sched li.done .tt, .sched li.done .tm { color: var(--ink-3); }
.sched .mt { font-size: 13px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.sched .afp { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.sched .afp b { color: var(--ink-2); font-weight: 700; }
.stars { letter-spacing: 1px; color: var(--amber); font-size: 11px; }

/* ───────── 수급 */
.who3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.who { background: var(--card); border: 1px solid var(--rule-2); border-radius: 12px; padding: 11px 10px; min-width: 0; }
.who .nm { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 5px; color: var(--ink-2); }
.who .nm i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.who .v { font-size: clamp(14.5px, 4.3vw, 17px); font-weight: 800; letter-spacing: -0.04em; margin-top: 3px; white-space: nowrap; }
.who .s { font-size: 12px; color: var(--ink-3); line-height: 1.4; margin-top: 3px; }
.legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--sans); font-size: 11px; fill: var(--ink-3); font-weight: 600; }

/* ───────── 테마 지도 */
.treemap { position: relative; width: 100%; height: 320px; border-radius: 12px; overflow: hidden; background: var(--paper-2); margin-top: 10px; }
.tm-cell { position: absolute; padding: 6px 7px; overflow: hidden; border: 1px solid var(--paper); display: flex; flex-direction: column; justify-content: flex-end; text-align: left; color: #fff; }
.tm-cell .n { font-size: 13.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.tm-cell .p { font-size: 12.5px; font-weight: 700; opacity: 0.95; white-space: nowrap; }
.tm-cell.sm { padding: 4px 5px; }
.tm-cell.sm .n { font-size: 11.5px; letter-spacing: -0.04em; }
.tm-cell.sm .p { font-size: 10.5px; letter-spacing: -0.03em; }
.tm-cell.xs .p { display: none; }
.tm-cell.none .n, .tm-cell.none .p { display: none; }
.tm-scale { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 8px; }
.tm-scale i { flex: 1; height: 8px; border-radius: 4px; }

/* ───────── 목표가 표 */
.tgt-prices { font-size: 14px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; }
.tgt-prices .arrow { color: var(--ink-3); margin: 0 3px; }

/* ───────── 리그 */
.mycard { background: var(--card); border: 1.5px solid var(--ink); border-radius: 14px; padding: 16px; margin-top: 10px; }
.mycard .big { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.mycard .l2 { font-size: 16.5px; font-weight: 700; margin-top: 6px; }
.mycard .l3 { font-size: 14px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.pips { display: flex; gap: 6px; margin: 10px 0 4px; }
.pips i { flex: 1; height: 6px; border-radius: 3px; background: var(--paper-2); }
.pips i.on { background: var(--ink); }
.me-row { background: var(--amber-soft); margin: 0 -10px; padding-left: 10px !important; padding-right: 10px !important; border-radius: 8px; border-top-color: transparent !important; }
.me-row + li { border-top-color: transparent !important; }
.gap-row { justify-content: center; color: var(--ink-3); min-height: 28px !important; padding: 0 !important; letter-spacing: 3px; }
.heart { width: 44px; height: 44px; margin-right: -10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); flex: none; }
.heart svg { width: 22px; height: 22px; }
.heart.on { color: var(--up); }
.heart.on svg { fill: currentColor; }

/* ───────── 맞히기 */
.q { font-family: var(--serif); font-size: 23px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; }
.count { font-size: 15px; font-weight: 700; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.pick2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.pick { min-height: 84px; border-radius: 12px; font-size: 20px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--card); text-align: center; }
.pick small { font-size: 12.5px; font-weight: 600; opacity: 0.85; }
.pick.up { color: var(--up); box-shadow: inset 0 0 0 2px var(--up); }
.pick.down { color: var(--down); box-shadow: inset 0 0 0 2px var(--down); }
.pick.up[aria-pressed="true"] { background: var(--up); color: #fff; }
.pick.down[aria-pressed="true"] { background: var(--down); color: #fff; }
.pick:disabled { opacity: 0.5; }
.pick[aria-pressed="true"]:disabled { opacity: 1; }
.ratio { margin-top: 12px; }
.ratio .bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--paper-2); }
.ratio .bar i { display: block; height: 100%; }
.ratio .nums { display: flex; justify-content: space-between; font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; }
.ratio .nums small { font-size: 12.5px; font-weight: 600; margin: 0 4px; }
.ratio.locked { position: relative; }
.ratio.locked .bar, .ratio.locked .nums { filter: blur(7px); opacity: 0.55; }
.ratio .lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; text-align: center; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { background: var(--card); border: 1px solid var(--rule-2); border-radius: 12px; padding: 11px 8px; text-align: center; }
.stat .k { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-top: 1px; white-space: nowrap; }
.stat .v small { font-size: 13px; font-weight: 700; }
.minibar { display: flex; align-items: flex-end; gap: 6px; height: 76px; margin-top: 10px; }
.minibar div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.minibar i { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; }
.minibar span { font-size: 10.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; letter-spacing: -0.03em; }
.resultline { font-size: 16.5px; font-weight: 600; line-height: 1.55; }

/* ───────── 투표 */
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 11px 12px; border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1px var(--rule-2); margin-top: 8px; position: relative; overflow: hidden; }
.opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.opt .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--amber-soft); z-index: 0; }
.opt > * { position: relative; z-index: 1; }
.opt .radio { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--rule); flex: none; display: flex; align-items: center; justify-content: center; }
.opt[aria-pressed="true"] .radio { background: var(--ink); box-shadow: none; color: var(--paper); }
.opt .radio svg { width: 14px; height: 14px; opacity: 0; }
.opt[aria-pressed="true"] .radio svg { opacity: 1; }
.opt .share { font-size: 17px; font-weight: 800; }

/* ───────── 달력 */
.cal-week > li { padding: 12px 0; display: flex; gap: 12px; }
.cal-week > li + li { border-top: 1px solid var(--rule-2); }
.cal-day { width: 46px; flex: none; text-align: center; }
.cal-day b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.cal-day span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.cal-week li.today .cal-day b { background: var(--ink); color: var(--paper); border-radius: 8px; padding: 4px 0; }
.cal-evs { flex: 1; min-width: 0; }
.cal-ev { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.cal-ev .t { width: 44px; flex: none; font-size: 13.5px; font-weight: 700; color: var(--ink-3); }
.cal-ev .n { font-size: 16px; font-weight: 600; line-height: 1.45; }
.cal-ev .v { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.cal-ev i.k { width: 3px; align-self: stretch; border-radius: 2px; background: var(--ink-3); flex: none; margin: 4px 0; }
.k-econ { background: var(--who-for) !important; }
.k-earnings { background: var(--who-inst) !important; }
.k-room { background: var(--amber) !important; }
.k-holiday { background: var(--up) !important; }
.k-market { background: var(--ink-2) !important; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 10px; }
.grid .dow { font-size: 12px; font-weight: 700; color: var(--ink-3); text-align: center; padding: 4px 0; }
.grid button { min-height: 56px; border-radius: 8px; background: var(--card); border: 1px solid var(--rule-2); padding: 4px 2px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.grid button.out { opacity: 0.35; }
.grid button.today { border: 2px solid var(--ink); }
.grid button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.grid button b { font-size: 14.5px; font-weight: 700; }
.grid .dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; max-width: 34px; }
.grid .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }

/* ───────── 더보기 */
.menu > li > button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 0; }
.menu > li + li { border-top: 1px solid var(--rule-2); }
.menu .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--paper-2); display: flex; align-items: center; justify-content: center; flex: none; }
.menu .ic svg { width: 22px; height: 22px; }
.menu .tx { flex: 1; min-width: 0; }
.menu .t1 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.menu .t2 { font-size: 13.5px; color: var(--ink-3); }
.menu .chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.founder { text-align: center; padding: 22px 16px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card); margin-top: 10px; position: relative; }
.founder::before, .founder::after { content: ""; position: absolute; left: 10px; right: 10px; height: 0; border-top: 3px double var(--ink); }
.founder::before { top: 9px; }
.founder::after { bottom: 9px; }
.founder .k { font-size: 13px; font-weight: 700; letter-spacing: 0.3em; color: var(--ink-2); margin-top: 6px; }
.founder .no { font-family: var(--serif); font-size: 44px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.founder .nk { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.founder .dt { font-size: 13px; color: var(--ink-3); }
.field { display: flex; gap: 8px; margin-top: 10px; }
.input { flex: 1; min-width: 0; min-height: 48px; border-radius: 10px; border: 1.5px solid var(--rule); background: var(--card); padding: 0 12px; font-size: 16px; }
.input:focus { outline: none; border-color: var(--ink); }
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--rule-2); }
.switch-row .tx { flex: 1; min-width: 0; }
.switch-row .t1 { font-size: 16px; font-weight: 600; }
.switch-row .t2 { font-size: 13px; color: var(--ink-3); }
.switch { width: 52px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.switch i { width: 48px; height: 28px; border-radius: 14px; background: var(--rule); position: relative; transition: background 0.15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch[aria-checked="true"] i { background: var(--ink); }
.switch[aria-checked="true"] i::after { transform: translateX(20px); background: var(--paper); }
.notice-list > li { padding: 14px 0; font-size: 16px; line-height: 1.6; display: flex; gap: 10px; }
.notice-list > li + li { border-top: 1px solid var(--rule-2); }
.notice-list b.n { font-family: var(--serif); font-size: 20px; line-height: 1.3; flex: none; width: 20px; }
.prose p { font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.prose p + p { margin-top: 8px; }
.prose h3 { font-size: 16px; margin: 16px 0 4px; }
.prose h3:first-child { margin-top: 0; }

/* ───────── 빈 화면·로딩·오류 */
.empty { text-align: center; padding: 26px 12px; color: var(--ink-3); }
.empty .t1 { font-size: 16px; font-weight: 700; color: var(--ink-2); }
.empty .t2 { font-size: 14px; margin-top: 4px; line-height: 1.5; }
.empty .btn { margin-top: 14px; }
.sk { background: linear-gradient(90deg, var(--paper-2) 0%, var(--rule-2) 50%, var(--paper-2) 100%); background-size: 200% 100%; animation: sk 1.3s linear infinite; border-radius: 6px; height: 16px; }
.sk + .sk { margin-top: 10px; }
.sk.w40 { width: 40%; } .sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.h28 { height: 28px; } .sk.h80 { height: 80px; border-radius: 12px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk, .vcard.flash { animation: none; } }
.stale { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; padding: 9px 11px; border-radius: 9px; background: var(--paper-2); color: var(--ink-2); margin-top: 8px; }

/* ───────── 전체 화면 안내(바깥에서 열었을 때, 회원이 아닐 때, 오류) */
.gate { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px 24px; max-width: 480px; margin: 0 auto; }
.gate .masthead { font-size: 28px; }
.gate h1 { font-size: 22px; margin-top: 26px; font-family: var(--serif); }
.gate p { font-size: 16px; color: var(--ink-2); margin-top: 10px; line-height: 1.6; }
.gate .btn { margin-top: 20px; }
.gate .small { font-size: 13px; color: var(--ink-3); margin-top: 22px; line-height: 1.6; }
.gate .small li { padding-left: 10px; position: relative; }
.gate .small li::before { content: "·"; position: absolute; left: 0; }

/* ───────── 아래 탭 */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper); border-top: 1.5px solid var(--ink); padding-bottom: env(safe-area-inset-bottom, 0px); }
#tabs nav { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tab-h); }
#tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; position: relative; }
#tabs button svg { width: 23px; height: 23px; }
#tabs button[aria-current="page"] { color: var(--ink); }
#tabs button[aria-current="page"]::before { content: ""; position: absolute; top: -1.5px; left: 26%; right: 26%; height: 3px; background: var(--ink); }

/* ───────── 아래에서 올라오는 시트·풍선·토스트 */
#scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; opacity: 0; transition: opacity 0.18s; }
#scrim.on { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 480px; margin: 0 auto; background: var(--paper); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); max-height: 88vh; display: flex; flex-direction: column; transform: translateY(102%); transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); padding-bottom: env(safe-area-inset-bottom, 0px); }
.sheet.on { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 4px 18px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 18px; min-width: 0; }
.sheet-x { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; }
.sheet-x svg { width: 22px; height: 22px; }
.sheet-body { padding: 4px 18px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tip-body p { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.tip-body p + p { margin-top: 8px; }
.tip-body p b { color: var(--ink); }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
#toast div { background: var(--ink); color: var(--paper); font-size: 15px; font-weight: 600; padding: 12px 16px; border-radius: 10px; max-width: 420px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); opacity: 0; transform: translateY(8px); transition: opacity 0.18s, transform 0.18s; }
#toast div.on { opacity: 1; transform: none; }
.share-img { width: 100%; border-radius: 12px; border: 1px solid var(--rule-2); display: block; margin-top: 4px; }
.search-list { margin-top: 6px; }
.search-list li button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 6px 0; }
.search-list li + li { border-top: 1px solid var(--rule-2); }
.search-list .add { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--ink-2); flex: none; }
.chap li { display: flex; gap: 10px; font-size: 16px; padding: 5px 0; color: var(--ink-2); }
.chap li b { width: 46px; flex: none; color: var(--ink-3); font-weight: 700; }

@media (min-width: 400px) {
  :root { --pad: 18px; }
  .idx { width: 158px; }
}

.wk { font-size: 15px; font-weight: 800; margin-top: 20px; padding-bottom: 6px; border-bottom: 1.5px solid var(--ink); letter-spacing: -0.01em; }
.wk + div .col-head { padding-top: 10px; }

/* ───────── 방향 색(맨 끝에 둔다): 상승 빨강, 하락 파랑, 0 은 색을 뺀다.
   부품 쪽 규칙이 색을 덮어쓰지 못하게 가장 뒤에서 한 번 더 정한다. */
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--flat) !important; }
.pick.up[aria-pressed="true"], .pick.down[aria-pressed="true"] { color: #fff !important; }
.tag.up { background: var(--up-soft); }
.tag.down { background: var(--down-soft); }
