/* The Glasshouse Almanac — one stylesheet, four seasons.
   Type floor: 14px for labels, 17px for reading. */

/* Self-hosted so the type looks the same on every device and works offline (SIL Open Font License). */
@font-face { font-family: "Lora"; src: url("../fonts/lora-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/lora-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Lora"; src: url("../fonts/lora-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700 800; font-display: swap; }

:root {
  --serif: "Lora", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --r: 18px;
  --r-sm: 12px;
  --nav-h: 68px;
  --gutter: 16px;
}

/* Every season is candlelit and warm, like the paintings: a dark base tinted by the season,
   the season's painting softly blurred behind everything, and one accent color that changes.
   Winter: midnight blue + gold. Spring: plum + rose. Summer: forest + honey. Autumn: walnut + copper. */
:root {
  --ink: #f6ecd9; --ink-soft: #d2c4ac; --line: rgba(246, 230, 200, .16);
  --accent-ink: #1f1608; --well: rgba(8, 6, 4, .28);
  color-scheme: dark;
}
[data-season="winter"] {
  --bg: #121722; --bg-2: #1c2333; --surface: rgba(28, 34, 50, .82); --surface-2: rgba(48, 56, 80, .72);
  --accent: #e9bf6b; --accent-soft: rgba(233, 191, 107, .17);
  --bg-img: url("../assets/bg-winter-wide.webp");
}
[data-season="spring"] {
  --bg: #1d1519; --bg-2: #2a1f25; --surface: rgba(46, 33, 40, .82); --surface-2: rgba(72, 52, 62, .72);
  --accent: #f0a8bf; --accent-soft: rgba(240, 168, 191, .17);
  --bg-img: url("../assets/bg-spring-wide.webp");
}
[data-season="summer"] {
  --bg: #111a14; --bg-2: #1a271e; --surface: rgba(27, 41, 31, .82); --surface-2: rgba(45, 66, 50, .72);
  --accent: #f0cd6a; --accent-soft: rgba(240, 205, 106, .17);
  --bg-img: url("../assets/bg-summer-wide.webp");
}
[data-season="autumn"] {
  --bg: #1d140f; --bg-2: #2b1e16; --surface: rgba(48, 33, 24, .82); --surface-2: rgba(76, 52, 37, .72);
  --accent: #eb9a5c; --accent-soft: rgba(235, 154, 92, .18);
  --bg-img: url("../assets/bg-autumn-wide.webp");
}
@media (orientation: portrait) {
  [data-season="winter"] { --bg-img: url("../assets/bg-winter-tall.webp"); }
  [data-season="spring"] { --bg-img: url("../assets/bg-spring-tall.webp"); }
  [data-season="summer"] { --bg-img: url("../assets/bg-summer-tall.webp"); }
  [data-season="autumn"] { --bg-img: url("../assets/bg-autumn-tall.webp"); }
}
/* The painting behind the page: blurred and dimmed so text always stays readable on top. */
body::before {
  content: ""; position: fixed; inset: -40px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(10, 8, 6, .35), rgba(10, 8, 6, .65)), var(--bg-img) center / cover no-repeat;
  filter: blur(16px) saturate(1.15) brightness(.55);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 17px/1.55 var(--sans); transition: background-color .4s, color .4s;
  /* room for the nav AND the floating "+" so the last thing on a page is never under it */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 100px);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.view { max-width: 760px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) var(--gutter) 0; outline: none; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.eyebrow { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 236, 200, .06);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 16px; text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 18px; display: inline-grid; place-items: center; flex: none; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
input[type="text"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--well); font-size: 17px; }
textarea { resize: vertical; line-height: 1.6; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 160px; min-width: 0; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-weight: 600; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }

/* ---- page header with prev/next ---- */
.pager { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.pager .title { flex: 1; min-width: 0; text-align: center; }
.pager .title h1 { font-size: 1.5rem; }

/* ---- today ---- */
.energy-grid { display: grid; gap: 12px; }
@media (min-width: 620px) { .energy-grid { grid-template-columns: repeat(3, 1fr); } }
.energy { text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); padding: 16px; cursor: pointer; display: grid; gap: 4px; }
.energy .ico { font-size: 28px; }
.energy b { font-family: var(--serif); font-size: 1.12rem; }
.energy[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; background: var(--accent-soft); }
.energy-chosen { display: flex; align-items: center; gap: 12px; }
.energy-chosen .ico { font-size: 30px; }

.whisper { font-family: var(--serif); font-size: 1.12rem; font-style: italic; line-height: 1.6; padding: 16px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }

.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.task { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 4px 4px 12px; border-radius: var(--r-sm); background: var(--well); }
.task label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; overflow-wrap: anywhere; }
.task input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.task.done label span { text-decoration: line-through; color: var(--ink-soft); }
.task .icon-btn { width: 40px; height: 40px; font-size: 15px; background: transparent; border-color: transparent; }

