/* ============================================================
   Portal Engine — stylesheet
   1. Tokens (defaults; overridden by config.php inline :root)
   2. Base & typography
   3. Portal animation
   4. Layout
   5. Components (sections, lists, seal, deck, buttons)
   6. Motion preferences
   Mobile-first throughout.
   ============================================================ */

/* ---------- 1. tokens ---------- */
:root {
  --bg: #0c141e;
  --panel: #131e2a;
  --text: #f3e9d7;
  --dim: #b7a88f;
  --copper: #d29a6b;
  --gold: #e6c887;
  --seal: #8c2f2a;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  --sans: -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- 2. base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  font-family: var(--serif);
  color: var(--text);
  line-height: 1.7;
  min-height: 100dvh;
  background:
    radial-gradient(120vmin 60vmin at 50% -10vmin, rgba(210, 154, 107, .14), transparent 70%),
    radial-gradient(2px 2px at 15% 25%, rgba(230, 200, 135, .55), transparent 60%),
    radial-gradient(1.6px 1.6px at 78% 14%, rgba(230, 200, 135, .45), transparent 60%),
    radial-gradient(1.5px 1.5px at 62% 46%, rgba(230, 200, 135, .3), transparent 60%),
    radial-gradient(1.8px 1.8px at 28% 66%, rgba(230, 200, 135, .35), transparent 60%),
    radial-gradient(1.5px 1.5px at 86% 82%, rgba(230, 200, 135, .35), transparent 60%),
    var(--bg);
}
img { max-width: 100%; }
a { color: var(--gold); }
a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.eyebrow {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .38em; text-indent: .38em; text-transform: uppercase;
  color: var(--copper); text-align: center;
}
h1 {
  font-weight: 500; font-style: italic; color: var(--gold); text-align: center;
  font-size: clamp(26px, 7vw, 36px); line-height: 1.2; margin: 10px 0 4px; text-wrap: balance;
}
.orn { color: var(--copper); text-align: center; letter-spacing: .5em; text-indent: .5em; font-size: 12px; margin: 14px 0; }

/* ink-bleed reveal */
.ink { opacity: 0; filter: blur(8px); transition: opacity .9s ease, filter 1.1s ease; }
.ink.rev { opacity: 1; filter: blur(0); }

