/* Yichen Lin — site styles.
   The page is a set of glass panels floating over a fixed, full-viewport 3D world (#world).
   Content stays plain semantic HTML; the world only reacts to it. */

:root {
  --bg: #070a12;
  --bg-2: #0e121b;
  --ink: #eef0f5;
  --ink-2: #bcc3d1;
  --ink-3: #8b94a7;
  --line: rgba(233, 236, 241, 0.12);
  --line-2: rgba(233, 236, 241, 0.22);
  --accent: #f2b84b;
  --accent-2: #ffd23f;
  --navy: #182b49;
  --glass: rgba(10, 14, 25, 0.68);
  --glass-2: rgba(14, 19, 33, 0.82);
  --serif: 'Instrument Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --bar-top: 56px;   /* the bar's first row */
  --hud-h: 0px;      /* the status strip under it (set in hud.css for the game) */
  --bar-h: calc(var(--bar-top) + var(--hud-h));
  --gutter: clamp(16px, 5.5vw, 84px);
  --card-w: 600px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, canvas, svg { display: block; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
b { font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 5px; text-align: center;
  font: 500 12px/1.5 var(--mono); color: var(--ink); background: rgba(233, 236, 241, 0.08); border: 1px solid var(--line-2);
}
.skip { position: fixed; left: 16px; top: -60px; padding: 8px 12px; background: var(--accent); color: #1a1300; z-index: 200; border-radius: 6px; }
.skip:focus { top: 12px; }

/* ---------------- the world layer ---------------- */
#world { position: fixed; inset: 0; z-index: 0; background: var(--bg); overflow: hidden; touch-action: pan-y; }
/* phones: the world keeps the large-viewport height, so the browser bars sliding in and out while you
   scroll do not resize (and re-aim) the 3D view every time */
@supports (height: 100lvh) { @media (pointer: coarse) { #world { bottom: auto; height: 100lvh; } } }
html.is-play #world { touch-action: none; }
.world__poster {
  position: absolute; inset: 0;
  background:
    url('../img/world-poster.jpg?v=hub2') 50% 50% / cover no-repeat,
    radial-gradient(70% 60% at 68% 42%, rgba(60, 60, 150, 0.5), transparent 70%),
    var(--bg);
  transition: opacity 1.1s ease 0.15s;
}
#world .g__canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.9s ease; }
body.world-live #world .g__canvas { opacity: 1; }
body.world-live .world__poster { opacity: 0; }
/* the poster is the hero shot itself, baked at both aspects (tools/dev/poster.mjs) */
@media (max-aspect-ratio: 4/5) {
  .world__poster { background-image: url('../img/world-poster-tall.jpg?v=hub2'), radial-gradient(70% 60% at 68% 42%, rgba(60, 60, 150, 0.5), transparent 70%); }
}
/* a soft scrim on the side that carries text, so type stays legible over bright parts of the world */
#world::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; transition: opacity 0.6s;
  background: linear-gradient(90deg, rgba(7, 10, 18, 0.72) 0%, rgba(7, 10, 18, 0.32) 34%, rgba(7, 10, 18, 0) 58%);
}
body[data-side='right'] #world::after { background: linear-gradient(270deg, rgba(7, 10, 18, 0.5) 0%, rgba(7, 10, 18, 0.2) 34%, rgba(7, 10, 18, 0) 58%); }
html.is-play #world::after { opacity: 0; }

/* ---------------- top bar ---------------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 30; height: var(--bar-top);
  display: flex; align-items: center; gap: 22px; padding: 0 var(--gutter);
  /* no backdrop-filter: re-blurring the live WebGL canvas every frame is the costliest thing on the page */
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.94), rgba(7, 10, 18, 0.8));
  border-bottom: 1px solid var(--line);
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.4s;
}
html.is-booting .bar { transform: translateY(-100%); }
html.is-play .bar { transform: translateY(-100%); }
.bar__brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.bar__avatar { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%;
  box-shadow: 0 0 0 2px #0b1426, 0 0 0 3.5px #ffcd00, 0 4px 14px rgba(0, 0, 0, 0.45); transition: transform 0.25s; }
.bar__avatar img { width: 100%; height: 100%; border-radius: 50%; }
.bar__brand:hover .bar__avatar { transform: rotate(-6deg) scale(1.06); }
.bar__online { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 0 2px #0b1426; }
.bar__id { display: grid; line-height: 1.05; }
.bar__status { font: 400 10px/1.3 'Silkscreen', var(--mono); letter-spacing: 0.06em; color: #9fb4d8; white-space: nowrap; transition: opacity 0.3s; }
.bar__name { font-family: var(--serif); font-size: 21px; letter-spacing: 0.01em; white-space: nowrap; }
.bar__nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; font-size: 14.5px; }
.bar__nav a { padding: 6px 11px; border-radius: 999px; text-decoration: none; color: var(--ink-2); transition: color 0.2s, background-color 0.2s; }
.bar__nav a:hover { color: var(--ink); background: rgba(233, 236, 241, 0.06); }
.bar__nav a.is-active { color: var(--ink); background: rgba(242, 184, 75, 0.14); box-shadow: inset 0 0 0 1px rgba(242, 184, 75, 0.35); }
.bar__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bar__zone { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; font: 500 12px var(--mono); color: var(--ink-3); letter-spacing: 0.03em; white-space: nowrap; }
.bar__zone img { filter: invert(1); opacity: 0.6; }
.bar__zone span { transition: opacity 0.25s; }
.bar__btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: rgba(233, 236, 241, 0.04); border: 1px solid var(--line); color: var(--ink); font-size: 13.5px; white-space: nowrap;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}
.bar__btn:hover { border-color: var(--accent); background: rgba(242, 184, 75, 0.09); }
.bar__btn img { filter: invert(1); opacity: 0.9; }
.bar__eggs svg { color: #a3e635; filter: drop-shadow(0 0 5px rgba(163, 230, 53, 0.45)); }
.bar__eggs #eggs-count { font-weight: 600; min-width: 1ch; }
.bar__of { color: var(--ink-3); margin-left: -5px; }
.bar__eggs.is-pop { animation: pop 0.55s ease; }
@keyframes pop { 30% { transform: scale(1.18); border-color: #a3e635; } }
.bar__play { background: rgba(242, 184, 75, 0.12); border-color: rgba(242, 184, 75, 0.45); }
.bar__play[hidden] { display: none; }
.phud { position: absolute; left: 0; right: 0; top: 100%; height: 2px; margin-top: -1px; pointer-events: none; }
.phud__m--prog, .bar__progress { position: absolute; inset: 0; }
.bar__progress i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px rgba(242, 184, 75, 0.6); }
.bar__toggle, .bar__burger { display: none; }

/* ---------------- scenes and cards ---------------- */
.page { position: relative; z-index: 10; pointer-events: none; transition: opacity 0.4s, visibility 0.4s; }
html.is-play .page, html.is-play .foot { opacity: 0; visibility: hidden; pointer-events: none; }
.scene {
  min-height: 100svh; display: flex; align-items: center;
  padding: calc(var(--bar-h) + 36px) var(--gutter) 48px;
}
.scene--last { min-height: 100svh; }
.scene[data-side='right'] { justify-content: flex-end; }
.card, .hero, .scroll-cue { pointer-events: auto; }
.card {
  width: min(var(--card-w), 100%); padding: 28px 32px 30px; border-radius: 20px;
  /* opaque-ish gradient instead of backdrop-filter (the canvas behind animates every frame) */
  background: linear-gradient(180deg, rgba(14, 19, 33, 0.93), rgba(10, 14, 25, 0.87));
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .card:not(.is-in) { opacity: 0; transform: translateY(26px); }
.card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4vw, 46px); line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 16px; }
.tag { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 10px; font: 500 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tag__n { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 6px; border-radius: 6px; color: #1a1300; background: var(--accent); letter-spacing: 0; font-weight: 600; }
.prose p + p { margin-top: 12px; }
.prose .aside { margin-top: 16px; color: var(--ink-2); font-size: 15.5px; }

/* hero */
.hero { max-width: 720px; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px; font: 500 13px var(--mono); letter-spacing: 0.06em; color: var(--ink-2); text-transform: uppercase; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(242, 184, 75, 0.18), 0 0 14px var(--accent); animation: pip 2.4s ease-in-out infinite; }
@keyframes pip { 50% { box-shadow: 0 0 0 8px rgba(242, 184, 75, 0), 0 0 20px var(--accent); } }
.hero__name {
  font-family: var(--serif); font-weight: 400; cursor: default; user-select: none;
  font-size: clamp(64px, 11vw, 150px); line-height: 0.92; letter-spacing: -0.015em; margin-bottom: 22px;
  background: linear-gradient(180deg, #fff 30%, #d7dcf3);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 4px 30px rgba(0, 0, 0, 0.5));
}
/* the Chinese name beside the big one: its own colour (the h1 paints its text with a clipped gradient) */
.hero__cn {
  font-family: 'Noto Serif SC Name', 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Source Han Serif SC', 'SimSun', serif;
  font-weight: 500; font-size: clamp(17px, 0.3em, 34px); letter-spacing: 0.14em; white-space: nowrap;
  color: var(--ink-2); -webkit-text-fill-color: var(--ink-2);
}
.hero__role { max-width: 33em; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink); }
.hero__links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 24px; font-size: 15px; }
.hero__links a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-2); }
.hero__links a:hover { color: var(--ink); }
.hero__links img { filter: invert(1); opacity: 0.85; }
.hero__links--card { margin-top: 20px; }
.hero__hint { display: flex; align-items: flex-start; gap: 14px; max-width: 34em; margin-top: 34px; color: var(--ink-2); font-size: 14.5px; }
.hero__hint b { color: var(--ink); font-weight: 600; }
.keys { display: inline-grid; grid-template-columns: repeat(3, 26px); gap: 3px; flex: none; margin-top: 2px; }
.keys kbd { min-width: 0; height: 26px; padding: 0; line-height: 24px; font-size: 12px; }
.keys kbd:first-child { grid-column: 2; }
.keys kbd:nth-child(n+2) { grid-row: 2; }
.keys kbd:nth-child(2) { grid-column: 1; }
.keys kbd:nth-child(3) { grid-column: 2; }
.keys kbd:nth-child(4) { grid-column: 3; }
.hero__hint .keys kbd { animation: keyglow 3.2s ease-in-out infinite; }
.hero__hint .keys kbd:nth-child(2) { animation-delay: 0.3s; }
.hero__hint .keys kbd:nth-child(3) { animation-delay: 0.6s; }
.hero__hint .keys kbd:nth-child(4) { animation-delay: 0.9s; }
@keyframes keyglow { 0%, 70%, 100% { border-color: var(--line-2); } 80% { border-color: var(--accent); box-shadow: 0 0 10px rgba(242, 184, 75, 0.5); } }
.hero__boot { margin-top: 14px; min-height: 1.5em; font: 400 12px/1.5 var(--mono); color: var(--ink-3); letter-spacing: 0.03em; white-space: pre-wrap; opacity: 0.8; transition: opacity 0.8s; text-shadow: none; }
.hero__boot[hidden] { display: none; }
.hero__boot::after { content: '_'; animation: blink 1s steps(2) infinite; }
.hero__boot.is-done { opacity: 0; }
@keyframes blink { 50% { opacity: 0; } }
html:not(.js) .hero__boot { display: none; }
.scroll-cue { position: absolute; left: 50%; bottom: 22px; width: 26px; height: 42px; margin-left: -13px; border-radius: 14px; border: 1.5px solid var(--line-2); display: block; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--ink-2); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0% { transform: translateY(0); opacity: 1; } 80%, 100% { transform: translateY(14px); opacity: 0; } }
.scene--hero { position: relative; }
.js .hero, .js .scene--hero .eyebrow, .js .hero__hint { opacity: 0; transform: translateY(14px); }
html:not(.is-booting) .hero > * { animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html:not(.is-booting) .hero > *:nth-child(2) { animation-delay: 0.12s; }
html:not(.is-booting) .hero > *:nth-child(3) { animation-delay: 0.24s; }
html:not(.is-booting) .hero > *:nth-child(4) { animation-delay: 0.34s; }
html:not(.is-booting) .hero > *:nth-child(5) { animation-delay: 0.5s; }
html:not(.is-booting) .hero > *:nth-child(6) { animation-delay: 0.6s; }
html.js:not(.is-booting) .hero, html.js:not(.is-booting) .hero__hint, html.js:not(.is-booting) .scene--hero .eyebrow { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* about: a character sheet in the game, a plain two-column block otherwise */
.sheet { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: start; }
.sheet h2 { margin-bottom: 14px; }
.sheet__side { display: grid; gap: 14px; justify-items: start; width: 232px; }
.sheet__stats { display: grid; gap: 6px; font-size: 14px; }
.sheet__stats div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: baseline; }
.sheet__stats dt { color: var(--ink-3); font: 500 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.sheet__stats dd { color: var(--ink-2); overflow-wrap: break-word; min-width: 0; }
.sheet__stats a { color: var(--ink); }
.portrait__px { display: none; }
.portrait { padding: 0; border: 0; background: none; border-radius: 14px; overflow: hidden; width: 140px; height: 140px; box-shadow: 0 0 0 1px var(--line-2), 0 14px 34px rgba(0, 0, 0, 0.4); transition: transform 0.3s, box-shadow 0.3s; }
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.9); transition: transform 0.4s; }
.portrait:hover { transform: rotate(-2deg) scale(1.03); box-shadow: 0 0 0 1px var(--accent), 0 14px 34px rgba(0, 0, 0, 0.4); }
.portrait.is-voxel img { filter: none; image-rendering: pixelated; }

/* lists */
.pubs { display: grid; }
/* game.css has an unrelated .ach (the 3D achievements grid): neutralise it for the papers */
.pubs .pub.ach { display: grid; grid-template-rows: none; align-items: start; column-gap: 16px; padding: 14px 12px; border: 0; border-radius: 12px; background: none; opacity: 1; }
.pubs .ach__icon { grid-row: auto; }
.pubs .ach b { font-size: inherit; }
.pub > *, .row > * { min-width: 0; }
.pub { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; padding: 14px 12px; margin: 0 -12px; border-radius: 12px; }
.pub + .pub { margin-top: 2px; }
.pub__year { padding-top: 3px; color: var(--ink-3); font: 500 14px var(--mono); }
.pub__title { font-weight: 600; line-height: 1.4; }
.pub__authors { margin-top: 4px; color: var(--ink-2); }
.pub__meta { margin-top: 4px; color: var(--ink-3); font-size: 15px; }
.pub__note { color: var(--ink-3); font-size: 14px; }
.pub__status { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: 13px; }

.rows { display: grid; gap: 2px; }
.row { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 18px; align-items: start; padding: 14px 12px; margin: 0 -12px; border-radius: 12px; }
.row__logo { display: flex; align-items: center; min-height: 26px; padding-top: 2px; }
.row__logo img { width: auto; max-width: 120px; max-height: 30px; height: auto; }
.row__logo--mono img { filter: brightness(0) invert(1); opacity: 0.88; }
.row__logo--icon { gap: 8px; font-weight: 500; }
.row__logo--icon img { width: 26px; height: 26px; border-radius: 6px; filter: grayscale(1) brightness(1.15); opacity: 0.88; }
.row__title { font-weight: 600; }
.row__role { display: block; font-weight: 400; color: var(--ink-2); }
.row__desc { margin-top: 4px; color: var(--ink-2); font-size: 15.5px; }
.row__when { color: var(--ink-3); font-size: 13.5px; font-family: var(--mono); white-space: nowrap; padding-top: 3px; }
.row--project { grid-template-columns: minmax(0, 1fr) auto; }
.equip__item { display: block; }
.equip__front { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.equip__sub { color: var(--ink-3); font-size: 13.5px; }
.equip__back { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line-2); color: var(--ink-2); font-size: 15px; }
.equip__k { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.equip__type { margin-top: 2px; color: var(--ink-3); font-size: 13.5px; }
.row__title a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.row__title a img { filter: invert(1); opacity: 0.5; }
.row__title a:hover { text-decoration: underline; }
.row__tags { display: flex; gap: 8px; padding-top: 4px; }
.row__tags img { filter: invert(1); opacity: 0.65; }

/* cards and rows that the world points at */
[data-focus] { transition: background-color 0.25s, box-shadow 0.25s; cursor: default; }
[data-focus]:hover, [data-focus]:focus-visible, [data-focus].is-lit, [data-focus].is-current { background: rgba(242, 184, 75, 0.08); box-shadow: inset 3px 0 0 var(--accent); outline: none; }
[data-focus].is-ping { animation: ping 1.2s ease; }
@keyframes ping { 0% { background: rgba(242, 184, 75, 0.4); } 100% { background: rgba(242, 184, 75, 0); } }

.toolbox { margin: 18px -12px 0; padding: 14px 12px 4px; border-top: 1px solid var(--line); border-radius: 12px; }
.toolbox__label { margin-bottom: 8px; font: 500 12px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.tools { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.tools li { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 14.5px; }
.attr__tier { color: var(--ink-3); font-size: 13px; }
.attr__tier::before { content: '· '; }
.tools img { filter: invert(1); opacity: 0.8; }

.eggline { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.linkish { padding: 0; background: none; border: 0; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.2em; }
.linkish:hover { color: var(--ink); text-decoration-color: var(--accent); }
.linkish b { color: #a3e635; }

/* ---------------- structure shared by every mode (the clean CV) ---------------- */
/* game-only DOM is invisible to no-JS, Reviewer mode and print */
html:not(.is-game) [data-game] { display: none !important; }
html:not(.is-game) .game-only { display: none !important; }
html.is-game .plain-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head .tag { margin-bottom: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: 12.5px; line-height: 1.5; text-decoration: none; white-space: nowrap; background: none; }
.pub__meta .chip { margin-left: 6px; vertical-align: 1px; }
.pub__more { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; }
.pub__more details { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.pub__more details[open] { flex-basis: 100%; }
details.more > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-3); font-size: 13.5px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary:hover { color: var(--ink); }
details.more > :not(summary) { margin-top: 6px; color: var(--ink-2); font-size: 14.5px; }
details.more pre { max-width: 100%; overflow-x: auto; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); font: 400 12px/1.55 var(--mono); color: var(--ink-2); }
.quest__more { margin-top: 6px; }
.quest__notes { font-style: italic; }
.quest__objs { display: grid; gap: 2px; padding-left: 18px; list-style: disc; }
.quest__rewards { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.mailline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.hero__name.is-alias .hero__name-t { color: inherit; }
.hero__name.is-alias .hero__blocks { visibility: hidden; }
.bar__lv { display: none; }
.bar__plain-l { font-size: 13px; }

/* footer */
.foot { position: relative; z-index: 10; padding: 28px var(--gutter) 44px; color: var(--ink-3); font-size: 13.5px; background: linear-gradient(180deg, transparent, rgba(7, 10, 18, 0.9) 60%); }
.foot p { max-width: 62em; }
.foot p + p { margin-top: 6px; }
.foot a { color: var(--ink-2); }

/* ---------------- egg toasts, Field Notes, terminal ---------------- */
.egg-toasts { position: fixed; z-index: 90; right: 18px; top: calc(var(--bar-h) + 14px); display: grid; gap: 8px; width: min(340px, calc(100vw - 36px)); pointer-events: none; }
html.is-play .egg-toasts { top: max(76px, var(--toast-top, 0px)); right: 20px; }  /* below the quest tracker (hud.js) */
.egg-toast {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 44, 20, 0.92), rgba(12, 18, 12, 0.92)); border: 1px solid rgba(163, 230, 53, 0.45);
  backdrop-filter: blur(12px); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45), 0 0 26px rgba(163, 230, 53, 0.16);
  opacity: 0; transform: translateX(24px) scale(0.96); transition: opacity 0.35s, transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.egg-toast.is-in { opacity: 1; transform: none; }
.egg-toast.is-out { opacity: 0; transform: translateX(24px); }
.egg-toast svg { color: #a3e635; filter: drop-shadow(0 0 8px rgba(163, 230, 53, 0.6)); }
.egg-toast__k { font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #bef264; }
.egg-toast__t { font-weight: 600; font-size: 15px; line-height: 1.25; }
.egg-toast__s { color: var(--ink-2); font-size: 13px; line-height: 1.35; margin-top: 1px; }

.notes {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(4, 6, 12, 0.8);
  opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s;
}
.notes.is-open { opacity: 1; visibility: visible; }
.notes__panel { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 20px; background: linear-gradient(180deg, #111726, #0b0f1a); border: 1px solid var(--line-2); box-shadow: 0 40px 100px rgba(0, 0, 0, 0.65); padding: 24px 26px 26px; }
.notes__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.notes__title { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.05; }
.notes__sub { margin-top: 4px; color: var(--ink-3); font-size: 14px; }
.notes__x { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: transparent; border: 1px solid var(--line); }
.notes__x:hover { border-color: var(--line-2); }
.notes__x img { filter: invert(1); }
.notes__meter { display: flex; align-items: center; gap: 12px; margin: 16px 0 14px; font: 500 13px var(--mono); color: var(--ink-2); }
.notes__bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.notes__bar i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, #65a30d, #bef264); transition: transform 0.6s; }
.notes__list { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.note { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); }
.note svg { margin-top: 2px; color: var(--ink-3); opacity: 0.55; }
.note.is-found { border-color: rgba(163, 230, 53, 0.35); background: rgba(163, 230, 53, 0.05); }
.note.is-found svg { color: #a3e635; opacity: 1; filter: drop-shadow(0 0 5px rgba(163, 230, 53, 0.5)); }
.note__t { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.note__s { color: var(--ink-3); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.note:not(.is-found) .note__t { color: var(--ink-2); letter-spacing: 0.1em; }
.notes__foot { margin-top: 14px; color: var(--ink-3); font-size: 13px; }
.notes__tabs { display: flex; gap: 4px; margin: 16px 0 0; border-bottom: 1px solid var(--line); }
.notes__tab { position: relative; padding: 8px 14px; background: none; border: 0; color: var(--ink-3); font: 400 11px var(--px, var(--mono)); letter-spacing: 0.12em; text-transform: uppercase; }
.notes__tab:hover { color: var(--ink); }
.notes__tab.is-on { color: var(--gold, var(--accent)); }
.notes__tab.is-on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--gold, var(--accent)); }
.notes__pane[hidden] { display: none; }
.notes__group + .notes__group { margin-top: 16px; }
.notes__gh { margin: 0 0 8px; font: 400 10.5px var(--px, var(--mono)); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.np__head { display: grid; gap: 8px; margin-top: 16px; padding: 14px 16px; border-radius: 10px; background: linear-gradient(180deg, rgba(24, 43, 73, 0.55), rgba(15, 29, 51, 0.4)); border: 1px solid rgba(255, 205, 0, 0.18); }
.np__lv { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.np__lvn { padding: 5px 6px 4px; border-radius: 2px; font: 400 10px/1 var(--px-num, var(--mono)); color: var(--gold, var(--accent)); background: var(--ucsd-navy, var(--navy)); border: 1px solid rgba(255, 205, 0, 0.45); }
.np__lvt { font: 400 18px var(--px-title, var(--sans)); }
.np__meter { display: grid; grid-template-columns: 56px 1fr 84px; gap: 10px; align-items: center; font: 400 10px var(--px, var(--mono)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.np__track { position: relative; height: 8px; background: rgba(255, 255, 255, 0.07); -webkit-mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); }
.np__track i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--v, 0)); background: var(--c, #FFCD00); }
.np__meter--hp { --c: #4ADE80; } .np__meter--focus { --c: #818CF8; } .np__meter--xp { --c: #FFCD00; }
.np__v { text-align: right; font-variant-numeric: tabular-nums; }
.np__cash { font-size: 13px; color: var(--ink-3); }
.np__cash b { margin-right: 6px; font: 400 11px var(--px-num, var(--mono)); color: #FFCD00; }
.np__sec { margin-top: 18px; }
.np__chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.np__chapters li { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px 6px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.np__chapters li.is-done { border-color: rgba(255, 205, 0, 0.35); color: var(--ink); }
.np__box { display: grid; place-items: center; width: 16px; height: 16px; border: 1.5px solid var(--line-2); border-radius: 3px; font-size: 11px; color: #FFCD00; }
.is-done .np__box { border-color: #FFCD00; }
.np__go { height: 26px; padding: 0 10px; border-radius: 4px; border: 1px solid var(--line-2); background: none; font: 400 10px var(--px, var(--mono)); letter-spacing: 0.08em; text-transform: uppercase; }
.np__go:hover { border-color: #FFCD00; }
.np__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.np__stat { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.np__stat dt { font: 400 9.5px var(--px, var(--mono)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.np__stat dd { margin-top: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.np__hint { margin: 8px 0 14px; font-size: 13px; color: var(--ink-3); }
.np__bugs { display: flex; flex-wrap: wrap; gap: 6px; }
.np__bugs li { display: inline-flex; gap: 8px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.np__bugs li.is-done { color: var(--ink); border-color: rgba(74, 222, 128, 0.4); }
.np__toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.np__toggle { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); text-align: left; font-size: 14px; }
.np__toggle:hover { border-color: var(--line-2); }
.np__sw { position: relative; flex: none; width: 30px; height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); transition: background-color 0.2s; }
.np__sw::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink-2); transition: transform 0.2s; }
.np__toggle[aria-pressed='true'] .np__sw { background: #00C6D7; }
.np__toggle[aria-pressed='true'] .np__sw::after { transform: translateX(14px); background: #fff; }
.np__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.np__confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.np__confirm--red { color: #fca5a5; }

.term {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 110; height: min(46vh, 420px); display: flex; flex-direction: column;
  background: rgba(6, 9, 16, 0.96); border-top: 1px solid rgba(163, 230, 53, 0.4);
  font: 400 14px/1.55 var(--mono); color: #d9f99d; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(102%); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.term.is-open { transform: none; }
.term__bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }
.term__dots { display: inline-flex; gap: 6px; }
.term__dots i { width: 10px; height: 10px; border-radius: 50%; background: #3b4256; }
.term__dots i:first-child { background: #f87171; cursor: pointer; }
.term__out { flex: 1; overflow: auto; padding: 12px 16px; white-space: pre-wrap; word-break: break-word; }
.term__out .dim { color: var(--ink-3); }
.term__out .err { color: #fca5a5; }
.term__out .hi { color: #fde68a; }
.term__out .cmd { color: #fff; }
.term__in { display: flex; gap: 8px; align-items: center; padding: 8px 16px 12px; border-top: 1px solid var(--line); }
.term__in span { color: #a3e635; white-space: nowrap; }
.term__in input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; caret-color: #a3e635; }

/* misc world-adjacent bits */
.confetti { position: fixed; z-index: 100; top: -20px; width: 10px; height: 14px; pointer-events: none; will-change: transform; }
html.modal-open { overflow: hidden; }
body.is-glitch #page { filter: hue-rotate(90deg) saturate(1.6); }

/* ---------------- responsive ---------------- */
@media (max-width: 1440px) { .bar__zone { display: none; } }
@media (max-width: 1240px) {
  .bar__zone { display: none; }
  .bar { gap: 14px; }
  .bar__nav a { padding: 6px 9px; }
}
@media (max-width: 860px) {
  :root { --bar-top: 52px; }
  .bar { gap: 10px; }
  .bar__burger { display: grid; place-items: center; width: 36px; height: 34px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; margin-left: auto; order: 5; }
  .bar__burger img { filter: invert(1); opacity: 0.9; }
  .bar__tools { margin-left: 0; order: 4; }
  .bar__nav { display: none; position: absolute; left: 12px; right: 12px; top: calc(var(--bar-h) + 6px); flex-direction: column; align-items: stretch; gap: 2px; margin: 0; padding: 10px; border-radius: 16px; background: rgba(14, 19, 33, 0.97); border: 1px solid var(--line-2); }
  .bar__nav a { padding: 10px 12px; }
  .bar__toggle:checked ~ .bar__nav { display: flex; }
  .bar__name { display: none; }
  .bar__play { display: none; }
  .scene { align-items: flex-end; padding-top: calc(var(--bar-h) + 20px); padding-bottom: 28px; }
  .scene--hero { padding-bottom: 76px; }
  .card { padding: 22px 20px 24px; border-radius: 18px; }
  .card h2 { font-size: 34px; }
  #world::after, body[data-side='right'] #world::after { background: linear-gradient(0deg, rgba(7, 10, 18, 0.8) 0%, rgba(7, 10, 18, 0.4) 30%, rgba(7, 10, 18, 0) 55%); }
  .sheet { grid-template-columns: 1fr; }
  .sheet__side { order: -1; width: auto; grid-template-columns: 96px 1fr; align-items: start; }
  .portrait { width: 96px; height: 96px; }
  .sheet__stats { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 10px 16px; width: 100%; }
  .sheet__stats div { grid-template-columns: 1fr; gap: 0; }
  .equip__front { grid-template-columns: 1fr; gap: 6px; }
  .bar__plain-l { display: none; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row__when { padding-top: 0; }
  .row--project { grid-template-columns: minmax(0, 1fr) auto; }
.equip__item { display: block; }
.equip__front { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.equip__sub { color: var(--ink-3); font-size: 13.5px; }
.equip__back { margin: 8px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line-2); color: var(--ink-2); font-size: 15px; }
.equip__k { font: 500 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.equip__type { margin-top: 2px; color: var(--ink-3); font-size: 13.5px; }
  .pub { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
  .pubs .pub.ach { column-gap: 12px; }
  .hero__name { font-size: clamp(56px, 19vw, 96px); }
  .hero__hint .keys { display: none; }
  .scroll-cue { bottom: 18px; }
  .notes__list { grid-template-columns: 1fr; }
  .np__stats, .np__toggles, .np__chapters { grid-template-columns: 1fr 1fr; }
  .np__meter { grid-template-columns: 48px 1fr 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .card:not(.is-in) { opacity: 1; transform: none; }
  .card { transition: none; }
  .pip, .scroll-cue span, .hero__hint .keys kbd { animation: none; }
  html:not(.is-booting) .hero > * { animation: none; }
}

@media print {
  .hero__cn { color: #333; -webkit-text-fill-color: #333; }
  #world, .bar, .scroll-cue, .egg-toasts, .term, .notes, #game-root, .hero__hint, .hero__boot, .eggline, .fx-layer, [data-game], .game-only { display: none !important; }
  body { background: #fff; color: #000; }
  .page { pointer-events: auto; }
  .scene { min-height: 0; padding: 12px 0; display: block; }
  .card { width: auto; opacity: 1; transform: none; background: none; border: 0; box-shadow: none; backdrop-filter: none; padding: 0; }
  .hero { opacity: 1; transform: none; text-shadow: none; }
  .hero__name { color: #000; background: none; -webkit-text-fill-color: #000; filter: none; font-size: 48px; }
  img { filter: none !important; }
  * { color: #000 !important; }
}
html:not(.js) .bar__plain, html:not(.js) .bar__eggs, html:not(.js) #sound-btn { display: none; }

/* long BibTeX lines scroll inside their box instead of widening the page */
.pub, .pub > div, .ach__body, .pub__more, .pub__more details { min-width: 0; max-width: 100%; }
.pub pre { max-width: 100%; overflow-x: auto; }
html, body { overflow-x: clip; }

/* ---------------- phones: the bar fits (avatar + icon buttons), readable labels, one toast at a time ---------------- */
@media (max-width: 719px) {
  .bar { gap: 6px; padding: 0 12px; }
  .bar__brand, .bar__tools { min-width: 0; }
  .bar__id { display: none; }
  .bar__tools { gap: 5px; }
  .bar__btn { height: 36px; padding: 0 9px; gap: 5px; }
  #plain-btn, #sound-btn { width: 36px; padding: 0; justify-content: center; }
  .bar__burger { flex: none; width: 40px; height: 36px; margin-left: auto; }
  /* the gamepad stays: the one-tap way into play mode on phones */
  html .bar__play:not([hidden]) { display: inline-flex; width: 36px; padding: 0; justify-content: center; }
  .bar__play span, .bar__play kbd { display: none; }
  html:not(.is-play) .egg-toasts { top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 12px; right: 12px; width: auto; }
  .egg-toasts > :not(:last-child) { display: none; }
  .term input { font-size: 16px; }
}
@media (max-width: 380px) { .bar__btn { padding: 0 7px; } .bar__tools { gap: 4px; } }
.term__x { margin-left: auto; width: 40px; height: 36px; border: 0; background: none; color: var(--ink); font-size: 24px; line-height: 1; }
.notes__touch { display: flex; gap: 8px; margin: 10px 0 4px; }
@media (pointer: coarse) { .term { height: min(388px, 55dvh); } }

/* ---------------- footer visitor map: a small widget in the corner, dressed like the bar's buttons ---------------- */
.foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 28px; align-items: end; }
.foot > p { grid-column: 1; }
.vmap { grid-column: 2; grid-row: 1 / span 3; align-self: end; position: relative; width: 236px; padding: 8px 9px 7px; border-radius: 10px;
  background: rgba(7, 10, 18, 0.62); border: 1px solid var(--line); }
.vmap:empty { display: none; }
.vmap__c { display: block; width: 100%; height: auto; }
.vmap__stats { display: flex; align-items: center; gap: 5px; margin: 6px 1px 0; font: 400 9px/1.2 var(--px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); cursor: help; }
.vmap__stats b { font: 400 9px/1 var(--px-num); color: var(--ink); }
.vmap__latest { margin: 3px 1px 0; font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmap__latest span { color: var(--ink-2); }
.vmap__live { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--gold, #ffcd00); box-shadow: 0 0 6px var(--gold, #ffcd00); animation: vmap-live 1.6s ease-in-out infinite; }
@keyframes vmap-live { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .vmap__live { animation: none; } }
.vmap__tip { position: absolute; z-index: 2; bottom: calc(100% + 6px); right: 0; padding: 5px 9px; border-radius: 8px; background: rgba(7, 10, 18, 0.94); border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); white-space: nowrap; pointer-events: none; }
.vmap__tip b { color: var(--ink); font-weight: 600; margin-right: 4px; }
.vmap__tip[hidden] { display: none; }
@media (max-width: 719px) { .foot { grid-template-columns: 1fr; } .vmap { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 12px; width: min(236px, 100%); } }
