/* ---------- Tokens ---------- */
:root {
  --bg: #fbf7f0;
  --bg-soft: #f4ede1;
  --surface: #ffffff;
  --surface-2: #faf6ef;
  --border: #ebe3d6;
  --text: #1f2a2e;
  --muted: #66727a;
  --primary: #0f766e;
  --primary-soft: #ccebe6;
  --accent: #d97706;
  --accent-soft: #fdf1dc;
  --arab: #10302c;
  --shadow: 0 1px 2px rgb(31 42 46 / 0.04), 0 8px 24px -12px rgb(31 42 46 / 0.12);
  --shadow-lg: 0 2px 4px rgb(31 42 46 / 0.04), 0 24px 48px -20px rgb(15 118 110 / 0.28);

  --sky-1: #ffd9a8;
  --sky-2: #ffeccc;
  --sky-3: #fbf7f0;
  --orb: radial-gradient(circle at 50% 50%, #fff6d8 0%, #ffcf73 45%, #f59e0b 100%);
  --orb-glow: rgb(251 191 36 / 0.55);
  --hill-back: #e9d3b0;
  --hill-front: #dcc198;
  --stars-opacity: 0;
  --title-grad: linear-gradient(120deg, var(--accent), #f97316 60%, var(--primary));

  --arab-size: 30px;
  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0b1220;
  --bg-soft: #0f1829;
  --surface: #111b2e;
  --surface-2: #14203a;
  --border: #1f2c46;
  --text: #e6edf5;
  --muted: #93a2b8;
  --primary: #2dd4bf;
  --primary-soft: #0f3b3a;
  --accent: #fbbf24;
  --accent-soft: #2a2412;
  --arab: #f1f6f9;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(45 212 191 / 0.25);

  --sky-1: #0b1433;
  --sky-2: #172554;
  --sky-3: #0b1220;
  --orb: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 50%, #94a3b8 100%);
  --orb-glow: rgb(226 232 240 / 0.25);
  --hill-back: #16213a;
  --hill-front: #101a2e;
  --stars-opacity: 1;
  color-scheme: dark;
}

/* Tema gelap mengikuti sistem bila pengguna belum memilih */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0b1220; --bg-soft: #0f1829; --surface: #111b2e; --surface-2: #14203a;
    --border: #1f2c46; --text: #e6edf5; --muted: #93a2b8; --primary: #2dd4bf;
    --primary-soft: #0f3b3a; --accent: #fbbf24; --accent-soft: #2a2412; --arab: #f1f6f9;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 24px 48px -20px rgb(45 212 191 / 0.25);
    --sky-1: #0b1433; --sky-2: #172554; --sky-3: #0b1220;
    --orb: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 50%, #94a3b8 100%);
    --orb-glow: rgb(226 232 240 / 0.25);
    --hill-back: #16213a; --hill-front: #101a2e; --stars-opacity: 1;
    color-scheme: dark;
  }
}

