/* Derrick Yen — editorial GTM portfolio */
:root {
  --bg: #ece8f2;
  --bg-warm: #ddd5ea;
  --fg: #171225;
  --muted: #6b6577;
  --accent: #5b3fef;
  --accent-2: #3b82f6;
  --card: #1a1730;
  --card-fg: #ece8f2;
  --card-warm: #d8cfe8;
  --card-warm-fg: #1e1832;
  --border: rgba(23, 18, 37, 0.14);
  --serif: 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --max: 1240px;
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  padding: clamp(16px, 3vw, 32px);
  min-height: 100vh;
  overflow-x: hidden;
}

/* GRAIN OVERLAY */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.12;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* CUSTOM CURSOR */
#cursor {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease, background 0.15s ease, width 0.15s ease, height 0.15s ease;
  mix-blend-mode: difference;
  opacity: 0;
}
body.cursor-ready #cursor { opacity: 1; }
body.cursor-hover #cursor {
  width: 36px;
  height: 36px;
  background: var(--accent);
}
@media (hover: none), (pointer: coarse) { #cursor { display: none; } }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 20px;
  top: 20px;
  padding: 8px 12px;
  background: var(--fg);
  color: var(--bg);
  z-index: 100;
}

main { max-width: var(--max); margin: 0 auto; position: relative; z-index: 2; }

/* ─────────── HERO ─────────── */
.hero {
  padding: 0 0 clamp(30px, 5vw, 60px);
  position: relative;
}

.hero-top {
  margin-bottom: clamp(20px, 3vw, 40px);
}

.hero .intro {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.015em;
  max-width: 620px;
}

.rotator {
  display: inline-block;
  position: relative;
  min-width: 320px;
}
.rot-word {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  color: var(--accent);
  font-style: italic;
  font-weight: 500;
  white-space: nowrap;
}
.rot-word[data-active] {
  opacity: 1;
  transform: translateY(0);
  position: relative;
}
@media (max-width: 640px) {
  .rotator { min-width: 0; display: inline; }
  .rot-word { white-space: normal; }
}

.hero .education {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
  text-align: right;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.05); }
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(4.5rem, 20vw, 17rem);
  line-height: 0.85;
  letter-spacing: -0.05em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}
.name-first {
  font-weight: 500;
  font-style: normal;
}
.name-last {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

/* TICKER */
.ticker {
  margin-top: clamp(30px, 5vw, 50px);
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}
.ticker-track {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: scroll 60s linear infinite;
  width: max-content;
}
.tick {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tick b {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--fg);
  font-style: italic;
  margin-right: 4px;
}
.tick-dot {
  color: var(--accent);
  font-size: 0.7rem;
  align-self: center;
}
@keyframes scroll {
  to { transform: translateX(-50%); }
}

/* ─────────── SECTION LABELS ─────────── */
.section-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--muted);
}

/* ─────────── WORK: a deck of trading cards ─────────── */
#work { margin: clamp(50px, 8vw, 100px) 0; }

.work-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(32px, 6vw, 90px);
  align-items: center;
}

.deck {
  --wc-w: clamp(320px, 27vw, 360px);
  position: relative;
  width: calc(var(--wc-w) + 40px);
  height: calc(var(--wc-w) * 88 / 63 + 44px);
  outline: none;
  touch-action: pan-y;
}
.deck:focus-visible .wcard.is-top .wc-face { box-shadow: 0 0 0 3px var(--accent); }

.wcard {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--wc-w);
  aspect-ratio: 63 / 88;
  padding: calc(var(--wc-w) * 0.034);
  border-radius: calc(var(--wc-w) * 0.045);
  background: linear-gradient(135deg, #dcdbe2 0%, #a9a6b3 24%, #f2f1f5 46%, #9c98a6 72%, #dddce3 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.8),
    0 18px 40px -18px rgba(23, 18, 37, 0.45),
    0 4px 10px rgba(23, 18, 37, 0.12);
  font-size: calc(var(--wc-w) / 21);
  color: var(--fg);
  transform-origin: 50% 60%;
  transition: transform 0.42s cubic-bezier(.2,.8,.2,1), filter 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  will-change: transform;
}
.wcard:not(.is-top) { filter: brightness(0.94) saturate(0.9); cursor: default; }
.wcard.dragging { transition: none; cursor: grabbing; }
.wcard.flying { transition: transform 0.28s cubic-bezier(.5,0,.9,.5); }
.wcard.no-anim { transition: none; }

/* full art: the scene fills the card and the text sits over it */
.wc-face {
  --ink: #f7f3ff;
  --ink-soft: rgba(247, 243, 255, 0.78);
  --scrim: 22, 13, 52;
  position: relative;
  height: 100%;
  border-radius: calc(var(--wc-w) * 0.025);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(43, 37, 64, 0.35);
  isolation: isolate;
}

