/* ============ Design tokens ============ */
:root {
  --bg: #fdfdfc;
  --bg-alt: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2230;
  --text-soft: #4b5565;
  --muted: #8b94a3;
  --accent: #b91c1c;          /* UW-Madison cardinal */
  --accent-soft: rgba(185, 28, 28, 0.08);
  --glow: rgba(185, 28, 28, 0.13);
  --accent-2: #1d4ed8;
  --border: #e5e8ee;
  --shadow: 0 2px 12px rgba(28, 34, 48, 0.06);
  --shadow-hover: 0 10px 30px rgba(28, 34, 48, 0.12);
  --nav-bg: rgba(253, 253, 252, 0.85);
  --radius: 14px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #0f1420;
  --bg-alt: #131a29;
  --surface: #1a2233;
  --text: #e8ecf4;
  --text-soft: #b3bdce;
  --muted: #7c8699;
  --accent: #f87171;
  --accent-soft: rgba(248, 113, 113, 0.1);
  --glow: rgba(248, 113, 113, 0.17);
  --accent-2: #93b4f8;
  --border: #2a3447;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.45);
  --nav-bg: rgba(15, 20, 32, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1060px; margin: 0 auto; padding: 0 24px; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent); color: #fff; }

/* ============ Progress bar ============ */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 1001; transition: width 0.1s linear;
}

/* ============ Nav ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.nav.scrolled { border-bottom-color: var(--border); box-shadow: var(--shadow); }
.nav-inner {
  max-width: 1060px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-brand {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.25rem;
  color: var(--text); letter-spacing: -0.01em;
}
.nav-brand:hover { text-decoration: none; color: var(--accent); }
.nav-links { display: flex; gap: 4px; position: relative; }
/* sliding pill behind the hovered/active link; positioned from main.js */
.nav-pill {
  position: absolute; top: 0; height: 100%; border-radius: 8px;
  background: var(--accent-soft); opacity: 0; pointer-events: none;
  transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s;
}
.nav-link {
  color: var(--text-soft); font-size: 0.92rem; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; position: relative; z-index: 1;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--accent); text-decoration: none; }
.nav-link.active { color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; color: var(--text-soft);
  display: grid; place-items: center;
  transition: border-color 0.2s, color 0.2s, transform 0.3s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); transform: rotate(15deg); }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
.icon-sun { display: none; }
.icon-moon { display: block; }

.nav-burger { display: none; background: none; border: none; cursor: pointer; padding: 8px; flex-direction: column; gap: 5px; }
.nav-burger span { width: 22px; height: 2px; background: var(--text); transition: 0.3s; display: block; }
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Buttons ============ */
.btn {
  display: inline-block; padding: 11px 24px; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer; border: none;
  font-family: var(--font-sans);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s, color 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(185, 28, 28, 0.3); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(185, 28, 28, 0.4); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: none; color: var(--accent-2); font-weight: 600;
  display: block; margin: 18px auto 0;
}
.btn-small { padding: 7px 16px; font-size: 0.85rem; }
.btn-large { padding: 14px 32px; font-size: 1.05rem; }

/* ============ Hero ============ */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden; padding: 120px 0 60px;
}
#tokenCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0.95;
}
.hero-canvas-note {
  position: absolute; bottom: 22px; right: 24px;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted);
  max-width: 46ch; text-align: right; opacity: 0.75; z-index: 1;
}

