:root {
  --brand: #17b8a6;
  --brand-dark: #0e8c7f;
  --coin: #e08a00;
  --coin-soft: #fff2c9;
  --accent: #ff7a59;
  --dust: #7258bb;
  --success: #2d9d58;
  --danger: #d85342;
  --ink: #1f2430;
  --muted: #66707e;
  --faint: #97a0ad;
  --line: #e7ebef;
  --paper: #ffffff;
  --page: #f6f8fa;
  --kids-page: #fff9ee;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.07);
  --shadow-small: 0 4px 14px rgba(31, 36, 48, 0.06);
  --radius: 16px;
  --radius-small: 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(23, 184, 166, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px max(22px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(231, 235, 239, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  background: var(--brand);
  border-radius: 12px;
  box-shadow: 0 5px 13px rgba(23, 184, 166, 0.24);
}

.brand-name {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.role-switch,
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-switch {
  padding: 4px;
  background: #f0f3f5;
  border-radius: 10px;
}

.role-switch button {
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
}

.role-switch button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-small);
  font-weight: 700;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border-radius: 10px;
  font-size: 18px;
}

.icon-button:hover {
  color: var(--ink);
  background: #f0f3f5;
}

.content {
  width: min(100% - 32px, 1080px);
  margin: 0 auto;
  padding: 30px 0 108px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: 0;
  line-height: 1.16;
}

h2 {
  font-size: 21px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
}

.caption {
  color: var(--muted);
  font-size: 13px;
}

.tiny {
  color: var(--faint);
  font-size: 12px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.band {
  margin-top: 22px;
}

.surface {
  background: var(--paper);
  border: 1px solid rgba(231, 235, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.surface-pad {
  padding: 22px;
}

.kids-shell {
  background: var(--kids-page);
}

.kids-shell .content {
  width: min(100% - 32px, 760px);
}

.hero {
  padding: 26px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(23, 184, 166, 0.98), rgba(14, 140, 127, 0.96)),
    var(--brand);
  border: 0;
  box-shadow: 0 16px 38px rgba(14, 140, 127, 0.18);
}

.hero-top,
.between,
.task-row,
.wish-head,
.approval-row,
.focus-head,
.bank-row,
.form-row,
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-greeting {
  font-size: 24px;
  font-weight: 750;
}

.hero-date {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.hero-balance {
  flex: 0 0 auto;
  text-align: right;
}

.hero-balance strong {
  display: block;
  font-size: 38px;
  line-height: 1;
}

.hero-balance span {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.stat-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 24px;
}

.stat {
  min-width: 130px;
  padding-right: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

.stat:last-child {
  border-right: 0;
}

.stat-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.stat-value {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 750;
}

.progress {
  height: 9px;
  overflow: hidden;
  background: var(--line);
  border-radius: 99px;
}

.hero .progress {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.22);
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #fff3c4, #ffcf62);
  border-radius: inherit;
  transition: width 500ms var(--ease);
}

.task-list,
.wish-list,
.approval-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.task-row,
.wish-row,
.approval-row {
  padding: 16px;
  background: var(--paper);
  border: 1px solid rgba(231, 235, 239, 0.9);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow-small);
}

.task-icon,
.wish-icon,
.approval-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  background: #fff4dc;
  border-radius: 12px;
  font-size: 24px;
}

.task-main,
.wish-main,
.approval-main {
  flex: 1;
  min-width: 0;
}

.task-title,
.wish-title,
.approval-title {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.task-row.is-done {
  opacity: 0.58;
}

.task-row.is-pending .task-title {
  color: var(--brand-dark);
}

.task-side {
  flex: 0 0 auto;
  text-align: right;
}

.coin {
  color: var(--coin);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dust {
  color: var(--dust);
  font-weight: 800;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  color: #fff;
  background: var(--brand);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition:
    transform 100ms var(--ease),
    opacity 100ms linear;
}

.action-button:hover {
  opacity: 0.9;
}

.action-button:active {
  transform: scale(0.97);
}

.action-button.secondary {
  color: var(--brand-dark);
  background: #e5f7f4;
}

.action-button.ghost {
  color: var(--brand-dark);
  background: var(--paper);
  border: 1px solid var(--brand);
}

.action-button.danger {
  color: #fff;
  background: var(--danger);
}

.action-button.small {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12px;
}

.action-button[disabled] {
  color: var(--faint);
  background: var(--line);
  border-color: transparent;
  cursor: not-allowed;
}

.bottom-nav {
  position: sticky;
  z-index: 4;
  top: 72px;
  display: flex;
  justify-content: center;
  padding: 9px 16px max(9px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(231, 235, 239, 0.9);
  backdrop-filter: blur(16px);
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 1fr));
  width: min(100%, 760px);
  gap: 4px;
}

.nav-item {
  position: relative;
  display: grid;
  min-height: 52px;
  place-items: center;
  padding: 6px 4px;
  color: var(--muted);
  background: transparent;
  border-radius: 10px;
  font-size: 11px;
  gap: 2px;
}

.nav-item strong {
  font-size: 19px;
  line-height: 1;
}

.nav-item.active {
  color: var(--brand-dark);
  background: #e9f8f6;
  font-weight: 750;
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 27px);
  display: grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-radius: 9px;
  font-size: 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading .caption {
  text-align: right;
}

.empty {
  padding: 48px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-symbol {
  margin-bottom: 10px;
  font-size: 34px;
}

.chip-list,
.seg-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.seg {
  padding: 10px 13px;
  color: var(--muted);
  background: #f3f5f6;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
}

.chip.selected,
.seg.selected {
  color: var(--brand-dark);
  background: #e5f7f4;
  border-color: rgba(23, 184, 166, 0.4);
  font-weight: 700;
}

.focus-panel {
  text-align: center;
}

.focus-clock {
  margin: 30px 0 22px;
  color: var(--brand-dark);
  font-size: clamp(54px, 14vw, 92px);
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1;
}

.focus-ring {
  display: grid;
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 24px auto;
  padding: 16px;
  place-items: center;
  background: conic-gradient(var(--brand) var(--focus-progress, 0%), #e9eeef 0);
  border-radius: 50%;
}

.focus-ring::after {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: var(--paper);
  border-radius: 50%;
  content: "";
}

.focus-ring .focus-clock {
  position: absolute;
  z-index: 1;
  margin: 0;
}

.focus-ring-wrap {
  position: relative;
}

.result-stars {
  margin: 15px 0 8px;
  color: #dce1e5;
  font-size: 42px;
  letter-spacing: 4px;
}

.result-stars .on {
  color: #ffbd30;
  text-shadow: 0 5px 13px rgba(255, 189, 48, 0.25);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.choice {
  padding: 13px 7px;
  color: var(--muted);
  background: #f3f5f6;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
}

.choice.selected {
  color: var(--brand-dark);
  background: #e5f7f4;
  border-color: rgba(23, 184, 166, 0.4);
  font-weight: 750;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.inline-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.field input:focus,
.inline-input:focus {
  border-color: var(--brand);
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.toggle input {
  width: 0;
  height: 0;
  opacity: 0;
}

.toggle span {
  position: absolute;
  inset: 0;
  background: #d8dde1;
  border-radius: 99px;
  cursor: pointer;
  transition: background 160ms linear;
}

.toggle span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  content: "";
  transition: transform 160ms var(--ease);
}

.toggle input:checked + span {
  background: var(--brand);
}

.toggle input:checked + span::after {
  transform: translateX(18px);
}

.wish-progress {
  margin: 15px 0 12px;
}

.wish-progress .progress > span {
  background: linear-gradient(90deg, #ffb020, #ffcf62);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  color: var(--brand-dark);
  background: #e5f7f4;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.tag.gray {
  color: var(--muted);
  background: #f0f2f4;
}

.bank-balance {
  font-size: 28px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.account-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: #fff5d8;
  border-radius: 11px;
  font-size: 21px;
}

.transaction-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.transaction {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.transaction:last-child {
  border-bottom: 0;
}

.amount-positive {
  color: var(--success);
  font-weight: 750;
}

.amount-negative {
  color: var(--danger);
  font-weight: 750;
}

.approval-groups {
  display: grid;
  gap: 22px;
}

.approval-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.approval-row {
  box-shadow: none;
}

.approval-side {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.metric {
  padding: 17px;
}

.metric-value {
  margin-top: 7px;
  font-size: 26px;
  font-weight: 780;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.report-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.report-row .progress {
  height: 10px;
}

.report-row .progress > span {
  background: var(--brand);
}

.report-score {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 750;
  text-align: right;
}

.fx-lab {
  display: grid;
  gap: 12px;
}

.fx-demo-button {
  min-height: 88px;
  padding: 15px;
  color: var(--ink);
  background: #f7f8f9;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: left;
}

.fx-demo-button strong {
  display: block;
  margin-bottom: 4px;
}

.fx-demo-button span {
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 50%;
  top: 86px;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  color: #fff;
  background: rgba(31, 36, 48, 0.92);
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 12px);
  transition:
    opacity 160ms linear,
    transform 160ms var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(50%, 0);
}

.fx-layer {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  overflow: hidden;
  place-items: center;
  pointer-events: none;
}

.fx-curtain {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(14, 140, 127, 0.94);
  animation: curtain-in 2200ms var(--ease) both;
}

.fx-curtain-content {
  text-align: center;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.fx-curtain-content strong {
  display: block;
  font-size: clamp(36px, 8vw, 68px);
}

.fx-curtain-content span {
  display: block;
  margin-top: 8px;
  font-size: 17px;
}

.fx-coin {
  position: absolute;
  color: #ffbe32;
  font-size: 25px;
  animation: coin-fly 900ms var(--ease) both;
}

.fx-jump {
  position: absolute;
  color: #fff;
  font-size: 29px;
  font-weight: 800;
  animation: jump-up 1000ms var(--ease) both;
}

@keyframes curtain-in {
  0% {
    opacity: 0;
    transform: scale(1.06);
  }
  15%,
  75% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes coin-fly {
  0% {
    opacity: 0;
    transform: translate(0, 70px) scale(0.6) rotate(-15deg);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--x), -170px) scale(1) rotate(18deg);
  }
}

@keyframes jump-up {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.8);
  }
  18%,
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-52px) scale(1);
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 12px 16px;
  }

  .brand-sub {
    display: none;
  }

  .content {
    width: min(100% - 24px, 760px);
    padding-top: 22px;
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }

  .page-heading .toolbar {
    width: 100%;
  }

  .page-heading .toolbar .action-button {
    flex: 1;
  }

  .hero {
    padding: 21px;
  }

  .hero-greeting {
    font-size: 21px;
  }

  .hero-balance strong {
    font-size: 31px;
  }

  .stat {
    min-width: 108px;
    padding-right: 14px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .surface-pad {
    padding: 17px;
  }

  .task-row,
  .approval-row {
    align-items: flex-start;
  }

  .task-side {
    display: grid;
    gap: 7px;
  }

  .approval-row {
    flex-wrap: wrap;
  }

  .approval-main {
    min-width: calc(100% - 62px);
  }

  .approval-side {
    width: 100%;
    padding-left: 62px;
  }

  .approval-side .action-button {
    flex: 1;
  }

  .report-row {
    grid-template-columns: 75px minmax(0, 1fr) 40px;
  }

  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
