:root {
  --bg: #fff7df;
  --bg-2: #e8f7ff;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --ink: #292735;
  --muted: #746f83;
  --line: rgba(79, 67, 105, 0.16);
  --accent: #ff6d98;
  --accent-2: #42c7bd;
  --accent-3: #ffd15c;
  --reward: #20ad78;
  --penalty: #f2546a;
  --warning: #ffb84d;
  --shadow: 0 18px 55px rgba(107, 83, 42, 0.15);
  --glow: 0 0 32px color-mix(in srgb, var(--accent) 30%, transparent);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    sans-serif;
  background:
    radial-gradient(circle at 12% 8%, color-mix(in srgb, var(--accent-3) 42%, transparent), transparent 28%),
    radial-gradient(circle at 88% 14%, color-mix(in srgb, var(--accent-2) 34%, transparent), transparent 27%),
    radial-gradient(circle at 50% 100%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: -20%;
  z-index: -1;
  content: "";
  background:
    linear-gradient(115deg, transparent 0 42%, color-mix(in srgb, var(--accent) 10%, transparent) 45% 48%, transparent 52%),
    linear-gradient(35deg, transparent 0 38%, color-mix(in srgb, var(--accent-2) 12%, transparent) 42% 46%, transparent 50%);
  animation: auroraFlow 14s ease-in-out infinite alternate;
  filter: blur(2px);
}

.start-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.start-card {
  width: min(560px, 100%);
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.start-logo {
  width: 78px;
  height: 78px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--glow);
}

.start-card h1 {
  margin-top: 10px;
}

.start-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.start-actions,
.recover-form {
  display: grid;
  gap: 12px;
}

.recover-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.family-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.family-banner strong,
.family-banner span {
  display: block;
}

.family-banner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.family-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 36px rgba(64, 55, 82, 0.1);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 210px;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--glow);
  animation: logoFloat 4.5s ease-in-out infinite;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.top-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.view-toggle,
.mini-toggle {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.toggle-button,
.mini-toggle-button {
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 1000;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.toggle-button.active,
.mini-toggle-button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 55%, var(--accent)));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 26%, transparent);
}

.select-wrap {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(120px, 180px);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.select-wrap select {
  min-height: 42px;
  width: 100%;
  padding: 0 48px 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 24px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    rgba(255, 255, 255, 0.86);
  appearance: none;
  -webkit-appearance: none;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 280px);
  align-items: center;
  min-height: 220px;
  margin-bottom: 16px;
  padding: 26px clamp(20px, 4vw, 44px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.56)),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 15%, transparent), color-mix(in srgb, var(--accent-2) 15%, transparent));
  box-shadow: var(--shadow);
}

.hero-panel::before {
  position: absolute;
  inset: auto 12% -90px auto;
  width: 260px;
  height: 260px;
  content: "";
  border: 28px solid color-mix(in srgb, var(--accent-3) 58%, transparent);
  border-radius: 50%;
  animation: slowSpin 18s linear infinite;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker,
.mini-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  margin-top: 8px;
  font-size: clamp(2.1rem, 4vw, 4.45rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.08rem;
}

.hero-note {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
}

.hero-orbit {
  position: absolute;
  top: 22px;
  right: 260px;
  width: 150px;
  height: 150px;
  pointer-events: none;
}

.hero-orbit span {
  position: absolute;
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 24px var(--accent-3);
  animation: orbitDot 4s ease-in-out infinite;
}

.hero-orbit span:nth-child(1) {
  top: 16px;
  left: 24px;
}

.hero-orbit span:nth-child(2) {
  top: 68px;
  right: 10px;
  background: var(--accent-2);
  animation-delay: 0.45s;
}

.hero-orbit span:nth-child(3) {
  left: 62px;
  bottom: 10px;
  background: var(--accent);
  animation-delay: 0.9s;
}

.mascot {
  position: relative;
  z-index: 1;
  width: min(100%, 260px);
  justify-self: end;
  filter: drop-shadow(0 18px 22px rgba(76, 57, 83, 0.2));
  animation: mascotBob 5s ease-in-out infinite;
}

.panel,
.meter-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 18px;
}