/* ---------- 3. portal ---------- */
#portal {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; background: var(--bg);
}
#portal.on { display: flex; }
.pring {
  width: 38vmin; height: 38vmin; border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 26px rgba(230, 200, 135, .55), inset 0 0 22px rgba(210, 154, 107, .5);
  display: flex; align-items: center; justify-content: center;
}
.pring .pnum { font-size: 11vmin; color: var(--gold); letter-spacing: .1em; font-style: italic; }
#portal.anim .pring { animation: pring 1.15s cubic-bezier(.4, 0, .2, 1) .15s forwards; }
@keyframes pring {
  0% { transform: scale(1); opacity: 1; }
  55% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(6); opacity: 0; }
}
#portal.anim { animation: pfade .3s ease 1.15s forwards; }
@keyframes pfade { to { opacity: 0; visibility: hidden; } }
.dust { position: absolute; width: 5px; height: 5px; border-radius: 50% 40% 55% 45%; background: var(--gold); opacity: 0; }
#portal.anim .dust { animation: dust 1.5s ease-out .35s forwards; }
@keyframes dust {
  0% { transform: translate(0, 0) scale(1); opacity: .95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

/* ---------- 4. layout ---------- */
#stage { max-width: 640px; margin: 0 auto; padding: 22px 20px 70px; }
figure.art { margin: 22px -6px; }
figure.art img {
  width: 100%; border-radius: 10px; display: block;
  box-shadow: 0 0 0 1px rgba(210, 154, 107, .4), 0 18px 45px rgba(0, 0, 0, .55);
}
footer { color: var(--dim); text-align: center; font-size: 12.5px; font-style: italic; margin-top: 34px; }

/* ---------- 5. components ---------- */
/* his voice on card pages: handwritten (Bad Script); practical lists
   (path, feast, challenges) stay serif for street-level scannability */
.greet {
  font-family: 'Bad Script', 'Segoe Script', cursive;
  font-size: clamp(19px, 5vw, 21px); line-height: 1.55;
  text-align: center; max-width: 30em; margin: 6px auto 0; color: #f6f1e6;
}

section {
  background: var(--panel);
  border: 1px solid rgba(210, 154, 107, .25);
  border-radius: 10px; padding: 20px 22px; margin: 16px 0;
}
section h2 {
  font-family: var(--sans); font-size: 11.5px; letter-spacing: .3em; text-indent: .3em;
  text-transform: uppercase; color: var(--copper); font-weight: 600; margin-bottom: 12px;
}
section h2 .g { margin-right: 8px; color: var(--gold); }
section h2 .hint { float: right; color: var(--dim); letter-spacing: 0; text-indent: 0; text-transform: none; }
.tale {
  font-family: 'Bad Script', 'Segoe Script', cursive;
  font-size: clamp(18px, 4.8vw, 20px); line-height: 1.62;
  color: #f3eee2; margin-bottom: 12px;
}
.tale:last-of-type { margin-bottom: 0; }
.sign { font-style: italic; color: var(--copper); text-align: right; margin-top: 14px; }

ul.plain { list-style: none; }
ul.plain li {
  padding: 8px 0 8px 24px; position: relative;
  border-bottom: 1px dashed rgba(243, 233, 215, .14); font-size: 14.5px;
}
ul.plain li:last-child { border-bottom: none; }
ul.plain li::before { content: "✦"; position: absolute; left: 2px; top: 11px; color: var(--copper); font-size: 11px; }

ul.chal li { cursor: pointer; user-select: none; }
ul.chal li::before { content: ""; width: 14px; height: 14px; border: 1.5px solid var(--copper); border-radius: 3px; top: 11px; }
ul.chal li.done { color: var(--dim); text-decoration: line-through; }
ul.chal li.done::before {
  content: "✦"; border-color: var(--gold); color: var(--gold);
  font-size: 11px; line-height: 14px; text-align: center; text-decoration: none;
}

.ritual {
  font-family: 'Bad Script', 'Segoe Script', cursive;
  font-size: clamp(18px, 4.8vw, 20px); line-height: 1.62; color: #f3eee2;
}
.ritual::before { content: "☾  "; color: var(--gold); }

/* wax seal */
.sealbox { text-align: center; padding: 26px 22px; }
.wax {
  width: 74px; height: 74px; border-radius: 50%; margin: 6px auto 10px; cursor: pointer;
  background: radial-gradient(circle at 35% 32%, #b6483d, var(--seal) 60%, #5f1d1a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5), inset 0 0 0 6px rgba(255, 255, 255, .06);
  display: flex; align-items: center; justify-content: center;
  color: #f2d8b8; font-size: 26px;
  transition: transform .5s ease, opacity .6s ease, filter .6s ease;
}
.wax:active { transform: scale(.94); }
.sealbox.open .wax { transform: scale(1.6); opacity: 0; filter: blur(6px); pointer-events: none; }
.sealhint {
  font-family: var(--sans); font-size: 11px; letter-spacing: .25em;
  text-transform: uppercase; color: var(--dim);
}
.note {
  display: none;
  font-family: 'Bad Script', 'Segoe Script', cursive;
  font-size: clamp(19px, 5vw, 21px);
  color: var(--gold); max-width: 26em; margin: 0 auto; line-height: 1.7;
}
.note .who { color: var(--copper); }
.sealbox.open .note { display: block; animation: inkin 1.2s ease; }
.sealbox.open .sealhint { display: none; }
@keyframes inkin { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: blur(0); } }

/* where-it-all-is map pins */
.pins { display: flex; flex-wrap: wrap; gap: 10px; }
.pin {
  font-family: var(--sans); font-size: 12.5px; letter-spacing: .06em;
  color: var(--gold); text-decoration: none;
  border: 1px solid rgba(230, 200, 135, .45); border-radius: 999px;
  padding: 9px 15px; transition: box-shadow .3s, border-color .3s;
}
.pin:hover { border-color: var(--gold); box-shadow: 0 0 12px rgba(230, 200, 135, .35); }
.pinhint { font-size: 12.5px; color: var(--dim); font-style: italic; margin-top: 12px; }

/* our memories: polaroids scattered on a table */
.polagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; margin-bottom: 6px; }
.pola {
  background: #f6f1e6; padding: 7px 7px 20px; border-radius: 2px;
  transform: rotate(var(--tilt, -2deg));
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
  transition: transform .25s ease, box-shadow .25s ease; cursor: pointer;
}
.pola:hover { transform: rotate(0deg) scale(1.04); box-shadow: 0 10px 24px rgba(0, 0, 0, .55); z-index: 3; }
.pola img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed rgba(230, 200, 135, .45); border-radius: 10px;
  padding: 22px 16px; margin-top: 14px; cursor: pointer; text-align: center;
  transition: border-color .3s, background .3s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--gold); background: rgba(230, 200, 135, .05); }
