:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #f2f4f8;
  --muted: #8b93a4;
  --accent: #4f8cff;
  --accent-2: #2f63d6;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; }

#app {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 16px);
  max-width: 560px; margin: 0 auto;
}

header { text-align: center; }
.lesson-no { color: var(--accent); font-size: 15px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
h1 { font-size: 24px; margin: 6px 0 4px; font-weight: 700; line-height: 1.25; }
.phase { color: var(--muted); font-size: 15px; min-height: 20px; }

.subs {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: 12px 4px; min-height: 180px;
}
.subs p { margin: 0; transition: opacity .2s; }
.subs .en { font-size: 30px; font-weight: 600; line-height: 1.3; }
.subs .vi { font-size: 20px; color: var(--muted); margin-top: 14px; line-height: 1.35; }
.subs.hidden .en, .subs.hidden .vi { visibility: hidden; }
.subs .en.active-vi { color: var(--muted); }
.subs .vi.active-vi { color: var(--text); }

.controls { padding-top: 8px; }
.progress { height: 28px; display: flex; align-items: center; cursor: pointer; position: relative; }
.progress .bar { position: relative; height: 5px; width: 100%; background: #2a2f3a; border-radius: 3px; overflow: hidden; }
.progress .bar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); background: var(--accent); border-radius: 3px; }
.time { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-top: -4px; }

.buttons { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 18px 0 20px; }
button { font: inherit; color: var(--text); background: none; border: 0; cursor: pointer; }
button svg { fill: currentColor; display: block; }
.round { width: 60px; height: 60px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
.round svg { width: 30px; height: 30px; }
.big { width: 104px; height: 104px; border-radius: 50%; background: var(--accent); display: grid; place-items: center;
  box-shadow: 0 8px 30px rgba(79,140,255,.35); }
.big:active { background: var(--accent-2); transform: scale(.97); }
.big svg { width: 56px; height: 56px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { background: var(--panel); color: var(--muted); padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.pill.on { color: var(--text); }
.speed { display: flex; background: var(--panel); border-radius: 999px; padding: 4px; }
.speed button { padding: 7px 10px; border-radius: 999px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.speed button.on { background: var(--accent); color: #fff; }

#picker { margin-top: 18px; width: 100%; padding: 12px 14px; border-radius: 12px; background: var(--panel); color: var(--muted);
  border: 0; font: inherit; font-size: 15px; -webkit-appearance: none; appearance: none; text-align: center; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 24px); transform: translateX(-50%);
  background: #262b36; color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (max-height: 640px) {
  .subs .en { font-size: 24px; }
  .subs .vi { font-size: 17px; }
  .big { width: 88px; height: 88px; }
}
