:root {
  color-scheme: dark;
  --ink: #f8f4ff;
  --muted: #b9adc9;
  --panel: rgba(38, 21, 66, 0.92);
  --panel-2: rgba(28, 15, 50, 0.96);
  --purple: #21123d;
  --deep: #120922;
  --gold: #ffd84d;
  --gold-dark: #6f4510;
  --aqua: #5de4d1;
  --pink: #ff5c9f;
  --danger: #ff718e;
  --line: rgba(255, 255, 255, 0.13);
  --shadow: 0 18px 55px rgba(4, 0, 14, 0.42);
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  scroll-padding-bottom: calc(120px + env(safe-area-inset-bottom));
  background: var(--deep);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(149, 77, 202, 0.3), transparent 27rem),
    radial-gradient(circle at 95% 24%, rgba(31, 183, 173, 0.18), transparent 24rem),
    var(--deep);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.17;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 1px, transparent 1.5px);
  background-size: 13px 13px;
  mask-image: linear-gradient(to bottom, #000, transparent 65%);
}

button, input { font: inherit; }
button { color: inherit; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--aqua);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  color: #120922;
  background: var(--gold);
  border-radius: 10px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding:
    calc(10px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    10px
    calc(18px + env(safe-area-inset-left));
  background: rgba(18, 9, 34, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--purple);
  font-size: 24px;
  background: var(--gold);
  border-radius: 13px 5px 13px 5px;
  box-shadow: 4px 4px 0 var(--pink);
  transform: rotate(-3deg);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: 0.15em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.ticket-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 64px;
  padding: 8px 12px;
  color: var(--gold);
  background: rgba(255, 216, 77, 0.11);
  border: 1px solid rgba(255, 216, 77, 0.35);
  border-radius: 999px;
}
.ticket-pill strong { font-size: 20px; }

main {
  padding:
    18px
    calc(14px + env(safe-area-inset-right))
    30px
    calc(14px + env(safe-area-inset-left));
}

.warning-banner, .info-banner {
  margin: 12px 14px 0;
  padding: 13px 15px;
  color: #fff8d8;
  line-height: 1.55;
  background: rgba(151, 98, 10, 0.55);
  border: 1px solid rgba(255, 216, 77, 0.45);
  border-radius: 14px;
}
.info-banner { margin: 12px 0; background: rgba(24, 122, 116, 0.35); border-color: rgba(93, 228, 209, 0.45); }

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

h1, h2, p { margin-top: 0; }
h1, h2 { line-height: 1.2; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 8vw, 42px); letter-spacing: 0.02em; }
h2 { margin-bottom: 6px; font-size: 21px; }

.home-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 14px;
}
.home-intro h2 { margin: 0; font-size: 22px; }
.deadline { display: grid; gap: 3px; text-align: right; }
.deadline strong { color: var(--gold); font-size: 13px; }
.deadline small { color: var(--muted); }

.boss-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  min-height: 230px;
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(50, 24, 83, 0.98), rgba(23, 12, 42, 0.98)),
    var(--panel);
  border: 1px solid rgba(255, 216, 77, 0.38);
  border-radius: 26px 10px 26px 10px;
  box-shadow: var(--shadow), inset 0 0 40px rgba(255, 92, 159, 0.08);
}
.boss-card::before {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  right: -150px;
  top: -160px;
  background: repeating-conic-gradient(from 10deg, rgba(255, 216, 77, 0.19) 0 7deg, transparent 7deg 16deg);
  border-radius: 50%;
}
.boss-art {
  align-self: center;
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 0.84;
  background: linear-gradient(145deg, var(--pink), #7f42bc 62%, #381655);
  border: 3px solid var(--gold);
  border-radius: 58% 42% 48% 52% / 35% 46% 54% 65%;
  box-shadow: 0 0 0 7px rgba(255, 216, 77, 0.08), 10px 12px 0 rgba(0, 0, 0, 0.22);
  transform: rotate(-4deg);
}
.boss-art span { font-size: 55px; font-weight: 1000; text-shadow: 3px 3px 0 #381655; }
.boss-copy { position: relative; align-self: center; min-width: 0; }
.boss-copy h1 { overflow-wrap: anywhere; }
.place { margin-bottom: 18px; color: var(--aqua); font-size: 13px; }
.hp-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; letter-spacing: 0.08em; }
.hp-label strong { color: var(--gold); }

.meter, .overall-meter {
  height: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}
.meter i, .overall-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--aqua), #32b9ca);
  border-radius: inherit;
  transition: width 300ms ease;
}
.enemy-meter { height: 14px; border: 1px solid rgba(255, 255, 255, 0.1); }
.enemy-meter i { background: linear-gradient(90deg, var(--pink), var(--gold)); }