.kid-switcher {
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  align-items: center;
  margin-bottom: 12px;
}

.kid-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.kid-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 70px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.kid-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent), var(--glow);
}

.kid-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 1000;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.kid-card-copy {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.kid-card-copy strong,
.kid-card-copy span {
  display: block;
}

.kid-card-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kid-card-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(360px, 1fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.control-column,
.activity-column,
.timer-column {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.field input:focus,
.select-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.theme-box {
  margin-top: 16px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 9px;
}

.theme-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.theme-choice.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.theme-swatch {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.segment {
  min-height: 38px;
  color: var(--muted);
  font-weight: 1000;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.segment.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 20px color-mix(in srgb, var(--accent) 30%, transparent);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.tiny-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 1000;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease,
    filter 0.16s ease;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover,
.tiny-button:hover,
.text-button:hover,
.kid-card:hover,
.theme-choice:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 55%, var(--accent)));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 28%, transparent);
}

.secondary-button,
.danger-button {
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.danger-button {
  color: var(--penalty);
  border-color: color-mix(in srgb, var(--penalty) 30%, transparent);
}

.icon-button {
  display: grid;
  width: 42px;
  min-width: 42px;
  place-items: center;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.text-button {
  min-height: 32px;
  padding: 0 8px;
  color: var(--accent);
  border: 0;
  background: transparent;
}

.meter-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 3vw, 28px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.58)),
    linear-gradient(140deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent-2) 16%, transparent));
}

.meter-panel::before {
  position: absolute;
  inset: -80px auto auto -80px;
  width: 190px;
  height: 190px;
  content: "";
  border: 24px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 50%;
  animation: slowSpin 16s linear infinite reverse;
}

.meter-top {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.balance-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  font-size: clamp(2.45rem, 5vw, 4rem);
  font-weight: 1000;
  line-height: 1;
}

.balance-line small {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 1000;
}

.status-stack {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-pill,
.pending-chip {
  min-width: 94px;
  padding: 8px 12px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 1000;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, white);
}

.pending-chip {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  background: color-mix(in srgb, var(--warning) 11%, white);
}

.timer-face {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 318px;
  padding: 18px 0;
}

.timer-ring {
  --progress: 0deg;
  position: relative;
  display: grid;
  width: min(320px, 82vw);
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: var(--surface-solid);
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.66),
    0 22px 44px rgba(68, 48, 79, 0.13),
    var(--glow);
  animation: pulseRing 3.4s ease-in-out infinite;
}

.timer-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.timer-ring-track,
.timer-ring-progress {
  fill: none;
  stroke-linecap: round;
  stroke-width: 10;
}

.timer-ring-track {
  opacity: 0.28;
  stroke: var(--accent-2);
}

.timer-ring-progress {
  stroke: var(--accent);
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.4s ease;
  filter: drop-shadow(0 0 8px rgba(255, 109, 152, 0.32));
}

.timer-ring span {
  position: relative;
  z-index: 1;
  display: block;
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 1000;
  line-height: 1;
}

.timer-ring small {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 1000;
}

.redeem-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.redeem-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-tools {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.stats-total {
  display: flex;
  gap: 8px;
  font-weight: 1000;
}

.stats-total span {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

#rewardTotal {
  color: var(--reward);
}

#penaltyTotal {
  color: var(--penalty);
}

#statsChart {
  display: block;
  width: 100%;
  height: 260px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 1000;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.reward-dot {
  background: var(--reward);
}

.penalty-dot {
  background: var(--penalty);
}

.stats-list {
  display: grid;
  gap: 10px;
}

.stats-row {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) minmax(120px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.stat-bars {
  display: grid;
  gap: 6px;
}

.stat-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.stat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.stat-bar.reward span {
  background: var(--reward);
}

.stat-bar.penalty span {
  background: var(--penalty);
}

.rule-list,
.approval-list,
.history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.rule-item,
.approval-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.kid-check {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
}

.kid-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.kid-check span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid color-mix(in srgb, var(--accent-2) 45%, white);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.72);
}