.hero-inner {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center;
  position: relative; z-index: 1;
}
.hero-text { position: relative; z-index: 1; }
.hero-kicker {
  color: var(--accent); font-size: 0.82rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 14px;
  display: grid; gap: 2px;
}
.hero-kicker a { color: inherit; }
.hero-name {
  font-family: var(--font-serif); font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 16px;
}
/* letters are wrapped in .ch spans by main.js and cascade in on load */
.hero-name .ch {
  display: inline-block;
  animation: letter-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes letter-rise {
  from { opacity: 0; transform: translateY(0.55em); filter: blur(6px); }
}
.hero-name-vn {
  font-size: 0.45em; font-weight: 500; color: var(--muted); white-space: nowrap;
  animation: fade-in 0.8s ease 0.9s both;
}
@keyframes fade-in { from { opacity: 0; } }
.hero-lede {
  font-family: var(--font-serif); font-style: italic; font-size: 1.22rem;
  color: var(--text-soft); line-height: 1.6; max-width: 56ch;
  margin-bottom: 18px; padding-left: 18px; border-left: 3px solid var(--accent);
}
/* highlighter sweep over key phrases; .marked is added from main.js */
.hl {
  background-image: linear-gradient(var(--glow), var(--glow));
  background-repeat: no-repeat; background-position: 0 72%;
  background-size: 0% 45%;
  transition: background-size 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.hl.marked { background-size: 100% 45%; }

.hero-bio { color: var(--text-soft); max-width: 60ch; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; }

.hero-socials { display: flex; gap: 12px; }
.social-link {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border); color: var(--text-soft); position: relative;
  transition: transform 0.2s ease, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.social-link:hover {
  color: var(--accent); border-color: var(--accent);
  transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none;
}
.social-link[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: -32px; left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--text); color: var(--bg); font-size: 0.72rem; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.social-link[data-tip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }

.photo-frame { position: relative; justify-self: center; width: min(320px, 78vw); perspective: 900px; }
.photo-frame::before {
  content: ""; position: absolute; inset: 0;
  border: 1.5px solid var(--accent); border-radius: 4px;
  transform: translate(14px, 14px); z-index: -1;
  transition: transform 0.35s ease;
}
.photo-frame:hover::before { transform: translate(8px, 8px); }
.photo-frame img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 18%;
  border-radius: 4px; display: block; box-shadow: var(--shadow-hover);
  transition: transform 0.3s ease; will-change: transform;
}
.photo-frame figcaption {
  margin-top: 14px; text-align: center; min-height: 1.2em;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted);
}
.photo-frame figcaption.typing::after {
  content: "▍"; margin-left: 2px; color: var(--accent);
  animation: caret-blink 0.9s steps(2) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.scroll-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: var(--muted); animation: bob 2.2s ease-in-out infinite; z-index: 1;
}
.scroll-hint:hover { color: var(--accent); }
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ============ Sections ============ */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); transition: background 0.35s ease; }
.section-title {
  font-family: var(--font-serif); font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700; margin-bottom: 32px; letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 12px;
}
.section-title.centered { justify-content: center; }
.section-title::after {
  content: ""; flex: 1; height: 1px; margin-left: 8px;
  background: linear-gradient(90deg, var(--accent), var(--border) 160px);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.25s;
}
.section-title.visible::after { transform: scaleX(1); }
.section-title.centered::after { display: none; }
.section-note { color: var(--muted); font-size: 0.92rem; margin: -18px 0 26px; }

/* ============ News ============ */
.news-list { list-style: none; max-width: 760px; }
.news-item {
  display: grid; grid-template-columns: 110px 1fr; gap: 18px;
  padding: 13px 16px; border-radius: 10px; align-items: baseline;
  transition: background 0.2s;
}
.news-item:hover { background: var(--surface); }
.news-item + .news-item { border-top: 1px solid var(--border); }
.news-date {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent);
  font-weight: 500; white-space: nowrap;
}
.news-item p { color: var(--text-soft); font-size: 0.97rem; }
.hidden-news { display: none; }
.news-list.expanded .hidden-news { display: grid; }