.event { display: flex; align-items: center; gap: 12px; padding: 10px 4px 10px 12px; border-radius: var(--r-sm); background: var(--well); }
.event .time { font-weight: 700; font-size: 15px; min-width: 74px; color: var(--accent); }
.event .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.event .repeat { font-size: 14px; color: var(--ink-soft); }

.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mood { border: 1px solid var(--line); background: var(--well); border-radius: var(--r-sm); padding: 8px 2px; cursor: pointer; display: grid; justify-items: center; gap: 2px; font-size: 14px; }
.mood .ico { font-size: 24px; }
.mood[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

.presence { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: 15px; }
.presence .ico { font-size: 22px; }

/* ---- month ---- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { text-align: center; font-size: 14px; font-weight: 700; color: var(--ink-soft); padding-bottom: 4px; }
.cal .cell { aspect-ratio: 1 / 1.08; min-height: 46px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 2px; position: relative; font-weight: 600; font-size: 16px; }
.cal .cell.empty { background: transparent; border-color: transparent; }
.cal .cell.today { box-shadow: 0 0 0 2px var(--accent) inset; }
.cal .cell.logged { background: var(--accent-soft); }
.cal .marks { display: flex; gap: 3px; align-items: center; font-size: 14px; line-height: 1; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: var(--ink-soft); margin-top: 12px; }

/* ---- year ---- */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-decoration: none; display: block; }
.mini h3 { font-size: 1rem; margin-bottom: 8px; }
.mini .g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini .g i { aspect-ratio: 1; border-radius: 3px; background: var(--bg-2); }
.mini .g i.pad { background: transparent; }
.mini .g i.logged { background: var(--accent); }
.mini .g i.today { outline: 2px solid var(--ink); outline-offset: -1px; }
.mini .count { font-size: 14px; color: var(--ink-soft); margin-top: 8px; }

/* ---- glasshouse ---- */
.progress { height: 12px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .6s; }
.wallet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.wallet div { background: var(--well); border-radius: var(--r-sm); padding: 12px 6px; }
.wallet b { display: block; font-size: 1.4rem; font-family: var(--serif); }
.wallet span { font-size: 14px; color: var(--ink-soft); }

