/* ============================================================
   Ritme — stylesheet
   Prinsip: tenang, kontras tinggi, target sentuh besar, minim hiasan.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --bg: #F7F3EC;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --surface-3: #F3EEE4;
  --ink: #211E19;
  --ink-2: #635C51;
  --ink-3: #746C5F;
  --line: #E9E2D6;
  --line-strong: #DCD3C3;

  --good: #146C34;
  --good-soft: #E4F4E9;
  --warn: #9A4A06;
  --warn-soft: #FBF0DC;
  --bad: #B42318;
  --bad-soft: #FBEAE8;

  /* --accent-base diisi oleh [data-accent]; --accent adalah versi yang dipakai
     di tema aktif, jadi mode gelap bisa mencerahkannya tanpa menyentuh palet. */
  --accent-base: #C2410C;
  --accent: var(--accent-base);
  --accent-ink: #9A3412;      /* teks aksen di atas permukaan terang */
  --accent-text: var(--accent-ink); /* teks aksen di atas permukaan tema */
  --accent-soft: #FBE9DD;

  /* pasangan warna yang harus dibalik total saat mode gelap */
  --toast-bg: #211E19;
  --toast-ink: #FFFFFF;
  --on-good: #FFFFFF;

  --sh-1: 0 1px 2px rgba(33, 30, 25, .05);
  --sh-2: 0 2px 6px rgba(33, 30, 25, .04), 0 18px 34px -26px rgba(33, 30, 25, .45);
  --sh-3: 0 24px 60px -20px rgba(33, 30, 25, .35);

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;

  --pad: 18px;
  --maxw: 560px;
  --nav-h: 78px;

  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(.22, .9, .3, 1);
}

[data-accent="terra"]  { --accent-base: #C2410C; --accent-ink: #9A3412; --accent-soft: #FBE9DD; }
[data-accent="indigo"] { --accent-base: #4338CA; --accent-ink: #3730A3; --accent-soft: #E7E6FB; }
[data-accent="forest"] { --accent-base: #15803D; --accent-ink: #166534; --accent-soft: #E1F2E7; }
[data-accent="ocean"]  { --accent-base: #0369A1; --accent-ink: #075985; --accent-soft: #DDEEF9; }
[data-accent="plum"]   { --accent-base: #9D174D; --accent-ink: #831843; --accent-soft: #FAE4EE; }
[data-accent="clay"]   { --accent-base: #8D5B4C; --accent-ink: #6F4538; --accent-soft: #F2E6E1; }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(140% 52% at 50% -14%, var(--accent-soft) 0%, transparent 62%);
  background-repeat: no-repeat;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-ink); }
svg { display: block; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- shell ---------- */
.app {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--pad) calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px));
  animation: fade .22s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.screen { display: flex; flex-direction: column; gap: 20px; }

.eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

h1 { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 1.18rem; font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: .95rem; font-weight: 700; }
h4 { font-size: .95rem; font-weight: 700; }
p { color: var(--ink-2); }
.muted { color: var(--ink-2); }
.tiny { font-size: .78rem; }
.center { text-align: center; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 46px; height: 46px; flex: 0 0 46px;
  display: grid; place-items: center;
  font-size: 1.5rem; line-height: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh-1);
}
.greet { flex: 1; min-width: 0; }
.greet h1 { font-size: 1.3rem; }
.greet .eyebrow { margin-bottom: 1px; }

.points {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: var(--ink);
  color: var(--bg);
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: -.01em;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .6);
}
.points small { font-weight: 600; font-size: .68rem; opacity: .65; letter-spacing: .04em; }
.points.bump { animation: bump .4s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--ink-3);
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 18px;
}
.card.tight { padding: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line); border: 0; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: 0 18px 36px -22px var(--accent);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -30% -70% auto;
  width: 260px; height: 260px;
  background: rgba(255, 255, 255, .13);
  border-radius: 50%;
  pointer-events: none;
}
.hero .eyebrow { color: rgba(255, 255, 255, .95); }
.hero h2 { color: #fff; font-size: 1.45rem; margin: 2px 0 2px; }
.hero p { color: rgba(255, 255, 255, .95); font-size: .86rem; }
.hero-body { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; position: relative; }
.hero-emoji {
  width: 58px; height: 58px; flex: 0 0 58px;
  display: grid; place-items: center;
  font-size: 1.9rem;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 18px;
}
.hero .btn-light {
  position: relative;
  background: #fff;
  color: var(--accent-ink);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, .5);
}
.hero-done { background: var(--good); box-shadow: 0 18px 36px -22px var(--good); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .16s var(--ease), background .16s, box-shadow .16s;
  text-align: center;
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 10px 22px -14px var(--accent); }
.btn-primary:hover { box-shadow: 0 14px 26px -14px var(--accent); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.02rem; border-radius: 20px; width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .82rem; border-radius: 11px; }

