/* Time Travelers Club — visual system.
   Big, warm, high-contrast, generous tap targets. Deliberately NOT the adult Histomap's
   muted poster palette. Two reading levels scale type and chrome via html[data-level]. */

:root {
  --ink:        #1a1740;
  --ink-soft:   #4a4676;
  --paper:      #fffdf6;
  --paper-2:    #f4efff;

  --grape:      #2a1f6f;
  --grape-deep: #16123f;
  --violet:     #7b4bc4;
  --sun:        #ffc94a;
  --coral:      #ff6b6b;
  --mint:       #2fc98a;
  --sky:        #4cc9f0;

  --gold:       #ffb020;
  --stamp:      #d94f45;

  --r-sm: 12px;
  --r-md: 20px;
  --r-lg: 30px;
  --r-xl: 42px;

  --shadow:    0 6px 0 rgba(22, 18, 63, .22);
  --shadow-lg: 0 14px 34px rgba(22, 18, 63, .30);

  --fs-body: 1.05rem;
  --fs-read: 1.25rem;
  --fs-h1:   2.1rem;
  --tap: 56px;

  --topbar-h: 68px;

  font-family: 'Nunito', ui-rounded, 'Segoe UI Rounded', 'Trebuchet MS', system-ui, sans-serif;
}

/* Little Explorer (5-7): bigger everything, fewer words on screen. */
html[data-level="little"] {
  --fs-body: 1.2rem;
  --fs-read: 1.62rem;
  --fs-h1:   2.4rem;
  --tap: 64px;
}

* { box-sizing: border-box; }

/* An id selector with `display:` beats the UA's [hidden] rule, so state it once and loudly. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--grape-deep);
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(1200px 700px at 15% -10%, #4a2f9e 0%, transparent 60%),
    radial-gradient(1000px 800px at 95% 10%, #b4478c 0%, transparent 55%),
    linear-gradient(180deg, var(--grape) 0%, var(--grape-deep) 60%, #0d0a2b 100%);
  background-attachment: fixed;
  min-height: 100dvh;
}

h1, h2, h3, .display { font-family: 'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif; font-weight: 600; }

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------------------------------------------ boot */

.boot {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-content: center; justify-items: center; gap: 1.2rem;
  color: #fff; font-size: 1.1rem; letter-spacing: .02em;
  background: var(--grape-deep);
  transition: opacity .4s ease;
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-ship {
  width: 74px; height: 74px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--sun), var(--coral), var(--sky), var(--sun));
  animation: spin 1.4s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%);
          mask: radial-gradient(circle, transparent 52%, #000 54%);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- topbar */

#topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: .6rem;
  padding: 0 max(.7rem, env(safe-area-inset-left)) 0 max(.7rem, env(safe-area-inset-right));
  background: rgba(22, 18, 63, .72);
  backdrop-filter: blur(14px);
  border-bottom: 2px solid rgba(255, 255, 255, .10);
}
.crumb {
  flex: 1; min-width: 0; text-align: center;
  color: #fff; font-family: 'Fredoka', sans-serif; font-size: 1.15rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb-up {
  max-width: 100%; padding: .3rem .9rem; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.10); color: #fff;
  font-family: 'Fredoka', sans-serif; font-size: 1.1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb-up:hover { background: rgba(255,255,255,.2); }
.crumb-up::before { content: '↑ '; color: var(--sun); }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  min-height: 46px; padding: 0 .95rem;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-weight: 800; font-size: .95rem;
  transition: transform .12s ease, background .12s ease;
}
.chip:hover { background: rgba(255, 255, 255, .24); }
.chip:active { transform: scale(.94); }
.chip-ico { font-size: 1.2rem; }
.chip-count {
  min-width: 26px; padding: 0 .35rem; border-radius: 999px;
  background: var(--sun); color: var(--grape-deep);
  font-size: .85rem; font-weight: 800; text-align: center;
}
@media (max-width: 560px) { .chip-txt { display: none; } }

/* ------------------------------------------------------------------- app */

#app { display: block; }
.screen { max-width: 1100px; margin: 0 auto; padding: 1.4rem 1rem 7rem; }
.screen-wide { max-width: 1400px; }