/* ---- story ---- */
.waiting { display: flex; align-items: center; gap: 14px; text-decoration: none; border-color: var(--accent); background: var(--accent-soft); padding: 14px 16px; }
.waiting .ico { font-size: 28px; flex: none; }
.prose p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; }
.prose p + p { margin-top: 14px; }
.unlocks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.unlocks li { padding: 8px 12px; border-radius: var(--r-sm); background: var(--well); font-weight: 600; }
.visitor { display: flex; align-items: center; gap: 14px; }
.portrait { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 32px; background: var(--accent-soft); border: 2px solid var(--accent); }
.speech { font-family: var(--serif); font-size: 1.15rem; line-height: 1.7; }
.prompt { font-weight: 600; }
.offer.picked { padding: 12px 14px; border-radius: var(--r-sm); background: var(--well); font-weight: 600; }
.collection { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.shelf.locked { opacity: .7; border-style: dashed; }
.entry { font-family: var(--serif); font-size: 1.05rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- art ---- */
.media { position: relative; overflow: hidden; border-radius: var(--r); background: var(--bg-2); }
.media-poster, .media-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.media-video { opacity: 0; transition: opacity .8s; }
.media.playing .media-video { opacity: 1; }
/* fit: the whole picture, never cropped, floating over a blurred copy of itself */
.media.fit .media-poster, .media.fit .media-video { object-fit: contain; }
.media-backdrop { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(18px) brightness(.55); }
.story-media { height: clamp(260px, 52vh, 520px); }
.intro-media { height: clamp(240px, 46vh, 460px); }
.chapter-media { height: clamp(260px, 50vh, 480px); }
.today-hero { height: clamp(240px, 48vh, 460px); box-shadow: 0 12px 34px rgba(0, 0, 0, .45); }
.today-hero .media-poster { object-position: center 62%; }
.expandable { cursor: zoom-in; }
.expand-hint { position: absolute; right: 10px; top: 10px; z-index: 4; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 8, 6, .55); color: #fff6e6; font-size: 20px; pointer-events: none; }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(6, 5, 4, .94); display: grid; place-items: center; }
.viewer-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer-video { opacity: 0; transition: opacity .6s; }
.viewer.playing .viewer-video { opacity: 1; }
.viewer-close { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 2; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255, 246, 230, .3); background: rgba(20, 16, 12, .7); color: #fff6e6; font-size: 20px; cursor: pointer; }
.modal-portrait { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; justify-self: center; border: 3px solid var(--accent); }
.portrait { object-fit: cover; }
.waiting-face { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; padding: 10px 8px 12px; border-radius: var(--r-sm); background: var(--well); font-size: 15px; min-width: 0; }
.tile b { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; hyphens: auto; }
.tile-art { width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: #f6ecd8; }
.tile-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s, filter .5s; }
.stage-1 .tile-art img { transform: scale(.62); }
.stage-2 .tile-art img { transform: scale(.82); }
.stage-3 .tile-art { box-shadow: 0 0 0 2px var(--accent), 0 0 22px var(--accent-soft); }
.worn .tile-art img { filter: grayscale(.85) sepia(.5) contrast(.85) brightness(.95); }
.waiting-tile { min-height: 120px; place-content: center; border: 1px dashed var(--line); background: transparent; }
.tile-note { color: var(--accent); font-weight: 700; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 15px; }
.btn:disabled, .btn.is-short { opacity: .55; }
.btn:disabled { cursor: not-allowed; }
.hint { margin: -4px 0 14px; }
@media (max-width: 380px) { .tiles.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.decor-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.decor-list li { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; background: var(--well); border-radius: var(--r-sm); }
.decor-list .grow { flex: 1; min-width: 0; }

.tea-ring { --p: 0; width: 200px; height: 200px; margin: 8px auto; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), var(--bg-2) 0); }
.tea-ring span { width: 168px; height: 168px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 600 2.2rem/1 var(--serif); }

/* ---- the scene ---- */
.scene { position: relative; height: clamp(300px, 58vh, 560px); border-radius: var(--r); overflow: hidden; margin: 0 calc(-1 * var(--gutter)); border-radius: 0; isolation: isolate; }
@media (min-width: 792px) { .scene { margin: 0; border-radius: var(--r); } }
.scene-media { position: absolute; inset: 0; border-radius: 0; }
.scene-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px var(--gutter) 18px; color: #fff8ec; z-index: 3;
  background: linear-gradient(transparent, rgba(12, 10, 20, .78)); }
