/* 🎛 v2 조종실 옷 — 옛 운영 화면 공통 옷(ops-theme.css) · 조종실 '유리 스튜디오'(controller.html body.skin-glass)와 같은 색.
   짙은 갈색 유리 바탕 + 주황 하나로 강조 + 가장 자주 누르는 두 곳(점수판 · 대기함 카드)은 흰 종이 카드.
   ⚠️ 색 값은 옛 ops-theme.css --ops-* 와 같다. 거기를 바꾸면 여기도 같이.
   ⚠️ 바깥(CDN)에서 아무것도 안 불러온다 — 글꼴은 컴퓨터에 있는 것, 바탕 그림은 우리 서버(/vendor/stage). */
:root {
    /* 바탕 → 판 → 카드 순으로 밝아진다 */
    --bg: #1a1411;
    --panel: #221a16;
    --card: #2b221d;
    --input: rgba(0, 0, 0, 0.26);
    --glass: rgba(24, 18, 15, 0.62);
    --glass-hi: rgba(24, 18, 15, 0.76);
    --line: rgba(255, 255, 255, 0.13);
    --line-soft: rgba(255, 255, 255, 0.08);
    /* 글자 */
    --text: #f6f1ec;
    --muted: #bcb0a6;
    --dim: #8c8078;
    /* 강조는 주황 하나 */
    --accent: #f07b3f;
    --accent-hi: #ff8f57;
    --accent-soft: rgba(240, 123, 63, 0.16);
    --accent-ring: rgba(240, 123, 63, 0.32);
    --on-accent: #1d1a17;
    --gold: #ffb36b;
    /* 뜻이 있는 색 */
    --good: #3ddc84;
    --warn: #f5a524;
    --bad: #ff6b6b;
    --info: #7cb2ff;
    /* 흰 종이 카드(점수판 · 대기함) */
    --paper: #ffffff;
    --paper-2: #faf7f4;
    --paper-3: #f3eee9;
    --paper-line: #ebe4dd;
    --ink: #1d1a17;
    --ink-2: #6d655e;
    --ink-3: #9a918a;
    --accent-ink: #b4501a;
    /* 둥글기 · 그림자 · 글꼴 */
    --r-m: 14px;
    --r-l: 22px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    --font: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    --hdr-h: 64px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* 머리줄이 위에 붙어 있다 — 키보드로 옮겨 간 칸 · 굴려 보인 칸이 머리줄 밑에 숨지 않게 */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr-h) + 24px); scroll-padding-bottom: 16px; }
