:root {
  --bg: #f9f8f5;
  --card: #ffffff;
  --ink: #2e3532;
  --ink-2: #58645e;
  --muted: #929e98;
  --soft: #c8d1cb;
  --hairline: #e8ece8;
  --sage: #739f80;
  --sage-dark: #537b60;
  --sage-light: #e6f2ea;
  --sage-soft: #f0f7f2;
  --warm: #e99868;
  --warm-light: #fdf0e7;
  --warm-soft: #fff6ef;
  --plum: #a99bd6;
  --plum-light: #f1eefa;
  --rose: #de8084;
  --sky: #7bb5d0;
  --danger: #b95f61;
  --radius: 18px;
  --radius-sm: 14px;
  --shadow: 0 1px 0 var(--hairline), 0 3px 12px rgb(44 56 49 / 5%);
  --shadow-lg: 0 18px 60px rgb(35 46 40 / 18%);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Display", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input { font: inherit; }
button { -webkit-appearance: none; }

.app { width: min(100%, 430px); margin: 0 auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 22px 6px;
}
.brand { color: var(--ink); font-size: 22px; font-weight: 820; letter-spacing: -.4px; }
.mini { margin-top: 2px; color: var(--muted); font-size: 10.5px; font-weight: 520; letter-spacing: .02em; }
.sync-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgb(255 255 255 / 84%);
  color: var(--ink-2);
  box-shadow: 0 1px 5px rgb(44 56 49 / 5%);
  cursor: pointer;
  font-size: 11px;
  font-weight: 680;
}
.sync-button:active { transform: scale(.97); }
.sync-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--soft); transition: .3s var(--ease); }
.sync-dot.online { background: var(--sage); box-shadow: 0 0 0 4px rgb(115 159 128 / 18%); }
.sync-dot.syncing { background: var(--sky); box-shadow: 0 0 0 4px rgb(123 181 208 / 18%); animation: pulse 1.2s infinite; }
.sync-dot.pending { background: var(--warm); box-shadow: 0 0 0 4px rgb(233 152 104 / 18%); }
.sync-dot.error { background: var(--danger); box-shadow: 0 0 0 4px rgb(185 95 97 / 16%); }
@keyframes pulse { 50% { opacity: .45; } }

.notice {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border: 1px solid #efd6c4;
  border-radius: 12px;
  background: var(--warm-soft);
  color: #856046;
  font-size: 11px;
  line-height: 1.5;
}
main { padding: 0 16px 20px; }
main > section { animation: page-enter .35s var(--ease-out); }
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.date {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 2px;
  color: var(--ink);
  font-size: 34px;
  font-weight: 880;
  line-height: 1.1;
  letter-spacing: -.8px;
}
.back-today {
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--sage-light);
  color: var(--sage-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
}
.weekday { margin-bottom: 22px; color: var(--muted); font-size: 12px; font-weight: 580; }
.badge { display: inline-block; margin-left: 8px; padding: 3px 8px; border-radius: 999px; font-size: 9px; font-weight: 760; }
.badge-weekend { background: var(--warm-light); color: var(--warm); }
.day-focus { margin: -10px 0 18px; padding: 11px 13px; border-radius: 12px; background: var(--sage-soft); color: var(--sage-dark); font-size: 12px; line-height: 1.55; }

