:root {
  --rose-50: #ffebf2;
  --rose-100: #fbd4dd;
  --rose-200: #f4dceb;
  --rose-300: #efcce2;
  --mauve: #a98780;
  --sage: #aebd9f;
  --mint: #e1edd5;
  --sky: #c5c6e3;
  --lavender: #efcce2;
  --peach: #f7d7c5;
  --butter: #fde7b2;
  --blush: #ffb7c3;
  --cream: #fcf7ef;
  --paper: #fffdf8;
  --surface: #fffbf5;
  --surface-soft: #fff8ef;
  --notebook-paper: #fffefb;
  --paper-line: rgba(126, 83, 75, .115);
  --tape-pink: rgba(251, 212, 221, .78);
  --tape-mint: rgba(225, 237, 213, .78);
  --tape-blue: rgba(197, 198, 227, .52);
  --ink: #3f3431;
  --muted: #8f7d78;
  --line: rgba(91, 66, 60, .09);
  --shadow: 0 18px 46px rgba(77, 54, 48, .10);
  --soft-shadow: 0 10px 28px rgba(77, 54, 48, .075);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background:
    linear-gradient(90deg, transparent 0 72px, rgba(251, 212, 221, .16) 72px 73px, transparent 74px),
    linear-gradient(90deg, rgba(126, 83, 75, .026) 1px, transparent 1px),
    linear-gradient(rgba(126, 83, 75, .026) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(239, 204, 226, .24), transparent 34vw),
    radial-gradient(circle at 100% 12%, rgba(197, 198, 227, .24), transparent 28vw),
    linear-gradient(145deg, var(--paper), var(--cream) 52%, #fbf6ee);
  background-size: auto, 28px 28px, 28px 28px, auto, auto, auto;
}

body.is-offline::before {
  content: "Sem conexao - seus dados continuam visiveis, salve quando voltar";
  position: fixed;
  left: 50%;
  bottom: 82px;
  z-index: 50;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 600;
}

.app-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow);
}

button, input, select, textarea {
  font: inherit;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(156, 172, 143, .45);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(760px, 100%);
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(520px, 100%);
  text-align: center;
}

.auth-mascot {
  width: min(132px, 38vw);
  height: auto;
  display: block;
  margin: 0 auto 14px;
  border-radius: 30px;
  filter: drop-shadow(0 12px 22px rgba(77, 54, 48, .10));
}

.brand-mark, .app-badge {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--rose-100);
  color: var(--mauve);
  font-size: 30px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--mauve);
  font-family: "Cormorant Garamond", "Instrument Serif", "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: none;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.06;
  font-weight: 500;
}

h2 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 500;
}

.soft-text {
  color: var(--muted);
  line-height: 1.55;
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: #ffebf2;
  border: 1px solid rgba(216, 117, 101, .25);
}

.debug-notice {
  background: var(--surface);
  border-color: rgba(95, 63, 58, .22);
  text-align: left;
}

.debug-notice dl {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0 0;
}

.debug-notice dt {
  color: var(--muted);
  font-weight: 600;
}

.debug-notice dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 650;
  text-align: left;
}

.span-2 { grid-column: span 2; }

.primary-action, .ghost-button, .icon-action, .check-button, .tool, .soft-action {
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}

.primary-action {
  display: inline-grid;
  place-items: center;
  padding: 10px 16px;
  background: var(--ink);
  color: white;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(95, 63, 58, .18);
}

.ghost-button, .tool {
  padding: 9px 13px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  color: var(--muted);
}

.soft-action {
  display: inline-grid;
  place-items: center;
  padding: 9px 13px;
  background: var(--blush);
  color: var(--ink);
  font-weight: 600;
}

.icon-action, .check-button {
  width: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--muted) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--surface) 72%, transparent);
}

.check-button:disabled {
  opacity: .45;
  cursor: default;
}

.app-shell {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px 10px;
  border-right: 1px solid rgba(91, 66, 60, .045);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  backdrop-filter: blur(18px);
}

.side-nav a {
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 0 18px 18px 0;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 600;
  transform: translateX(-8px);
}

.side-nav a.active, .side-nav a:hover {
  background: rgba(251, 212, 221, .78);
  color: var(--ink);
}

.today-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px 28px 96px;
}

.today-hero {
  min-height: 190px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--paper) 84%, transparent), rgba(247, 215, 197, .46));
  box-shadow: var(--shadow);
}