.eyebrow {
  color: var(--sun); font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; font-size: .8rem; margin: 0 0 .35rem;
}
.screen h1 { color: #fff; font-size: var(--fs-h1); margin: 0 0 .3rem; line-height: 1.1; }
.screen .sub { color: #cfc7ff; font-size: var(--fs-body); margin: 0 0 1.5rem; max-width: 46ch; }

/* --------------------------------------------------------------- welcome */

.welcome { min-height: calc(100dvh - 2rem); display: grid; align-content: center; gap: 1.2rem; text-align: center; }
.welcome h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.welcome .sub { margin: 0 auto 1rem; }

.pick-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pick {
  display: grid; justify-items: center; gap: .6rem;
  padding: 1.2rem .8rem;
  border: 3px solid transparent; border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .10); color: #fff;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.pick:hover { transform: translateY(-4px); background: rgba(255,255,255,.18); }
.pick:active { transform: scale(.96); }
.pick[aria-pressed="true"] { border-color: var(--sun); background: rgba(255, 201, 74, .20); }
.pick svg { width: 96px; height: 96px; }
.pick-name { font-family: 'Fredoka', sans-serif; font-size: 1.2rem; }
.pick-note { font-size: .9rem; color: #cfc7ff; line-height: 1.35; }

.name-row { display: grid; gap: .5rem; justify-items: center; margin-top: 1.6rem; }
.name-label { color: #cfc7ff; font-weight: 700; font-size: .95rem; }
.name-input {
  width: min(320px, 90%); min-height: 52px; padding: 0 1.1rem;
  border: 3px solid rgba(255,255,255,.2); border-radius: 999px;
  background: rgba(255,255,255,.1); color: #fff;
  font: inherit; font-size: 1.1rem; text-align: center;
}
.name-input::placeholder { color: #a79fd6; }
.name-input:focus { border-color: var(--sun); outline: none; }

.level-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.level-card {
  display: grid; gap: .5rem; justify-items: center; text-align: center;
  padding: 1.6rem 1.2rem; border: 0; border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-lg);
  transition: transform .14s ease;
}
.level-card:hover { transform: translateY(-5px); }
.level-card:active { transform: scale(.97); }
.level-card .big { font-family: 'Fredoka', sans-serif; font-size: 1.5rem; }
.level-card .say { color: var(--ink-soft); font-size: 1rem; line-height: 1.4; }
.level-card .demo {
  margin-top: .3rem; padding: .6rem .8rem; border-radius: var(--r-sm);
  background: var(--paper-2); font-size: .95rem; color: var(--ink-soft); font-style: italic;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: 0 1.6rem;
  border: 0; border-radius: 999px;
  background: var(--sun); color: var(--grape-deep);
  font-family: 'Fredoka', sans-serif; font-size: 1.15rem;
  box-shadow: var(--shadow);
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(22,18,63,.22); }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; }
.btn-ghost:active { transform: scale(.95); }
/* On a white card the translucent-white ghost button is invisible. */
.block .btn-ghost, .moment-hero .btn-ghost {
  background: var(--paper-2); color: var(--ink-soft);
}
.block .btn-ghost:hover { background: #e6dfff; }

/* --------------------------------------------------------------- islands */

.island-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.island-card {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 0; border: 0; border-radius: var(--r-lg); overflow: hidden;
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-lg);
  transition: transform .16s ease;
}
.island-card:hover { transform: translateY(-6px) rotate(-.4deg); }
.island-card:active { transform: scale(.98); }
.island-art { display: block; width: 100%; aspect-ratio: 16 / 9; }
.island-body { display: block; padding: .9rem 1.1rem 1.1rem; }
.island-body h2 { margin: 0 0 .15rem; font-size: 1.28rem; }
.island-years { display: block; color: var(--violet); font-weight: 800; font-size: .88rem; }
.island-blurb { display: block; color: var(--ink-soft); font-size: .97rem; line-height: 1.4; margin: .45rem 0 .8rem; min-height: 2.7em; }

.progress { display: flex; align-items: center; gap: .7rem; margin-top: .2rem; }
.progress-track { flex: 1; height: 14px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--sky)); transition: width .5s ease; }
.progress-num { font-weight: 800; font-size: .9rem; color: var(--ink-soft); white-space: nowrap; }
.island-card.done .progress-fill { background: linear-gradient(90deg, var(--sun), var(--gold)); }
.island-done-flag {
  position: absolute; top: .7rem; right: .7rem;
  padding: .3rem .7rem; border-radius: 999px;
  background: var(--sun); color: var(--grape-deep); font-weight: 800; font-size: .8rem;
}

/* ---------------------------------------------------------- moment cards */

.moment-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.mcard {
  position: relative; display: grid; gap: .1rem;
  padding: 0; border: 0; border-radius: var(--r-md); overflow: hidden;
  background: var(--paper); color: var(--ink); text-align: left;
  box-shadow: var(--shadow);
  transition: transform .14s ease;
}
.mcard:hover { transform: translateY(-4px); }
.mcard:active { transform: scale(.97); }
.mcard-thumb { display: block; position: relative; aspect-ratio: 1 / 1; background: var(--paper-2); overflow: hidden; }
.mcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard-thumb .fallback { display: grid; place-content: center; height: 100%; font-size: 2.6rem; }
.mcard-body { display: block; padding: .55rem .7rem .75rem; }
.mcard-title { display: block; font-family: 'Fredoka', sans-serif; font-size: 1.02rem; line-height: 1.2; }
.mcard-year { display: block; margin-top: .15rem; color: var(--violet); font-weight: 800; font-size: .84rem; }
.mcard.seen::after {
  content: '✓'; position: absolute; top: .5rem; left: .5rem;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-content: center;
  background: var(--mint); color: #fff; font-weight: 800; font-size: 1rem;
  box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.rar-legend { box-shadow: 0 0 0 3px var(--gold), var(--shadow); }
.rar-rare   { box-shadow: 0 0 0 3px var(--sky), var(--shadow); }
.mcard-heavy {
  position: absolute; top: .5rem; right: .5rem;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-content: center;
  background: rgba(26,23,64,.78); color: #fff; font-size: .9rem;
}

/* --------------------------------------------------------- moment detail */

.moment { max-width: 780px; margin: 0 auto; padding: 1.2rem 1rem 8rem; }
.moment-hero {
  border-radius: var(--r-lg); overflow: hidden; background: var(--paper);
  box-shadow: var(--shadow-lg);
}
.moment-img { display: block; position: relative; background: var(--paper-2); aspect-ratio: 16 / 10; overflow: hidden; touch-action: pan-y; }
.moment-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.moment-img .fallback { display: grid; place-content: center; height: 100%; font-size: 5rem; }

/* ------------------------------------------------------------------ gallery */

.gal-strip { display: flex; height: 100%; transition: transform .38s cubic-bezier(.3,.7,.2,1); }
.gal-cell { flex: 1 1 0; min-width: 0; height: 100%; overflow: hidden; }

/* Ken Burns. A still photograph with a slow drift on it reads as alive; four directions are
   cycled so consecutive pictures never pan the same way. Only the visible cell animates. */
.gal-cell img { transform-origin: center; will-change: transform; }
.gal-cell.on.kb1 img { animation: kb1 16s ease-out both; }
.gal-cell.on.kb2 img { animation: kb2 16s ease-out both; }
.gal-cell.on.kb3 img { animation: kb3 16s ease-out both; }
.gal-cell.on.kb4 img { animation: kb4 16s ease-out both; }
@keyframes kb1 { from { transform: scale(1.02) translate(0, 0); }      to { transform: scale(1.17) translate(-2%, 1.5%); } }
@keyframes kb2 { from { transform: scale(1.17) translate(2%, -1%); }   to { transform: scale(1.02) translate(0, 0); } }
@keyframes kb3 { from { transform: scale(1.04) translate(1.5%, 1%); }  to { transform: scale(1.18) translate(-1%, -2%); } }
@keyframes kb4 { from { transform: scale(1.16) translate(-2%, -1.5%); } to { transform: scale(1.03) translate(1%, 0); } }
.gal-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: rgba(26, 23, 64, .55); color: #fff; font-size: 1.9rem; line-height: 1;
  backdrop-filter: blur(4px);
  display: grid; place-content: center;
}
.gal-arrow:hover { background: rgba(26, 23, 64, .8); }
.gal-prev { left: .6rem; }
.gal-next { right: .6rem; }
.gal-count {
  position: absolute; top: .6rem; right: .7rem;
  padding: .25rem .6rem; border-radius: 999px;
  background: rgba(26, 23, 64, .6); color: #fff; font-size: .78rem; font-weight: 800;
}
.gal-dots { position: absolute; left: 0; right: 0; bottom: .55rem; display: flex; justify-content: center; gap: .35rem; }
.gal-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.5); transition: transform .2s ease, background .2s ease; }
.gal-dots i.on { background: var(--sun); transform: scale(1.45); }
.moment-imgnote {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: .35rem .7rem; font-size: .72rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.62));
}
.moment-head { padding: 1.1rem 1.3rem .2rem; }
.moment-head h1 { color: var(--ink); font-size: clamp(1.7rem, 5vw, 2.3rem); margin: 0; line-height: 1.1; }
.moment-when { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .8rem; margin: .4rem 0 0; }
.moment-year { font-family: 'Fredoka', sans-serif; font-size: 1.25rem; color: var(--violet); }
.moment-ago { color: var(--ink-soft); font-weight: 700; font-size: .98rem; }