/* ============ Publications ============ */
.pub-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.filter-btn {
  padding: 7px 18px; border-radius: 999px; border: 1.5px solid var(--border);
  background: transparent; color: var(--text-soft); font-weight: 500; font-size: 0.88rem;
  cursor: pointer; font-family: var(--font-sans);
  transition: all 0.2s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.pub-search {
  flex: 1; min-width: 210px; max-width: 300px; margin-left: auto;
  padding: 7px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: transparent; color: var(--text); font-family: var(--font-sans);
  font-size: 0.88rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pub-search::placeholder { color: var(--muted); }
.pub-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.pub-list { display: flex; flex-direction: column; gap: 18px; }
.pub-card {
  display: grid; grid-template-columns: 130px 1fr; gap: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.3s, border-color 0.25s;
}
.pub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.pub-card.filtered-out { display: none; }

.pub-venue-badge {
  align-self: start; text-align: center; font-weight: 700; font-size: 0.82rem;
  padding: 8px 10px; border-radius: 8px; letter-spacing: 0.02em;
}
.venue-neurips { background: rgba(118, 53, 178, 0.12); color: #9333ea; }
.venue-iclr   { background: rgba(29, 78, 216, 0.1); color: var(--accent-2); }
.venue-icml   { background: rgba(5, 150, 105, 0.12); color: #059669; }
.venue-aaai   { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.venue-preprint { background: rgba(107, 114, 128, 0.12); color: var(--muted); }
[data-theme="dark"] .venue-neurips { color: #c4a3f5; }
[data-theme="dark"] .venue-icml { color: #6ee7b7; }
[data-theme="dark"] .venue-aaai { color: #fbbf6e; }

.pub-title { font-size: 1.08rem; font-weight: 600; line-height: 1.45; margin-bottom: 6px; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent-2); text-decoration: none; }
.pub-highlight {
  font-size: 0.7rem; font-weight: 700; color: var(--accent); border: 1px solid var(--accent);
  padding: 1px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.pub-authors { font-size: 0.92rem; color: var(--text-soft); margin-bottom: 4px; }
.me { font-weight: 700; color: var(--text); border-bottom: 2px solid var(--accent); }
.pub-venue { font-size: 0.88rem; color: var(--muted); font-style: italic; margin-bottom: 12px; }
.pub-links { display: flex; gap: 10px; flex-wrap: wrap; }
.pub-link {
  font-size: 0.82rem; font-weight: 600; color: var(--accent-2);
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 13px;
  background: transparent; cursor: pointer; font-family: var(--font-sans);
  transition: all 0.2s;
}
.pub-link:hover { border-color: var(--accent-2); background: rgba(29, 78, 216, 0.06); text-decoration: none; }
.pub-empty { color: var(--muted); text-align: center; padding: 30px; }

/* ============ Timeline ============ */
.timeline { position: relative; max-width: 760px; padding-left: 36px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--accent), var(--border));
  /* --tl-progress is set from scroll position in main.js */
  transform: scaleY(var(--tl-progress, 1)); transform-origin: top;
}
.timeline-item { position: relative; padding-bottom: 34px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -36px; top: 6px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--bg-alt); border: 3px solid var(--muted);
  transition: border-color 0.3s, box-shadow 0.3s;
}
/* .lit is added as the scroll-drawn line reaches each dot (main.js) */
.timeline-dot.lit { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-dot.current { border-color: var(--accent); }
.timeline-dot.current::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.timeline-item:hover .timeline-dot { border-color: var(--accent); }
.timeline-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 26px; box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.timeline-card:hover { transform: translateX(6px); box-shadow: var(--shadow-hover); }
.timeline-date {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); font-weight: 500;
}
.timeline-card h3 { font-size: 1.12rem; font-weight: 600; margin: 6px 0 2px; }
.timeline-org { font-weight: 500; color: var(--text-soft); font-size: 0.95rem; margin-bottom: 8px; }
.timeline-card p:last-child { color: var(--text-soft); font-size: 0.93rem; }

/* ============ Awards ============ */
.award-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.award-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.award-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.award-year {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent);
  font-weight: 500; background: var(--accent-soft); padding: 3px 10px; border-radius: 999px;
}
.award-card h3 { font-size: 1.05rem; font-weight: 600; margin: 12px 0 6px; }
.award-card p { font-size: 0.9rem; color: var(--text-soft); }

/* ============ Talks & service ============ */
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 60px; }
.simple-list { list-style: none; }
.simple-list li {
  padding: 16px 0; border-bottom: 1px solid var(--border); font-size: 0.97rem;
}
.simple-list li:last-child { border-bottom: none; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ============ After hours ============ */
.after-hours {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px;
  align-items: center; max-width: 900px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 28px 0;
}
.after-hours-kicker {
  font-family: var(--font-mono); color: var(--accent); font-size: 0.75rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 8px;
}
.after-hours h2 {
  font-family: var(--font-serif); font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  line-height: 1.2; letter-spacing: -0.01em; margin-bottom: 10px;
}
.after-hours p:last-child { color: var(--text-soft); max-width: 66ch; }
.after-hours-actions {
  display: flex; gap: 10px; align-items: center; justify-content: flex-end;
  flex-wrap: wrap;
}
.after-hours-actions .btn { white-space: nowrap; }

.token-unlock {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 1120; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text-soft);
  box-shadow: var(--shadow-hover); font-family: var(--font-mono);
  font-size: 0.74rem;
}
.token-unlock[hidden] { display: none; }
.token-unlock:not([hidden]) { animation: unlock-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.token-unlock button {
  border: none; border-radius: 999px; padding: 6px 12px;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
@keyframes unlock-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.97); }
}

/* ============ Cursor-glow cards ============ */
/* --mx/--my are set from pointer position in main.js */
.glow-card { position: relative; }
.glow-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%),
              var(--glow) 0%, transparent 70%);
  opacity: 0; transition: opacity 0.35s ease; pointer-events: none;
}
.glow-card:hover::after { opacity: 1; }