.today-hero p:last-child {
  max-width: 520px;
  color: var(--muted);
  font-size: 1.12rem;
}

.hero-mascot {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.mascot-face {
  width: 118px;
  height: 118px;
  position: relative;
  border-radius: 48% 52% 46% 54%;
  background: radial-gradient(circle at 35% 34%, var(--paper), var(--rose-100) 62%, var(--rose-200));
  border: 1px solid var(--line);
  box-shadow: inset 0 -8px 16px rgba(185, 134, 138, .12);
}

.mascot-face::before, .mascot-face::after {
  content: "";
  position: absolute;
  top: 38px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

.mascot-face::before { left: 37px; }
.mascot-face::after { right: 37px; }
.mascot-face span {
  position: absolute;
  left: 44px;
  top: 68px;
  width: 30px;
  height: 14px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 22px 22px;
}

.summary-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.summary-strip span {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 66%, transparent);
  color: var(--muted);
  font-weight: 500;
}

.home-page {
  width: min(1180px, 100%);
  padding-top: 22px;
}

.home-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, 18%);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid rgba(91, 66, 60, .065);
  border-radius: 18px 34px 34px 18px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--paper) 92%, transparent), rgba(255,247,236,.88)),
    radial-gradient(circle at 88% 20%, rgba(239, 204, 226, .38), transparent 32%);
  box-shadow: var(--shadow);
}

.home-hero::before {
  content: "";
  position: absolute;
  left: clamp(18px, 4vw, 44px);
  top: 0;
  width: min(180px, 28%);
  height: 34px;
  border-radius: 0 0 12px 12px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.16) 0 14px, transparent 14px 28px),
    var(--tape-pink);
  background-size: 28px 100%, auto;
  transform: translateY(-9px) rotate(-1deg);
  opacity: .78;
}

.home-hero::after {
  content: "✦";
  position: absolute;
  right: 23%;
  bottom: 18px;
  color: color-mix(in srgb, var(--mauve) 45%, transparent);
  font-size: 1.2rem;
}

.home-hero h1 {
  max-width: 680px;
  margin-bottom: 10px;
  font-family: "Cormorant Garamond", "Instrument Serif", "Playfair Display", Georgia, serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.home-hero p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.55;
}

.home-mascot {
  display: grid;
  gap: 8px;
  justify-items: center;
  justify-self: end;
  width: clamp(104px, 14vw, 160px);
  max-width: 20%;
  min-width: 104px;
  color: var(--muted);
  text-align: center;
  animation: mascot-arrive 240ms ease-out both;
}

.home-mascot img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 32px;
  filter: drop-shadow(0 14px 24px rgba(77, 54, 48, .10));
}

.home-mascot small {
  max-width: 150px;
  font-size: .82rem;
  line-height: 1.35;
}

@keyframes mascot-arrive {
  from {
    opacity: 0;
    transform: scale(.96) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.home-date-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid rgba(91, 66, 60, .055);
  border-radius: 26px;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(91, 66, 60, .035) 48% 49%, transparent 49%),
    color-mix(in srgb, var(--surface) 72%, transparent);
  box-shadow: var(--soft-shadow);
}

.home-date-strip a {
  min-height: 74px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(91, 66, 60, .045);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 74%, transparent);
  color: var(--muted);
  box-shadow: 0 8px 20px rgba(77, 54, 48, .045);
}

.home-date-strip a.active {
  background:
    linear-gradient(90deg, rgba(255,255,255,.18) 0 12px, transparent 12px 24px),
    linear-gradient(180deg, var(--rose-100), var(--rose-300));
  background-size: 24px 100%, auto;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(167, 127, 134, .14);
}

.home-date-strip span {
  font-size: .82rem;
}

.home-date-strip strong {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 68%, transparent);
  color: var(--ink);
  font-weight: 500;
}

.home-date-strip a.active strong {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  color: var(--ink);
}

.home-progress-card,
.home-card {
  position: relative;
  border: 1px solid rgba(91, 66, 60, .07);
  border-radius: 22px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  box-shadow: var(--soft-shadow);
}

.home-card::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -9px;
  width: 74px;
  height: 20px;
  border-radius: 5px;
  background: var(--tape-mint);
  transform: rotate(-1.5deg);
  opacity: .75;
}

.home-card:nth-child(2n)::before {
  background: var(--tape-pink);
  transform: rotate(1.2deg);
}