.read {
  padding: 1rem 1.3rem 1.3rem;
  font-size: var(--fs-read); line-height: 1.62; color: var(--ink);
}
.read .w { border-radius: 5px; transition: background .08s linear; }
.read .w.on { background: var(--sun); }

.readbar { display: flex; gap: .6rem; align-items: center; padding: 0 1.3rem 1.2rem; flex-wrap: wrap; }
.btn-read {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 52px; padding: 0 1.3rem; border: 0; border-radius: 999px;
  background: var(--violet); color: #fff; font-family: 'Fredoka', sans-serif; font-size: 1.08rem;
  box-shadow: 0 5px 0 #5a34a0;
}
.btn-read:active { transform: translateY(3px); box-shadow: 0 2px 0 #5a34a0; }
.btn-read.playing { background: var(--coral); box-shadow: 0 5px 0 #cc4b4b; }
.level-swap {
  margin-left: auto; border: 2px solid var(--paper-2); border-radius: 999px;
  background: transparent; color: var(--ink-soft);
  min-height: 44px; padding: 0 1rem; font-weight: 800; font-size: .9rem;
}

.facts { display: grid; gap: .8rem; margin: 1.1rem 0; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fact {
  padding: 1rem 1.1rem; border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-size: 1.05rem; line-height: 1.45;
}
.fact b { display: block; font-family: 'Fredoka', sans-serif; font-size: 1.05rem; margin-bottom: .25rem; }
.fact-wow  { background: #fff3cf; color: #6a4b00; }
.fact-yuck { background: #dff7ea; color: #12603f; }

.block { background: var(--paper); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; margin: 1rem 0; box-shadow: var(--shadow); }
.block > h2 {
  margin: 0 0 .2rem; font-size: 1.25rem; color: var(--ink);
  display: flex; align-items: center; gap: .5rem;
}
.block > .hint { margin: 0 0 .8rem; color: var(--ink-soft); font-size: .95rem; line-height: 1.4; }

.mini-row { display: flex; gap: .6rem; overflow-x: auto; padding-bottom: .4rem; scroll-snap-type: x mandatory; }
.mini {
  flex: 0 0 auto; width: 132px; scroll-snap-align: start;
  display: grid; gap: .2rem; padding: 0 0 .5rem;
  border: 0; border-radius: var(--r-sm); overflow: hidden;
  background: var(--paper-2); color: var(--ink); text-align: left;
  transition: transform .12s ease;
}
.mini:hover { transform: translateY(-3px); }
.mini-thumb { display: block; aspect-ratio: 4 / 3; background: #e6dfff; overflow: hidden; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-thumb .fallback { display: grid; place-content: center; height: 100%; font-size: 1.8rem; }
.mini-name { padding: 0 .5rem; font-weight: 800; font-size: .86rem; line-height: 1.2; }
.mini-where { padding: 0 .5rem; font-size: .76rem; color: var(--violet); font-weight: 700; }

.watch { display: grid; gap: .5rem; }
.watch-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .8rem; border-radius: var(--r-sm);
  background: var(--paper-2); color: var(--ink); text-decoration: none;
}
.watch-item:hover { background: #e9e0ff; }
.watch-play { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-content: center; font-size: 1rem; }
.watch-meta { font-size: .82rem; color: var(--ink-soft); }

.heavy-note {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .9rem 1rem; margin: 1rem 0; border-radius: var(--r-md);
  background: rgba(255,255,255,.12); color: #efeaff; font-size: .95rem; line-height: 1.45;
}

.collect-row { display: flex; justify-content: center; padding: .5rem 0 0; }
.btn-collect { background: var(--mint); box-shadow: 0 6px 0 #1f9e69; color: #063d28; }
.btn-collect:active { box-shadow: 0 3px 0 #1f9e69; }
.btn-collect.got { background: var(--paper-2); color: var(--ink-soft); box-shadow: 0 6px 0 #cfc4ee; }

/* -------------------------------------------------------------- passport */

.passport-head {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.2rem 1.3rem; margin-bottom: 1.2rem;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, #8a2f3f, #5e1c2b);
  color: #ffe9d6; box-shadow: var(--shadow-lg);
}
.passport-head h1 { color: #fff; margin: 0; font-size: 1.9rem; }
.passport-head .who { font-weight: 800; opacity: .85; }
.passport-big { margin-left: auto; text-align: right; }
.passport-big b { display: block; font-family: 'Fredoka', sans-serif; font-size: 2.6rem; line-height: 1; color: var(--sun); }

.stamp-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.stamp { display: grid; justify-items: center; gap: .35rem; text-align: center; }
.stamp svg { width: 104px; height: 104px; }
.stamp.locked svg { opacity: .26; filter: grayscale(1); }
.stamp-name { font-size: .85rem; font-weight: 800; color: #fff; line-height: 1.2; }
.stamp.locked .stamp-name { color: #a79fd6; }
.stamp-hint { font-size: .74rem; color: #8078b8; line-height: 1.2; }

/* ---------------------------------------------------------------- co-pilot */

.copilot { position: fixed; right: 1rem; bottom: 1rem; z-index: 45; display: flex; align-items: flex-end; gap: .5rem; }
.copilot-body {
  width: 78px; height: 78px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.14); backdrop-filter: blur(8px);
  display: grid; place-content: center;
  box-shadow: var(--shadow-lg);
  animation: bob 3.4s ease-in-out infinite;
}
.copilot-body svg { width: 62px; height: 62px; }
.copilot-body:active { transform: scale(.92); }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.copilot-bubble {
  order: -1; max-width: min(56vw, 300px);
  padding: .75rem .95rem; border-radius: var(--r-md) var(--r-md) 4px var(--r-md);
  background: var(--paper); color: var(--ink);
  font-size: .98rem; line-height: 1.4; font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: pop .25s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ------------------------------------------------------------------ misc */

.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
  z-index: 60; max-width: 90vw;
  padding: .85rem 1.3rem; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 800;
  box-shadow: var(--shadow-lg);
  animation: pop .25s cubic-bezier(.2,1.4,.4,1);
}

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i {
  position: absolute; width: 11px; height: 15px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .1; } }

.empty { color: #cfc7ff; text-align: center; padding: 3rem 1rem; font-size: 1.05rem; }

/* ------------------------------------------------------------ journey path */

.screen-path { padding-bottom: 9rem; }

.journey-start {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.2rem; margin-bottom: .8rem;
  border-radius: var(--r-lg); background: rgba(255,255,255,.10);
}
.journey-start .progress { flex: 1 1 220px; }
.journey-start .progress-track { background: rgba(255, 255, 255, .18); }
.btn-journey { background: var(--mint); color: #063d28; box-shadow: 0 6px 0 #1f9e69; }
.btn-journey:active { box-shadow: 0 3px 0 #1f9e69; }

.path { list-style: none; margin: 1.6rem 0 0; padding: 0; position: relative; }
.path::before {
  content: ''; position: absolute; left: 50%; top: 10px; bottom: 10px;
  border-left: 5px dashed rgba(255, 255, 255, .17); transform: translateX(-50%);
}
/* Two columns so each card hugs the dashed line down the middle — laid out with flex they
   drifted to the page edges and the "path" stopped reading as a path. */
.stop {
  display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.6rem;
  margin-bottom: .9rem;
  animation: stopPop .45s cubic-bezier(.2,1.2,.4,1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.stop.left  .stop-btn { grid-column: 1; justify-self: end; }
.stop.right .stop-btn { grid-column: 2; justify-self: start; }
@keyframes stopPop { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }

.stop-btn {
  display: flex; align-items: center; gap: .85rem;
  width: min(100%, 430px); padding: .55rem .9rem .55rem .55rem;
  border: 0; border-radius: 999px;
  background: var(--paper); color: var(--ink); text-align: left;
  box-shadow: var(--shadow);
  transition: transform .14s ease;
}
.stop.right .stop-btn { flex-direction: row-reverse; text-align: right; padding: .55rem .55rem .55rem .9rem; }
.stop-btn:hover { transform: scale(1.03); }
.stop-btn:active { transform: scale(.97); }

.stop-medal { position: relative; flex: 0 0 auto; }
.stop-thumb {
  display: block; width: 66px; height: 66px; border-radius: 50%; overflow: hidden;
  background: var(--paper-2); box-shadow: 0 0 0 4px #ded5ff;
}
.stop-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stop-thumb .fallback { display: grid; place-content: center; height: 100%; font-size: 1.7rem; }
.stop-num {
  position: absolute; right: -4px; bottom: -4px;
  min-width: 26px; height: 26px; padding: 0 .25rem; border-radius: 999px;
  background: var(--violet); color: #fff; font-weight: 800; font-size: .85rem;
  display: grid; place-content: center; box-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.stop-heavy {
  position: absolute; left: -4px; top: -2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: .7rem;
  display: grid; place-content: center;
}
.stop.seen .stop-thumb { box-shadow: 0 0 0 4px var(--mint); }
.stop.seen .stop-num { background: var(--mint); color: #063d28; }
.stop.here .stop-thumb { box-shadow: 0 0 0 4px var(--sun); animation: hereGlow 2s ease-in-out infinite; }
@keyframes hereGlow { 0%,100% { box-shadow: 0 0 0 4px var(--sun); } 50% { box-shadow: 0 0 0 9px rgba(255,201,74,.35); } }

.stop-info { min-width: 0; }
.stop-info b { display: block; font-family: 'Fredoka', sans-serif; font-size: 1.02rem; line-height: 1.15; }
.stop-info i { display: block; font-style: normal; color: var(--violet); font-weight: 800; font-size: .82rem; }

@media (max-width: 720px) {
  .path::before { left: 41px; }
  .stop { grid-template-columns: 1fr; column-gap: 0; }
  .stop.left .stop-btn, .stop.right .stop-btn {
    grid-column: 1; justify-self: stretch;
    width: 100%; flex-direction: row; text-align: left;
    padding: .55rem .9rem .55rem .55rem;
  }
}

/* ----------------------------------------------------------- story panel */

.bridge {
  margin: 0 0 1rem; padding: .85rem 1.1rem;
  border-left: 5px solid var(--sun); border-radius: 0 var(--r-md) var(--r-md) 0;
  background: rgba(255, 201, 74, .13); color: #ffe9b8;
  font-size: 1.06rem; line-height: 1.45; font-style: italic;
}
.bridge span { font-style: normal; color: var(--sun); }

.stop-badge {
  display: inline-block; margin-bottom: .35rem;
  padding: .2rem .7rem; border-radius: 999px;
  background: var(--paper-2); color: var(--violet);
  font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}

.stop-in  { animation: stopIn .34s cubic-bezier(.25,.9,.3,1) both; }
@keyframes stopIn  { from { opacity: 0; transform: translateX(34px); } to { opacity: 1; transform: none; } }
.stop-out { animation: stopOut .2s ease both; }
@keyframes stopOut { to { opacity: 0; transform: translateX(-26px); } }

.end-card { text-align: center; }
.end-card .btn { margin-top: .4rem; }

/* -------------------------------------------------------------- quiz */

.quiz { margin: 0; }
.quiz + .quiz { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 2px dashed var(--paper-2); }
.quiz-q {
  margin: 0 0 .8rem; font-family: 'Fredoka', sans-serif;
  font-size: 1.18rem; line-height: 1.3; color: var(--ink);
}
.quiz-opts { display: grid; gap: .55rem; }
.quiz-opt {
  min-height: 54px; padding: .7rem 1rem;
  border: 3px solid var(--paper-2); border-radius: var(--r-md);
  background: #fff; color: var(--ink);
  font-size: 1.03rem; font-weight: 700; text-align: left; line-height: 1.35;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--violet); transform: translateX(3px); }
.quiz-opt:active:not(:disabled) { transform: scale(.98); }
.quiz-opt:disabled { opacity: 1; }
.quiz-opt.right {
  border-color: var(--mint); background: #dff7ea; color: #0d5637;
  animation: rightPop .4s cubic-bezier(.2,1.4,.4,1);
}
.quiz-opt.right::after { content: ' ✓'; font-weight: 800; }
.quiz-opt.wrong { border-color: #e7b7b7; background: #fdf0f0; color: #8a4b4b; }
@keyframes rightPop { 0% { transform: scale(1); } 45% { transform: scale(1.05); } 100% { transform: scale(1); } }

.quiz-why {
  margin: .8rem 0 0; padding: .8rem 1rem; border-radius: var(--r-md);
  background: var(--paper-2); color: var(--ink-soft);
  font-size: 1rem; line-height: 1.45; font-weight: 700;
  animation: pop .3s cubic-bezier(.2,1.4,.4,1);
}
.quiz-why.is-right { background: #dff7ea; color: #0d5637; }

.quiz-score {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  font-family: 'Fredoka', sans-serif; font-size: 1.3rem; color: var(--ink);
}

/* ------------------------------------------------------- quiz + games UI */

.qz-screen { padding-bottom: 5rem; }
.qz-dots { display: flex; justify-content: center; gap: .5rem; margin: 0 0 1.2rem; }
.qz-dots i {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,.2); transition: transform .2s ease, background .2s ease;
}
.qz-dots i.done { background: var(--mint); }
.qz-dots i.now  { background: var(--sun); transform: scale(1.4); }

.qz-count { margin: 0 0 .5rem; color: var(--violet); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.qz-nav { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.qz-next { min-width: 190px; }
.qz-result { text-align: center; }
.qz-result h2 { margin: .6rem 0 .3rem; font-size: 1.5rem; }
.qz-art { display: block; max-width: 320px; margin: 0 auto; }
.qz-art svg { width: 100%; height: auto; border-radius: var(--r-md); }

.islands-foot { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 2.2rem; }
.btn-games { background: var(--coral); color: #fff; box-shadow: 0 6px 0 #cc4b4b; }
.btn-games:active { box-shadow: 0 3px 0 #cc4b4b; }
.foot-link { color: #cfc7ff; font-weight: 700; }

.game-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.game-card {
  display: grid; justify-items: center; gap: .35rem; text-align: center;
  padding: 1.6rem 1.1rem; border: 0; border-radius: var(--r-lg);
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow-lg);
  transition: transform .15s ease;
}
.game-card:hover { transform: translateY(-5px); }
.game-card:active { transform: scale(.97); }
.game-emoji { font-size: 2.6rem; line-height: 1; }
.game-emoji.big { font-size: 3.6rem; }
.game-name { font-family: 'Fredoka', sans-serif; font-size: 1.25rem; }
.game-blurb { color: var(--ink-soft); font-size: .95rem; line-height: 1.35; }
.game-best { margin-top: .3rem; padding: .2rem .7rem; border-radius: 999px; background: var(--paper-2); color: var(--violet); font-weight: 800; font-size: .8rem; }

.game-subject { display: flex; align-items: center; gap: .8rem; margin: 0 0 .8rem; font-weight: 800; color: var(--ink-soft); }
.game-subject-name { font-family: 'Fredoka', sans-serif; font-size: 1.2rem; color: var(--ink); }
.game-thumb { display: block; flex: 0 0 auto; width: 84px; height: 84px; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-2); }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-thumb .fallback { display: grid; place-content: center; height: 100%; font-size: 2rem; }

/* Who Came First? */
.vs-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .7rem; align-items: center; }
.vs-or { font-family: 'Fredoka', sans-serif; color: var(--ink-soft); font-size: 1.1rem; }
.vs-card {
  display: grid; justify-items: center; gap: .35rem;
  padding: .7rem; border: 3px solid var(--paper-2); border-radius: var(--r-md);
  background: #fff; color: var(--ink); text-align: center;
  transition: transform .13s ease, border-color .13s ease;
}
.vs-card:hover:not(:disabled) { border-color: var(--violet); transform: translateY(-3px); }
.vs-card.right { border-color: var(--mint); background: #dff7ea; }
.vs-card.wrong { border-color: #e7b7b7; background: #fdf0f0; }
.vs-thumb { display: block; width: 100%; aspect-ratio: 4/3; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-2); }
.vs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vs-thumb .fallback { display: grid; place-content: center; height: 100%; font-size: 2rem; }
.vs-title { font-family: 'Fredoka', sans-serif; font-size: 1rem; line-height: 1.2; }
.vs-year { color: var(--violet); font-weight: 800; font-size: .88rem; }

/* Where in the World? */
.game-map-wrap { overflow-x: auto; overflow-y: hidden; margin-top: .5rem; -webkit-overflow-scrolling: touch; }
.game-map { cursor: crosshair; }
@media (max-width: 720px) {
  .game-map { height: 250px; width: auto; max-width: none; }
  .game-map-wrap::after {
    content: 'swipe the map →'; display: block; text-align: right;
    color: var(--ink-soft); font-size: .75rem; font-weight: 800; padding: .25rem .2rem 0;
  }
}
.game-map.answered { cursor: default; }
.guess-dot { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.true-dot  { fill: #ff3b3b; stroke: #fff; stroke-width: 2.5; }
.guess-line { stroke: #fff; stroke-width: 2; stroke-dasharray: 5 5; }

/* Guess the Year */
.dial-readout {
  text-align: center; font-family: 'Fredoka', sans-serif;
  font-size: 2rem; color: var(--violet); margin: .6rem 0 .3rem;
  font-variant-numeric: tabular-nums;
}
.dial { width: 100%; height: 42px; accent-color: var(--violet); }
.dial-ends { display: flex; justify-content: space-between; color: var(--ink-soft); font-weight: 800; font-size: .8rem; }

/* ---------------------------------------------------------- world map */

.wmap { margin: 0; }
.wmap-svg {
  display: block; width: 100%; height: auto;
  border-radius: var(--r-md);
  background: #2b3f7a;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.08);
}
.wmap-svg.zoomed { cursor: zoom-out; }
.wmap-sea  { fill: #2b3f7a; }
.wmap-land { fill: #8fbf6a; stroke: #6c9750; stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.wmap-other { fill: #fff; opacity: .45; }
.wmap-halo { animation: halo 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes halo { 0%,100% { opacity: .55; transform: scale(.75); } 50% { opacity: 1; transform: scale(1.15); } }

.wmap-pin { animation: pinDrop .55s cubic-bezier(.2,1.4,.4,1) both; animation-delay: .25s; }
.wmap-pin-body { fill: #ff3b3b; stroke: #fff; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.wmap-pin-dot  { fill: #fff; }
@keyframes pinDrop {
  from { opacity: 0; transform: translateY(-26px) scale(.4); }
  to   { opacity: 1; transform: none; }
}
.wmap-label {
  margin: .6rem 0 0; text-align: center;
  color: var(--ink-soft); font-weight: 800; font-size: .95rem; line-height: 1.35;
}

/* --------------------------------------------------------- voyage footer */

.voyage {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 44;
  padding: .5rem max(.7rem, env(safe-area-inset-left)) max(.6rem, env(safe-area-inset-bottom));
  background: rgba(16, 12, 46, .93);
  backdrop-filter: blur(14px);
  border-top: 2px solid rgba(255, 255, 255, .12);
}
body:has(.voyage:not([hidden])) { padding-bottom: 160px; }

.ribbon { max-width: 900px; margin: 0 auto .5rem; }
.ribbon-year {
  text-align: center; color: var(--sun);
  font-family: 'Fredoka', sans-serif; font-size: 1.15rem; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.ribbon-track {
  position: relative; height: 10px; margin: .55rem .8rem 0;
  border-radius: 999px; background: rgba(255, 255, 255, .14);
}
.ribbon-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--sky));
  transition: width .85s cubic-bezier(.5,0,.2,1);
}
.ribbon-dot {
  position: absolute; top: 50%; width: 13px; height: 13px; padding: 0;
  transform: translate(-50%, -50%);
  border: 0; border-radius: 50%; background: rgba(255,255,255,.42);
  transition: transform .2s ease, background .2s ease;
}
.ribbon-dot:hover { transform: translate(-50%, -50%) scale(1.5); background: #fff; }
.ribbon-dot.done { background: var(--sky); }
.ribbon-dot.on   { background: var(--sun); transform: translate(-50%, -50%) scale(1.5); }
.ribbon-ship {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%, -62%); font-size: 1.5rem; pointer-events: none;
  transition: left .85s cubic-bezier(.5,0,.2,1);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
.ribbon-ends {
  display: flex; justify-content: space-between;
  margin: .35rem .5rem 0; color: #a79fd6; font-size: .75rem; font-weight: 800;
}

.jnav { display: flex; gap: .5rem; align-items: center; justify-content: center; max-width: 900px; margin: 0 auto; }
.jbtn {
  min-height: 50px; padding: 0 1.1rem; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-family: 'Fredoka', sans-serif; font-size: 1rem;
  transition: transform .12s ease, background .12s ease;
}
.jbtn:hover:not(:disabled) { background: rgba(255,255,255,.24); }
.jbtn:active:not(:disabled) { transform: scale(.95); }
.jbtn:disabled { opacity: .3; }
.jbtn-play.on { background: var(--coral); }
.jbtn-next { flex: 1; max-width: 320px; background: var(--sun); color: var(--grape-deep); box-shadow: 0 5px 0 #d99b12; }
.jbtn-next:active { transform: translateY(3px); box-shadow: 0 2px 0 #d99b12; }

@media (max-width: 560px) {
  .jbtn-play { font-size: 0; padding: 0 .9rem; }
  .jbtn-play::before { content: '▶'; font-size: 1.1rem; }
  .jbtn-play.on::before { content: '⏸'; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