/* ============ Contact ============ */
#contact { position: relative; overflow: hidden; }
#contactCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.contact-wrap { text-align: center; max-width: 620px; position: relative; z-index: 1; }
.contact-email {
  display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.copy-email { display: inline-flex; align-items: center; gap: 8px; }

/* tokens bursting out of the copy button (spawned from main.js) */
.burst-dot {
  position: fixed; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); pointer-events: none; z-index: 1200;
}
.burst-dot.alt { background: var(--accent-2); }
.contact-text { color: var(--text-soft); margin-bottom: 28px; font-size: 1.05rem; }
.contact-socials { justify-content: center; margin-top: 28px; }

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border); padding: 28px 0; text-align: center;
  color: var(--muted); font-size: 0.88rem;
}

/* ============ Back to top ============ */
.back-to-top {
  position: fixed; bottom: 28px; right: 28px; width: 46px; height: 46px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff;
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-hover);
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s; z-index: 900;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-3px); }
/* scroll-progress ring; stroke-dashoffset is driven from main.js */
.btt-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.btt-ring circle {
  fill: none; stroke: rgba(255, 255, 255, 0.9); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 125.7; stroke-dashoffset: 125.7;
}

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--bg); padding: 12px 24px; border-radius: 10px;
  font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-hover);
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.35s; z-index: 1100;
}
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }

/* ============ Theme-change wipe (View Transitions API) ============ */
/* main.js sets --wipe-x/--wipe-y to the toggle button's position and only
   calls startViewTransition() when motion is allowed and supported */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) {
  clip-path: circle(0px at var(--wipe-x, 100%) var(--wipe-y, 0%));
  animation: theme-wipe 0.55s ease-in-out forwards;
}
@keyframes theme-wipe {
  to { clip-path: circle(150vmax at var(--wipe-x, 100%) var(--wipe-y, 0%)); }
}

