:root {
  color-scheme: light;
  --ink: #24372f;
  --muted: #718077;
  --green: #356e53;
  --green-dark: #28583f;
  --mint: #eaf2eb;
  --paper: #fffefa;
  --line: #e6e9e1;
  --danger: #8a4038;
  --danger-hover: #fbefec;
  --focus-ring: #1f6c45;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:root[data-theme="dark"], :root[data-theme="system"] {
  color-scheme: dark;
  --ink: #e7eee9; --muted: #a6b4aa; --green: #75bd91; --green-dark: #8dcc9f;
  --mint: #253b2e; --paper: #19251f; --line: #35443a;
  --danger: #ffaaa0; --danger-hover: #482a28;
  --focus-ring: #c5f3d0;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="system"] { color-scheme: light; --ink:#24372f; --muted:#718077; --green:#356e53; --green-dark:#28583f; --mint:#eaf2eb; --paper:#fffefa; --line:#e6e9e1; --danger:#8a4038; --danger-hover:#fbefec; --focus-ring:#1f6c45; }
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at top left, color-mix(in srgb, var(--mint), transparent 35%) 0, transparent 42%), var(--page-bg, #f7f8f4);
}
:root[data-theme="dark"] body, :root[data-theme="system"] body { --page-bg:#111a15; }
@media (prefers-color-scheme: light) { :root[data-theme="system"] body { --page-bg:#f7f8f4; } }
button, input { font: inherit; }
.app-shell { width: min(100% - 32px, 560px); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preferences { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: end; gap: 10px 14px; margin-top: 12px; }
.preference-group { display: grid; gap: 5px; }
.preference-label { color: var(--muted); font-size: 10px; font-weight: 700; }
.preference-buttons { display: flex; align-items: center; gap: 4px; padding: 2px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.preference-button { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.preference-button[aria-pressed="true"] { color: var(--green-dark); background: var(--mint); box-shadow: inset 0 0 0 1px var(--green); }
.preference-button:hover { color: var(--ink); background: var(--mint); }
.preference-button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.theme-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.language-button { font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 750; letter-spacing: -.02em; }
.mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 11px; color: white; background: var(--green); font-size: 17px; font-weight: 800; }
.eyebrow { margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.hero { padding: 50px 4px 26px; }
.hero h1 { margin: 8px 0 5px; font-size: clamp(32px, 9vw, 42px); line-height: 1.08; letter-spacing: -.055em; }
.date { margin: 0; color: var(--muted); font-size: 14px; }
.habit-panel { padding: 23px; border: 1px solid rgba(230, 233, 225, .8); border-radius: 22px; background: var(--paper); box-shadow: 0 14px 38px rgba(43, 64, 46, .06); }
.todo-panel, .sleep-panel, .weight-panel { margin-top: 16px; padding: 23px; border: 1px solid rgba(230, 233, 225, .8); border-radius: 22px; background: var(--paper); box-shadow: 0 14px 38px rgba(43, 64, 46, .06); }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.03em; }
.progress { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.sun { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 13px; color: #9b7c36; background: #f8f1dd; font-size: 19px; }
.todo-icon, .sleep-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 13px; color: var(--green); background: var(--mint); font-size: 19px; }
.sleep-icon { color: #657895; background: #eef1f7; }
.weight-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 13px; color: var(--green); background: var(--mint); font-size: 13px; }
.habit-list { display: grid; gap: 9px; margin: 14px 0 20px; padding: 0; list-style: none; }
.habit-item { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.check-button { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border: 1.5px solid #9aa89d; border-radius: 12px; color: transparent; background: var(--paper); cursor: pointer; font-size: 20px; transition: background .15s, border-color .15s, transform .15s; -webkit-tap-highlight-color: transparent; }
.check-button:active { transform: scale(.94); }
.check-button[aria-pressed="true"] { border-color: var(--green); color: white; background: var(--green); }
.habit-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 15px; font-weight: 600; }
.habit-item.is-done .habit-name { color: var(--muted); text-decoration: line-through; }
.todo-list { display: grid; gap: 9px; margin: 14px 0 20px; padding: 0; list-style: none; }
.todo-item { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.todo-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.todo-item.is-done .todo-name { color: var(--muted); text-decoration: line-through; }
.todo-actions { display: flex; align-items: center; gap: 3px; }
.task-action { min-width: 44px; min-height: 44px; padding: 0 7px; border: 0; border-radius: 10px; color: var(--green-dark); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.task-action:hover { background: var(--mint); }
.task-action.remove-task { color: var(--danger); }
.remove-button { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 10px; color: var(--danger); background: transparent; cursor: pointer; font-size: 22px; }
.remove-button:hover { color: var(--danger); background: var(--danger-hover); }
.empty-state { padding: 24px 8px 20px; text-align: center; }
.empty-icon { display: grid; width: 42px; height: 42px; margin: 0 auto 10px; place-items: center; border-radius: 15px; color: var(--green); background: var(--mint); font-size: 26px; }
.empty-state h3 { margin: 0 0 5px; font-size: 15px; }
.empty-state p { max-width: 260px; margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.5; }
.add-form { padding-top: 17px; border-top: 1px solid var(--line); }
.add-form label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; height: 48px; padding: 0 13px; border: 1px solid #9aa89d; border-radius: 13px; color: var(--ink); background: var(--paper); font-size: 14px; outline: none; }
.input-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(53, 110, 83, .12); }
.input-row input::placeholder { color: #a1aaa1; }
.add-button { min-width: 68px; height: 48px; padding: 0 17px; border: 0; border-radius: 13px; color: white; background: var(--green); cursor: pointer; font-weight: 700; }
.add-button:hover { background: var(--green-dark); }
.sleep-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 16px; }
.sleep-form label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.sleep-form input { width: 100%; min-width: 0; height: 48px; padding: 0 10px; border: 1px solid #9aa89d; border-radius: 13px; color: var(--ink); background: var(--paper); font: inherit; }
.sleep-form input:focus-visible { border-color: var(--green); outline: 3px solid rgba(53, 110, 83, .12); }
.sleep-form .add-button { grid-column: 1 / -1; }
.sleep-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.weight-chart { min-height: 90px; padding: 12px 0 4px; color: var(--muted); font-size: 13px; text-align: center; }
.weight-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.weight-chart text { fill: var(--muted); font-family: inherit; font-size: 11px; }
.weight-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.weight-point { fill: var(--paper); stroke: var(--green); stroke-width: 3; }
.weight-grid { stroke: var(--line); stroke-width: 1; }
.weight-list { display: grid; gap: 8px; margin: 8px 0 18px; padding: 0; list-style: none; }
.weight-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.weight-entry-label { min-width: 0; font-size: 13px; font-weight: 600; }
.weight-entry-actions { display: flex; gap: 2px; }
.weight-form { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.weight-form h3 { margin: 0 0 3px; font-size: 15px; }
.weight-form label { font-size: 13px; font-weight: 700; }
.weight-form input { width: 100%; min-width: 0; height: 48px; padding: 0 12px; border: 1px solid #9aa89d; border-radius: 13px; color: var(--ink); background: var(--paper); font: inherit; }
.weight-form input:focus-visible { border-color: var(--green); outline: 3px solid rgba(53, 110, 83, .12); }
.weight-form-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.weight-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.check-button:focus-visible, .remove-button:focus-visible, .add-button:focus-visible, .task-action:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.storage-message { margin: 10px 0 0; color: var(--danger); font-size: 12px; line-height: 1.4; }
footer { padding: 18px 8px 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }

@media (max-width: 380px) {
  .app-shell { width: min(100% - 22px, 560px); }
  .preferences { gap: 8px; }
  .preference-button { flex-basis: 44px; width: 44px; height: 44px; }
  .preference-buttons { gap: 2px; }
  .habit-panel, .todo-panel, .sleep-panel, .weight-panel { padding: 18px 15px; }
  .hero { padding-top: 38px; }
  .todo-item { gap: 7px; padding-inline: 7px; }
  .task-action { min-width: 40px; padding-inline: 4px; font-size: 11px; }
}