.dz-heart { color: var(--seal); font-size: 24px; animation: dzpulse 2.6s ease-in-out infinite; }
@keyframes dzpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.dz-text { font-family: 'Bad Script', 'Segoe Script', cursive; font-size: 19px; color: var(--gold); }
.dz-sub { font-family: var(--sans); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.dz-status { text-align: center; font-style: italic; color: var(--dim); font-size: 13.5px; min-height: 20px; margin-top: 8px; }
.pola.uploading { opacity: .45; filter: blur(1px); }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(6, 10, 16, .93);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94vw; max-height: 88dvh; border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(230, 200, 135, .4), 0 30px 80px rgba(0, 0, 0, .8);
}
.lb-close {
  position: absolute; top: 18px; right: 22px; color: var(--gold);
  font-size: 26px; font-family: var(--sans);
}
@media (prefers-reduced-motion: reduce) { .dz-heart { animation: none; } }

/* challenges accomplished: a roomy celebratory medallion, in normal flow
   (no absolute overlap — reads beautifully at any width) */
.chalsec { position: relative; overflow: hidden; transition: border-color .6s ease, box-shadow .6s ease; }
.chalsec.accomplished { border-color: var(--gold); box-shadow: 0 0 26px rgba(230, 200, 135, .20), inset 0 0 34px rgba(230, 200, 135, .05); }
.chalsec.accomplished .hint { display: none; }
.chalsec.accomplished ul.chal li { opacity: .58; }

.accbanner { display: none; text-align: center; margin: 8px auto 2px; max-width: 30em; }
.chalsec.accomplished .accbanner { display: block; animation: accfade .8s ease both; }
@keyframes accfade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.accrule { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--copper); margin: 4px 0 20px; }
.accrule::before, .accrule::after { content: ""; height: 1px; flex: 1; max-width: 84px; background: linear-gradient(90deg, transparent, rgba(230, 200, 135, .5)); }
.accrule::after { background: linear-gradient(90deg, rgba(230, 200, 135, .5), transparent); }
.accrule span { font-size: 12px; color: var(--gold); }
.accseal {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 28px; border: 2px solid var(--gold);
  background: radial-gradient(circle at 38% 32%, rgba(230, 200, 135, .2), rgba(230, 200, 135, .04));
  box-shadow: 0 0 24px rgba(230, 200, 135, .35), inset 0 0 16px rgba(230, 200, 135, .16);
}
.chalsec.celebrate .accseal { animation: sealstamp .8s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes sealstamp {
  0% { transform: rotate(26deg) scale(2.3); opacity: 0; }
  55% { transform: rotate(-7deg) scale(.88); opacity: 1; }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}
.acclabel {
  font-family: var(--sans); font-size: 10.5px; letter-spacing: .32em; text-indent: .32em;
  text-transform: uppercase; color: var(--copper); margin-bottom: 14px;
}
.accline { color: var(--gold); font-size: clamp(19px, 5vw, 22px); line-height: 1.55; margin: 0; }
.celebdust { position: absolute; left: 50%; bottom: 30%; width: 6px; height: 6px; border-radius: 50% 40% 55% 45%; background: var(--gold); opacity: 0; pointer-events: none; }
.chalsec.celebrate .celebdust { animation: celebdust 1.5s ease-out forwards; }
@keyframes celebdust {
  0% { opacity: .95; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2); }
}

