:root {
  color-scheme: light;
  font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.6;
  color: #18372e;
  background: #f5f7f1;
  --accent: #146451;
  --ink: #18372e;
  --muted: #52685e;
  --line: #dce7db;
  --shadow: 0 14px 40px #203d2d0a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
header {
  background: #ffffffed;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  padding: 12px max(20px, calc((100vw - 1120px) / 2));
}
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 800; line-height: 1.18; }
.brand-mark { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 14px; background: #1e6252; color: #fff2ba; font-size: 1.4rem; }
.brand b { color: var(--accent); }
.brand small { display: block; color: var(--muted); font-size: .875rem; font-weight: 650; margin-top: 3px; letter-spacing: .025em; }
nav { display: flex; gap: 4px; background: #edf3eb; border-radius: 32px; padding: 4px; white-space: nowrap; }
nav a { padding: 7px 12px; border-radius: 24px; font-size: .9rem; font-weight: 700; }
nav a[aria-current] { background: white; color: var(--accent); box-shadow: 0 2px 6px #18372e15; }
#account-tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
main { max-width: 1160px; margin: auto; padding: 28px 20px 66px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.07fr) minmax(0, 1fr);
  align-items: stretch;
  background: #dcead9;
  border: 1px solid #d0e0cf;
  border-radius: 26px;
  overflow: hidden;
}
.hero-copy { padding: clamp(22px, 4.6vw, 52px); align-self: center; min-width: 0; }
.hero-media { display: block; min-width: 0; }
.hero-art { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; }
.hero .eyebrow { color: #315e4d; font-size: .9rem; font-weight: 750; margin: 0; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.65rem); line-height: 1.14; letter-spacing: -.055em; margin: 9px 0 12px; }
.hero-copy > p:last-child { margin-bottom: 0; color: #35584b; }
.dashboard-hero { min-height: 238px; }
.dashboard-hero .hero-art { max-height: 270px; }
.welcome { background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.welcome .hero-art { aspect-ratio: 5/4; max-height: 460px; }
.welcome h1 { margin-bottom: 16px; }
.welcome-summary { max-width: 32ch; color: var(--muted); margin: 0 0 22px; }
.welcome-features { margin-top: 28px; }
.welcome-features h2 { margin-bottom: 14px; }
.feature-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.feature { border-radius: 18px; padding: 18px; border: 1px solid var(--line); }
.feature h3 { margin: 0 0 6px; }
.feature p { margin: 0; color: var(--muted); }
.feature-tasks { background: #fff; }
.feature-game { background: #eaf3db; }
.feature-bedtime { background: #f0edf8; border-color: #e6dff0; }
.feature-stars { background: #fff3dc; border-color: #f1e1bc; }
.device-note { margin: 16px 0 0; color: var(--muted); }
@media (max-width: 860px) { .feature-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 420px) { .feature-grid { grid-template-columns: 1fr; } }
.account h2 { font-size: 1.18rem; margin: 0 0 12px; }
.account-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0 0; color: var(--muted); }
.account-links a, dialog a { text-decoration: underline; text-underline-offset: 3px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(0,1fr); gap: 22px; margin-top: 24px; align-items: start; }
h2, h3, p, strong { overflow-wrap: anywhere; }
h2 { margin: 0 0 12px; font-size: 1.28rem; }
h3 { margin: 5px 0; font-size: 1.1rem; }
.heading, .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.heading > h2 { margin: 0; }
.task-heading { margin: 0 0 12px; }
.card { background: white; border: 1px solid var(--line); border-radius: 20px; padding: 19px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card p { margin: 7px 0 12px; color: var(--muted); white-space: pre-wrap; }
.tag { background: #e8f2e5; border-radius: 20px; padding: 4px 10px; font-size: .875rem; color: #275f4e; font-weight: 700; }
.status { color: var(--muted); font-size: .9rem; }
.game { background: #eaf3db; border-color: #dce8cb; }
.bedtime { background: #f0edf8; border-color: #e6dff0; }
.stars { background: #fff3dc; border-color: #f1e1bc; }
.game, .bedtime, .stars { padding: 22px; }
.photo { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #f3f6ef; border-radius: 12px; margin: 8px 0; }
.clock { display: block; font-size: clamp(1.5rem, 7vw, 2.5rem); line-height: 1.15; font-variant-numeric: tabular-nums; font-weight: 800; margin: 10px 0; }
.overdue, form [role=alert] { color: #942f33; }
button { border: 0; border-radius: 12px; padding: 10px 15px; font-weight: 720; cursor: pointer; min-height: 44px; background: var(--accent); color: white; }
button.secondary { background: #eaf2e9; color: #245849; }
button:disabled { opacity: .56; cursor: default; }
button:not(:disabled):hover { filter: brightness(.93); }
:where(button, a, input, textarea, select):focus-visible { outline: 3px solid #b26a36; outline-offset: 3px; }
.conditions { padding-left: 24px; margin: 12px 0; }
.conditions label { display: flex; gap: 8px; align-items: center; }
.condition-confirm { justify-content: flex-start; }
dialog { border: 1px solid var(--line); border-radius: 22px; padding: 23px; width: min(92vw,510px); max-height: 88dvh; color: inherit; }
dialog::backdrop { background: #18372e99; }
form > label { display: grid; gap: 4px; margin: 10px 0; }
input:not([type=checkbox]), textarea, select { width: 100%; padding: 9px; border: 1px solid #93a89c; border-radius: 9px; background: white; color: inherit; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
form label.check { display: flex; align-items: center; gap: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 17px; }
#notice { position: fixed; z-index: 2; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: 90vw; width: max-content; border-radius: 12px; background: #18372e; color: white; padding: 10px 16px; }
.muted { color: var(--muted); }
.bedtime-items { display: grid; gap: 6px; margin: 12px 0; }
.bedtime-items label { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.star-actions { justify-content: flex-start; margin: 12px 0 14px; }
.reward-row { padding: 10px 0; border-top: 1px solid #eadcbb; }
.stars h3 { margin-top: 14px; }
@media (max-width: 680px) {
  header { min-height: 65px; padding: 10px 13px; }
  main { padding: 15px 13px 40px; }
  .hero { border-radius: 20px; }
  .welcome, .layout { grid-template-columns: 1fr; }
  .welcome .hero-art { aspect-ratio: 2.1; max-height: 235px; }
  .layout { gap: 14px; }
  .dashboard-hero { min-height: 165px; grid-template-columns: minmax(0,1.3fr) minmax(0,.7fr); }
  .dashboard-hero h1 { font-size: clamp(1.5rem, 6vw, 2.3rem); }
  .dashboard-hero .hero-copy { padding: 18px 14px; }
  .dashboard-hero .hero-art { object-position: 45% 50%; }
  #account-tools button { font-size: .875rem; padding-inline: 10px; }
}
.bedtime-art { display: block; margin-top: 12px; width: 100%; aspect-ratio: 3/1; object-fit: cover; border-radius: 12px; }
.history-entry { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-entry button { margin-top: 4px; }
#history-content h3 { margin-top: 16px; }
.phone-nav { display: none; }
.settings-list { margin: 0 0 16px; }
.settings-list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.settings-list dt { color: var(--muted); }
.settings-list dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.completed-tasks { border: 1px solid var(--line); border-radius: 16px; background: #edf3eb; }
.completed-tasks summary { cursor: pointer; padding: 12px 16px; font-weight: 700; }
.completed-tasks > div { padding: 0 10px; }
.photo-fields { min-width: 0; margin: 12px 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.photo-fields label { display: grid; gap: 4px; margin-bottom: 8px; }
.photo-fields label:last-child { margin-bottom: 0; }
input[type=file] { min-width: 0; }
input::file-selector-button { min-height: 36px; border: 0; border-radius: 8px; background: #eaf2e9; color: var(--ink); font: inherit; padding: 4px 8px; margin-right: 6px; }

@media (max-width: 680px) {
  header { padding-top: max(10px, env(safe-area-inset-top)); }
  main:has(.phone-nav) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .phone-nav {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 4px max(8px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: #fff;
    border-top: 1px solid var(--line);
    border-radius: 0;
  }
  .phone-nav a { display: grid; place-items: center; min-height: 44px; padding: 4px; color: var(--accent); }
  [id$="-board"] { scroll-margin-top: 12px; }
  #notice { bottom: calc(66px + env(safe-area-inset-bottom)); }
  dialog { width: 100%; max-width: none; max-height: 90dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
  input:not([type=checkbox]), textarea, select { min-height: 44px; font-size: 16px; }
  .account-actions > button { flex: 1 1 110px; }
}
