/* Yubo Kou — site styles. Colors and fonts live in the variables below. */
:root {
  --bg: #0E1117;
  --band: #121720;
  --panel: #161B24;
  --panel-2: #1C2330;
  --line: #2E3848;
  --text: #ECEFF3;
  --text-2: #D5DAE1;
  --muted: #AAB4C2;
  --dim: #8C97A6;
  --gold: #F4B942;
  --teal: #73D2C7;
  --px: 'Pixelify Sans', 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
/* 8-bit mode (secret). */
html.retro {
  --bg: #050805; --band: #081008; --panel: #0C160C; --panel-2: #122012; --line: #1F3A1F;
  --text: #9DFF8A; --text-2: #8BEA79; --muted: #6FCC5F; --dim: #5DB04F; --gold: #D6FF5C; --teal: #9DFF8A;
  --sans: 'Pixelify Sans', monospace; --mono: 'Pixelify Sans', monospace;
}
html.retro .notch, html.retro .dialog { clip-path: none; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { color: var(--teal); }
a:hover { color: var(--gold); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
img { max-width: 100%; display: block; }
.px { font-family: var(--px); }
.px, html.retro body { font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; }
.mono { font-family: var(--mono); }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.notch { clip-path: polygon(0 5px, 5px 5px, 5px 0, calc(100% - 5px) 0, calc(100% - 5px) 5px, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 5px calc(100% - 5px), 0 calc(100% - 5px)); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--gold); color: var(--bg); padding: 8px 12px; z-index: 9; }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Header */
.site-header { position: sticky; top: 0; z-index: 25; background: var(--bg); border-bottom: 2px solid var(--panel-2); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 80px; flex-wrap: wrap; }
.logo { font-size: 26px; font-weight: 600; color: var(--text); text-decoration: none; letter-spacing: .02em; }
.logo .blink { color: var(--gold); }
.nav { display: flex; gap: 28px; flex-wrap: wrap; }
.nav a { position: relative; color: var(--text); text-decoration: none; font-family: var(--mono); font-size: 15px; font-weight: 500; padding: 10px 2px; }
.nav a::before { content: '▸'; position: absolute; left: -15px; color: var(--gold); opacity: 0; }
.nav a:hover { color: var(--gold); }
.nav a:hover::before { opacity: 1; }
.nav a[aria-current="page"] { color: var(--gold); }
.nav a[aria-current="page"]::before { opacity: 1; }

/* Hero */
.hero-row { display: flex; flex-wrap: wrap; gap: 64px; align-items: flex-start; padding-top: 80px; padding-bottom: 96px; }
.hero-text { flex: 1 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.eyebrow { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .12em; color: var(--gold); }
.hero-name { display: flex; flex-direction: column; gap: 14px; }
.hero h1 { margin: 0; font-size: clamp(60px, 9vw, 128px); font-weight: 600; line-height: .92; letter-spacing: .01em; }
.hero-titles { margin: 0; font-size: 19px; line-height: 1.55; color: var(--muted); }
.dialog { position: relative; margin: 10px 6px 6px; background: var(--bg); border: 3px solid var(--text); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--text); padding: 26px 28px 30px; }
.dialog p { margin: 0; font-size: 24px; line-height: 1.45; }
/* All lines share one cell so the box keeps the height of the longest line. */
.dialog-lines { display: grid; }
.dialog-lines p { grid-area: 1 / 1; }
.dialog-lines p[hidden] { display: block !important; visibility: hidden; }
.dialog-next { display: none; position: absolute; right: 6px; bottom: 2px; width: 44px; height: 40px; padding: 0; background: none; border: 0; color: var(--gold); font-size: 16px; cursor: pointer; }
.js .dialog-next { display: block; }
.dialog-next:hover { color: var(--text); }
.menu { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.menu a { display: flex; align-items: center; gap: 14px; min-height: 44px; color: var(--muted); text-decoration: none; font-family: var(--px); font-size: 26px; letter-spacing: .02em; }
.menu a .cur { color: var(--gold); opacity: 0; width: 16px; }
.menu a:hover, .menu a.on, .menu a:focus-visible { color: var(--gold); }
.menu a:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.menu a:hover .cur, .menu a.on .cur, .menu a:focus-visible .cur { opacity: 1; }
.hint { margin: 0; font-size: 13px; letter-spacing: .08em; color: var(--dim); }
.profile { flex: 0 1 360px; min-width: 280px; }
.portrait { position: relative; background: var(--gold); padding: 10px; box-shadow: 8px 8px 0 var(--teal); }
.portrait img, .portrait-empty { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--panel-2); }
.portrait-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.sheet { margin: 18px 0 0; background: var(--panel-2); border-left: 4px solid var(--teal); padding: 18px 20px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px 14px; font-size: 14px; line-height: 1.45; }
.sheet dt { color: var(--gold); font-weight: 600; }
.sheet dd { margin: 0; }

/* Sections */
.section { padding: 96px 0; }
.section.tight-top { padding-top: 0; }
.band { background: var(--band); border-top: 2px solid var(--panel-2); border-bottom: 2px solid var(--panel-2); }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.section-head.split { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.section-head h2, .page-h { margin: 0; font-size: 52px; font-weight: 600; line-height: 1; }
.section-head h2.small { font-size: 44px; }
.label { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .12em; color: var(--gold); }
.sublabel { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--dim); }
.head-links { display: flex; gap: 0 22px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.head-links a, .after-link a { display: inline-flex; align-items: center; min-height: 44px; }
.meta { color: var(--muted); font-size: 15px; }
.mono.meta { font-size: 13px; }

/* About */
.about-row { display: flex; flex-wrap: wrap; gap: 48px; }
.about-row .section-head { flex: 0 0 220px; margin: 0; }
.about-text { flex: 1 1 560px; min-width: 0; max-width: 760px; }
.about-text p { margin: 0 0 18px; font-size: 18px; line-height: 1.7; color: var(--text-2); }
.hero + .section { padding-top: 0; }

/* Quest log: all quests shown with equal weight */
.research-intro { margin: 0 0 40px; max-width: 760px; font-size: 18px; line-height: 1.7; color: var(--text-2); }
.quest-grid { display: grid; gap: 16px; }
.quest-grid.main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quest-grid.side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.side-label { margin-top: 48px; }
.quest-card { min-width: 0; background: var(--panel); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.quest-card h3 { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.15; }
.quest-card.small { background: transparent; border: 2px solid var(--panel-2); padding: 22px 24px; gap: 10px; }
.quest-card.small h3 { font-family: var(--sans); font-size: 18px; font-weight: 600; line-height: 1.3; }
.quest-desc { margin: 0; font-size: 16px; line-height: 1.65; color: var(--text-2); }
.quest-card.small .quest-desc { font-size: 15px; color: var(--muted); }
.quest-foot { padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.quest-papers { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.quest-papers li { display: flex; flex-direction: column; gap: 1px; font-size: 15px; line-height: 1.45; }
.quest-papers .mono { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--teal); }
.quest-card.small .quest-papers li { font-size: 14px; color: var(--muted); }
.sponsor { margin: 14px 0 0; padding-top: 14px; border-top: 2px dashed var(--line); font-size: 12px; line-height: 1.6; color: var(--muted); }
.sponsor span { color: var(--gold); font-weight: 600; letter-spacing: .1em; }
.qbtn { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; background: transparent; border: 0; color: var(--muted); text-align: left; font-family: var(--mono); font-size: 15px; font-weight: 500; cursor: pointer; }
.qbtn .cur { color: var(--gold); opacity: 0; width: 12px; flex: 0 0 12px; }
.qbtn:hover { color: var(--text); }
.qbtn:hover .cur { opacity: 1; }
.qbtn.on { background: var(--gold); color: var(--bg); font-weight: 600; }
.qbtn.on .cur { opacity: 1; color: var(--bg); }
@media (max-width: 1000px) { .quest-grid.main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .quest-grid.side { grid-template-columns: minmax(0, 1fr); } .quest-card { padding: 22px; } }

/* Publications */
.pubs { border-bottom: 2px dashed var(--line); }
.pub { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-top: 2px dashed var(--line); }
.pub[hidden] { display: none; }
.pub-venue { font-size: 14px; font-weight: 600; color: var(--teal); padding-top: 3px; }
.pub-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.4; }
.pub-title a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.pub-title a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.pub-authors { margin: 8px 0 0; font-size: 16px; color: var(--muted); }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-full { margin: 4px 0 0; font-size: 14px; color: var(--dim); font-style: italic; }
.badge { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 13px; font-weight: 500; color: var(--gold); }
.badge.notch { clip-path: none; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.filters .qbtn { width: auto; min-height: 44px; border: 2px solid var(--panel-2); }
.filters .qbtn:hover { border-color: var(--gold); }
.filters .qbtn.on { border-color: var(--gold); }
.filters .qbtn .cur { display: none; }
.nav a.here { color: var(--gold); }
.nav a.here::before { opacity: 1; }
.year-group[hidden] { display: none; }
.year { margin: 40px 0 8px; font-size: 32px; font-weight: 600; color: var(--gold); }
.note { margin-top: 32px; }
.page-top { padding-top: 64px; }

/* Tiles */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { background: var(--panel); padding: 22px; display: flex; flex-direction: column; gap: 10px; transition: background .12s; }
.tile:hover { background: var(--panel-2); }
.tile p { margin: 0; }
.tile-title { font-size: 17px; font-weight: 600; line-height: 1.35; }
.tile-meta { font-size: 13px; letter-spacing: .06em; color: var(--muted); }
.star { font-size: 26px; color: var(--gold); line-height: 1; }
.code { font-size: 14px; font-weight: 600; color: var(--teal); }
.after-link { margin: 18px 0 0; font-size: 14px; }

/* Students */
.party { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 40vw), 1fr)); gap: 32px 20px; }
@media (min-width: 761px) { .party { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.member { display: flex; flex-direction: column; gap: 6px; }
.member p { margin: 0; }
.avatar { aspect-ratio: 1 / 1; width: 100%; height: auto; object-fit: cover; background: var(--panel-2); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; outline: 3px solid transparent; outline-offset: 4px; transition: outline-color .12s; }
.avatar span { font-size: 40px; color: var(--teal); }
.member:hover .avatar { outline-color: var(--gold); }
.pname { font-size: 18px; font-weight: 600; }
.pname a, .former-row a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.pname a:hover, .former-row a:hover { color: var(--gold); text-decoration-color: var(--gold); }
.member:hover .pname::before { content: '▸ '; color: var(--gold); }
.former { margin-top: 48px; display: flex; flex-direction: column; gap: 12px; }
.former p { margin: 0; }
.former-row { font-size: 17px; }

/* Contact */
.contact { background: var(--gold); color: var(--bg); padding: 96px 0; }
.contact a { color: var(--bg); }
.contact-row { display: flex; flex-wrap: wrap; gap: 48px; justify-content: space-between; align-items: flex-end; }
.contact-text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.contact-text p { margin: 0; max-width: 600px; font-size: 18px; line-height: 1.6; }
.contact h2 { margin: 0; font-size: clamp(48px, 6vw, 76px); font-weight: 600; line-height: .95; }
.save { font-size: 14px; font-weight: 600; letter-spacing: .12em; }
.contact-info { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.contact-info p { margin: 0; font-size: 14px; line-height: 1.7; }
.mail { display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px; background: var(--bg); color: var(--gold) !important; font-size: 16px; font-weight: 600; text-decoration: none; }
.contact a:focus-visible { outline-color: var(--bg); }

/* Footer */
.site-footer { border-top: 2px solid var(--panel-2); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-top: 28px; padding-bottom: 32px; font-size: 13px; color: var(--muted); }

/* 404 */
.gameover { padding: 120px 0 140px; }
.gameover .wrap { display: flex; flex-direction: column; gap: 24px; }
.gameover h1 { margin: 0; font-size: clamp(64px, 12vw, 168px); font-weight: 700; line-height: .95; }
.go-text { margin: 0; max-width: 560px; font-size: 19px; color: var(--muted); }
.continue { margin: 24px 0 0; font-size: 16px; font-weight: 600; letter-spacing: .1em; }
.continue .blink { color: var(--gold); }

/* Secret-mode toast */
.retro-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; padding: 10px 16px; background: var(--gold); color: var(--bg); font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; }
.retro-toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .blink { animation: none; }
  .tile, .avatar, .retro-toast { transition: none; }
}
@media (max-width: 760px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .nav { gap: 6px 20px; }
  .nav a::before { display: none; }
  .hero-row { padding-top: 48px; padding-bottom: 64px; gap: 40px; }
  .dialog p { font-size: 20px; }
  .menu a { font-size: 22px; }
  .profile { flex-basis: 100%; }
  .section { padding: 64px 0; }
  .section-head h2, .page-h { font-size: 40px; }
  .pub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ---------- Game navigation: minimap, stage card, controls ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.linkish { display: inline-flex; align-items: center; min-height: 44px; background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--gold); }
.hint .linkish { color: var(--muted); }

.minimap { position: fixed; right: 20px; bottom: 20px; z-index: 20; width: 164px; padding: 12px 14px 14px; background: var(--panel); border: 2px solid var(--line); transition: opacity .2s, transform .2s; }
.minimap.off { opacity: 0; transform: translateY(12px); pointer-events: none; }
.mm-head { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; color: var(--dim); }
.mm-cur { color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-grid { position: relative; width: 132px; height: 58px; }
.mm-lines { position: absolute; inset: 0; width: 132px; height: 58px; }
.mm-lines polyline { fill: none; stroke: var(--line); stroke-width: 2; }
.room { position: absolute; width: 24px; height: 24px; background: var(--panel-2); border: 2px solid var(--line); }
.room.seen { border-color: var(--teal); }
.room.here { background: var(--gold); border-color: var(--gold); }
.room:hover { border-color: var(--gold); }
.room.here::after { content: ''; position: absolute; inset: -6px; border: 2px solid var(--gold); animation: blink 1.1s steps(1) infinite; }

.stage-card { position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 30; padding: 26px 20px 30px; background: var(--bg); border-top: 3px solid var(--gold); border-bottom: 3px solid var(--gold); text-align: center; opacity: 0; pointer-events: none; transition: opacity .14s; }
.stage-card.show { opacity: 1; }
.stage-card p { margin: 0; }
.stage-card .mono { font-size: 13px; font-weight: 600; letter-spacing: .2em; color: var(--gold); }
.stage-card .px { margin-top: 6px; font-size: clamp(40px, 6vw, 72px); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.controls { width: min(560px, calc(100vw - 32px)); padding: 30px 32px 28px; background: var(--bg); color: var(--text); border: 3px solid var(--text); box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--text); }
.controls::backdrop { background: rgba(5, 7, 10, .78); }
.controls h2 { margin: 6px 0 18px; font-size: 36px; font-weight: 600; }
.keys { margin: 0 0 22px; display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 18px; font-size: 15px; line-height: 1.45; }
.keys dt { color: var(--gold); font-size: 13px; font-weight: 600; padding-top: 2px; }
.keys dd { margin: 0; color: var(--text-2); }
.controls-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.controls-actions .qbtn { width: auto; }

[data-stage], .year-group { scroll-margin-top: 100px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 16px; font-size: 14px; font-weight: 600; color: var(--teal); text-decoration: none; }
.back-link:hover { color: var(--gold); }
.year-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; font-size: 14px; }
.year-jump span { margin-right: 8px; font-size: 12px; font-weight: 600; letter-spacing: .12em; color: var(--dim); }
.year-jump a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; color: var(--muted); text-decoration: none; border: 2px solid var(--panel-2); }
.year-jump a:hover { color: var(--gold); border-color: var(--gold); }
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; background: var(--gold); color: var(--bg); font-size: 14px; font-weight: 600; text-decoration: none; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--bg); }
[data-stage]:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .room.here::after { animation: none; }
  .minimap, .stage-card { transition: none; }
}
@media (max-width: 900px) { .minimap { display: none; } }
.menu-toggle { display: none; }
@media (max-width: 760px) {
  .header-row { min-height: 64px; flex-wrap: nowrap; }
  .logo { font-size: 22px; }
  .menu-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; background: none; border: 2px solid var(--line); color: var(--text); font-size: 14px; font-weight: 600; letter-spacing: .08em; cursor: pointer; }
  .menu-toggle[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; padding: 8px 20px 16px; background: var(--bg); border-bottom: 2px solid var(--panel-2); }
  .nav.open { display: flex; }
  .nav a { display: flex; align-items: center; min-height: 48px; padding: 0 0 0 18px; font-size: 16px; border-top: 1px solid var(--panel-2); }
  .nav a::before { display: block; left: 0; top: 50%; transform: translateY(-52%); }
  .site-header .wrap { position: relative; }
  [data-stage], .year-group { scroll-margin-top: 80px; }
}
@media (max-width: 560px) { .keys { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .keys dd { margin-bottom: 8px; } }

/* On the homepage the nav follows the section in view instead of marking Home as current. */
html.has-spy .nav a[aria-current="page"]:not(.here) { color: var(--text); }
html.has-spy .nav a[aria-current="page"]:not(.here)::before { opacity: 0; }