/* collapsible "where it all is" (native <details>, works without JS) */
.foldsec { background: var(--panel); border: 1px solid rgba(210, 154, 107, .25); border-radius: 10px; margin: 16px 0; overflow: hidden; }
.foldsec summary {
  list-style: none; cursor: pointer; padding: 20px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: background .3s ease;
}
.foldsec summary:hover { background: rgba(230, 200, 135, .04); }
.foldsec summary::-webkit-details-marker { display: none; }
.foldsec summary h2 {
  font-family: var(--sans); font-size: 11.5px; letter-spacing: .3em; text-indent: .3em;
  text-transform: uppercase; color: var(--copper); font-weight: 600; margin: 0;
}
.foldsec summary h2 .g { margin-right: 8px; color: var(--gold); }
.foldhint { font-family: var(--sans); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--copper); white-space: nowrap; }
.foldsec .fh-open { display: none; }
.foldsec[open] .fh-closed { display: none; }
.foldsec[open] .fh-open { display: inline; }
.foldbody { padding: 0 22px 22px; }
.routeintro { font-size: 13.5px; color: var(--dim); font-style: italic; margin: 2px 0 16px; }

/* intermodal route timeline */
.route { list-style: none; margin: 0; padding: 0; }
.route .stop { padding: 3px 0; }
.route .stop .pin { display: inline-block; }
.route .leg {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 9px 0 9px 8px; margin-left: 13px; position: relative;
  color: var(--dim); font-size: 13px;
}
.route .leg::before {
  content: ""; position: absolute; left: 8px; top: -3px; bottom: -3px;
  width: 1px; border-left: 1px dashed rgba(230, 200, 135, .35);
}
.legmode { font-size: 16px; line-height: 1; }
.legtime { color: var(--gold); font-family: var(--sans); font-size: 12px; letter-spacing: .04em; }
.legword { font-style: italic; }

/* veiled (deactivated) + lived (done) card views */
.veiledart img { filter: grayscale(.55) brightness(.58); }
.livedbanner { text-align: center; margin: 10px 0 2px; }
.livedbanner .lb-stamp {
  display: inline-block; border: 2px solid var(--gold); color: var(--gold);
  border-radius: 999px; padding: 6px 20px; transform: rotate(-3deg);
  font-family: var(--sans); font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
}
.livedbanner p { margin-top: 14px; }