/* ---------- groups & routine cards ---------- */
.group-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 4px 2px;
  color: var(--ink-2);
}
.group-head h3 { color: var(--ink); }
.group-head .count {
  font-size: .74rem; font-weight: 700;
  background: var(--surface-3); color: var(--ink-2);
  padding: 3px 8px; border-radius: 999px;
}
.group-head .chev { margin-left: auto; transition: transform .22s var(--ease); color: var(--ink-3); }
.group-head[aria-expanded="true"] .chev { transform: rotate(180deg); }

.routine {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: left;
  box-shadow: var(--sh-1);
  transition: border-color .18s, transform .16s var(--ease), background .18s;
}
.routine:active { transform: scale(.985); }
.routine:hover { border-color: var(--line-strong); }

.routine.done { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.routine.done .r-title { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.routine.done .r-sub { color: var(--good); font-weight: 600; }
.routine.next { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.routine.mini { padding: 11px 12px; }

.r-emoji {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  font-size: 1.4rem;
  background: var(--surface-3);
  border-radius: 13px;
}
.routine.done .r-emoji { background: rgba(255, 255, 255, .7); }
.r-main { flex: 1; min-width: 0; }
.r-title {
  display: block;
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.r-sub { display: block; font-size: .76rem; color: var(--ink-3); margin-top: 2px; }

.ring {
  --p: 0;
  position: relative;
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center;
  transition: background .4s var(--ease);
}
.ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface);
}
.routine.done .ring { background: var(--good); }
.routine.done .ring::after { background: var(--good); }
.ring-tick {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--on-good);
  z-index: 2;
}
.ring-tick svg { width: 15px; height: 15px; }

/* ---------- nav ---------- */
.tabbar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(var(--maxw) - 24px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 7px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--sh-3);
  z-index: 40;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px;
  border-radius: 15px;
  color: var(--ink-3);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .01em;
  transition: color .18s, background .18s;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--accent-text); background: var(--accent-soft); }
.tab .dot {
  position: absolute; margin: -1px 0 0 16px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bad);
}

/* ---------- sheets ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 18, 14, .42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s var(--ease);
}
.overlay[hidden] { display: none; }

.sheet {
  width: 100%;
  max-width: var(--maxw);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .4);
  animation: rise .28s var(--ease);
}
@keyframes rise { from { transform: translateY(28px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-grab {
  width: 42px; height: 4px; border-radius: 999px;
  background: var(--line-strong);
  margin: 2px auto 14px;
}
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { flex: 1; font-size: 1.2rem; }

/* steps */
.steps { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }

.step {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  transition: border-color .16s, background .16s, transform .14s var(--ease);
}
.step:active { transform: scale(.985); }
.step .box {
  width: 24px; height: 24px; flex: 0 0 24px;
  border-radius: 8px;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  color: transparent;
  transition: background .18s, border-color .18s, color .18s;
}
.step .box svg { width: 14px; height: 14px; }
.step span { font-weight: 600; font-size: .92rem; }
.step.done { background: var(--surface-2); }
.step.done span { color: var(--ink-3); text-decoration: line-through; }
.step.done .box { background: var(--good); border-color: var(--good); color: var(--on-good); }

.step.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}
.step.current .box { border-color: var(--accent); }
.step.current span { font-weight: 800; }

.step-reward {
  margin-left: auto;
  font-size: .72rem; font-weight: 800;
  color: var(--accent-text);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
}

.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: .95rem;
  transition: border-color .16s, background .16s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.textarea { min-height: 84px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: all .16s;
}
.chip[aria-pressed="true"], .chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emoji-opt {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 1.45rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.emoji-opt[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  transition: transform .16s;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.06); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch p { font-size: .78rem; }
.toggle {
  width: 48px; height: 28px; flex: 0 0 48px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background .2s;
}
.toggle::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s var(--ease);
}
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- segmented ---------- */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: 15px;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 1;
  min-width: max-content;
  padding: 9px 13px;
  border-radius: 11px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
}
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

