/* ---------- Shell tokens: the portal itself only uses paper + ink ---------- */
:root {
  --shell-bg: #f4f1ea; --shell-fg: #17161a; --shell-muted: #5f5b53; --shell-line: rgba(23,22,26,.14); --shell-card: #fffdf8;
  --bg: var(--shell-bg); --fg: var(--shell-fg); --muted: var(--shell-muted); --accent: var(--shell-fg); --accent2: var(--shell-muted);
  --font: 'Noto Sans TC', system-ui, sans-serif; --radius: 999px;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --shell-bg: #121214; --shell-fg: #ece9e2; --shell-muted: #a7a298; --shell-line: rgba(236,233,226,.16); --shell-card: #1b1b1f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --shell-bg: #121214; --shell-fg: #ece9e2; --shell-muted: #a7a298; --shell-line: rgba(236,233,226,.16); --shell-card: #1b1b1f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: 'Noto Sans TC', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.7;
  transition: background-color .9s var(--ease), color .9s var(--ease);
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--shell-fg); color: var(--shell-bg); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Top bar: blend mode keeps it legible on every site's colors ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px); color: #fff; mix-blend-mode: difference; pointer-events: none;
}
.topbar a, .topbar p { pointer-events: auto; }
.logo { font-family: Unbounded, sans-serif; font-weight: 800; font-size: 1.05rem; text-decoration: none; letter-spacing: .02em; }
.now { margin: 0; flex: 1; font-size: .85rem; opacity: .85; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.now span { display: inline-block; transition: opacity .4s, transform .4s var(--ease); }
.now span.swap { opacity: 0; transform: translateY(8px); }
.toall { font-size: .85rem; text-decoration: none; border: 1.5px solid currentColor; padding: 4px 14px; border-radius: 999px; }

/* ---------- Side rail ---------- */
.rail {
  position: fixed; right: clamp(10px, 2vw, 24px); top: 50%; transform: translateY(-50%); z-index: 30;
  display: flex; flex-direction: column; gap: 10px; mix-blend-mode: difference; color: #fff;
}
.rail a { position: relative; display: block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; transition: transform .3s var(--ease), background .3s; }
.rail a.on { background: currentColor; transform: scale(1.35); }
.rail a span { position: absolute; right: 22px; top: 50%; transform: translate(6px, -50%); white-space: nowrap; font-size: .78rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: translate(0, -50%); }
@media (max-width: 760px) { .rail { display: none; } }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; display: grid; place-items: center; position: relative; overflow: hidden;
  padding: 96px 16px 80px; text-align: center;
}
.hero-inner { position: relative; z-index: 2; max-width: 760px; }
.hero-kicker { margin: 0 0 8px; font-size: .9rem; letter-spacing: .18em; color: var(--muted); }
.hero-title { margin: 0; font-family: Unbounded, sans-serif; font-weight: 800; font-size: clamp(3.4rem, 13vw, 9rem); line-height: 1; letter-spacing: -.02em; }
.hero-title span { display: inline-block; }
.js .hero-title span { animation: drop 1s var(--ease) both; animation-delay: calc(var(--i) * 80ms + 150ms); }
@keyframes drop { from { opacity: 0; transform: translateY(-60px) rotate(-12deg) scale(.8); } }
.hero-sub { margin: 18px 0 0; font-size: clamp(1.25rem, 3.4vw, 1.9rem); font-weight: 700; }
.rot { display: inline-block; min-width: 6.5em; text-align: left; border-bottom: 3px solid currentColor; transition: color .4s; }
.rot.typing::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 3px; vertical-align: -.12em; background: currentColor; animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-lead { margin: 20px auto 0; max-width: 34em; color: var(--muted); font-size: 1.02rem; text-wrap: pretty; }
.hero-cta { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-solid, .btn-line { text-decoration: none; padding: 12px 24px; border-radius: 999px; font-weight: 700; transition: transform .25s var(--ease); }
.btn-solid { background: var(--shell-fg); color: var(--shell-bg); }
.btn-line { border: 1.5px solid var(--shell-fg); }
.btn-solid:hover, .btn-line:hover { transform: translateY(-3px); }
.js .hero-kicker, .js .hero-sub, .js .hero-lead, .js .hero-cta { animation: rise .9s var(--ease) both; }
.js .hero-kicker { animation-delay: .1s; } .js .hero-sub { animation-delay: .75s; } .js .hero-lead { animation-delay: .9s; } .js .hero-cta { animation-delay: 1.05s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

.hero-ring { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
/* colour chips orbit on an ellipse so they clear the text and the scroll cue */
.hero-ring span {
  --rx: min(44vw, 420px); --ry: min(36vh, 320px); --a: calc(var(--k) * 30deg + var(--spin));
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  translate: calc(cos(var(--a)) * var(--rx)) calc(sin(var(--a)) * var(--ry));
  box-shadow: 0 0 0 4px var(--shell-bg);
}
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.js .hero-ring span { animation: orbit 80s linear infinite, chipIn 1.4s var(--ease) both; animation-delay: 0s, calc(var(--k) * 70ms + .3s); }
@keyframes orbit { to { --spin: 360deg; } }
@keyframes chipIn { from { opacity: 0; scale: .2; translate: 0 0; } }
@media (max-width: 760px) { .hero { padding-left: 30px; padding-right: 30px; } .hero-ring span { --rx: calc(50vw - 15px); --ry: 44svh; width: 10px; height: 10px; box-shadow: none; } .hero-ring { opacity: .6; } }

.scroll-cue { position: absolute; bottom: 24px; left: 50%; width: 24px; height: 38px; margin-left: -12px; border: 2px solid var(--muted); border-radius: 12px; }
.scroll-cue span { position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--muted); animation: cue 1.6s var(--ease) infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Stages: each one carries its own site palette ---------- */
.stage { min-height: 100svh; display: grid; align-items: center; padding: 96px clamp(16px, 5vw, 72px) 72px; color: var(--fg); position: relative; }
.stage-inner { width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.st-meta { margin: 0; display: flex; gap: 10px; align-items: baseline; font-size: .9rem; color: var(--muted); }
.st-no { font-family: Unbounded, sans-serif; font-weight: 800; font-size: 1.6rem; color: var(--accent); }
.st-group { margin-left: 6px; padding: 2px 10px; border: 1px solid currentColor; border-radius: var(--radius); font-size: .8rem; }
.st-name { margin: 14px 0 0; font-family: var(--font); font-weight: 900; font-size: clamp(2.1rem, 5.4vw, 4.1rem); line-height: 1.12; letter-spacing: -.01em; overflow-wrap: anywhere; text-wrap: balance; }
.st-tag { margin: 18px 0 0; font-size: 1.06rem; color: var(--fg); opacity: .9; max-width: 30em; text-wrap: pretty; }
.st-style { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.st-style li { padding: 4px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); font-size: .88rem; }
.st-swatch { display: flex; gap: 8px; margin-top: 22px; }
.st-swatch i { width: 30px; height: 30px; border-radius: min(var(--radius), 50%); border: 1.5px solid color-mix(in srgb, var(--fg) 30%, transparent); }
.st-go {
  margin-top: 30px; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700;
  background: var(--accent); color: var(--onaccent, var(--bg)); padding: 13px 22px; border-radius: var(--radius); transition: transform .3s var(--ease), gap .3s var(--ease);
}
.st-host { font-weight: 400; font-size: .85rem; opacity: .85; }
.st-go:hover { transform: translateY(-3px); gap: 18px; }
.st-go .arr { transition: transform .3s var(--ease); }
.st-go:hover .arr { transform: translateX(4px); }

/* reveal: only hidden when JS is running */
.js .stage .rv { opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i) * 90ms); }
.js .stage.seen .rv { opacity: 1; transform: none; }
.js .stage .st-swatch i { transform: scale(0); transition: transform .5s var(--ease); }
.js .stage.seen .st-swatch i { transform: scale(1); }
.js .stage.seen .st-swatch i:nth-child(2) { transition-delay: .55s; } .js .stage.seen .st-swatch i:nth-child(3) { transition-delay: .62s; } .js .stage.seen .st-swatch i:nth-child(4) { transition-delay: .69s; } .js .stage.seen .st-swatch i:nth-child(1) { transition-delay: .48s; }

.stage-visual { position: relative; aspect-ratio: 11 / 10; --rx: 0deg; --ry: 0deg; perspective: 1200px; }
.motif { position: absolute; left: 0; top: 0; width: 72%; z-index: 1; }
.motif svg { width: 100%; height: auto; overflow: visible; display: block; }
.browser {
  position: absolute; right: 0; bottom: 0; width: 74%; z-index: 2; border-radius: 12px; overflow: hidden; background: #fff;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.45), 0 0 0 1px color-mix(in srgb, var(--fg) 14%, transparent);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .35s var(--ease);
}
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #ececee; color: #444; font-size: .72rem; }
.browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: #c9c9cd; }
.browser-bar span { margin-left: 8px; background: #fff; border-radius: 6px; padding: 1px 10px; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.browser img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.js .stage .browser { opacity: 0; transform: translateY(60px) rotateX(18deg) scale(.94); transition: opacity 1s var(--ease) .25s, transform 1s var(--ease) .25s; }
.js .stage.seen .browser { opacity: 1; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: opacity 1s var(--ease) .25s, transform .35s var(--ease); }
.js .stage .motif { opacity: 0; transform: scale(.9); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .stage.seen .motif { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .stage { min-height: auto; padding-top: 110px; padding-bottom: 90px; }
  .stage-inner { grid-template-columns: minmax(0, 1fr); }
  .stage-visual { aspect-ratio: 10 / 9; max-width: 560px; }
}

/* ---------- Motif paint classes (per-stage palette) ---------- */
.f-a { fill: var(--accent); } .f-b { fill: var(--accent2); } .f-fg { fill: var(--fg); } .f-bg { fill: var(--bg); } .f-mu { fill: var(--muted); } .f-none { fill: none; }
.f-b2 { fill: color-mix(in srgb, var(--accent) 22%, var(--bg)); }
.f-card { fill: color-mix(in srgb, var(--fg) 7%, var(--bg)); } .f-track { fill: color-mix(in srgb, var(--fg) 14%, var(--bg)); }
.f-paper1 { fill: color-mix(in srgb, var(--fg) 4%, #fff); } .f-paper2 { fill: color-mix(in srgb, var(--fg) 12%, #fff); }
.f-ink { fill: #1a1a1a; }
.s-a { stroke: var(--accent); fill: none; } .s-b { stroke: var(--accent2); } .s-fg { stroke: var(--fg); } .s-mu { stroke: var(--muted); } .s-bg { stroke: var(--bg); }
.s-track { stroke: color-mix(in srgb, var(--fg) 14%, var(--bg)); }
.t-fg { fill: var(--fg); font-family: var(--font); } .t-mu { fill: var(--muted); font-family: var(--font); } .t-bg { fill: var(--bg); font-family: var(--font); } .t-b { fill: var(--accent2); font-family: var(--font); }

/* motif animations run only while the stage is on screen */
.stage .motif * { animation-play-state: paused; }
.stage.on .motif * { animation-play-state: running; }
.motif .draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.m-profile .draw, .m-spires .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; }
.stage.seen .motif .draw { animation: draw 2.2s var(--ease) forwards; animation-delay: var(--d, 0s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.m-profile .area { opacity: .14; }
.m-profile .runner { animation: run 7s linear infinite; }
@keyframes run { from { offset-distance: 0%; } to { offset-distance: 100%; } }
.m-profile .tick { animation: fade 2.4s ease-in-out infinite alternate; }
@keyframes fade { from { opacity: .3; } to { opacity: 1; } }
.m-graph .node { transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes pulse { 50% { transform: scale(1.7); opacity: .6; } }
.m-spires .star { animation: twinkle 2.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes twinkle { 50% { opacity: .15; } }
.m-spires .city { opacity: .9; transform: translateY(40%); }
.stage.seen .m-spires .city { animation: up 1.6s var(--ease) forwards; }
@keyframes up { to { transform: none; } }
.m-spires .moon { animation: glow 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes glow { 50% { transform: scale(1.08); } }
.m-geo .ci { transform-box: fill-box; transform-origin: center; animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.86) translateX(-10px); } }
.m-geo .tri { transform-box: fill-box; transform-origin: 50% 70%; animation: tilt 6s ease-in-out infinite; mix-blend-mode: multiply; }
@keyframes tilt { 50% { transform: rotate(-10deg) translateY(-8px); } }
.m-geo .sq { animation: slide 4s ease-in-out infinite; }
@keyframes slide { 50% { transform: translateX(26px); } }
.m-geo .sq2 { transform-box: fill-box; transform-origin: center; animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.m-geo .geo-t { font-family: Unbounded, sans-serif; font-weight: 800; }
.m-stamps .stamp { animation: flipY 4.8s var(--ease) infinite; animation-delay: var(--d); }
@keyframes flipY { 0%, 30% { transform: rotateY(0); } 40% { transform: rotateY(90deg); } 50%, 100% { transform: rotateY(0); } }
.m-stamps .stamp-hl { opacity: .0; animation: hl 4.8s steps(1) infinite; }
@keyframes hl { 0% { opacity: 0; } 55% { opacity: .9; } 90% { opacity: 0; } }
.m-fold .panel { transform: perspective(600px) rotateY(80deg); opacity: 0; }
.stage.seen .m-fold .panel { animation: unfold 1.1s var(--ease) forwards; animation-delay: var(--d); }
@keyframes unfold { to { transform: none; opacity: 1; } }
.m-fold .pin { transform-box: fill-box; transform-origin: 50% 100%; animation: hop 1.6s var(--ease) infinite; }
@keyframes hop { 50% { transform: translateY(-14px); } }
.m-xp .bar { transform-box: fill-box; transform-origin: left; transform: scaleX(0); }
.stage.seen .m-xp .bar { animation: fill 1.4s var(--ease) forwards; animation-delay: calc(var(--d) + .3s); }
@keyframes fill { to { transform: scaleX(1); } }
.m-xp .ring { stroke-dasharray: 1; stroke-dashoffset: 1; }
.stage.seen .m-xp .ring { animation: ring 1.8s var(--ease) forwards .4s; }
@keyframes ring { to { stroke-dashoffset: .28; } }
.m-xp .xp { animation: xp 2.2s ease-out infinite; }
@keyframes xp { 0% { opacity: 0; transform: translateY(20px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px); } }
.m-stroke .char { font-family: 'Noto Serif TC', serif; font-weight: 900; fill: transparent; stroke-dasharray: 1400; stroke-dashoffset: 1400; }
.stage.seen .m-stroke .char { animation: write 3.4s var(--ease) forwards; }
@keyframes write { 70% { stroke-dashoffset: 0; fill: transparent; } 100% { stroke-dashoffset: 0; fill: var(--accent); } }
.m-stroke .bub, .m-doodle .tag { animation: bob 2.6s ease-in-out infinite; animation-delay: var(--d); }
@keyframes bob { 50% { transform: translateY(-12px); } }
.m-doodle .ray { stroke: var(--accent); }
.m-doodle .dot { animation: fade 1s ease-in-out infinite alternate; }
.m-leaf .cross { transform-box: fill-box; transform-origin: center; animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 15% { transform: scale(1.08); } 30% { transform: scale(1); } 45% { transform: scale(1.05); } }
.m-leaf .ripple { transform-box: fill-box; transform-origin: center; animation: ripple 2.4s ease-out infinite; animation-delay: var(--d, 0s); }
@keyframes ripple { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.m-leaf .sway { animation: sway 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes sway { 50% { transform: rotate(6deg); } }
.m-sprout .sprout { animation: sprout 1.8s ease-in-out infinite; animation-delay: var(--d); }
@keyframes sprout { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-10px) rotate(-4deg); } 50% { transform: translateY(0) rotate(0); } 75% { transform: translateY(-4px) rotate(3deg); } }
.m-fish .swim { animation: swim 7s linear infinite; animation-delay: calc(var(--d) * -1); }
@keyframes swim { from { transform: translate(460px, var(--y)); } to { transform: translate(-80px, var(--y)); } }
.m-fish .bubble { animation: bubble 3.4s ease-in infinite; animation-delay: var(--d); opacity: 0; }
@keyframes bubble { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translateY(-240px); } }
.m-fish .wave { animation: wave 3s linear infinite; }
@keyframes wave { to { transform: translateX(-100px); } }

/* ---------- Works: card wall ---------- */
.works { padding: 120px clamp(16px, 5vw, 72px) 100px; }
.works-head { max-width: 1180px; margin: 0 auto 40px; }
.works h2 { margin: 0; font-family: Unbounded, 'Noto Sans TC', sans-serif; font-weight: 800; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.15; }
.works-head > p { margin: 10px 0 0; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.filters button {
  font: inherit; font-size: .9rem; cursor: pointer; color: var(--fg); background: transparent;
  border: 1.5px solid var(--shell-line); border-radius: 999px; padding: 6px 16px; transition: background .25s, color .25s, border-color .25s, transform .2s;
}
.filters button span { color: var(--muted); margin-left: 4px; font-size: .8rem; }
.filters button:hover { border-color: var(--fg); }
.filters button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.filters button.on span { color: inherit; opacity: .7; }

.deck { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 1080px) { .deck { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .deck { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
@media (max-width: 480px) { .deck { grid-template-columns: minmax(0, 1fr); } }

.card { perspective: 1400px; --tx: 0deg; --ty: 0deg; --mx: 50%; --my: 50%; }
.card.hide { display: none; }
.card-inner {
  position: relative; display: grid; transform-style: preserve-3d; height: 100%;
  transition: transform .8s var(--ease); transform: rotateX(var(--tx)) rotateY(var(--ty));
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; overflow: hidden; }
.card-front { background: var(--shell-card); color: var(--shell-fg); border: 1px solid var(--shell-line); display: flex; flex-direction: column; position: relative; }
.card-front::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255,255,255,.35), transparent 45%);
  mix-blend-mode: soft-light;
}
.card:hover .card-front::after { opacity: 1; }
.card-shot { aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--shell-line); }
.card-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .8s var(--ease); }
.card:hover .card-shot img { transform: scale(1.06); }
.card-body { padding: 16px 18px 16px; display: flex; flex-direction: column; flex: 1; }
.card-group { margin: 0; font-size: .76rem; letter-spacing: .08em; color: var(--shell-muted); }
.card h3 { margin: 4px 0 0; font-size: 1.12rem; line-height: 1.35; }
.card h3 a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; transition: background-size .35s var(--ease); }
.card h3 a:hover { background-size: 100% 1.5px; }
.card-tag { margin: 8px 0 0; font-size: .86rem; color: var(--shell-muted); line-height: 1.65; flex: 1; }
.card-foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-dots { display: flex; }
.card-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--shell-card); margin-right: -5px; box-shadow: 0 0 0 1px var(--shell-line); }
.flip-btn { font: inherit; font-size: .8rem; cursor: pointer; background: transparent; color: inherit; border: 1.5px solid currentColor; border-radius: 999px; padding: 4px 12px; transition: transform .2s; }
.flip-btn:hover { transform: rotate(-3deg) scale(1.05); }

.card-back {
  transform: rotateY(180deg); background: var(--bg); color: var(--fg); padding: 20px; display: flex; flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--fg) 18%, transparent);
}
.dna-title { margin: 0; font-size: .74rem; letter-spacing: .14em; color: var(--muted); }
.dna-name { margin: 2px 0 12px; font-family: var(--font); font-weight: 900; font-size: 1.3rem; line-height: 1.25; }
.dna-pal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; font-size: .74rem; font-family: ui-monospace, Consolas, monospace; }
.dna-pal span { display: flex; align-items: center; gap: 6px; }
.dna-pal i { width: 16px; height: 16px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--fg) 30%, transparent); flex: none; }
.card-back dl { margin: 14px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; font-size: .82rem; line-height: 1.5; flex: 1; align-content: start; }
.card-back dt { color: var(--muted); }
.card-back dd { margin: 0; }
.dna-act { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 14px; }
.dna-act a { text-decoration: none; font-weight: 700; font-size: .85rem; background: var(--accent); color: var(--onaccent, var(--bg)); padding: 6px 14px; border-radius: var(--radius); }

/* deal-in: cards fly from a stacked deck */
.js .deck .card { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 120px)) rotate(var(--dr, 0deg)) scale(.85); }
.js .deck.dealt .card { opacity: 1; transform: none; transition: opacity .7s var(--ease), transform 1s var(--ease); transition-delay: calc(var(--i) * 70ms); }
.js .deck.dealt.settled .card { transition: none; }

/* ---------- Footer ---------- */
.foot { padding: 60px 16px 70px; text-align: center; border-top: 1px solid var(--shell-line); color: var(--muted); }
.foot p { margin: 0; }
.foot-small { margin-top: 8px !important; font-size: .85rem; }

/* ---------- Reduced motion: keep the colour changes, drop the movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; transition-delay: 0s !important; }
  .hero-ring span { animation: none !important; }
  .js .stage .rv, .js .stage .browser, .js .stage .motif, .js .deck .card { transform: none !important; }
  .card-inner { transform: none; }
  .card.flipped .card-inner { transform: rotateY(180deg); }
}
