:root {
  --bg: #14110d; --panel: #1d1813; --line: rgba(227, 172, 80, .16); --gold: #e3ac50;
  --txt: #f3ecdc; --muted: #9c9284; --live: #69cd8e; --warn: #e6b34f;
  --size: 24px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--txt);
  font: 16px/1.5 system-ui, -apple-system, "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans", sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line);
}
.room { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); font-size: 14px; }
.room span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--live); box-shadow: 0 0 0 4px rgba(105, 205, 142, .15); }
.dot.warn { background: var(--warn); }
.actions { display: flex; gap: 8px; flex: none; }
.chip, .icon {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px;
  display: inline-flex; align-items: center; gap: 4px; font-size: 15px; min-height: 40px;
}
.chip svg { width: 16px; height: 16px; }
.icon { width: 40px; justify-content: center; padding: 0; font-weight: 600; }

main {
  flex: 1; overflow-y: auto; padding: 20px 18px 12px; display: flex; flex-direction: column; gap: 18px;
  overscroll-behavior: contain;
}
main[dir="rtl"] { text-align: right; }
.line { animation: in .25s ease-out; }
.line .tr { font-size: var(--size); line-height: 1.45; font-weight: 500; margin: 0; overflow-wrap: anywhere; }
.line .tr.wait { color: var(--muted); }
.line .tr.provisional { color: #d9ccb2; }
.line .src { display: none; margin: 4px 0 0; color: var(--muted); font-size: calc(var(--size) * .6); line-height: 1.4; }
body.orig .line .src { display: block; }
.line.untranslated .tr { color: var(--muted); font-size: calc(var(--size) * .75); }
.line mark { background: rgba(227, 172, 80, .24); color: inherit; border-radius: 3px; transition: background 1.2s; }
.line mark.off { background: transparent; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.live {
  border-top: 1px solid var(--line); background: rgba(227, 172, 80, .04);
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); min-height: 64px;
}
.preview { font-size: calc(var(--size) * .92); line-height: 1.45; color: #efe4cc; min-height: 1.45em; overflow-wrap: anywhere; }
.preview .new { animation: fade .25s ease-out; }
.hearing { display: none; color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: left; }
body.orig .hearing { display: block; }
@keyframes fade { from { opacity: .25; } to { opacity: 1; } }

.notice {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(86vw, 420px);
  text-align: center; color: var(--muted); font-size: 18px; line-height: 1.5; pointer-events: none;
}
.notice.bar { top: auto; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 14px; width: auto; }
.latest {
  position: fixed; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); width: 44px; height: 44px; border-radius: 50%;
  background: var(--gold); color: #1a1006; border: 0; font-size: 20px; font-weight: 700; box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}

.sheet {
  border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--txt);
  width: min(92vw, 460px); max-height: 82vh; padding: 18px; margin: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.langs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow-y: auto; }
.langs button {
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: left; font-size: 16px; min-height: 48px;
}
.langs button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row input { width: 22px; height: 22px; accent-color: var(--gold); }
.stepper { display: flex; gap: 8px; }
.stepper button { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; width: 52px; height: 40px; }
.done { margin-top: 14px; width: 100%; background: var(--gold); color: #1a1006; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .line, .preview .new { animation: none; } }
