:root {
  --bg: hsl(40 33% 97%);
  --card: hsl(0 0% 100%);
  --ink: hsl(160 20% 12%);
  --sub: hsl(160 8% 38%);
  --line: hsl(160 12% 86%);
  --brand: hsl(165 62% 24%);
  --brand-ink: hsl(0 0% 100%);
  --soft: hsl(165 40% 92%);
  --warn: hsl(8 70% 40%);
  --now: hsl(48 95% 86%);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(160 14% 9%); --card: hsl(160 12% 13%); --ink: hsl(40 20% 92%); --sub: hsl(160 8% 66%);
    --line: hsl(160 10% 24%); --brand: hsl(165 55% 46%); --brand-ink: hsl(160 30% 8%); --soft: hsl(165 30% 18%);
    --warn: hsl(8 80% 70%); --now: hsl(48 50% 24%);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}
#app { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }
h1 { font-size: 26px; margin: 8px 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 28px 0 10px; color: var(--sub); font-weight: 600; }
.lead { color: var(--sub); margin: 0 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
input, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-height: 52px;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 0 20px; min-height: 52px; cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ghost { flex: none; white-space: nowrap; border-color: transparent; background: transparent; padding: 0 10px 0 0; min-height: 44px; color: var(--sub); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn[aria-pressed="true"] { background: var(--soft); border-color: var(--brand); }
.msg { margin: 0; color: var(--warn); min-height: 1.2em; }
.msg.ok { color: var(--sub); }
.hint { margin: 0 0 10px; color: var(--sub); font-size: 15px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; gap: 8px; }
.list .open {
  flex: 1; text-align: left; font: inherit; color: inherit; background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 16px; min-height: 52px; cursor: pointer;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.list .del { flex: none; width: 52px; min-height: 52px; font: inherit; color: var(--sub); background: transparent; border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; }

.bar { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.title { font-size: 16px; margin: 0; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.player { position: sticky; top: 0; z-index: 2; background: hsl(0 0% 0%); border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; }
.player iframe, .player > div { width: 100%; height: 100%; display: block; border: 0; }

.group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0; }
.glabel { color: var(--sub); font-size: 15px; width: 36px; }
.chip {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 0 16px; min-height: 44px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 18px 0 6px; background: var(--soft); padding: 5px; border-radius: var(--r); }
.tab { font: inherit; font-weight: 600; color: var(--sub); background: transparent; border: 0; border-radius: 10px; min-height: 44px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); }
.panel { padding-top: 2px; }
.panel .row, .panel .stack { margin-top: 14px; }

.sentences, .cues { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.sentences button, .cues button {
  width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px 16px; min-height: 52px; cursor: pointer;
}
.sentences .en { display: block; font-size: 19px; line-height: 1.45; }
.sentences .ko { display: block; margin-top: 4px; color: var(--sub); font-size: 15px; }
.hide-ko .sentences .ko { display: none; }
.sentences button.now, .cues button.now { background: var(--now); border-color: var(--brand); }
.cues button { font-size: 16px; padding: 10px 14px; min-height: 44px; }
.cues .time { color: var(--sub); font-size: 13px; margin-right: 8px; font-variant-numeric: tabular-nums; }

.words { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.words li { display: flex; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 10px 14px; }
.words .w { font-weight: 600; }
.words .k { color: var(--sub); }
[hidden] { display: none !important; }