.wc-scene { position: absolute; inset: 0; z-index: -2; }
.wc-scene svg { display: block; width: 100%; height: 100%; }
.wc-digiworld .wc-scene {
  background:
    radial-gradient(circle at 20% 70%, rgba(255,255,255,0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle at 76% 82%, rgba(255,255,255,0.7) 0 1px, transparent 1.6px),
    radial-gradient(circle at 60% 64%, rgba(255,255,255,0.6) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 34% 90%, rgba(255,255,255,0.6) 0 0.8px, transparent 1.4px),
    radial-gradient(120% 70% at 50% 100%, #3a1f86 0%, #1c1146 55%, #140c2e 100%);
}
.wc-photo {
  position: absolute;
  left: 0;
  top: 7%;
  width: 100%;
  height: 58%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 72%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 14%, #000 72%, transparent 100%);
  -webkit-user-drag: none;
}

/* the company mark is the "creature", floating in the sky */
.wc-subject {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 18%;
  width: 38%;
  transform: translateX(-50%);
  animation: wcfloat 5s ease-in-out infinite;
}
.wc-subject img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 0.6em rgba(203, 176, 255, 0.9)) drop-shadow(0 0 1.6em rgba(157, 110, 255, 0.6));
  -webkit-user-drag: none;
}
.wc-subject img.wide { width: 140%; margin-left: -20%; }
.wc-subject img.glow { filter: brightness(0) invert(1) drop-shadow(0 0 0.5em rgba(203, 176, 255, 0.95)) drop-shadow(0 0 1.4em rgba(157, 110, 255, 0.7)); }
.wc-wonghaus .wc-subject { top: 20%; width: 32%; }
@keyframes wcfloat { 50% { transform: translateX(-50%) translateY(-4%); } }

