:root {
  --parch: #fbf5e6;
  --parch-2: #f3e9d0;
  --parch-glass: rgba(251, 245, 230, 0.9);
  --ink: #2e3726;
  --ink-soft: #5f6852;
  --ink-faint: #8a8f7c;
  --gold: #c99a3e;
  --gold-deep: #a47a2b;
  --gold-soft: #f5e3b8;
  --moss: #5f8a3c;
  --moss-soft: #e4edd2;
  --lav: #7f6cbc;
  --lav-soft: #ebe5f8;
  --amber-soft: #f7e2c8;
  --amber-ink: #9a5b24;
  --rose: #b0503b;
  --line: rgba(120, 90, 40, 0.2);
  --shadow: 0 10px 30px rgba(52, 40, 18, 0.18), 0 2px 6px rgba(52, 40, 18, 0.1);
  --radius: 18px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --display: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  --sans: 'Nunito', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #e9d3a8;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; }

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.vignette {
  position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(60, 40, 10, 0.22) 100%);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.6em 1.1em; font-weight: 700; font-size: 0.95rem; line-height: 1.1;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  white-space: nowrap;
}
.btn svg { stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary {
  background: linear-gradient(180deg, #d9ae55, var(--gold-deep));
  color: #fffaf0; border-color: rgba(120, 80, 20, 0.35);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 12px rgba(150, 100, 30, 0.3);
  text-shadow: 0 1px 1px rgba(90, 60, 10, 0.35);
}
.btn.primary:hover { box-shadow: 0 2px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 18px rgba(150, 100, 30, 0.4); }
.btn.primary:disabled { opacity: 0.55; cursor: default; filter: saturate(0.6); }
.btn.primary.glow { animation: glow 2.4s ease-in-out infinite; }
.btn.big { font-size: 1.1rem; padding: 0.85em 2em; }
.btn.ghost { background: rgba(255, 255, 255, 0.55); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.85); }
.btn.ghost.danger { color: var(--rose); }
.btn.small { padding: 0.45em 0.9em; font-size: 0.85rem; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(217, 174, 85, 0.35), 0 6px 18px rgba(150, 100, 30, 0.4); } }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--parch-glass); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.icon-btn svg { fill: var(--ink-soft); width: 20px; height: 20px; }
.icon-btn.small { width: 32px; height: 32px; box-shadow: none; background: transparent; font-size: 0.85rem; color: var(--ink-soft); }
.icon-btn.small:hover { background: rgba(0, 0, 0, 0.05); }

:focus-visible { outline: 3px solid rgba(201, 154, 62, 0.7); outline-offset: 2px; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.6s ease, visibility 0s linear 0.6s; }
.screen > * { pointer-events: auto; }
body[data-screen="welcome"] #welcome,
body[data-screen="select"] #select,
body[data-screen="haven"] #haven,
body[data-screen="vale"] #vale,
body[data-screen="stars"] #stars,
body[data-screen="focus"] #focus { opacity: 1; visibility: visible; transition: opacity 0.8s ease 0.2s, visibility 0s; }

/* Loading */
.loading {
  position: fixed; inset: 0; display: grid; place-content: center; text-align: center; z-index: 50;
  background: radial-gradient(ellipse at center, #f6e6c2, #d9b98a);
  transition: opacity 0.9s ease, visibility 0s linear 0.9s;
}
.loading.done { opacity: 0; visibility: hidden; }
.loading-mark { font-family: var(--display); font-size: 2.4rem; letter-spacing: 0.3em; margin: 0; color: var(--gold-deep); }
.loading-text { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--ink-soft); margin: 0.3em 0 0; }

/* Welcome */
#welcome { display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse 60% 45% at center, rgba(45, 32, 10, 0.5), rgba(45, 32, 10, 0.12) 70%, rgba(45, 32, 10, 0.25)); }
.welcome-card { text-align: center; max-width: 560px; }
.wordmark {
  margin: 0; font-family: var(--display); font-weight: 700; color: #fffaf0;
  font-size: clamp(3.2rem, 13vw, 6rem); letter-spacing: 0.14em; line-height: 1;
  text-shadow: 0 2px 0 rgba(120, 80, 20, 0.35), 0 6px 30px rgba(80, 50, 10, 0.45);
}
.wordmark span {
  display: block; font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(1.4rem, 5vw, 2.1rem); letter-spacing: 0.06em; margin-top: 0.35em; color: #fdf1d6;
}
.tagline { font-family: var(--serif); font-size: clamp(1.1rem, 4vw, 1.35rem); color: #fffaf0; margin: 1.2em 0 2em; text-shadow: 0 1px 12px rgba(60, 40, 10, 0.6); }

/* Selection */
#select { display: flex; flex-direction: column; justify-content: space-between; padding: 20px 16px calc(20px + var(--safe-b)); }
.select-head { text-align: center; color: #fffaf0; text-shadow: 0 2px 16px rgba(60, 40, 10, 0.55); pointer-events: none; }
.select-head h2 { font-family: var(--display); font-weight: 700; font-size: clamp(1.4rem, 5vw, 2rem); letter-spacing: 0.06em; margin: 0.2em 0 0.1em; }
.select-head p { font-family: var(--serif); font-style: italic; font-size: 1.15rem; margin: 0; }
.select-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.dragon-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: min(760px, 100%); }
.dragon-card {
  text-align: left; display: flex; flex-direction: column; gap: 4px;
  background: var(--parch-glass); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.dragon-card:hover { transform: translateY(-2px); }
.dragon-card.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 154, 62, 0.3), var(--shadow); }
.swatch { display: flex; gap: 4px; margin-bottom: 4px; }
.swatch i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.12); }
.dragon-card .name { font-family: var(--display); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.04em; }
.dragon-card .trait { font-size: 0.78rem; font-weight: 700; color: var(--gold-deep); }
.dragon-card .blurb { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.35; }
@media (max-width: 560px) {
  .dragon-cards { gap: 8px; }
  .dragon-card { padding: 10px; }
  .dragon-card .blurb { display: none; }
  .dragon-card .trait { font-size: 0.7rem; }
  .dragon-card .name { font-size: 1.05rem; }
}

