/* ============================================
   InsightTube Macro — 가로 시간선 + 하단 패널  (디자인 v2, 2026-10-15)
   원칙: 시간선은 흰 캔버스 위의 그림, 도구는 조용하게, 선택된 것만 색이 찬다.
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #f3f3f6;            /* 페이지 바탕 (회색) */
    --surface: #ffffff;       /* 카드·캔버스 (흰색) */
    --surface-2: #ebebf0;     /* 눌린 면 */
    --text: #1c1c21;
    --text-2: #4b4b55;
    --muted: #80808a;
    --border: #e3e3e8;
    --hair: rgba(28, 28, 33, 0.07);
    --accent: #2f6fd6;
    --accent-ink: #1f4fa3;
    --accent-soft: rgba(47, 111, 214, 0.10);
    --hit: #0e8f5b;  --hit-soft: rgba(14, 143, 91, 0.12);
    --miss: #c84a4a; --miss-soft: rgba(200, 74, 74, 0.12);
    --pending: #a2a2ac;
    --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.06), 0 2px 8px rgba(20, 20, 40, 0.04);
    --shadow: 0 14px 40px rgba(20, 20, 40, 0.12);
    --p0: #2f6fd6; --p1: #6b5ce7; --p2: #c2620a; --p3: #0e8f7e; --p4: #c0356b; --p5: #5d7a1f; --p6: #b8860b; --p7: #1f4fa3;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f0f12; --surface: #18181d; --surface-2: #26262d; --text: #ececf0; --text-2: #c2c2ca; --muted: #8e8e98;
        --border: #2a2a32; --hair: rgba(255,255,255,0.07);
        --accent: #6ea5ff; --accent-ink: #9cc0ff; --accent-soft: rgba(110, 165, 255, 0.14);
        --hit: #4cc38a; --hit-soft: rgba(76, 195, 138, 0.16);
        --miss: #f08080; --miss-soft: rgba(240, 128, 128, 0.16);
        --pending: #5d5d68;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.4); --shadow: 0 14px 40px rgba(0,0,0,0.55);
        --p0: #6ea5ff; --p1: #9d92ff; --p2: #f0a04b; --p3: #3cc4b0; --p4: #f07aa5; --p5: #a9c95a; --p6: #e0b84a; --p7: #8fb8ff;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0f0f12; --surface: #18181d; --surface-2: #26262d; --text: #ececf0; --text-2: #c2c2ca; --muted: #8e8e98;
    --border: #2a2a32; --hair: rgba(255,255,255,0.07);
    --accent: #6ea5ff; --accent-ink: #9cc0ff; --accent-soft: rgba(110, 165, 255, 0.14);
    --hit: #4cc38a; --hit-soft: rgba(76, 195, 138, 0.16);
    --miss: #f08080; --miss-soft: rgba(240, 128, 128, 0.16);
    --pending: #5d5d68;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4); --shadow: 0 14px 40px rgba(0,0,0,0.55);
    --p0: #6ea5ff; --p1: #9d92ff; --p2: #f0a04b; --p3: #3cc4b0; --p4: #f07aa5; --p5: #a9c95a; --p6: #e0b84a; --p7: #8fb8ff;
    color-scheme: dark;
}
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    font-size: 14px; line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.w { display: none; }
html[data-write="1"] .w { display: initial; }
html[data-write="1"] .w.flex { display: flex; }

/* ---------- 뼈대 ---------- */
.app { height: 100%; display: flex; flex-direction: column; }

/* ---------- 상단 바: 1줄 이름·탭·동작, 2줄 도구 ---------- */
.bar { flex: 0 0 auto; padding: 10px 28px 0; background: var(--bg); }
.bar-row { display: flex; align-items: center; gap: 16px; min-height: 36px; }
.bar .back { color: var(--muted); font-size: 13px; white-space: nowrap; }
.bar .back:hover { color: var(--text); }
.bar h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.tabs button { padding: 5px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs .cnt { margin-left: 6px; font-size: 11px; color: var(--accent); font-weight: 700; }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.bar-row.tools { margin-top: 8px; padding: 0 0 10px; gap: 8px; }
.chips-scroll { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: nowrap; width: max-content; align-items: center; }
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px 5px 9px; border-radius: 999px; border: 1px solid var(--border);
    font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--surface);
    white-space: nowrap; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip:hover { border-color: var(--c); }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; background: var(--c); opacity: 0.45; }