.kid-check span::after {
  content: "✓";
  color: #fff;
  font-size: 0.95rem;
  font-weight: 1000;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.kid-check input:checked + span {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.kid-check input:checked + span::after {
  opacity: 1;
  transform: scale(1);
}

body[data-view="parent"] .kid-check {
  display: none;
}

.rule-title,
.approval-title {
  display: block;
  font-size: 0.96rem;
}

.rule-minutes,
.approval-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.rule-actions,
.approval-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.tiny-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-solid);
}

.apply-rule,
.approve-request {
  color: #fff;
  border: 0;
  background: var(--accent-2);
}

.reject-request {
  color: var(--penalty);
}

.delete-rule {
  width: 34px;
  padding: 0;
  color: var(--muted);
}

.history-list {
  max-height: 360px;
  overflow: auto;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.history-type {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  font-weight: 1000;
}

.history-type.reward {
  background: var(--reward);
}

.history-type.penalty {
  background: var(--penalty);
}

.history-type.pending {
  background: var(--warning);
}

.history-type.redeem,
.history-type.system {
  background: var(--accent);
}

.history-main {
  min-width: 0;
}

.history-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-main span,
.history-time {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

.hidden {
  display: none !important;
}

body[data-view="kid"] .parent-only {
  display: none !important;
}

body[data-view="kid"] .workspace {
  grid-template-columns: minmax(340px, 1.12fr) minmax(300px, 0.88fr);
}

body[data-view="kid"] .timer-column {
  order: 1;
}

body[data-view="kid"] .activity-column {
  order: 2;
}

body[data-view="kid"] .rule-item {
  grid-template-columns: auto minmax(0, 1fr);
}

body[data-view="kid"] .rule-actions {
  display: none;
}

body[data-view="kid"] .apply-rule {
  display: none;
}

body[data-view="kid"] .kid-check {
  display: grid;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #fff;
  font-weight: 1000;
  border-radius: 8px;
  background: #292735;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

body[data-theme="fresh"] {
  --bg: #eefdf8;
  --bg-2: #e9f3ff;
  --accent: #2eb4a6;
  --accent-2: #6a95ff;
  --accent-3: #fee27a;
  --shadow: 0 18px 45px rgba(42, 93, 104, 0.12);
}

body[data-theme="star"] {
  --bg: #f1efff;
  --bg-2: #e9fbff;
  --accent: #7c6df2;
  --accent-2: #24b8d4;
  --accent-3: #ffcb6d;
  --shadow: 0 18px 45px rgba(62, 47, 121, 0.13);
}

body[data-theme="forest"] {
  --bg: #f3fae8;
  --bg-2: #eff8f6;
  --accent: #6cbf58;
  --accent-2: #29a3a3;
  --accent-3: #ffd36b;
  --shadow: 0 18px 45px rgba(57, 104, 42, 0.13);
}

@keyframes auroraFlow {
  from {
    transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1);
  }
  to {
    transform: translate3d(2%, 1%, 0) rotate(4deg) scale(1.05);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-4px) rotate(2deg);
  }
}

@keyframes mascotBob {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(1.4deg);
  }
}

@keyframes orbitDot {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.75;
  }
  50% {
    transform: translateY(-12px) scale(1.18);
    opacity: 1;
  }
}

@keyframes pulseRing {
  0%,
  100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.16);
  }
}

@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .workspace,
  body[data-view="kid"] .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .timer-column {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 10px;
  }

  .app-header,
  .top-controls,
  .hero-panel,
  .workspace,
  body[data-view="kid"] .workspace,
  .family-banner,
  .recover-form,
  .redeem-box {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
  }

  .brand {
    min-width: 0;
  }

  .top-controls {
    display: grid;
    width: 100%;
  }

  .view-toggle,
  .mini-toggle {
    width: 100%;
  }

  .select-wrap {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
    padding: 22px;
  }

  .hero-orbit {
    right: 20px;
    opacity: 0.5;
  }

  .mascot {
    width: min(220px, 72vw);
    justify-self: center;
  }

  .kid-tabs {
    grid-template-columns: 1fr;
  }

  .timer-column {
    grid-column: auto;
    grid-row: auto;
  }

  .timer-face {
    min-height: 260px;
  }

  .redeem-actions,
  .profile-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .field-grid,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .stats-tools,
  .status-stack {
    justify-items: start;
  }

  .section-head {
    flex-wrap: wrap;
  }

  .family-banner,
  .family-actions {
    display: grid;
    justify-content: stretch;
  }
}