/* ============ Terminal easter egg (press `) ============ */
.terminal {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px)); z-index: 1150;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-hover); overflow: hidden;
  font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.55;
}
.terminal:not([hidden]) { animation: term-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes term-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.98); }
}
.terminal-bar {
  display: flex; align-items: center; gap: 7px; padding: 9px 12px;
  background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.term-dot { width: 10px; height: 10px; border-radius: 50%; }
.term-dot-r { background: #ff5f57; }
.term-dot-y { background: #febc2e; }
.term-dot-g { background: #28c840; }
.terminal-title { margin-left: 6px; color: var(--muted); font-size: 0.72rem; }
.terminal-body {
  max-height: 240px; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.term-line { color: var(--text-soft); white-space: pre-wrap; word-break: break-word; }
.term-cmd { color: var(--text); font-weight: 500; }
.term-cmd::before { content: "$ "; color: var(--accent); }
.term-muted { color: var(--muted); }
.terminal-input-row {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-top: 1px solid var(--border);
}
.term-prompt { color: var(--accent); font-weight: 500; }
#termInput {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font: inherit; padding: 0;
}

/* ============ Dissertation Defense minigame ============ */
.is-overlay {
  position: fixed; inset: 0; z-index: 1400;
  display: grid; place-items: center; padding: 20px;
  background: rgba(15, 20, 32, 0.44);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.is-overlay[hidden] { display: none; }
.is-frame {
  width: min(1080px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}
.is-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 0.74rem;
}
.is-bar-title { margin-left: 4px; color: var(--text); font-weight: 600; }
.is-bar-run { margin-left: auto; color: var(--muted); }
.is-close {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer;
}
.is-close:hover { color: var(--accent); border-color: var(--accent); }
.is-screen {
  min-height: 0; overflow: auto;
  padding: clamp(18px, 3vw, 34px);
}
.is-title, .is-map, .is-enc, .is-debrief { max-width: 860px; margin: 0 auto; }
.is-title h2, .is-debrief h2, .is-enc h3 {
  font-family: var(--font-serif); line-height: 1.12; letter-spacing: -0.01em;
}
.is-title h2 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 12px; }
.is-enc h3 { font-size: clamp(1.55rem, 3vw, 2.2rem); margin-bottom: 12px; }
.is-kicker, .is-label {
  font-family: var(--font-mono); color: var(--accent);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.11em; margin-bottom: 10px;
}
.is-sub { color: var(--text-soft); max-width: 72ch; margin-bottom: 22px; }
.is-muted { color: var(--muted); font-size: 0.86rem; }
.is-howto {
  display: grid; gap: 8px; margin: 18px 0 26px;
  color: var(--text-soft); font-size: 0.9rem;
}
.is-howto span {
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg);
}
.is-squads, .is-choices {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.is-squad, .is-choice, .is-node, .is-card, .is-btn {
  font-family: var(--font-sans); color: var(--text);
}
.is-squad, .is-choice {
  text-align: left; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 14px; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.is-squad:hover, .is-choice:hover {
  border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow);
}
.is-squad.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.is-squad b, .is-choice b { display: block; margin-bottom: 5px; }
.is-squad span, .is-choice span { display: block; color: var(--text-soft); font-size: 0.86rem; }
.is-squad-ops { font-family: var(--font-mono); color: var(--accent) !important; margin-bottom: 7px; }
.is-title-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 24px;
}
.is-btn {
  border: none; border-radius: 9px; background: var(--accent);
  color: #fff; padding: 10px 18px; font-weight: 700; cursor: pointer;
}
.is-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.is-btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.is-link {
  border: none; background: none; color: var(--accent-2);
  font: inherit; font-weight: 700; cursor: pointer; padding: 0;
}
.is-seedline { color: var(--text-soft); font-size: 0.9rem; }
.is-mapwrap { position: relative; padding: 12px 34px; margin: 20px 0 10px; }
.is-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.is-edge { fill: none; stroke: var(--border); stroke-width: 1.5; }
.is-edge.open { stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 5 5; animation: is-dash 1.1s linear infinite; }
.is-edge.done { stroke: var(--accent-2); stroke-width: 2; }
.is-edge.dim { opacity: 0.3; }
.is-edge-dot { fill: var(--accent); }
@keyframes is-dash { to { stroke-dashoffset: -20; } }
.is-map-marker {
  position: absolute; z-index: 1; transform: translate(-50%, -100%);
  font-size: 1.2rem; pointer-events: none;
  transition: left 0.4s ease, top 0.4s ease;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}
.is-stages {
  display: flex; align-items: center; justify-content: space-between; gap: 40px;
  position: relative;
}
.is-stage { display: grid; gap: 12px; flex: 1; min-width: 0; max-width: 250px; }
.is-node {
  min-height: 58px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 700;
  padding: 10px 12px; text-align: left; display: grid; gap: 3px; align-content: center;
}
.is-node b { font-size: 0.88rem; }
.is-node-sub { color: var(--muted); font-size: 0.7rem; font-weight: 500; line-height: 1.4; }
.is-node.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.is-node.done { border-color: var(--accent-2); color: var(--accent-2); }
.is-node.skipped, .is-node.locked { opacity: 0.42; cursor: default; }
.is-roster-line { text-align: center; }
.is-result {
  grid-column: 1 / -1; color: var(--text-soft);
  padding: 14px 0; font-size: 0.95rem;
}
.is-battle { max-width: 980px; margin: 0 auto; }
.is-hud {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; font-size: 0.86rem; color: var(--text-soft);
}
.is-hud span {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface);
}
.is-hud-node { color: var(--accent) !important; font-weight: 700; }
.is-hud-ctl { margin-left: auto; display: inline-flex; gap: 6px; padding: 3px !important; }
.is-hud-ctl button {
  min-width: 34px; height: 28px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--bg); color: var(--text);
  cursor: pointer; font-weight: 700;
}
.is-stage-wrap {
  position: relative; border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; background: var(--surface);
}
#ibCanvas { display: block; width: 100%; touch-action: none; }
.is-opmenu {
  position: absolute; z-index: 2; width: 180px;
  padding: 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-hover);
}
.is-opmenu p { color: var(--text-soft); font-size: 0.78rem; margin-bottom: 8px; }
.is-opmenu button {
  display: block; width: 100%; margin-top: 6px; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); cursor: pointer;
  font-size: 0.78rem; font-weight: 700;
}
.is-opmenu button:disabled { opacity: 0.45; cursor: not-allowed; }
.is-hand {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px; margin-top: 12px;
}
.is-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  min-height: 70px; text-align: left; position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 10px; cursor: pointer;
  touch-action: none;
}
.is-card:hover, .is-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.is-card.deployed, .is-card.unaffordable { opacity: 0.48; }
.is-card-glyph {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 8px; background: var(--accent-soft);
  color: var(--accent); font-family: var(--font-mono); font-weight: 800;
}
.is-card-name { font-weight: 700; line-height: 1.25; }
.is-card-tag { grid-column: 2 / 4; color: var(--muted); font-size: 0.76rem; }
.is-card-cost {
  color: var(--accent-2); font-family: var(--font-mono);
  font-weight: 800; font-size: 0.86rem;
}
.is-battle-hint { text-align: center; margin-top: 10px; }
.is-statgrid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 20px 0;
}
.is-statgrid span {
  border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  color: var(--muted); background: var(--surface);
}
.is-statgrid b { display: block; color: var(--text); font-size: 1.4rem; line-height: 1.1; }
.is-win { color: var(--accent-2); }
.is-lose { color: var(--accent); }
.is-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 2;
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: 0.78rem;
}
.is-banner b { font-family: var(--font-mono); letter-spacing: 0.02em; }
.is-banner span { color: var(--muted); }
.is-banner span:empty { display: none; }
.is-banner button {
  border: none; border-radius: 999px; background: var(--accent); color: #fff;
  padding: 5px 11px; font-weight: 700; font-size: 0.72rem; cursor: pointer;
}
.is-leakflash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(270deg, rgba(220, 38, 38, 0.4), transparent 20%);
}
.is-leakflash.on { animation: is-leak 0.55s ease-out; }
@keyframes is-leak { from { opacity: 1; } to { opacity: 0; } }
.is-shake { animation: is-shake 0.5s; }
@keyframes is-shake {
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(2px, 2px); }
}
.is-shake-sm { animation: is-shake-sm 0.4s; }
@keyframes is-shake-sm {
  25% { transform: translate(-3px, 0); }
  50% { transform: translate(3px, 0); }
  75% { transform: translate(-2px, 0); }
}
#ibComp { display: inline-block; }
#ibComp.is-tick { animation: is-tick 0.35s ease; }
@keyframes is-tick { 50% { transform: scale(1.3); color: var(--accent); } }
.is-card-aff {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--border); opacity: 0; transition: opacity 0.25s;
}
.is-card.unaffordable .is-card-aff { opacity: 1; }
.is-card-aff i {
  position: absolute; inset: 0; background: var(--accent-2);
  transform-origin: left; transform: scaleX(var(--aff, 0));
  transition: transform 0.25s linear;
}
.is-check {
  display: flex; align-items: center; gap: 9px; margin-top: 16px;
  color: var(--text-soft); font-size: 0.88rem; cursor: pointer;
}
.is-check input { accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.is-runlog { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.is-log, .is-log-year {
  font-size: 0.72rem; padding: 4px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-soft); background: var(--bg);
}
.is-log-year {
  background: var(--accent-soft); color: var(--accent);
  border-color: transparent; font-weight: 700; font-family: var(--font-mono);
}

/* ---- v3: terrain, inspection, achievements, guests, diploma, weekly ---- */
#ibCanvas { touch-action: none; }
.is-hud-ctl button#ibAudio { min-width: 26px; }
.is-guest-chip {
  font-style: normal; font-size: 0.62rem; font-family: var(--font-mono);
  margin-left: 5px; padding: 1px 5px; border-radius: 999px;
  border: 1px solid var(--muted); color: var(--muted); vertical-align: middle;
}
.is-card-guest { border-style: dashed; }
.is-achrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.is-ach-chip {
  font-size: 0.74rem; padding: 5px 11px; border-radius: 999px; font-weight: 600;
  border: 1px solid #b08d3e; color: #b08d3e; background: rgba(176, 141, 62, 0.08);
}
.is-ach-chip.locked {
  border-color: var(--border); color: var(--muted); background: var(--bg);
}
.is-title-shelf {
  display: grid; grid-template-columns: minmax(130px, 0.7fr) 1fr; gap: 12px;
  align-items: center; margin: 16px 0; padding: 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
}
.is-title-shelf b { display: block; color: var(--text); font-size: 0.82rem; }
.is-title-shelf span { color: var(--muted); font-size: 0.74rem; }
.is-badge-strip {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.is-badge-delta {
  margin: 12px 0 14px; padding: 12px;
  border: 1px solid rgba(176, 141, 62, 0.34);
  border-radius: 10px; background: rgba(176, 141, 62, 0.08);
}
.is-badge-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px; margin-top: 14px;
}
.is-badge-card {
  min-width: 0; display: grid; gap: 6px; align-content: start;
}
.is-badge-card.compact { width: 76px; }
.is-badge-card.changed .is-badge-medal {
  animation: badge-polish 0.9s ease-out both;
}
.is-badge {
  --metal-a: #a8a29e;
  --metal-b: #78716c;
  --metal-ring: #57534e;
  --progress: 0%;
  width: 100%; min-height: 104px; padding: 8px 6px 7px;
  display: grid; justify-items: center; align-content: center; gap: 5px;
  border: 1px solid var(--border); border-radius: 8px;
  background:
    linear-gradient(90deg, var(--accent) var(--progress), transparent 0) left bottom / 100% 3px no-repeat,
    linear-gradient(180deg, var(--surface), var(--bg));
  color: var(--text); cursor: help; text-align: center;
}
.is-badge:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.is-badge-medal {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.82), transparent 17px),
    linear-gradient(145deg, var(--metal-a), var(--metal-b));
  border: 3px solid var(--metal-ring);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.20), 0 5px 14px rgba(15, 23, 42, 0.14);
}
.is-badge-medal::after {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.48);
}
.is-badge-icon {
  position: relative; z-index: 1; font-family: var(--font-mono);
  font-size: 0.82rem; font-weight: 800; color: rgba(20, 20, 20, 0.78);
}
.is-badge-caption {
  width: 100%; font-size: 0.72rem; font-weight: 800; line-height: 1.15;
  overflow-wrap: anywhere;
}
.is-badge-progress {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted);
}
.is-badge-detail {
  display: grid; gap: 2px; min-width: 0; text-align: center;
}
.is-badge-detail b {
  color: var(--text); font-size: 0.76rem; line-height: 1.2;
}
.is-badge-detail span {
  color: var(--muted); font-size: 0.68rem; line-height: 1.25;
}
.is-badge-t0 {
  color: var(--muted); background:
    linear-gradient(90deg, var(--muted) var(--progress), transparent 0) left bottom / 100% 3px no-repeat,
    repeating-linear-gradient(135deg, var(--surface), var(--surface) 7px, var(--bg) 7px, var(--bg) 14px);
}
.is-badge-t0 .is-badge-medal {
  --metal-a: #cbd5e1; --metal-b: #94a3b8; --metal-ring: #64748b;
  filter: grayscale(1); opacity: 0.5;
}
.is-badge-t1 .is-badge-medal {
  --metal-a: #d9a066; --metal-b: #a16207; --metal-ring: #854d0e;
}
.is-badge-t2 .is-badge-medal {
  --metal-a: #f1f5f9; --metal-b: #94a3b8; --metal-ring: #64748b;
}
.is-badge-t3 .is-badge-medal {
  --metal-a: #fde68a; --metal-b: #d97706; --metal-ring: #b45309;
}
.is-badge.secret .is-badge-medal { opacity: 0.38; }
@keyframes badge-polish {
  0% { transform: scale(0.92); filter: saturate(0.7) brightness(0.85); }
  45% { transform: scale(1.06); filter: saturate(1.2) brightness(1.2); }
  100% { transform: scale(1); filter: none; }
}
.is-record-panel {
  margin-top: 14px; padding: 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text-soft);
  font-size: 0.84rem;
}
.is-record-panel p + p { margin-top: 5px; }
.is-record-top {
  display: grid; gap: 3px; margin-bottom: 12px;
}
.is-record-sections {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px; margin: 12px 0;
}
.is-record-sections section {
  display: grid; gap: 3px; padding: 9px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg);
}
.is-record-sections b {
  color: var(--text); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
}
.is-record-sections span {
  color: var(--text-soft); font-size: 0.74rem; line-height: 1.35;
}
.is-unlocks {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin: 12px 0;
}
.is-unlock {
  display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center;
  padding: 8px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
}
.is-unlock input { accent-color: var(--accent); }
.is-unlock span { display: grid; gap: 1px; }
.is-unlock b { color: var(--text); font-size: 0.76rem; }
.is-unlock i { color: var(--muted); font-style: normal; font-size: 0.68rem; }
.is-unlock.locked { opacity: 0.55; }
.is-compact-hud .is-hud {
  gap: 6px; margin-bottom: 6px; font-size: 0.76rem;
}
.is-compact-hud .is-hud span {
  padding: 4px 7px; border-radius: 7px;
}
.is-focus-layout .is-battle-hint,
.is-focus-layout .is-runlog {
  display: none;
}
.is-committee-frame .is-frame {
  box-shadow: 0 0 0 2px rgba(176, 141, 62, 0.25), var(--shadow-hover);
}
.is-diploma-seals .is-debrief h2::after {
  content: " sealed"; margin-left: 8px; font-family: var(--font-mono);
  font-size: 0.72rem; color: #b45309; vertical-align: middle;
}
.is-dossier {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px; margin-top: 14px;
}
.is-dossier-row {
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 11px 12px; display: grid; gap: 4px;
}
.is-dossier-row b { color: var(--text); font-size: 0.86rem; }
.is-dossier-row span { color: var(--text-soft); font-size: 0.75rem; }
.is-dossier-row i { color: var(--muted); font-size: 0.72rem; }
.is-inspect {
  position: absolute; z-index: 3; width: 178px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); font-size: 0.76rem; pointer-events: auto;
}
.is-inspect b { display: block; color: var(--text); margin-bottom: 3px; }
.is-inspect span { display: block; color: var(--text-soft); }
.is-inspect i { display: block; margin-top: 5px; color: var(--muted); font-size: 0.72rem; }
.is-inspect-x {
  position: absolute; top: 4px; right: 6px; border: none; background: none;
  color: var(--muted); cursor: pointer; font-size: 0.82rem; line-height: 1;
}
.is-hint-terr {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  z-index: 2; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-soft); font-size: 0.74rem; box-shadow: var(--shadow);
}
.is-diploma-row {
  display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap;
}
.is-diploma-row[hidden] { display: none; }
.is-diploma-row input {
  padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-family: var(--font-mono); min-width: 180px;
}
.is-mut-line { color: var(--accent); font-size: 0.82rem; }