body {
    margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
    font: 500 15px/1.45 var(--font); letter-spacing: -0.2px; -webkit-font-smoothing: antialiased;
}
/* 바탕의 은은한 주황 빛 */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background: radial-gradient(1100px 560px at 15% -10%, rgba(240, 123, 63, 0.14), transparent 60%);
}
/* 넓은 화면은 옛 조종실처럼 흐린 무대 그림 위에 유리 판 — 그림은 미리 흐리게 구워 둔 것(backdrop-filter 안 씀: 방송 PC 부하) */
@media (min-width: 900px) {
    body::after {
        content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
        background: linear-gradient(rgba(26, 20, 17, 0.5), rgba(26, 20, 17, 0.72)), url('/vendor/stage/ctl_bg.jpg') center / cover no-repeat;
    }
}
button, input, select, textarea { font-family: inherit; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.5px; }
h2 { font-size: 18px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.app { max-width: 1760px; margin: 0 auto; padding: 14px 20px 28px; }

/* ── 머리줄 ── */
.hdr {
    position: sticky; top: 10px; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px 10px 14px; margin: 0 0 16px; background: rgba(28, 21, 18, 0.94); border: 1px solid var(--line); border-radius: 26px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 30px rgba(0, 0, 0, 0.28);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand b { font-weight: 900; letter-spacing: -0.5px; }
.brand-sub { color: var(--muted); font-weight: 700; font-size: 15px; }
.logo {
    flex: none; width: 36px; height: 36px; border-radius: 12px; box-shadow: 0 8px 22px rgba(240, 123, 63, 0.4);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z' fill='%23ffffff'/%3E%3C/svg%3E") center / 19px no-repeat;
}
.logo.big { width: 52px; height: 52px; border-radius: 16px; background-size: 26px; }
.hdr-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
    display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px;
    font-size: 13.5px; font-weight: 800; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); white-space: nowrap;
}
.pill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.conn[data-s=live] { color: #8ef0b8; background: rgba(61, 220, 132, 0.12); border-color: rgba(61, 220, 132, 0.3); }
.conn[data-s=connecting] { color: #ffd28a; background: rgba(245, 165, 36, 0.12); border-color: rgba(245, 165, 36, 0.3); }
.conn[data-s=down] { color: #ffb0b0; background: rgba(255, 107, 107, 0.16); border-color: rgba(255, 107, 107, 0.5); }
.conn[data-s=down] i, .conn[data-s=connecting] i, .onair i { animation: blink 1.2s ease-in-out infinite; }
/* ✂ 클립 단추(머리줄) — 점 색 = OBS 저장 담당(초록 연결 · 노랑 권한/버퍼 · 회색 안 보임) */
.clip-btn { cursor: pointer; font: inherit; font-weight: 800; color: var(--fg, #f3ece6); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); }
.clip-btn:hover { background: rgba(255, 255, 255, 0.12); }
.clip-btn:active { transform: translateY(1px); }
.clip-btn:disabled { opacity: 0.6; cursor: wait; }
.clip-btn[data-s=ok] i { color: #3ddc84; }
.clip-btn[data-s=warn] i { color: #f5a524; }
.clip-btn[data-s=off] i { color: #8a817a; }
.onair { color: #ffc9c9; background: rgba(255, 90, 90, 0.14); border-color: rgba(255, 107, 107, 0.4); }
.onair i { background: #ff5a5a; }
.onair .since { color: var(--muted); font-weight: 700; }
@keyframes blink { 50% { opacity: 0.3; } }
.down-banner {
    margin: -4px 0 14px; padding: 10px 16px; border-radius: 16px; font-weight: 700;
    background: rgba(255, 107, 107, 0.16); border: 1px solid rgba(255, 107, 107, 0.45); color: #ffc2c2;
}

/* ── 단추 ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px;
    border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--text);
    font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: default; }
.btn.pri { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.pri:hover:not(:disabled) { background: var(--accent-hi); }
.btn.danger { background: rgba(255, 107, 107, 0.16); border-color: rgba(255, 107, 107, 0.5); color: #ffb8b8; }
.btn.danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.28); }
.btn.ghost-danger { background: transparent; border-color: rgba(255, 107, 107, 0.35); color: #ff9e9e; }
.btn.ghost-danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.12); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.big { min-height: 52px; padding: 0 24px; font-size: 17px; }
.btn.wide { width: 100%; }
.icon-btn {
    width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted);
    font-size: 22px; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

/* ── 입력칸(어두운 바탕) ── */
input[type=text], input[type=password] {
    height: 46px; min-width: 0; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--input); color: var(--text);
    padding: 0 14px; font-size: 16px; font-weight: 600;
}
input[type=text]:focus, input[type=password]:focus { outline: none; border-color: var(--accent); background: rgba(0, 0, 0, 0.42); box-shadow: 0 0 0 3px var(--accent-ring); }
input::placeholder { color: var(--dim); font-weight: 500; }
input[aria-invalid=true] { border-color: var(--bad) !important; }
input.sending { opacity: 0.55; }
.shake { animation: shake 0.35s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ── 꼬리표 ── */
.tag {
    display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; white-space: nowrap;
    font-size: 12.5px; font-weight: 800; background: rgba(255, 255, 255, 0.1); color: var(--text);
}
.tag.hot { background: var(--accent); color: var(--on-accent); }
.tag.warn { background: rgba(245, 165, 36, 0.18); color: #ffd28a; }
.tag.live { background: rgba(61, 220, 132, 0.18); color: #8ef0b8; }
.tag.plain { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.count-badge {
    display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 8px; margin-left: 6px; vertical-align: 2px;
    border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 14px; font-weight: 900;
}
.count-badge.zero { background: rgba(255, 255, 255, 0.12); color: var(--muted); }
.empty { margin: 0; padding: 18px 8px; text-align: center; color: var(--dim); font-size: 14px; }

/* ── 화면 넷 ── */
.view { display: none; }
body[data-view=splash] .v-splash,
body[data-view=login] .v-login,
body[data-view=setup] .v-setup { display: flex; justify-content: center; padding: 5vh 0 4vh; }
.splash-card { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); font-weight: 700; padding-top: 10vh; }
.spin { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
    width: min(540px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px;
    background: var(--glass-hi); border: 1px solid var(--line); border-radius: 30px; box-shadow: var(--shadow);
}
.card h1 { font-size: 26px; font-weight: 900; }
.card p { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.form-err { margin: 0; padding: 10px 14px; border-radius: 12px; background: rgba(255, 107, 107, 0.14); color: #ffb8b8; font-weight: 700; }
.name-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.name-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.name-row .n { color: var(--dim); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.add-name { align-self: flex-start; }
.pre-pending { padding: 10px 14px; border-radius: 14px; background: rgba(245, 165, 36, 0.14); border: 1px solid rgba(245, 165, 36, 0.35); color: #ffd28a; font-weight: 700; font-size: 14px; }
/* ⏪ 방송 끝 되돌리기(js/endundo.js) — 방송 전 카드 맨 위 */
.endundo-box { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 18px; background: rgba(90, 200, 250, 0.12); border: 1px solid rgba(90, 200, 250, 0.4); }
.endundo-box[hidden] { display: none; }
.endundo-box .eu-t { font-size: 16px; font-weight: 900; color: #bfe9ff; }
.endundo-box .eu-d { font-size: 14px; font-weight: 700; color: var(--muted); }

/* ── 칸 공통(방송 중 · 방송 전 세 칸 배치는 맨 아래 '시안 B 틀') ── */
.sec { min-width: 0; background: rgba(255, 255, 255, 0.055); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px; padding: 16px 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-tools, .extra-on { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-h { font-size: 16px; font-weight: 800; margin: 18px 4px 10px; }
.sub-h small { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ── 되돌리기 ── */
.undo-sec { padding: 10px; display: flex; }
.undo-btn {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 66px; padding: 10px 18px 10px 12px; text-align: left;
    border-radius: 20px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.08); color: var(--text);
    font: inherit; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.undo-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.13); border-color: var(--accent-ring); }
.undo-btn:active:not(:disabled) { transform: translateY(1px); }
.undo-btn .ic {
    flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
    background: var(--accent); color: var(--on-accent); font-size: 25px; font-weight: 900;
}
.undo-btn .tx { min-width: 0; display: flex; flex-direction: column; }
.undo-btn b { font-size: 19px; font-weight: 900; }
.undo-btn small { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.undo-btn:disabled { cursor: default; opacity: 0.55; }
.undo-btn:disabled .ic { background: rgba(255, 255, 255, 0.14); color: var(--muted); }
.undo-btn.sending { opacity: 0.6; }

/* ── 점수판(흰 카드) ── */
.board { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 4px 14px 6px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22); }
.brow {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) 78px 78px minmax(96px, 132px) 70px; gap: 8px; align-items: center;
    padding: 8px 4px; border-bottom: 1px solid var(--paper-3);
}
.bhead { padding: 10px 4px 6px; font-size: 12px; font-weight: 700; color: var(--ink-3); border-bottom-color: var(--paper-line); }
.brows .brow:last-child { border-bottom: 0; }
.r { text-align: right; }
.rank {
    width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
    background: var(--paper-3); color: var(--ink); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.prow.first .rank { background: var(--accent); color: #fff; }
.nm { font-size: 17px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc { font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ct { font-size: 15px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.board input[type=text] {
    width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--paper-line); background: var(--paper-2); color: var(--ink);
    padding: 0 12px; font-size: 16px; font-weight: 700; box-shadow: none;
}
.board input[type=text]:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 123, 63, 0.2); }
.board input::placeholder { color: #b3aaa2; }
.cfix-btn {
    height: 38px; padding: 0 6px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-3);
    font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
}
.cfix-btn:hover, .cfix-btn[aria-expanded=true] { background: var(--paper-2); border-color: var(--paper-line); color: var(--ink); }
.cfix-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--paper-2); border-radius: 12px; }
.cfix-row .muted { color: var(--ink-2); }
.cfix-row input[type=text] { width: 130px; background: #fff; }
.prow.fixing { background: #fffaf6; }
.bottom-row { margin: 4px 0 6px; border-radius: 14px; background: #fbf6f1; border-bottom: 0; }
.bottom-row .nm { color: var(--ink-2); font-size: 15px; }
.bottom-row .rank { visibility: hidden; }
.brow > :nth-child(5) { padding-left: 10px; }
.bottom-row .sc { font-size: 18px; }
.board .empty { color: var(--ink-3); }
.board .btn.pri { color: var(--on-accent); }
.bump-up, .bump-down { animation: bumpUp 1s ease; }
.bump-down { animation-name: bumpDown; }
@keyframes bumpUp { 0% { color: #1f9a57; transform: scale(1.15); } 100% { transform: none; } }
@keyframes bumpDown { 0% { color: #d33a3f; transform: scale(1.15); } 100% { transform: none; } }

/* 명단 고치기 */
.roster { margin-top: 12px; }
.roster summary { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 6px; cursor: pointer; color: var(--muted); font-weight: 800; border-radius: 12px; }
.roster summary:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.roster summary small { font-weight: 600; }
.roster-body { display: flex; flex-direction: column; gap: 10px; padding: 8px 6px 4px; }
.roster-add { display: flex; gap: 8px; }
.roster-add input { flex: 1; }
.roster-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.roster-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }

/* ── 대기함(오른쪽 칸 · 카드는 흰 종이) ── */
.pending-sec { flex: 1 1 0; min-height: 200px; overflow-y: auto; overscroll-behavior: contain; background: transparent; border: 0; padding: 2px 2px 0; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 4px 10px; }
.frozen-hint { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.extra-note { margin: 0 2px 10px; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-ring); color: #ffd0b5; font-size: 13.5px; }
.extra-note b { color: #fff; }
.pcard {
    margin: 0 0 10px; padding: 14px; border-radius: 20px; background: var(--paper); color: var(--ink);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16); transition: opacity 0.15s ease;
}
.pc-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; }
.pc-time { color: var(--ink-3); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-name { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }
.pc-amt { font-size: 18px; font-weight: 900; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.pc-pts { margin-left: auto; align-self: center; padding: 3px 11px; border-radius: 999px; background: #fff0e6; color: var(--accent-ink); font-size: 15px; font-weight: 900; white-space: nowrap; }
.pc-pts.zero { background: var(--paper-3); color: var(--ink-3); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pcard .tag.ret { background: #eaf2ff; color: #2c5fb8; }
.pcard .tag.test { background: #e7f3fc; color: #1b6fae; }
.pcard .tag.plain { background: var(--paper-3); color: var(--ink-2); }
.pc-msg { margin: 8px 0 0; padding: 8px 11px; border-radius: 12px; background: var(--paper-2); color: #3d3833; font-size: 14.5px; overflow-wrap: anywhere; white-space: pre-line; }
.pc-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 12px; }
.pbtn {
    min-height: 50px; padding: 6px 8px; border-radius: 14px; border: 1px solid var(--paper-line); background: var(--paper-2); color: var(--ink);
    font: inherit; font-size: 16px; font-weight: 800; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pbtn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.pbtn:active:not(:disabled) { transform: translateY(1px); }
.pbtn:disabled { opacity: 0.5; cursor: default; }
.pbtn.pick.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.pc-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pcard .btn { background: var(--paper-2); border-color: var(--paper-line); color: var(--ink); }
.pcard .btn:hover:not(:disabled) { background: var(--paper-3); }
.pcard .btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pcard .btn.pri:hover:not(:disabled) { background: var(--accent-hi); }
.pcard .btn.ghost-danger { background: transparent; border-color: #f0c8c9; color: #c4383d; }
.pcard .btn.ghost-danger:hover:not(:disabled) { background: #fdecec; }
.pcard .muted { color: var(--ink-2); }
.split-preview { margin-right: auto; font-size: 14px; font-weight: 800; color: var(--ink); }
.sending { margin-right: auto; color: var(--ink-2); font-weight: 700; font-size: 14px; }
.pcard.busy { opacity: 0.72; }
.pcard.splitting { box-shadow: inset 0 0 0 2px var(--ink), 0 10px 24px rgba(0, 0, 0, 0.16); }
.pcard.returned { box-shadow: inset 0 0 0 2px #7cb2ff, 0 10px 24px rgba(0, 0, 0, 0.16); }
/* 기여도 카드(돈이 아니다) — 보라 기운으로 후원과 헷갈리지 않게(옛 조종실과 같다) */
.pcard.contrib { background: #f6f1ff; box-shadow: inset 0 0 0 1px #d9ccff, 0 10px 24px rgba(0, 0, 0, 0.14); }
.pcard.contrib .pc-amt { color: #6b45d6; }
.pcard.contrib .pc-pts { background: #ebe3ff; color: #5a36c4; }
/* 처리됨 자리 — 손을 빼기 전까지 같은 높이로 남아 아래 카드가 당겨 올라오지 않게 */
.pcard.ghost {
    display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.05); color: var(--muted);
    border: 1px dashed rgba(255, 255, 255, 0.2); box-shadow: none; font-weight: 800;
}

/* ── 시그니처 대기줄 ── */
.queue-sec { flex: 0 0 auto; max-height: 44%; overflow-y: auto; overscroll-behavior: contain; border-radius: 22px; padding: 14px; }
.q-ctrl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.q-ctrl .btn { padding: 0 10px; }
.vol { display: flex; align-items: center; gap: 10px; margin: 12px 2px 4px; color: var(--muted); font-size: 14px; font-weight: 700; }
.vol input { flex: 1; height: 30px; accent-color: var(--accent); cursor: pointer; }
.vol output { min-width: 46px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.qlist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.qitem {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main btns" "sub btns"; gap: 3px 10px; align-items: center;
    padding: 10px 10px 10px 12px; border-radius: 16px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.08);
}
.qitem.head { background: rgba(240, 123, 63, 0.14); border-color: var(--accent-ring); }
.qitem.head.paused { background: rgba(245, 165, 36, 0.1); border-color: rgba(245, 165, 36, 0.35); }
.q-main { grid-area: main; display: flex; align-items: center; gap: 8px; min-width: 0; }
.q-title { font-size: 15.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-count { color: var(--gold); font-weight: 900; }
.q-sub { grid-area: sub; display: flex; gap: 10px; min-width: 0; color: var(--muted); font-size: 13.5px; }
.q-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-amt { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.q-btns { grid-area: btns; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* ── 목표 ── */
.gauge { display: flex; flex-direction: column; gap: 8px; }
.gbar { height: 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.gbar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff9a5c, #e8662a); transition: width 0.4s ease; }
.gauge.reached .gbar i { background: linear-gradient(90deg, #3ddc84, #2f9a5f); }
.gnum { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.gnum .cur { font-size: 30px; font-weight: 900; }
.gnum .sep { color: var(--dim); font-size: 18px; }
.gnum .tgt { font-size: 18px; font-weight: 800; color: var(--muted); }
.gnum .pct { color: var(--gold); font-weight: 900; }
.goal-form { display: flex; align-items: flex-end; gap: 8px; margin: 14px 0 8px; }
.goal-form label { flex: 1; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.goal-sec p { margin: 0; }

/* ── 최근 기록 ── */
.loglist { list-style: none; margin: 0; padding: 0; }
.log { display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 4px; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.log:last-child { border-bottom: 0; }
.log .lt { color: var(--dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.log .lx { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log.neg .lx { color: #ffb8b8; }

/* ── 알림(토스트) — 넓은 화면은 왼쪽 아래(오른쪽 대기함을 가리지 않게) ── */
.toasts {
    position: fixed; left: 24px; bottom: 22px; z-index: 90; width: min(520px, calc(100vw - 32px));
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 16px; cursor: pointer;
    border-radius: 16px; background: rgba(30, 22, 18, 0.97); border: 1px solid var(--line); border-left: 4px solid var(--good);
    color: var(--text); font-weight: 700; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); animation: tin 0.18s ease;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast .ti { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #10241a; font-size: 13px; font-weight: 900; }
.toast.err { border-left-color: var(--bad); }
.toast.err .ti { background: var(--bad); color: #2a0d0d; }
.toast.info { border-left-color: var(--info); }
.toast.info .ti { background: var(--info); color: #0d1a2e; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ── 확인 상자 ── */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(10, 7, 6, 0.64); animation: fade 0.15s ease; }
.modal { width: min(470px, 100%); padding: 22px; border-radius: 24px; background: #261d18; border: 1px solid var(--line); box-shadow: var(--shadow); }
.modal h2 { font-size: 20px; margin-bottom: 8px; }
.modal-body { margin: 0 0 18px; color: var(--muted); line-height: 1.6; white-space: pre-line; }
/* ↻ 다시 송출 확인 상자(replay.js) — 사람이 알아보는 것을 크게, 장부 번호는 작은 회색 */
.rp-box { margin: 4px 0 18px; }
.rp-box p { margin: 0; overflow-wrap: anywhere; }
.rp-who { font-size: 24px; line-height: 1.3; color: var(--text); }
.rp-who b { font-weight: 900; }
.rp-amt { color: var(--gold); font-weight: 900; font-variant-numeric: tabular-nums; }
.rp-meta { margin-top: 6px !important; font-size: 17px; color: var(--text); opacity: .9; line-height: 1.45; }
.rp-note { margin-top: 12px !important; color: var(--muted); font-size: 14px; line-height: 1.5; }
.rp-no { margin-top: 6px !important; color: var(--dim); font-size: 12px; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }

/* ── 반 화면(900~1279px) — 점수판 줄 격자만(세 칸 배치는 맨 아래) ── */
@media (min-width: 900px) and (max-width: 1279px) {
    .sec:not(.pending-sec) { padding: 12px; }
    .brow { grid-template-columns: 34px minmax(0, 1fr) 62px 62px 100px 58px; gap: 6px; }
}

/* ── 📱 폰(900px 아래) — 한 줄. 대기함이 맨 위, 되돌리기는 화면 아래에 붙어 따라온다 ── */
@media (max-width: 899px) {
    body { font-size: 15px; }
    .app { padding: 8px 10px 16px; }
    .hdr { top: 6px; padding: 8px 8px 8px 10px; border-radius: 22px; margin-bottom: 10px; }
    .brand { font-size: 16px; gap: 8px; }
    .brand-sub { display: none; }
    .logo { width: 30px; height: 30px; border-radius: 10px; background-size: 16px; }
    .pill { height: 34px; padding: 0 10px; font-size: 12.5px; }
    .onair .since { display: none; }
    .hdr .end-btn { min-height: 38px; padding: 0 14px; font-size: 14px; }
    .sec { padding: 12px; border-radius: 20px; }
    .undo-btn { min-height: 56px; }
    .undo-btn .ic { width: 40px; height: 40px; font-size: 22px; }
    .board { padding: 2px 8px 4px; border-radius: 18px; }
    .brow { grid-template-columns: 28px minmax(0, 1fr) 46px 50px 76px 44px; gap: 5px; padding: 7px 2px; }
    .bhead { font-size: 11px; }
    .rank { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
    .nm { font-size: 15.5px; }
    .sc { font-size: 18px; }
    .ct { font-size: 14px; }
    .board input[type=text] { height: 42px; padding: 0 8px; }
    .cfix-btn { font-size: 12px; padding: 0 2px; }
    .card { padding: 20px; border-radius: 24px; }
    .card h1 { font-size: 22px; }
    .toasts { left: 50%; transform: translateX(-50%); bottom: 92px; align-items: center; }
    .pc-players { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
    .log { grid-template-columns: 58px minmax(0, 1fr); }
    .log .ls { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 🗂️ 탭 — 왼쪽 줄(#rail.tabbar)은 맨 아래 '시안 B 틀' */
.tabpanel[hidden] { display: none !important; }

/* 🏆 목표 달성 상자(조종실 목표 칸) — 옛 goal-alert-box */
.goal-win { margin-top: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid rgba(255, 207, 77, 0.8);
    background: linear-gradient(135deg, rgba(255, 207, 77, 0.15), rgba(255, 152, 0, 0.1)); box-shadow: 0 0 25px rgba(255, 207, 77, 0.3); }
.goal-win .gw-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--gold, #ffcf4d); font-weight: 900; }
.goal-win .gw-head span { font-size: 12px; background: var(--gold, #ffcf4d); color: #1b1404; padding: 2px 8px; border-radius: 8px; }
.goal-win p { margin: 8px 0; font-size: 14px; }
.goal-win .gw-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* 🧪 시험판 표시(머리줄 로고 옆) */
.pill.trial { margin-left: 8px; color: #b9d4ff; background: rgba(124, 178, 255, 0.14); border-color: rgba(124, 178, 255, 0.45); font-weight: 800; cursor: help; }

/* ═══════════════════════════════════════════════════════════════════════════════════════════
   🧱 시안 B 틀(10-17 · 묶음 A) — 머리 두 줄(상태 줄 · 조종 줄) · 왼쪽 줄 · 가운데 · 오른쪽 · 폰 머리
   칸 id 약속은 index.html. 폭: ≥1280 = 76 · 나머지 · clamp(380,28.5vw,460) / 900~1279 = 64 · 나머지 · 340 / <900 = 한 줄
   ⚠️ #hdr · #rail 같은 id 로 옛 알약 모양(tools_*.css)을 덮는다 — 그 파일들은 고치지 않았다.
   ═══════════════════════════════════════════════════════════════════════════════════════════ */
:root {
    --sb-h: 36px;           /* 상태 줄 */
    --cb-h: 58px;           /* 조종 줄 */
    --rail-w: 76px;
    --side-w: clamp(380px, 28.5vw, 460px);
    --gap: 10px;
    --pane: rgba(34, 26, 22, 0.88);
    --line-2: rgba(255, 255, 255, 0.07);
}

/* ── 공용: 선 아이콘(icons.js) · 단추 크기 xs · 테두리 빨강 · 스위치 · 소리 막대 · 묶음 글자 · 칸막이 ── */
.ico { width: 18px; height: 18px; flex: none; display: block; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico .ico-fill { fill: currentColor; stroke: none; }
.ico .ico-cut { stroke: var(--bg); stroke-width: 2.2; }
.btn .ico { width: 15px; height: 15px; }
.btn.sm .ico, .btn.xs .ico { width: 13px; height: 13px; }
a.btn { text-decoration: none; }
.btn.xs { min-height: 26px; padding: 0 9px; border-radius: 8px; font-size: 12.5px; gap: 4px; }
.btn.dgr { border-color: rgba(255, 107, 107, 0.75); color: #ff9d9d; background: rgba(255, 107, 107, 0.06); }
.btn.dgr:hover:not(:disabled) { background: rgba(255, 107, 107, 0.16); }
/* 스위치 — <input type="checkbox" class="sw"> (켜짐 주황) */
input[type=checkbox].sw {
    -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 40px; height: 22px; margin: 0;
    border-radius: 11px; background: rgba(255, 255, 255, 0.18); cursor: pointer; transition: background 0.15s ease;
}
input[type=checkbox].sw::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: left 0.15s ease;
}
input[type=checkbox].sw:checked { background: var(--accent); }
input[type=checkbox].sw:checked::after { left: 21px; }
/* 소리 막대 — <input type="range" class="sld"> */
input[type=range].sld { flex: none; width: 84px; height: 22px; margin: 0; accent-color: var(--accent-hi); cursor: pointer; }
.gcap { flex: none; font-size: 10.5px; font-weight: 800; color: var(--dim); letter-spacing: 0.06em; white-space: nowrap; }
.vsep { flex: none; width: 1px; height: 32px; background: var(--line); }

/* ── 바깥 ── */
.app { padding: 0 10px 10px; }
html { scroll-padding-top: calc(var(--hdr-h) + 12px); }

/* ── 1줄: 상태 줄(.sb) — 보기만 ── */
#hdr {
    position: sticky; top: 0; z-index: 40; display: block; margin: 0 -10px var(--gap); padding: 0 10px;
    background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
/* ↑ 상태 줄(.sb)은 화면 끝까지(margin -10px) — 머리 칸이 그만큼 안쪽 여백을 가져 가로 넘침으로 안 잡힌다 */
#hdr .sb {
    height: var(--sb-h); display: flex; align-items: center; gap: 16px; margin: 0 -10px; padding: 0 14px;
    background: rgba(12, 9, 7, 0.92); border-bottom: 1px solid var(--line-2); font-size: 12.5px; white-space: nowrap;
}
#hdr .sb-l { flex: none; min-width: 0; display: flex; align-items: center; gap: 12px; }
#hdr .brand { flex: none; gap: 8px; font-size: 13px; }
#hdr .brand b { font-weight: 800; }
#hdr .logo { width: 22px; height: 22px; border-radius: 7px; background-size: 12px; box-shadow: none; }
#hdr .pill.trial { height: 22px; padding: 0 8px; margin-left: 2px; font-size: 11.5px; }
#hdr .sb-dots { display: flex; align-items: center; gap: 2px; min-width: 0; }
#hdr .pf-chips { display: contents; margin: 0; }
/* 상태 = 테두리 없는 점 + 글자(누르면 까닭) — 넓은 화면 긴 글자(.t) · 반 화면 짧은 글자(.ts) */
#hdr .st {
    flex: none; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 7px; margin: 0;
    border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
#hdr button.st { cursor: pointer; }
#hdr button.st:hover { background: rgba(255, 255, 255, 0.07); }
#hdr .st .t { color: var(--text); }
#hdr .st .ts { display: none; color: var(--text); }
#hdr .st .dot {
    flex: none; width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; box-shadow: 0 0 0 3px rgba(142, 142, 147, 0.16); animation: none;
}
#hdr .st[data-lv=ok] .dot, #hdr .conn[data-s=live] .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.15); }
#hdr .st[data-lv=warn] .dot, #hdr .conn[data-s=connecting] .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(245, 165, 36, 0.18); }
#hdr .st[data-lv=bad] .dot, #hdr .conn[data-s=down] .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.24); animation: blink 1.2s ease-in-out infinite; }
#hdr .st[data-lv=bad] .t, #hdr .st[data-lv=bad] .ts, #hdr .conn[data-s=down] .t, #hdr .conn[data-s=down] .ts { color: #ffb0b0; }
#hdr .st[data-lv=none] .t, #hdr .st[data-lv=none] .ts { color: var(--muted); }
/* 자동 진행 — 켬은 초록 테두리를 남긴다(켜진 걸 모르는 게 가장 위험) */
#hdr .au-pill .dot { background: var(--info); box-shadow: 0 0 0 3px rgba(124, 178, 255, 0.18); }
#hdr .au-pill[data-mode=on] { background: rgba(61, 220, 132, 0.1); box-shadow: inset 0 0 0 1px rgba(61, 220, 132, 0.6); }
#hdr .au-pill[data-mode=on] .dot { background: var(--good); animation: blink 1.6s ease-in-out infinite; }
/* 오른쪽 — 방송 중 N분 · 시계 · [방송 끝] */
#hdr .sbr { flex: none; display: flex; align-items: center; gap: 12px; margin-left: auto; }
#hdr .onair .dot { background: var(--accent-hi); box-shadow: 0 0 0 3px rgba(255, 143, 87, 0.22); }
#hdr .onair b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
#hdr .onair .since-s { display: none; }
#hdr .sb-clock { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
#hdr .end-slot:empty { display: none; }

/* 경보 띠 — 상태 줄 안 가운데 한 줄(PC 는 아래 화면이 안 밀린다) · [자세히] = 아래로 뜨는 판 */
#sb-band {
    position: relative; flex: 1 1 auto; min-width: 0; height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 8px;
    border-radius: 8px; background: #6a2420; border: 1px solid rgba(255, 107, 107, 0.6); color: #ffe4e1; white-space: nowrap;
}
#sb-band[data-lv=warn] { background: #57400f; border-color: rgba(245, 165, 36, 0.65); color: #fff0d2; }
#sb-band[data-lv=ok] { background: #173d2a; border-color: rgba(61, 220, 132, 0.55); color: #d6f8e4; }
#sb-band .sbb-line { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; }
#sb-band .sbb-ic {
    flex: none; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
    background: var(--bad); color: #3a0d0d; font-size: 11px; font-weight: 900; line-height: 1;
}
#sb-band[data-lv=warn] .sbb-ic { background: var(--warn); color: #3a2600; }
#sb-band[data-lv=ok] .sbb-ic { background: var(--good); color: #0d2a19; }
#sb-band .sbb-t { flex: 0 1 auto; min-width: 0; max-width: 60%; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
#sb-band .sbb-s { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; opacity: 0.78; }
#sb-band .sbb-n { flex: none; padding: 0 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); font-weight: 700; }
#sb-band .sbb-more { flex: none; min-height: 20px; height: 20px; padding: 0 8px; border-radius: 6px; border-color: rgba(255, 220, 215, 0.45); background: transparent; color: inherit; font-size: 11.5px; }
#sb-band .sbb-pop {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: min(440px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; z-index: 60;
    margin: 0; padding: 12px 14px; gap: 10px; white-space: normal; background: #3b1714; border: 1px solid #ff5a5a; border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); animation: pfIn 0.15s ease;
}
#sb-band .pf-row[data-lv=warn] .pf-head b { color: #ffe08a; }
#sb-band .pf-row[data-lv=ok] .pf-head b { color: #8ef0b8; }
#sb-band .pf-row .btn.xs { flex: none; background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
#sb-band .pf-row .pf-txt { cursor: default; }

/* ── 2줄: 조종 줄(.cb) — 누르기만 ── */
#hdr .cb {
    height: var(--cb-h); min-width: 0; margin: var(--gap) 0 0 calc(var(--rail-w) + var(--gap)); display: flex; align-items: center; gap: 12px;
    padding: 0 12px 0 14px; border-radius: 16px; background: rgba(34, 26, 22, 0.92); border: 1px solid var(--line-2); white-space: nowrap;
}
#hdr .cb-grp { min-width: 0; height: 100%; display: flex; align-items: center; gap: 8px; }
#hdr .cb-bgm { flex: 0 1 auto; }
#hdr .cb-bgm .bgm-mini { min-width: 0; max-width: 420px; }
#hdr .cb-rx:empty { display: none; }
#hdr .cb-rx { display: flex; align-items: center; gap: 8px; }
#hdr .cb-misc { margin-left: auto; flex: none; }
#hdr .cb .btn { min-height: 34px; height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 700; }
#hdr .cb .btn.sm { min-height: 30px; height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; }
#hdr .cb-more { display: none; }
#hdr .clip-btn i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; color: #8a817a; }
#hdr .clip-btn[data-s=ok] i { color: var(--good); }
#hdr .clip-btn[data-s=warn] i { color: var(--warn); }
#hdr .ap-banner { margin: var(--gap) 0 0 calc(var(--rail-w) + var(--gap)); }

/* ⋯ 판(폰) — 아래에서 올라온다 */
#ctl-more { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; background: rgba(10, 7, 6, 0.55); }
#ctl-more[hidden] { display: none !important; }
#ctl-more .cbs-panel {
    width: 100%; max-height: 80vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
    padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0;
    background: #261d18; border-top: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.45); white-space: normal;
}
#ctl-more .cbs-grab { width: 36px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); margin: 0 auto; }
#ctl-more .cbs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#ctl-more .cbs-row:empty, #ctl-more .cbs-bgm:not(:has(.cb-grp)) { display: none; }
#ctl-more .cbs-cap { width: 100%; color: var(--muted); font-size: 12px; font-weight: 700; }
#ctl-more .cb-grp { height: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#ctl-more .gcap { display: none; }
#ctl-more .cbs-foot { justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line-2); }
#ctl-more .end-btn { min-height: 40px; padding: 0 16px; font-size: 14px; }

/* ── 세 칸(방송 전 · 방송 중 공통) ── */
.v-shell { display: none; }
body[data-view=setup] .v-shell, body[data-view=live] .v-shell {
    display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--side-w); gap: var(--gap); align-items: stretch;
    height: calc(100vh - var(--hdr-h) - var(--gap) - 10px); height: calc(100dvh - var(--hdr-h) - var(--gap) - 10px); min-height: 520px;
}
/* 왼쪽 줄 — 조종 줄 옆까지 올라간다(머리 높이 --hdr-h 는 main.js 가 잰다) */
#rail {
    position: relative; z-index: 41; top: calc(var(--sb-h) - var(--hdr-h)); height: calc(100% + var(--hdr-h) - var(--sb-h));
    min-height: 0; margin: 0; padding: 8px 0; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: center; gap: 2px;
    border-radius: 18px; background: rgba(34, 26, 22, 0.94); border: 1px solid var(--line-2);
    overflow-x: hidden; overflow-y: auto; scrollbar-width: none; -webkit-mask-image: none; mask-image: none;
}
#rail::-webkit-scrollbar { display: none; }
#rail .tab {
    position: relative; flex: none; width: 64px; min-height: 46px; padding: 5px 2px; margin: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 12px; background: transparent; color: var(--muted);
    font: inherit; font-size: 10.5px; font-weight: 600; line-height: 1.15; text-align: center; cursor: pointer;
}
#rail .tab .tab-t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rail .tab .tab-ic { display: grid; place-items: center; }
#rail .tab .tab-emo { font-size: 17px; line-height: 18px; }
#rail .tab:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
#rail .tab.on { background: rgba(240, 123, 63, 0.18); color: #ffb58c; box-shadow: inset 0 0 0 1px rgba(240, 123, 63, 0.45); }
#rail .tab.locked { opacity: 0.36; }
#rail .tab.locked:hover { background: transparent; color: var(--muted); }
#rail .tab-badge { position: absolute; top: 2px; right: 3px; margin: 0; padding: 0 5px; font-size: 10px; line-height: 16px; }
#rail .tab-dot { position: absolute; top: 6px; right: 13px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hi); box-shadow: 0 0 0 2px rgba(34, 26, 22, 0.94); }
#rail .tabsep { flex: none; width: 40px; height: 1px; margin: 5px 0; background: var(--line); }
#rail .rail-push { flex: 1 0 6px; }

/* 가운데 · 오른쪽 — 칸 안에서 굴린다 */
#center, #side {
    min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 20px; background: var(--pane); border: 1px solid var(--line-2);
}
#center { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
#side { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
#stagebar:empty, #goal-win-slot:empty, #kpis:empty, #say-slot:empty, #con-mini:empty { display: none; }
/* '랭킹' 자리 — 방송 중 #home · 방송 전 #v-setup. 다른 탭을 열면 둘 다 숨고 .tabbody 가 보인다 */
#center:not([data-tab=home]) > #home, #center:not([data-tab=home]) > #v-setup { display: none; }
#center[data-tab=home] > .tabbody { display: none; }
body[data-view=live] #v-setup, body[data-view=setup] #home { display: none; }
body[data-view=setup] #center[data-tab=home] > #v-setup { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 18px; padding: 3vh 0; }
#home { display: flex; flex-direction: column; gap: 12px; }
#home > .scores-sec { background: transparent; border: 0; padding: 0; }
details.basic { flex: none; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.14); }
details.basic > summary {
    min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; cursor: pointer; list-style: none;
    font-size: 14px; font-weight: 800; border-radius: 14px;
}
details.basic > summary::-webkit-details-marker { display: none; }
details.basic > summary small { color: var(--dim); font-size: 12.5px; font-weight: 600; }
details.basic > summary::after { content: '▾'; margin-left: auto; color: var(--dim); }
details.basic[open] > summary::after { content: '▴'; }
details.basic > .sec { margin: 0 10px 10px; }
.tabbody { min-width: 0; }
.tab-crumb { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.tab-crumb b { font-size: 15px; font-weight: 800; }
/* 오른쪽 — 한마디 · 콘솔 미니 · 되돌리기 · 대기함(남는 높이 전부) · 시그니처 대기줄(접힘) */
#side > .undo-sec { flex: none; padding: 6px; }
#side .undo-btn { min-height: 54px; }
#side > .pending-sec { flex: 1 1 0; min-height: 200px; overflow-y: auto; }
.queue-fold { flex: 0 1 auto; max-height: 44%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); }
.queue-fold > summary { min-height: 38px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; list-style: none; color: var(--muted); font-size: 13.5px; font-weight: 800; }
.queue-fold > summary::-webkit-details-marker { display: none; }
.queue-fold > summary::after { content: '▾'; margin-left: auto; }
.queue-fold[open] > summary::after { content: '▴'; }
.queue-fold > .queue-sec { max-height: none; overflow: visible; border: 0; background: transparent; padding: 0 10px 10px; }
/* 대기줄이 비었을 때 [멈춤] 은 흐리게 — 안 쓰는 단추가 제일 진하면 눈이 먼저 간다(10-16 점검 '단추 이름표') */
.queue-sec:has(.count-badge.zero) .pause-btn:not(.pri) { background: transparent; color: var(--muted); border-color: var(--line); }
/* 방송 전 오른쪽 = 점검표만 */
body[data-view=setup] #say-slot, body[data-view=setup] #con-mini, body[data-view=setup] #undo,
body[data-view=setup] #pending, body[data-view=setup] #queue-fold { display: none; }
#side > .pf-pre { width: 100%; flex: none; padding: 18px; border-radius: 18px; box-shadow: none; }
body[data-view=live] #side > .pf-pre { display: none; }
/* 알림 — 왼쪽 줄을 가리지 않게 */
@media (min-width: 900px) { .toasts { left: calc(var(--rail-w) + 34px); } }
/* '서버와 연결이 끊겼어요' 띠 — 왼쪽 줄이 조종 줄 옆까지 올라가 있어 그 자리를 비켜 선다(안 비키면 첫 글자들이 줄 밑에 가린다 · 10-17 검토) */
@media (min-width: 900px) { .down-banner { margin: 0 0 var(--gap) calc(var(--rail-w) + var(--gap)); } }

/* ── ⚙ 설정 화면 · 틀 탭(panels/settings_menu.js · panels/frame.js) ── */
.st-panel { display: flex; flex-direction: column; gap: 16px; }
.st-panel .sec-head { margin-bottom: 0; }
.st-grp h3 { margin: 0 0 8px; font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: 0.02em; }
.st-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.st-tile {
    position: relative; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-align: left;
    border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--text); font: inherit; cursor: pointer;
}
.st-tile:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--accent-ring); }
.st-tile.locked { opacity: 0.4; }
.st-tile.locked:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.st-emo { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(0, 0, 0, 0.22); font-size: 16px; }
.st-tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.st-tx b { font-size: 14px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-tx small { color: var(--muted); font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-last { position: absolute; top: -7px; left: 10px; padding: 0 6px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--gold); font-size: 10.5px; font-weight: 800; line-height: 16px; }
.st-news { position: absolute; top: 6px; right: 8px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #2a1a00; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; }
.st-outrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fr-sigdisp, .fr-restore-panel { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.fr-sigdisp p, .fr-restore-panel p { margin: 0; }
.fr-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fr-url { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 8px 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.fr-url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.fr-logs > .logs-sec { background: transparent; border: 0; padding: 0; }

/* ── 반 화면(900~1279) ── */
@media (min-width: 900px) and (max-width: 1279px) {
    :root { --rail-w: 64px; --side-w: 340px; }
    #hdr .sb { gap: 10px; }
    #hdr .pf-chip .t, #hdr .conn .t { display: none; }
    #hdr .pf-chip .ts, #hdr .conn .ts { display: inline; }
    #hdr .cb { gap: 10px; padding: 0 10px; }
    #hdr .cb-bgm .bgm-mini { max-width: 260px; }
    #rail .tab { width: 56px; font-size: 10px; }
    #center { padding: 12px; }
    #side { padding: 10px; }
}

/* ── 📱 폰(900 아래) — 위 4줄 고정(상태 점 · 경보 띠 · 조종 줄 · 탭 줄) + 아래로 한 줄 ── */
@media (max-width: 899px) {
    :root { --sb-h: 32px; }
    html { scroll-padding-top: calc(var(--hdr-h) + 54px); }
    .app { padding: 0 10px 16px; }
    #hdr {
        top: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; margin: 0 -10px; padding: 0; border-radius: 0;
        background: rgba(26, 20, 17, 0.97); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    }
    #hdr .sb { display: contents; }
    #hdr .sbr, #hdr .sb-l { height: var(--sb-h); background: rgba(8, 6, 5, 0.55); border-bottom: 1px solid var(--line-2); font-size: 11.5px; }
    #hdr .sbr { grid-row: 1; grid-column: 1; margin: 0; padding: 0 2px 0 8px; gap: 6px; }
    #hdr .sbr:not(:has(> :not([hidden]))) { padding: 0; }
    #hdr .sb-l {
        grid-row: 1; grid-column: 2; min-width: 0; gap: 6px; padding: 0 30px 0 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent);
    }
    #hdr .sb-l::-webkit-scrollbar { display: none; }
    body[data-view=setup] #hdr .brand, body[data-view=live] #hdr .brand { display: none; }
    #hdr .st { height: 24px; padding: 0 5px; gap: 6px; font-size: 11.5px; }
    #hdr .st .dot { width: 7px; height: 7px; }
    /* 폰은 짧은 글자(.ts) — '방송 화면 ?' → '화면 ?' (긴 글자 · 짧은 글자 둘 다 숨으면 점만 남는다) */
    #hdr .pf-chip .t, #hdr .conn .t { display: none; }
    #hdr .pf-chip .ts, #hdr .conn .ts { display: inline; }
    #hdr .onair .since { display: none; }
    #hdr .onair .since-s { display: inline; }
    #hdr .sb-clock { display: none; }
    #sb-band { grid-row: 2; grid-column: 1 / -1; height: 30px; margin: 0; padding: 0 6px 0 11px; border-radius: 0; border-width: 0 0 1px; font-size: 12px; }
    #sb-band .sbb-t { max-width: none; flex: 1 1 auto; }
    #sb-band .sbb-s { display: none; }
    #sb-band .sbb-pop { left: 8px; right: 8px; min-width: 0; }
    #hdr .cb {
        grid-row: 3; grid-column: 1 / -1; height: 56px; margin: 0; padding: 0 12px; gap: 8px; border-radius: 0;
        border-width: 0 0 1px; background: rgba(34, 26, 22, 0.92);
    }
    #hdr .cb .vsep, #hdr .cb .gcap { display: none; }
    #hdr .cb .btn { min-height: 40px; height: 40px; border-radius: 11px; font-size: 13.5px; }
    #hdr .cb-more { display: inline-flex; margin-left: auto; padding: 0 14px; }
    #hdr .cb:not(:has(#ctl-sig:not([hidden]))) .cb-more { flex: 1; margin-left: 0; }
    #hdr .ap-banner { grid-column: 1 / -1; margin: 0; border-radius: 0; }
    /* 세 칸 → 한 줄: 탭 줄(머리 밑에 붙음) → 대기함 → 가운데(랭킹 · 탭) → 되돌리기(아래에 붙음) → 시그니처 대기줄 → 한마디 · 점검표 */
    body[data-view=setup] .v-shell, body[data-view=live] .v-shell { display: flex; flex-direction: column; gap: 12px; height: auto; min-height: 0; }
    #rail {
        position: sticky; top: var(--hdr-h); z-index: 38; order: 0; height: 42px; margin: 0 -10px; padding: 0 30px 0 8px;
        flex-direction: row; align-items: stretch; gap: 2px; border-radius: 0; border-width: 0 0 1px; background: rgba(26, 20, 17, 0.97);
        overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
    }
    #rail .tab { width: auto; min-height: 0; height: 100%; flex-direction: row; gap: 4px; padding: 0 9px; border-radius: 0; font-size: 13.5px; }
    #rail .tab .tab-ic { display: none; }
    #rail .tab .tab-t { overflow: visible; }
    #rail .tab.on { background: transparent; color: #fff; box-shadow: inset 0 -2.5px 0 var(--accent); }
    #rail .tabsep { width: 1px; height: auto; margin: 12px 4px; }
    #rail .rail-push { display: none; }
    #rail .tab-badge { position: static; }
    #rail .tab-dot { top: 8px; right: 1px; }
    #center, #side { overflow: visible; background: transparent; border: 0; border-radius: 0; padding: 0; }
    #center { order: 2; }
    #side { display: contents; }
    #pending { order: 1; }
    #side > .pending-sec { flex: none; min-height: 0; max-height: none; overflow: visible; padding: 0; }
    #undo {
        order: 3; position: sticky; bottom: 8px; z-index: 30; padding: 8px;
        background: rgba(30, 22, 18, 0.96); border-color: var(--line); box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.45);
    }
    #queue-fold { order: 4; max-height: none; overflow: visible; }
    #say-slot { order: 5; }
    #con-mini { order: 6; }
    #side > .pf-pre { order: 7; }
    #drawer { order: 8; }
    body[data-view=setup] #center[data-tab=home] > #v-setup { padding: 4px 0; }
    .st-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