.home-card:nth-child(3n)::before {
  background: var(--tape-blue);
}

.home-progress-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 18px 0;
  padding: 22px;
}

.home-progress-card span,
.home-progress-card small,
.home-card small,
.home-card p,
.home-card .section-title a,
.home-card .section-title span {
  color: var(--muted);
}

.home-progress-card strong {
  display: block;
  margin: 4px 0;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
}

.progress-ring {
  width: 92px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 58%, transparent 59%),
    conic-gradient(var(--sage) var(--progress), rgba(168,185,167,.16) 0);
}

.progress-ring span {
  color: var(--ink);
  font-weight: 600;
}

.home-grid {
  column-count: 2;
  column-gap: 24px;
}

.home-card {
  display: grid;
  gap: 16px;
  margin: 0 0 24px;
  padding: 24px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.home-card .section-title h2 {
  display: inline-grid;
  padding: 6px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
  font-family: "Cormorant Garamond", "Instrument Serif", "Playfair Display", Georgia, serif;
  font-size: clamp(1.25rem, 2.1vw, 1.65rem);
}

.home-card .section-title a {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
}

.home-priority-list,
.home-task-list,
.glance-list {
  display: grid;
  gap: 12px;
}

.home-priority-list article,
.home-task-list article,
.glance-list article {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  box-shadow: inset 0 -1px 0 rgba(91, 66, 60, .04);
}

.home-task-list article:nth-child(5n+1),
.habit-card:nth-child(5n+1),
.glance-list article:nth-child(5n+1) {
  background: rgba(244, 222, 219, .72);
}

.home-task-list article:nth-child(5n+2),
.habit-card:nth-child(5n+2),
.glance-list article:nth-child(5n+2) {
  background: rgba(238, 231, 251, .76);
}

.home-task-list article:nth-child(5n+3),
.habit-card:nth-child(5n+3),
.glance-list article:nth-child(5n+3) {
  background: rgba(223, 238, 229, .78);
}

.home-task-list article:nth-child(5n+4),
.habit-card:nth-child(5n+4),
.glance-list article:nth-child(5n+4) {
  background: rgba(231, 243, 247, .82);
}

.home-task-list article:nth-child(5n+5),
.habit-card:nth-child(5n+5),
.glance-list article:nth-child(5n+5) {
  background: rgba(248, 228, 214, .76);
}

.home-priority-list article.is-done,
.home-task-list article.is-done {
  opacity: .64;
}

.home-priority-list article.is-empty {
  color: var(--muted);
}

.home-priority-list article.is-empty > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--lavender);
  color: var(--ink);
}

.home-task-list article div {
  min-width: 0;
}

.home-task-list strong,
.glance-list strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.home-habits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.habit-card {
  min-height: 82px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 9px;
  justify-items: start;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  border: 1px solid rgba(91, 66, 60, .045);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
  transition: transform 180ms ease, background 180ms ease;
}

.habit-card:active,
.quick-mood button:active,
.water-actions button:active {
  transform: scale(.98);
}

.habit-card span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--mint);
  font-size: .95rem;
  grid-row: span 2;
}

.habit-card strong,
.habit-card small {
  min-width: 0;
  max-width: 100%;
}

.habit-card strong {
  overflow-wrap: anywhere;
  font-size: .95rem;
  line-height: 1.2;
}

.habit-card small {
  color: var(--muted);
  font-size: .82rem;
}

.habit-card.is-done {
  background: rgba(223, 238, 229, .82);
}

.water-bottle {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.water-bottle > div {
  position: relative;
  width: 76px;
  height: 132px;
  overflow: hidden;
  border: 2px solid rgba(128, 167, 178, .32);
  border-radius: 24px 24px 30px 30px;
  background: rgba(231,243,247,.55);
}

.water-bottle > div::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: -9px;
  height: 18px;
  border-radius: 8px 8px 2px 2px;
  background: rgba(128, 167, 178, .28);
}

.water-bottle span {
  position: absolute;
  inset: auto 0 0;
  height: var(--water-level);
  background: linear-gradient(180deg, #bfe3ea, #8fc9d6);
  transition: height 220ms ease;
}

.water-bottle strong {
  font-size: 2rem;
  font-weight: 600;
}

.water-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.water-actions .water-drop {
  width: auto;
  min-height: 48px;
  border-radius: 18px;
  background: var(--sky);
  color: var(--ink);
  font-weight: 600;
}

.quick-mood {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.quick-mood button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  font-size: 1.35rem;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.quick-mood button.active {
  background: var(--peach);
}

.activity-quick-form {
  grid-template-columns: minmax(130px, 1fr) minmax(92px, .6fr) minmax(120px, .8fr);
}

.activity-today-list {
  display: grid;
  gap: 10px;
}

.activity-today-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--mint) 52%, var(--paper));
}