/* Langit senja untuk dzikir petang (terang / gelap / gelap mengikuti sistem) */
:root[data-waktu='petang']:not([data-theme='dark']) {
  --sky-1: #f4a3a8; --sky-2: #fdd0b1; --sky-3: #fbf7f0;
  --orb: radial-gradient(circle at 50% 50%, #fff1d6 0%, #fb923c 50%, #e11d48 100%);
  --orb-glow: rgb(251 113 133 / 0.5);
  --hill-back: #e7c2b0; --hill-front: #d6a38d;
  --title-grad: linear-gradient(120deg, #e11d48, #f97316 55%, #7c3aed);
}
:root[data-waktu='petang'][data-theme='dark'] {
  --sky-1: #1e1b4b; --sky-2: #3b2466; --sky-3: #0b1220;
  --orb: radial-gradient(circle at 35% 35%, #fffbeb 0%, #fde68a 55%, #d6a54a 100%);
  --orb-glow: rgb(253 230 138 / 0.25);
  --hill-back: #1f1a3d; --hill-front: #150f2e;
  --title-grad: linear-gradient(120deg, #fb7185, #fbbf24 55%, #a78bfa);
}
@media (prefers-color-scheme: dark) {
  :root[data-waktu='petang']:not([data-theme]) {
    --sky-1: #1e1b4b; --sky-2: #3b2466; --sky-3: #0b1220;
    --orb: radial-gradient(circle at 35% 35%, #fffbeb 0%, #fde68a 55%, #d6a54a 100%);
    --orb-glow: rgb(253 230 138 / 0.25);
    --hill-back: #1f1a3d; --hill-front: #150f2e;
    --title-grad: linear-gradient(120deg, #fb7185, #fbbf24 55%, #a78bfa);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
code { font-size: 0.9em; padding: 0.1em 0.4em; border-radius: 6px; background: var(--bg-soft); }

/* ---------- Progress bar ---------- */
.progress-bar { position: fixed; inset: 0 0 auto; height: 3px; z-index: 60; }
.progress-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.6s var(--ease);
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px max(clamp(16px, 4vw, 32px), env(safe-area-inset-right)) 14px max(clamp(16px, 4vw, 32px), env(safe-area-inset-left));
  padding-top: max(14px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.5s var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--border); }
.brand { flex: none; display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #f97316); color: #fff;
  box-shadow: 0 6px 16px -6px var(--accent);
}
.brand-mark svg { width: 20px; height: 20px; }
.topbar-actions { flex: none; display: flex; gap: 8px; }

/* Segmented control Pagi / Petang */
.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; border-radius: 16px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
}
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 12px; background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
  transition: transform 0.45s var(--spring), background-color 0.4s;
}
:root[data-waktu='petang'] .seg-pill { transform: translateX(100%); }
.seg-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border: 0; border-radius: 12px; background: none;
  font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.3s;
}
.seg-btn svg { width: 16px; height: 16px; flex: none; }
.seg-btn[aria-selected='true'] { color: var(--primary); }
.seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface);
  transition: transform 0.25s var(--spring), background-color 0.3s, border-color 0.3s;
}
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-expanded='true'] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.theme-toggle svg { position: absolute; transition: transform 0.6s var(--spring), opacity 0.35s var(--ease); }
.theme-toggle .moon { opacity: 0; transform: rotate(-90deg) scale(0.4); }
:root[data-theme='dark'] .theme-toggle .sun { opacity: 0; transform: rotate(90deg) scale(0.4); }
:root[data-theme='dark'] .theme-toggle .moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { opacity: 0; transform: rotate(90deg) scale(0.4); }
  :root:not([data-theme]) .theme-toggle .moon { opacity: 1; transform: none; }
}

/* ---------- Settings panel ---------- */
.settings {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-rows: 1fr;
  padding: 0 clamp(12px, 4vw, 32px);
  transition: grid-template-rows 0.4s var(--ease), opacity 0.3s;
}
.settings[hidden] { display: grid; grid-template-rows: 0fr; opacity: 0; pointer-events: none; }
.settings-inner {
  overflow: hidden; min-height: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  max-width: 760px; margin: 0 auto; width: 100%;
}
.settings:not([hidden]) .settings-inner {
  margin-top: 8px; padding: 16px 20px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.settings-head {
  flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 15px;
}
.close-btn {
  display: grid; place-items: center; width: 32px; height: 32px; margin: -4px -6px -4px 0;
  border: none; border-radius: 10px; background: transparent; color: var(--muted);
  transition: color 0.2s, background-color 0.2s, transform 0.25s var(--spring);
}
.close-btn:hover { color: var(--text); background: var(--bg-soft); }
.close-btn:active { transform: scale(0.9); }
.close-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.close-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-track {
  width: 40px; height: 24px; border-radius: 99px; padding: 3px;
  background: var(--border); transition: background-color 0.3s var(--ease);
}
.switch-thumb {
  display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.35s var(--spring);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.range { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.range input { accent-color: var(--primary); width: 120px; }
.ghost-btn {
  margin-left: auto; padding: 8px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.ghost-btn:hover { color: #dc2626; border-color: #dc2626; background: rgb(220 38 38 / 0.06); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  margin: 8px clamp(12px, 3vw, 24px) 0;
  border-radius: 32px;
  min-height: 460px;
  display: grid; align-items: end;
  isolation: isolate;
}
.sky {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  transition: background 0.8s var(--ease);
}
.orb {
  position: absolute; top: 64px; right: 14%;
  width: 110px; height: 110px; border-radius: 50%;
  background: var(--orb);
  box-shadow: 0 0 80px 20px var(--orb-glow);
  animation: rise 2.4s var(--ease) both, float 8s ease-in-out 2.4s infinite;
  transition: box-shadow 0.8s var(--ease), top 1.2s var(--ease), right 1.2s var(--ease);
}
:root[data-waktu='petang'] .orb { top: 150px; right: 22%; animation-name: sink, float; }
@keyframes rise { from { transform: translateY(120px) scale(0.85); opacity: 0; } }
@keyframes sink { from { transform: translateY(-110px) scale(0.9); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-10px); } }
.stars {
  position: absolute; inset: 0; opacity: var(--stars-opacity); transition: opacity 1s var(--ease);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 20%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 70% 10%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 34%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 52%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 36% 58%, #fff 50%, transparent 51%);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { filter: brightness(0.5); } }
.hill { position: absolute; left: -10%; right: -10%; border-radius: 50% 50% 0 0; transition: background-color 0.8s var(--ease); }
.hill-back { bottom: -40%; height: 70%; background: var(--hill-back); transform: translateX(8%); }
.hill-front { bottom: -52%; height: 72%; background: var(--hill-front); transform: translateX(-12%); opacity: 0.9; }

.hero-content { position: relative; padding: clamp(24px, 5vw, 48px); max-width: 760px; margin: 0 auto; width: 100%; }
.hero-content > * { animation: fadeUp 0.9s var(--ease) both; }
.hero-content > :nth-child(2) { animation-delay: 0.08s; }
.hero-content > :nth-child(3) { animation-delay: 0.16s; }
.hero-content > :nth-child(4) { animation-delay: 0.24s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } }

.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); }
h1 { margin: 0; font-size: clamp(44px, 9vw, 76px); line-height: 1; letter-spacing: -0.035em; font-weight: 800; }
h1 em {
  font-style: normal;
  background: var(--title-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { max-width: 46ch; color: var(--muted); margin: 14px 0 26px; }

.hero-stats { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ring { --size: 96px; position: relative; width: var(--size); height: var(--size); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { stroke: color-mix(in srgb, var(--text) 10%, transparent); stroke-width: 8; }
.ring-fg {
  stroke: var(--primary); stroke-width: 8;
  stroke-dasharray: 327; stroke-dashoffset: calc(327 - 327 * var(--p));
  transition: stroke-dashoffset 0.8s var(--ease), stroke 0.3s;
}
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-size: 26px; font-weight: 800; }
.ring-label span { font-size: 12px; color: var(--muted); }

.cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 16px;
  background: var(--text); color: var(--bg);
  font-weight: 700; text-decoration: none;
  transition: transform 0.3s var(--spring), box-shadow 0.3s;
}
.cta:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--text) 60%, transparent); }
.cta svg { width: 18px; height: 18px; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(3px); } }