.victory-card { display: block; text-align: center; padding: 30px 20px; }
.victory-star { color: var(--gold); font-size: 70px; filter: drop-shadow(6px 6px 0 var(--pink)); }
.victory-card p:last-child { margin: 0 auto; max-width: 480px; color: var(--muted); line-height: 1.6; }

.quest-status, .progress-section, .history-section, .settings-card {
  margin-top: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(4, 0, 14, 0.22);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.section-heading h2 { margin: 0; }
.reward-rule { max-width: 130px; color: var(--aqua); font-size: 11px; font-weight: 800; text-align: right; }

.sibling-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sibling-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr 14px;
  align-items: center;
  gap: 10px;
  min-height: 104px;
  padding: 13px 11px;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.sibling-card.gold.is-complete { border-color: rgba(255, 216, 77, 0.7); box-shadow: inset 0 0 24px rgba(255, 216, 77, 0.08); }
.sibling-card.aqua.is-complete { border-color: rgba(93, 228, 209, 0.7); box-shadow: inset 0 0 24px rgba(93, 228, 209, 0.08); }
.avatar, .settings-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 24px;
  color: var(--purple);
  background: var(--gold);
  border-radius: 50%;
}
.aqua .avatar, .child-settings.aqua .settings-avatar { background: var(--aqua); }
.sibling-copy { min-width: 0; }
.sibling-copy small, .sibling-copy strong, .sibling-copy em { display: block; }
.sibling-copy small { color: var(--muted); font-size: 10px; }
.sibling-copy strong { margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sibling-copy em { color: var(--gold); font-size: 11px; font-style: normal; }
.aqua .sibling-copy em { color: var(--aqua); }
.chevron { font-size: 28px; color: var(--muted); }
.mini-progress { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,.08); border-radius: 4px; }
.mini-progress i { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.aqua .mini-progress i { background: var(--aqua); }

.combo-ready, .combo-wait {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 13px;
  background: rgba(93, 228, 209, 0.1);
  border: 1px solid rgba(93, 228, 209, 0.3);
  border-radius: 14px;
}
.combo-wait { background: rgba(255, 255, 255, 0.035); border-color: var(--line); }
.combo-stars { min-width: 46px; color: var(--gold); font-size: 20px; }
.combo-ready strong, .combo-ready small, .combo-wait strong, .combo-wait small { display: block; }
.combo-ready small, .combo-wait small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.primary-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  min-height: 74px;
  margin-top: 16px;
  padding: 14px 18px;
  color: var(--purple);
  background: linear-gradient(100deg, var(--gold), #ffec8c);
  border: 0;
  border-radius: 16px 7px 16px 7px;
  box-shadow: 0 8px 0 #7a4b17, 0 16px 35px rgba(255, 216, 77, 0.18);
}
.primary-action span { font-size: 18px; font-weight: 1000; }
.primary-action small { margin-top: 3px; font-size: 11px; font-weight: 700; }
.primary-action:active { transform: translateY(5px); box-shadow: 0 3px 0 #7a4b17; }
.attack-action { background: linear-gradient(105deg, var(--pink), var(--gold)); animation: pulse-shadow 1.8s infinite; }

.privacy-note {
  display: flex;
  gap: 11px;
  margin-top: 22px;
  padding: 13px 5px;
  color: var(--muted);
}
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { color: var(--ink); font-size: 12px; }
.privacy-note small { margin-top: 3px; font-size: 10px; line-height: 1.45; }
.fan-note { margin: 12px 0 0; color: #766b85; font-size: 9px; text-align: center; letter-spacing: .12em; }

.bottom-nav {
  position: fixed;
  z-index: 30;
  bottom: 0;
  left: 50%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 760px);
  padding:
    7px
    calc(8px + env(safe-area-inset-right))
    calc(7px + env(safe-area-inset-bottom))
    calc(8px + env(safe-area-inset-left));
  background: rgba(18, 9, 34, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 54px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 13px;
}
.bottom-nav button span { font-size: 21px; }
.bottom-nav button small { font-size: 10px; }
.bottom-nav button[aria-current="page"] { color: var(--gold); background: rgba(255, 216, 77, 0.09); }

.page-head { padding: 8px 4px 12px; }
.page-head h1 { margin-bottom: 7px; }
.page-head > p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.child-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.child-switch button {
  min-height: 48px;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.child-switch button.active.gold { color: var(--purple); font-weight: 900; background: var(--gold); }
.child-switch button.active.aqua { color: var(--purple); font-weight: 900; background: var(--aqua); }

.daily-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(110deg, rgba(255,216,77,.2), rgba(255,255,255,.025));
  border-left: 5px solid var(--gold);
  border-radius: 16px;
}
.daily-summary.aqua { background: linear-gradient(110deg, rgba(93,228,209,.2), rgba(255,255,255,.025)); border-color: var(--aqua); }
.daily-summary small, .daily-summary strong { display: block; }
.daily-summary > div small { margin-bottom: 5px; color: var(--muted); }
.daily-summary > div strong { font-size: 19px; }
.daily-summary > span { text-align: center; }
.daily-summary > span b { display: block; color: var(--gold); font-size: 28px; }
.daily-summary.aqua > span b { color: var(--aqua); }
.daily-summary > span small { color: var(--muted); font-size: 9px; }

.task-list { display: grid; gap: 12px; margin-top: 14px; }
.task-card {
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: border-color .2s, transform .2s;
}
.task-card.checked { border-color: rgba(93, 228, 209, .55); box-shadow: inset 0 0 28px rgba(93,228,209,.05); }
.task-card.task-complete { background: rgba(28, 65, 58, .55); }
.task-top { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; }
.check-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  color: var(--purple);
  font-size: 25px;
  font-weight: 1000;
  background: transparent;
  border: 3px solid var(--gold);
  border-radius: 50%;
}
.check-button[aria-pressed="true"] { background: var(--aqua); border-color: var(--aqua); animation: pop .26s ease; }
.check-button:disabled { opacity: .45; }
.task-title { min-width: 0; }
.task-title h2 { margin: 0 0 6px; font-size: 17px; overflow-wrap: anywhere; }
.task-title p { display: flex; justify-content: space-between; gap: 8px; margin: 0; font-size: 11px; }
.task-title p strong { color: var(--gold); }
.task-title p span { color: var(--muted); }
.task-card > .meter { margin: 13px 0 11px 60px; height: 5px; }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-left: 60px; color: var(--muted); font-size: 11px; }
.stepper { display: grid; grid-template-columns: 42px 64px 42px; min-height: 44px; }
.stepper button, .stepper input {
  min-width: 0;
  color: var(--ink);
  text-align: center;
  background: rgba(255,255,255,.075);
  border: 1px solid var(--line);
}
.stepper button:first-child { border-radius: 11px 0 0 11px; }
.stepper button:last-child { border-radius: 0 11px 11px 0; }
.stepper input {
  border-left: 0;
  border-right: 0;
  appearance: textfield;
  font-size: 16px;
  scroll-margin-bottom: 120px;
}
.stepper input::-webkit-inner-spin-button { display: none; }

.completion-card {
  display: grid;
  gap: 13px;
  margin-top: 16px;
  padding: 17px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.completion-card.is-complete { border-color: rgba(93,228,209,.5); }
.completion-card strong, .completion-card small { display: block; }
.completion-card small { margin-top: 4px; color: var(--muted); line-height: 1.45; }

.primary-button, .secondary-button, .danger-button, .add-button {
  min-height: 48px;
  padding: 11px 16px;
  font-weight: 900;
  border-radius: 12px;
}
.primary-button { color: var(--purple); background: var(--gold); border: 0; }
.secondary-button { color: var(--ink); background: rgba(255,255,255,.075); border: 1px solid var(--line); }
.danger-button { color: #ffd8e1; background: rgba(149, 25, 62, .3); border: 1px solid rgba(255,113,142,.45); }
.add-button { width: 100%; color: var(--aqua); background: rgba(93,228,209,.08); border: 1px dashed rgba(93,228,209,.5); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats-grid > div { padding: 15px 8px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; }
.stats-grid strong, .stats-grid small { display: block; }
.stats-grid strong { color: var(--gold); font-size: 28px; }
.stats-grid small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.progress-section > .section-heading > strong { color: var(--gold); font-size: 26px; }
.progress-section.aqua > .section-heading > strong { color: var(--aqua); }
.overall-meter { height: 12px; }
.progress-section.gold .overall-meter i { background: linear-gradient(90deg, #bd781d, var(--gold)); }
.overall-copy { margin: 8px 0 15px; color: var(--muted); font-size: 10px; text-align: right; }
.progress-list { display: grid; gap: 12px; }
.progress-row { display: grid; grid-template-columns: 1fr 95px; align-items: center; gap: 10px; }
.progress-row strong, .progress-row small { display: block; }
.progress-row strong { font-size: 13px; }
.progress-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.progress-row .meter { height: 6px; }

.history-list { display: grid; gap: 8px; }
.history-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border: 0; }
.history-row time { font-size: 11px; font-weight: 800; }
.history-row div { display: flex; flex-wrap: wrap; gap: 4px; }
.history-row span { padding: 3px 6px; font-size: 9px; background: rgba(255,255,255,.06); border-radius: 8px; }
.history-row span.gold { color: var(--gold); }
.history-row span.aqua { color: var(--aqua); }
.history-row > strong { color: var(--gold); font-size: 10px; }
.empty-state { padding: 25px 12px; color: var(--muted); text-align: center; line-height: 1.6; }

.settings-card h2 { margin-bottom: 16px; }
.settings-card label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.settings-card input[type="text"], .settings-card input[type="number"], .settings-card input[type="date"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  scroll-margin-bottom: 120px;
}
.settings-card fieldset { margin: 19px 0 0; padding: 0; border: 0; }
.settings-card legend { margin-bottom: 9px; font-size: 12px; font-weight: 900; }
.weekday-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.weekday-grid label { display: block; }
.weekday-grid input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-grid span { display: grid; place-items: center; min-height: 44px; color: var(--muted); background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 10px; }
.weekday-grid input:checked + span { color: var(--purple); font-weight: 900; background: var(--gold); border-color: var(--gold); }
.weekday-grid input:focus-visible + span { outline: 3px solid var(--aqua); outline-offset: 2px; }
.toggle-list { display: grid; gap: 7px; }
.toggle-row { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { color: var(--ink); font-size: 13px; }
.toggle-row small { margin-top: 3px; font-size: 9px; }
.toggle-row input { width: 48px; height: 28px; accent-color: var(--aqua); }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.child-settings.gold { border-top: 3px solid var(--gold); }
.child-settings.aqua { border-top: 3px solid var(--aqua); }
.settings-avatar { width: 42px; height: 42px; }
.settings-card details { margin-top: 16px; }
.settings-card summary { min-height: 46px; padding: 13px; color: var(--gold); font-weight: 900; cursor: pointer; background: rgba(255,255,255,.045); border-radius: 11px; }
.task-settings-list { display: grid; gap: 10px; margin: 11px 0; }
.task-setting-row { padding: 12px; background: rgba(0,0,0,.17); border: 1px solid var(--line); border-radius: 12px; }
.task-setting-row .two-fields { margin-top: 8px; }
.task-setting-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.task-setting-foot small { color: var(--muted); }
.task-setting-foot button { min-height: 44px; padding: 7px 12px; color: var(--danger); background: transparent; border: 1px solid rgba(255,113,142,.3); border-radius: 9px; }
.data-card p { color: var(--muted); line-height: 1.65; }
.button-stack { display: grid; gap: 9px; margin: 16px 0; }
.data-card > small { color: #887d98; }

#toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 13px 16px;
  color: var(--ink);
  background: #34204e;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
  transition: .22s ease;
}
#toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
#toast span { line-height: 1.4; }
#toast button { min-height: 44px; flex: 0 0 auto; color: var(--gold); background: transparent; border: 0; font-weight: 900; }

#screen-flash { position: fixed; z-index: 60; inset: 0; pointer-events: none; opacity: 0; }
#screen-flash.active { animation: flash .52s ease-out; }
#screen-flash.combo { background: radial-gradient(circle, rgba(255,216,77,.85), rgba(93,228,209,.3) 38%, transparent 70%); }
#screen-flash.boss { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,216,77,.7) 0 5deg, transparent 5deg 12deg); }
#confetti { position: fixed; z-index: 70; inset: 0; overflow: hidden; pointer-events: none; }
#confetti i { position: absolute; top: -25px; left: var(--x); width: 10px; height: 19px; background: var(--gold); transform: rotate(var(--r)); }
#confetti i:nth-child(3n) { background: var(--aqua); }
#confetti i:nth-child(3n+1) { background: var(--pink); }
#confetti.active i { animation: confetti 1.35s cubic-bezier(.18,.75,.35,1) var(--d) forwards; }

@keyframes pop { 50% { transform: scale(1.22) rotate(-7deg); } }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: .9; } 100% { opacity: 0; } }
@keyframes confetti { to { transform: translate3d(35px, 105vh, 0) rotate(680deg); } }
@keyframes pulse-shadow { 50% { box-shadow: 0 8px 0 #7a4b17, 0 18px 48px rgba(255,92,159,.35); } }

@media (max-width: 430px) {
  .boss-card { grid-template-columns: 88px 1fr; min-height: 205px; padding: 16px; }
  .boss-art { width: 86px; }
  .boss-art span { font-size: 43px; }
  .boss-copy h1 { font-size: 25px; }
  .sibling-grid { grid-template-columns: 1fr; }
  .sibling-card { min-height: 82px; grid-template-columns: 44px 1fr 12px; }
  .mini-progress { grid-column: 2 / -1; }
  .task-foot { margin-left: 0; margin-top: 12px; }
  .task-card > .meter { margin-left: 60px; }
  .progress-row { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 80px 1fr; }
  .history-row > strong { grid-column: 2; }
  .weekday-grid { grid-template-columns: repeat(4, 1fr); }
  .two-fields { grid-template-columns: 1fr; }
}

@media (min-width: 431px) and (max-width: 520px) {
  .sibling-grid { grid-template-columns: 1fr; }
  .sibling-card {
    min-height: 86px;
    grid-template-columns: 44px 1fr 12px;
  }
  .mini-progress { grid-column: 2 / -1; }
}
@media (min-width: 700px) {
  main {
    padding:
      24px
      calc(24px + env(safe-area-inset-right))
      40px
      calc(24px + env(safe-area-inset-left));
  }

  .boss-card {
    min-height: 240px;
    grid-template-columns: 132px 1fr;
    padding: 24px;
  }

  .boss-art { width: 128px; }
  .settings-card, .quest-status, .progress-section, .history-section { padding: 22px; }
  .topbar { min-height: 82px; }
  .brand strong { font-size: 14px; }
  .brand small, .deadline small { font-size: 12px; }
  .ticket-pill { min-width: 74px; min-height: 48px; justify-content: center; }
  .home-intro h2 { font-size: 26px; }
  .deadline strong { font-size: 14px; }
  .eyebrow { font-size: 12px; }
  .place, .hp-label { font-size: 14px; }
  .sibling-card { min-height: 112px; padding: 16px 14px; }
  .sibling-copy small, .sibling-copy em { font-size: 12px; }
  .combo-ready small, .combo-wait small, .reward-rule { font-size: 12px; }
  .privacy-note strong { font-size: 14px; }
  .privacy-note small, .primary-action small { font-size: 12px; }
  .bottom-nav button { min-height: 60px; }
  .bottom-nav button small { font-size: 12px; }
  .child-switch button { min-height: 56px; }
  .daily-summary > div strong { font-size: 22px; }
  .daily-summary > span small { font-size: 11px; }
  .task-card { padding: 18px; }
  .task-title h2 { font-size: 19px; }
  .task-title p, .task-foot { font-size: 13px; }
  .stepper { grid-template-columns: 48px 76px 48px; min-height: 48px; }
  .completion-card { padding: 20px; }
  .primary-button, .secondary-button, .danger-button, .add-button { min-height: 52px; }
  .stats-grid small, .progress-row small, .overall-copy, .history-row > strong { font-size: 11px; }
  .progress-row strong, .toggle-row strong { font-size: 14px; }
  .history-row time { font-size: 13px; }
  .history-row span { padding: 5px 8px; font-size: 11px; }
  .settings-card label, .settings-card legend { font-size: 13px; }
  .settings-card input[type="text"],
  .settings-card input[type="number"],
  .settings-card input[type="date"] { min-height: 52px; }
  .weekday-grid span { min-height: 50px; }
  .toggle-row { min-height: 64px; }
  .toggle-row small { font-size: 11px; }
  .settings-card summary { min-height: 52px; }
}

@media (min-width: 700px) and (max-width: 899px) {
  .app-shell { width: min(100%, 820px); }
  .task-foot { gap: 16px; }
}

@media (min-width: 900px) and (max-width: 1180px) and (max-height: 820px) and (orientation: landscape) {
  .app-shell {
    width: min(100%, 1180px);
    padding-left: 88px;
    padding-bottom: 24px;
  }

  .topbar {
    min-height: 64px;
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
    border-left: 1px solid var(--line);
  }

  .bottom-nav {
    top: 0;
    bottom: 0;
    left: max(0px, calc((100vw - 1180px) / 2));
    align-content: center;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, 72px);
    width: 88px;
    padding:
      calc(64px + env(safe-area-inset-top))
      8px
      calc(16px + env(safe-area-inset-bottom))
      calc(8px + env(safe-area-inset-left));
    border-top: 0;
    border-right: 1px solid var(--line);
    transform: none;
  }

  .bottom-nav button {
    align-content: center;
    min-height: 64px;
  }

  .bottom-nav button span { font-size: 24px; }

  main {
    padding:
      14px
      calc(24px + env(safe-area-inset-right))
      24px
      24px;
  }

  main.view-home {
    display: grid;
    grid-template-columns: minmax(0, 0.98fr) minmax(380px, 1.02fr);
    gap: 14px 18px;
    align-items: stretch;
  }

  .view-home .home-intro {
    grid-column: 1 / -1;
    margin: 0;
  }

  .view-home .boss-card {
    grid-column: 1;
    grid-row: 2 / span 2;
    grid-template-columns: 100px 1fr;
    min-height: 100%;
    padding: 20px;
  }

  .view-home .boss-art { width: 96px; }
  .view-home .quest-status { grid-column: 2; grid-row: 2; margin-top: 0; }
  .view-home .primary-action { grid-column: 2; grid-row: 3; margin-top: 0; }
  .view-home .privacy-note { grid-column: 1 / -1; margin-top: 0; }
  .view-home .fan-note { grid-column: 1 / -1; margin-top: -6px; }

  .view-today .task-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
  }

  .view-today .task-card { height: 100%; }
  .view-today .task-foot {
    flex-wrap: wrap;
    margin-left: 0;
    margin-top: 12px;
  }
  .view-today .stepper { margin-left: auto; }

  main.view-progress,
  main.view-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
  }

  .view-progress > .page-head,
  .view-progress > .stats-grid,
  .view-progress > .history-section,
  .view-settings > .page-head,
  .view-settings > .settings-card:not(.child-settings):not(.data-card),
  .view-settings > .data-card,
  .view-settings > .fan-note {
    grid-column: 1 / -1;
  }

  .view-progress > .progress-section,
  .view-settings > .settings-card {
    margin-top: 0;
  }

  #toast {
    left: calc(50% + 44px);
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 899px) {
  .app-shell:has(input:focus) .bottom-nav {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 110%);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (forced-colors: active) {
  .meter i, .overall-meter i { background: Highlight; }
  .check-button { forced-color-adjust: none; }
}