.activity-today-list span,
.activity-today-list strong,
.activity-today-list small {
  min-width: 0;
}

.activity-today-list span {
  font-weight: 600;
}

.activity-today-list small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.diary-shortcut-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.diary-shortcut-card::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 18px;
  width: 70px;
  height: 18px;
  border-radius: 4px;
  background:
    radial-gradient(circle, rgba(91, 66, 60, .18) 2px, transparent 2.5px),
    var(--tape-pink);
  background-size: 12px 12px, auto;
  transform: rotate(2deg);
  opacity: .55;
}

.shortcut-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--lavender);
}

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

.glance-list article {
  display: grid;
  align-items: start;
}

.tablet-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  grid-column: span 3;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  box-shadow: 0 6px 20px rgba(108, 72, 64, .065);
}

.tasks-panel, .handwriting-panel, .diary-panel, .calendar-panel, .notebook-shortcut {
  grid-column: span 6;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}

.inline-form, .task-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.task-form {
  margin-bottom: 14px;
}

.task-form input:first-child {
  flex: 1;
}

.task-form select, .task-form input[type="time"] {
  width: min(150px, 28vw);
}

.priority-list, .item-list, .habit-list, .mini-history, .book-shelf {
  display: grid;
  gap: 10px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 56%, transparent);
}

.list-item div {
  flex: 1;
  min-width: 0;
}

.list-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.list-item small, .book-shelf small {
  display: block;
  color: var(--muted);
}

.is-done {
  opacity: .72;
}

.is-done strong {
  text-decoration: line-through;
}

.water-cups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 10px;
}

