@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Serif+SC:wght@600;700&display=swap");

:root {
  --ink: #10231d;
  --muted: #697871;
  --paper: #f4f1e8;
  --paper-deep: #e9e4d7;
  --card: rgba(255, 254, 249, 0.86);
  --line: rgba(16, 35, 29, 0.12);
  --sage: #6f8f7d;
  --sage-light: #dbe6dc;
  --amber: #d7a84c;
  --coral: #d97861;
  --blue: #6e8c98;
  --ease-enter: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-move: cubic-bezier(0.25, 1, 0.5, 1);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); font-family: "Noto Sans SC", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .16; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 22px 22px; display: flex; flex-direction: column; background: var(--ink); color: #f6f1e5; }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; padding: 0 8px 34px; }
.brand-mark { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.28); display: grid; place-items: center; font-family: "Noto Serif SC"; border-radius: 50%; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: "Noto Serif SC"; letter-spacing: .08em; }
.brand small { color: rgba(255,255,255,.46); font: 10px/1.5 "DM Mono"; letter-spacing: .19em; margin-top: 3px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.58); padding: 13px 14px; display: flex; align-items: center; gap: 13px; text-align: left; transition: color 160ms ease, background-color 160ms ease, transform 140ms var(--ease-enter); }
.nav-item span { width: 20px; font-size: 17px; text-align: center; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-item:active { transform: scale(.98); }
.sidebar-note { margin-top: auto; margin-bottom: 25px; padding: 18px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.035); position: relative; }
.sidebar-note p { margin: 7px 0 0; color: rgba(255,255,255,.62); font-family: "Noto Serif SC"; font-size: 12px; line-height: 1.8; }
.pulse-dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: #a8c5b1; box-shadow: 0 0 0 5px rgba(168,197,177,.08); }
.profile { border-top: 1px solid rgba(255,255,255,.09); padding-top: 20px; display: grid; grid-template-columns: 35px 1fr 32px; align-items: center; gap: 10px; }
.avatar { width: 35px; height: 35px; border-radius: 50%; background: #d9b777; color: var(--ink); display: grid; place-items: center; font: 600 14px "Noto Serif SC"; }
.profile strong, .profile small { display: block; }
.profile strong { font-size: 12px; }
.profile small { font-size: 10px; color: rgba(255,255,255,.42); margin-top: 3px; }
.main-content { padding: 42px clamp(28px, 5vw, 76px) 70px; max-width: 1500px; width: 100%; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; margin-bottom: 42px; }
.eyebrow, .kicker { margin: 0; font: 500 10px/1.2 "DM Mono"; letter-spacing: .18em; color: var(--sage); }
.topbar h1 { font: 700 clamp(26px, 3vw, 40px)/1.2 "Noto Serif SC"; margin: 9px 0 0; letter-spacing: -.04em; }
.top-actions, .date-jump { display: flex; align-items: center; gap: 9px; }
.sync-button { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.52); border-radius: 12px; padding: 11px 13px; font-size: 10px; }
.sync-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(215,168,76,.12); }
.sync-button.connected .sync-indicator, .sync-status-card.connected .sync-indicator { background: var(--sage); box-shadow: 0 0 0 4px rgba(111,143,125,.12); }
.sync-button.syncing .sync-indicator { animation: syncPulse 1s ease infinite alternate; }
@keyframes syncPulse { to { opacity: .3; transform: scale(.72); } }
.date-jump { background: rgba(255,255,255,.52); border: 1px solid var(--line); padding: 8px 12px; border-radius: 12px; font: 12px "DM Mono"; }
.date-jump select { border: 0; background: transparent; outline: none; font-weight: 500; }
.primary-button, .secondary-button { border: 0; border-radius: 11px; padding: 11px 17px; font-weight: 600; font-size: 12px; transition: transform 140ms var(--ease-enter), background-color 180ms ease, color 180ms ease; }
.primary-button { background: var(--ink); color: #fff; }
.secondary-button { background: var(--paper-deep); }
.primary-button:active, .secondary-button:active, .round-button:active, .icon-button:active { transform: scale(.97); }
.icon-button { width: 35px; height: 35px; padding: 0; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: inherit; transition: transform 140ms var(--ease-enter), background-color 160ms ease; }
.view { display: none; opacity: 0; transform: translateY(8px); }
.view.active { display: block; animation: viewIn 260ms var(--ease-enter) forwards; }
@keyframes viewIn { to { opacity: 1; transform: translateY(0); } }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); gap: 18px; }
.hero-card, .mood-card, .panel, .calendar-card, .journal-strip { border: 1px solid var(--line); background: var(--card); border-radius: 20px; }
.hero-card { min-height: 270px; position: relative; overflow: hidden; padding: 38px 42px; display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; }
.hero-card::before { content: ""; position: absolute; width: 380px; height: 380px; right: -170px; top: -190px; border-radius: 50%; border: 1px solid rgba(255,255,255,.09); box-shadow: 0 0 0 46px rgba(255,255,255,.025), 0 0 0 92px rgba(255,255,255,.02); }
.hero-copy { position: relative; z-index: 1; }
.date-chip { display: inline-block; color: #c6d9cc; font: 10px "DM Mono"; letter-spacing: .12em; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; padding: 7px 10px; }
.hero-copy h2 { font: 600 clamp(24px, 3vw, 38px)/1.5 "Noto Serif SC"; letter-spacing: -.04em; margin: 25px 0 15px; }
.hero-copy p { color: rgba(255,255,255,.5); font-size: 12px; margin: 0; }
.progress-orbit { --p: calc(var(--progress) * 1%); width: 142px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; margin-left: 24px; background: conic-gradient(#a8c5b1 var(--p), rgba(255,255,255,.09) 0); position: relative; transition: background 280ms var(--ease-enter); }
.progress-orbit::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--ink); border: 1px solid rgba(255,255,255,.08); }
.progress-orbit div { position: relative; z-index: 1; text-align: center; }
.progress-orbit strong, .progress-orbit span { display: block; }
.progress-orbit strong { font: 600 30px "DM Mono"; }
.progress-orbit span { color: rgba(255,255,255,.44); font-size: 10px; margin-top: 5px; }
.mood-card { padding: 28px; display: flex; flex-direction: column; justify-content: space-between; }
.section-heading { display: flex; justify-content: space-between; align-items: end; }
.section-heading h2, .section-heading h3 { font-family: "Noto Serif SC"; margin: 7px 0 0; }
.section-heading h3 { font-size: 18px; }
.mood-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 25px 0; }
.mood-options button { border: 1px solid var(--line); border-radius: 12px; background: transparent; padding: 15px 7px; font-size: 11px; transition: transform 140ms var(--ease-enter), background-color 160ms ease, border-color 160ms ease; }
.mood-options button span { display: block; font-size: 21px; margin-bottom: 7px; }
.mood-options button.selected { background: var(--sage-light); border-color: var(--sage); }
.mood-options button:active { transform: scale(.96); }
.mood-note { font: 11px/1.7 "Noto Serif SC"; color: var(--muted); margin: 0; }
.habits-heading { margin: 44px 0 17px; }
.habits-heading h2 { font-size: 24px; }
.text-button { border: 0; background: transparent; font-size: 12px; color: var(--muted); }
.text-button span { margin-left: 5px; transition: transform 160ms var(--ease-enter); display: inline-block; }
.text-button:hover span { transform: translateX(3px); }
.habit-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.habit-card { position: relative; min-height: 172px; border: 1px solid var(--line); background: var(--card); border-radius: 17px; padding: 21px; cursor: pointer; overflow: hidden; transition: transform 180ms var(--ease-enter), border-color 180ms ease, background-color 180ms ease; }
.habit-card::after { content: ""; position: absolute; inset: auto -30px -54px auto; width: 100px; height: 100px; border-radius: 50%; background: var(--habit-soft); opacity: .55; }
.habit-card.completed { background: var(--habit-soft); border-color: var(--habit-color); }
.habit-card-top { display: flex; justify-content: space-between; align-items: center; }
.habit-icon { width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; background: var(--habit-soft); color: var(--habit-color); }
.habit-check { width: 23px; height: 23px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: transparent; transition: transform 160ms var(--ease-enter), color 160ms ease, background-color 160ms ease; }
.habit-card.completed .habit-check { background: var(--habit-color); color: white; border-color: transparent; transform: scale(1.06); }
.habit-card h3 { font: 600 15px "Noto Serif SC"; margin: 22px 0 6px; }
.habit-card p { color: var(--muted); font-size: 10px; margin: 0; }
.journal-strip { margin-top: 24px; padding: 21px 25px; display: grid; grid-template-columns: 44px 1fr 40px; align-items: center; gap: 17px; cursor: pointer; transition: transform 180ms var(--ease-enter), border-color 180ms ease; }
.journal-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-deep); }
.journal-strip h3 { margin: 5px 0 3px; font: 600 16px "Noto Serif SC"; }
.journal-strip p { margin: 0; color: var(--muted); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.round-button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: white; }
.calendar-toolbar, .review-intro, .settings-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.calendar-toolbar h2, .review-intro h2, .settings-intro h2 { font: 600 30px "Noto Serif SC"; margin: 7px 0 0; }
.review-intro p, .settings-intro p { color: var(--muted); margin: 8px 0 0; font-size: 12px; }
.calendar-controls { display: flex; gap: 8px; }
.calendar-card { padding: 17px; overflow: hidden; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays span { text-align: center; color: var(--muted); font: 10px "DM Mono"; padding: 10px 0 16px; }
.calendar-day { min-height: 116px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); padding: 10px; background: transparent; text-align: left; position: relative; transition: background-color 150ms ease; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { opacity: .28; }
.calendar-day.today .day-number { background: var(--ink); color: white; }
.day-number { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 11px "DM Mono"; }
.day-status { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.day-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.day-status i.done { background: var(--sage); }
.day-mood { position: absolute; right: 10px; top: 13px; font-size: 13px; }
.calendar-legend { display: flex; gap: 20px; justify-content: flex-end; margin-top: 14px; color: var(--muted); font-size: 10px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.legend-dot.complete { background: var(--sage); } .legend-dot.partial { background: var(--amber); } .legend-dot.empty { border: 1px solid var(--line); }
.score-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 15px; }
.score-card { background: var(--card); border: 1px solid var(--line); border-radius: 17px; padding: 20px; }
.score-card-header { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.score-card strong { display: block; font: 500 30px "DM Mono"; margin: 17px 0 8px; }
.score-card p { font-size: 10px; color: var(--muted); margin: 0; }
.review-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 15px; }
.panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.panel-heading h3 { margin: 6px 0 0; font: 600 17px "Noto Serif SC"; }
.panel-meta, .autosave { color: var(--muted); font: 9px "DM Mono"; }
.bar-chart { height: 180px; display: flex; align-items: end; gap: 4px; border-bottom: 1px solid var(--line); padding-top: 15px; }
.bar { flex: 1; min-width: 3px; background: var(--sage-light); border-radius: 3px 3px 0 0; transform-origin: bottom; animation: barGrow 500ms var(--ease-enter) both; }
.bar.high { background: var(--sage); }
@keyframes barGrow { from { transform: scaleY(.05); opacity: .2; } }
.week-row { display: grid; grid-template-columns: 72px 1fr 48px; align-items: center; gap: 12px; margin: 14px 0; font-size: 10px; }
.week-track { height: 7px; background: var(--paper-deep); border-radius: 999px; overflow: hidden; }
.week-fill { height: 100%; background: var(--coral); border-radius: inherit; transform-origin: left; animation: fillGrow 450ms var(--ease-enter) both; }
@keyframes fillGrow { from { transform: scaleX(0); } }
.week-result { text-align: right; color: var(--muted); }
.week-result.pass { color: var(--sage); font-weight: 700; }
.review-draft { margin-top: 15px; }
.review-draft textarea { width: 100%; min-height: 220px; border: 0; resize: vertical; outline: none; background: transparent; line-height: 1.9; font-size: 13px; }
.habit-settings-list { display: grid; gap: 12px; }
.setting-row { display: grid; grid-template-columns: 48px 1.2fr .8fr .8fr 90px 40px; align-items: center; gap: 18px; padding: 17px 20px; border: 1px solid var(--line); background: var(--card); border-radius: 16px; }
.setting-row .habit-icon { width: 42px; height: 42px; }
.setting-main strong, .setting-main span { display: block; }
.setting-main strong { font: 600 14px "Noto Serif SC"; }
.setting-main span, .setting-cell span { color: var(--muted); font-size: 9px; margin-top: 4px; }
.setting-cell strong, .setting-cell span { display: block; }
.setting-cell strong { font-size: 11px; }
.status-pill { justify-self: start; color: #416353; background: var(--sage-light); border-radius: 999px; padding: 6px 9px; font-size: 9px; }
.day-drawer { position: fixed; z-index: 40; top: 0; right: 0; width: min(480px, 94vw); height: 100vh; background: #f9f6ee; box-shadow: -20px 0 70px rgba(16,35,29,.16); transform: translate3d(102%,0,0); transition: transform 300ms var(--ease-move); display: flex; flex-direction: column; }
.day-drawer.open { transform: translate3d(0,0,0); }
.drawer-backdrop { position: fixed; z-index: 39; inset: 0; background: rgba(6,18,14,.38); opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease-enter); }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.day-drawer > header { display: flex; justify-content: space-between; align-items: start; padding: 30px 32px 23px; border-bottom: 1px solid var(--line); }
.day-drawer h2 { font: 600 28px "Noto Serif SC"; margin: 6px 0 0; }
.drawer-content { padding: 26px 32px; overflow-y: auto; flex: 1; }
.drawer-content section + section { margin-top: 32px; }
.drawer-section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.drawer-section-title h3 { margin: 0; font: 600 14px "Noto Serif SC"; }
.drawer-section-title span { color: var(--muted); font: 9px "DM Mono"; }
.drawer-habits { display: grid; gap: 8px; }
.drawer-habit { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 13px; text-align: left; }
.drawer-habit > span:first-child { display: flex; gap: 11px; align-items: center; }
.drawer-habit.done { background: var(--habit-soft); border-color: var(--habit-color); }
.drawer-habit .habit-check { flex: 0 0 auto; }
.mood-options.compact { margin: 0; }
.mood-options.compact button { padding: 10px 5px; }
#dayNote { width: 100%; min-height: 160px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.52); outline: none; padding: 14px; line-height: 1.7; font-size: 12px; }
.day-drawer > footer { padding: 18px 32px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.day-drawer > footer span { color: var(--muted); font-size: 9px; }
dialog { border: 0; border-radius: 20px; background: #f9f6ee; color: var(--ink); padding: 0; width: min(590px, calc(100vw - 32px)); box-shadow: 0 30px 100px rgba(16,35,29,.25); }
dialog::backdrop { background: rgba(6,18,14,.45); backdrop-filter: blur(3px); }
dialog[open] { animation: dialogIn 250ms var(--ease-enter); }
@keyframes dialogIn { from { opacity: 0; transform: scale(.95) translateY(8px); } }
dialog form > header, dialog form > footer { padding: 23px 26px; display: flex; justify-content: space-between; align-items: center; }
dialog form > header { border-bottom: 1px solid var(--line); }
dialog h2 { margin: 5px 0 0; font: 600 23px "Noto Serif SC"; }
.form-grid { padding: 25px 26px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid label { color: var(--muted); font-size: 10px; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: rgba(255,255,255,.55); margin-top: 6px; outline: none; }
.form-hint { margin: 7px 26px 0; color: var(--muted); font-size: 10px; }
dialog form > footer { justify-content: flex-end; gap: 8px; }
.sync-content { padding: 25px 26px 10px; }
.sync-content > p { color: var(--muted); font-size: 11px; line-height: 1.8; margin: 19px 0; }
.sync-illustration { min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 13px; border-radius: 14px; background: var(--ink); color: white; font: 10px "DM Mono"; }
.sync-illustration i { color: #a8c5b1; font-style: normal; }
.sync-content label { color: var(--muted); font-size: 10px; }
.key-field { display: grid; grid-template-columns: 1fr auto; margin-top: 7px; }
.key-field input { min-width: 0; border: 1px solid var(--line); border-radius: 10px 0 0 10px; padding: 11px; background: rgba(255,255,255,.58); outline: none; font: 10px "DM Mono"; }
.key-field button { border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--paper-deep); padding: 0 13px; font-size: 10px; }
.sync-status-card { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: center; margin: 16px 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.sync-status-card strong, .sync-status-card small { display: block; }
.sync-status-card strong { font-size: 11px; }.sync-status-card small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.full-button { width: 100%; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 28px; display: flex; align-items: center; gap: 9px; background: var(--ink); color: white; padding: 11px 15px; border-radius: 999px; opacity: 0; transform: translate3d(-50%,8px,0); pointer-events: none; transition: opacity 180ms var(--ease-enter), transform 180ms var(--ease-enter); }
.toast.show { opacity: 1; transform: translate3d(-50%,0,0); }
.toast span { color: #a8c5b1; }.toast p { margin: 0; font-size: 11px; }

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
  .habit-card:hover, .journal-strip:hover { transform: translateY(-2px); border-color: rgba(16,35,29,.25); }
  .calendar-day:hover { background: rgba(111,143,125,.08); }
  .icon-button:hover { background: rgba(255,255,255,.11); }
}
@media (max-width: 1050px) {
  .habit-grid, .score-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .review-grid { grid-template-columns: 1fr; }
  .mood-card { min-height: 230px; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; top: auto; bottom: 0; width: 100%; height: 68px; padding: 8px 12px; display: block; }
  .brand, .sidebar-note, .profile { display: none; }
  .main-nav { grid-template-columns: repeat(4, 1fr); }
  .nav-item { display: grid; justify-items: center; gap: 2px; padding: 7px 2px; font-size: 9px; }
  .main-content { padding: 25px 16px 100px; }
  .topbar { display: block; margin-bottom: 27px; }
  .top-actions { margin-top: 19px; justify-content: space-between; }
  .sync-button { padding: 11px; }
  .sync-button #syncLabel { display: none; }
  .hero-card { padding: 28px 22px; min-height: 300px; align-items: flex-start; }
  .progress-orbit { width: 100px; position: absolute; right: 22px; bottom: 22px; }
  .habit-grid { grid-template-columns: 1fr 1fr; }
  .habit-card { min-height: 154px; padding: 17px; }
  .calendar-card { padding: 7px; }
  .calendar-day { min-height: 82px; padding: 6px; }
  .day-status { gap: 2px; margin-top: 10px; }
  .score-grid { grid-template-columns: 1fr 1fr; }
  .setting-row { grid-template-columns: 42px 1fr 36px; gap: 12px; }
  .setting-row .setting-cell, .setting-row .status-pill { display: none; }
  .review-intro, .settings-intro { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