@media (max-width: 480px) {
  .app-shell {
    width: calc(100% - 14px);
  }

  .panel,
  .meter-panel {
    padding: 14px;
  }

  .rule-item,
  .approval-item,
  .history-list li {
    grid-template-columns: minmax(0, 1fr);
  }

  .rule-actions,
  .approval-actions {
    width: 100%;
  }

  .rule-actions button,
  .approval-actions button {
    flex: 1;
  }

  body[data-view="kid"] .rule-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body[data-view="kid"] .rule-actions {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Simplified daily-use layout */
.hero-panel {
  min-height: 168px;
  margin-bottom: 14px;
  padding-block: 20px;
}

.hero-note {
  max-width: 660px;
}

.mascot {
  width: min(100%, 205px);
}

.workspace,
body[data-view="kid"] .workspace {
  grid-template-columns: minmax(360px, 1.08fr) minmax(320px, 0.92fr);
  gap: 16px;
}

.timer-column,
body[data-view="kid"] .timer-column {
  grid-column: auto;
  grid-row: auto;
  order: 0;
}

.activity-column,
body[data-view="kid"] .activity-column {
  order: 0;
}

.timer-face {
  min-height: 260px;
  padding: 12px 0;
}

.timer-ring {
  width: min(270px, 74vw);
}

.quick-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quick-totals span {
  padding: 7px 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 1000;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
}

#quickRewardTotal {
  color: var(--reward);
}

#quickPenaltyTotal {
  color: var(--penalty);
}

.more-zone {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

body[data-view="parent"] .workspace .delete-rule {
  display: none;
}

.settings-panel,
.stats-panel {
  padding: 0;
  overflow: hidden;
}

.settings-panel > summary,
.stats-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.settings-panel > summary::-webkit-details-marker,
.stats-panel > summary::-webkit-details-marker {
  display: none;
}

.settings-panel > summary::after,
.stats-panel > summary::after {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  content: "+";
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: transform 0.18s ease;
}

.settings-panel[open] > summary::after,
.stats-panel[open] > summary::after {
  content: "−";
  transform: rotate(180deg);
}

.settings-panel summary strong,
.stats-panel summary strong,
.settings-panel summary small,
.stats-panel summary small {
  display: block;
}

.settings-panel summary strong,
.stats-panel summary strong {
  font-size: 1.05rem;
}

.settings-panel summary small,
.stats-panel summary small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 900;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(340px, 1.25fr);
  gap: 16px;
  padding: 0 18px 18px;
}

