:root {
  --bg: #0b0e14;
  --panel: #141a24;
  --panel2: #1b2331;
  --text: #e8eaf0;
  --dim: #8b93a7;
  --accent: #4da3ff;
  --ok: #3ecf8e;
  --warn: #ffd166;
  --err: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Pretendard', 'Noto Sans KR', 'Noto Sans SC', -apple-system, sans-serif; }
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }

.wrap { max-width: 960px; margin: 0 auto; padding: 20px; }
.card { background: var(--panel); border: 1px solid #232c3d; border-radius: 14px; padding: 20px; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 10px; color: var(--dim); font-weight: 600; }
.sub-note { color: var(--dim); font-size: 13px; }

input[type="text"], select {
  background: var(--panel2); color: var(--text); border: 1px solid #2a3549; border-radius: 8px;
  padding: 10px 12px; font-size: 15px; width: 100%;
}
.btn {
  background: var(--accent); color: #06121f; border: 0; border-radius: 10px; padding: 12px 18px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid #2a3549; }
.btn.danger { background: var(--err); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* room page */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid #232c3d; flex-wrap: wrap; }
.topbar .code { font-size: 18px; font-weight: 800; letter-spacing: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel2); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--dim); }
.chip.on { color: var(--ok); border: 1px solid var(--ok); }
.btn-chip { cursor: pointer; border: 1px solid #2a3549; }

.mic-area { display: flex; align-items: center; gap: 14px; }
#micBtn { width: 84px; height: 84px; border-radius: 50%; font-size: 34px; border: 3px solid #2a3549; background: var(--panel2); cursor: pointer; }
#micBtn.on { border-color: var(--err); background: #3a1420; box-shadow: 0 0 24px rgba(255, 107, 107, 0.35); }
#level { width: 120px; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
#level > i { display: block; height: 100%; width: 0%; background: var(--ok); transition: width 80ms linear; }

.provider-item { display: flex; gap: 8px; align-items: baseline; padding: 6px 4px; }
.provider-item .cost { color: var(--warn); font-size: 12px; margin-left: auto; white-space: nowrap; }
.provider-item .desc { color: var(--dim); font-size: 12px; }
.provider-item.unavailable { opacity: 0.4; }

#feed { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 60px; }
.sub { background: var(--panel); border-left: 4px solid var(--pc, var(--accent)); border-radius: 10px; padding: 10px 14px; }
.sub .meta { display: flex; gap: 8px; font-size: 12px; color: var(--dim); margin-bottom: 4px; align-items: center; }
.sub .meta .prov { color: var(--pc, var(--accent)); font-weight: 700; }
.sub .meta .lat { margin-left: auto; }
.sub .src { font-size: 14px; color: var(--dim); }
.sub .tr { font-size: 17px; margin-top: 2px; }
.sub .tr .lang-tag { font-size: 11px; color: var(--dim); margin-right: 6px; vertical-align: 2px; }
.sub.partial .src, .sub.partial .tr { opacity: 0.65; }
.sub.partial .src::after { content: '▌'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }

#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid #2a3549; border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 380px; }
.toast.error { border-left-color: var(--err); }

.overlay { position: fixed; inset: 0; background: rgba(4, 6, 10, 0.82); display: flex; align-items: center; justify-content: center; z-index: 100; }
.overlay .card { width: min(420px, 92vw); }

/* 자막(시어터) 모드 — 같은 룸 페이지에서 토글 */
#strips { display: none; }
#theaterBar { display: none; }
body.theater { overflow: hidden; background: #05070c; }
body.theater .topbar, body.theater #controlWrap { display: none; }
body.theater #strips { position: fixed; inset: 0; display: grid; gap: 6px; padding: 8px 18px 12px; }
#strips.single .phead { display: none; }
.strip { display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; min-width: 0; }
.strip .phead { font-size: 13px; color: var(--dim); border-bottom: 1px solid #1b2331; padding-bottom: 3px; margin-bottom: 6px; display: flex; gap: 8px; }
.strip .phead b { color: var(--pc, var(--accent)); }
.dline { margin-top: 1.1vh; line-height: 1.32; }
.dline .dmeta { font-size: calc(1.7vh * var(--fs, 1)); color: #6b7590; }
.dline .dsrc { font-size: calc(2.4vh * var(--fs, 1)); color: #9aa3b8; }
.dline .dtr { font-size: calc(4vh * var(--fs, 1)); font-weight: 700; color: #f2f4fa; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.dline .dtr .lang-tag { font-size: calc(1.8vh * var(--fs, 1)); font-weight: 400; color: #6b7590; margin-right: 8px; vertical-align: 6px; }
.dline.partial { opacity: 0.6; }
.dline.old { opacity: 0.45; filter: brightness(0.8); }
.dline.old .dtr { font-size: calc(3vh * var(--fs, 1)); }

body.theater #theaterBar { display: flex; position: fixed; top: 6px; right: 10px; gap: 6px; align-items: center; z-index: 10; opacity: 0.35; transition: opacity 0.2s; }
body.theater #theaterBar:hover { opacity: 1; }
.tb { background: #141a24; color: #8b93a7; border: 1px solid #2a3549; border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
#micBtn2.on { color: var(--err); border-color: var(--err); box-shadow: 0 0 10px rgba(255, 107, 107, 0.3); }
#level2 { display: inline-block; width: 46px; height: 5px; background: #141a24; border-radius: 3px; overflow: hidden; position: relative; }
#level2::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--lv, 0%); background: var(--ok); transition: width 80ms linear; }

/* 설정 서랍 (양쪽 모드 공용) */
#settingsDrawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 94vw);
  background: var(--panel); border-left: 1px solid #232c3d; padding: 16px;
  transform: translateX(105%); transition: transform 0.2s; z-index: 60; overflow-y: auto;
}
#settingsDrawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#settingsDrawer h2 { margin-top: 16px; }
.drawer-grid { display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: var(--dim); }
.drawer-grid select, .drawer-grid input[type="range"] { width: 100%; margin-top: 4px; }