.water-drop {
  min-height: 58px;
  border: 1px solid rgba(124, 164, 177, .28);
  border-radius: 50% 50% 52% 48%;
  background: linear-gradient(to top, #b9dce5 var(--water-level), color-mix(in srgb, var(--paper) 74%, transparent) var(--water-level));
  cursor: pointer;
}

.water-drop.filled {
  background: #b9dce5;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.mood-chip input {
  position: absolute;
  opacity: 0;
}

.mood-chip span {
  min-height: 68px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  cursor: pointer;
  font-size: 1.35rem;
}

.mood-chip small {
  font-size: .72rem;
}

.mood-chip input:checked + span {
  background: var(--rose-100);
  border-color: var(--rose-300);
}

.habit-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.habit-pill {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.habit-pill.is-done {
  background: rgba(156, 172, 143, .22);
}

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

.canvas-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.tool.active {
  background: var(--rose-100);
  color: var(--ink);
}

#handwritingCanvas {
  width: 100%;
  aspect-ratio: 5 / 3;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(circle, rgba(143, 125, 120, .13) 1px, transparent 1.15px),
    linear-gradient(var(--notebook-paper), var(--notebook-paper));
  background-size: 22px 22px, auto;
  touch-action: none;
}

.notebook-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.routine-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.week-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.diary-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.evolution-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.settings-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.history-page {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

.reminders-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px 24px 110px;
}

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

.routine-create {
  grid-column: span 2;
}

.routine-list-panel {
  grid-column: span 4;
}

.week-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.week-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.week-summary article {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  box-shadow: 0 8px 28px rgba(108, 72, 64, .08);
}

.week-summary span,
.week-summary small {
  color: var(--muted);
}

.week-summary strong {
  font-size: clamp(1.25rem, 2.2vw, 1.8rem);
}

.week-layout {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: start;
}

.week-plan-panel .form-grid label {
  min-width: 0;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.week-priorities-panel {
  grid-column: span 2;
}

.week-priority-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.week-priority-editor .inline-form {
  padding: 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.week-day-card {
  display: grid;
  gap: 10px;
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  color: var(--ink);
  text-decoration: none;
}

.week-day-card.is-today {
  border-color: var(--rose-300);
  background: var(--rose-100);
}

.week-day-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.week-day-card span,
.week-day-card small {
  color: var(--muted);
}

.week-day-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.routine-list {
  display: grid;
  gap: 10px;
}

.routine-row {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 56%, transparent);
  overflow: visible;
}

.routine-row.is-paused {
  opacity: .7;
}

.routine-details summary,
.book-edit-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.routine-details summary::-webkit-details-marker,
.book-edit-card summary::-webkit-details-marker {
  display: none;
}

.routine-details summary span,
.book-edit-card summary span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.routine-details summary strong,
.book-edit-card summary strong {
  overflow-wrap: anywhere;
}

.routine-details summary small,
.book-edit-card summary small {
  color: var(--muted);
}

.routine-details summary em,
.book-edit-card summary em {
  color: var(--muted);
  font-size: .82rem;
  font-style: normal;
}

.routine-details[open] summary,
.book-edit-card[open] summary {
  border-bottom: 1px dashed var(--line);
}

.routine-details > form,
.book-edit-card form {
  position: relative;
  padding: 12px 14px 14px;
}

.routine-details > form,
.book-details-form {
  padding-top: 50px;
}

.card-icon-actions {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 2;
}

.icon-mini,
.more-actions summary {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  color: var(--ink);
  cursor: pointer;
  font-size: .92rem;
}

.icon-mini.danger {
  color: #9f5f61;
}

.more-actions {
  position: relative;
  width: 32px;
  height: 32px;
}

.more-actions summary {
  list-style: none;
}

.more-actions summary::-webkit-details-marker {
  display: none;
}

.more-actions[open] summary {
  background: var(--rose-50);
}

.more-actions > button {
  position: absolute;
  right: 0;
  z-index: 6;
  min-width: 158px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
}

.more-actions > button:nth-of-type(1) {
  top: 38px;
  border-radius: 14px 14px 0 0;
}

.more-actions > button:nth-of-type(2) {
  top: 74px;
  border-radius: 0;
}

.more-actions > button:nth-of-type(3) {
  top: 110px;
  border-radius: 0 0 14px 14px;
}

.diary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 18px;
  align-items: start;
}

.diary-editor-panel textarea[name="body"] {
  min-height: 340px;
  line-height: 1.7;
  background:
    linear-gradient(color-mix(in srgb, var(--paper) 86%, transparent), color-mix(in srgb, var(--paper) 86%, transparent)),
    linear-gradient(180deg, transparent 31px, rgba(126, 83, 75, .06) 32px);
  background-size: auto, 100% 32px;
}

.diary-history-panel {
  position: sticky;
  top: 16px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.diary-history {
  display: grid;
  gap: 10px;
}

.diary-history-item {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.diary-history-item.active {
  background: var(--rose-100);
  border-color: var(--rose-300);
}

.diary-history-item span {
  font-weight: 600;
}

.diary-history-item small {
  color: var(--muted);
  line-height: 1.45;
}

.wide-link {
  width: 100%;
  display: grid;
  place-items: center;
  margin-top: 12px;
}

.evolution-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.evolution-summary article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  box-shadow: 0 8px 28px rgba(108, 72, 64, .08);
}

.evolution-summary span,
.evolution-summary small {
  color: var(--muted);
}

.evolution-summary strong {
  font-size: clamp(1.35rem, 2.3vw, 1.9rem);
}

.evolution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.weight-quick-form {
  grid-template-columns: 140px minmax(110px, .45fr) minmax(0, 1fr) auto;
}

.weight-chart {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12px 12px, rgba(143, 125, 120, .08) 1px, transparent 1.2px),
    color-mix(in srgb, var(--paper) 64%, transparent);
  background-size: 22px 22px, auto;
}

.weight-variation {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 0;
}

.weight-variation strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.weight-variation span {
  color: var(--muted);
  font-size: .86rem;
}

.weight-chart svg {
  width: 100%;
  height: 170px;
  overflow: visible;
}

.weight-chart polyline {
  fill: none;
  stroke: color-mix(in srgb, var(--sage) 70%, var(--ink));
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.weight-chart circle {
  fill: color-mix(in srgb, var(--sage) 76%, var(--ink));
  stroke: color-mix(in srgb, var(--paper) 88%, white);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.activity-heatmap {
  display: grid;
  grid-template-rows: repeat(7, 12px);
  grid-auto-flow: column;
  grid-auto-columns: 12px;
  gap: 5px;
  align-items: center;
  width: max-content;
  max-width: 100%;
  margin: 12px 0 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.activity-heatmap span {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid rgba(91, 66, 60, .045);
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}

.activity-heatmap .level-1 { background: color-mix(in srgb, var(--sage) 35%, var(--paper)); }
.activity-heatmap .level-2 { background: color-mix(in srgb, var(--sage) 52%, var(--paper)); }
.activity-heatmap .level-3 { background: color-mix(in srgb, var(--sage) 68%, var(--paper)); }
.activity-heatmap .level-4 { background: color-mix(in srgb, var(--sage) 86%, var(--ink)); }

.books-panel {
  grid-column: span 2;
}

.evolution-list,
.book-edit-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.evolution-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.evolution-list article div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.evolution-list small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.evolution-list .ghost-button {
  min-height: 34px;
  padding: 7px 11px;
  font-size: .86rem;
}

.book-edit-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

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

.book-details-form textarea {
  grid-column: span 2;
}

.book-edit-card .ghost-button,
.book-edit-card .primary-action,
.book-edit-card .soft-action {
  min-height: 34px;
  padding: 7px 11px;
  font-size: .86rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-grid .panel {
  min-height: 100%;
}

.mascot-panel {
  grid-column: span 2;
}

.mascot-setting {
  display: flex;
  align-items: center;
  gap: 18px;
}

.settings-mascot {
  width: min(118px, 30vw);
  height: auto;
  border-radius: 28px;
  filter: drop-shadow(0 12px 22px rgba(77, 54, 48, .10));
}

.mascot-setting p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.achievements-panel {
  grid-column: span 2;
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.achievement-list article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  opacity: .68;
}

.achievement-list article.is-unlocked {
  opacity: 1;
  background: rgba(156, 172, 143, .18);
}

.achievement-list small,
.achievement-list span {
  color: var(--muted);
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(320px, .75fr) minmax(0, 1.25fr);
  gap: 18px;
  align-items: start;
}

.history-calendar {
  grid-template-columns: repeat(7, minmax(42px, 1fr));
}

.history-summary-panel {
  min-height: 620px;
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.history-chips span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  color: var(--muted);
  font-weight: 500;
}

.history-sections {
  display: grid;
  gap: 14px;
}

.history-sections article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 56%, transparent);
}

.history-sections h3 {
  margin: 0 0 8px;
}

.history-sections p {
  margin: 6px 0;
  line-height: 1.55;
}

.reminders-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.reminders-all-panel {
  grid-column: span 2;
}

.reminder-list,
.reminder-edit-list {
  display: grid;
  gap: 10px;
}

.compact-list {
  margin-bottom: 12px;
}

.reminder-card {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.reminder-card small {
  color: var(--muted);
}

.reminder-edit-card {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(120px, .8fr)) minmax(90px, .5fr) repeat(3, auto);
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.inline-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
}

.inline-check input {
  width: auto;
}

.notebook-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--paper) 86%, transparent), rgba(247,231,228,.72));
  box-shadow: var(--shadow);
}