.scene-caption .eyebrow { color: #f0dfbf; }
.scene-caption h1 { text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.fx-lights { background: radial-gradient(circle, #ffe7a3 0 2px, transparent 3px) 0 14px / 34px 30px repeat-x; filter: drop-shadow(0 0 4px #ffd36b); height: 44px; animation: twinkle 2.6s ease-in-out infinite alternate; }
.fx-lanterns i { position: absolute; top: -10px; left: calc(14% + var(--i) * 32%); width: 30px; height: 40px; border-radius: 45%; background: radial-gradient(circle at 50% 40%, #fff1c2, #f2a54a 60%, #b55a2a);
  box-shadow: 0 0 26px 8px rgba(255, 190, 90, .45); transform-origin: 50% -60px; animation: sway 5s ease-in-out calc(var(--i) * -1.4s) infinite alternate; }
.fx-fireflies i { position: absolute; left: var(--x); top: calc(25% + var(--y) * .5); width: 5px; height: 5px; border-radius: 50%; background: #fff6a8;
  box-shadow: 0 0 10px 3px rgba(255, 240, 120, .7); animation: drift var(--s) ease-in-out var(--d) infinite alternate; }
.fx-candles { background: radial-gradient(ellipse at 50% 110%, rgba(255, 170, 70, .38), transparent 60%); animation: flicker 3s ease-in-out infinite alternate; }
.fx-weather i { position: absolute; top: -12px; left: var(--x); width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: .85;
  animation: fall var(--s) linear var(--d) infinite; }
[data-season="spring"] .fx-weather i { background: #f6b9cc; border-radius: 60% 0; width: 10px; }
[data-season="summer"] .fx-weather i { background: #fff3a0; width: 4px; height: 4px; box-shadow: 0 0 8px 2px rgba(255, 240, 140, .7); }
[data-season="autumn"] .fx-weather i { background: #d9772e; border-radius: 70% 0; width: 11px; height: 9px; }
.fx-mist { background: linear-gradient(transparent 55%, rgba(235, 240, 245, .35)); animation: mist 9s ease-in-out infinite alternate; }
.fx-stars i { position: absolute; top: calc(var(--y) * .3); left: var(--x); width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, .6); animation: twinkle calc(var(--s) / 3) ease-in-out var(--d) infinite alternate; }
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes drift { from { transform: translate(0, 0); opacity: .3; } to { transform: translate(24px, -30px); opacity: 1; } }
@keyframes flicker { from { opacity: .7; } to { opacity: 1; } }
@keyframes fall { to { transform: translate(30px, calc(60vh + 30px)) rotate(240deg); } }
@keyframes mist { from { transform: translateX(-4%); } to { transform: translateX(4%); } }

/* ---- onboarding ---- */
.onboard { min-height: calc(100vh - 40px); display: grid; align-content: center; gap: 22px; max-width: 520px; margin: 0 auto; padding: 24px 0 40px; }
.onboard .story { font-family: var(--serif); font-size: 1.2rem; line-height: 1.7; }
.onboard .steps { display: flex; gap: 6px; justify-content: center; }
.onboard .steps i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.onboard .steps i.on { background: var(--accent); width: 22px; border-radius: 99px; }
.choice { text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 16px; cursor: pointer; display: grid; gap: 4px; width: 100%; }
.choice b { font-family: var(--serif); font-size: 1.12rem; }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.install-tip { font-size: 15px; background: var(--surface-2); border-radius: var(--r-sm); padding: 14px; display: grid; gap: 6px; }

/* ---- chrome ---- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.nav a { display: grid; place-content: center; justify-items: center; gap: 2px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.nav a span { font-size: 20px; line-height: 1; }
.nav a[aria-current="page"] { color: var(--accent); }
.fab { position: fixed; right: max(18px, calc((100vw - 760px) / 2 + 18px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); z-index: 21;
  width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 32px; line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); cursor: pointer; }
.fab:active { transform: scale(.94); }
.fab { transition: transform .2s, opacity .2s; }
.fab.tucked { transform: scale(.4); opacity: 0; pointer-events: none; }

.modal-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 20, .5); display: grid; align-items: end; justify-items: center; }
@media (min-width: 620px) { .modal-wrap { align-items: center; } }
.modal { width: min(560px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border-radius: var(--r) var(--r) 0 0; padding: 18px var(--gutter) calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
@media (min-width: 620px) { .modal { border-radius: var(--r); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 90px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; z-index: 50; transition: .3s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.save-banner { position: sticky; top: 0; z-index: 30; background: #8a2b1d; color: #fff; padding: 12px var(--gutter); font-size: 15px; font-weight: 600; text-align: center; }
.save-banner a { color: #fff; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- guide + tour ---- */
.guide-item { display: flex; gap: 14px; align-items: flex-start; }
.guide-ico { font-size: 26px; line-height: 1.2; flex: none; width: 34px; text-align: center; }
.guide-item h3 { margin-bottom: 4px; }
.tour { position: fixed; inset: 0; z-index: 70; }
.tour-spot { position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(6, 5, 4, .78), 0 0 0 3px var(--accent); transition: all .35s ease; pointer-events: none; }
.tour-bubble { position: fixed; left: var(--gutter); right: var(--gutter); max-width: 460px; margin: 0 auto; background: var(--bg-2); border: 1px solid var(--accent);
  border-radius: var(--r); padding: 18px; display: grid; gap: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }

/* ---- oracle + dice ---- */
.die { width: 72px; height: 72px; flex: none; border-radius: 16px; display: grid; place-items: center; font: 700 2rem/1 var(--serif);
  background: linear-gradient(145deg, #fff6e2, #e6d2ad); color: #3a2618; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), 0 8px 18px rgba(0, 0, 0, .4); }
.die.big { width: 84px; height: 84px; font-size: 2.3rem; }
.die.rolling { animation: tumble .8s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes tumble { 0% { transform: rotate(-200deg) scale(.4); opacity: .2; } 70% { transform: rotate(20deg) scale(1.08); opacity: 1; } 100% { transform: rotate(0) scale(1); } }
.spark { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); }
.spark b { font-family: var(--serif); font-size: 1.15rem; }
.oracle-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.oracle-log li { padding: 10px 12px; border-radius: var(--r-sm); background: var(--well); overflow-wrap: anywhere; }
.tray { align-items: center; }

/* ---- keeper ---- */
.keeper-head { display: flex; gap: 16px; align-items: center; }
.monogram { width: 76px; height: 76px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 600 2.2rem/1 var(--serif);
  color: var(--accent-ink); background: radial-gradient(circle at 35% 30%, #fff1cf, var(--accent)); box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 20px rgba(0, 0, 0, .4); }
.traits { display: flex; flex-wrap: wrap; gap: 8px; }
.trait { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--well); cursor: pointer; font-weight: 600; font-size: 15px; }
.trait[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.axes { display: grid; gap: 12px; }
.legend-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.legend-list li { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--well); border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* ---- tea ritual ---- */
.teacup { display: grid; place-items: center; gap: 4px; width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; border: 2px dashed var(--accent);
  background: var(--well); cursor: pointer; font-size: 46px; transition: transform .4s; }
.teacup small { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.teacup.stirred span { display: inline-block; transform: rotate(calc(var(--stirs) * 120deg)); transition: transform .5s; }
.teacup:disabled { opacity: .5; cursor: not-allowed; }

/* ---- card of the day ---- */
.daily-card { width: min(240px, 70%); margin: 4px auto; padding: 12px 12px 14px; border-radius: 16px; display: grid; gap: 10px; text-align: center;
  background: linear-gradient(160deg, #f8edd6, #e9d6b1); color: #3a2618; box-shadow: 0 0 0 2px var(--accent), 0 14px 30px rgba(0, 0, 0, .45); font-family: var(--serif); }
.daily-card-art { aspect-ratio: 1; border-radius: 10px; overflow: hidden; }
.daily-card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.daily-card.flip-in { animation: cardflip .9s ease-out; }
@keyframes cardflip { from { transform: perspective(800px) rotateY(180deg) scale(.8); opacity: 0; } to { transform: perspective(800px) rotateY(0) scale(1); opacity: 1; } }

/* ---- moments of the year + keepsakes ---- */
.moment { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 14px 34px rgba(0, 0, 0, .4); }
.moment-head { display: flex; gap: 14px; align-items: center; }
.moment-ico { font-size: 40px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4)); }
.moment.kept { display: grid; gap: 10px; }
.keepsakes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.keepsake { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 14px 10px; border-radius: var(--r-sm); background: var(--well); border: 1px solid var(--line); }
.keepsake-ico { font-size: 34px; }

/* ---- planner extras ---- */
.carry { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border-radius: var(--r-sm); background: var(--accent-soft); font-size: 15px; }
.ritual-count { font-weight: 400; opacity: .8; }
.task .icon-btn { flex: none; }
.week { display: grid; gap: 10px; }
.week-day { display: grid; grid-template-columns: 74px 1fr; gap: 12px; text-decoration: none; padding: 12px 14px; }
.week-day.today { box-shadow: 0 0 0 2px var(--accent) inset; }
.week-day.logged .week-num { color: var(--accent); }
.week-date { display: grid; justify-items: center; align-content: start; gap: 2px; }
.week-num { font: 600 1.6rem/1 var(--serif); }
.week-icons { font-size: 16px; }
.week-body { display: grid; gap: 4px; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.week-ev b { color: var(--accent); }
.week-rituals { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.week-rituals span { opacity: .3; filter: grayscale(1); }
.week-rituals span.on { opacity: 1; filter: none; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, 1fr); } .week-day { grid-template-columns: 1fr; } }
.archive-entry { display: grid; gap: 6px; text-decoration: none; }
input[type="search"] { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--well); font-size: 17px; }

/* ---- rituals of the week, month and year ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { display: grid; justify-items: center; text-align: center; padding: 12px 8px; border-radius: var(--r-sm); background: var(--well); }
.stat b { font: 600 1.6rem/1.1 var(--serif); color: var(--accent); }
.stat span { font-size: 14px; color: var(--ink-soft); }
.page-hero { height: clamp(180px, 32vh, 300px); }
.mood-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.mood-month i { aspect-ratio: 1; border-radius: 8px; background: var(--well); border: 1px solid var(--line); }
.mood-month.small-dots { grid-template-columns: repeat(16, 1fr); gap: 3px; max-width: 420px; }
.mood-month.small-dots i { border-radius: 4px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; }
.year-moods { display: grid; gap: 3px; overflow-x: auto; }
.moods-row { display: grid; grid-template-columns: 34px repeat(31, minmax(6px, 1fr)); gap: 2px; align-items: center; }
.moods-label { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.moods-row i { aspect-ratio: 1; border-radius: 2px; background: var(--well); }
.moods-row i.pad { background: transparent; }

/* ---- the book: on screen and on paper ---- */
.book { display: grid; gap: 18px; }
.book-cover { text-align: center; padding: 48px 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--accent); }
.book-cover h1 { font-size: 3rem; margin: 10px 0; }
.book-name { font: italic 400 1.3rem var(--serif); }
.book-month { padding: 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; }
.book-entry { border-left: 3px solid var(--accent); padding-left: 12px; }
.book-meta { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.book-entry p, .book-month > p { font-family: var(--serif); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
@media print {
  body { background: #fff !important; color: #222 !important; padding: 0 !important; font-size: 12pt; }
  body::before, .nav, .fab, .toast, .no-print, .save-banner { display: none !important; }
  .view { max-width: none; padding: 0; }
  .book-cover, .book-month { background: none !important; border: none !important; box-shadow: none !important; backdrop-filter: none !important; break-inside: avoid-page; color: #222; }
  .book-cover { min-height: 90vh; display: grid; place-content: center; break-after: page; }
  .book-month { break-before: page; }
  .book-entry { border-left-color: #b8893a; break-inside: avoid; }
  .book-meta, .muted { color: #555 !important; }
}

/* ---- friends + rooms ---- */
.hearts { display: inline-flex; gap: 3px; vertical-align: middle; }
.hearts i { width: 11px; height: 11px; transform: rotate(45deg); background: var(--well); border: 1px solid var(--line); border-radius: 3px 0 3px 3px; }
.hearts i.on { background: #ef8fa6; border-color: #ef8fa6; }
.friendship { margin-top: 6px; }
.letter { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-sm); background: linear-gradient(160deg, rgba(248, 237, 214, .1), rgba(248, 237, 214, .03)); border: 1px solid var(--line); }
.locked-room { opacity: .6; cursor: default; display: inline-flex; align-items: center; }
.fx-garland, .fx-bunting, .fx-suns, .fx-leaves { height: 40px; }
.fx-garland { background: radial-gradient(circle at 50% 0, #2f6b45 0 9px, transparent 10px) 0 0 / 22px 18px repeat-x, radial-gradient(circle, #fff 0 2px, transparent 3px) 11px 8px / 22px 18px repeat-x; }
.fx-bunting { background: conic-gradient(from -30deg at 50% 0, #f0a8bf 60deg, transparent 0) 0 0 / 28px 26px repeat-x; }
.fx-suns i, .fx-leaves i { position: absolute; top: 6px; left: calc(var(--i) * 9% + 3%); width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle, #ffe7a0, #f0b24a); box-shadow: 0 0 14px 4px rgba(255, 200, 90, .5); animation: sway 4s ease-in-out var(--d) infinite alternate; }
.fx-leaves i { border-radius: 70% 0; background: #d9772e; box-shadow: none; width: 16px; height: 13px; }
