/* ==========================================================================
   STORY — intro · timeline world · memory reveals · act cards · finale
   ========================================================================== */

/* ================================================================ INTRO */
#intro { background: #000; display: grid; place-items: center; overflow: hidden; }
.in-light {
  position: absolute; left: 0; top: 0; width: 900px; height: 900px; margin: -450px 0 0 -450px; pointer-events: none;
  background: radial-gradient(circle, rgba(232, 177, 106, 0.07) 0%, rgba(232, 177, 106, 0.02) 35%, transparent 65%);
}
.in-inner { position: relative; text-align: center; padding: 0 24px; display: flex; flex-direction: column; align-items: center; }
.in-inner > * { opacity: 0; animation: fadeUp 1.6s var(--ease-out) forwards; }
.in-kicker { color: var(--paper-dim); letter-spacing: 0.34em; padding-left: 0.34em; font-size: 10px; }
.in-emblem { width: 38px; height: 38px; margin-top: 26px; color: var(--red-soft); filter: drop-shadow(0 0 14px rgba(198, 90, 81, 0.6)); }
.in-emblem svg { width: 100%; height: 100%; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.in-inner > .in-title { margin-top: 18px; display: flex; flex-direction: column; align-items: center; opacity: 1; animation: none; }
.in-title-l { display: block; font-family: var(--sans); font-weight: 800; text-transform: uppercase; font-size: clamp(30px, 6.2vw, 86px); line-height: 0.96; letter-spacing: -0.03em; color: var(--paper);
  text-shadow: 0 0 40px rgba(232, 177, 106, 0.18); opacity: 0; filter: blur(10px); animation: inWord 1.8s var(--ease-out) forwards; }
.in-title-l + .in-title-l { background: linear-gradient(180deg, var(--paper) 30%, #c9a27a); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
@keyframes inWord { to { opacity: 1; filter: blur(0); transform: none; } }
.in-line { margin-top: 22px; font-style: italic; font-weight: 300; font-size: clamp(17px, 1.7vw, 22px); color: var(--paper-dim); max-width: 30ch; }
.in-stage { position: relative; margin-top: 26px; width: 64px; height: 108px; display: grid; place-items: end center; }
.in-hero { width: 64px; height: 108px; image-rendering: pixelated; image-rendering: crisp-edges; position: relative; z-index: 1; }
.in-ring { position: absolute; left: 50%; bottom: -6px; width: 84px; height: 26px; margin-left: -42px; border-radius: 50%; border: 1.5px solid rgba(110, 168, 255, 0.7); box-shadow: 0 0 22px rgba(110, 168, 255, 0.45), inset 0 0 14px rgba(110, 168, 255, 0.35); animation: ringPulse 2.6s ease-in-out infinite; }
@keyframes ringPulse { 50% { box-shadow: 0 0 34px rgba(110, 168, 255, 0.7), inset 0 0 18px rgba(110, 168, 255, 0.5); } }
.in-cta { margin-top: 34px; display: inline-flex; align-items: center; gap: 14px; padding: 12px 8px; color: var(--paper); }
.in-br { font-family: var(--serif); font-weight: 300; font-size: 22px; color: var(--paper-dim); transition: transform 0.7s var(--ease-out), color 0.5s; }
.in-cta-t { letter-spacing: 0.4em; padding-left: 0.4em; font-size: 11px; animation: blinkStart 1.6s steps(1) 4.5s infinite; }
@keyframes blinkStart { 50% { opacity: 0.25; } }
.in-cta:hover .in-cta-t { animation: none; }
.in-cta:hover .in-br:first-child { transform: translateX(-10px); color: var(--paper); }
.in-cta:hover .in-br:last-child { transform: translateX(10px); color: var(--paper); }
.in-skip { margin-top: 14px; color: var(--mute); font-size: 9.5px; transition: color 0.3s; }
.in-skip:hover { color: var(--paper); }
.in-foot { position: absolute; left: var(--gutter); right: calc(var(--gutter) + 110px); bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; color: var(--mute); opacity: 0; animation: fadeUp 2s 3s var(--ease-out) forwards; }
.in-horizon { position: absolute; left: 50%; top: 50%; width: 100vw; height: 1px; margin-left: -50vw; background: linear-gradient(90deg, transparent, rgba(246, 227, 194, 0.9), transparent); transform: scaleX(0); opacity: 0; }

#intro.is-leaving .in-inner > *, #intro.is-leaving .in-title-l { animation: none; opacity: 0; filter: blur(10px); transform: translateY(-12px); transition: opacity 1.3s var(--ease-cine), filter 1.3s var(--ease-cine), transform 1.5s var(--ease-cine); }
#intro.is-leaving .in-inner > .in-title, #intro.is-leaving .in-inner > .in-stage { opacity: 1; filter: none; transform: none; }
#intro.is-leaving .in-hero { animation: heroWalk 1.4s var(--ease-cine) forwards; }
#intro.is-leaving .in-ring { opacity: 0; transition: opacity 1s; }
@keyframes heroWalk { to { transform: translateY(-30px) scale(0.6); opacity: 0; } }
#intro.is-leaving .in-horizon { animation: horizon 2.2s 0.5s var(--ease-cine) forwards; }
@keyframes horizon { 0% { transform: scaleX(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: scaleX(1); opacity: 0.0; } }
@media (max-width: 759px) { .in-foot span:last-child { display: none; } .in-stage { transform: scale(0.85); } }

/* ========================================================= MEMORY LANE */
#timeline { overflow: hidden; background: #0d1210; }
.vl-canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; transition: transform 7s cubic-bezier(0.3, 0, 0.2, 1); }
.vl-canvas.is-push { transform: scale(1.35); }
.vl-labels { position: absolute; inset: 0; pointer-events: none; transition: opacity 1.5s; }
.vl-label {
  position: absolute; left: 0; top: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 10px 6px; background: rgba(8, 9, 13, 0.84); border: 1px solid rgba(236, 230, 218, 0.14); color: var(--paper-dim);
  opacity: 0.35; transition: opacity 0.6s, border-color 0.4s; white-space: nowrap; will-change: transform;
}
.vl-label::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 1px; height: 6px; background: rgba(236, 230, 218, 0.3); }
.vl-year { font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; padding-left: 0.24em; color: var(--paper); }
.vl-year--name { text-transform: uppercase; font-size: 10px; letter-spacing: 0.2em; }
.vl-place { font-family: var(--serif); font-style: italic; font-size: 12.5px; }
.vl-label.is-seen { opacity: 0.8; }
.vl-label.is-next { opacity: 1; border-color: rgba(110, 168, 255, 0.55); animation: nextPulse 2.4s ease-in-out infinite; }
.vl-label.is-here { opacity: 1; border-color: var(--red-soft); }
.vl-label:not(.is-seen):not(.is-next) { pointer-events: none; }
.vl-label:not(.is-seen):not(.is-next) .vl-place { display: none; }
@keyframes nextPulse { 50% { box-shadow: 0 0 18px rgba(110, 168, 255, 0.4); } }
#timeline.is-ending .vl-labels, #timeline.is-ending .vl-area { opacity: 0; }
.vl-area { position: absolute; left: 50%; top: calc(30px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; pointer-events: none; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
.vl-area.is-on { animation: area 3.6s var(--ease-cine) forwards; }
.vl-area strong { font-weight: 300; font-size: clamp(34px, 4vw, 52px); letter-spacing: -0.02em; line-height: 1; }
.vl-area .mono { color: var(--paper-dim); }
@keyframes area { 0% { opacity: 0; transform: translate(-50%, -6px); } 18% { opacity: 1; transform: translate(-50%, 0); } 75% { opacity: 1; } 100% { opacity: 0; } }
#timeline .rv--pc { width: min(100%, 230px); }
#timeline .tl-mem { overflow-y: auto; scrollbar-width: none; }
#timeline .mem-text { background: rgba(6, 7, 10, 0.9); border: 1px solid var(--line); padding: 20px 22px 18px; }
.tl-hint { position: absolute; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); color: var(--paper-dim); opacity: 0; transition: opacity 1.2s; pointer-events: none; white-space: nowrap; text-shadow: 0 1px 10px #000; }
.tl-hint.is-on { opacity: 1; }
.vl-canvas { cursor: pointer; }

/* close button on memory cards, and the dimmed backdrop behind the phone pop-up */
.mem { position: relative; }
#timeline .tl-mem .mem { width: fit-content; max-width: 460px; }
.mem-x {
  position: absolute; right: -10px; top: -10px; z-index: 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  font-size: 14px; color: var(--paper); background: rgba(8, 9, 14, 0.9); border: 1px solid rgba(236, 230, 218, 0.3); transition: background 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}
.mem-x:hover { background: var(--paper); color: #0b0b10; transform: rotate(90deg); }
.tl-mem-back { position: absolute; inset: 0; z-index: 9; background: rgba(3, 4, 7, 0.68); opacity: 0; pointer-events: none; transition: opacity 0.5s var(--ease-out); display: none; }

/* on-screen pad for phones and tablets */
.vl-pad { position: absolute; right: 16px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 6; display: none; grid-template-columns: repeat(3, 46px); grid-template-rows: repeat(3, 46px); gap: 4px; }
.vl-pad-b { display: grid; place-items: center; border-radius: 10px; background: rgba(8, 9, 14, 0.78); border: 1px solid rgba(236, 230, 218, 0.22); color: var(--paper); font-size: 13px; touch-action: none; user-select: none; -webkit-user-select: none; }
.vl-pad-b:active { background: rgba(236, 230, 218, 0.9); color: #0b0b10; }
.vl-pad-up { grid-column: 2; grid-row: 1; }
.vl-pad-left { grid-column: 1; grid-row: 2; }
.vl-pad-right { grid-column: 3; grid-row: 2; }
.vl-pad-down { grid-column: 2; grid-row: 3; }
#timeline.is-ending .vl-pad { display: none !important; }
#timeline.has-mem .vl-pad { opacity: 0.55; }
@media (max-width: 759px) { .tl-hint { bottom: auto; top: calc(96px + env(safe-area-inset-top)); white-space: normal; text-align: center; width: 80%; } }
@media (hover: none), (pointer: coarse), (max-width: 759px) { .vl-pad { display: grid; } }

/* ============================================================ ACT CARD */
.act-card {
  position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
  background: radial-gradient(60% 50% at 50% 50%, rgba(3, 4, 6, 0.72), rgba(3, 4, 6, 0.35)); pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity 1.1s var(--ease-cine), visibility 0s 1.1s;
}
.act-card.is-on { opacity: 1; visibility: visible; transition: opacity 1.1s var(--ease-cine); }
.act-card.is-out { opacity: 0; }
.act-id { color: var(--red-soft); letter-spacing: 0.5em; padding-left: 0.5em; }
.act-name { font-weight: 300; font-size: clamp(40px, 6vw, 84px); line-height: 1; letter-spacing: -0.02em; }
.act-line { font-style: italic; color: var(--paper-dim); font-size: clamp(16px, 1.5vw, 20px); }
.act-kanji { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; font-family: var(--jp); font-size: 22px; letter-spacing: 0.4em; color: rgba(236, 230, 218, 0.28); }
.act-card.is-on .act-id, .act-card.is-on .act-name, .act-card.is-on .act-line { animation: fadeUp 1.4s var(--ease-out) both; }
.act-card.is-on .act-name { animation-delay: 0.15s; }
.act-card.is-on .act-line { animation-delay: 0.45s; }

/* ========================================================= MEMORY PANEL */
.tl-mem {
  position: absolute; z-index: 3; left: 53vw; right: var(--gutter); top: 50%; transform: translateY(-54%);
  max-height: 86vh; transition: opacity 0.7s var(--ease-cine), transform 0.7s var(--ease-cine);
}
.tl-mem.is-out { opacity: 0; transform: translateY(-50%); }
.mem { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
.rv { position: relative; width: min(100%, 400px); }
.mem-text { max-width: 440px; }
.mem-meta { display: flex; align-items: center; gap: 10px; color: var(--paper-dim); opacity: 0; animation: fadeUp 1s 1.1s var(--ease-out) forwards; }
.mem-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--red-soft); }
.mem-title { font-weight: 300; font-size: clamp(30px, 3.2vw, 48px); line-height: 1.05; letter-spacing: -0.015em; margin-top: 12px; opacity: 0; animation: fadeUp 1.2s 1.25s var(--ease-out) forwards; text-wrap: balance; }
.mem-cap { margin-top: 12px; color: var(--paper-dim); font-size: 15px; max-width: 38ch; opacity: 0; animation: fadeUp 1.2s 1.45s var(--ease-out) forwards; }
.mem-age { margin-top: 12px; color: var(--red-soft); font-size: 10px; opacity: 0; animation: fadeUp 1s 1.2s var(--ease-out) forwards; }
.mem-age + .mem-title { margin-top: 6px; }
.mem-verse { margin-top: 16px; padding: 12px 0 2px 16px; border-left: 2px solid rgba(110, 168, 255, 0.55); opacity: 0; animation: fadeUp 1.2s 1.65s var(--ease-out) forwards; }
.mem-verse p { font-style: italic; font-size: 15.5px; line-height: 1.45; color: var(--paper); }
.mem-verse cite { display: block; margin-top: 8px; font-style: normal; font-size: 9.5px; color: #9ec2ff; }
.mem-nav { display: flex; gap: 18px; align-items: center; margin-top: 26px; opacity: 0; animation: fadeUp 1.2s 1.7s var(--ease-out) forwards; }
.mem-next { display: inline-flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-2); transition: border-color 0.4s, gap 0.5s var(--ease-out); }
.mem-next:hover { border-color: var(--paper); gap: 22px; }
.mem-arrow { font-family: var(--serif); font-size: 18px; }
.mem-prev { color: var(--mute); font-size: 14px; padding: 10px 6px; transition: color 0.3s; }
.mem-prev:hover { color: var(--paper); }

/* --- the collectible card (every year) */
.rv--pc { width: min(100%, 250px); perspective: 1100px; }
.pc { --acc: #d9a066; --acc2: #8a5a2e; --rx: 0deg; --ry: 0deg; --hx: 50%; --hy: 30%; position: relative; aspect-ratio: 5 / 7.4; transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform 0.5s var(--ease-out); }
.pc--II { --acc: #d0605a; --acc2: #7a221f; }
.pc--III { --acc: #7fb0ff; --acc2: #2c4a8a; }
.pc-inner { position: absolute; inset: 0; transform-style: preserve-3d; animation: pcFlip 1.5s var(--ease-out) both; }
@keyframes pcFlip { 0% { transform: translateY(60px) rotateY(180deg) scale(0.9); opacity: 0; } 25% { opacity: 1; } 100% { transform: none; opacity: 1; } }
.pc-front, .pc-back { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.pc-back {
  transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(80% 60% at 50% 45%, color-mix(in srgb, var(--acc) 30%, #0c0d12), #0a0b10 70%);
  border: 2px solid var(--acc); box-shadow: inset 0 0 0 6px #0a0b10, inset 0 0 0 7px color-mix(in srgb, var(--acc) 50%, transparent);
}
.pc-back-mark { width: 64px; height: 64px; color: var(--acc); filter: drop-shadow(0 0 12px var(--acc)); }
.pc-back-mark svg { width: 100%; height: 100%; }
.pc-back-t { color: var(--acc); letter-spacing: 0.5em; padding-left: 0.5em; font-size: 10px; }
.pc-back-n { color: rgba(236, 230, 218, 0.5); font-size: 9px; }
.pc-front {
  display: flex; flex-direction: column; padding: 10px 10px 9px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--acc) 22%, #101117), #0b0c10 55%, color-mix(in srgb, var(--acc2) 30%, #0b0c10));
  border: 2px solid var(--acc);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), 0 0 36px -6px color-mix(in srgb, var(--acc) 55%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.pc-top { display: flex; justify-content: space-between; padding: 2px 4px 8px; color: var(--acc); font-size: 9px; letter-spacing: 0.22em; }
.pc-art { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--acc) 60%, transparent); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.pc-art .ph { display: block; }
.pc-art.is-stack { cursor: pointer; aspect-ratio: 4 / 5; }
.pc-art .pc-shot { position: absolute; inset: 0; opacity: 0; transition: opacity 0.45s var(--ease-out); }
.pc-art .pc-shot.is-on { opacity: 1; }
.pc-count { position: absolute; left: 8px; top: 8px; padding: 3px 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.55); color: var(--paper); font-size: 8.5px; letter-spacing: 0.14em; }
.pc-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.pc-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.4); box-shadow: 0 0 4px rgba(0, 0, 0, 0.6); transition: background 0.3s, transform 0.3s; }
.pc-dots i.is-on { background: var(--acc); transform: scale(1.3); }
.pc-mark { position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; color: var(--acc); opacity: 0.85; filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.8)); }
.pc-mark svg { width: 100%; height: 100%; }
.pc-name { margin-top: 10px; padding: 7px 8px 6px; text-align: center; font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--acc) 22%, transparent), transparent); border-top: 1px solid color-mix(in srgb, var(--acc) 45%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--acc) 45%, transparent); }
.pc-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: auto; padding: 8px 4px 0; color: rgba(236, 230, 218, 0.62); font-size: 8.5px; letter-spacing: 0.14em; }
.pc-foot span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-holo { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0.35;
  background: radial-gradient(60% 45% at var(--hx) var(--hy), rgba(255, 255, 255, 0.45), transparent 60%), linear-gradient(115deg, transparent 30%, rgba(255, 120, 200, 0.25) 42%, rgba(120, 220, 255, 0.25) 52%, rgba(255, 230, 140, 0.2) 60%, transparent 72%);
  background-size: 100% 100%, 250% 250%; background-position: 0 0, var(--hx) var(--hy); transition: opacity 0.4s; }