.notebook-header p:last-child {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.55;
}

.notebook-toolbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 28px rgba(108, 72, 64, .1);
}

.notebook-toolbar label {
  grid-template-columns: auto minmax(80px, 130px);
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 62%, transparent);
}

.notebook-toolbar input[type="color"] {
  width: 46px;
  height: 36px;
  padding: 2px;
  border-radius: 12px;
}

.save-status {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--paper) 62%, transparent);
  font-weight: 500;
}

.notebook-stack {
  display: grid;
  gap: 22px;
}

.notebook-sheet {
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: color-mix(in srgb, var(--notebook-paper) 96%, transparent);
  box-shadow: 0 10px 30px rgba(108, 72, 64, .08);
}

.notebook-sheet-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.notebook-sheet-header label {
  max-width: 520px;
  flex: 1;
}

.notebook-sheet-header small {
  color: var(--muted);
}

.notebook-canvas {
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 720px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle, rgba(143, 125, 120, .20) 1.15px, transparent 1.25px),
    linear-gradient(var(--paper), var(--paper));
  background-size: 22px 22px, auto;
  box-shadow: inset 0 0 0 10px color-mix(in srgb, var(--paper) 34%, transparent);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: contain;
}

.notebook-canvas.is-active {
  outline: 3px solid rgba(156, 172, 143, .36);
  outline-offset: 3px;
}

