:root {
  --bg: #0d1117;
  --panel: #0f141b;
  --panel2: #161b24;
  --border: #21262d;
  --text: #c9d1d9;
  --head: #e6edf3;
  --muted: #8b949e;
  --green: #3ddc97;
  --red: #ff6b6b;
  --gold: #f0b90b;
  --blue: #5aa9ff;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --peek: 76px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); }
html { overscroll-behavior: none; }   /* 페이지 전체 튕김은 html 에 걸어야 듣는다 */
body {
  color: var(--text);
  font-family: -apple-system, 'Apple SD Gothic Neo', 'Pretendard', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; background: var(--bg); }
.view { min-height: 100dvh; }
.num, .px, .lv-val, .card-price, .meter-tag { font-variant-numeric: tabular-nums; }

/* ── 목록 ─────────────────────────────────────────── */
.list-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: calc(18px + var(--safe-t)) 16px 10px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--head); font-weight: 800; letter-spacing: .14em; font-size: 17px; }
.brand-sub { color: var(--muted); font-size: 13px; }
.stamp { color: var(--muted); font-size: 12px; }

.filters {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px 10px; background: linear-gradient(var(--bg) 82%, transparent);
}
.chips { display: flex; gap: 6px; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 17px;
  border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 600;
}
.chip.is-on { background: var(--head); border-color: var(--head); color: var(--bg); }
.sort { height: 34px; padding: 0 4px; color: var(--muted); font-size: 13px; }

.cards { padding: 2px 12px 12px; display: grid; gap: 10px; }
.card {
  display: block; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 14px 12px;
}
.card { cursor: pointer; }
.card:active { background: var(--panel2); }
.card:focus-visible, .fav:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.card-right { display: flex; align-items: center; gap: 2px; flex: none; }
.group-label { padding: 6px 4px 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.group-label:first-child { padding-top: 0; }

/* 즐겨찾기 별표 — 손가락으로 누르기 좋게 40px */
.fav { flex: none; width: 40px; height: 40px; display: grid; place-items: center; color: #5b6573; border-radius: 50%; }
.fav svg path { fill: none; }
.fav.is-on { color: var(--gold); }
.fav.is-on svg path { fill: currentColor; }
.fav:active { background: var(--panel2); }
.card .fav { margin: -10px -10px -10px 0; }
.card.is-near { border-color: rgba(240, 185, 11, .55); }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-id { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sym { color: var(--head); font-weight: 800; font-size: 18px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-price { color: var(--head); font-weight: 700; font-size: 16px; white-space: nowrap; }
.card-head { color: var(--text); font-size: 14px; margin: 3px 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  flex: none; height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 800; line-height: 21px;
}
.pill.long { background: rgba(61, 220, 151, .14); color: var(--green); }
.pill.short { background: rgba(255, 107, 107, .14); color: var(--red); }
.grade {
  flex: none; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--muted);
  font-size: 12px; font-weight: 800; line-height: 19px; text-align: center;
}
.grade.a { border-color: rgba(240, 185, 11, .6); color: var(--gold); }

/* 손절 ─ 진입 구간 ─ TP1 위에 현재가를 찍는 위치 막대 */
.meter { position: relative; height: 26px; margin: 0 2px; }
.meter-track { position: absolute; left: 0; right: 0; top: 11px; height: 4px; border-radius: 2px; background: #232a35; }
.meter-zone { position: absolute; top: 7px; height: 12px; border-radius: 3px; background: rgba(240, 185, 11, .30); border: 1px solid rgba(240, 185, 11, .75); }
.meter-end { position: absolute; top: 5px; width: 3px; height: 16px; border-radius: 2px; }
.meter-end.stop { left: 0; background: var(--red); }
.meter-end.t1 { right: 0; background: var(--green); }
.meter-dot {
  position: absolute; top: 6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--head); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--head);
}
.meter-dot.is-out { background: var(--muted); box-shadow: 0 0 0 1px var(--muted); }
.meter-legend { position: relative; display: flex; justify-content: space-between; margin: 2px 2px 0; font-size: 11px; color: var(--muted); }
.meter-legend .zone { position: absolute; top: 0; transform: translateX(-50%); color: var(--gold); }
.meter-legend .stop { color: var(--red); }
.meter-legend .t1 { color: var(--green); }

.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 9px; font-size: 13px; }
.card-state { color: var(--text); font-weight: 600; }
.card-state.near { color: var(--gold); }
.card-state.filled { color: var(--green); }
.card-left { color: var(--muted); white-space: nowrap; }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--head); font-size: 16px; margin-bottom: 6px; }
.empty button { margin-top: 16px; height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid var(--border); color: var(--head); font-weight: 600; }
.list-foot { padding: 6px 20px calc(28px + var(--safe-b)); color: var(--muted); font-size: 11.5px; text-align: center; }