.pc:hover .pc-holo { opacity: 0.6; }
.pc-inner::after { content: ""; position: absolute; inset: -10%; border-radius: 20px; pointer-events: none; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.35) 50%, transparent 60%); transform: translateX(-120%); animation: pcShine 1.4s 1.3s var(--ease-out) forwards; }
@keyframes pcShine { to { transform: translateX(120%); } }

/* ================================================================ FINALE */
#finale { position: fixed; inset: 0; z-index: 12; display: none; }
#finale.is-on { display: block; }
.fin-veil { position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 55%, rgba(3, 4, 7, 0.55), rgba(3, 4, 7, 0.92)); animation: fadeIn 3s both; }
.fin-bg { position: absolute; inset: 0; opacity: 0; animation: finBg 4s 0.5s ease-out forwards; }
.fin-bg .ph { height: 100%; }
.fin-bg .ph img { animation: kenburns 30s linear both; }
@keyframes finBg { to { opacity: 0.32; } }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
.fin-stage, .fin-keep { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; padding: 0 24px; }
.fin-keep { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.fin-line { font-weight: 300; font-size: clamp(24px, 3.2vw, 44px); line-height: 1.2; letter-spacing: -0.01em; max-width: 24ch; margin: 0 auto; text-wrap: balance; animation: finIn 1.6s var(--ease-out) both; }
.fin-line.is-out { animation: finOut 1.1s var(--ease-cine) forwards; }
.fin-number { font-size: clamp(110px, 20vw, 260px); line-height: 0.9; letter-spacing: -0.05em; }
.fin-big { font-size: clamp(36px, 5vw, 68px); }
.fin-keep-sub { font-style: italic; color: var(--paper-dim); font-size: clamp(17px, 1.7vw, 22px); max-width: 32ch; }
@keyframes finIn { from { opacity: 0; filter: blur(12px); transform: translateY(12px); } to { opacity: 1; filter: none; transform: none; } }
@keyframes finOut { to { opacity: 0; filter: blur(10px); transform: translateY(-10px); } }
.fin-cta { margin-top: 42px; display: inline-flex; align-items: center; gap: 14px; opacity: 0; animation: fadeUp 1.6s 0.4s var(--ease-out) forwards; }
.fin-cta .mono { letter-spacing: 0.34em; padding-left: 0.34em; }
.fin-cta:hover .in-br:first-child { transform: translateX(-10px); color: var(--paper); }
.fin-cta:hover .in-br:last-child { transform: translateX(10px); color: var(--paper); }
.fin-skip { position: absolute; right: var(--gutter); top: calc(22px + env(safe-area-inset-top)); color: var(--mute); transition: color 0.3s; }
.fin-skip:hover { color: var(--paper); }
#finale.is-leaving .fin-keep, #finale.is-leaving .fin-stage { opacity: 0; filter: blur(8px); transition: all 0.9s var(--ease-cine); }

/* ============================================================ RESPONSIVE */
@media (max-width: 759px) {
  .tl-mem-back { display: block; }
  #timeline.has-mem .tl-mem-back { opacity: 1; pointer-events: auto; }
  #timeline .tl-mem {
    position: absolute; z-index: 10; left: 16px; right: 16px; top: 50% !important; bottom: auto !important; transform: translateY(-50%) !important;
    max-height: calc(100% - 120px); overflow-y: auto; padding: 22px 18px 20px !important; background: rgba(8, 9, 14, 0.96);
    border: 1px solid rgba(236, 230, 218, 0.16); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  }
  #timeline .tl-mem:empty { display: none; }
  #timeline .tl-mem.is-out { opacity: 0; transform: translateY(-46%) !important; }
  #timeline .tl-mem .mem { flex-direction: column !important; align-items: center; gap: 22px; }
  #timeline .tl-mem .rv--pc { width: 62% !important; flex: 0 0 auto !important; }
  #timeline .tl-mem .mem-text { background: none; border: 0; padding: 0; backdrop-filter: none; width: 100%; }
  #timeline .mem-x { position: sticky; top: 0; right: 0; margin: -8px -4px -30px auto; align-self: flex-end; }
  #timeline.has-mem .vl-pad { opacity: 0; pointer-events: none; }
  .old-tl-mem {
    left: 0; right: 0; top: 46%; bottom: 0; transform: none; max-height: none;
    padding: 18px 20px calc(190px + env(safe-area-inset-bottom)); overflow-y: auto;
    background: linear-gradient(180deg, transparent, rgba(3, 4, 6, 0.4) 30px);
  }
  .tl-mem.is-out { transform: translateY(16px); }
  .mem { flex-direction: row; align-items: flex-start; gap: 18px; }
  .mem-title { font-size: 26px; margin-top: 8px; }
  .mem-cap { font-size: 14px; }
  .mem-nav { margin-top: 16px; }
  .act-kanji { right: 12px; font-size: 16px; }
}


