:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --line: #232a32;
  --text: #eef1f4;
  --muted: #8a96a3;
  --accent: #ffb347;
  --accent2: #5cc8ff;
  --ok: #4ade80;
  --warn: #ff6b6b;
  --font: 40px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }

/* ---------- Setup ---------- */
#setup { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.setup-card { width: 100%; max-width: 560px; }
.setup-card h1 { margin: 0 0 4px; font-size: 32px; }
.sub { margin: 0 0 24px; color: var(--muted); }
.field { margin-bottom: 18px; }
.label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.seg-toggle button { padding: 12px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg-toggle button.on { background: var(--accent); color: #1a1205; }
.seg-list { list-style: none; padding: 0; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.seg-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.seg-list li:first-child { border-top: 0; }
.seg-list .n { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.seg-list .m { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tips { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 20px; color: var(--muted); }
.tips summary { color: var(--text); font-weight: 600; cursor: pointer; }
.tips li { margin: 6px 0; }
.big-btn { width: 100%; padding: 18px; border-radius: 16px; background: var(--accent); color: #1a1205; font-size: 20px; font-weight: 700; }
.link-btn { width: 100%; margin-top: 12px; padding: 12px; color: var(--accent2); }

/* ---------- Prompter ---------- */
#prompter { position: fixed; inset: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.seg-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.seg-num { background: var(--accent); color: #1a1205; font-weight: 800; border-radius: 8px; padding: 3px 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.seg-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timers { display: flex; gap: 14px; font-variant-numeric: tabular-nums; }
.t { display: flex; align-items: baseline; gap: 4px; }
.t .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }
.t span:nth-child(2) { font-weight: 700; font-size: 18px; }
.t .of { color: var(--muted); font-size: 13px; }
.seg-t.over span:nth-child(2) { color: var(--warn); }
.icon-btn { font-size: 24px; width: 40px; height: 40px; border-radius: 10px; background: var(--line); }
.progress { height: 4px; background: var(--line); }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .5s linear; }
.progress .bar.over { background: var(--warn); }
.seg-dots { display: flex; gap: 4px; padding: 6px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.seg-dots i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.seg-dots i b { position: absolute; inset: 0; width: 0; background: var(--ok); }
.seg-dots i.cur { outline: 1px solid var(--accent); }

.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: #3a1d1d; border-bottom: 1px solid var(--warn); font-weight: 600; animation: pulse 1.4s ease-in-out infinite; }
.banner span { flex: 1; }
.banner button { background: var(--warn); color: #1a0505; padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.banner button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
@keyframes pulse { 50% { background: #521f1f; } }

.viewport { flex: 1; position: relative; overflow: hidden; }
.scroller { position: absolute; inset: 0; overflow-y: auto; padding: 38vh 6vw 70vh; scrollbar-width: none; overscroll-behavior: contain; }
.scroller::-webkit-scrollbar { display: none; }
.read-line { position: absolute; left: 0; right: 0; top: 34vh; height: 0; border-top: 2px dashed rgba(255,179,71,.35); pointer-events: none; z-index: 2; }
.read-line::before { content: "▶"; position: absolute; left: 6px; top: -14px; color: var(--accent); font-size: 18px; }
.viewport::before, .viewport::after { content: ""; position: absolute; left: 0; right: 0; height: 18vh; z-index: 1; pointer-events: none; }
.viewport::before { top: 0; background: linear-gradient(var(--bg), transparent); }
.viewport::after { bottom: 0; background: linear-gradient(transparent, var(--bg)); }

.scroller .intro { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; padding: 22px 24px; margin-bottom: 1.4em; }
.scroller .intro h2 { margin: 0 0 8px; font-size: calc(var(--font) * .8); color: var(--accent); }
.scroller .intro p { margin: 0; font-size: calc(var(--font) * .5); color: var(--muted); line-height: 1.45; }
.scroller .intro .meta { margin-top: 10px; font-size: calc(var(--font) * .42); color: var(--accent2); }
.scroller h3 { font-size: calc(var(--font) * .75); margin: 1.6em 0 .6em; color: var(--accent2); }
.scroller p.read { font-size: var(--font); line-height: 1.5; margin: 0 0 1.1em; font-weight: 500; }
.scroller p.note { font-size: calc(var(--font) * .5); color: var(--muted); font-style: italic; border-left: 3px solid var(--line); padding-left: 14px; margin: 0 0 1.2em; line-height: 1.45; }
.scroller .prompt { font-size: calc(var(--font) * .9); line-height: 1.4; margin: 0 0 1.2em; padding: 16px 20px; border-radius: 16px; background: rgba(92,200,255,.08); border: 1px solid rgba(92,200,255,.25); }
.scroller .prompt::before { content: "🗣️ Cakap bebas ±45 saat"; display: block; font-size: calc(var(--font) * .38); color: var(--accent2); font-weight: 700; letter-spacing: .04em; margin-bottom: 6px; }
.scroller .extra-h { margin-top: 2em; padding-top: 1em; border-top: 2px dashed var(--line); color: var(--ok); font-size: calc(var(--font) * .6); }
.scroller .extra-h small { display: block; font-size: .6em; color: var(--muted); font-weight: 400; margin-top: 4px; }
.scroller .x { opacity: .92; }
.jeda { display: inline-block; font-size: .45em; vertical-align: middle; padding: 2px 8px; margin: 0 .2em; border-radius: 999px; background: var(--line); color: var(--muted); font-weight: 700; letter-spacing: .05em; }
.scroller .end { text-align: center; border: 1px dashed var(--line); border-radius: 18px; padding: 26px; margin-top: 2em; font-size: calc(var(--font) * .5); color: var(--muted); }
.scroller .end b { color: var(--text); }
.scroller .end button { margin: 14px 6px 0; padding: 12px 18px; border-radius: 12px; background: var(--line); color: var(--text); font-weight: 600; }
.scroller .end button.pri { background: var(--accent); color: #1a1205; }

.paused-badge { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(110px + var(--safe-b)); background: rgba(20,24,29,.92); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; color: var(--muted); font-size: 14px; z-index: 3; pointer-events: none; }
body.playing .paused-badge { display: none; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px calc(10px + var(--safe-b)); background: var(--panel); border-top: 1px solid var(--line); }
.ctl { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 72px; height: 64px; border-radius: 16px; background: var(--line); user-select: none; }
.ctl:active { transform: scale(.96); background: #2e3742; }
.ctl .ic { font-size: 22px; line-height: 1; }
.ctl .lb { font-size: 11px; color: var(--muted); margin-top: 4px; }
.ctl.play { min-width: 96px; background: var(--accent); color: #1a1205; }
.ctl.play .ic { font-size: 30px; }
body.playing .ctl.play { background: var(--ok); }
.speed-group { display: flex; align-items: center; gap: 8px; }
.speed-val { display: flex; flex-direction: column; align-items: center; min-width: 44px; font-variant-numeric: tabular-nums; }
.speed-val span:first-child { font-size: 26px; font-weight: 800; }
.speed-val .lb { font-size: 11px; color: var(--muted); }

/* ---------- Sheets ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-card { width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); }
.sheet-card.center { text-align: center; border-radius: 20px; margin-bottom: 20vh; }
.sheet-card h3 { margin: 0 0 12px; }
.sheet-card .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; }
.sheet-card .inline { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.sheet-card .inline button { background: var(--line); padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.sheet-card hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.wide { display: block; width: 100%; padding: 14px; border-radius: 12px; background: var(--line); margin-top: 8px; font-weight: 600; }
.wide.danger { background: #4a1f1f; color: #ffb4b4; }
.wide.ghost { background: transparent; border: 1px solid var(--line); }
.keys { font-size: 12px; color: var(--muted); margin: 14px 0 0; line-height: 1.6; }
.sw input { display: none; }
.sw i { display: inline-block; width: 46px; height: 26px; border-radius: 13px; background: var(--line); position: relative; transition: .2s; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: .2s; }
.sw input:checked + i { background: var(--ok); }
.sw input:checked + i::after { left: 23px; background: #fff; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 6px 10px; }
  .seg-info { flex-basis: calc(100% - 54px); }
  .timers { order: 3; width: 100%; justify-content: space-between; }
  .ctl { min-width: 54px; height: 58px; }
  .ctl.play { min-width: 70px; }
  .speed-group { gap: 4px; }
  .scroller { padding-left: 5vw; padding-right: 5vw; }
}
