:root {
  --bg: #0d1014;
  --surface: #161a21;
  --surface-2: #1e232c;
  --line: #2a303b;
  --text: #eef1f5;
  --muted: #98a1b0;
  --accent: #c8f54a;
  --accent-ink: #11160a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; padding-bottom: calc(96px + var(--safe-b)); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.wrap { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px 0; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 22px; letter-spacing: -.01em; }
.top .sub { color: var(--muted); font-size: 13px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); display: grid; place-items: center; font-size: 20px; }
.iconbtn:active { background: var(--surface-2); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.warn { background: rgba(251,191,36,.14); color: var(--warn); }
.badge.off { background: rgba(248,113,113,.14); color: var(--bad); }

/* ---------- home ---------- */
.hero { background: linear-gradient(160deg, #1d2a0c 0%, var(--surface) 70%); border: 1px solid #33431a;
  border-radius: 20px; padding: 18px; margin-bottom: 16px; }
.hero .label { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.hero h2 { font-size: 30px; margin: 6px 0 4px; letter-spacing: -.02em; }
.hero p { color: var(--muted); font-size: 14px; }
.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:active { filter: brightness(.9); }
.btn.ghost { background: var(--surface-2); }
.btn.block { width: 100%; }
.hero .btn { margin-top: 14px; }

.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 20px 4px 8px; }
.daycard { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; min-height: 64px; }
.daycard:active { background: var(--surface-2); }
.daycard .n { font-weight: 700; }
.daycard .m { color: var(--muted); font-size: 13px; }
.daycard .go { margin-left: auto; color: var(--muted); font-size: 20px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(13,16,20,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; padding-bottom: var(--safe-b); z-index: 20; }
.tabbar button { flex: 1; min-height: 56px; color: var(--muted); font-size: 12px; font-weight: 600; display: grid; place-items: center; gap: 2px; padding: 6px 0; }
.tabbar button .ic { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--accent); }

/* ---------- session ---------- */
.sess-head { position: sticky; top: 0; z-index: 15; background: rgba(13,16,20,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); padding: calc(10px + var(--safe-t)) 16px 10px; }
.sess-head .in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.sess-head .t { flex: 1; min-width: 0; }
.sess-head .t b { display: block; font-size: 17px; }
.sess-head .t span { color: var(--muted); font-size: 12px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); }
.progress { height: 3px; background: var(--surface-2); margin-top: 10px; border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s; }

.ex { background: var(--surface); border-radius: 20px; margin: 14px 0; overflow: hidden; border: 1px solid transparent; }
.ex.done { border-color: rgba(74,222,128,.35); }
.ex.skipped { opacity: .5; }
.ex-top { display: flex; gap: 12px; padding: 14px 14px 10px; }
.figure { position: relative; width: 92px; height: 92px; flex: none; border-radius: 12px; overflow: hidden; background: #fff; }
.figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.figure img:nth-child(2) { animation: swap 2.4s steps(1, end) infinite; }
@keyframes swap { 0%, 50% { opacity: 0; } 50.01%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .figure img:nth-child(2) { animation: none; opacity: 0; } }
.figure.tall { cursor: zoom-in; }
.ex-title { min-width: 0; }
.ex-title .idx { color: var(--muted); font-size: 12px; font-weight: 600; }
.ex-title h3 { font-size: 18px; line-height: 1.2; margin: 2px 0 4px; }
.ex-title .cue { color: var(--muted); font-size: 13px; line-height: 1.35; }

.ref { margin: 0 14px 10px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.ref .row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.chip.naik { background: rgba(200,245,74,.16); color: var(--accent); }
.chip.ulang { background: rgba(251,191,36,.14); color: var(--warn); }
.chip.turun { background: rgba(248,113,113,.14); color: var(--bad); }
.chip.baru { background: rgba(152,161,176,.16); color: var(--muted); }
.ref .last { font-size: 13px; color: var(--muted); }
.ref .hint { font-size: 13px; margin-top: 6px; }
.opts { display: flex; gap: 8px; margin-top: 10px; }
.opts button { flex: 1; min-height: 44px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.opts button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.opts button small { display: block; font-weight: 500; font-size: 11px; opacity: .8; }

.sets { padding: 0 14px 6px; }
.sethead, .setrow { display: grid; grid-template-columns: 30px 1fr 1fr 48px; gap: 8px; align-items: center; }
.sethead { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 0 0 4px; text-align: center; }
.sethead.nw, .setrow.nw { grid-template-columns: 30px 1fr 48px; }
.setrow { padding: 4px 0; }
.setrow .no { color: var(--muted); font-weight: 700; text-align: center; }
.stepper { display: grid; grid-template-columns: 34px 1fr 34px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: 48px; }
.stepper button { font-size: 20px; color: var(--muted); }
.stepper button:active { background: var(--surface-2); }
.stepper input { width: 100%; min-width: 0; text-align: center; background: none; border: 0; outline: 0; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; padding: 0; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input[type=number] { -moz-appearance: textfield; }
.setrow.done .stepper { border-color: rgba(74,222,128,.5); opacity: .8; }
.check { height: 48px; border-radius: 12px; background: var(--surface-2); font-size: 22px; color: var(--muted); }
.check.on { background: var(--ok); color: #06210f; }
.ex-foot { display: flex; gap: 8px; padding: 6px 14px 14px; }
.ex-foot button { flex: 1; min-height: 44px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 600; }

.finish { margin: 22px 0 8px; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin: 6px 0 0; }

/* ---------- rest timer ---------- */
.rest { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 30; max-width: 536px; margin: 0 auto;
  background: var(--accent); color: var(--accent-ink); border-radius: 18px; padding: 10px 12px 10px 16px;
  display: none; align-items: center; gap: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.rest.on { display: flex; }
.rest .lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.rest .time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.rest .grow { flex: 1; }
.rest button { min-height: 44px; padding: 0 14px; border-radius: 12px; background: rgba(17,22,10,.14); font-weight: 800; }
.rest.end { animation: pulse .5s 3; }
@keyframes pulse { 50% { transform: scale(1.03); } }

/* ---------- history ---------- */
.hist { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; }
.hist .l1 { display: flex; justify-content: space-between; font-weight: 700; }
.hist .l2 { color: var(--muted); font-size: 13px; margin-top: 4px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ---------- misc ---------- */
#toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #f4f6f9; color: #10141a; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; max-width: 90vw;
  transition: .2s; z-index: 50; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; align-items: end; }
.sheet { background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + var(--safe-b)); max-width: 560px; width: 100%; margin: 0 auto; }
.sheet h3 { margin-bottom: 6px; }
.sheet p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.sheet input[type=password], .sheet input[type=text] { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; margin-bottom: 12px; }
.sheet .row { display: flex; gap: 8px; }
.sheet .row .btn { flex: 1; }
.zoom img { width: 100%; border-radius: 12px; background: #fff; margin-bottom: 8px; }

/* ---------- mode fokus (satu set sekaligus) ---------- */
.focus { padding-top: 14px; }
.kicker { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.figure.big { width: 100%; height: auto; aspect-ratio: 4 / 3; max-height: 240px; margin-bottom: 14px; border-radius: 16px; }
.ex-h { font-size: 26px; letter-spacing: -.01em; line-height: 1.15; margin-bottom: 4px; }
.cue { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.focus .ref { margin: 0 0 14px; }
.planlist { background: var(--surface); border-radius: 14px; padding: 10px 14px; margin-bottom: 16px; }
.pl-h { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.pl-r { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.pl-r:first-of-type { border-top: 0; }
.pl-r.d b { color: var(--ok); }
.btn.big { min-height: 64px; font-size: 19px; border-radius: 18px; }
.setline { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.setline .figure { width: 84px; height: 84px; }
.set-h { font-size: 30px; letter-spacing: -.02em; line-height: 1.05; }
.set-h span { font-size: 16px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.refline { color: var(--muted); font-size: 14px; margin-top: 6px; }
.flds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.flds.one { grid-template-columns: 1fr; }
.fl { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stepper.big { grid-template-columns: 52px 1fr 52px; height: 76px; border-radius: 16px; }
.stepper.big button { font-size: 28px; }
.stepper.big input { font-size: 30px; }
.tmbox { margin-bottom: 14px; text-align: center; }
.tmt { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.row3.two { grid-template-columns: 1fr 1fr; }
.row3 button { min-height: 48px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 14px; }
.row3 button:disabled { opacity: .35; }

.rest-screen { text-align: center; }
.rest-screen .kicker { text-align: center; }
.restbox { background: var(--surface); border-radius: 24px; padding: 30px 16px; margin: 6px 0 12px; border: 2px solid var(--line); transition: background .3s, border-color .3s; }
.restbox .lbl { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.restbox .time { font-size: 84px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -.03em; }
.restbox.ready { background: #16240a; border-color: var(--accent); }
.restbox.ready .lbl { color: var(--accent); }
.restbox.ready .time { color: var(--accent); font-size: 64px; }
.nextcard { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin: 14px 0 16px; text-align: left; }
.nextcard .nl { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.nextcard .nd { font-weight: 700; font-size: 17px; margin-top: 2px; }

.summary { background: var(--surface); border-radius: 16px; padding: 4px 14px; margin: 12px 0 16px; }
.sm-r { padding: 10px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.sm-r:first-child { border-top: 0; }
.sm-r span { color: var(--muted); font-size: 13px; }
.sm-r.no b { color: var(--muted); }

.li { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border-radius: 12px; text-align: left; margin-bottom: 6px; background: var(--surface-2); }
.li .ln { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted); flex: none; }
.li .lt { flex: 1; font-weight: 600; }
.li .ls { color: var(--muted); font-size: 13px; }
.li.ok .ln { background: var(--ok); color: #06210f; }
.li.here { outline: 2px solid var(--accent); }
.chk { display: flex; gap: 10px; align-items: center; margin: 4px 0 14px; font-size: 14px; color: var(--muted); }
.chk input { width: 20px; height: 20px; accent-color: var(--accent); }
.pl-legend { color: var(--muted); font-size: 12px; margin: -2px 0 6px; }