.add-page-button {
  width: 100%;
  min-height: 64px;
  margin-top: 22px;
  border: 1px dashed rgba(95, 63, 58, .32);
  border-radius: 24px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.mini-history {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-top: 12px;
}

.mini-history span, .book-shelf article {
  padding: 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  border: 1px solid var(--line);
}

.book-shelf {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 12px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-grid a {
  min-height: 62px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
}

.calendar-grid a.active {
  background: var(--rose-100);
  border-color: var(--rose-300);
}

.bottom-nav {
  display: none;
}

/* Planner system layer: shared components across every screen. */
.auth-card,
.panel,
.home-progress-card,
.home-card,
.notebook-header,
.notebook-toolbar,
.notebook-sheet,
.week-summary article,
.week-day-card,
.evolution-summary article,
.evolution-list article,
.book-edit-card,
.diary-history-item,
.history-sections article,
.reminder-card,
.reminder-edit-card,
.achievement-list article,
.calendar-grid a,
.mini-history span,
.book-shelf article {
  position: relative;
  border: 1px solid rgba(91, 66, 60, .075);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  box-shadow: var(--soft-shadow);
}

.auth-card::before,
.panel::before,
.notebook-header::before,
.notebook-toolbar::before,
.notebook-sheet::before,
.week-day-card::before,
.book-edit-card::before,
.reminder-card::before,
.diary-history-item::before {
  content: "";
  position: absolute;
  left: 22px;
  top: -8px;
  width: 76px;
  height: 18px;
  border-radius: 4px;
  background: var(--tape-mint);
  transform: rotate(-1.5deg);
  opacity: .6;
  pointer-events: none;
}

.panel:nth-of-type(2n)::before,
.week-day-card:nth-child(2n)::before,
.book-edit-card:nth-child(2n)::before,
.reminder-card:nth-child(2n)::before,
.diary-history-item:nth-child(2n)::before {
  background: var(--tape-pink);
  transform: rotate(1.4deg);
}

.panel:nth-of-type(3n)::before,
.week-day-card:nth-child(3n)::before,
.book-edit-card:nth-child(3n)::before,
.reminder-card:nth-child(3n)::before,
.diary-history-item:nth-child(3n)::before {
  background: var(--tape-blue);
}

.section-title h2,
.history-sections h3 {
  font-family: "Cormorant Garamond", "Instrument Serif", "Playfair Display", Georgia, serif;
  font-weight: 600;
}

.section-title h2 {
  display: inline-grid;
  padding: 5px 13px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 86%, transparent);
}

.section-title a,
.section-title span,
.history-chips span,
.soft-action,
.primary-action,
.ghost-button,
.tool {
  border-radius: 999px;
}

input,
select,
textarea {
  border-color: rgba(91, 66, 60, .08);
  background: color-mix(in srgb, var(--notebook-paper) 92%, transparent);
}

select {
  background-color: color-mix(in srgb, var(--notebook-paper) 92%, transparent);
}

.notice,
.app-toast {
  border-radius: 22px;
  background: color-mix(in srgb, var(--rose-50) 76%, var(--paper));
}

.calendar-grid a.active,
.diary-history-item.active,
.mood-chip input:checked + span {
  background:
    linear-gradient(90deg, rgba(255,255,255,.16) 0 12px, transparent 12px 24px),
    color-mix(in srgb, var(--rose-100) 82%, var(--paper));
  background-size: 24px 100%, auto;
}

.notebook-canvas,
#handwritingCanvas {
  background:
    radial-gradient(circle, rgba(143, 125, 120, .11) 1px, transparent 1.15px),
    linear-gradient(var(--notebook-paper), var(--notebook-paper));
  background-size: 22px 22px, auto;
}

.notebook-sheet {
  background: color-mix(in srgb, var(--notebook-paper) 98%, transparent);
}

.home-mascot img,
.login-card .mascot-face,
.mascot-panel .mascot-face {
  background: color-mix(in srgb, var(--paper) 72%, transparent);
}

@media (min-width: 1180px) {
  .panel {
    grid-column: span 2;
  }

  .tasks-panel, .handwriting-panel, .notebook-shortcut {
    grid-column: span 4;
  }

  .diary-panel, .calendar-panel {
    grid-column: span 3;
  }
}