/* ---------- Haven HUD ---------- */
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px; pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.crest {
  pointer-events: none; color: #fffaf0;
  text-shadow: 0 1px 2px rgba(60, 40, 10, 0.4), 0 2px 18px rgba(60, 40, 10, 0.45);
}
.crest h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.3rem, 4vw, 1.8rem); letter-spacing: 0.08em; }
.crest p { margin: 0.1em 0 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.menu-wrap { position: relative; }
@media (min-width: 820px) { .menu-wrap { margin-right: 404px; } }
.menu {
  position: absolute; right: 0; top: 50px; min-width: 200px; z-index: 5;
  background: var(--parch); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 6px; display: flex; flex-direction: column;
}
.menu[hidden] { display: none; }
.menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.menu button:hover { background: var(--parch-2); }
.menu button.danger { color: var(--rose); }

/* ---------- Quest panel ---------- */
.quest-panel {
  position: absolute; display: flex; flex-direction: column;
  background: var(--parch-glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
@media (min-width: 820px) {
  .quest-panel { top: 16px; right: 16px; bottom: 16px; width: 380px; border-radius: 22px; }
  .panel-grip { display: none; }
}
@media (max-width: 819px) {
  .quest-panel {
    left: 0; right: 0; bottom: 0; max-height: 58vh; border-radius: 22px 22px 0 0;
    padding-bottom: var(--safe-b); transition: max-height 0.35s ease;
  }
  .quest-panel[data-open="false"] { max-height: calc(92px + var(--safe-b)); }
  .quest-panel[data-open="false"] .panel-body { overflow: hidden; }
}
.panel-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.panel-grip { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 80px; height: 20px; border: 0; background: none; display: grid; place-items: center; }
.panel-grip span { width: 40px; height: 4px; border-radius: 4px; background: rgba(90, 70, 30, 0.25); }
.panel-title h2 { margin: 0; white-space: nowrap; font-family: var(--display); font-weight: 700; font-size: 1.12rem; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; }
.panel-title h2[data-count]:not([data-count=""])::after {
  content: attr(data-count); font-family: var(--sans); font-size: 0.75rem; font-weight: 800;
  background: var(--gold-soft); color: var(--gold-deep); border-radius: 999px; padding: 2px 8px; letter-spacing: 0;
}
.panel-title .date { margin: 2px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.02rem; color: var(--ink-soft); }
.panel-body { overflow-y: auto; padding: 10px 12px 16px; flex: 1; overscroll-behavior: contain; }

.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.quest {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(255, 255, 255, 0.72); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; transition: opacity 0.4s ease, transform 0.4s ease, background 0.2s;
}
.quest:hover { background: rgba(255, 255, 255, 0.95); }
.quest.pri-high { border-left: 3px solid var(--gold); }
.quest.completing { opacity: 0; transform: translateX(16px) scale(0.98); }
.quest.done { background: rgba(255, 255, 255, 0.4); }
.quest.done .q-title { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.3); color: var(--ink-faint); }
.check {
  flex: none; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%;
  border: 2px solid rgba(95, 138, 60, 0.55); background: #fff; display: grid; place-items: center; padding: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.check svg { width: 15px; height: 15px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity 0.2s; }
.check:hover { border-color: var(--moss); background: var(--moss-soft); }
.check:hover svg { opacity: 0.6; stroke: var(--moss); }
.quest.done .check, .quest.completing .check, li.done > .check { background: var(--moss); border-color: var(--moss); }
.quest.done .check svg, .quest.completing .check svg, li.done > .check svg { opacity: 1; stroke: #fff; }
.check.small { width: 22px; height: 22px; }
.check.small svg { width: 13px; height: 13px; }
.quest-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.q-title { font-weight: 700; font-size: 0.98rem; line-height: 1.3; overflow-wrap: anywhere; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.q-meta:empty { display: none; }
.badge { white-space: nowrap; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--parch-2); color: var(--ink-soft); }
.badge.focus { background: var(--lav-soft); color: var(--lav); }
.badge.important { background: var(--gold-soft); color: var(--gold-deep); }
.badge.carried { background: var(--amber-soft); color: var(--amber-ink); }
.badge.steps { background: var(--moss-soft); color: var(--moss); }

.section { margin-top: 14px; }
.section summary { cursor: pointer; list-style: none; font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); padding: 6px 4px; display: flex; align-items: center; gap: 6px; }
.section summary::-webkit-details-marker { display: none; }
.section summary::before { content: '▸'; transition: transform 0.2s; font-size: 0.8em; }
.section[open] summary::before { transform: rotate(90deg); }
.section summary span { background: var(--parch-2); border-radius: 999px; padding: 0 7px; font-size: 0.75rem; }
.section .quest-list { margin-top: 6px; }

.empty { text-align: center; padding: 26px 16px; color: var(--ink-soft); }
.empty p { margin: 0.2em 0; line-height: 1.45; }
.empty-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); }

/* ---------- Caption + celebration ---------- */
.caption {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 10px);
  max-width: min(560px, calc(100vw - 32px)); z-index: 20;
  background: rgba(46, 55, 38, 0.82); color: #fdf6e4; backdrop-filter: blur(8px);
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.35; text-align: center;
  padding: 10px 18px; border-radius: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.4s ease, transform 0.4s ease;
}
.caption.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 820px) { body[data-screen="haven"] .caption { left: calc(50% - 198px); } }
@media (max-width: 819px) { body[data-screen="haven"] .caption { bottom: auto; top: 142px; } }
body[data-screen="select"] .caption { bottom: auto; top: 110px; }