/* ============ Reveal animation ============ */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .section-title::after, .timeline::before { transform: none !important; }
  html { scroll-behavior: auto; }
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-photo { order: -1; width: min(260px, 70vw); }
  .hero { padding-top: 110px; }
  .hero-canvas-note { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .two-col { grid-template-columns: 1fr; gap: 30px; }
  .after-hours { grid-template-columns: 1fr; }
  .after-hours-actions { justify-content: flex-start; }
  .award-grid { grid-template-columns: 1fr; }
  .pub-card { grid-template-columns: 1fr; gap: 12px; }
  .pub-venue-badge { justify-self: start; }

  .nav-links {
    position: fixed; top: 64px; right: 0; bottom: 0; width: min(280px, 80vw);
    background: var(--surface); flex-direction: column; padding: 24px;
    border-left: 1px solid var(--border); box-shadow: var(--shadow-hover);
    transform: translateX(100%); transition: transform 0.3s ease;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-pill { display: none; }
  .nav-link { padding: 12px 16px; font-size: 1rem; }
  .nav-link:hover, .nav-link.active { background: var(--accent-soft); }
  .nav-burger { display: flex; }
  .cv-btn { display: none; }
  .is-frame { max-height: calc(100vh - 16px); width: calc(100vw - 16px); }
  .is-screen { padding: 18px; }
  .is-squads, .is-choices { grid-template-columns: 1fr; }
  .is-title-shelf { grid-template-columns: 1fr; }
  .is-badge-grid { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .is-mapwrap { padding: 8px 20px; }
  .is-stages { align-items: stretch; gap: 16px; }
  .is-stage { min-width: 0; flex: 1; }
  .is-node { min-height: 52px; }
  .is-node b { font-size: 0.78rem; }
  .is-statgrid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .news-item { grid-template-columns: 1fr; gap: 2px; }
  .section { padding: 64px 0; }
  .hero-cta .btn { flex: 1; text-align: center; }
  .after-hours-actions .btn { width: 100%; text-align: center; }
  .token-unlock {
    width: calc(100vw - 32px); justify-content: space-between;
    bottom: 18px;
  }
  .is-overlay { padding: 8px; }
  .is-bar-run { display: none; }
  .is-stages { flex-direction: column; gap: 12px; }
  .is-stage { max-width: none; }
  .is-map-svg, .is-map-marker { display: none; }
  .is-mapwrap { padding: 0; }
  .is-banner { top: 6px; padding: 5px 9px; font-size: 0.68rem; gap: 6px; }
  .is-hud-ctl { margin-left: 0; }
  .is-hud-ctl button { min-height: 40px; min-width: 40px; }
  .is-statgrid { grid-template-columns: 1fr; }
  .is-badge-strip { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .is-badge-card.compact { flex: 0 0 72px; }
  .is-badge { min-height: 96px; }
  .is-badge-medal { width: 46px; height: 46px; }
  /* larger touch targets on phones */
  .is-card { min-height: 56px; }
  .is-opmenu button { min-height: 40px; }
}