/* ── 차트 화면 ────────────────────────────────────── */
#chart-view {
  position: relative; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  padding-bottom: calc(var(--peek) + var(--safe-b));
}
.top {
  flex: none; display: flex; align-items: center; gap: 4px;
  height: calc(54px + var(--safe-t)); padding: var(--safe-t) 14px 0 4px;
}
.back { width: 44px; height: 44px; display: grid; place-items: center; color: var(--head); }
.top-title { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; }
.top-price { text-align: right; line-height: 1.2; }
.px { display: block; color: var(--head); font-weight: 700; font-size: 17px; }
.px-sub { display: block; color: var(--muted); font-size: 11px; }

.tf { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px 8px; }
.tf-btn { flex: none; height: 32px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.tf-btn.is-on { background: var(--panel2); color: var(--head); }
/* 시간봉이 넷(12시간봉 추가)이라 좁은 폰에서는 상태 글이 줄어든다(…) — 줄이 화면 밖으로 밀리지 않게 */
.tf-status { margin-left: auto; min-width: 0; padding-left: 6px; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tf-shot { flex: none; width: 34px; height: 32px; margin-left: 4px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.tf-shot:hover { color: var(--head); }
.tf-shot:disabled { opacity: .4; cursor: default; }
.tf-status.near { color: var(--gold); }
.tf-status.filled { color: var(--green); }

.chart-wrap { flex: 1; min-height: 0; position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.chart { position: absolute; inset: 0; touch-action: none; }
.ohlc {
  position: absolute; left: 10px; top: 8px; z-index: 3; pointer-events: none;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.ohlc b { color: var(--text); font-weight: 600; margin-right: 6px; }
.chart-msg { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 20px; background: var(--bg); }

/* 그리기 도구(2026-11-16) — 연필 버튼 · 왼쪽 도구 줄 · 그림 판 · 도움말 */
.draw-layer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 2; display: none; touch-action: none; cursor: crosshair;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }   /* iOS: 길게 눌러 끌 때 글자 선택·돋보기·튕김이 화면을 흔들지 않게 */
.draw-layer.is-on { display: block; }
.draw-btn {
  position: absolute; left: 8px; top: 28px; z-index: 5; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--muted);
  background: rgba(22, 27, 36, .88); border: 1px solid var(--border);
}
.draw-btn.is-on { color: var(--head); border-color: var(--blue); }
.draw-bar {
  position: absolute; left: 8px; top: 68px; z-index: 5; width: 42px; max-height: calc(100% - 76px);
  display: flex; flex-direction: column; gap: 1px; padding: 3px; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(15, 20, 27, .94); border: 1px solid var(--border); border-radius: 10px;
}
.draw-bar[hidden] { display: none; }
.draw-tool { flex: none; width: 34px; height: 31px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.draw-tool:hover { color: var(--head); }
.draw-tool.is-on { background: var(--blue); color: var(--bg); }
.draw-tool.is-warn { background: var(--red); color: var(--bg); }
.draw-tool:disabled { opacity: .3; cursor: default; }
.draw-sep { flex: none; height: 1px; margin: 3px 3px; background: var(--border); }
.draw-swatch { width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 2px var(--panel2), 0 0 0 3px var(--border); }
.draw-hint {
  position: absolute; left: 58px; right: 70px; bottom: 36px; z-index: 5; width: max-content; max-width: calc(100% - 128px); margin: 0 auto;
  padding: 6px 10px; border-radius: 8px; background: rgba(22, 27, 36, .94); border: 1px solid var(--border);
  color: var(--text); font-size: 12px; line-height: 1.35; text-align: center; pointer-events: none;
}
.draw-hint[hidden] { display: none; }
.draw-hint.is-act { display: flex; gap: 2px; padding: 3px; pointer-events: auto; }
.draw-hint.is-act[hidden] { display: none; }
.draw-hint.is-act button { width: 40px; height: 34px; border-radius: 7px; display: grid; place-items: center; color: var(--head); }
.draw-hint.is-act button:active { background: var(--panel2); }
.draw-bar { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.levels { flex: none; display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 1px; background: var(--border); }
.lv { background: var(--bg); padding: 8px 4px 9px; text-align: center; min-width: 0; }
.lv-label { display: block; font-size: 11px; font-weight: 700; }
.lv-val { display: block; color: var(--head); font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-val.is-long { font-size: 11.5px; letter-spacing: -.02em; line-height: 20px; }
.lv.entry .lv-label { color: var(--gold); }
.lv.stop .lv-label { color: var(--red); }
.lv.tp .lv-label { color: var(--green); }

/* ── 리포트 시트 ──────────────────────────────────── */
.scrim { position: absolute; inset: 0; z-index: 8; background: rgba(0, 0, 0, .45); }
.sheet {
  position: absolute; left: 0; right: 0; top: 0; height: 100%; z-index: 9;
  background: var(--panel); border-top: 1px solid var(--border); border-radius: 16px 16px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .45);
  transform: translateY(100%); will-change: transform;
  display: flex; flex-direction: column;
}
.sheet.is-anim { transition: transform .26s cubic-bezier(.2, .8, .2, 1); }
.grip { flex: none; padding: 8px 16px 0; height: var(--peek); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.grip-bar { display: block; width: 38px; height: 4px; border-radius: 2px; background: #3a4350; margin: 0 auto 9px; }
.grip-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grip-text { min-width: 0; }
.grip-kicker { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.grip-head { display: block; color: var(--head); font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grip-arrow { flex: none; color: var(--muted); transition: transform .2s; }
.sheet[data-snap="full"] .grip-arrow { transform: rotate(180deg); }

.sheet-body { flex: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 4px 16px calc(28px + var(--safe-b)); border-top: 1px solid var(--border); }
.rp-meta { color: var(--muted); font-size: 12px; padding: 12px 0 0; }
.rp-box { margin: 12px 0 4px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rp-box-row { display: flex; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); }
.rp-box-row:first-child { border-top: 0; }
.rp-box-k { flex: none; width: 76px; color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.rp-box-v { color: var(--head); font-size: 14px; font-weight: 600; min-width: 0; }
.rp-signals { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.rp-signal { padding: 5px 10px; border-radius: 8px; background: var(--panel2); color: var(--text); font-size: 12.5px; }
.rp-h { color: var(--head); font-size: 15px; font-weight: 800; margin: 26px 0 8px; }
.rp-list { margin: 0; padding: 0; list-style: none; }
.rp-list li { position: relative; padding: 0 0 10px 14px; color: var(--text); font-size: 14.5px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.rp-list li::before { content: ''; position: absolute; left: 0; top: .72em; width: 5px; height: 5px; border-radius: 50%; background: #4a5462; }
.rp-list.warn li::before { background: var(--gold); }
.rp-list.stopcond li::before { background: var(--red); }
.rp-p { color: var(--text); font-size: 14.5px; line-height: 1.6; margin: 0 0 10px; word-break: keep-all; overflow-wrap: anywhere; }

.pv { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--bg); }
.pv summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px; cursor: pointer; }
.pv summary::-webkit-details-marker { display: none; }
.pv-name { color: var(--head); font-weight: 700; font-size: 14.5px; flex: 1; min-width: 0; }
.pv-conf { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pv-caret { color: var(--muted); transition: transform .2s; }
.pv[open] .pv-caret { transform: rotate(180deg); }
.pv-body { padding: 0 12px 4px; }
.rp-foot { color: var(--muted); font-size: 11.5px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); }
.bf { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.bf-sec { border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 2px; background: var(--bg); }
.bf-h { display: flex; align-items: center; gap: 7px; margin: 0 0 9px; color: var(--head); font-size: 14px; font-weight: 800; }
.bf-h::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--blue); }
.bf-stop .bf-h::before { background: var(--red); }
.bf-flip .bf-h::before { background: #b28dff; }
.bf-watch .bf-h::before { background: var(--gold); }
.bf .rp-list li { font-size: 14px; line-height: 1.55; padding-bottom: 9px; }
.rp-list.flip li::before { background: #b28dff; }
.rp-full { margin-top: 16px; border-top: 1px solid var(--border); }
.rp-full > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 4px; color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.rp-full > summary::-webkit-details-marker { display: none; }
.rp-full[open] > summary .pv-caret { transform: rotate(180deg); }
.rp-full > .rp-h:first-of-type { margin-top: 12px; }
.rp-loading { padding: 28px 0; color: var(--muted); text-align: center; }

@media (min-width: 521px) {
  body { background: #06080b; }
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  .sheet.is-anim, .grip-arrow, .pv-caret { transition: none; }
}

/* ── 입장 화면 ────────────────────────────────────── */
.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 28px calc(32px + var(--safe-b)); }
.gate-mark { color: var(--head); font-weight: 800; letter-spacing: .18em; font-size: 15px; margin-bottom: 44px; }
.gate-body h1 { color: var(--head); font-size: 22px; font-weight: 800; margin: 0 0 10px; }
.gate-body p { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0 auto; max-width: 300px; word-break: keep-all; }
.gate-actions { display: grid; gap: 10px; margin-top: 32px; width: 100%; min-width: 260px; }
.gate-btn { display: grid; place-items: center; height: 50px; border-radius: 12px; border: 1px solid var(--border); color: var(--head); font-size: 15px; font-weight: 700; text-decoration: none; }
.gate-btn.primary { background: var(--head); border-color: var(--head); color: var(--bg); }
.gate-link { color: var(--muted); font-size: 13px; margin-top: 6px; }
.gate-foot { color: #5b6573; font-size: 12px; margin-top: 44px; }

/* ── 메뉴(우상단) · 내 정보 · 언어 (2026-11-14) ───────────── */
.list-head { align-items: center; }
.head-right { display: flex; align-items: center; gap: 4px; }
.menu-btn { width: 40px; height: 40px; margin-right: -8px; display: grid; place-items: center; color: var(--head); border-radius: 10px; }
.menu-btn:active { background: var(--panel2); }
.menu-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); }
.menu {
  position: fixed; z-index: 41; top: calc(8px + var(--safe-t)); right: max(8px, calc(50vw - 252px));
  width: min(300px, calc(100vw - 16px)); padding: 8px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.menu-me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 10px; text-align: left; color: var(--muted); }
.menu-me:active, .menu-item:active { background: var(--panel2); }
.menu-me-t { flex: 1; min-width: 0; display: grid; }
.menu-me-t b { color: var(--head); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-me-t span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--panel2); color: var(--head); font-weight: 800; font-size: 15px; }
.avatar.big { width: 56px; height: 56px; font-size: 22px; }
.menu-sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-top: 1px solid var(--border); margin-top: 4px; }
.menu-k { color: var(--muted); font-size: 13px; font-weight: 700; }
.menu .seg { margin: 0; }
.menu-item { display: block; width: 100%; padding: 12px 10px; border-radius: 10px; text-align: left; color: var(--head); font-size: 14.5px; font-weight: 600; }
#menu-flow { border-top: 1px solid var(--border); margin-top: 4px; }
.menu-item.danger { color: var(--red); }

.me { min-height: 100dvh; }
.me-body { padding: 8px 16px calc(32px + var(--safe-b)); }
.me-head { display: flex; align-items: center; gap: 14px; padding: 12px 4px 18px; }
.me-head b { color: var(--head); font-size: 20px; font-weight: 800; word-break: break-all; }
.me-box { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.me-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--border); }
.me-row:first-child { border-top: 0; }
.me-k { color: var(--muted); font-size: 13.5px; flex: none; }
.me-v { color: var(--head); font-size: 14.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.me-v.ok { color: var(--green); }
.me-v.bad { color: var(--red); }
.me-left { margin-left: 6px; color: var(--gold); font-weight: 800; }
.me-note { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 12px 4px 0; word-break: keep-all; }
.me-note.dim { color: #5b6573; font-size: 12px; }
.me-logout { margin-top: 24px; width: 100%; color: var(--red); }
.gate-lang { margin-top: 14px; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.menu-err { margin: 2px 10px 6px; color: var(--red); font-size: 12.5px; line-height: 1.5; }
button.gate-link { display: block; margin: 8px auto 0; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ── 데스크탑 3단 (2026-11-15): 종목 | 차트(고정) | 리포트 · 실시간 수급 ─────────────
   기준 폭 1180px 은 app.js 의 deskMQ 와 같아야 한다. 그보다 좁으면 휴대폰 화면 그대로다.
   차트 화면(#chart-view)은 display: contents 로 풀어서, 그 안의 부품을 2단(차트)과 3단(리포트)에 나눠 앉힌다. */
.side-tabs { display: none; }
@media (min-width: 1180px) {
  body { background: var(--bg); overflow: hidden; }
  #app {
    max-width: none; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; border: 0;
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr) 400px;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  }
  #gate-view { grid-column: 1 / -1; grid-row: 1 / -1; }
  /* 목록을 내려도 메뉴 버튼·필터가 위에 남는다 */
  #list-view .list-head { position: sticky; top: 0; z-index: 6; height: 62px; padding-top: 0; padding-bottom: 0; background: var(--bg); }
  #list-view .filters { top: 62px; }
  #list-view .brand { flex-direction: column; align-items: flex-start; gap: 0; }
  #list-view .stamp, .sort { white-space: nowrap; }
  #list-view { scrollbar-width: thin; }
  #list-view .filters { flex-wrap: wrap; row-gap: 4px; padding-left: 12px; padding-right: 12px; }
  #list-view .chip { padding: 0 10px; font-size: 12.5px; white-space: nowrap; }

  /* 1단: 종목 — 이 칸 안에서만 위아래로 스크롤 */
  #list-view { grid-column: 1; grid-row: 1 / -1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--border); }
  .card.is-sel { border-color: rgba(90, 169, 255, .65); background: var(--panel2); }

  /* 2단: 차트 — 움직이지 않는다 */
  #chart-view { display: contents; }
  #chart-view > .top { grid-column: 2; grid-row: 1; padding-left: 14px; }
  #chart-view > .tf { grid-column: 2; grid-row: 2; }
  #chart-view > .chart-wrap { grid-column: 2; grid-row: 3; }
  #chart-view > .levels { grid-column: 2; grid-row: 4; }
  #chart-view > .flowbar { grid-column: 2; grid-row: 5; }
  #back-btn, #scrim, #grip, #feed-back { display: none !important; }

  /* 3단: 위 탭 + 리포트(위아래 스크롤) 또는 실시간 수급 · 알림 설정 · 내 정보 */
  .side-tabs {
    display: flex; grid-column: 3; grid-row: 1; align-items: center; gap: 4px; padding: 0 12px;
    border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--panel);
  }
  .side-tab { height: 34px; padding: 0 14px; border-radius: 8px; color: var(--muted); font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-tab.is-on { background: var(--panel2); color: var(--head); }
  .side-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
  #sheet, #feed-view, #alerts-view, #me-view { grid-column: 3; grid-row: 2 / -1; min-height: 0; border-left: 1px solid var(--border); }
  #sheet { position: static; transform: none !important; height: auto; z-index: auto; border-radius: 0; border-top: 0; box-shadow: none; }
  #sheet-body { flex: 1; height: auto !important; min-height: 0; border-top: 0; padding-bottom: 28px; }
  #sheet-body .sh-tabs { display: none; }   /* 리포트 | 수급 탭은 위 탭으로 올렸다 */
  #app:not([data-side="report"]) #sheet { display: none; }
  #feed-view, #alerts-view, #me-view { overflow-y: auto; overscroll-behavior: contain; }

  .menu { right: auto; left: 28px; top: 58px; }
  #toast { left: auto; right: 16px; top: 64px; width: 380px; max-width: none; }   /* 오른쪽 칸 탭을 가리지 않게 */
}
@media (min-width: 1180px) and (hover: hover) {
  .card:hover { background: var(--panel2); }
  .side-tab:hover, .tf-btn:hover { color: var(--head); }
}
@media (min-width: 1600px) {
  #app { grid-template-columns: 360px minmax(0, 1fr) 460px; }
}

/* 좁은 폰(360px 미만, 2026-11-15 12시간봉 추가 검수): 시간봉 탭을 좁혀 상태 글(진입 구간까지 2.34%)이 잘리지 않게 */
@media (max-width: 359px) {
  .tf { padding: 0 8px 8px; }
  .tf-btn { padding: 0 7px; }
}