/* ---------- shop ---------- */
.reward-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reward {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-1);
  text-align: center;
}
.reward .emoji { font-size: 1.9rem; line-height: 1.2; }
.reward .name { font-weight: 700; font-size: .88rem; }
.reward .cost {
  align-self: center;
  font-size: .76rem; font-weight: 800;
  color: var(--warn);
  background: var(--warn-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.reward .btn { width: 100%; margin-top: 2px; }
.reward.affordable { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.reward.locked .emoji, .reward.locked .name { opacity: .55; }

/* ---------- wins ---------- */
.win-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0;
}
.win-row + .win-row { border-top: 1px solid var(--line); }
.win-emoji {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--good-soft);
  font-size: 1.05rem;
}
.win-row .t { font-weight: 600; font-size: .88rem; }
.win-row .when { margin-left: auto; font-size: .72rem; color: var(--ink-3); }

.levelbar { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.levelbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 62%, #fff)); transition: width .6s var(--ease); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.week-day .bar {
  width: 100%; height: 56px;
  border-radius: 8px;
  background: var(--surface-3);
  display: flex; align-items: flex-end;
  overflow: hidden;
}
.week-day .bar > i { display: block; width: 100%; background: var(--accent); border-radius: 8px; transition: height .5s var(--ease); }
.week-day .lbl { font-size: .64rem; font-weight: 700; color: var(--ink-3); }
.week-day.today .lbl { color: var(--accent-text); }

.stat-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.stat-row + .stat-row { border-top: 1px solid var(--line); }
.stat-row .nm { flex: 1; font-size: .88rem; font-weight: 600; }
.stat-row .val { font-size: .78rem; font-weight: 800; color: var(--ink-2); }
.mini-bar { width: 70px; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.mini-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
}
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item .meta { font-size: .75rem; color: var(--ink-3); }
.list-item .grow { flex: 1; min-width: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
}
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 22px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 14px);
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  border-radius: 16px;
  font-size: .86rem;
  font-weight: 600;
  box-shadow: var(--sh-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s var(--ease);
  z-index: 120;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--toast-ink); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }

/* ---------- confetti ---------- */
.confetti {
  position: fixed;
  top: 50%; left: 50%;
  width: 9px; height: 9px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 200;
  animation: burst 1100ms cubic-bezier(.15, .7, .35, 1) forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) rotate(0deg) scale(1); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(.35); opacity: 0; }
}

/* ---------- welcome ---------- */
.welcome { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding-top: 18px; }
.welcome .logo {
  width: 62px; height: 62px; border-radius: 20px;
  background: var(--accent-soft);
  display: grid; place-items: center;
  font-size: 1.8rem;
}
.welcome h1 { font-size: 2rem; }
.lede { font-size: .95rem; line-height: 1.6; }

/* ---------- empty ---------- */
.empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--ink-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.empty .big { font-size: 2rem; margin-bottom: 8px; }

/* ---------- misc ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  font-size: .82rem;
  line-height: 1.5;
  background: var(--warn-soft);
  color: var(--warn);
}
.banner.good { background: var(--good-soft); color: var(--good); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner strong { display: block; margin-bottom: 2px; }

.timer-face {
  display: grid; place-items: center;
  width: 190px; height: 190px;
  margin: 8px auto 18px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 100) * 1%), var(--surface-3) 0);
  position: relative;
}
.timer-face::before {
  content: ""; position: absolute; inset: 9px;
  border-radius: 50%; background: var(--surface);
}
.timer-face span { position: relative; font-size: 2.5rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- dark ----------
   Satu daftar token, dipakai dua kali: untuk pengguna yang mengikuti setelan
   sistem, dan untuk yang memilih gelap secara manual. Jangan menaruh aturan
   komponen di sini — semua perbedaan tema harus lewat token, supaya kedua
   jalur di atas selalu identik. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412;
    --surface: #201E1A;
    --surface-2: #26231F;
    --surface-3: #2E2A25;
    --ink: #F2EDE4;
    --ink-2: #C2BAAB;
    --ink-3: #978F81;
    --line: #322E28;
    --line-strong: #453F36;
    --good: #4ADE80;
    --good-soft: #16291D;
    --warn: #F0B45E;
    --warn-soft: #2C2317;
    --bad: #F87171;
    --bad-soft: #2C1A18;
    --accent-text: color-mix(in srgb, var(--accent-base) 40%, #FFFFFF);
    --accent-soft: color-mix(in srgb, var(--accent-base) 26%, #201E1A);
    --toast-bg: #F2EDE4;
    --toast-ink: #151412;
    --on-good: #10240F;
    --sh-1: 0 1px 2px rgba(0, 0, 0, .35);
    --sh-2: 0 18px 34px -26px rgba(0, 0, 0, .9);
    --sh-3: 0 24px 60px -20px rgba(0, 0, 0, .9);
  }
}
[data-theme="dark"] {
  --bg: #151412;
  --surface: #201E1A;
  --surface-2: #26231F;
  --surface-3: #2E2A25;
  --ink: #F2EDE4;
  --ink-2: #C2BAAB;
  --ink-3: #978F81;
  --line: #322E28;
  --line-strong: #453F36;
  --good: #4ADE80;
  --good-soft: #16291D;
  --warn: #F0B45E;
  --warn-soft: #2C2317;
  --bad: #F87171;
  --bad-soft: #2C1A18;
  --accent-text: color-mix(in srgb, var(--accent-base) 40%, #FFFFFF);
  --accent-soft: color-mix(in srgb, var(--accent-base) 26%, #201E1A);
  --toast-bg: #F2EDE4;
  --toast-ink: #151412;
  --on-good: #10240F;
}