/* admin control room */
.admininfo { font-size: 14px; color: var(--dim); max-width: 34em; margin: 6px auto 18px; text-align: center; font-style: italic; }
.savednote { color: var(--gold); }
.permwarn {
  max-width: 36em; margin: 6px auto 16px; padding: 16px 20px;
  border: 1px solid var(--seal); border-radius: 10px; background: rgba(140, 47, 42, .12);
  font-size: 13.5px; color: var(--text);
}
.permwarn p { margin: 0 0 8px; }
.permwarn p:last-child { margin-bottom: 0; }
.permwarn b { color: var(--gold); }
.permpath { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--copper); word-break: break-all; }
.storagestat { text-align: center; font-size: 12.5px; color: var(--dim); font-style: italic; margin: 4px auto 14px; }
.storagestat .ok { color: var(--gold); font-style: normal; }
.admintable { width: 100%; border-collapse: collapse; margin: 10px 0 6px; }
.admintable th {
  font-family: var(--sans); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--copper); text-align: center; padding: 8px 6px; border-bottom: 1px solid rgba(230, 200, 135, .25);
}
.admintable th:nth-child(2) { text-align: left; }
.admintable td { padding: 11px 6px; border-bottom: 1px dashed rgba(230, 200, 135, .14); text-align: center; }
.ac-num { color: var(--copper); font-family: 'Cormorant Garamond', Georgia, serif; font-size: 15px; width: 32px; }
.ac-title { text-align: left; font-size: 14.5px; }
.acbox { display: inline-flex; cursor: pointer; }
.acbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.acbox span { width: 21px; height: 21px; border: 1.5px solid var(--copper); border-radius: 5px; display: inline-block; position: relative; transition: background .2s, border-color .2s; }
.acbox input:checked + span { background: var(--gold); border-color: var(--gold); }
.acbox input:checked + span::after { content: "✦"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--bg); font-size: 12px; }
.acbox input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.acbox.done input:checked + span { background: var(--seal); border-color: var(--seal); }
.acbox.done input:checked + span::after { content: "❦"; color: #f2d8b8; }
@media (prefers-reduced-motion: reduce) {
  .chalsec.accomplished .accbanner, .chalsec.celebrate .accseal, .celebdust { animation: none; transition: none; }
}

/* buttons & nav */
.navrow { display: flex; justify-content: center; gap: 14px; margin: 26px 0 0; flex-wrap: wrap; }
.btn {
  font-family: var(--sans); font-size: 12px; letter-spacing: .22em; text-indent: .22em;
  text-transform: uppercase; color: var(--gold);
  border: 1px solid rgba(230, 200, 135, .5); border-radius: 999px;
  padding: 11px 22px; background: none; cursor: pointer; text-decoration: none;
}

/* handwritten love letter — self-hosted Dancing Script (true cursive on every
   device; the earlier system-cursive fallback rendered plain on Android).
   Weight 500 + line-height 1.55: bolder weights fill the loops, tighter
   leading tangles ascenders/descenders on phones. */
@font-face {
  font-family: 'Dancing Script';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/dancing-script.woff2') format('woff2');
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/caveat.woff2') format('woff2');
}
@font-face {
  font-family: 'Bad Script';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/bad-script.woff2') format('woff2');
}
.handwritten {
  background:
    linear-gradient(rgba(230, 200, 135, .04), rgba(230, 200, 135, .04)),
    var(--panel);
  padding: 28px 26px;
}
.hand {
  /* Bad Script: the chosen hand — elegant connected handwriting, readable
     over paragraphs. Thin strokes, so brighter ink and roomy leading. */
  font-family: 'Bad Script', 'Segoe Script', 'Snell Roundhand', cursive;
  font-weight: 400;
  font-size: clamp(21px, 5.4vw, 23px);
  line-height: 1.62;
  color: #f6f1e6;
  margin-bottom: 18px;
  letter-spacing: .01em;
}
.hand:last-of-type { margin-bottom: 0; }
.hand-sign {
  font-family: 'Bad Script', 'Segoe Script', 'Snell Roundhand', cursive;
  font-weight: 400;
  font-size: clamp(24px, 6vw, 26px);
  color: var(--copper); text-align: right; margin-top: 16px;
}

/* sealed-deck gate: the whisper ritual */
.gate { padding-top: 2dvh; }         /* keep interactives in the upper half, clear of the keyboard */
.keyhole {
  width: 92px; height: 92px; border-radius: 50%;
  border: 1.5px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 16px; color: var(--gold);
  animation: keypulse 3s ease-in-out infinite;
}
@keyframes keypulse {
  0%, 100% { box-shadow: 0 0 10px rgba(230, 200, 135, .25), inset 0 0 8px rgba(210, 154, 107, .2); transform: scale(1); }
  50% { box-shadow: 0 0 28px rgba(230, 200, 135, .55), inset 0 0 16px rgba(210, 154, 107, .4); transform: scale(1.04); }
}
.whisperform { text-align: center; margin: 26px 0 4px; }
.whisperwrap { position: relative; width: min(300px, 74vw); margin: 0 auto 18px; }
#whisper {
  width: 100%; background: transparent; border: none; outline: none;
  text-align: center; padding: 10px 0 12px;
  font-family: 'Bad Script', 'Segoe Script', cursive;
  font-weight: 400; font-size: 24px; letter-spacing: .08em;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(230, 200, 135, .35);
  caret-color: var(--gold);
}
#whisper::placeholder { color: rgba(230, 200, 135, .4); font-size: 21px; letter-spacing: .04em; }
#whisper:focus { text-shadow: 0 0 16px rgba(230, 200, 135, .7); }
.whisperline {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 62%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transition: width .6s cubic-bezier(.25, 1, .5, 1), box-shadow .4s;
}
#whisper:focus ~ .whisperline { width: 100%; box-shadow: 0 0 10px rgba(230, 200, 135, .6); }
.waswrong .whisperline { background: linear-gradient(90deg, transparent, #c96a52, transparent); }
.sealbtn {
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 35% 32%, #b6483d, var(--seal) 60%, #5f1d1a);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5), inset 0 0 0 5px rgba(255, 255, 255, .06);
  color: #f2d8b8; font-size: 22px;
  transition: transform .2s ease, box-shadow .3s ease;
}
.sealbtn:hover { box-shadow: 0 6px 24px rgba(140, 47, 42, .7), inset 0 0 0 5px rgba(255, 255, 255, .1); }
.sealbtn:active { transform: scale(.92); }
.sealbtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.whisperform .sealhint { margin-top: 10px; }
.shake { animation: gentleshake .45s ease-in-out; }
@keyframes gentleshake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
.gate.opening { animation: gateopen 1s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes gateopen {
  0% { transform: scale(1); opacity: 1; filter: blur(0); }
  100% { transform: scale(1.6); opacity: 0; filter: blur(10px); }
}
.gatewrong { color: var(--copper); }
.gatehint { font-size: 15.5px; color: var(--dim); }
.cardhint { text-align: center; font-style: italic; color: var(--dim); font-size: 13.5px; margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
  .keyhole, .shake, .gate.opening { animation: none; }
}

/* ask-fate page: a breathing deck that swirls and chooses one door */
.fatewords { text-align: center; max-width: 24em; margin: 10px auto 0; }
.fatemodes { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 20px 0 0; }
.fmode {
  font-family: var(--sans); font-size: 11.5px; letter-spacing: .18em; text-indent: .18em;
  text-transform: uppercase; color: var(--dim); background: none; cursor: pointer;
  border: 1px solid rgba(210, 154, 107, .35); border-radius: 999px; padding: 10px 18px;
  transition: color .3s, border-color .3s, box-shadow .3s;
}
.fmode.active {
  color: var(--gold); border-color: var(--gold);
  box-shadow: 0 0 14px rgba(230, 200, 135, .35), inset 0 0 8px rgba(230, 200, 135, .12);
}
.fmode:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.fatedeck {
  position: relative; height: 250px; width: min(320px, 84vw);
  margin: 30px auto 8px; cursor: pointer; perspective: 900px; outline: none;
}
.fatedeck:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 14px; }
.fcard {
  position: absolute; left: 50%; top: 50%; width: 118px; height: 168px;
  margin: -84px 0 0 -59px; border-radius: 10px;
  background:
    radial-gradient(2px 2px at 24% 22%, rgba(230, 200, 135, .5), transparent 60%),
    radial-gradient(1.6px 1.6px at 74% 34%, rgba(230, 200, 135, .4), transparent 60%),
    radial-gradient(1.8px 1.8px at 38% 76%, rgba(230, 200, 135, .4), transparent 60%),
    linear-gradient(150deg, #182635, var(--panel) 60%, #0f1926);
  border: 1px solid rgba(230, 200, 135, .5);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5), inset 0 0 0 6px rgba(230, 200, 135, .07);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 30px;
  transform: rotate(calc((var(--i) - 3) * 6deg)) translateY(calc((var(--i) - 3) * 2px));
  animation: fatebreathe 4.2s ease-in-out calc(var(--i) * .35s) infinite;
}
@keyframes fatebreathe {
  0%, 100% { box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 10px rgba(230, 200, 135, .12); }
  50% { box-shadow: 0 10px 26px rgba(0, 0, 0, .55), 0 0 24px rgba(230, 200, 135, .3); }
}
.fatedeck.shuffling .fcard {
  animation: fateshuffle .5s ease-in-out calc(var(--i) * 55ms) infinite alternate;
}
@keyframes fateshuffle {
  from { transform: rotate(calc((var(--i) - 3) * 16deg)) translate(calc((var(--i) - 3) * 22px), -14px); }
  to   { transform: rotate(calc((3 - var(--i)) * 12deg)) translate(calc((3 - var(--i)) * 18px), 12px); }
}
.fatedeck .fcard.chosen {
  animation: fatechosen 1.15s cubic-bezier(.3, 1.2, .4, 1) forwards; z-index: 6;
}
@keyframes fatechosen {
  0%   { transform: rotate(0) scale(1) rotateY(0); }
  45%  { transform: translateY(-26px) scale(1.22) rotateY(90deg); }
  100% { transform: translateY(-22px) scale(1.28) rotateY(0);
         box-shadow: 0 0 55px rgba(230, 200, 135, .8), 0 14px 30px rgba(0, 0, 0, .55);
         border-color: var(--gold); }
}
.fcard.chosen span { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; letter-spacing: .06em; }
.fatedeck.shuffling ~ #fatebtn, .fatedeck.done ~ #fatebtn { opacity: 0; pointer-events: none; }
#fatebtn { transition: opacity .5s ease; display: block; margin: 14px auto 0; }
.fdust {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px;
  border-radius: 50% 40% 55% 45%; background: var(--gold); opacity: 0; pointer-events: none;
  animation: fdust 1.3s ease-out forwards;
}
@keyframes fdust {
  0% { transform: translate(0, 0) scale(1); opacity: .95; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .fcard, .fatedeck.shuffling .fcard, .fcard.chosen, .fdust { animation: none; }
}

/* hello start page */
.hello { padding-top: 4dvh; }
.brand {
  display: block; width: min(240px, 60vw); margin: 0 auto 22px;
  border-radius: 50%; box-shadow: 0 0 40px rgba(230, 200, 135, .25), 0 0 0 1px rgba(210, 154, 107, .35);
}
.brandline { display: block; width: 120px; margin: 26px auto 0; border-radius: 50%; opacity: .9; }

/* deck grid (intro side) */
.landing p.big { font-style: italic; text-align: center; font-size: 18px; max-width: 30em; margin: 12px auto; }
.cover {
  width: 100%; border-radius: 12px; margin: 18px 0 6px;
  box-shadow: 0 0 0 1px rgba(210, 154, 107, .4), 0 20px 50px rgba(0, 0, 0, .55);
}
.deckhead {
  font-weight: 500; font-style: italic; color: var(--gold); text-align: center;
  font-size: clamp(20px, 5vw, 26px); margin: 34px 0 6px;
}
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 16px; }
.mini {
  background: var(--panel); border: 1px solid rgba(210, 154, 107, .3); border-radius: 10px;
  overflow: hidden; text-align: center; padding-bottom: 12px; text-decoration: none;
  transition: transform .2s ease; display: block;
}
.mini:hover { transform: translateY(-3px); }
.mini img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; margin-bottom: 9px;
  filter: saturate(.35) brightness(.75); transition: filter .4s;
}
.mini.unlocked img { filter: none; }
.mini .mn { display: block; color: var(--copper); font-size: 12px; letter-spacing: .2em; }
.mini .mt { display: block; font-style: italic; color: var(--text); font-size: 13.5px; padding: 2px 10px 0; line-height: 1.35; }
.mini.unlocked .mt { color: var(--gold); }

/* ---------- 6. motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  #portal.anim .pring, #portal.anim .dust { animation: none; }
  #portal.anim { animation: pfade .5s ease .4s forwards; }
  .ink { transition: none; }
  .mini, .wax { transition: none; }
}