/* ---------- List & cards ---------- */
.list {
  max-width: 760px; margin: 0 auto; padding: 36px clamp(12px, 4vw, 24px) 24px; display: grid; gap: 20px;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.list.switching { opacity: 0; transform: translateY(12px); }

.skeleton {
  height: 260px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%) 0 0 / 200% 100%;
  border: 1px solid var(--border);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.card {
  position: relative;
  padding: clamp(20px, 4vw, 30px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(28px) scale(0.98);
  transition:
    opacity 0.7s var(--ease), transform 0.7s var(--ease),
    box-shadow 0.4s var(--ease), border-color 0.4s var(--ease), background-color 0.5s var(--ease);
}
.card.in { opacity: 1; transform: none; }
.card.in:hover { box-shadow: var(--shadow-lg); }
.card.active { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: var(--shadow-lg); }
.card.done { background: color-mix(in srgb, var(--primary-soft) 30%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.card.done::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 2px solid var(--primary); opacity: 0; animation: pulse 0.9s var(--ease);
}
@keyframes pulse { 30% { opacity: 1; } to { opacity: 0; transform: scale(1.03); } }

.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.num {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 11px; font-size: 14px; font-weight: 800;
  background: var(--primary-soft); color: var(--primary);
  transition: background-color 0.4s, color 0.4s;
}
.card.done .num { background: var(--primary); color: var(--surface); }
.title { flex: 1; min-width: 0; overflow-wrap: anywhere; margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.chip {
  flex: none; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}

.arab {
  margin: 0 0 18px;
  font-family: 'Amiri', 'Scheherazade New', serif;
  font-size: var(--arab-size);
  line-height: 2.1;
  text-align: right;
  color: var(--arab);
  white-space: pre-line;
  overflow-wrap: break-word;
  transition: font-size 0.3s var(--ease), color 0.5s;
}
.latin, .arti {
  margin: 0 0 12px; font-size: 15px; overflow-wrap: anywhere;
  display: grid; grid-template-rows: 1fr;
  transition: opacity 0.35s var(--ease), margin 0.35s var(--ease);
}
.latin { color: var(--primary); font-style: italic; font-weight: 500; }
.arti { color: var(--muted); }
.hide-latin .latin, .hide-arti .arti { opacity: 0; margin: 0; max-height: 0; overflow: hidden; }

.faedah {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 16px 0 0; padding: 14px 16px; border-radius: 16px;
  background: var(--accent-soft); color: var(--text);
  font-size: 14px;
}
.faedah svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); fill: currentColor; stroke: none; }
.faedah p { margin: 0; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--border); }
.riwayat { min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; color: var(--muted); font-weight: 500; }

/* Counter */
.counter {
  flex: none; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-weight: 700; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s var(--spring), background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.counter:not(:disabled):hover { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent); }
.counter:not(:disabled):active { transform: scale(0.94); }
.counter:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.counter-ring { position: relative; width: 40px; height: 40px; display: grid; place-items: center; }
.counter-ring svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.counter .ring-bg { stroke-width: 4; }
.counter .ring-fg { stroke-width: 4; stroke-dasharray: 125.7; stroke-dashoffset: calc(125.7 - 125.7 * var(--p, 0)); transition: stroke-dashoffset 0.45s var(--ease); }
.counter .check { width: 18px; height: 18px; color: var(--primary); stroke-width: 2.6; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 0.5s var(--ease) 0.15s; }
.counter:disabled { cursor: default; }
.card.done .counter { background: var(--primary); border-color: var(--primary); color: var(--surface); }
.card.done .counter .ring-bg { stroke: color-mix(in srgb, var(--surface) 30%, transparent); }
.card.done .counter .ring-fg { stroke: var(--surface); }
.card.done .counter .check { stroke-dashoffset: 0; color: var(--surface); }
.counter-text { font-variant-numeric: tabular-nums; }
.count { display: inline-block; }
.count.bump { animation: bump 0.35s var(--spring); }
@keyframes bump { 40% { transform: translateY(-4px) scale(1.25); } }

/* Ripple saat ketuk */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  transform: scale(0); animation: ripple 0.7s var(--ease) forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- Footer / toast ---------- */
.footer { max-width: 760px; margin: 0 auto; padding: 16px 24px calc(56px + env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 70;
  max-width: calc(100% - 32px);
  padding: 14px 20px; border-radius: 16px;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  box-shadow: 0 20px 40px -12px rgb(0 0 0 / 0.35);
  transform: translate(-50%, 140%); opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.error { padding: 24px; border-radius: var(--radius); border: 1px solid #fca5a5; background: rgb(254 226 226 / 0.4); color: #b91c1c; text-align: center; }

/* ---------- Transisi tema (View Transitions API) ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

@media (max-width: 560px) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 10px; }
  .brand-text { display: none; }
  .seg { margin: 0 auto; }
  .icon-btn { width: 40px; height: 40px; border-radius: 13px; }
  .hero { min-height: 500px; border-radius: 26px; margin-top: 4px; }
  /* Sisakan ruang di atas teks untuk matahari/bulan agar tidak menimpa tulisan */
  .hero-content { padding-top: 136px; }
  .orb { width: 80px; height: 80px; top: 36px; right: 12%; }
  :root[data-waktu='petang'] .orb { top: 52px; right: 20%; }
  .lede { font-size: 15px; }
  .settings-inner { gap: 14px 18px; }
  .settings:not([hidden]) .settings-inner { padding: 14px 16px; }
  .range { flex: 1 1 100%; }
  .range input { flex: 1; width: auto; }
  .ghost-btn { margin-left: 0; flex: 1 1 100%; }
  .card-foot { flex-direction: column-reverse; align-items: stretch; }
  .counter { justify-content: center; padding: 8px 16px; }
}

@media (max-width: 380px) {
  .topbar { gap: 6px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand-mark { width: 32px; height: 32px; }
  .seg-btn { padding: 7px 10px; font-size: 13px; }
  .seg-btn svg { display: none; }
  .icon-btn { width: 36px; height: 36px; border-radius: 12px; }
  .topbar-actions { gap: 6px; }
  .hero { margin-left: 8px; margin-right: 8px; min-height: 480px; }
  .hero-content { padding-top: 116px; }
  .orb, :root[data-waktu='petang'] .orb { width: 68px; height: 68px; top: 30px; }
  .ring { --size: 84px; }
  .cta { padding: 12px 18px; }
}

/* HP miring: hero tidak perlu setinggi layar */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: 340px; }
  .hero-content { padding-top: clamp(24px, 5vw, 48px); }
  .orb, :root[data-waktu='petang'] .orb { width: 64px; height: 64px; top: 28px; right: 8%; }
  h1 { font-size: 44px; }
}

@media (min-width: 1100px) {
  .list, .settings-inner, .footer { max-width: 820px; }
  .hero-content { max-width: 820px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .card { opacity: 1; transform: none; }
}