.wc-head {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.55em 0.65em 0;
}
.wc-stage {
  flex: none;
  font-family: var(--sans);
  font-size: 0.5em;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.04em;
  padding: 0.2em 0.6em;
  border-radius: 0.35em 1em 1em 0.35em;
  background: linear-gradient(180deg, #f7f6f9, #b9b6c3);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
  color: #2b2540;
  white-space: nowrap;
}
.wc-head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32em;
  letter-spacing: -0.015em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
.wc-move-title .metric-num {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  font-family: var(--serif);
  font-weight: 600;
  flex: none;
  font-size: 1.2em;
  line-height: 1;
  white-space: nowrap;
}
.wc-move-title .metric-prefix, .wc-move-title .metric-suffix { font-size: 0.66em; opacity: 0.85; }
.metric-value { font-variant-numeric: tabular-nums; }
.wc-energy, .wc-cost i {
  flex: none;
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 18%, transparent 19%),
    radial-gradient(circle at 35% 30%, #b99bff, #6c2fd8 60%, #3c1590);
  box-shadow: 0 0 0 0.1em #fff, 0 0 0 0.16em rgba(43,37,64,0.35);
}

/* "Evolves from" line with the previous company in a silver medallion */
.wc-evolves {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin: 0.2em 0.65em 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.56em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.wc-evolves .proj-year { font-style: normal; font-family: var(--mono); font-size: 0.95em; }
.wc-prev {
  flex: none;
  width: 3.4em;
  height: 3.4em;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #ffffff, #dcd8e6 70%, #a9a5b6);
  box-shadow: 0 0 0 0.22em #c9c6d2, 0 0 0 0.3em rgba(43,37,64,0.35), 0 0.3em 0.6em rgba(43,37,64,0.25);
}
.wc-prev img { width: 64%; height: auto; -webkit-user-drag: none; }
.wc-prev img.wide { width: 84%; }
.wc-prev img.photo { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; transform: scale(1.9); }

/* text panel over the lower art, frosted so the scene shows through */
.wc-body {
  margin-top: auto;
  padding: 1.8em 0 0;
  background: linear-gradient(180deg, rgba(var(--scrim), 0) 0%, rgba(var(--scrim), 0.55) 22%, rgba(var(--scrim), 0.8) 100%);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.wc-move { padding: 0 0.8em; }
.wc-move-title { margin: 0; display: flex; align-items: center; gap: 0.4em; }
.wc-cost { display: inline-flex; gap: 0.12em; }
.wc-cost i { width: 0.95em; height: 0.95em; }
.wc-move-title .metric-label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.92em;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wc-blurb {
  margin: 0.35em 0 0;
  font-size: 0.8em;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
.wcard .proj-desc { display: none; } /* full text lives on for the battle's FIGHT pages */

.wc-stats {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  margin: 0.45em 0.8em 0;
  padding-top: 0.35em;
  border-top: 1px solid rgba(var(--scrim), 0.9);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.18);
  font-size: 0.6em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.wc-stats .k { color: var(--ink-soft); }
.wc-stats .proj-role { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* partner chips sit in a silver "rule box" */
.wcard .proj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  list-style: none;
  margin: 0.4em 0.7em 0;
  padding: 0.35em 0.5em;
  border-radius: 0.6em;
  background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(210,206,220,0.8));
  box-shadow: inset 0 0 0 1px rgba(43,37,64,0.28);
}
.wcard .proj-chips li {
  font-family: var(--mono);
  font-size: 0.5em;
  padding: 0.15em 0.55em;
  border-radius: 999px;
  background: rgba(91, 63, 239, 0.12);
  color: #2b2540;
}

.wc-foot {
  /* reset the page <footer> styles this element would otherwise inherit */
  max-width: none;
  padding: 0;
  z-index: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em;
  margin: 0.35em 0.8em 0.55em;
  font-family: var(--mono);
  font-size: 0.48em;
  color: var(--ink-soft);
  white-space: nowrap;
}
.wc-link { color: #cdb8ff; text-decoration: none; font-weight: 500; }
.wc-link:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) { .wc-subject { animation: none; } }

/* foil + glare on the top card, following the pointer (--lx/--ly from app.js) */
.wc-holo, .wc-glare { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.wc-holo {
  background: repeating-linear-gradient(110deg,
    rgba(255, 0, 132, 0.4) 0%, rgba(252, 164, 0, 0.4) 6%, rgba(255, 255, 0, 0.35) 12%,
    rgba(0, 255, 138, 0.35) 18%, rgba(0, 207, 255, 0.4) 24%, rgba(204, 76, 250, 0.4) 30%, rgba(255, 0, 132, 0.4) 36%);
  background-size: 300% 300%;
  background-position: var(--lx, 50%) var(--ly, 50%);
  mix-blend-mode: color-dodge;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.wc-glare {
  background: radial-gradient(circle at var(--lx, 50%) var(--ly, 30%), rgba(255,255,255,0.5), transparent 45%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.wcard.is-top:hover .wc-holo { opacity: 0.18; }
.wcard.is-top:hover .wc-glare { opacity: 0.6; }

/* side panel: index + controls */
.deck-index {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  counter-reset: card;
}
.deck-index li { border-top: 1px solid var(--border); }
.deck-index li:last-child { border-bottom: 1px solid var(--border); }
.deck-index button {
  width: 100%;
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 16px 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--fg);
  font: inherit;
  transition: color 0.2s, padding 0.25s;
}
.deck-index .n { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.deck-index .t { font-family: var(--serif); font-size: clamp(1.3rem, 2.2vw, 1.9rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.deck-index .y { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.deck-index button:hover { padding-left: 12px; }
.deck-index button[aria-current="true"] { color: var(--accent); }
.deck-index button[aria-current="true"] .t { font-style: italic; }

.deck-controls { display: flex; align-items: center; gap: 16px; }
.deck-controls button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.deck-controls button:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }
#deckCount { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); min-width: 3.5em; text-align: center; }
.deck-hint { margin: 14px 0 0; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

@media (max-width: 780px) {
  .work-layout { grid-template-columns: 1fr; justify-items: center; gap: 28px; }
  .deck { --wc-w: min(84vw, 340px); }
  .deck-side { width: 100%; }
  .deck-index { display: none; }
  .deck-controls { justify-content: center; }
  .deck-hint { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .wcard, .wcard.flying { transition: none; }
}

/* ─────────── MANIFESTO ─────────── */
.manifesto {
  margin: clamp(60px, 10vw, 120px) 0;
  padding: clamp(40px, 6vw, 80px) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.tenets {
  list-style: none;
  padding: 0;
  margin: 30px 0 0;
  display: grid;
  gap: 4px;
}
.tenets li {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: baseline;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  transition: transform 0.3s, color 0.3s;
}
.tenets li:first-child { border-top: none; }
.tenets li:hover { transform: translateX(8px); color: var(--accent); }
.tenets .num {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  align-self: start;
  padding-top: 8px;
}
.tenets .text { font-style: italic; font-weight: 400; }

/* ─────────── FOOTER ─────────── */
footer {
  max-width: var(--max);
  margin: clamp(40px, 6vw, 80px) auto 0;
  padding-top: clamp(30px, 5vw, 60px);
  position: relative;
  z-index: 2;
}

footer h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 clamp(30px, 5vw, 60px);
}
footer h2 em { font-style: italic; color: var(--accent); font-weight: 400; }

footer p {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.6vw, 1.4rem);
  line-height: 1.6;
  margin: 0;
  max-width: 780px;
  color: var(--fg);
}
.contact-line { display: inline; }
.social { text-decoration: none; }
.social-pill {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.85em;
  font-weight: 500;
  vertical-align: baseline;
  transition: transform 0.2s ease;
  color: #fff;
}
.social:hover .social-pill { transform: translateY(-2px) rotate(-2deg); }
.linkedin { background: #0a66c2; }
.twitter { background: #000; }
.github { background: #24292e; }
.email { background: var(--accent); }

/* Marquee */
.marquee {
  margin: clamp(60px, 8vw, 100px) 0 30px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 6%, black 94%, transparent);
}
.marquee-track {
  display: flex;
  gap: 30px;
  white-space: nowrap;
  animation: scroll 45s linear infinite;
  width: max-content;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  color: var(--fg);
  letter-spacing: -0.01em;
}
.mq-dot { color: var(--accent); font-style: normal; }

.colophon {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono) !important;
  font-size: 0.75rem !important;
  color: var(--muted) !important;
  padding: 20px 0;
  max-width: none !important;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─────────── DIALOG ─────────── */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  max-width: 680px;
  width: calc(100% - 32px);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(20, 15, 10, 0.6); backdrop-filter: blur(6px); }

dialog .panel { padding: clamp(28px, 4vw, 44px); }

dialog header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
dialog h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  margin: 0;
  letter-spacing: -0.02em;
  font-style: italic;
}
dialog .close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg);
  padding: 6px;
  border-radius: 8px;
}
dialog .close:hover { background: rgba(0,0,0,0.06); color: var(--accent); }

dialog .bio p {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 0 0 14px;
}
dialog .bio p b { font-weight: 500; color: var(--accent); }
dialog .bio .origin {
  padding: 14px 18px;
  background: rgba(91, 63, 239, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  margin-top: 20px;
  font-style: italic;
}

dialog h3 {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 32px 0 14px;
  font-weight: 500;
}

.stack-line {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg);
  line-height: 1.7;
  margin: 0;
}

.experience {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2px;
}
.experience li {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}
.experience .years {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.experience .company { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; }
.experience .role { color: var(--muted); text-align: right; font-size: 0.85rem; }

@media (max-width: 720px) {
  .hero-top { grid-template-columns: 1fr; }
  .hero .education { text-align: left; }
  footer p { font-size: 1.05rem; }
  .experience li { grid-template-columns: 90px 1fr; }
  .experience .role { grid-column: 1 / -1; text-align: left; padding-left: 106px; }
  .colophon { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track, .marquee-track { animation: none; }
  .status-dot { animation: none; }
  * { transition-duration: 0.01s !important; }
}

/* ─────────── STAGE: Master Ball on the name ─────────── */
/* Full-bleed stage; app.js places the ball, its shadow, and the name in
   stage-local CSS pixels and sets the stage height. */
.stage {
  --ball: clamp(150px, min(34svh, 28vw), 300px);
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: max(560px, calc(100svh - clamp(16px, 3vw, 32px)));
  overflow-x: clip;
  overflow-y: visible;
}

.stage .intro {
  position: absolute;
  top: clamp(12px, 11svh, 130px);
  left: 8vw;
  z-index: 2;
}
.stage .now {
  position: absolute;
  top: clamp(12px, 11svh, 130px);
  right: 8vw;
  margin: 0;
  text-align: right;
  font-family: var(--serif);
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.35;
  color: var(--fg);
  z-index: 2;
}

.name-behind {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  /* full-bleed like Sam's: the name fills the width and runs off both edges */
  font-size: min(24.5vw, 46svh);
  line-height: 0.78;
  letter-spacing: -0.055em;
  display: flex;
  align-items: baseline;
  gap: 0.22em;
  padding: 0;
  pointer-events: none;
  z-index: 1;
  color: var(--fg);
  white-space: nowrap;
}
.name-behind .name-first { font-weight: 500; font-style: normal; }
.name-behind .name-last { font-style: italic; font-weight: 400; color: var(--accent); }

/* ─────────── MASTER BALL ─────────── */
.mball {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--ball);
  height: var(--ball);
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: grab;
  z-index: 3;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 100%;
  will-change: transform;
  visibility: hidden; /* shown once physics has placed it */
}
.mball.ready { visibility: visible; }
.mball:active { cursor: grabbing; }
.mball:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }
.mb-spin { display: block; width: 100%; height: 100%; will-change: transform; }
.mb-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 18px 22px rgba(23, 18, 37, 0.18));
}
.mball.shake .mb-svg { animation: mbshake 0.34s linear; }
@keyframes mbshake {
  20% { transform: translateX(-3%) rotate(-4deg); }
  40% { transform: translateX(3%) rotate(4deg); }
  60% { transform: translateX(-2%) rotate(-3deg); }
  80% { transform: translateX(2%) rotate(2deg); }
}

/* opening: the top shell lifts and tips back on its rear hinge, showing its
   underside, while the lower half shows a glowing opening and a light beam */
.mb-top {
  transform-box: view-box;
  transform-origin: 100px 100px;
  transition: transform 0.32s cubic-bezier(.3,1.45,.5,1);
}
.mball.open .mb-top { transform: translate(0, -36px) rotate(-7deg); }
.mb-open-only { opacity: 0; transition: opacity 0.15s ease; }
.mball.open .mb-open-only { opacity: 1; }

/* the centre button glows on hover and blinks after each capture wiggle */
.mb-btn { transition: fill 0.2s; }
.mball:hover .mb-btn, .mball:focus-visible .mb-btn { fill: #ff4d5e; filter: drop-shadow(0 0 6px #ff4d5e); }
.mball.blink .mb-btn { animation: mbblink 0.9s ease-out; }
@keyframes mbblink {
  0%, 100% { fill: #fff; }
  30% { fill: #ff5a7a; }
  60% { fill: #fff; }
}

.mb-shadow {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--ball) * 0.78);
  height: calc(var(--ball) * 0.12);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(23, 18, 37, 0.32), rgba(23, 18, 37, 0) 70%);
  z-index: 2;
  pointer-events: none;
  will-change: transform, opacity;
}

.mb-hint {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  z-index: 2;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.mb-hint.show { opacity: 0.75; }

.mb-light {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 35%, rgba(233, 216, 255, 0.9) 55%, rgba(185, 140, 255, 0) 72%);
  z-index: 4;
  pointer-events: none;
  opacity: 0;
}
.mb-light.burst { animation: mblight 0.6s ease-out forwards; }
@keyframes mblight {
  0% { opacity: 1; transform: scale(0.2); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: scale(60); }
}

/* traits in the About dialog */
.traits { margin: 0; display: grid; gap: 4px 0; }
.traits dt { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; margin-top: 10px; }
.traits dt span {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 2px;
}
.traits dd { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--fg); opacity: 0.85; }

@media (max-width: 720px) {
  .stage { --ball: clamp(140px, 40vw, 200px); height: clamp(560px, calc(100svh - 20px), 820px); }
  .stage .now { display: none; }
  .name-behind { font-size: 25vw; }
}

/* ─────────── BATTLE (opens from the Master Ball) ─────────── */
.battle {
  --ink: #2b2540;
  --paper: #fbf8ef;
  --px: 'Pixelify Sans', var(--mono);
  --bw: min(92vw, 900px, calc((86svh - 170px) * 2.2));
  /* sits in the hero where the name and ball were; app.js sets top and the
     transform-origin (the ball's centre) so it grows out of / back into it */
  position: absolute;
  left: calc(50% - var(--bw) / 2);
  top: 0;
  z-index: 5;
  width: max-content;
  margin: 0;
  padding: 0;
  border-radius: 18px;
  color: var(--ink);
  box-shadow: 0 40px 100px -20px rgba(13, 11, 20, 0.45), 0 12px 30px rgba(13, 11, 20, 0.22);
}
.battle[hidden] { display: none; }
.battle.shown { animation: btgrow 0.5s cubic-bezier(.2,1.1,.35,1); }
@keyframes btgrow { from { transform: scale(0.06); opacity: 0; } }
.battle.leaving {
  transform: scale(0.06);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(.55,0,.8,.35), opacity 0.4s ease-in;
}

/* while battling, the name and the ball step aside */
.stage :is(.name-behind, .mball, .mb-shadow) { transition: opacity 0.35s ease; }
.stage.battling :is(.name-behind, .mball, .mb-shadow, .mb-hint) { opacity: 0 !important; pointer-events: none; }

.bt-screen {
  position: relative;
  width: var(--bw);
  display: flex;
  flex-direction: column;
  font-family: var(--px);
  font-size: calc(var(--bw) * 0.021);
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 0 0 0.35em var(--ink);
}

/* arena */
.bt-arena {
  position: relative;
  flex: none;
  aspect-ratio: 2.2 / 1;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255,255,255,0.7), transparent 60%),
    linear-gradient(180deg, #efe9fb 0%, #e2d8f7 46%, #d4ecc6 46.2%, #b9dea6 100%);
  cursor: pointer;
}
.bt-pad {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #a9d88f 0 55%, #86c46c 56% 100%);
  box-shadow: inset 0 -0.3em 0 rgba(43,37,64,0.18);
}
.foe-pad { right: 7%; top: 38%; width: 34%; height: 13%; }
.me-pad { left: 3%; bottom: 3%; width: 42%; height: 15%; }

.bt-foe {
  position: absolute;
  right: 12%;
  top: 2%;
  width: 20%;
  aspect-ratio: 1;
  transform-origin: 50% 100%;
}
/* 48×48 pixel sprite scaled up crisp; idles with a stepped one-pixel bob */
.bt-foe img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-user-drag: none;
  animation: pxbob 1.1s steps(1, end) infinite;
  filter: brightness(0);
  transition: filter 0.45s steps(3, end);
}
/* enters as a silhouette, then snaps into colour */
.bt-foe.lit img { filter: none; }
@keyframes pxbob { 50% { transform: translateY(2.083%); } }
.bt-me {
  position: absolute;
  left: 10%;
  bottom: 9%;
  width: 27%;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 0.3em;
  background: #fff;
  box-shadow: 0 0 0 0.2em var(--ink), 0 0.6em 0 -0.1em rgba(43,37,64,0.25);
  transform: scale(0);
  transform-origin: 50% 80%;
}
.bt-me img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; -webkit-user-drag: none; }
.bt-me.out { animation: popout 0.5s cubic-bezier(.3,1.6,.5,1) forwards; }
@keyframes popout { from { transform: scale(0); filter: brightness(3); } to { transform: scale(1); filter: none; } }
.bt-me.lunge { transform: scale(1); animation: lunge 0.36s ease-in-out; }
@keyframes lunge { 50% { transform: translate(28%, -22%) scale(1.04); } }

.bt-ball {
  position: absolute;
  left: 18%;
  bottom: 22%;
  width: 7%;
  aspect-ratio: 1;
  opacity: 0;
  pointer-events: none;
}
.bt-ball svg { width: 100%; height: 100%; display: block; }
.bt-ball.throw { animation: throw 0.7s cubic-bezier(.3,.7,.4,1) forwards; }
@keyframes throw {
  0% { opacity: 1; transform: translate(-260%, 220%) rotate(-360deg); }
  60% { opacity: 1; transform: translate(0, -80%) rotate(-40deg); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0); }
}
.bt-ball.open { opacity: 1; animation: ballopen 0.45s ease-out forwards; }
@keyframes ballopen {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 #fff); }
  40% { transform: scale(1.25); filter: drop-shadow(0 0 1.2em #fff) brightness(1.8); }
  100% { transform: scale(0.2); opacity: 0; filter: drop-shadow(0 0 2em #fff); }
}

/* status boxes */
.bt-status {
  position: absolute;
  background: var(--paper);
  border: 0.18em solid var(--ink);
  border-radius: 0.7em 0.7em 0.7em 0.15em;
  box-shadow: 0.25em 0.25em 0 rgba(43,37,64,0.22);
  padding: 0.45em 0.8em 0.55em;
  display: grid;
  gap: 0.25em;
}
.foe-status { left: 5%; top: 8%; width: 40%; }
.me-status { right: 4%; bottom: 8%; width: 44%; border-radius: 0.7em 0.7em 0.15em 0.7em; }
.bt-name { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 1.15em; letter-spacing: 0.02em; }
.bt-name .lv { font-size: 0.8em; font-weight: 600; }
.bt-hp { display: flex; align-items: center; gap: 0.4em; }
.bt-hp b {
  font-size: 0.62em;
  font-weight: 700;
  color: #f5c542;
  background: var(--ink);
  padding: 0.05em 0.35em;
  border-radius: 0.3em;
}
.bt-status .bar {
  flex: 1;
  height: 0.55em;
  border-radius: 999px;
  background: #4a4260;
  border: 0.12em solid var(--ink);
  overflow: hidden;
}
.bt-status .bar i {
  display: block;
  height: 100%;
  width: var(--hp, 100%);
  background: #3fd46b;
  border-radius: inherit;
  transition: width 0.9s cubic-bezier(.3,.6,.3,1), background 0.3s;
}
.bt-status .bar i.mid { background: #f5c542; }
.bt-status .bar i.low { background: #e0403a; }
.bt-hpnum { justify-self: end; font-weight: 600; font-size: 0.95em; letter-spacing: 0.05em; }

/* hit effects */
.bt-foe.hit img { animation: blink 0.5s steps(2, jump-none) 2, pxbob 1.1s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.bt-foe.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake { 20% { transform: translateX(-6%); } 40% { transform: translateX(6%); } 60% { transform: translateX(-4%); } 80% { transform: translateX(3%); } }
.bt-foe.faint { transition: transform 0.6s ease-in, opacity 0.6s ease-in; transform: translateY(40%); opacity: 0; }
.bt-fx { position: absolute; inset: 0; pointer-events: none; }
.bt-fx span {
  position: absolute;
  color: var(--accent);
  font-size: 1.6em;
  text-shadow: 0 0 0.4em #fff;
  animation: burst 0.65s ease-out forwards;
}
@keyframes burst {
  from { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2) rotate(90deg); opacity: 0; }
}

/* end-of-battle catch: thrown ball, QUOTA pulled in as red light, 3 wobbles */
.bt-catch {
  position: absolute;
  left: 0;
  top: 0;
  width: 7%;
  aspect-ratio: 1;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
}
.bt-catch svg { display: block; width: 100%; height: 100%; overflow: visible; transform-origin: 50% 95%; }
.cb-top {
  transform-box: view-box;
  transform-origin: 38px 20px;
  transition: transform 0.18s cubic-bezier(.3,1.5,.5,1);
}
.bt-catch.open .cb-top { transform: translate(0, -6px) rotate(-16deg); }
.cb-glow { opacity: 0; transition: opacity 0.15s; }
.bt-catch.open .cb-glow { opacity: 1; }
.bt-catch.clicked .cb-btn { animation: cbclick 0.6s ease-out; }
@keyframes cbclick { 30% { fill: #ff4d5e; } }
.battle.arena-in .bt-foe.absorb {
  transition: transform 0.5s cubic-bezier(.6,0,.9,.4), opacity 0.5s ease-in;
  transform: translate(var(--ax, 0px), var(--ay, 0px)) scale(0.04);
  opacity: 0.2;
}
.bt-foe.absorb img {
  animation: none;
  transition: none;
  filter: brightness(0) invert(36%) sepia(90%) saturate(4000%) hue-rotate(330deg) brightness(1.05);
}
.battle.arena-in .bt-foe.caught { transition: none; transform: scale(0); opacity: 0; }
.bt-fx span.gold { color: #f5c542; text-shadow: 0 0 0.4em #fff8d6; }

/* HUD */
.bt-hud {
  flex: none;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0.5em;
  padding: 0.55em;
  background: var(--ink);
  min-height: 0;
}
.bt-text, .bt-menu, .bt-moves, .bt-moveinfo {
  background: var(--paper);
  border-radius: 0.6em;
  box-shadow: inset 0 0 0 0.18em var(--accent), inset 0 0 0 0.36em var(--paper), inset 0 0 0 0.45em rgba(43,37,64,0.25);
  min-height: 0;
}
.bt-text {
  position: relative;
  padding: 0.7em 1.1em;
  font-size: 1.12em;
  line-height: 1.45;
  height: calc(3 * 1.45em + 1.4em); /* exactly three lines */
  overflow: hidden;
  cursor: pointer;
}
.bt-text p { margin: 0; }
.bt-text:focus { outline: none; }
.bt-next {
  position: absolute;
  right: 0.9em;
  bottom: 0.5em;
  color: #e0403a;
  font-size: 0.8em;
  opacity: 0;
}
.bt-text.more .bt-next { opacity: 1; animation: nudge 0.7s steps(2, jump-none) infinite; }
@keyframes nudge { 50% { transform: translateY(0.2em); } }

.bt-menu, .bt-moves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: center;
  padding: 0.6em 0.8em;
  gap: 0.2em 0.6em;
}
.bt-menu button, .bt-moves button, .bt-back {
  font: inherit;
  font-weight: 700;
  font-size: 1.12em;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0.3em 0.2em 0.3em 1.1em;
  text-align: left;
  cursor: pointer;
  position: relative;
  border-radius: 0.3em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bt-menu button::before, .bt-moves button::before, .bt-back::before {
  content: "▶";
  position: absolute;
  left: 0.15em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7em;
  opacity: 0;
}
.bt-menu button:is(:hover, :focus-visible)::before,
.bt-moves button:is(:hover, :focus-visible)::before { opacity: 1; }
.bt-menu button:focus-visible, .bt-moves button:focus-visible, .bt-back:focus-visible { outline: none; background: rgba(91,63,239,0.1); }
.bt-moves button.used { color: #8a8398; }
.bt-moveinfo {
  padding: 0.8em 1em;
  display: grid;
  align-content: center;
  gap: 0.35em;
  font-size: 0.95em;
}
.bt-moveinfo b { font-weight: 700; }
.bt-moveinfo .k { color: #8a8398; margin-right: 0.4em; }

/* HUD modes */
.bt-hud[data-mode="text"] .bt-text { grid-column: 1 / -1; }
.bt-hud[data-mode="text"] :is(.bt-menu, .bt-moves, .bt-moveinfo),
.bt-hud[data-mode="panel"] :is(.bt-menu, .bt-moves, .bt-moveinfo),
.bt-hud[data-mode="command"] :is(.bt-moves, .bt-moveinfo),
.bt-hud[data-mode="fight"] :is(.bt-text, .bt-menu) { display: none; }
.bt-hud[data-mode="panel"] .bt-text { grid-column: 1 / -1; }

/* bag + about panels */
.bt-panel {
  position: absolute;
  inset: 5% 4%;
  z-index: 5;
  background: var(--paper);
  border: 0.2em solid var(--ink);
  border-radius: 0.8em;
  box-shadow: 0.35em 0.35em 0 rgba(43,37,64,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: default;
  animation: panelin 0.25s ease-out;
}
@keyframes panelin { from { transform: translateY(4%); opacity: 0; } }
.bt-panel[hidden] { display: none; }
.bt-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em 0.9em;
  background: var(--accent);
  color: #fff;
}
.bt-panel h3 { margin: 0; font-family: var(--px); font-size: 1.2em; letter-spacing: 0.08em; color: #fff; text-transform: none; }
.bt-back { color: #fff; font-size: 0.95em; }
.bt-back::before { opacity: 1; content: ""; }
.bt-items {
  list-style: none;
  margin: 0;
  padding: 0.9em;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5em, 1fr));
  gap: 0.5em;
  overflow: auto;
}
.bt-items li {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 0.6em;
  border-radius: 0.5em;
  background: #fff;
  box-shadow: inset 0 0 0 0.12em rgba(43,37,64,0.18);
  font-weight: 600;
  animation: itemin 0.3s ease-out backwards;
}
.bt-items li i {
  flex: none;
  width: 1.8em;
  height: 1.8em;
  display: grid;
  place-items: center;
  border-radius: 0.35em;
  background: var(--ink);
  color: #f5c542;
  font-style: normal;
  font-weight: 700;
}
@keyframes itemin { from { transform: translateY(0.6em); opacity: 0; } }
.bt-about {
  padding: 0.9em 1.2em 1.2em;
  overflow: auto;
  font-family: var(--serif);
  font-size: 0.9em;
  line-height: 1.55;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
.bt-about p { margin: 0 0 0.8em; }
.bt-about b { color: var(--accent); font-weight: 500; }
.bt-about .origin { font-style: italic; padding-left: 0.8em; border-left: 3px solid var(--accent); }
.bt-about h4 { font-family: var(--px); font-size: 0.95em; letter-spacing: 0.1em; margin: 1.1em 0 0.4em; color: var(--muted); font-weight: 600; }
.bt-about ol { list-style: none; margin: 0; padding: 0; }
.bt-about li { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 0.8em; padding: 0.45em 0; border-top: 1px solid var(--border); font-family: var(--sans); font-size: 0.92em; }
.bt-about .years { font-family: var(--mono); color: var(--muted); font-size: 0.85em; }
.bt-about .role { color: var(--muted); text-align: right; }
.bt-about dl { margin: 0; }
.bt-about dt { font-family: var(--sans); font-weight: 600; margin-top: 0.5em; }
.bt-about dt span { font-family: var(--px); font-size: 0.8em; color: #fff; background: var(--accent); padding: 0.05em 0.5em; border-radius: 999px; margin-right: 0.4em; }
.bt-about dd { margin: 0.1em 0 0; }

/* entrance: sides slide in once the wipe has opened */
.foe-status, .foe-pad, .bt-foe { transform: translateX(-140%); transition: transform 0.7s cubic-bezier(.2,.7,.2,1); }
.me-status, .me-pad { transform: translateX(140%); transition: transform 0.7s cubic-bezier(.2,.7,.2,1); }
.battle.arena-in :is(.foe-status, .foe-pad, .bt-foe, .me-status, .me-pad) { transform: none; }
.battle.arena-in .bt-foe.faint { transform: translateY(40%); }

/* the encounter wipe: one soft flash, then shutters close and open */
.bt-wipe {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
}
.battle.enter .bt-wipe { animation: encounter 1.25s ease-in-out forwards; }
@keyframes encounter {
  0% { opacity: 0; background: #fff; clip-path: inset(0); }
  14% { opacity: 0.75; background: #fff; clip-path: inset(0); }
  28% { opacity: 0; background: #fff; clip-path: inset(50% 0 50% 0); }
  29% { opacity: 1; background: #0d0b14; clip-path: inset(50% 0 50% 0); }
  55% { opacity: 1; background: #0d0b14; clip-path: inset(0); }
  68% { opacity: 1; background: #0d0b14; clip-path: inset(0); }
  100% { opacity: 1; background: #0d0b14; clip-path: inset(0 50% 0 50%); }
}

.bt-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 11;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--paper);
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(13, 11, 20, 0.35);
}
.bt-close:hover { background: var(--accent); }

/* phones: stack the arena over a taller HUD */
@media (max-width: 720px), (max-aspect-ratio: 1/1) {
  .battle { --bw: min(94vw, calc((86svh - 190px) / 0.92)); }
  .bt-screen { font-size: clamp(12px, 3.4vw, 17px); }
  .bt-arena { aspect-ratio: 1 / 0.92; }
  .bt-hud { grid-template-columns: 1fr; }
  .bt-hud[data-mode="command"] .bt-menu, .bt-hud[data-mode="fight"] .bt-moves { grid-row: 2; }
  .bt-hud[data-mode="fight"] .bt-moveinfo { grid-row: 1; }
  .bt-moves { grid-template-columns: 1fr; }
  .foe-status { width: 52%; }
  .me-status { width: 54%; }
  .bt-foe { width: 30%; right: 8%; top: 14%; }
  .bt-me { width: 30%; left: 7%; }
  .foe-pad { width: 44%; }
  .me-pad { width: 50%; }
  .bt-about li { grid-template-columns: 1fr; gap: 0.1em; }
  .bt-about .role { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .battle.enter .bt-wipe { animation: none; }
  .bt-foe img { animation: none; transition: none; }
}