.settings-grid .control-column {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.settings-grid .profile-panel,
.settings-grid .rule-editor {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.manage-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.manage-rule-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.manage-rule-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.manage-rule-item strong,
.manage-rule-item small {
  display: block;
}

.manage-rule-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-rule-item small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 900;
}

.settings-grid .kid-switcher {
  margin-bottom: 0;
}

.stats-panel .stats-head,
.stats-panel .chart-wrap,
.stats-panel .stats-list {
  margin-inline: 18px;
}

.stats-panel .stats-list,
.stats-panel .chart-wrap {
  margin-bottom: 18px;
}

body[data-view="kid"] .hero-note {
  max-width: 560px;
}

body[data-view="kid"] .rules-panel.parent-only {
  display: none !important;
}

body[data-view="kid"] .workspace {
  grid-template-columns: minmax(340px, 1fr) minmax(300px, 0.88fr);
}

body[data-view="kid"] .more-zone {
  display: none;
}

@media (max-width: 1180px) {
  .workspace,
  body[data-view="kid"] .workspace,
  .settings-grid,
  .settings-grid .control-column {
    grid-template-columns: 1fr;
  }

  .timer-column {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .hero-panel {
    grid-template-columns: minmax(0, 1fr) minmax(82px, 106px);
    align-items: center;
    padding: 14px;
    gap: 12px;
  }

  .hero-panel .hero-copy {
    min-width: 0;
  }

  .hero-panel h1 {
    font-size: 1.55rem;
    line-height: 1.12;
  }

  .hero-note {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 8px;
    font-size: 0.92rem;
    line-height: 1.52;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mascot {
    width: min(94px, 25vw);
  }

  .hero-orbit {
    display: none;
  }

  .family-banner {
    padding: 12px;
  }

  .family-banner span {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .family-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .family-actions button {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 0.9rem;
  }

  .meter-panel {
    padding: 16px;
  }

  .timer-face {
    min-height: 226px;
    padding: 8px 0;
  }

  .timer-ring {
    width: min(228px, 66vw);
  }

  .settings-panel > summary,
  .stats-panel > summary {
    padding: 14px;
  }

  .settings-grid,
  .manage-rules,
  .stats-panel .stats-head,
  .stats-panel .chart-wrap,
  .stats-panel .stats-list {
    margin-inline: 14px;
  }

  .settings-grid {
    padding: 0 0 14px;
  }

  .redeem-box {
    grid-template-columns: 1fr;
  }
}

/* Polished no-line interface */
:root {
  --line: transparent;
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --soft-fill: rgba(255, 255, 255, 0.54);
  --soft-fill-strong: rgba(255, 255, 255, 0.78);
  --raised:
    inset 0 1px 0 rgba(255, 255, 255, 0.76),
    0 18px 48px rgba(75, 59, 98, 0.1);
  --pressed:
    inset 0 1px 2px rgba(77, 55, 94, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.78);
}

body {
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 209, 92, 0.38), transparent 26%),
    radial-gradient(circle at 92% 10%, rgba(66, 199, 189, 0.3), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(255, 109, 152, 0.16), transparent 34%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

.app-header,
.panel,
.meter-panel,
.hero-panel,
.start-card {
  border-color: transparent;
  box-shadow: var(--raised);
}

button,
input,
select,
.view-toggle,
.mini-toggle,
.rule-item,
.approval-item,
.history-list li,
.stats-row,
.kid-card,
.theme-choice,
.segmented,
.manage-rule-item,
.settings-grid .profile-panel,
.settings-grid .rule-editor,
.empty-state {
  border-color: transparent;
}

.app-header {
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.brand-logo {
  width: 42px;
  height: 42px;
}

.brand {
  min-width: 185px;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  font-size: 0.7rem;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-toggle,
.mini-toggle {
  border: 0;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--pressed);
}

.toggle-button,
.mini-toggle-button {
  min-height: 34px;
  color: var(--ink);
  -webkit-text-fill-color: currentColor;
}

.toggle-button.active,
.mini-toggle-button.active,
.segment.active {
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.select-wrap {
  grid-template-columns: auto minmax(110px, 160px);
  gap: 6px;
  white-space: nowrap;
}

.select-wrap select,
.field input {
  border: 0;
  background-color: rgba(255, 255, 255, 0.62);
  box-shadow: var(--pressed);
}

.select-wrap select {
  min-height: 38px;
  padding-right: 42px;
}

.field input:focus,
.select-wrap select:focus {
  border-color: transparent;
  box-shadow:
    var(--pressed),
    0 0 0 3px rgba(255, 255, 255, 0.7),
    0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent);
}

.theme-dock {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: var(--pressed);
}

.theme-dock .theme-choice {
  position: relative;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  gap: 0;
  overflow: hidden;
  color: transparent;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.theme-dock .theme-choice.active {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 5px var(--accent);
}

.theme-dock .theme-swatch {
  width: 100%;
  height: 100%;
  border: 0;
  box-shadow: none;
}

.theme-box {
  display: none;
}

.settings-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.6;
}

.hero-panel {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.46)),
    radial-gradient(circle at 83% 54%, color-mix(in srgb, var(--accent-3) 52%, transparent), transparent 26%),
    radial-gradient(circle at 95% 16%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 24%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent));
}

.hero-mascot {
  position: absolute;
  right: 12px;
  bottom: -26px;
  z-index: 0;
  display: block;
  justify-self: end;
  width: min(38%, 250px);
  aspect-ratio: 1;
  border-radius: 42% 58% 52% 48%;
  background:
    url("assets/mascot.png") center / contain no-repeat,
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent-3) 42%, transparent), transparent 70%);
  opacity: 0.2;
  mix-blend-mode: multiply;
}