.celebrate {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, 12px) scale(0.96); z-index: 30;
  width: min(420px, calc(100vw - 32px)); text-align: center;
  background: linear-gradient(180deg, #fffaf0, var(--parch)); border: 1px solid rgba(201, 154, 62, 0.5);
  border-radius: 22px; padding: 18px 22px 20px; box-shadow: 0 0 0 6px rgba(255, 240, 200, 0.35), var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.5s ease, transform 0.5s ease;
}
.celebrate.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
@media (min-width: 820px) { .celebrate { left: calc(50% - 198px); } }
.celebrate .eyebrow { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.2em; font-size: 0.8rem; color: var(--gold-deep); text-transform: uppercase; }
.celebrate h3 { margin: 6px 0 6px; font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.celebrate .line { margin: 0; color: var(--ink-soft); line-height: 1.45; }

/* ---------- Modals ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 30, 12, 0.35); opacity: 0; transition: opacity 0.22s ease; }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--parch); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 18px 20px 20px; opacity: 0; transform: translateY(12px) scale(0.98); transition: opacity 0.22s ease, transform 0.22s ease;
}
.modal-wrap.show .modal-backdrop { opacity: 1; }
.modal-wrap.show .modal { opacity: 1; transform: none; }
@media (max-width: 560px) {
  .modal-wrap { place-items: end center; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: calc(20px + var(--safe-b)); }
}
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.detail-head h2 { margin: 0; font-family: var(--display); font-size: 1.25rem; letter-spacing: 0.04em; }
.kind { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--moss); }
.kind.focus { color: var(--lav); }
.detail-title { font-family: var(--serif); font-weight: 600; font-size: 1.8rem; line-height: 1.15; margin: 0 0 10px; overflow-wrap: anywhere; }
.steps { margin-top: 18px; }
.steps h3 { font-size: 0.9rem; margin: 0 0 8px; display: flex; justify-content: space-between; color: var(--ink-soft); }
.steps h3 span { font-weight: 600; }
.progress { height: 6px; background: var(--parch-2); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #8fb86a, var(--moss)); border-radius: 6px; transition: width 0.4s ease; }
.step-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step-list li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.step-list li.done span { text-decoration: line-through; color: var(--ink-faint); }
.add-step-inline, .add-step { display: flex; gap: 8px; }
.add-step-inline input, .add-step input, .field input:not(.chip-input), .steps-edit input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}
.detail-actions, .form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

.quest-form .field { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.label { font-weight: 800; font-size: 0.88rem; }
.label small { font-weight: 600; color: var(--ink-faint); }
.error { color: var(--rose); font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg button {
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; text-align: left;
  display: flex; flex-direction: column; gap: 2px; transition: border-color 0.15s, background 0.15s;
}
.seg.small button { text-align: center; align-items: center; padding: 8px; font-weight: 700; font-size: 0.9rem; }
.seg button b { font-size: 0.95rem; }
.seg button small { color: var(--ink-faint); font-size: 0.78rem; }
.seg button.on { border-color: var(--gold); background: #fffaf0; box-shadow: 0 0 0 2px rgba(201, 154, 62, 0.2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .chip-input {
  background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 0.85rem;
}
.chip-input { width: 90px; font-weight: 600; }
.chip-input.date { width: 150px; }
.chips button.on, .chip-input.on { border-color: var(--gold); background: #fffaf0; color: var(--gold-deep); }
.steps-edit { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.steps-edit:empty { display: none; }
.steps-edit li { padding-left: 4px; }
.steps-edit li > * { vertical-align: middle; }
.steps-edit li { display: list-item; }
.steps-edit li input { width: calc(100% - 40px); }

/* ---------- Play button on Focus Quests ---------- */
.play {
  flex: none; align-self: center; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; border: 1px solid rgba(127, 108, 188, 0.35);
  background: var(--lav-soft); color: var(--lav); transition: background 0.2s, transform 0.15s;
}
.play svg { width: 15px; height: 15px; fill: currentColor; margin-left: 2px; }
.play:hover { background: #ddd4f5; transform: scale(1.06); }
.btn.primary svg[viewBox] path[d^="M8 5.5"] { fill: currentColor; stroke: none; }
.badge.focus-time { background: var(--lav-soft); color: var(--lav); }

/* ---------- Focus screen ---------- */
#focus { display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + var(--safe-b)); }
.focus-card {
  width: min(640px, 100%); display: flex; gap: 22px; align-items: center;
  background: var(--parch-glass); backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 18px 22px;
}
.focus-ring { position: relative; flex: none; width: 150px; height: 150px; }
.focus-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.focus-ring circle { fill: none; stroke-width: 7; }
.focus-ring .track { stroke: rgba(127, 108, 188, 0.14); }
.focus-ring .bar { stroke: var(--lav); stroke-linecap: round; transition: stroke-dashoffset 0.3s linear, stroke 0.4s; }
.focus-card[data-state="paused"] .bar { stroke: #b8aedb; }
.focus-card[data-state="finished"] .bar { stroke: var(--gold); }
.focus-time { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#focus-time { font-family: var(--serif); font-weight: 600; font-size: 2.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
#focus-status { margin-top: 4px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.focus-card[data-state="paused"] #focus-time { color: var(--ink-soft); animation: breathe 2.6s ease-in-out infinite; }
.focus-card[data-state="finished"] #focus-status { color: var(--gold-deep); }
@keyframes breathe { 50% { opacity: 0.55; } }
.focus-info { flex: 1; min-width: 0; }
.focus-info .kind { margin: 0; }
#focus-title { margin: 2px 0 4px; font-family: var(--serif); font-weight: 600; font-size: 1.6rem; line-height: 1.15; overflow-wrap: anywhere; }
.focus-activity { margin: 0 0 10px; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink-soft); line-height: 1.35; }
.step-list.compact { margin: 0 0 10px; max-height: 128px; overflow-y: auto; gap: 2px; }
.step-list.compact li { padding: 3px 2px; font-size: 0.92rem; }
.focus-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { margin-top: 8px; padding: 4px 0; background: none; border: 0; font-size: 0.82rem; font-weight: 600; color: var(--ink-faint); text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink-soft); }
body[data-screen="focus"] .caption { bottom: auto; top: 24px; }
body[data-screen="focus"] .celebrate { left: 50%; }
@media (max-width: 560px) {
  .focus-card { flex-direction: column; gap: 10px; text-align: center; padding: 16px; }
  .focus-ring { width: 128px; height: 128px; }
  #focus-time { font-size: 2.1rem; }
  #focus-title { font-size: 1.35rem; }
  .focus-actions { justify-content: center; }
  .step-list.compact { text-align: left; max-height: 96px; }
}

/* ---------- Panel tools: energy + Choose My Next Quest ---------- */
.panel-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.energy-card {
  background: linear-gradient(180deg, #fffaf0, rgba(255, 255, 255, 0.6)); border: 1px solid rgba(201, 154, 62, 0.35);
  border-radius: 16px; padding: 12px 12px 8px; text-align: center;
}
.energy-q { margin: 0 0 10px; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.energy-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.energy-options button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 700; font-size: 0.8rem;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.energy-options button:hover { border-color: var(--gold); background: #fffaf0; transform: translateY(-1px); }
.energy-card .link-btn { margin-top: 6px; }
.pips { display: inline-flex; gap: 3px; align-items: flex-end; vertical-align: middle; }
.pips i { width: 5px; border-radius: 2px; background: rgba(95, 138, 60, 0.18); }
.pips i:nth-child(1) { height: 6px; } .pips i:nth-child(2) { height: 9px; } .pips i:nth-child(3) { height: 12px; } .pips i:nth-child(4) { height: 15px; }
.pips i.on { background: var(--moss); }
.energy-line { margin: 0; font-size: 0.82rem; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; padding: 0 4px; }
.energy-line .link-btn { margin: 0; }
.choose-next {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 12px 14px; border-radius: 14px; font-weight: 800; font-size: 0.98rem; color: var(--gold-deep);
  background: linear-gradient(180deg, #fff8e6, #fbecc8); border: 1.5px solid rgba(201, 154, 62, 0.55);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6) inset, 0 3px 10px rgba(150, 100, 30, 0.12);
  transition: transform 0.15s, box-shadow 0.2s;
}
.choose-next svg { width: 18px; height: 18px; fill: var(--gold); }
.choose-next:hover { transform: translateY(-1px); box-shadow: 0 2px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 16px rgba(150, 100, 30, 0.2); }
.quest.spotlight { animation: spotlight 2.8s ease; }
@keyframes spotlight {
  0%, 60% { box-shadow: 0 0 0 3px rgba(201, 154, 62, 0.55), 0 0 22px rgba(255, 210, 120, 0.6); background: #fffaf0; }
  100% { box-shadow: none; }
}

/* ---------- Choose My Next Quest modal ---------- */
.next-intro { margin: 0 0 6px; color: var(--ink-soft); line-height: 1.45; }
.time-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.time-options button {
  padding: 14px 4px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); font-weight: 800; font-size: 0.92rem;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.time-options button:hover { border-color: var(--gold); background: #fffaf0; transform: translateY(-1px); }
@media (max-width: 480px) { .time-options { grid-template-columns: repeat(3, 1fr); } }
.energy-chips button { display: inline-flex; align-items: center; gap: 6px; }
.next-quest .eyebrow, .templates .eyebrow { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.18em; font-size: 0.78rem; color: var(--gold-deep); text-transform: uppercase; }
.just-step { margin: -2px 0 10px; font-size: 1rem; }
.just-step b { color: var(--moss); }
.reason { margin: 14px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink-soft); }
.next-quest > .link-btn, .quest-detail > .link-btn { display: block; margin: 12px auto 0; }

/* ---------- Templates ---------- */
.template-chips button { font-size: 0.82rem; }
.template-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.template-list li { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.t-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.t-name { font-weight: 800; }
.t-meta { font-size: 0.8rem; color: var(--ink-faint); }

/* ---------- Hatch & Treasures ---------- */
.menu-wrap { display: flex; gap: 10px; align-items: flex-start; }
.menu-wrap .menu { right: 0; }
.icon-btn.gem svg { fill: #e2b04e; width: 22px; height: 22px; }
.icon-btn.gem svg .shine { fill: #fff6dc; }
.hatch-ready {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 12px 14px; border-radius: 14px; font-weight: 800; color: #fffaf0;
  background: linear-gradient(180deg, #d9ae55, var(--gold-deep)); border: 1px solid rgba(120, 80, 20, 0.35);
  animation: glow 2.4s ease-in-out infinite;
}
.hatch-ready svg { width: 18px; height: 18px; fill: #fff6dc; }

.discovery {
  position: fixed; left: 50%; top: 20%; z-index: 32; transform: translate(-50%, 14px) scale(0.96);
  width: min(380px, calc(100vw - 32px)); text-align: center;
  background: linear-gradient(180deg, #fffaf0, var(--parch)); border: 1px solid rgba(201, 154, 62, 0.5);
  border-radius: 22px; padding: 18px 20px 14px; box-shadow: 0 0 0 6px rgba(255, 240, 200, 0.35), var(--shadow);
  opacity: 0; visibility: hidden; transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
}
.discovery.show { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); transition: opacity 0.45s ease, transform 0.45s ease; }
@media (min-width: 820px) { body[data-screen="haven"] .discovery { left: calc(50% - 198px); } }
.discovery .icon { width: 64px; height: 64px; filter: drop-shadow(0 4px 10px rgba(201, 154, 62, 0.35)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.discovery .eyebrow { margin: 4px 0 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.16em; font-size: 0.75rem; color: var(--gold-deep); text-transform: uppercase; }
.discovery h3 { margin: 4px 0 6px; font-family: var(--serif); font-size: 1.55rem; font-weight: 600; line-height: 1.15; }
.disc-desc { margin: 0 0 6px; color: var(--ink-soft); line-height: 1.45; }
.disc-desc.story { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink); }
.disc-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.discovery > .link-btn { margin-top: 6px; }
.hatch-card { top: auto; bottom: 24px; }
.hatch-card .field { text-align: left; margin-top: 10px; }
.hatch-card .rename-input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.baby-name { color: var(--moss); }
.baby-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.baby-dot.big { display: inline-block; width: 44px; height: 44px; margin: 8px 0 2px; }

/* Collection modal */
.collection-modal { width: min(600px, 100%); }
.tabs { display: flex; gap: 4px; background: var(--parch-2); border-radius: 999px; padding: 4px; margin: 6px 0 14px; }
.tabs button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 8px 6px; font-weight: 800; font-size: 0.88rem; color: var(--ink-soft); }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(60, 40, 10, 0.12); }
.egg-card { display: flex; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; }
.egg-svg { flex: none; width: 96px; height: 120px; }
.egg-info { flex: 1; min-width: 0; }
.egg-info .eyebrow { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.14em; font-size: 0.72rem; color: var(--gold-deep); text-transform: uppercase; }
.egg-stage { margin: 4px 0 10px; font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; }
.warmth { height: 10px; border-radius: 10px; background: var(--parch-2); overflow: hidden; }
.warmth i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, #f3d38a, #e8a64a); transition: width 0.5s ease; }
.egg-info .t-meta { display: block; margin: 6px 0 10px; }
.coll-h { margin: 18px 0 8px; font-size: 0.92rem; display: flex; justify-content: space-between; color: var(--ink-soft); }
.coll-h span { font-weight: 600; }
.coll-empty, .coll-note { margin: 0; color: var(--ink-faint); font-size: 0.9rem; }
.coll-note { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--ink-soft); margin-top: 8px; }
.coll-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.coll-grid li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; background: rgba(255, 255, 255, 0.5); border: 1px dashed var(--line); border-radius: 14px; padding: 10px 8px; }
.coll-grid li.found { background: #fff; border-style: solid; }
.coll-grid .icon { width: 44px; height: 44px; }
.c-name { font-weight: 800; font-size: 0.86rem; }
.coll-grid li:not(.found) .c-name { color: var(--ink-faint); font-weight: 600; }
.c-desc { font-size: 0.78rem; color: var(--ink-soft); line-height: 1.35; }
.coll-grid .link-btn { margin-top: 4px; font-size: 0.76rem; }
.story-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.story-list li { background: rgba(255, 255, 255, 0.5); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.story-list li.found { background: #fffaf0; border: 1px solid rgba(201, 154, 62, 0.35); }
.story-list p { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--ink-soft); }
.story-list li:not(.found) p { font-size: 0.95rem; color: var(--ink-faint); }
.rename-input { width: 100%; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); }
@media (max-width: 560px) { .egg-card { flex-direction: column; text-align: center; } .coll-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Verdant Vale + the Door ---------- */
.icon-btn.vale svg { fill: #6f9c4c; width: 22px; height: 22px; }
.icon-btn.vale svg circle { fill: #e2b04e; }
#vale .hud-top { align-items: center; }
body[data-screen="vale"] .caption { bottom: 28px; top: auto; left: 50%; }
.rune-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rune-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; border: 1px dashed var(--line); background: rgba(255, 255, 255, 0.45); }
.rune-list li.lit { background: #fffaf0; border: 1px solid rgba(201, 154, 62, 0.4); }
.rune-list img { flex: none; }
.rune-list li:not(.lit) .t-name { color: var(--ink-soft); }

/* ---------- Characters + Story Moments ---------- */
.dialogue {
  position: fixed; left: 50%; bottom: 20px; z-index: 34; transform: translate(-50%, 16px);
  width: min(560px, calc(100vw - 32px)); display: flex; gap: 14px; align-items: flex-start;
  background: linear-gradient(180deg, #fffaf0, var(--parch)); border: 1px solid rgba(201, 154, 62, 0.45);
  border-radius: 22px; padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer;
  opacity: 0; visibility: hidden; transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
.dialogue.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 0.35s ease, transform 0.35s ease; }
@media (min-width: 820px) { body[data-screen="haven"] .dialogue { left: calc(50% - 198px); } }
@media (max-width: 819px) { body[data-screen="haven"] .dialogue { bottom: auto; top: 86px; } }
.dlg-portrait { flex: none; width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); overflow: hidden; }
.dlg-portrait svg { width: 100%; height: 100%; display: block; }
.dlg-body { flex: 1; min-width: 0; }
.dlg-name { margin: 0; font-family: var(--display); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.1em; color: var(--gold-deep); text-transform: uppercase; }
.dlg-text { margin: 4px 0 8px; font-family: var(--serif); font-size: 1.22rem; line-height: 1.35; }
.dlg-actions { display: flex; justify-content: flex-end; }

.story-bars { position: fixed; inset: 0; z-index: 33; pointer-events: none; }
.story-bars .bar {
  position: absolute; left: 0; right: 0; background: rgba(24, 20, 12, 0.82); display: flex; align-items: center; justify-content: center;
  transition: transform 0.7s ease; pointer-events: auto;
}
.story-bars .bar.top { top: 0; height: 9vh; min-height: 48px; transform: translateY(-100%); justify-content: flex-end; padding-right: 18px; }
.story-bars .bar.bottom { bottom: 0; height: 17vh; min-height: 96px; transform: translateY(100%); padding: 0 20px calc(var(--safe-b)); }
.story-bars.show .bar { transform: none; }
.story-bars:not(.show) .bar { pointer-events: none; }
#story-skip { color: rgba(253, 246, 228, 0.7); }
#story-skip:hover { color: #fdf6e4; }
#story-text {
  margin: 0; max-width: 720px; text-align: center; color: #fdf6e4; font-family: var(--serif); font-style: italic;
  font-size: clamp(1.15rem, 3.4vw, 1.55rem); line-height: 1.35; opacity: 0;
}
#story-text.in { animation: storyIn 0.9s ease forwards; }
@keyframes storyIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body[data-screen="story"] .caption { display: none; }
.template-list.moments li.locked { background: rgba(255, 255, 255, 0.45); border-style: dashed; }
.template-list.moments li.locked .t-name { color: var(--ink-faint); }

/* ---------- Settings ---------- */
.switch-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.switch-list li { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.switch-row { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.sw-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sw-text small { color: var(--ink-soft); font-size: 0.82rem; line-height: 1.35; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { flex: none; width: 46px; height: 28px; border-radius: 999px; background: #d9d1bf; position: relative; transition: background 0.2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch-row input:checked + .sw { background: var(--moss); }
.switch-row input:checked + .sw::after { transform: translateX(18px); }
.switch-row input:focus-visible + .sw { outline: 3px solid rgba(201, 154, 62, 0.7); outline-offset: 2px; }
.volume { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); }
.volume input { flex: 1; accent-color: var(--moss); }
.settings-note { margin: 12px 0 0; font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- Welcome tour ---------- */
.tour { position: fixed; inset: 0; z-index: 45; display: none; }
.tour.show { display: block; }
.tour.dim { background: rgba(24, 18, 8, 0.5); }
.tour-spot {
  position: fixed; box-shadow: 0 0 0 200vmax rgba(24, 18, 8, 0.5), 0 0 0 3px rgba(255, 226, 150, 0.9), 0 0 24px rgba(255, 210, 120, 0.6);
  transition: all 0.4s ease; pointer-events: none;
}
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 32px)); background: linear-gradient(180deg, #fffaf0, var(--parch));
  border: 1px solid rgba(201, 154, 62, 0.5); border-radius: 20px; padding: 16px 18px 14px; box-shadow: var(--shadow);
  transition: left 0.35s ease, top 0.35s ease;
}
.tour-card .eyebrow { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.16em; font-size: 0.72rem; color: var(--gold-deep); text-transform: uppercase; }
.tour-card h3 { margin: 4px 0 4px; font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.tour-text { margin: 0; line-height: 1.5; color: var(--ink-soft); }
.tour-card .disc-actions { justify-content: flex-end; }

/* ---------- Larger text + reduced motion ---------- */
html.large-text { font-size: 112.5%; }
html.large-text .q-title { font-size: 1.05rem; }
html.large-text .badge { font-size: 0.8rem; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }

/* ================= V1 edits (from play-testing) ================= */

/* ---------- Dragon carousel ---------- */
.carousel { display: flex; align-items: center; gap: 10px; width: min(520px, 100%); }
.dragon-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
  background: var(--parch-glass); border: 1.5px solid rgba(201, 154, 62, 0.45); border-radius: var(--radius);
  padding: 14px 16px 12px; box-shadow: var(--shadow); backdrop-filter: blur(8px); touch-action: pan-y; user-select: none; cursor: grab;
}
.dragon-info .name { font-family: var(--display); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.06em; }
.dragon-info .trait { font-size: 0.85rem; font-weight: 800; color: var(--gold-deep); }
.dragon-info .blurb { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.4; }
.dragon-info .move { margin-top: 4px; font-size: 0.85rem; color: var(--ink-soft); }
.dragon-info .move b { color: var(--moss); }
.dragon-info .pager { margin-top: 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; color: var(--ink-faint); text-transform: uppercase; }
.icon-btn.arrow { flex: none; }
.icon-btn.arrow svg { fill: none; stroke: var(--ink-soft); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.arrow:disabled { opacity: 0.35; cursor: default; }
body[data-screen="select"] .caption { top: 104px; }

/* ---------- Today's Quests as a sheet: peek / half / full ---------- */
.panel-reopen { display: none; }
@media (min-width: 820px) {
  .quest-panel { transition: transform 0.4s ease, opacity 0.3s ease; }
  .panel-grip {
    display: grid; top: 50%; left: -15px; transform: translateY(-50%); width: 30px; height: 64px;
    background: var(--parch); border: 1px solid var(--line); border-radius: 12px 0 0 12px; box-shadow: -4px 2px 10px rgba(52, 40, 18, 0.12);
  }
  .panel-grip span { width: 4px; height: 28px; }
  .quest-panel[data-sheet="peek"] { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }
  body[data-sheet="peek"] .panel-reopen { display: inline-flex; position: absolute; top: 70px; right: 16px; box-shadow: var(--shadow); background: var(--parch-glass); }
  body[data-sheet="peek"] .menu-wrap { margin-right: 0; }
  body[data-sheet="peek"][data-screen="haven"] .caption,
  body[data-sheet="peek"][data-screen="haven"] .dialogue,
  body[data-sheet="peek"][data-screen="haven"] .discovery { left: 50%; }
}
@media (max-width: 819px) {
  .quest-panel { max-height: none; height: 46vh; transition: height 0.35s ease; touch-action: none; }
  .quest-panel.dragging { transition: none; }
  .quest-panel[data-sheet="full"] { height: 88vh; }
  .quest-panel[data-sheet="peek"] { height: calc(48px + var(--safe-b)); }
  .quest-panel .panel-body { touch-action: pan-y; }
  .panel-head { cursor: grab; touch-action: none; }
  .panel-grip { height: 22px; width: 120px; }
  .panel-grip span { width: 46px; height: 5px; }
  /* tucked away: just the handle and a small title */
  .quest-panel[data-sheet="peek"] .panel-head { padding: 20px 18px 8px; border-bottom: 0; justify-content: center; }
  .quest-panel[data-sheet="peek"] .date,
  .quest-panel[data-sheet="peek"] #new-quest,
  .quest-panel[data-sheet="peek"] .panel-body { display: none; }
  .quest-panel[data-sheet="peek"] .panel-title h2 { font-size: 0.82rem; color: var(--ink-soft); }
}

/* ---------- Captions you can read at your own pace ---------- */
.caption { display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; }
.caption.show { pointer-events: auto; }
.caption .cap-text { flex: 1; }
.caption .cap-next { flex: none; }
.caption.sticky { background: rgba(46, 55, 38, 0.92); padding: 12px 14px 12px 18px; }
@media (max-width: 560px) { .caption.sticky { flex-direction: column; align-items: stretch; text-align: center; } }

/* ---------- Story Moments: Next button ---------- */
.story-bars .bar.bottom { gap: 16px; height: 20vh; min-height: 112px; }
#story-next { flex: none; }
@media (max-width: 560px) { .story-bars .bar.bottom { flex-direction: column; gap: 10px; height: 24vh; } }

/* ---------- Celebration clips ---------- */
#clip-skip { display: none; position: fixed; top: 16px; right: 16px; z-index: 31; box-shadow: var(--shadow); }
body[data-screen="clip"] #clip-skip { display: inline-flex; }
/* The banner is a compact ribbon at the top, so the scene stays in view. */
.celebrate { top: 18px; width: min(380px, calc(100vw - 110px)); padding: 10px 18px 12px; border-radius: 18px; left: 50% !important; }
.celebrate h3 { font-size: 1.3rem; margin: 2px 0 2px; }
.celebrate .eyebrow { font-size: 0.7rem; }
.celebrate .line { font-size: 0.9rem; }
body[data-screen="clip"] .caption { bottom: 28px; top: auto; left: 50%; }
/* Reward cards sit low, so the reward itself is visible above them. */
.discovery { top: auto; bottom: 22px; padding: 14px 18px 14px; }
.discovery .icon { width: 48px; height: 48px; }
.discovery h3 { font-size: 1.35rem; }
body[data-screen="clip"] .discovery, body[data-screen="vale"] .discovery { left: 50%; }
body:has(.discovery.show) .caption { opacity: 0; }

/* ---------- How your dragon feels today ---------- */
.feel-pill {
  position: absolute; left: 16px; top: 86px; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--parch-glass); box-shadow: var(--shadow); color: var(--ink); cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.feel-pill:empty { display: none; }
.feel-pill .feel-icon { font-size: 1.35rem; line-height: 1; }
.feel-pill .feel-text { display: flex; flex-direction: column; text-align: left; font-weight: 800; font-size: 0.9rem; line-height: 1.1; }
.feel-pill small { font-size: 0.66rem; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.04em; }
.care-feel { display: flex; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--gold-soft); margin-top: 6px; }
.care-icon { font-size: 2.4rem; line-height: 1; }
.care-feel .eyebrow { margin: 0 0 2px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep); }
.care-quote { margin: 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.3; }
.care-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.care-btn, .treat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.7); font: 700 0.85rem var(--sans); color: var(--ink); cursor: pointer;
}
.care-btn span, .treat-btn span { font-size: 1.5rem; line-height: 1.2; }
.care-btn.wanted { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 154, 62, 0.35); background: #fffaf0; }
.care-treats { margin-top: 14px; }
.care-treats .eyebrow { margin: 0 0 6px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.treat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.treat-btn small { color: var(--ink-faint); }
.treat-btn.fav { border-color: #e79ab4; }
.card-emoji { display: block; font-size: 3rem; line-height: 1.1; margin: 2px auto 4px; }
.card-emoji.small { display: inline-block; font-size: 1.5rem; margin: 0; }
.disc-note { margin: 6px 0 0; font-size: 0.82rem; font-weight: 700; color: var(--lav); }
.c-tale { display: block; margin-top: 4px; font-size: 0.78rem; font-style: italic; color: var(--lav); }
.c-links { display: flex; gap: 10px; justify-content: center; }
.treat-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.treat-list li { padding: 6px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.6); border: 1px solid var(--line); font-weight: 700; font-size: 0.88rem; }
.treat-list small { color: var(--ink-faint); }

/* ---------- Placing a new thing in the Haven ---------- */
.place-bar {
  position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 22;
  width: min(460px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 18px;
  background: var(--parch-glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: none;
}
body[data-screen="place"] .place-bar { display: block; }
.place-bar p { margin: 0 0 10px; text-align: center; font-size: 0.95rem; }
.place-bar b { display: block; font-family: var(--serif); font-size: 1.25rem; }
.place-actions { display: flex; gap: 8px; justify-content: center; }

/* ---------- The Realm of Stars ---------- */
#stars .hud-top { align-items: center; }
.stars-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stars-actions .btn.ghost { background: rgba(30, 34, 70, 0.55); color: #f1ecff; border-color: rgba(200, 190, 255, 0.35); }
.realm-fade {
  position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity 0.85s ease;
  background: radial-gradient(circle at 50% 45%, #fff8e6 0%, #c9c2ff 35%, #2a2f6e 100%);
}
.realm-fade.on { opacity: 1; pointer-events: auto; }
.places { display: grid; gap: 10px; }
.place-btn {
  display: grid; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7); color: var(--ink); cursor: pointer; font: inherit;
}
.place-btn b { font-family: var(--serif); font-size: 1.3rem; }
.place-btn span { font-size: 0.86rem; color: var(--ink-soft); }
.place-btn.stars { background: linear-gradient(135deg, #2a2f6e, #4a3f86); color: #f6f1ff; border-color: transparent; }
.place-btn.stars span { color: #d6cff8; }

/* ---------- Something waiting in Dragon Haven ---------- */
#vale-btn { position: relative; }
#vale-btn.has-news::after {
  content: ''; position: absolute; top: 2px; right: 2px; width: 11px; height: 11px; border-radius: 50%;
  background: #f3b23c; box-shadow: 0 0 0 2px var(--parch), 0 0 10px #ffd98a; animation: newsPulse 2s ease-in-out infinite;
}
@keyframes newsPulse { 50% { transform: scale(1.25); } }

/* ---------- The egg's symbol and the Door's, side by side ---------- */
.symbol-card {
  position: fixed; left: 50%; top: 14vh; transform: translate(-50%, 10px); z-index: 34;
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 20px;
  background: rgba(30, 33, 28, 0.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity 0.5s ease, transform 0.5s ease;
}
.symbol-card.show { opacity: 1; transform: translate(-50%, 0); }
.symbol-card figure { margin: 0; display: grid; justify-items: center; gap: 6px; }
.symbol-card canvas { width: min(26vw, 120px); height: auto; }
.symbol-card figcaption { color: #fdf6e4; font: 800 0.72rem var(--sans); letter-spacing: 0.12em; text-transform: uppercase; }
.symbol-eq { color: #ffe3a0; font: 700 2.4rem var(--serif); text-shadow: 0 0 14px #ffd98a; }
.star-steps { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.9rem; }
.star-steps li { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.star-steps li.done { color: var(--ink); }
.star-steps .tick { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center; }
.star-steps li.done .tick { background: var(--gold); }
.star-steps .tick svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3; }
.star-steps small { color: var(--ink-faint); }

/* ---------- The Door as a journey ---------- */
.rune-list li.next { background: var(--gold-soft); border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(201, 154, 62, 0.45); }
.rune-list li.later { opacity: 0.5; }
.rune-list .t-eyebrow { display: block; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep); }

/* ---------- The old map, drawn out ---------- */
.old-map { display: block; width: min(340px, 100%); height: auto; margin: 0 auto; border-radius: 8px; box-shadow: 0 2px 10px rgba(52, 40, 18, 0.18); }
.discovery.with-map .old-map { width: min(300px, 100%); margin-bottom: 8px; }
.map-fresh { animation: mapFresh 1.6s ease-in-out 3; }
@keyframes mapFresh { 50% { opacity: 0.55; } }

/* ---------- Your dragon's wish (what happens next) ---------- */
.wish-card { padding: 10px 14px 11px; border-radius: 14px; background: var(--lav-soft); border: 1px solid rgba(127, 108, 188, 0.22); }
.wish-card .eyebrow { margin: 0 0 2px; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lav); }
.wish-card .wish-text { margin: 0; font-family: var(--serif); font-size: 1.08rem; line-height: 1.3; color: var(--ink); }
.wish-card .wish-progress { margin: 5px 0 0; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }

/* ---------- Thought bubbles over a character's head ---------- */
.bubble {
  position: fixed; left: 0; top: 0; z-index: 24; width: max-content; max-width: min(300px, calc(100vw - 28px));
  padding: 10px 15px 11px; border-radius: 22px; background: #fffdf6; border: 1px solid var(--line); box-shadow: var(--shadow);
  font: 600 0.98rem/1.36 var(--sans); color: var(--ink); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; will-change: transform; cursor: pointer;
}
.bubble.show { opacity: 1; pointer-events: auto; }
.bubble.interactive { cursor: default; }
.bubble p { margin: 0; }
.bubble .b-name { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 2px; }
.bubble .b-form { display: flex; gap: 6px; margin-top: 9px; }
.bubble .b-form input {
  flex: 1; min-width: 0; width: 170px; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font: 600 16px var(--sans); color: var(--ink);
}
.bubble .b-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 9px; }
.bubble .b-form + .b-actions { margin-top: 6px; }
.bubble .b-form + .b-actions .btn { background: none; border: 0; box-shadow: none; padding: 2px 8px; font-size: 0.78rem; color: var(--ink-faint); text-decoration: underline; }
/* the little trail of circles down to the thinker */
.bubble i { position: absolute; left: var(--tail, 50%); border-radius: 50%; background: #fffdf6; border: 1px solid var(--line); box-shadow: 0 2px 5px rgba(52, 40, 18, 0.12); }
.bubble i:nth-of-type(1) { width: 13px; height: 13px; bottom: -11px; margin-left: -9px; }
.bubble i:nth-of-type(2) { width: 7px; height: 7px; bottom: -21px; margin-left: -1px; }
.bubble.pinned i { display: none; }

/* ---------- Sound on/off on the focus timer ---------- */
.focus-card { position: relative; }
.sound-toggle {
  position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 9px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.6);
  font: 700 0.78rem var(--sans); color: var(--ink-soft); cursor: pointer;
}
.sound-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-toggle .slash { display: none; }
.sound-toggle[aria-pressed="false"] { color: var(--ink-faint); }
.sound-toggle[aria-pressed="false"] .waves { display: none; }
.sound-toggle[aria-pressed="false"] .slash { display: inline; }
@media (min-width: 561px) { .sound-toggle { top: auto; bottom: 14px; right: 16px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
body[data-screen="place"] .caption { display: none; }