@media (max-width: 820px) and (min-width: 641px) {
  .app-shell {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .side-nav {
    display: grid;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav a {
    min-height: 48px;
    padding: 0 8px;
    font-size: .82rem;
    border-radius: 0 16px 16px 0;
  }

  .app-badge {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 24px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .today-page {
    padding: 16px 14px 86px;
  }

  .home-page {
    padding: 14px 12px 88px;
  }

  .home-hero,
  .home-progress-card,
  .diary-shortcut-card {
    grid-template-columns: 1fr;
  }

  .home-hero {
    border-radius: 28px;
  }

  .home-mascot {
    grid-template-columns: auto 1fr;
    justify-items: start;
    justify-self: start;
    width: 100%;
    max-width: none;
    min-width: 0;
    text-align: left;
  }

  .home-mascot img {
    width: 82px;
    border-radius: 24px;
  }

  .home-mascot small {
    align-self: center;
    max-width: none;
  }

  .home-grid {
    column-count: 1;
    column-gap: 0;
  }

  .home-habits,
  .glance-list {
    grid-template-columns: 1fr;
  }

  .home-date-strip {
    grid-template-columns: repeat(7, 64px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .home-date-strip::-webkit-scrollbar {
    display: none;
  }

  .weight-quick-form,
  .activity-quick-form,
  .activity-today-list article {
    grid-template-columns: 1fr;
  }

  .water-actions {
    grid-template-columns: 1fr;
  }

  .today-hero {
    grid-template-columns: 1fr;
    border-radius: 26px;
  }

  .hero-mascot {
    justify-items: start;
    grid-template-columns: auto 1fr;
    text-align: left;
  }

  .mascot-face {
    width: 82px;
    height: 82px;
  }

  .mascot-face::before, .mascot-face::after {
    top: 28px;
  }

  .mascot-face::before { left: 26px; }
  .mascot-face::after { right: 26px; }
  .mascot-face span {
    left: 30px;
    top: 48px;
    width: 22px;
  }

  .tablet-grid, .form-grid, .compact {
    grid-template-columns: 1fr;
  }

  .panel, .tasks-panel, .handwriting-panel, .diary-panel, .calendar-panel, .notebook-shortcut {
    grid-column: span 1;
    border-radius: 22px;
    padding: 16px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .task-form, .inline-form {
    flex-wrap: wrap;
  }

  .task-form select, .task-form input[type="time"] {
    width: 100%;
  }

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

  #handwritingCanvas {
    min-height: 360px;
  }

  .notebook-page {
    padding: 14px 12px 88px;
  }

  .routine-page {
    padding: 14px 12px 88px;
  }

  .week-page {
    padding: 14px 12px 88px;
  }

  .diary-page {
    padding: 14px 12px 88px;
  }

  .evolution-page {
    padding: 14px 12px 88px;
  }

  .settings-page {
    padding: 14px 12px 88px;
  }

  .history-page {
    padding: 14px 12px 88px;
  }

  .reminders-page {
    padding: 14px 12px 88px;
  }

  .routine-grid {
    grid-template-columns: 1fr;
  }

  .week-summary,
  .week-layout,
  .week-days,
  .week-priority-editor {
    grid-template-columns: 1fr;
  }

  .week-priorities-panel {
    grid-column: span 1;
  }

  .week-nav {
    justify-content: flex-start;
  }

  .diary-grid {
    grid-template-columns: 1fr;
  }

  .evolution-summary,
  .evolution-grid,
  .settings-grid,
  .history-layout,
  .reminders-grid {
    grid-template-columns: 1fr;
  }

  .mascot-panel,
  .achievements-panel {
    grid-column: span 1;
  }

  .reminders-all-panel {
    grid-column: span 1;
  }

  .reminder-edit-card {
    grid-template-columns: 1fr;
  }

  .books-panel,
  .book-details-form textarea {
    grid-column: span 1;
  }

  .book-details-form {
    grid-template-columns: 1fr;
  }

  .diary-history-panel {
    position: static;
  }

  .routine-create,
  .routine-list-panel {
    grid-column: span 1;
  }

  .notebook-header {
    display: grid;
    border-radius: 24px;
  }

  .notebook-toolbar {
    top: 8px;
    border-radius: 20px;
  }

  .notebook-toolbar label {
    grid-template-columns: 1fr;
  }

  .notebook-sheet {
    border-radius: 22px;
    padding: 12px;
  }

  .notebook-sheet-header {
    display: grid;
    align-items: start;
  }

  .notebook-canvas {
    min-height: 620px;
    border-radius: 18px;
  }

  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255,250,240,.9);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    z-index: 20;
  }

  .bottom-nav a {
    min-height: 46px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

