@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 600 700; font-display: swap; src: url(../assets/fonts/fraunces.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(../assets/fonts/nunito.woff2) format('woff2'); }
/* The Mossbrew Cottage — autumn theme. Minimum text 14px, reading 16–17px. */
:root {
  --wood: #5b3a22; --wood-dark: #3b2a1a; --moss: #55683a; --moss-deep: #2f3b22;
  --gold: #d9a441; --rust: #b5562b; --cream: #fbf3e0; --paper: #f6ead0; --line: #dcc9a0;
  --ink: #3a2a1c; --ink-soft: #6b5640;
  --head: 'Fraunces', Georgia, serif; --body: 'Nunito', system-ui, sans-serif;
  --top: 60px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 500 17px/1.5 var(--body); color: var(--ink);
  background: radial-gradient(120% 80% at 50% 0%, #56653f 0%, #323d26 55%, #1f2719 100%) fixed;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 30; height: calc(var(--top) + env(safe-area-inset-top)); box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: linear-gradient(#4a3320, #3b2a1a); color: var(--cream);
  border-bottom: 3px solid #2a1d11; box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.top-title { flex: 1; min-width: 0; }
.top h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title p { margin: 0; font-size: 14px; color: #e6d3a8; }
.top-level { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.top-level .bar { width: 84px; height: 10px; border-radius: 6px; background: #2a1d11; overflow: hidden; }
.top-level .bar i { display: block; height: 100%; background: linear-gradient(90deg, #e9c46a, #f4e3a1); border-radius: 6px; transition: width .5s; }
.top-btn {
  min-width: 44px; height: 44px; padding: 0 10px; border-radius: 12px; border: 2px solid #6d4a2c;
  background: #5b3a22; color: var(--cream); font-size: 18px; font-weight: 800;
}
.top-btn:hover, .top-btn:focus-visible { background: #6d4a2c; outline: none; border-color: var(--gold); }
#timer-chip { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.stage { display: block; padding-bottom: 32px; }
.house { position: relative; width: min(100%, 760px); margin: 0 auto; filter: drop-shadow(0 12px 24px rgba(0,0,0,.4)); }
.side { width: min(100%, 760px); margin: 0 auto; padding: 14px; }

.floor { position: relative; aspect-ratio: 1376 / 768; background-size: 100% 100%; overflow: hidden; }
.canvas { position: absolute; }
.floor-attic { background-image: url(../assets/art/cut/floor-attic.webp); }
.floor-parlor { background-image: url(../assets/art/cut/floor-parlor.webp); }
.floor-greenhouse { background-image: url(../assets/art/cut/floor-greenhouse.webp); border-radius: 0 0 10px 10px; }

/* ---------- hotspots ---------- */
.spot {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  width: 19%; aspect-ratio: 1; min-width: 56px; border: 0; background: none; padding: 0;
  display: grid; place-items: center; z-index: 5; -webkit-tap-highlight-color: transparent;
}
.spot .glow {
  position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,236,170,.55) 0%, rgba(255,226,140,.22) 45%, transparent 70%);
  animation: breathe 3.2s ease-in-out infinite;
}
.spot .tag {
  position: absolute; bottom: 2%; left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 3px 10px; border-radius: 999px;
  background: rgba(59,42,26,.9); color: var(--cream); font-weight: 800; font-size: 14px;
  border: 1.5px solid var(--gold); box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.spot:hover .glow, .spot:focus-visible .glow { animation-duration: 1.1s; background: radial-gradient(circle, rgba(255,240,190,.85) 0%, rgba(255,226,140,.35) 50%, transparent 72%); }
.spot:focus-visible { outline: 3px solid var(--gold); outline-offset: -6px; border-radius: 50%; }
.spot:hover .tag, .spot:focus-visible .tag { background: var(--gold); color: var(--wood-dark); }
@keyframes breathe { 0%, 100% { opacity: .45; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.05); } }

/* ---------- living pieces ---------- */
.plant { position: absolute; left: 50%; bottom: 41.6%; transform: translateX(-50%); transform-origin: 50% 100%; pointer-events: none; z-index: 2; transition: height .8s; }
.plant.grew { animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: translateX(-50%) scale(.6); } 60% { transform: translateX(-50%) scale(1.12); } 100% { transform: translateX(-50%) scale(1); } }

.familiar {
  position: absolute; left: 70%; bottom: 12.5%; transform: translateX(-50%); z-index: 4;
  border: 0; padding: 0; background: none no-repeat center bottom / contain;
  width: 13%; aspect-ratio: 1; min-width: 44px; -webkit-tap-highlight-color: transparent;
}
.familiar.sleep { animation: snooze 4s ease-in-out infinite; transform-origin: 50% 100%; }
.familiar.hop { animation: hop .5s ease-out; }
@keyframes snooze { 0%, 100% { transform: translateX(-50%) scaleY(1); } 50% { transform: translateX(-50%) scaleY(1.04); } }
@keyframes hop { 40% { transform: translateX(-50%) translateY(-14%); } }

.fireglow {
  position: absolute; left: 62%; top: 38%; width: 32%; height: 56%; pointer-events: none; z-index: 7; opacity: .28;
  background: radial-gradient(circle at 50% 55%, rgba(255,170,70,.75), rgba(255,140,40,.25) 40%, transparent 68%);
  mix-blend-mode: screen; transition: opacity 1s;
}
.fireglow { animation: flicker 2.6s ease-in-out infinite; }
body.focusing .fireglow { opacity: 1; animation-duration: 1.4s; }
@keyframes flicker { 0%, 100% { transform: scale(1); filter: brightness(1); } 35% { transform: scale(1.06); filter: brightness(1.2); } 70% { transform: scale(.97); filter: brightness(.92); } }

.jars { position: absolute; left: 79.2%; width: 8%; top: 46%; height: 42%; pointer-events: none; z-index: 2; }
.jars .mini { position: absolute; left: 50%; transform: translateX(-50%); width: 47%; aspect-ratio: 3 / 4; }
.jars .mini svg { width: 100%; height: 100%; display: block; }

.weather-tint { position: absolute; inset: 0; pointer-events: none; z-index: 6; transition: background 1.2s; mix-blend-mode: multiply; }
body[data-weather="rain"] .weather-tint { background: rgba(120,140,170,.38); }
body[data-weather="night"] .weather-tint { background: rgba(46,50,112,.62); }
body[data-weather="night"] .fireglow { opacity: .8; }
body[data-weather="night"] .spot, body[data-weather="rain"] .spot { z-index: 8; }
body[data-weather="night"] .familiar, body[data-weather="rain"] .familiar { z-index: 8; }
.rain { position: absolute; left: 23%; top: 19%; width: 54%; height: 52%; pointer-events: none; opacity: 0; z-index: 1;
  background: repeating-linear-gradient(100deg, transparent 0 9px, rgba(220,235,255,.5) 9px 10px); background-size: 200% 200%; }
body[data-weather="rain"] .rain { opacity: .7; animation: rain .5s linear infinite; }
@keyframes rain { to { background-position: -40px 120px; } }

/* ---------- cards ---------- */
.dash, .panel { background: var(--cream); border-radius: 18px; border: 3px solid var(--wood); box-shadow: 0 10px 28px rgba(0,0,0,.35); }
.dash { padding: 18px; }
.dash h2 { font-size: 24px; }
.dash .sub { margin: 4px 0 14px; color: var(--ink-soft); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; }
button.tile:hover, button.tile:focus-visible { border-color: var(--gold); outline: none; }
.tile b { display: block; font: 700 22px var(--head); }
.tile span { font-size: 15px; color: var(--ink-soft); }
.nudge { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #eef0dc; border: 2px solid #c9d1a3; font-size: 16px; }

.panel { display: flex; flex-direction: column; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: linear-gradient(#6a4528, #5b3a22); color: var(--cream); }
.panel-head h2 { flex: 1; font-size: 22px; }
.x { width: 44px; height: 44px; border-radius: 12px; border: 2px solid #8a6238; background: #4a3320; color: var(--cream); font-size: 20px; font-weight: 800; }
.x:hover, .x:focus-visible { border-color: var(--gold); outline: none; }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: #e9d9b4; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tab { border: 2px solid transparent; border-bottom: 0; background: none; padding: 8px 12px; border-radius: 10px 10px 0 0; font-weight: 800; font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--cream); border-color: var(--line); color: var(--ink); }
.panel-body { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.panel-body h3 { font-size: 19px; margin: 18px 0 8px; }
.panel-body h3:first-child { margin-top: 0; }
.hint { color: var(--ink-soft); font-size: 15px; margin: 4px 0 10px; }

.btn { min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 2px solid var(--wood); background: var(--wood); color: var(--cream); font-weight: 800; }
.btn:hover, .btn:focus-visible { background: #6d4a2c; outline: 3px solid rgba(217,164,65,.5); }
.btn.soft { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.soft:hover, .btn.soft:focus-visible { border-color: var(--gold); background: #fff7e2; }
.btn.small { min-height: 38px; padding: 4px 12px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.field { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: #fffaf0; font-size: 16px; }
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(217,164,65,.3); }
select.field { flex: 0 1 auto; }
label.lbl { display: block; font-weight: 800; font-size: 15px; margin: 12px 0 4px; }

/* mana */
.mana { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mana button { border: 2px solid var(--line); background: var(--paper); border-radius: 14px; padding: 10px 6px; text-align: center; }
.mana button b { display: block; font: 700 17px var(--head); }
.mana button span { font-size: 14px; color: var(--ink-soft); display: block; line-height: 1.3; }
.mana button .ic { font-size: 24px; display: block; }
.mana button[aria-pressed="true"] { border-color: var(--rust); background: #fff1d6; box-shadow: inset 0 0 0 2px var(--gold); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 8px; background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; padding: 4px 6px 4px 4px; }
.item .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 16px; }
.item.done .txt { text-decoration: line-through; color: var(--ink-soft); }
.check { width: 44px; height: 44px; flex: none; border: 0; background: none; display: grid; place-items: center; border-radius: 10px; }
.check i { width: 26px; height: 26px; border-radius: 8px; border: 2.5px solid var(--wood); background: #fff; display: grid; place-items: center; font-style: normal; font-weight: 800; color: #fff; }
.done .check i, .check[aria-pressed="true"] i { background: var(--moss); border-color: var(--moss); }
.check:focus-visible { outline: 3px solid var(--gold); }
.icon { width: 40px; height: 40px; flex: none; border: 0; background: none; border-radius: 10px; font-size: 18px; color: var(--ink-soft); }
.icon:hover, .icon:focus-visible { background: #f0e2bd; outline: none; color: var(--ink); }
.icon.on { color: var(--rust); }
.banner { background: #fff1d6; border: 2px solid var(--gold); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.banner p { margin: 0 0 8px; }
.empty { text-align: center; color: var(--ink-soft); padding: 14px; border: 2px dashed var(--line); border-radius: 12px; }

/* week + month */
.daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.daynav h3 { flex: 1; margin: 0 !important; text-align: center; }
.week { display: grid; gap: 8px; }
.wday { text-align: left; width: 100%; background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.wday:hover, .wday:focus-visible { border-color: var(--gold); outline: none; }
.wday.today { border-color: var(--rust); background: #fff1d6; }
.wday b { font: 700 17px var(--head); }
.wday ul { margin: 4px 0 0; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
.wday ul li.d { text-decoration: line-through; }
.month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month .dow { text-align: center; font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.cell { aspect-ratio: 1; min-height: 44px; border: 2px solid var(--line); background: #fffaf0; border-radius: 10px; padding: 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: 15px; }
.cell:hover, .cell:focus-visible { border-color: var(--gold); outline: none; }
.cell.today { border-color: var(--rust); background: #fff1d6; }
.cell .dots { display: flex; gap: 3px; height: 8px; }
.cell .dots i { width: 8px; height: 8px; border-radius: 50%; }
.dot-q { background: var(--gold); } .dot-h { background: var(--moss); } .dot-b { background: var(--rust); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }

/* greenhouse */
.plantcard { display: flex; gap: 14px; align-items: center; background: linear-gradient(#eef0dc, #e3e8c8); border: 2px solid #c9d1a3; border-radius: 14px; padding: 12px; }
.plantcard .pic { width: 96px; height: 96px; flex: none; display: grid; place-items: end center; }
.plantcard .pic img { max-width: 100%; max-height: 100%; }
.meter { height: 12px; border-radius: 8px; background: #d5dbb5; overflow: hidden; margin: 6px 0; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #7c9a4d, #b5c96a); border-radius: 8px; transition: width .6s; }
.fam { font-size: 14px; font-weight: 800; padding: 2px 8px; border-radius: 999px; flex: none; }
.fam.calm { background: #e3dcf2; color: #54407d; } .fam.sun { background: #fbe3b5; color: #7a4a0c; } .fam.moon { background: #dbe5ea; color: #33505e; }
.pouch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.herb { display: flex; align-items: center; gap: 6px; background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; padding: 4px 8px; font-size: 14px; font-weight: 700; }
.herb img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.herb.none { opacity: .45; }
.herb b { margin-left: auto; font-size: 16px; }

/* hearth */
.clock { font: 700 64px/1 var(--head); text-align: center; font-variant-numeric: tabular-nums; margin: 6px 0 12px; color: var(--wood-dark); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg button { min-height: 44px; border: 2px solid var(--line); background: var(--paper); border-radius: 12px; font-weight: 800; }
.seg button[aria-pressed="true"] { border-color: var(--rust); background: #fff1d6; box-shadow: inset 0 0 0 2px var(--gold); }
.hearts { font-size: 22px; letter-spacing: 3px; }

/* jars */
.jargrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.jar { background: #fffaf0; border: 2px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.jar svg { width: 84px; height: 112px; }
.jar h4 { margin: 4px 0 0; font: 700 17px var(--head); overflow-wrap: anywhere; }
.jar p { margin: 2px 0 8px; font-size: 15px; color: var(--ink-soft); }
.jar.full { border-color: var(--gold); background: #fff6dc; }
.jar form { display: flex; gap: 6px; }
.jar .field { min-width: 0; width: 100%; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--wood-dark); color: var(--cream); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 14px; font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: rise .35s ease-out; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* welcome */
.welcome { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: linear-gradient(rgba(31,39,25,.55), rgba(31,39,25,.9)), url(../assets/art/cut/cover-exterior.webp) center / cover; }
.welcome .card { width: min(100%, 520px); background: var(--cream); border: 3px solid var(--wood); border-radius: 20px; padding: 22px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.welcome h2 { font-size: 30px; text-align: center; }
.welcome p { margin: 10px 0; }
.fams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fams label { border: 2px solid var(--line); border-radius: 14px; padding: 8px 4px; text-align: center; background: #fffaf0; cursor: pointer; font-weight: 800; font-size: 15px; }
.fams img { height: 86px; max-width: 100%; object-fit: contain; display: block; margin: 0 auto 4px; }
.fams input { position: absolute; opacity: 0; }
.fams label:has(input:checked) { border-color: var(--rust); background: #fff1d6; box-shadow: inset 0 0 0 2px var(--gold); }
.fams label:has(input:focus-visible) { outline: 3px solid var(--gold); }

/* ---------- phone / tablet: panel is a full sheet ---------- */
@media (max-width: 1023px), (max-aspect-ratio: 5/4) {
  .panel { position: fixed; z-index: 60; inset: calc(var(--top) + env(safe-area-inset-top)) 0 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; animation: sheet .28s ease-out; }
  @keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
  body.panel-open { overflow: hidden; }
  .spot .tag { font-size: 14px; padding: 2px 8px; }
}
@media (max-width: 520px) {
  .top h1 { font-size: 17px; }
  .top-level .bar { display: none; }
  .top { gap: 6px; padding: 0 8px; }
  .spot { width: 24%; }
  .pouch { grid-template-columns: repeat(2, 1fr); }
  .clock { font-size: 54px; }
}

/* ---------- desktop: whole dollhouse on the left, panel docked right ---------- */
@media (min-width: 1024px) and (min-aspect-ratio: 5/4) {
  .stage { display: grid; grid-template-columns: auto minmax(380px, 1fr); gap: 20px; padding: 14px 20px; align-items: start; }
  .house { width: calc((100dvh - var(--top) - 28px) * 16 / 26.6); max-width: 58vw; margin: 0; position: sticky; top: calc(var(--top) + 14px); }
  .side { width: 100%; max-width: 640px; margin: 0; padding: 0; position: sticky; top: calc(var(--top) + 14px); height: calc(100dvh - var(--top) - 28px); display: flex; flex-direction: column; }
  .panel { flex: 1; min-height: 0; }
  .dash { overflow-y: auto; max-height: 100%; }
  body.panel-open .dash { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- phase 3: cauldron, map, keepsakes, story ---------- */
.emos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.emos button { min-height: 64px; border: 2px solid var(--line); background: var(--paper); border-radius: 14px; padding: 6px 2px; font-weight: 800; font-size: 15px; }
.emos .ic { display: block; font-size: 24px; line-height: 1.2; }
.emos button[aria-pressed="true"] { border-color: var(--rust); background: #fff1d6; box-shadow: inset 0 0 0 2px var(--gold); }
.emos button:focus-visible, .herb.pickable:focus-visible, .slot.full:focus-visible, .relic.choice:focus-visible, .pin:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.slot { min-height: 64px; border: 2px dashed var(--line); border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink-soft); font-weight: 700; font-size: 15px; background: none; padding: 6px; }
.slot.full { border-style: solid; border-color: var(--moss); background: #eef0dc; color: var(--ink); }
.slot img { width: 44px; height: 44px; object-fit: contain; }
.herb.pickable { text-align: left; min-height: 48px; }
.herb.pickable:hover:not([disabled]) { border-color: var(--gold); }
.herb.pickable[disabled] { opacity: .45; cursor: default; }
.btn.big { min-height: 52px; padding: 10px 24px; font-size: 18px; }
.btn.wide { display: block; width: 100%; margin-top: 10px; }

.brewcard { background: #fffaf0; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.brewcard.fresh { animation: steam .9s ease-out; border-color: var(--gold); }
@keyframes steam { from { opacity: 0; transform: translateY(14px) scale(.98); filter: blur(4px); } }
.brewcard h3 { margin: 2px 0 0 !important; font-size: 22px; }
.kicker { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--rust); }
.scene { font: 600 19px/1.55 var(--head); margin: 10px 0; }
.mirror { margin: 0 0 6px; padding: 10px 14px; border-left: 5px solid var(--gold); background: #fff1d6; border-radius: 0 12px 12px 0; font-weight: 700; font-size: 17px; }
.written { white-space: pre-wrap; margin: 10px 0 0; padding-top: 10px; border-top: 2px dashed var(--line); font-size: 16px; }
.entry { display: block; width: 100%; resize: vertical; font-size: 17px; line-height: 1.5; min-height: 140px; }

.mapwrap { position: relative; border: 3px solid var(--wood); border-radius: 12px; overflow: hidden; container-type: inline-size; }
.mapwrap img { display: block; width: 100%; }
.pin { position: absolute; top: var(--ty); left: var(--x); transform: translate(-50%, -50%); min-height: 44px; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--wood-dark); background: var(--gold); color: var(--wood-dark); font-weight: 800; font-size: 14px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin.new { animation: pinpulse 1.6s ease-in-out infinite; background: #ffe9a8; }
@keyframes pinpulse { 0%, 100% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 0 rgba(255,233,168,.9); } 50% { box-shadow: 0 2px 6px rgba(0,0,0,.35), 0 0 0 10px rgba(255,233,168,0); } }
.pin:hover { background: #fff3c9; }
.fog { position: absolute; transform: translate(-50%, -50%); width: 40%; aspect-ratio: 1.1; pointer-events: none; filter: blur(3px);
  background: radial-gradient(closest-side, rgba(238,234,222,.98) 40%, rgba(238,234,222,.85) 62%, rgba(238,234,222,0) 100%); }
.locart { display: block; width: 100%; border-radius: 12px; border: 3px solid var(--wood); margin: 8px 0 12px; }
.letter { background: #fbf4df url(../assets/art/cut/letter-paper.webp) center / cover; border: 2px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-top: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15); background-blend-mode: normal; }
.letter { background: linear-gradient(#fbf6e6, #f5ecd2); }
.letter p { font: 600 18px/1.6 var(--head); margin: 0 0 12px; }
.letter p.kicker { font: 800 14px var(--body); }
.letter p:last-child { margin-bottom: 0; }

.relics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.relic { background: #fffaf0; border: 2px solid var(--line); border-radius: 14px; padding: 8px; text-align: center; font-size: 14px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.relic img { height: 72px; max-width: 100%; object-fit: contain; }
.relic.locked img { filter: brightness(0) opacity(.18); }
.relic.locked { color: var(--ink-soft); }
.relic.choice[aria-pressed="true"] { border-color: var(--rust); background: #fff1d6; box-shadow: inset 0 0 0 2px var(--gold); }
.tile.wide { display: block; width: 100%; margin-top: 10px; }

.story { z-index: 95; }
.story .card h2 { margin: 4px 0 10px; }
.story .card p { font-size: 17px; }

#print { display: none; }
@media print {
  body { background: #fff !important; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; font-size: 12pt; padding: 0 8mm; }
  #print h1 { font-size: 26pt; text-align: center; margin-top: 30mm; }
  #print .by { text-align: center; margin-bottom: 20mm; }
  #print .brewcard, #print .letter { border: 0; border-top: 1px solid #999; border-radius: 0; background: none; box-shadow: none; padding: 6mm 0; break-inside: avoid; }
  #print .mirror { background: none; border-left: 2px solid #999; }
}
@media (max-width: 520px) { .emos { grid-template-columns: repeat(2, 1fr); } .scene { font-size: 18px; } }

/* ---------- phase 4: the living house ---------- */
.decor, .motes { position: absolute; inset: 0; pointer-events: none; }
.deco { position: absolute; transform: translateX(-50%); object-fit: contain; object-position: 50% 100%; z-index: 2; filter: drop-shadow(0 2px 2px rgba(40,25,10,.35)); }
.deco.hang { object-position: 50% 0; transform-origin: 50% 0; animation: hang 6s ease-in-out infinite; }
.deco.arrive { animation: arrive 1.1s ease-out; }
@keyframes arrive { 0% { opacity: 0; transform: translateX(-50%) translateY(-30%) scale(.6); filter: brightness(2.2); } 60% { opacity: 1; transform: translateX(-50%) scale(1.12); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes hang { 0%, 100% { transform: translateX(-50%) rotate(-1.5deg); } 50% { transform: translateX(-50%) rotate(1.5deg); } }

.plant { animation: sway 7s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: translateX(-50%) rotate(-1.2deg); } 50% { transform: translateX(-50%) rotate(1.2deg); } }

.motes i { position: absolute; width: .45%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,240,190,.9); box-shadow: 0 0 4px rgba(255,235,170,.9); opacity: 0; animation: mote 10s linear infinite; }
body[data-weather="morning"] .motes i { opacity: 1; }
@keyframes mote { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .7; } 100% { transform: translate(260%, -900%); opacity: 0; } }
body:not([data-weather="morning"]) .motes i { animation: none; opacity: 0; }

.steam { position: absolute; left: 40%; top: 36%; width: 7%; height: 24%; pointer-events: none; z-index: 3; opacity: .35; transition: opacity 1s; }
body.brewed .steam { opacity: 1; }
.steam i { position: absolute; bottom: 0; left: 50%; width: 46%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(rgba(255,255,255,.75), rgba(255,255,255,0) 70%); animation: puff 3.6s ease-out infinite; opacity: 0; }
.steam i:nth-child(2) { animation-delay: 1.2s; left: 38%; } .steam i:nth-child(3) { animation-delay: 2.4s; left: 60%; }
@keyframes puff { 0% { transform: translate(-50%, 0) scale(.4); opacity: 0; } 20% { opacity: .8; } 100% { transform: translate(-90%, -330%) scale(1.8); opacity: 0; } }

.candleglow, .lanternglow { position: absolute; pointer-events: none; z-index: 7; opacity: 0; transition: opacity 1.2s; mix-blend-mode: screen; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,214,130,.95) 0%, rgba(255,180,80,.45) 30%, rgba(255,160,60,0) 68%); animation: flicker 2.2s ease-in-out infinite; }
.candleglow { left: 3.8%; top: 30.5%; width: 14%; aspect-ratio: 1; }
.lanternglow { left: 64%; top: 26%; width: 16%; aspect-ratio: 1; animation-duration: 3.1s; }
body[data-weather="night"] .candleglow { opacity: .95; }
body[data-weather="night"].has-lantern .lanternglow { opacity: .9; }
body[data-weather="rain"] .candleglow { opacity: .5; }
body[data-weather="night"] .fireglow { opacity: .9; }
body[data-weather="rain"] .fireglow { opacity: .55; }

.nightwin { position: absolute; left: 23%; top: 19%; width: 54%; height: 52%; pointer-events: none; z-index: 1; opacity: 0; transition: opacity 1.2s; border-radius: 46% 46% 0 0 / 60% 60% 0 0;
  background: radial-gradient(1.5px 1.5px at 20% 22%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 42% 12%, #fff 99%, transparent), radial-gradient(2px 2px at 63% 26%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 78% 16%, #fff 99%, transparent), radial-gradient(1.5px 1.5px at 33% 34%, #fff 99%, transparent), linear-gradient(rgba(14,20,60,.85), rgba(30,40,90,.6)); }
body[data-weather="night"] .nightwin { opacity: .85; }
.roundwin { position: absolute; left: 43.6%; top: 35.5%; width: 12.8%; aspect-ratio: 1; border-radius: 50%; overflow: hidden; pointer-events: none; z-index: 1; transition: background 1.2s; }
.roundwin .rain { left: 0; top: 0; width: 100%; height: 100%; }
body[data-weather="night"] .roundwin { background: rgba(14,20,60,.7); }
body[data-weather="rain"] .roundwin { background: rgba(120,140,170,.3); }

.fog { animation: drift 9s ease-in-out infinite alternate; }
@keyframes drift { from { margin-left: -1.5%; opacity: .96; } to { margin-left: 1.5%; opacity: 1; } }

/* map labels: wide = names under each drawing, narrow = numbered markers + list below */
.pin.al-l { left: var(--l); transform: translate(0, -50%); }
.pin.al-r { left: auto; right: var(--r); transform: translate(0, -50%); }
.pin .no { display: none; }
@container (max-width: 560px) {
  .pin, .pin.al-l, .pin.al-r { left: var(--x); right: auto; top: var(--y); transform: translate(-50%, -50%); width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
  .pin .nm { display: none; }
  .pin .no { display: block; font: 800 18px var(--body); }
}
.places { display: grid; gap: 6px; margin-top: 10px; }
.place { display: flex; align-items: center; gap: 10px; min-height: 48px; text-align: left; background: #fffaf0; border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px 6px 6px; font-weight: 800; font-size: 16px; }
.place:hover, .place:focus-visible { border-color: var(--gold); outline: none; }
.place .no { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--wood-dark); border: 2px solid var(--wood-dark); }
.place em { margin-left: auto; font-style: normal; font-size: 14px; color: var(--rust); }
.place.new { border-color: var(--gold); background: #fff6dc; }