/* ==========================================================================
   CHARACTER CREATION — character, weapon, pet (js/loadout.js)
   a pixel game window: tabs, a carousel, a preview, back and confirm
   ========================================================================== */
.cz {
  --cz-bg: #1a2236; --cz-bg2: #222c45; --cz-edge: #8d9cba; --cz-dark: #0c1120; --cz-slot: #2b3652; --cz-text: #e6ebf4; --cz-dim: #8e9ab3; --cz-hi: #c9d6ef;
  position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: #070a12;
  font-family: "Silkscreen", var(--mono); color: var(--cz-text); text-transform: uppercase;
  opacity: 0; visibility: hidden; transition: opacity 0.5s var(--ease-out), visibility 0s 0.5s;
}
.cz.is-on { opacity: 1; visibility: visible; transition: opacity 0.5s var(--ease-out); }
.cz button { font-family: inherit; text-transform: inherit; color: inherit; }
.cz canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
/* the beveled pixel frame used everywhere */
.cz-win, .cz-body, .cz-preview, .cz-slot, .cz-btn, .cz-rand, .cz-tab, .cz-tab-name, .cz-info {
  border: 3px solid var(--cz-edge); box-shadow: 0 0 0 3px var(--cz-dark), inset 0 0 0 2px var(--cz-dark);
}
.cz-win {
  width: min(760px, 100%); padding: 14px 18px 18px; border-radius: 6px;
  background-color: var(--cz-bg);
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 12px 12px;
}
.cz-title { text-align: center; font-family: "Silkscreen", var(--mono); font-weight: 700; font-size: clamp(24px, 5.4vw, 42px); letter-spacing: 0.06em; line-height: 1; margin: 2px 0 14px;
  color: #eef1f7; text-shadow: 0 3px 0 #5d6a88, 0 6px 0 var(--cz-dark); }
.cz-tabs { display: flex; align-items: flex-end; gap: 0; padding: 0 22px; position: relative; z-index: 1; margin-bottom: -3px; }
.cz-tab { position: relative; width: 52px; height: 40px; display: grid; place-items: center; background: var(--cz-bg2); border-bottom: 0; border-radius: 6px 6px 0 0; box-shadow: 0 -3px 0 0 var(--cz-dark), inset 0 0 0 2px var(--cz-dark); }
.cz-tab + .cz-tab { margin-left: -3px; }
.cz-tab.is-on { background: var(--cz-bg); height: 46px; z-index: 2; }
.cz-tab--blank { pointer-events: none; opacity: 0.8; }
.cz-tab-i { display: grid; place-items: center; }
.cz-tab-i canvas { height: 30px; width: auto; }
.cz-tab-i--svg { width: 32px; height: 32px; }
.cz-tab-i--svg svg { width: 100%; height: 100%; }
.cz-check { position: absolute; right: 3px; top: 3px; width: 8px; height: 8px; background: #59d18a; box-shadow: 0 0 0 2px var(--cz-dark); opacity: 0; transform: scale(0.4); transition: opacity 0.2s, transform 0.2s; }
.cz-tab.is-done .cz-check { opacity: 1; transform: none; }
.cz-tab-name { flex: 1; margin-left: -3px; height: 40px; display: flex; align-items: center; padding: 0 14px; font-size: 13px; background: var(--cz-bg); border-bottom: 0; border-radius: 6px 6px 0 0; }
.cz-body { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 18px; padding: 18px; background: var(--cz-bg); border-radius: 4px; }
.cz-pick { display: grid; gap: 12px; align-content: start; min-width: 0; }
.cz-label { font-size: 12px; letter-spacing: 0.06em; color: var(--cz-text); }
.cz-carousel { display: flex; align-items: center; gap: 6px; }
.cz-arrow { flex: none; width: 22px; height: 40px; font-size: 12px; color: var(--cz-hi); background: none; }
.cz-arrow:hover { color: #fff; }
.cz-row { flex: 1; display: grid; grid-template-columns: 1fr 1fr 1.3fr 1fr 1fr; align-items: center; gap: 8px; min-width: 0; }
.cz-slot { aspect-ratio: 1; display: grid; place-items: center; background: var(--cz-slot); border-color: #3e4b6b; border-radius: 3px; opacity: 0.5; filter: saturate(0.35); transition: opacity 0.2s, filter 0.2s, transform 0.2s var(--ease-out); }
.cz-slot:hover { opacity: 0.8; filter: none; }
.cz-slot.is-center { opacity: 0.85; filter: saturate(0.6); border-color: var(--cz-edge); background: #33405f; }
.cz-slot.is-picked { opacity: 1; filter: none; border-color: var(--cz-hi); background: #3a4a6e; transform: translateY(-3px); box-shadow: 0 0 0 3px var(--cz-dark), inset 0 0 0 2px var(--cz-dark), 0 0 18px -2px rgba(160, 190, 255, 0.45); }
.cz-art { display: grid; place-items: center; width: 78%; height: 78%; }
.cz-art canvas { max-width: 100%; max-height: 100%; }
.cz-art--char canvas { height: 100%; width: auto; }
.cz-art--pet canvas { width: 100%; height: auto; }
.cz-art--icon svg { width: 80%; height: 80%; }
.cz-info { display: grid; gap: 4px; padding: 12px 14px; min-height: 92px; align-content: center; background: rgba(12, 17, 32, 0.45); border-color: #3e4b6b; border-radius: 3px; }
.cz-info-k { font-size: 10px; color: var(--cz-dim); }
.cz-info-n { font-size: 18px; font-weight: 700; color: #fff; }
.cz-info-l { font-family: var(--serif); text-transform: none; font-style: italic; font-size: 16px; line-height: 1.35; color: var(--paper-2); }
.cz-side { display: grid; gap: 14px; align-content: start; justify-items: center; }
.cz-preview { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 3px; background-color: #1d2740;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px); background-size: 10px 10px; }
.cz-canvas { width: 100%; height: 100%; }
.cz-rand { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; font-size: 12px; background: var(--cz-bg2); border-radius: 14px; }
.cz-rand:hover, .cz-btn:not(:disabled):hover { background: #2e3b5c; }
.cz-die { width: 20px; height: 20px; display: grid; }
.cz-die svg { width: 100%; height: 100%; }
.cz-rand:active .cz-die { transform: rotate(90deg); }
.cz-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 0 18px; }
.cz-btn { min-width: 112px; padding: 8px 14px; font-size: 13px; background: var(--cz-bg2); border-radius: 4px; }
.cz-btn[hidden] { display: block; visibility: hidden; }
.cz-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cz-btn--go:not(:disabled) { border-color: #a9c4f5; animation: czReady 1.6s ease-in-out infinite; }
@keyframes czReady { 50% { box-shadow: 0 0 0 3px var(--cz-dark), inset 0 0 0 2px var(--cz-dark), 0 0 16px 0 rgba(150, 190, 255, 0.55); } }
.cz-hint { flex: 1; text-align: center; font-size: 10px; color: var(--cz-dim); }
.cz-hint.is-ready { color: #59d18a; }
@media (max-width: 640px) {
  .cz { place-items: start center; }
  .cz-win { padding: 12px 10px 14px; }
  .cz-tabs { padding: 0 8px; }
  .cz-tab { width: 46px; }
  .cz-tab--blank { display: none; }
  .cz-body { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .cz-side { grid-template-columns: 120px 1fr; align-items: center; justify-items: start; order: -1; }
  .cz-row { gap: 5px; }
  .cz-arrow { width: 16px; }
  .cz-foot { padding: 0 4px; }
  .cz-btn { min-width: 0; padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { .cz-btn--go:not(:disabled) { animation: none; } }

/* the chip in the village (where the inventory used to be) */
.cz-chip { position: absolute; left: var(--gutter); top: calc(24px + env(safe-area-inset-top)); z-index: 7; display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px; font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--paper);
  background: rgba(8, 9, 14, 0.92); border: 1px solid rgba(236, 230, 218, 0.18); transition: opacity 1.2s, border-color 0.25s; }
.cz-chip:hover { border-color: rgba(236, 230, 218, 0.45); }
.cz-chip canvas { width: 34px; height: 27px; image-rendering: pixelated; image-rendering: crisp-edges; }
.cz-chip kbd { font-family: var(--mono); font-size: 9px; padding: 2px 5px; border: 1px solid var(--line-2); color: var(--paper-dim); }
#timeline.is-ending .cz-chip { opacity: 0; pointer-events: none; }
@media (hover: none) { .cz-chip kbd { display: none; } }

/* ==========================================================================
   YEAR CARD (text only) — fits a phone without scrolling
   ========================================================================== */
#timeline .tl-mem .mem--text { max-width: 470px; }
.mem-pack { display: inline-flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; color: #0b0c10; background: var(--paper);
  border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 10px 30px -10px rgba(110, 168, 255, 0.7); transition: transform 0.3s var(--ease-out), box-shadow 0.3s; animation: packCall 2.4s ease-in-out 2.4s infinite; }
.mem-pack:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px #fff, 0 14px 36px -10px rgba(110, 168, 255, 0.9); }
.mem-pack .mono { font-size: 11px; letter-spacing: 0.2em; }
.mem-pack-i { width: 16px; height: 22px; border-radius: 2px; background: linear-gradient(135deg, #b46ef2, #6ea8ff 50%, #e8c14a); box-shadow: inset 0 3px 0 rgba(0, 0, 0, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.mem-pack-n { opacity: 0.55; font-size: 9px !important; }
.mem-pack.is-opened { color: var(--paper); background: transparent; box-shadow: none; border: 1px solid var(--line-2); padding: 9px 12px 9px 10px; animation: none; }
.mem-pack.is-opened .mem-pack-n { display: none; }
@keyframes packCall { 50% { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4), 0 10px 40px -6px rgba(180, 110, 242, 0.85); } }
.mem-skip { color: var(--mute); font-size: 10px; letter-spacing: 0.2em; padding: 10px 4px; transition: color 0.3s; }
.mem-skip:hover { color: var(--paper); }
.mem-nav { flex-wrap: wrap; }
@media (max-width: 759px) {
  #timeline .tl-mem { overflow: visible !important; max-height: none !important; padding: 20px 18px 18px !important; }
  #timeline .tl-mem .mem--text { max-width: none; }
  #timeline .mem-x { position: absolute; top: -14px; right: -6px; margin: 0; }
  .mem--text .mem-title { font-size: clamp(24px, 7.4vw, 30px); margin-top: 8px; }
  .mem--text .mem-cap { font-size: 14px; line-height: 1.5; margin-top: 10px; max-width: none; }
  .mem--text .mem-verse { margin-top: 12px; padding: 8px 0 0 12px; }
  .mem--text .mem-verse p { font-size: 14px; line-height: 1.4; }
  .mem--text .mem-nav { margin-top: 16px; gap: 10px 14px; }
  .mem-meta { font-size: 9px; }
}
@media (max-width: 759px) and (max-height: 700px) {
  .mem--text .mem-cap { font-size: 13px; line-height: 1.45; }
  .mem--text .mem-verse p { font-size: 13px; }
}

/* ==========================================================================
   CARD PACK — rip it open, the cards come out
   ========================================================================== */
.pk { position: fixed; inset: 0; z-index: 74; display: grid; place-items: center; align-content: center; gap: 18px; padding: calc(56px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(70% 60% at 50% 45%, #241b3e, #040509); opacity: 0; transition: opacity 0.45s var(--ease-out); overflow: hidden;
  font-family: "Silkscreen", var(--mono); text-transform: uppercase; color: var(--paper); }
.pk.is-on { opacity: 1; }
.pk button { font-family: inherit; text-transform: inherit; }
.pk-x { position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top)); z-index: 5; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--paper); background: rgba(8, 9, 14, 0.8); border: 1px solid rgba(236, 230, 218, 0.3); font-size: 14px; }
.pk.act-I { --acc: #d9a066; --acc2: #7a4a1e; --acc3: #f3d79a; }
.pk.act-II { --acc: #d0605a; --acc2: #5e1a24; --acc3: #f2a0b8; }
.pk.act-III { --acc: #7fb0ff; --acc2: #26306e; --acc3: #c9a0ff; }
.pk-stage { position: relative; display: grid; place-items: center; perspective: 1200px; }

/* the foil pack */
.pk-pack { --rx: 0deg; --ry: 0deg; --hx: 50%; --tear: 0; position: relative; width: min(64vw, 270px, 38vh); aspect-ratio: 0.6; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform 0.4s var(--ease-out); animation: packIn 0.9s var(--ease-out) both, packFloat 3.6s 0.9s ease-in-out infinite; z-index: 2; }
@keyframes packIn { from { opacity: 0; transform: translateY(40px) scale(0.86) rotate(-4deg); } }
@keyframes packFloat { 50% { translate: 0 -6px; } }
.pk-top, .pk-body { position: absolute; left: 0; right: 0; overflow: hidden;
  background:
    radial-gradient(60% 40% at 50% 55%, color-mix(in srgb, var(--acc3) 55%, transparent), transparent 70%),
    linear-gradient(160deg, var(--acc2), color-mix(in srgb, var(--acc) 70%, #1a1030) 45%, var(--acc2)); }
.pk-top { top: 0; height: 15%; border-radius: 6px 6px 0 0; display: flex; align-items: center; justify-content: space-between; padding: 10% 8% 0; transition: transform 0.75s var(--ease-out), opacity 0.75s; z-index: 2;
  clip-path: inset(0 0 0 0); }
.pk-body { top: 15%; bottom: 0; border-radius: 0 0 6px 6px; display: grid; justify-items: center; align-content: end; padding-bottom: 14%; transition: transform 0.8s 0.25s var(--ease-cine), opacity 0.6s 0.35s; }
.pk-crimp { position: absolute; left: 0; right: 0; top: 0; height: 9px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 2px, rgba(0, 0, 0, 0.25) 2px 5px); }
.pk-crimp--b { top: auto; bottom: 0; }
.pk-brand { font-size: clamp(8px, 2.4vw, 11px); letter-spacing: 0.12em; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); }
.pk-badge { font-size: clamp(8px, 2.2vw, 10px); padding: 2px 6px; background: #0b0c10; color: #fff; border-radius: 3px; }
.pk-tear { position: absolute; left: 4%; right: 4%; top: 15%; height: 2px; z-index: 3; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.85) 0 6px, transparent 6px 10px); transform: translateY(-1px); }
.pk-tear-fill { position: absolute; left: 0; top: -2px; height: 6px; width: calc(var(--tear) * 100%); background: #fff; box-shadow: 0 0 12px #fff, 0 0 24px var(--acc3); }
.pk-tear::after { content: "»»»"; position: absolute; left: 0; top: -14px; font-size: 10px; color: #fff; letter-spacing: 2px; animation: tearHint 1.6s ease-in-out infinite; opacity: calc(1 - var(--tear) * 3); }
@keyframes tearHint { from { transform: translateX(0); opacity: 0; } 30% { opacity: 1; } to { transform: translateX(160px); opacity: 0; } }
.pk-burst { position: absolute; inset: -20% -20% 20%; background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 255, 255, 0.10) 0 6deg, transparent 6deg 14deg); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pk-spiral { position: absolute; top: 9%; width: 54%; aspect-ratio: 1; color: rgba(255, 255, 255, 0.28); }
.pk-spiral svg { width: 100%; height: 100%; }
.pk-hero { position: relative; width: 44%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 0 10px var(--acc3)) drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); margin-bottom: 8%; }
.pk-name { position: relative; padding: 5px 12px; font-size: clamp(13px, 4vw, 18px); font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.55); border: 2px solid #fff; border-radius: 6px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); white-space: nowrap; }
.pk-sub { position: relative; margin-top: 6px; font-size: 9px; color: rgba(255, 255, 255, 0.85); min-height: 1em; }
.pk-count { position: relative; margin-top: 6px; font-size: 9px; padding: 2px 8px; background: #fff; color: #0b0c10; border-radius: 99px; }
.pk-holo { position: absolute; inset: 0; border-radius: 6px; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0.5; z-index: 4;
  background: linear-gradient(115deg, transparent calc(var(--hx) - 30%), rgba(255, 120, 220, 0.35) calc(var(--hx) - 12%), rgba(120, 220, 255, 0.4) var(--hx), rgba(255, 240, 140, 0.3) calc(var(--hx) + 12%), transparent calc(var(--hx) + 30%)); }
.pk-pack.is-ripped { animation: none; cursor: default; }
.pk-pack.is-ripped .pk-top { transform: translate(40%, -160%) rotate(22deg); opacity: 0; }
.pk-pack.is-ripped .pk-tear, .pk-pack.is-ripped .pk-holo { opacity: 0; }
.pk-pack.is-ripped .pk-body { transform: translateY(70%); opacity: 0; }
.pk-pack.is-ripped::before { content: ""; position: absolute; left: 10%; right: 10%; top: 12%; height: 30%; z-index: 1; background: radial-gradient(50% 50% at 50% 100%, #fff, transparent 70%); animation: ripGlow 0.8s ease-out both; }
@keyframes ripGlow { from { opacity: 1; transform: scaleY(0.2); } to { opacity: 0; transform: translateY(-40%) scaleY(1.4); } }
.pk-ghosts i { position: absolute; top: 50%; width: min(52vw, 210px, 30vh); aspect-ratio: 0.6; border-radius: 6px; opacity: 0.35; filter: blur(1.5px);
  background: linear-gradient(160deg, var(--acc2), var(--acc) 50%, var(--acc2)); }
.pk-ghosts i:first-child { right: 62%; transform: translateY(-50%) rotate(-8deg); }
.pk-ghosts i:last-child { left: 62%; transform: translateY(-50%) rotate(8deg); }
.pk-hint { display: grid; gap: 6px; text-align: center; font-size: 10px; letter-spacing: 0.1em; color: var(--paper); transition: opacity 0.4s; }
.pk-hint span { font-size: 8px; color: var(--paper-dim); }
.pk-hint.is-out { opacity: 0; }

/* the cards coming out */
.pk-deck { display: grid; place-items: center; }
.pk-card { width: min(72vw, 290px, calc((100vh - 230px) * 0.676)); cursor: pointer; animation: cardOut 0.7s var(--ease-out) both; }
.pk-card .pc { width: 100%; }
@keyframes cardOut { from { transform: translateY(60px) scale(0.9); opacity: 0; } }
.pk-card.is-gone { animation: cardGone 0.38s var(--ease-cine) forwards; }
@keyframes cardGone { to { transform: translateX(-120%) rotate(-14deg); opacity: 0; } }
.pk-card.is-new .pc-top span:last-child { color: #fff; background: var(--acc); padding: 0 5px; border-radius: 2px; }
.pk-under { display: grid; gap: 6px; text-align: center; }
.pk-counter { font-size: 11px; letter-spacing: 0.14em; }
.pk-tap { font-size: 8px; color: var(--paper-dim); letter-spacing: 0.12em; }

/* all of them, fanned */
.pk-fan { position: relative; display: flex; justify-content: center; height: min(46vh, 300px); width: min(92vw, 520px); align-items: center; }
.pk-mini { position: absolute; width: min(30vw, 140px); padding: 5px; background: #12131a; border: 1px solid var(--acc); border-radius: 8px; box-shadow: 0 16px 30px -12px rgba(0, 0, 0, 0.9);
  transform: translate(var(--x), var(--y)) rotate(var(--a)); animation: fanIn 0.7s var(--d) var(--ease-out) both; }
.pk-mini .ph { border-radius: 4px; }
@keyframes fanIn { from { transform: translate(0, 30px) rotate(0deg); opacity: 0; } }
.pk-end { display: grid; gap: 14px; justify-items: center; text-align: center; }
.pk-end-t { font-size: 11px; letter-spacing: 0.12em; }
.pk-end-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pk-btn { padding: 11px 16px; font-size: 11px; color: var(--paper); background: rgba(8, 9, 14, 0.7); border: 2px solid rgba(236, 230, 218, 0.4); border-radius: 4px; }
.pk-btn--go { color: #0b0c10; background: var(--paper); border-color: var(--paper); }
.pk-btn:hover { border-color: #fff; }

/* ==========================================================================
   BINDER — every card collected so far, a page at a time (no scrolling)
   ========================================================================== */
.pk--binder { background: radial-gradient(80% 70% at 50% 40%, #1a2236, #06080d); }
.bd { width: min(620px, 100%, calc((100vh - 250px) * 0.66)); display: grid; gap: 14px; justify-items: center; }
.pk--binder { overflow-y: auto; align-content: start; padding-top: calc(48px + env(safe-area-inset-top)); }
@media (min-height: 720px) { .pk--binder { align-content: center; } }
.bd-head { display: grid; justify-items: center; gap: 2px; }
.bd-k { font-size: 10px; letter-spacing: 0.3em; color: #9ec2ff; }
.bd-n { font-size: clamp(26px, 7vw, 38px); font-weight: 700; line-height: 1.1; }
.bd-sub { font-size: 9px; color: var(--paper-dim); }
.bd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; padding: 14px; background: rgba(12, 17, 32, 0.6); border: 3px solid #8d9cba; border-radius: 8px; box-shadow: 0 0 0 3px #0c1120; }
.bd-grid.is-turn { animation: pageTurn 0.4s var(--ease-out); }
@keyframes pageTurn { from { opacity: 0; transform: translateX(14px); } }
.bd-slot { position: relative; display: grid; gap: 5px; padding: 5px; border-radius: 6px; background: #12131a; border: 1px solid #2c3550; color: var(--paper); }
.bd-slot.act-I { --acc: #d9a066; } .bd-slot.act-II { --acc: #d0605a; } .bd-slot.act-III { --acc: #7fb0ff; }
.bd-slot.is-have { border-color: var(--acc); cursor: zoom-in; }
.bd-slot.is-have:hover { transform: translateY(-2px); }
.bd-slot .ph { border-radius: 4px; }
.bd-back { aspect-ratio: 4 / 5; display: grid; place-items: center; border-radius: 4px; color: #3a4668; background: repeating-linear-gradient(45deg, #161c2c 0 6px, #131827 6px 12px); }
.bd-back svg { width: 40%; }
.bd-slot-l { font-size: 7.5px; letter-spacing: 0.06em; color: var(--paper-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-nav { display: flex; align-items: center; gap: 18px; }
.bd-arrow { display: grid; place-items: center; width: 40px; height: 34px; color: var(--paper); background: rgba(8, 9, 14, 0.7); border: 2px solid rgba(236, 230, 218, 0.35); border-radius: 4px; font-size: 11px; }
.bd-page { font-size: 10px; letter-spacing: 0.1em; color: var(--paper-dim); }
.bd-view { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(3, 4, 7, 0.88); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.bd-view.is-on { opacity: 1; pointer-events: auto; }
@media (max-width: 639px) {
  .bd-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 9px; }
  .bd-grid .bd-slot { padding: 3px; }
}
@media (max-width: 639px) and (max-height: 760px) { .bd-grid { width: min(100%, 300px); } }

/* the cards chip in the village, under "change" */
.bd-chip { position: absolute; left: var(--gutter); top: calc(74px + env(safe-area-inset-top)); z-index: 7; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 10px;
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--paper); background: rgba(8, 9, 14, 0.92); border: 1px solid rgba(236, 230, 218, 0.18);
  transition: opacity 1.2s, border-color 0.25s; }
.bd-chip:hover { border-color: rgba(236, 230, 218, 0.45); }
.bd-chip-i { width: 16px; height: 16px; color: #b46ef2; display: grid; }
.bd-chip-n { color: var(--paper-dim); }
#timeline.is-ending .bd-chip { opacity: 0; pointer-events: none; }

/* ==========================================================================
   THE CHALLENGE — a platformer before act II (js/challenge.js)
   ========================================================================== */
.ch { position: fixed; inset: 0; z-index: 76; background: #120d1c; opacity: 0; transition: opacity 0.5s var(--ease-out); overflow: hidden; touch-action: none;
  font-family: "Silkscreen", var(--mono); text-transform: uppercase; color: var(--paper); user-select: none; -webkit-user-select: none; }
.ch.is-on { opacity: 1; }
.ch button { font-family: inherit; text-transform: inherit; color: inherit; }
.ch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.ch-hud { position: absolute; left: 16px; top: calc(16px + env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 2; transition: opacity 0.4s; }
.ch-hud-i { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; font-size: 10px; background: rgba(8, 9, 14, 0.75); border: 2px solid rgba(236, 230, 218, 0.35); border-radius: 4px; }
.ch-hud-i b { font-weight: 700; color: #fff; }
.ch-coin { width: 9px; height: 9px; background: #e8c14a; box-shadow: inset -2px -2px 0 #b8902a; }
.ch-skip { padding: 6px 10px; font-size: 9px; color: var(--paper-dim) !important; background: rgba(8, 9, 14, 0.75); border: 2px dashed rgba(236, 230, 218, 0.3); border-radius: 4px; }
.ch-skip[hidden] { display: none; }
.ch-x { position: absolute; right: 16px; top: calc(16px + env(safe-area-inset-top)); z-index: 3; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(8, 9, 14, 0.8); border: 1px solid rgba(236, 230, 218, 0.3); font-size: 14px; }
.ch.is-card .ch-hud, .ch.is-card .ch-pad { opacity: 0; pointer-events: none; }
/* on screen controls (touch) */
.ch-pad { position: absolute; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); display: none; justify-content: space-between; align-items: flex-end; z-index: 2; pointer-events: none; transition: opacity 0.4s; }
.ch-pad-l { display: flex; gap: 10px; }
.ch-pad-b { pointer-events: auto; width: 64px; height: 64px; display: grid; place-items: center; font-size: 18px; border-radius: 14px; background: rgba(8, 9, 14, 0.55); border: 2px solid rgba(236, 230, 218, 0.35); touch-action: none; }
.ch-pad-b:active { background: rgba(236, 230, 218, 0.85); color: #0b0c10 !important; }
.ch-pad-jump { width: 80px; height: 80px; border-radius: 50%; font-size: 22px; border-color: rgba(255, 210, 138, 0.6); }
@media (hover: none), (pointer: coarse), (max-width: 759px) { .ch-pad { display: flex; } }
/* the start, win and unlock cards */
.ch-screen { position: absolute; inset: 0; display: grid; place-items: center; padding: 70px 16px 24px; z-index: 2; pointer-events: none; }
.ch-screen:empty { display: none; }
.ch-card { pointer-events: auto; width: min(460px, 100%); display: grid; gap: 12px; justify-items: center; text-align: center; padding: 22px 20px 20px;
  background: rgba(18, 14, 30, 0.92); border: 3px solid #8d9cba; box-shadow: 0 0 0 3px #0c1120, inset 0 0 0 2px #0c1120, 0 30px 70px rgba(0, 0, 0, 0.6); border-radius: 6px; animation: chIn 0.6s var(--ease-out) both; }
@keyframes chIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
.ch-k { font-size: 10px; letter-spacing: 0.28em; color: #ffd28a; }
.ch-t { font-family: "Silkscreen", var(--mono); font-weight: 700; font-size: clamp(26px, 7vw, 40px); line-height: 1; color: #fff; text-shadow: 0 3px 0 #5d6a88, 0 6px 0 #0c1120; }
.ch-l { font-family: var(--serif); text-transform: none; font-size: 17px; line-height: 1.45; color: var(--paper-2); }
.ch-c { font-size: 9px; letter-spacing: 0.12em; color: var(--paper-dim); }
.ch-verse { padding: 10px 14px; border-left: 2px solid #d0605a; text-align: left; }
.ch-verse p { font-family: var(--serif); text-transform: none; font-style: italic; font-size: 15px; line-height: 1.4; color: var(--paper); }
.ch-verse cite { display: block; margin-top: 6px; font-style: normal; font-size: 9px; color: #ff9b8f; }
.ch-stats { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 9px; color: var(--paper-dim); }
.ch-stats b { color: #ffd28a; }
.ch-btn { margin-top: 4px; padding: 12px 20px; font-size: 12px; border-radius: 4px; border: 3px solid #8d9cba; background: #1f2a44; box-shadow: 0 0 0 3px #0c1120; }
.ch-btn--go { color: #0b0c10 !important; background: #ffd28a; border-color: #fff1d0; animation: czReady 1.6s ease-in-out infinite; }
/* act II unlocked */
.ch-unlock { display: grid; gap: 22px; justify-items: center; }
.ch-lock { position: relative; width: 70px; height: 80px; animation: lockShake 0.6s 0.1s ease-in-out; }
.ch-shackle { position: absolute; left: 14px; top: 0; width: 42px; height: 40px; border: 8px solid #e8c14a; border-bottom: 0; border-radius: 22px 22px 0 0; animation: shackleOpen 0.5s 0.7s var(--ease-out) forwards; transform-origin: 85% 100%; }
.ch-body { position: absolute; left: 0; bottom: 0; width: 70px; height: 48px; background: #e8c14a; border-radius: 6px; box-shadow: inset 0 -6px 0 #b8902a, 0 0 0 3px #0c1120; }
.ch-body::after { content: ""; position: absolute; left: 31px; top: 14px; width: 8px; height: 16px; background: #0c1120; border-radius: 4px; }
@keyframes lockShake { 25% { transform: rotate(-8deg); } 50% { transform: rotate(7deg); } 75% { transform: rotate(-4deg); } }
@keyframes shackleOpen { to { transform: translateY(-14px) rotate(28deg); } }
.ch-unlock-t { font-size: clamp(22px, 6vw, 34px); color: #fff; text-shadow: 0 0 24px rgba(255, 210, 138, 0.8), 0 3px 0 #0c1120; opacity: 0; animation: chIn 0.6s 1s var(--ease-out) forwards; }
.ch-unlock::before { content: ""; position: absolute; left: 50%; top: 50%; width: 140vmax; height: 140vmax; translate: -50% -50%; z-index: -1; opacity: 0;
  background: repeating-conic-gradient(rgba(255, 210, 138, 0.14) 0 8deg, transparent 8deg 18deg); animation: burstOn 1.4s 0.9s ease-out forwards, spin 30s linear infinite; }
@keyframes burstOn { to { opacity: 1; } }

/* ==========================================================================
   YEAR CARD SIZING — always inside the screen, at every width
   (desktop and tablet: pinned to the right, never wider than the space left;
    phones keep the centered pop up from the responsive block above)
   ========================================================================== */
@media (min-width: 760px) {
  #timeline .tl-mem {
    left: auto; right: var(--gutter); top: 50%; transform: translateY(-50%);
    width: min(480px, calc(100vw - 2 * var(--gutter)), max(360px, 46vw));
    max-height: calc(100vh - 150px); overflow: visible;
  }
  #timeline .tl-mem.is-out { transform: translateY(-46%); }
  #timeline .tl-mem .mem, #timeline .tl-mem .mem--text { width: 100%; max-width: none; }
  #timeline .tl-mem .mem-text { width: 100%; max-width: none; }
  #timeline .mem-x { top: 12px; right: 12px; }
  #timeline .mem-meta { padding-right: 40px; }
  .mem--text .mem-cap { max-width: none; }
}
/* shorter screens: tighten the type so it still fits without scrolling */
@media (min-width: 760px) and (max-height: 820px) {
  .mem--text .mem-title { font-size: clamp(26px, 4.2vh, 38px); }
  .mem--text .mem-cap { font-size: 14px; line-height: 1.5; margin-top: 10px; }
  .mem--text .mem-verse { margin-top: 12px; padding-top: 8px; }
  .mem--text .mem-verse p { font-size: 14px; }
  .mem--text .mem-nav { margin-top: 16px; }
  #timeline .mem-text { padding: 18px 20px 16px; }
}
@media (min-width: 760px) and (max-height: 620px) {
  .mem--text .mem-cap { font-size: 13px; line-height: 1.45; }
  .mem--text .mem-verse p { font-size: 13px; line-height: 1.35; }
}

/* ==========================================================================
   THE BRIDGE SCENE — a cutscene before the challenge (letterbox + dialog)
   ========================================================================== */
.chi { position: fixed; inset: 0; z-index: 76; pointer-events: none; font-family: "Silkscreen", var(--mono); color: var(--paper); }
.chi::before { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 70% at 50% 45%, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.7)); opacity: 0; transition: opacity 0.6s var(--ease-out); }
.chi.is-on::before { opacity: 1; }
.chi-bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; transition: transform 0.7s var(--ease-cine); }
.chi-bar--t { top: 0; transform: translateY(-100%); }
.chi-bar--b { bottom: 0; transform: translateY(100%); }
.chi.is-on .chi-bar { transform: none; }
.chi-box { pointer-events: auto; cursor: pointer; position: absolute; left: 50%; bottom: calc(11vh + 18px + env(safe-area-inset-bottom)); width: min(680px, calc(100vw - 32px)); display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start;
  padding: 16px 18px; background: rgba(12, 17, 32, 0.96); border: 3px solid #8d9cba; border-radius: 6px; box-shadow: 0 0 0 3px #0c1120, inset 0 0 0 2px #0c1120, 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, 30px); opacity: 0; transition: transform 0.6s 0.35s var(--ease-out), opacity 0.6s 0.35s; }
.chi.is-on .chi-box { transform: translate(-50%, 0); opacity: 1; }
.chi-portrait { width: 64px; height: 64px; display: grid; place-items: center; background: #1d2740; border: 3px solid #3e4b6b; border-radius: 4px; overflow: hidden; }
.chi-face { width: 64px; height: 64px; image-rendering: pixelated; image-rendering: crisp-edges; }
.chi-main { display: grid; gap: 8px; min-height: 92px; align-content: start; }
.chi-name { justify-self: start; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: #0b0c10; background: #ffd28a; padding: 3px 8px; border-radius: 3px; }
.chi-text { font-family: var(--serif); font-size: clamp(17px, 2.4vw, 21px); line-height: 1.4; color: #fff; min-height: 2.8em; }
.chi-tap { justify-self: end; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-dim); opacity: 0; }
.chi-tap.is-on { opacity: 1; animation: tapBlink 1.2s steps(2) infinite; }
@keyframes tapBlink { 50% { opacity: 0.25; } }
.chi-btns { display: flex; justify-content: flex-end; }
.chi-go { font-family: "Silkscreen", var(--mono); text-transform: uppercase; font-size: 12px; padding: 11px 16px; color: #0b0c10; background: #ffd28a; border: 3px solid #fff1d0; border-radius: 4px; box-shadow: 0 0 0 3px #0c1120; animation: czReady 1.6s ease-in-out infinite; }
.chi-x { pointer-events: auto; position: absolute; right: 16px; top: calc(11vh + 14px); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--paper); background: rgba(8, 9, 14, 0.85); border: 1px solid rgba(236, 230, 218, 0.3); font-size: 13px; opacity: 0; transition: opacity 0.4s 0.6s; }
.chi.is-on .chi-x { opacity: 1; }
body.chi-open .vl-pad, body.chi-open .cz-chip, body.chi-open .bd-chip, body.chi-open #hud { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
@media (max-width: 640px) {
  .chi-box { grid-template-columns: 1fr; gap: 10px; padding: 14px; }
  .chi-portrait { width: 48px; height: 48px; position: absolute; top: -30px; left: 14px; }
  .chi-face { width: 48px; height: 48px; }
  .chi-main { padding-top: 18px; min-height: 120px; }
}