.mascot {
  display: none;
}

.meter-panel {
  background:
    radial-gradient(circle at 78% 66%, rgba(255, 255, 255, 0.88), transparent 23%),
    radial-gradient(circle at 78% 66%, color-mix(in srgb, var(--accent-2) 24%, transparent), transparent 41%),
    radial-gradient(circle at 8% 24%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 30%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.48));
}

.meter-panel::after {
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: min(220px, 48vw);
  aspect-ratio: 1;
  content: "";
  pointer-events: none;
  background: url("assets/mascot.png") center / contain no-repeat;
  opacity: 0.16;
  filter: saturate(1.2);
}

.meter-top,
.timer-face,
.redeem-box {
  z-index: 1;
}

.quick-totals span,
.status-pill,
.pending-chip,
.stats-total span,
.stat-bar,
.rule-item,
.approval-item,
.history-list li,
.manage-rule-item,
.settings-grid .profile-panel,
.settings-grid .rule-editor,
.kid-card,
.theme-choice,
.segmented,
.empty-state {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--pressed);
}

.rule-item {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 54px;
  padding: 8px 8px 8px 12px;
}

body[data-view="kid"] .rule-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.rule-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.tiny-button {
  min-height: 32px;
  border: 0;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--pressed);
}

.apply-rule,
.approve-request {
  min-width: 72px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.reject-request,
.danger-button {
  color: var(--penalty);
  -webkit-text-fill-color: var(--penalty);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  border: 0;
  box-shadow: var(--pressed);
}

.primary-button {
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.secondary-button,
.danger-button,
.icon-button {
  background: rgba(255, 255, 255, 0.7);
}

.kid-check span {
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 0 0 2px var(--accent-2),
    0 0 0 2px rgba(255, 255, 255, 0.78);
}

.kid-check span::after {
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.kid-check input:checked + span {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.82);
}

.quantity-stepper {
  display: inline-grid;
  grid-template-columns: 30px 30px 30px;
  align-items: center;
  min-height: 32px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--pressed);
}

.quantity-stepper[hidden] {
  display: none;
}

.quantity-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  color: #fff;
  -webkit-text-fill-color: #fff;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  font-size: 1rem;
  font-weight: 1000;
}

.quantity-value {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 1000;
  text-align: center;
}

@supports not (color: color-mix(in srgb, red, white)) {
  .toggle-button.active,
  .mini-toggle-button.active,
  .primary-button,
  .segment.active,
  .apply-rule,
  .approve-request {
    background: linear-gradient(135deg, #ff6d98, #42c7bd);
  }

  .field input:focus,
  .select-wrap select:focus {
    box-shadow:
      var(--pressed),
      0 0 0 3px rgba(255, 255, 255, 0.7),
      0 0 0 5px rgba(255, 109, 152, 0.22);
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 14px, 760px);
    padding-top: 6px;
  }

  .app-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    padding: 7px;
  }

  .brand {
    min-width: 0;
    gap: 0;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand span {
    display: none;
  }

  .top-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    column-gap: 10px;
  }

  .top-row {
    display: grid;
    grid-template-columns: auto minmax(92px, 1fr);
    min-width: 0;
  }

  .view-toggle {
    width: auto;
    min-width: max-content;
  }

  .toggle-button {
    min-height: 32px;
    min-width: 44px;
    padding-inline: 10px;
    white-space: nowrap;
  }

  .select-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .select-wrap span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .select-wrap select {
    min-height: 32px;
    padding-left: 10px;
    padding-right: 34px;
    font-size: 0.9rem;
    text-overflow: ellipsis;
  }

  .theme-dock {
    gap: 4px;
    padding: 3px;
  }

  .theme-dock .theme-choice {
    width: 24px;
    height: 24px;
    min-height: 24px;
  }

  .hero-mascot {
    right: -6px;
    bottom: -16px;
    width: min(150px, 38vw);
  }

  .mascot {
    width: min(76%, 76px);
  }

  .rule-item {
    padding: 8px;
  }

  .rule-actions {
    width: auto;
  }

  .rule-actions button {
    flex: 0 0 auto;
  }

  body[data-view="kid"] .rule-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}