.section, .games-section, .books-section, .meals-section, .schedule-section { margin-bottom: 26px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.section-title { margin: 0; font-size: 15px; font-weight: 790; letter-spacing: -.1px; }
.section-badge { color: var(--muted); font-size: 10px; font-weight: 620; }

.game-card, .book-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin: 0 0 7px;
  padding: 14px 14px 14px 18px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: .22s var(--ease);
}
.game-card::after, .book-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--warm); }
.book-card::after { background: var(--plum); }
.game-card:active, .book-card:active { transform: scale(.985); }
.game-card.done, .book-card.done { opacity: .58; }
.game-card.done .gc-title, .book-card.done .gc-title { text-decoration: line-through; }
.gc-check {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  border: 1.5px solid var(--soft);
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 800;
}
.gc-check.on { border-color: var(--sage); background: var(--sage); }
.gc-body { min-width: 0; flex: 1; }
.gc-title { overflow-wrap: anywhere; font-size: 13.5px; font-weight: 690; line-height: 1.45; }
.gc-meta { margin-bottom: 3px; color: var(--muted); font-size: 9.5px; font-weight: 590; line-height: 1.35; }
.gc-tag { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: var(--warm-light); color: var(--warm); font-size: 9px; font-weight: 700; }
.gc-outdoor { background: #e9f5eb; color: #579268; }
.gc-indoor, .gc-desk { background: #f2eef9; color: #8d79c5; }
.gc-bath { background: #eaf5fa; color: #609db8; }
.gc-car, .gc-dining { background: #fff2e8; color: #ca7f50; }

.meal-cards { display: grid; gap: 8px; }
.meal-card { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px 16px 18px; overflow: hidden; border-radius: var(--radius-sm); background: var(--card); box-shadow: var(--shadow); }
.meal-card::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--sage); }
.meal-lunch::after { background: var(--warm); }
.meal-dinner::after { background: var(--plum); }
.meal-emoji { flex: 0 0 auto; margin-top: 1px; font-size: 28px; line-height: 1; }
.meal-body { min-width: 0; flex: 1; }
.meal-label { margin-bottom: 9px; color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .08em; }
.meal-items { display: flex; flex-wrap: wrap; gap: 6px; }
.meal-items span { padding: 6px 9px; border-radius: 9px; background: var(--sage-soft); color: var(--ink-2); font-size: 12px; font-weight: 640; line-height: 1.3; }
.meal-lunch .meal-items span { background: var(--warm-soft); }
.meal-dinner .meal-items span { background: #f6f3fb; }
.meal-count { margin-top: 10px; color: var(--muted); font-size: 10px; }
.meal-empty { color: var(--muted); font-size: 12px; }
.foodnote { margin-top: 10px; padding: 0 2px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.schedule-period { margin-bottom: 10px; }
.period-head { display: flex; align-items: center; gap: 7px; margin: 0 4px 7px; }
.period-icon { font-size: 14px; }
.period-label { font-size: 11px; font-weight: 760; }
.period-range { margin-left: auto; color: var(--muted); font-size: 9px; }
.timeline-card { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.timeline-card::before { content: ""; position: absolute; top: 18px; bottom: 18px; left: 22px; width: 2px; border-radius: 2px; background: #dce8df; }
.tl-row { position: relative; display: flex; gap: 14px; min-height: 38px; padding: 11px 14px 9px 40px; border-bottom: 1px solid var(--hairline); }
.tl-row:last-child { border-bottom: 0; }
.tl-row::before { content: ""; position: absolute; top: 50%; left: 17px; width: 12px; height: 12px; transform: translateY(-50%); border: 2.5px solid white; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 1px rgb(0 0 0 / 6%); }
.period-afternoon .timeline-card::before, .period-afternoon .tl-row::before { background: var(--warm); }
.period-evening .timeline-card::before, .period-evening .tl-row::before { background: var(--plum); }
.tl-highlight { background: #fbfcfb; }
.tl-time { min-width: 58px; flex: 0 0 auto; font-size: 10.5px; font-weight: 740; font-variant-numeric: tabular-nums; line-height: 1.4; }
.tl-desc { color: var(--ink-2); font-size: 11.5px; line-height: 1.45; }

.empty-state { padding: 44px 24px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-align: center; }
.empty-state .icon { display: block; margin-bottom: 14px; font-size: 38px; opacity: .42; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.theme-banner { position: relative; margin-bottom: 16px; padding: 22px 20px; overflow: hidden; border-radius: var(--radius); background: linear-gradient(150deg, #e8f2ec, #f4f9f6); box-shadow: var(--shadow); }
.theme-banner::before { content: ""; position: absolute; top: -42px; right: -42px; width: 140px; height: 140px; border-radius: 50%; background: rgb(255 255 255 / 36%); }
.theme-banner .label { color: var(--sage); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.theme-banner h1 { position: relative; margin: 7px 0 12px; font-size: 24px; letter-spacing: -.4px; }
.keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.kw { padding: 5px 8px; border-radius: 999px; background: rgb(255 255 255 / 70%); color: var(--sage-dark); font-size: 10px; font-weight: 650; }
.reason-card { margin-bottom: 8px; padding: 15px 16px; border-radius: var(--radius-sm); background: var(--card); box-shadow: var(--shadow); }
.reason-card .title { margin-bottom: 5px; color: var(--ink); font-size: 12px; font-weight: 750; }
.reason-card p { margin: 0; color: var(--ink-2); font-size: 11.5px; line-height: 1.65; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 2px 18px; }
.cal-title { min-width: 86px; }
.cal-head .month { font-size: 30px; font-weight: 860; letter-spacing: -.6px; }
.cal-head .year { color: var(--muted); font-size: 11px; }
.cal-controls { display: flex; gap: 6px; }
.cal-button { width: 36px; height: 36px; border: 1px solid var(--hairline); border-radius: 50%; background: var(--card); color: var(--ink-2); box-shadow: var(--shadow); cursor: pointer; font-size: 17px; }
.cal-button:active { transform: scale(.94); }
.cal-legend { display: flex; gap: 8px; margin: -8px 2px 14px; color: var(--muted); font-size: 10px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 4px; }
.cal-legend i, .cell .ind { display: inline-block; width: 4px; height: 4px; border-radius: 50%; }
.ind-meal { background: var(--sage); }
.ind-play { background: var(--warm); }
.ind-read { background: var(--plum); }
.week-labels, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.week-labels { margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 700; text-align: center; }
.cell { position: relative; min-width: 0; min-height: 48px; padding: 5px 4px 4px; overflow: hidden; border: 1px solid transparent; border-radius: 9px; background: var(--card); color: var(--ink); cursor: pointer; text-align: left; transition: .18s var(--ease); }
.cell:active { transform: scale(.94); background: var(--sage-soft); }
.cell.empty { pointer-events: none; background: transparent; }
.cell.today { border-color: var(--sage); background: var(--sage-light); }
.cell.selected { box-shadow: inset 0 0 0 2px var(--ink); }
.cell.has-trip { border-color: #f5d5b8; background: var(--warm-soft); }
.day-num { font-size: 11px; font-weight: 650; }
.cell.today .day-num { color: var(--sage-dark); font-weight: 820; }
.cell .indicators { display: flex; gap: 2px; margin-top: 3px; }
.cell .ind { width: 3px; height: 3px; }
.cell .hint { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 6.5px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }

.tab-bar { position: fixed; z-index: 100; bottom: calc(12px + env(safe-area-inset-bottom)); left: 50%; display: flex; width: min(360px, calc(100% - 40px)); padding: 3px; transform: translateX(-50%); border: 1px solid rgb(0 0 0 / 4%); border-radius: 999px; background: rgb(255 255 255 / 94%); box-shadow: 0 4px 22px rgb(0 0 0 / 11%); backdrop-filter: blur(18px); }
.tab-bar button { flex: 1; padding: 10px 4px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 640; }
.tab-bar button.active { background: var(--ink); color: white; box-shadow: 0 2px 12px rgb(46 53 50 / 20%); font-weight: 720; }
.update-toast { position: fixed; z-index: 200; bottom: calc(80px + env(safe-area-inset-bottom)); left: 50%; padding: 12px 20px; transform: translateX(-50%) translateY(20px); border: 0; border-radius: 999px; background: var(--ink); color: white; box-shadow: 0 4px 20px rgb(46 53 50 / 25%); cursor: pointer; opacity: 0; pointer-events: none; transition: .3s var(--ease-out); font-size: 13px; font-weight: 650; white-space: nowrap; }
.update-toast.show { transform: translateX(-50%); opacity: 1; pointer-events: auto; }

.modal { position: fixed; z-index: 300; inset: 0; display: grid; align-items: end; justify-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgb(28 35 31 / 38%); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(100%, 420px); max-height: calc(100dvh - 36px); padding: 22px; overflow: auto; border-radius: 24px; background: var(--bg); box-shadow: var(--shadow-lg); animation: modal-in .28s var(--ease-out); }
@keyframes modal-in { from { transform: translateY(20px); opacity: 0; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-kicker { color: var(--sage); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.modal-head h2 { margin: 4px 0 0; font-size: 24px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--card); color: var(--muted); cursor: pointer; font-size: 24px; line-height: 1; }
.modal-copy { margin: 0 0 16px; color: var(--ink-2); font-size: 12px; line-height: 1.65; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin: 0 0 6px 2px; color: var(--ink-2); font-size: 11px; font-weight: 700; }
.field input { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--hairline); border-radius: 12px; outline: 0; background: var(--card); color: var(--ink); font-size: 14px; }
.field input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgb(115 159 128 / 14%); }
.auth-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
.button { width: 100%; min-height: 44px; margin-top: 8px; padding: 10px 14px; border: 0; border-radius: 12px; cursor: pointer; font-size: 12px; font-weight: 720; }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { background: var(--ink); color: white; }
.button-secondary { background: var(--sage-light); color: var(--sage-dark); }
.button-quiet { background: transparent; color: var(--muted); }
.auth-note { margin: 14px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.auth-message { min-height: 18px; margin: 14px 2px 0; color: var(--danger); font-size: 11px; line-height: 1.5; }
.auth-message.success { color: var(--sage-dark); }
.account-card { display: flex; align-items: center; gap: 12px; padding: 15px; border-radius: 14px; background: var(--sage-soft); }
.account-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sage); color: white; font-weight: 800; }
.account-label { color: var(--sage-dark); font-size: 12px; font-weight: 760; }
.account-email { margin-top: 3px; color: var(--muted); font-size: 10px; word-break: break-all; }
.noscript { margin: 30px auto; padding: 15px; max-width: 360px; color: var(--danger); text-align: center; }
.hidden { display: none !important; }

@media (min-width: 600px) {
  main { padding-inline: 12px; }
  .app { width: min(100%, 520px); }
  .cell { min-height: 58px; }
  .modal { align-items: center; }
}

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