.chip[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-color: color-mix(in srgb, var(--c) 55%, var(--border)); font-weight: 600; }
.chip[aria-pressed="true"] .sw { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent); }
.chip.ind { border-style: dashed; }
.chip.ind .sw { border-radius: 2px; }
.chip.ind[aria-pressed="true"] { border-style: solid; }
.chip.edit { border-style: solid; color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.plain { font-size: 12.5px; color: var(--muted); padding: 5px 9px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.plain:hover { background: var(--surface-2); color: var(--text); }
.plain.on { color: var(--accent); }
.lock { display: inline-flex; align-items: center; gap: 6px; }
.lock svg { width: 13px; height: 13px; }
.more { position: relative; }
.more > summary { list-style: none; cursor: pointer; }
.more > summary::-webkit-details-marker { display: none; }
.more .menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 200px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px;
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.more .menu .chip { border: 0; justify-content: flex-start; background: none; font-weight: 500; }
.more .menu .chip:hover { background: var(--surface-2); }
.more .menu .chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 14%, var(--surface)); font-weight: 600; }
.more .menu.menu-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; min-width: 340px; max-height: calc(100vh - 140px); overflow-y: auto; overscroll-behavior: contain; padding: 0 8px; }
.menu-2col .menu-head { font-size: 11px; color: var(--muted); padding: 10px 10px 4px; font-weight: 600; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.menu-2col .col { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; }
.menu-2col .col .chip { padding: 3px 10px; font-size: 12.5px; }
.more .menu.menu-2col .edit { grid-column: 1 / -1; justify-content: center; position: sticky; bottom: 0; margin: 0 -8px; padding: 9px 10px; background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }
.more .menu.menu-2col .edit:hover { background: var(--accent-soft); }
.vsep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.switch { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px; border-radius: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.switch:hover { background: var(--surface-2); }
.switch .sw-track { width: 30px; height: 17px; border-radius: 999px; background: var(--border); position: relative; transition: background 0.15s; flex: 0 0 auto; }
.switch .sw-knob { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: left 0.15s; }
.switch[aria-checked="true"] .sw-track { background: var(--accent); }
.switch[aria-checked="true"] .sw-knob { left: 15px; }
.switch[aria-checked="true"] .sw-label { color: var(--text); }
.seg { display: flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { padding: 3px 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; border-radius: 7px; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- 무대: 흰 캔버스 ---------- */
.stage {
    flex: 1 1 auto; position: relative; min-height: 0; margin: 0 28px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px 16px 0 0; overflow: hidden;
    --gutter: 78px;
}
.scroller {
    position: absolute; top: 0; bottom: 0; left: var(--gutter); right: 0;
    overflow-x: auto; overflow-y: hidden;
    cursor: default; user-select: none; scrollbar-width: thin;   /* grab/grabbing 은 Chrome 자체 그림이라 Windows 커서 설정을 안 따름 → OS 커서만 사용 */
}
.scroller.dragging { cursor: move; }
.ev, .ev * { cursor: pointer; }
.track { position: relative; height: 100%; overflow: hidden; }
.price { position: absolute; left: 0; top: 0; width: 100%; display: block; }
.price .grid line { stroke: var(--hair); stroke-width: 1; }
.price .area { opacity: 0.9; }
.price .line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.price .line.ind { stroke-dasharray: 5 4; stroke-width: 1.5; }
.price .win { fill: var(--accent); opacity: 0.07; }
.price .win-edge { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.price .pt { stroke: var(--surface); stroke-width: 1.5; }
.lanes { position: absolute; left: 0; right: 0; }
.lane { position: relative; height: var(--lane-h); border-top: 1px solid var(--hair); }
.lane:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.lane.note { background: repeating-linear-gradient(90deg, transparent 0 6px, var(--hair) 6px 7px); background-size: 7px 1px; background-repeat: repeat-x; }
.ev {
    --dc: 7.5px;   /* 원의 중심 = 2px 패딩 + 반지름. 이 지점을 시각 위치에 고정, 제목은 오른쪽으로만 */
    position: absolute; top: 50%; transform: translate(calc(-1 * var(--dc)), -50%);
    display: flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 2px; border-radius: 999px;
    white-space: nowrap; font-size: 12px; color: var(--text-2);
}
.ev .dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; background: var(--pending); box-shadow: 0 0 0 2px var(--surface); transition: transform 0.12s; }
.ev.hit .dot { background: var(--hit); }
.ev.miss .dot { background: var(--miss); }
.ev.pending .dot { background: var(--surface); border: 2px solid var(--pending); }
.ev.judged .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--pending); }
.ev.j-agree .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.ev.j-disagree .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--miss) 45%, var(--surface)); }
.ev.j-unsure .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--border); }
/* 결과가 나온 뒤: 고리 = 내 판단이 맞았나 */
.ev.j-right .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--hit); }
.ev.j-wrong .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--miss); }
.et-j b.right { color: var(--hit); } .et-j b.wrong { color: var(--miss); }
.p-sum .mv { font-style: normal; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }
.p-sum .mv.right { color: var(--hit); background: color-mix(in srgb, var(--hit) 12%, var(--surface)); }
.p-sum .mv.wrong { color: var(--miss); background: color-mix(in srgb, var(--miss) 12%, var(--surface)); }
.ev .lb { overflow: hidden; text-overflow: ellipsis; max-width: var(--lbw, 150px); padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.ev.nolabel .lb { display: none; }
.ev:hover .dot { transform: scale(1.35); }
/* 선택한 사건: 파란 고리 + 세로선. 제목은 다른 사건과 같은 규칙(자리 있을 때만) */
.ev.sel { z-index: 3; }
.ev.sel .dot { transform: scale(1.45); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--accent), 0 0 0 9px color-mix(in srgb, var(--accent) 18%, transparent); }
.ev.sel .lb { font-weight: 700; color: #fff; background: var(--accent); box-shadow: var(--shadow-sm); }   /* 자리가 있을 때만 보임(옆 사건을 덮지 않음) */
.ev.sel::before { content: ''; position: absolute; left: calc(var(--dc) - 1px); top: -3000px; bottom: -3000px; width: 0; border-left: 2px solid var(--accent); opacity: 0.55; pointer-events: none; }
.ev.n.sel .dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
/* 내 예측(Mysight): 마름모 */
.ev.hunch .dot { border-radius: 2px; transform: rotate(45deg) scale(0.85); background: var(--pending); }
.ev.hunch.hit .dot { background: var(--hit); } .ev.hunch.miss .dot { background: var(--miss); }
.ev.hunch.partial .dot { background: #c2620a; }
.ev.hunch.pending .dot { background: var(--surface); border: 2px solid var(--accent); }
.ev.hunch:hover .dot { transform: rotate(45deg) scale(1.1); }
.ev.hunch.sel .dot { transform: rotate(45deg) scale(1.2); }
.badge.partial { background: rgba(194, 98, 10, 0.14); color: #b45a08; }
.ev.cluster.partial .dot { border-color: #c2620a; }
.p-top .p-mypred { margin-left: auto; flex: none; margin-top: 2px; }
.p-top .p-mypred + .close { margin-left: 0; }
.sortbar.since { margin-top: 0; margin-bottom: 14px; flex-wrap: wrap; }
.sortbar .hint-inline { font-size: 11.5px; }
/* 중요도: 1 참고(작은 점) · 2 보통 · 3 핵심(큰 점, 굵은 제목) */
.ev.imp1 { --dc: 5.5px; }
.ev.imp1 .dot { width: 7px; height: 7px; opacity: 0.75; }
.ev.imp1.pending .dot { border-width: 1.5px; }
.ev.imp3 { --dc: 8.5px; }
.ev.imp3 .dot { width: 13px; height: 13px; }
.ev.imp3 .lb { font-weight: 600; color: var(--text); }
/* 같은 날 묶음: 숫자가 든 원 */
.ev.cluster { --dc: 11px; }
.ev.cluster .dot { width: 18px; height: 18px; background: var(--surface); border: 2px solid var(--text-2); display: flex; align-items: center; justify-content: center; }
.ev.cluster .dot b { font-size: 10px; font-weight: 700; color: var(--text); line-height: 1; }
.ev.cluster.hit .dot { border-color: var(--hit); } .ev.cluster.miss .dot { border-color: var(--miss); } .ev.cluster.pending .dot { border-color: var(--pending); }
.ev.cluster.mixed .dot { border-color: var(--text-2); background: linear-gradient(135deg, var(--surface) 50%, color-mix(in srgb, var(--text-2) 12%, var(--surface)) 50%); }
.ev.cluster.sel .dot { transform: scale(1.2); }
/* 접은 행 */
.lane.off { height: var(--lane-off-h); background: repeating-linear-gradient(90deg, transparent 0 4px, var(--hair) 4px 5px); background-size: 5px 1px; background-repeat: repeat-x; background-position: 0 50%; }
.lane-names button.off { height: var(--lane-off-h); font-size: 9.5px; opacity: 0.55; padding-top: 0; padding-bottom: 0; }
.lane-names button:hover { color: var(--text); background: var(--surface-2); }
/* 묶음에서 고르기 */
.cluster-menu { position: absolute; z-index: 7; min-width: 240px; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.cluster-menu .cm-head { font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 10px 4px; }
.cluster-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; }
.cluster-menu button:hover { background: var(--surface-2); }
.cluster-menu button time { flex: 0 0 auto; color: var(--muted); font-size: 11px; min-width: 48px; }
.cluster-menu button span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cluster-menu button .badge { flex: 0 0 auto; }
.et-list div { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; }
.et-list time { color: var(--muted); font-size: 11px; flex: 0 0 auto; }
.et-list span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.et-list .badge { flex: 0 0 auto; }
.et-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.tip b small { font-weight: 400; color: var(--muted); }
.tip .row small { color: var(--muted); font-size: 10.5px; margin-left: 4px; }
.p-meta time small { color: var(--muted); }
.ev.n { font-size: 11.5px; color: var(--muted); }
.ev.n .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--muted); transform: rotate(45deg); }
.ev.n.draft .dot { background: var(--surface); border: 1.5px solid var(--muted); }
.axis { position: absolute; left: 0; right: 0; bottom: 0; height: var(--axis-h); border-top: 1px solid var(--border); background: var(--surface); }
.axis .mon { position: absolute; top: 5px; font-size: 11.5px; font-weight: 600; color: var(--text-2); padding-left: 8px; border-left: 1px solid var(--border); height: 100%; white-space: nowrap; }
.axis .day { position: absolute; bottom: 4px; font-size: 10px; color: var(--muted); transform: translateX(-50%); }
.today-line { position: absolute; top: 0; bottom: var(--axis-h); width: 0; border-left: 1.5px solid var(--accent); opacity: 0.8; pointer-events: none; }
.today-line::after { white-space: nowrap; content: '오늘'; position: absolute; bottom: 6px; left: -1px; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: #fff; background: var(--accent); padding: 1px 7px; border-radius: 999px; }
.hover-line { position: absolute; top: 0; bottom: var(--axis-h); width: 0; border-left: 1px dashed var(--muted); opacity: 0; pointer-events: none; }
.tip {
    position: absolute; top: 34px; transform: translateX(-50%);
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 9px 12px 8px; font-size: 12px; pointer-events: none; opacity: 0;
    box-shadow: var(--shadow); white-space: nowrap; min-width: 160px;
}
.tip b { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--hair); }
.tip .row { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.tip .row i { font-style: normal; color: var(--text-2); flex: 1 1 auto; display: inline-flex; align-items: center; gap: 7px; }
.tip .row i::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tip .row span { font-weight: 700; color: var(--text); }
.ev-tip {
    position: absolute; z-index: 6; pointer-events: none; max-width: 300px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
    padding: 9px 12px 10px; font-size: 12.5px; line-height: 1.45;
}
.ev-tip .et-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.ev-tip .et-meta .cat { padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.ev-tip .et-title { font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.ev-tip .et-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.ev-tip .et-j { font-size: 11.5px; color: var(--muted); }
.ev-tip .et-j b { color: var(--text-2); font-weight: 600; }
.ev-tip .et-exp { font-size: 11.5px; color: var(--text-2); margin-top: 5px; }
.ev-tip .et-exp i { font-style: normal; margin-right: 8px; white-space: nowrap; }
.ev-tip .et-exp i.up { color: var(--miss); } .ev-tip .et-exp i.dn { color: var(--hit); }
.ev-tip::after { content: ''; position: absolute; left: 14px; bottom: -6px; width: 10px; height: 10px; background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.ev-tip.below::after { bottom: auto; top: -6px; transform: rotate(-135deg); }
.lane-names { position: absolute; left: 0; top: 0; width: var(--gutter); border-right: 1px solid var(--border); background: var(--surface); z-index: 2; }
.lane-names button { width: 100%; cursor: pointer; }
.lane-names button, .lane-names div { height: var(--lane-h); display: flex; align-items: center; justify-content: flex-end; padding: 0 12px 0 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-top: 1px solid var(--hair); }
.stage-foot { position: absolute; right: 12px; bottom: calc(var(--axis-h) + 10px); display: flex; flex-direction: column; align-items: stretch; gap: 6px; z-index: 2; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); padding: 8px 10px 6px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.legend { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); pointer-events: none; padding-bottom: 6px; border-bottom: 1px solid var(--hair); }
.stage-foot .switch { padding: 2px 0 0; justify-content: flex-start; }
.stage-foot .switch:hover { background: none; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend .l-hit i { background: var(--hit); }
.legend .l-miss i { background: var(--miss); }
.legend .l-pend i { border: 2px solid var(--pending); }
.legend .l-j i, .legend .l-j2 i, .legend .l-j3 i { background: var(--pending); width: 7px; height: 7px; margin: 1px; }
.legend .l-j i { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, var(--surface)); }
.legend .l-j2 i { box-shadow: 0 0 0 2px color-mix(in srgb, var(--miss) 45%, var(--surface)); }
.legend .l-j3 i { box-shadow: 0 0 0 2px var(--border); }
.legend .l-r i, .legend .l-w i { background: var(--pending); width: 7px; height: 7px; margin: 1px; }
.legend .l-r i { box-shadow: 0 0 0 2px var(--hit); }
.legend .l-w i { box-shadow: 0 0 0 2px var(--miss); }
.legend .l-sep { height: 1px; background: var(--hair); margin: 3px 0; }
.stage-head { position: absolute; right: 12px; top: 10px; display: flex; align-items: center; gap: 6px; z-index: 2; max-width: calc(100% - var(--gutter) - 24px); }
.price-names { display: flex; gap: 6px; font-size: 12px; pointer-events: none; flex-wrap: wrap; justify-content: flex-end; }
.price-names span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--border); padding: 3px 9px 3px 7px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.price-names i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--c); }
.price-names b { font-weight: 700; color: var(--text); }
.price-names small { color: var(--muted); font-size: 11px; }
.stage-head .today { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); border-radius: 999px; padding: 4px 11px; color: var(--text-2); }
.stage-head .today:hover { color: var(--accent); border-color: var(--accent); }
.empty {
    position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 3;
    text-align: center; color: var(--muted); font-size: 13.5px; max-width: 34em; line-height: 1.7;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 24px; box-shadow: var(--shadow);
}
.empty b { color: var(--text); display: block; margin-bottom: 4px; }
.empty code { font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.price-empty { position: absolute; right: 100px; top: 16px; font-size: 12.5px; color: var(--muted); pointer-events: none; z-index: 2; }

/* ---------- 하단 패널: 회색 바탕 위 흰 카드 ---------- */
.panel { flex: 0 0 auto; height: 0; overflow: hidden; background: var(--bg); border-top: 1px solid var(--border); transition: height 0.22s ease; position: relative; }
.panel.open { height: 42vh; }
.panel.dragging { transition: none; }
.panel .grip { position: absolute; left: 0; right: 0; top: 0; height: 14px; cursor: row-resize; display: flex; align-items: center; justify-content: center; z-index: 3; touch-action: none; }
.panel .grip span { width: 44px; height: 4px; border-radius: 2px; background: var(--border); transition: background 0.12s; }
.panel .grip:hover span, .panel.dragging .grip span { background: var(--accent); }
.panel-in { height: 100%; overflow-y: auto; padding: 18px 28px 32px; }
.p-top { display: flex; align-items: flex-start; gap: 12px; }
.p-top .close { margin-left: auto; color: var(--muted); font-size: 13px; padding: 4px 10px; border-radius: 8px; white-space: nowrap; background: var(--surface); border: 1px solid var(--border); }
.p-top .close:hover { color: var(--text); }
.p-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.p-meta .cat { padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 500; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.hit { background: var(--hit-soft); color: var(--hit); }
.badge.miss { background: var(--miss-soft); color: var(--miss); }
.badge.pending { background: var(--surface-2); color: var(--muted); }
.badge.draft { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.panel h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.p-head { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.p-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.p-sum { display: flex; align-items: stretch; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.p-sum .s { padding: 7px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); min-width: 112px; box-shadow: var(--shadow-sm); }
.p-sum .s small { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; font-weight: 500; }
.p-sum .s b { font-size: 13.5px; font-weight: 700; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.p-sum .s b i { font-style: normal; white-space: nowrap; }
.p-sum .s b i.up { color: var(--miss); } .p-sum .s b i.dn { color: var(--hit); } .p-sum .s b i.muted { color: var(--muted); font-weight: 500; }
.p-sum .s.arrow { background: none; border: 0; box-shadow: none; min-width: 0; padding: 0 4px; display: flex; align-items: center; color: var(--muted); font-size: 16px; }
.p-sum .s.result { background: none; box-shadow: none; }
.p-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-top: 14px; font-size: 13px; }
.p-grid section { grid-column: span 4; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px 15px; min-width: 0; box-shadow: var(--shadow-sm); }
.p-grid section.wide { grid-column: span 8; }
.p-grid section h3 { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 10px; display: flex; align-items: baseline; gap: 6px; }
.p-grid section h3 small { font-weight: 400; color: var(--muted); font-size: 11px; }
.p-grid section h3.sub { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair); }
.facts { list-style: none; }
.facts li { padding-left: 14px; position: relative; margin-bottom: 6px; line-height: 1.55; color: var(--text-2); }
.facts li::before { content: ''; position: absolute; left: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.7; }
.srcs-box { margin-top: 10px; }
.srcs-box > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 3px 10px 3px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); user-select: none; }
.srcs-box > summary::-webkit-details-marker { display: none; }
.srcs-box > summary::before { content: ''; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); transform: rotate(-90deg); transition: transform 0.12s; }
.srcs-box[open] > summary::before { transform: rotate(0); }
.srcs-box > summary:hover { color: var(--text); border-color: var(--text-2); }
.srcs { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.srcs a { font-size: 12px; padding: 5px 10px; border-radius: 8px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--bg); display: flex; gap: 8px; align-items: center; }
.srcs a::before { content: attr(data-kind); flex: 0 0 auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; }
.srcs a:hover { color: var(--accent); }
.prior { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.exp { display: flex; flex-direction: column; gap: 6px; }
.exp-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 11px; border-radius: 9px; background: var(--bg); }
.exp .as { font-weight: 600; flex: 1 1 auto; }
.exp .dir { color: var(--muted); font-weight: 700; white-space: nowrap; }
.exp .dir.up { color: var(--miss); } .exp .dir.dn { color: var(--hit); }
.exp .hz { color: var(--muted); font-size: 12px; white-space: nowrap; }
.why { margin-top: 12px; color: var(--text-2); font-size: 12.5px; border-left: 2px solid var(--accent); padding-left: 10px; line-height: 1.55; }
.judge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.judge .ans { white-space: nowrap; font-weight: 700; padding: 5px 15px; border-radius: 999px; background: var(--accent); color: #fff; }
.judge .ans.none { background: var(--surface-2); color: var(--muted); font-weight: 500; }
.judge time { color: var(--muted); font-size: 12.5px; }
.judge-note { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.judge-prev { margin-top: 8px; font-size: 12px; color: var(--muted); }
.judge-prev small { font-size: 11px; }
.btn.ghost { border-style: dashed; color: var(--muted); }
.jopts { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.judge-web { margin-top: 12px; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.obs-wrap { overflow-x: auto; }
table.obs { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.obs th, table.obs td { white-space: nowrap; }
table.obs th { text-align: right; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 0 5px 8px; border-bottom: 1px solid var(--border); }
table.obs th:first-child, table.obs td:first-child { text-align: left; }
table.obs td { text-align: right; padding: 8px 5px; border-bottom: 1px solid var(--hair); }
table.obs td:first-child { font-weight: 600; }
table.obs tbody tr:last-child td { border-bottom: 0; }
table.obs td.chg { font-weight: 700; }
table.obs td.chg.up { color: var(--miss); } table.obs td.chg.dn { color: var(--hit); }
table.obs td.muted { color: var(--muted); }
.foot { margin-top: 10px; padding: 0 2px; font-size: 12px; color: var(--muted); }
.verdict { font-weight: 700; font-size: 15px; margin-bottom: 6px; letter-spacing: -0.01em; }
.actual { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.actual b.up { color: var(--miss); } .actual b.dn { color: var(--hit); }
.actual .muted { font-size: 12px; }
.hyps { list-style: none; counter-reset: h; }
.hyps li { position: relative; padding: 8px 12px 8px 36px; margin-bottom: 5px; counter-increment: h; background: var(--bg); border-radius: 10px; line-height: 1.5; color: var(--text-2); }
.hyps li::before { content: counter(h); position: absolute; left: 12px; top: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.hyps .conf { color: var(--muted); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.hyps a { color: var(--accent); font-size: 12px; margin-left: 6px; }
.lesson { margin-top: 12px; padding: 11px 14px; border-radius: 10px; background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 13px; line-height: 1.55; }
.lesson b { color: var(--accent-ink); margin-right: 6px; }
.react { margin-top: 12px; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.react button, .btn { padding: 5px 13px; border-radius: 999px; border: 1px solid var(--border); font-size: 12.5px; color: var(--text); background: var(--surface); white-space: nowrap; font-weight: 500; }
.react button:hover, .btn:hover { border-color: var(--accent); }
.react button[aria-pressed="true"], .btn.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn.danger:hover { border-color: var(--miss); color: var(--miss); }
.reacted { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.reacted b { color: var(--accent); }
.pend-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
.notes-rel { display: flex; flex-wrap: wrap; gap: 6px; }
.notes-rel button { font-size: 12.5px; padding: 5px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); text-align: left; }
.notes-rel button:hover { border-color: var(--accent); color: var(--accent); }
.note-body { max-width: 68ch; }
.note-body p { margin-bottom: 10px; color: var(--text-2); }
.note-body ul, .note-body ol { margin: 0 0 10px 20px; }
.note-body h1, .note-body h2, .note-body h3 { font-size: 14px; margin: 12px 0 6px; }
.note-body code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.note-body .tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.note-body .tags span { font-size: 12px; color: var(--muted); padding: 2px 9px; border-radius: 999px; background: var(--bg); }
.cases { list-style: none; }
.cases li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hair); cursor: pointer; align-items: center; }
.cases li:hover { color: var(--accent); }
.cases li time { color: var(--muted); font-size: 12.5px; flex: 0 0 72px; }
.cases li .badge { margin-left: auto; }
.p-actions { margin-top: 14px; gap: 6px; flex-wrap: wrap; }
.rel { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.rel-head { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rel-vals { display: flex; gap: 20px; margin-top: 10px; flex-wrap: wrap; }
.rel-vals span { font-size: 11.5px; color: var(--muted); }
.rel-vals b { display: block; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }
.rel-hist { margin-top: 10px; font-size: 12.5px; }
.rel-hist.muted, .rel .muted { color: var(--muted); }
.rel .foot { margin-top: 6px; padding: 0; }
.pin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-height: 50vh; overflow-y: auto; }
.pin-cols h4 { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.pin-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pin-row:hover { background: var(--surface-2); }
.pin-row .sw { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pin-row small { color: var(--muted); margin-left: auto; }

/* ---------- 목록 화면 ---------- */
.list-view { flex: 1 1 auto; overflow-y: auto; padding: 24px 28px 48px; }
.list-view .inner { max-width: 860px; margin: 0 auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.stat { padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.stat .k { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.list-view h2 { font-size: 15px; font-weight: 700; margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.list-view h2 .cnt { font-size: 12px; color: var(--muted); font-weight: 500; }
.list-view h2 .right { margin-left: auto; }
.rows { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--hair); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--accent-soft); }
.row.empty-row { cursor: default; color: var(--muted); font-size: 13px; }
.row.empty-row:hover { background: none; }
.row time { flex: 0 0 76px; color: var(--muted); font-size: 12.5px; }
.row .t { flex: 1 1 auto; min-width: 0; }
.row .t b { display: block; font-weight: 600; }
.row .t span { font-size: 12.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .badge { flex: 0 0 auto; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sortbar { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-size: 12.5px; }
.sortbar .filters { margin-bottom: 0; }
.sortbar + h2 { margin-top: 10px; }
.row .t span .cat { font-style: normal; color: var(--accent); margin-right: 8px; }
.obs td .d { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; line-height: 1.2; margin-top: 1px; }
.filters button { font-size: 12.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.filters button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.6; }

/* ---------- 상세 창 (복기·노트 화면에서) ---------- */
.detail-bg { position: fixed; inset: 0; background: rgba(10,10,20,0.45); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 28px 20px; overflow-y: auto; backdrop-filter: blur(2px); }
.detail { width: 100%; max-width: 1180px; background: var(--bg); border: 1px solid var(--border); border-radius: 18px; padding: 24px 28px 32px; box-shadow: var(--shadow); }
.detail .p-top .close { background: var(--surface); }

/* ---------- 모달 · 토스트 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,10,20,0.4); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.modal.wide { max-width: 560px; }
.modal h2 { font-size: 17px; margin-bottom: 4px; letter-spacing: -0.01em; }
.modal p { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }
.modal label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
.modal input[type="text"], .modal input[type="email"], .modal input[type="password"], .modal textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-size: 14px;
}
.modal textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
.modal .check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal .primary { background: var(--accent); color: #fff; border-color: var(--accent); padding: 7px 18px; border-radius: 10px; font-weight: 600; }
.modal .err { color: var(--miss); font-size: 12.5px; margin-top: 8px; min-height: 1em; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 999px; font-size: 13px; z-index: 60; opacity: 0; transition: opacity 0.2s; pointer-events: none; box-shadow: var(--shadow); }
.toast.show { opacity: 1; }

/* ---------- 모바일 ---------- */
@media (max-width: 760px) {
    .bar { padding: 8px 12px 0; }
    .bar-row { gap: 8px; min-height: 32px; }
    .bar h1 { font-size: 16px; }
    .bar .back { font-size: 14px; max-width: 18px; overflow: hidden; white-space: nowrap; flex: 0 0 auto; }
    .tabs { flex: 0 0 auto; }
    .tabs button { padding: 4px 10px; font-size: 12.5px; }
    .bar-actions .plain { padding: 4px 6px; }
    .bar-row.tools { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; gap: 6px; padding-bottom: 8px; }
    .bar-row.tools::-webkit-scrollbar { display: none; }
    .chips-scroll { flex: 0 0 auto; overflow: visible; }
    .chip, .seg button { padding: 4px 9px; font-size: 12px; }
    .seg, .more, .vsep, .plain { flex: 0 0 auto; }
    .stage-foot { right: 8px; padding: 4px 8px; }
    .more .menu.menu-2col { grid-template-columns: 1fr; min-width: 200px; }
    .stage-head { right: 8px; top: 8px; }
    .stage-head .today { padding: 3px 9px; font-size: 12px; }
    .price-names span { padding: 2px 7px 2px 6px; font-size: 11.5px; }
    .stage { margin: 0; border-radius: 0; border-left: 0; border-right: 0; --gutter: 58px; }
    .lane-names button, .lane-names div { padding: 0 8px 0 6px; font-size: 10.5px; }
    .legend { display: none; }
    .cluster-menu { max-width: calc(100vw - 24px); }
    .panel { position: fixed; left: 0; right: 0; bottom: 0; height: 0; min-height: 0; border-radius: 18px 18px 0 0; box-shadow: var(--shadow); z-index: 5; }
    .panel.open { height: 70vh; }
    .panel .grip { height: 20px; }
    .panel-in { padding: 18px 14px 32px; }
    .panel h2 { font-size: 18px; }
    .p-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
    .p-grid section, .p-grid section.wide { grid-column: auto; padding: 14px 15px 16px; }
    .p-sum .s.arrow { display: none; }
    .p-sum .s { min-width: calc(50% - 3px); flex: 1 1 auto; }
    .pin-cols { grid-template-columns: 1fr; }
    .detail-bg { padding: 0; align-items: stretch; }
    .detail { border-radius: 0; border: 0; padding: 14px 14px 40px; min-height: 100%; }
    table.obs { font-size: 12.5px; }
    .list-view { padding: 16px 14px 40px; }
    .stats { gap: 8px; }
    .stat { padding: 12px 12px; }
    .stat .v { font-size: 20px; }
    .row time { flex-basis: 60px; }
}
@media (prefers-reduced-motion: reduce) {
    .panel, .chip, .switch .sw-track, .switch .sw-knob, .ev .dot { transition: none; }
}
