/* GrimSec Ops — site design system
   Layout follows the single-frame + floating-dock pattern; identity is ours:
   graphite & bone, phosphor green used only as a signal, Chakra Petch display. */

:root {
  --font-display: "Chakra Petch", "IBM Plex Sans", "Noto Sans Thai", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0b0d10;
  --bg-2: #0e1115;
  --surface: #12151a;
  --raised: #181c22;
  --line: rgba(233, 236, 230, 0.09);
  --line-strong: rgba(233, 236, 230, 0.18);
  --text: #e9ece6;
  --text-2: #b8bdb6;
  --muted: #858c95;
  --faint: #5a616a;
  --accent: #66f0a3;
  --accent-2: #3ccf80;
  --accent-ink: #07130c;
  --accent-soft: rgba(102, 240, 163, 0.12);
  --accent-line: rgba(102, 240, 163, 0.35);
  --grid-line: rgba(102, 240, 163, 0.075);
  --glow: rgba(102, 240, 163, 0.17);
  --danger: #ff5c6c;
  --frame-bg: rgba(18, 21, 26, 0.82);
  --dock-bg: rgba(18, 21, 26, 0.78);
  --shadow: 0 30px 90px -40px rgba(0, 0, 0, 0.8);
  --chip-sat: 70%;
  --chip-l: 72%;
  --chip-bg-a: 0.13;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f1f2ec;
  --bg-2: #e9ebe4;
  --surface: #fbfbf8;
  --raised: #ffffff;
  --line: rgba(20, 23, 28, 0.1);
  --line-strong: rgba(20, 23, 28, 0.22);
  --text: #14171c;
  --text-2: #3a3f47;
  --muted: #5f666f;
  --faint: #9096a0;
  --accent: #0f8f56;
  --accent-2: #0b7a49;
  --accent-ink: #f4fff8;
  --accent-soft: rgba(15, 143, 86, 0.1);
  --accent-line: rgba(15, 143, 86, 0.4);
  --grid-line: rgba(15, 143, 86, 0.11);
  --glow: rgba(15, 143, 86, 0.14);
  --danger: #c8202f;
  --frame-bg: rgba(251, 251, 248, 0.86);
  --dock-bg: rgba(251, 251, 248, 0.82);
  --shadow: 0 30px 80px -40px rgba(20, 23, 28, 0.35);
  --chip-l: 32%;
  --chip-bg-a: 0.1;
  color-scheme: light;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
.ico { width: 1em; height: 1em; flex: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-glow {
  position: absolute; left: 50%; top: -34vh; width: min(1100px, 150vw); height: 78vh;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent 72%);
}
.bg-grid {
  position: absolute; inset: 0; perspective: 240px; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 8%, #000 30%, #000 62%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 8%, #000 30%, #000 62%, transparent 100%);
}
.bg-grid::before {
  content: ""; position: absolute; left: -200vw; top: 0; width: 500vw; height: 300vh;
  transform-origin: 50% 0;
  transform: rotateX(62deg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: grid-drift 16s linear infinite;
}
@keyframes grid-drift { from { transform: rotateX(62deg) translateY(-64px); } to { transform: rotateX(62deg) translateY(0); } }

/* ---------- frame ---------- */
.frame {
  position: relative; z-index: 1;
  width: min(960px, calc(100% - 32px));
  margin: clamp(28px, 6vh, 64px) auto 150px;
  padding: clamp(26px, 5vw, 60px);
  background: var(--frame-bg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow);
}
.frame > * + * { margin-top: 0; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr auto; gap: clamp(20px, 5vw, 56px); align-items: start; }
.wordmark { display: inline-flex; align-items: baseline; gap: 0.32em; font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 7.4vw, 66px); line-height: 0.95; letter-spacing: -0.035em; color: var(--text); }
.wordmark small { font-size: 0.34em; letter-spacing: 0.14em; font-weight: 600; color: var(--muted); transform: translateY(-0.1em); }
.wordmark em { font-style: normal; color: var(--accent); }
.motto { margin-top: 12px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.motto::before { content: "$ "; color: var(--accent); }
.h-about { margin-top: 30px; font-size: 21px; letter-spacing: -0.02em; }
.about { margin-top: 8px; max-width: 58ch; color: var(--text-2); font-size: 15.5px; }
.readout { display: flex; flex-wrap: wrap; gap: 8px 34px; margin-top: 26px; }
.readout li { display: flex; flex-direction: column; gap: 2px; }
.readout b { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.02em; }
.readout b.up { color: var(--accent); }
.readout span { font-size: 12.5px; color: var(--muted); }
.readout-src { margin-top: 12px; font-size: 12px; color: var(--faint); }
.readout-src a { color: var(--muted); border-bottom: 1px solid var(--line-strong); }
.readout-src a:hover { color: var(--text); border-color: var(--text); }

.mark { width: clamp(96px, 16vw, 150px); aspect-ratio: 1; border-radius: 28%; background: var(--raised); border: 1px solid var(--line); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 18px 40px -24px rgba(0,0,0,.7); }
.mark svg { width: 62%; height: 62%; }
.mark .g-stroke { stroke: var(--accent); }

/* ---------- gate (the flag) ---------- */
.gate-wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; margin: 44px 0; }
.gate-wrap hr { border-top-color: var(--line-strong); }
.gate {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 18px 11px 15px; border-radius: 10px;
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; letter-spacing: 0.02em; white-space: nowrap;
  color: var(--text-2); background: var(--raised); border: 1px solid var(--line-strong);
  transition: color .25s, border-color .25s, box-shadow .35s, background .25s;
  overflow: hidden;
}
.gate::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, var(--accent-soft) 50%, transparent 70%); transform: translateY(-100%); opacity: 0; pointer-events: none; }
.gate:hover, .gate:focus-visible, .gate.is-open { color: var(--text); border-color: var(--accent-line); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft), 0 12px 30px -18px var(--accent); }
.gate.is-open::after { animation: gate-sweep 1.6s var(--ease) 1; }
@keyframes gate-sweep { 0% { transform: translateY(-100%); opacity: 1; } 100% { transform: translateY(100%); opacity: 0; } }
.gate .ico { width: 16px; height: 16px; color: var(--muted); flex: none; transition: color .25s; }
.gate .ico-open { display: none; }
.gate.is-open .ico-closed { display: none; }
.gate.is-open .ico-open { display: block; color: var(--accent); }
.gate .gate-text { min-width: 20ch; text-align: left; }
.gate.is-open .gate-text { color: var(--accent); }
.gate .gate-hint { font-size: 11px; color: var(--faint); margin-left: 6px; }
.gate.is-copied .gate-hint { color: var(--accent); }

/* ---------- sections ---------- */
.sec { margin-top: 74px; }
.sec-head { text-align: center; max-width: 60ch; margin: 0 auto 30px; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--text); color: var(--bg); font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.01em; }
.sec-head h2 { margin-top: 12px; font-size: clamp(30px, 5vw, 44px); letter-spacing: -0.03em; }
.sec-head p { margin-top: 8px; color: var(--muted); font-size: 16px; }
.sec-cta { display: flex; justify-content: center; margin-top: 26px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--raised); font-weight: 500; font-size: 14px; color: var(--text); transition: border-color .2s, background .2s, transform .2s var(--ease); }
.btn:hover { border-color: var(--text); transform: translateY(-1px); }
.btn .ico { width: 15px; height: 15px; }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-accent:hover { border-color: transparent; background: var(--accent-2); }
.btn-ghost { background: transparent; }

/* ---------- member cards + marquee ---------- */
.marquee { --gap: 14px; --dur: 46s; display: flex; overflow: hidden; gap: var(--gap); padding: 6px 0; -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
.marquee + .marquee { margin-top: 2px; }
.marquee-track { display: flex; flex: none; gap: var(--gap); min-width: 100%; animation: marquee var(--dur) linear infinite; }
.marquee.reverse .marquee-track { animation-direction: reverse; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(calc(-100% - var(--gap))); } }

.mcard {
  --h: 150;
  display: flex; flex-direction: column; gap: 12px; width: 268px; flex: none;
  padding: 14px 15px 15px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--line);
  transition: border-color .2s, transform .25s var(--ease), box-shadow .25s;
}
.mcard:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 16px 34px -24px rgba(0,0,0,.7); }
.mcard-top { display: flex; align-items: center; gap: 11px; }
.avatar { --h: 150; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25);
  background: linear-gradient(145deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 28) 55% 34%)); border: 1px solid rgba(255,255,255,.14); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.avatar.lg { width: 84px; height: 84px; border-radius: 22px; font-size: 34px; }
.avatar.xl { width: 104px; height: 104px; border-radius: 26px; font-size: 42px; }
.mcard-name { font-family: var(--font-display); font-weight: 600; font-size: 16.5px; letter-spacing: -0.01em; line-height: 1.15; display: flex; align-items: center; gap: 8px; }
.mcard-handle { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.lead-tag { display: inline-flex; align-items: center; gap: 4px; }
.lead-tag .ico { width: 10px; height: 10px; }
.lead-tag {  font-family: var(--font-display); font-weight: 600; font-size: 10.5px; letter-spacing: 0.06em; color: var(--accent); padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { --h: 200; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 500; line-height: 1.5; color: hsl(var(--h) var(--chip-sat) var(--chip-l)); background: hsl(var(--h) var(--chip-sat) 55% / var(--chip-bg-a)); }
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.chip.plain::before { display: none; }

/* ---------- contests timeline ---------- */
.timeline { position: relative; padding-left: 0; }
.ev { display: grid; grid-template-columns: 44px 1fr; gap: 16px; position: relative; padding: 0 0 26px; }
.ev::before { content: ""; position: absolute; left: 21px; top: 50px; bottom: -4px; border-left: 1px dashed var(--line-strong); }
.ev:last-child::before { display: none; }
.ev-logo { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; border: 1px solid var(--line-strong); background: var(--raised); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--muted); flex: none; }
.ev-logo img { width: 100%; height: 100%; object-fit: cover; }
.ev-card { border: 1px solid var(--line); border-radius: 14px; background: var(--raised); padding: 14px 16px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: start; transition: border-color .2s; }
.ev-card:hover { border-color: var(--line-strong); }
.ev-date { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ev-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; margin-top: 4px; line-height: 1.2; }
.ev-title a:hover { color: var(--accent); }
.ev-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ev-meta .ico { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; opacity: .8; }
.rank { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 7px; font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.01em; background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); }
.rank .ico { width: 12px; height: 12px; }
.rank.t10 { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.rank.t50 { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.ev-stats { display: grid; grid-template-columns: auto auto; gap: 4px 18px; text-align: right; align-self: center; }
.ev-stats b { display: block; font-family: var(--font-mono); font-weight: 500; font-size: 15px; letter-spacing: -0.01em; }
.ev-stats span { display: block; font-size: 11.5px; color: var(--muted); }
.ev-link { grid-column: 1 / -1; justify-self: end; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ev-link:hover { color: var(--accent); }
.ev-link .ico { width: 12px; height: 12px; }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; max-width: 640px; margin: 0 auto; }
.ccard { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised); text-align: left; width: 100%; transition: border-color .2s, transform .2s var(--ease); }
.ccard:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.ccard .ico { width: 22px; height: 22px; flex: none; color: var(--muted); }
.ccard b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.ccard span { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.ccard .act { margin-left: auto; font-size: 12px; color: var(--faint); flex: none; }
.ccard.is-copied .act { color: var(--accent); }
.contact-note { text-align: center; color: var(--muted); font-size: 14.5px; max-width: 54ch; margin: 22px auto 0; }

/* ---------- footer ---------- */
.foot { margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; font-size: 12.5px; color: var(--muted); }
.foot nav { display: flex; gap: 16px; }
.foot a:hover { color: var(--text); }
.foot .motto { margin: 0; font-size: 12px; }

/* ---------- dock ---------- */
.dock-wrap { position: fixed; left: 0; right: 0; bottom: 22px; z-index: 40; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.dock-fade { position: fixed; left: 0; right: 0; bottom: 0; height: 90px; z-index: 39; pointer-events: none; background: linear-gradient(to top, var(--bg), transparent); opacity: .85; }
.dock { pointer-events: auto; display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px; background: var(--dock-bg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line-strong); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 40px -20px rgba(0,0,0,.7); animation: dock-in .7s var(--ease) both; }
@keyframes dock-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.dock hr { width: 1px; height: 26px; border: 0; border-left: 1px solid var(--line-strong); margin: 0 5px; }
.dock-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--text-2); transition: background .2s, color .2s, transform .25s var(--ease); }
.dock-btn:hover { background: var(--accent-soft); color: var(--text); transform: translateY(-2px); }
.dock-btn .ico { width: 20px; height: 20px; }
.dock-btn.is-active { color: var(--accent); }
.dock-btn.is-active::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.dock-btn[data-tip]::before { content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px); padding: 4px 9px; border-radius: 7px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .2s var(--ease); }
.dock-btn:hover::before, .dock-btn:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }
.dock-btn .ico-sun { display: none; }
html[data-theme="light"] .dock-btn .ico-moon { display: none; }
html[data-theme="light"] .dock-btn .ico-sun { display: block; }

/* ---------- page header (inner pages) ---------- */
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumb:hover { color: var(--text); }
.crumb .ico { width: 14px; height: 14px; }
.page-head { margin-top: 18px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.page-head h1 { font-size: clamp(32px, 5vw, 46px); letter-spacing: -0.03em; }
.page-head p { margin-top: 8px; color: var(--muted); max-width: 56ch; }
.page-head .count { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* roster */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 26px; }
.fbtn { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; color: var(--text-2); background: var(--raised); transition: border-color .15s, color .15s, background .15s; }
.fbtn:hover { border-color: var(--line-strong); color: var(--text); }
.fbtn.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 18px; }
.roster .mcard { width: auto; }
.roster .mcard.is-hidden { display: none; }
.roster-empty { display: none; color: var(--muted); text-align: center; padding: 40px 0; }
.roster-empty.is-visible { display: block; }
.mcard-role { font-size: 13px; color: var(--muted); margin-top: -4px; }

/* profile */
.profile-head { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; margin-top: 26px; }
.profile-head h1 { font-size: clamp(34px, 5.5vw, 52px); letter-spacing: -0.03em; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.profile-head .title { color: var(--muted); font-size: 16px; margin-top: 4px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.profile-actions .btn { padding: 8px 14px; font-size: 13px; }
.profile-actions .btn .ico { width: 14px; height: 14px; }
.pgrid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px 40px; margin-top: 40px; }
.pblock h2 { font-size: 15px; letter-spacing: 0.02em; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.pblock p { color: var(--text-2); }
.pblock .chips .chip { font-size: 13px; padding: 4px 10px; }
.quote { margin-top: 22px; padding: 16px 18px; border-left: 2px solid var(--accent); background: var(--accent-soft); border-radius: 0 12px 12px 0; font-size: 16px; line-height: 1.55; }
.quote cite { display: block; margin-top: 8px; font-style: normal; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.results { display: grid; gap: 8px; }
.results li { display: flex; justify-content: space-between; gap: 14px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); font-size: 14px; }
.results li b { font-family: var(--font-display); font-weight: 600; }
.results li span { color: var(--muted); text-align: right; }
.tools { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.tools li::before { content: "› "; color: var(--accent); }
.pnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.pnav a { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; max-width: 48%; }
.pnav a:hover { color: var(--text); }
.pnav a .ico { width: 14px; height: 14px; flex: none; }
.pnav a b { display: block; color: var(--text); font-family: var(--font-display); font-weight: 600; }
.pnav .next { text-align: right; margin-left: auto; }
.pnav .avatar { width: 34px; height: 34px; border-radius: 9px; font-size: 14px; }

/* contests page */
.best { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 26px; }
.best a { display: flex; flex-direction: column; gap: 6px; padding: 14px 15px; border-radius: 12px; border: 1px solid var(--line); background: var(--raised); transition: border-color .2s; }
.best a:hover { border-color: var(--accent-line); }
.best .rank { align-self: flex-start; }
.best b { font-family: var(--font-display); font-weight: 600; font-size: 15px; line-height: 1.2; }
.best span { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.tbl-wrap { margin-top: 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.tbl th { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--accent-soft); }
.tbl .num { text-align: right; font-family: var(--font-mono); font-size: 13.5px; white-space: nowrap; }
.tbl .num.dim { color: var(--muted); }
.tbl .date { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tbl .evt { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.tbl .evt .ev-logo { width: 28px; height: 28px; font-size: 12px; }
.tbl .evt a:hover { color: var(--accent); }
.tbl .evt small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.tbl-note { font-size: 12.5px; color: var(--faint); margin-top: 12px; }
.tbl-note a { color: var(--muted); border-bottom: 1px solid var(--line-strong); }

/* ---------- command palette ---------- */
.pal { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; background: rgba(5, 7, 9, 0.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.pal.is-open { display: flex; }
.pal-box { width: min(560px, 100%); border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); overflow: hidden; animation: pal-in .18s var(--ease) both; }
@keyframes pal-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pal-in .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pal-in input { flex: 1; background: none; border: 0; outline: 0; font: inherit; font-size: 16px; color: var(--text); }
.pal-in kbd { font-family: var(--font-mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 10px; text-align: left; }
.pal-item.is-sel, .pal-item:hover { background: var(--accent-soft); }
.pal-item .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.pal-item .ev-logo { width: 30px; height: 30px; font-size: 12px; }
.pal-item b { display: block; font-weight: 500; font-size: 14.5px; }
.pal-item span { display: block; font-size: 12px; color: var(--muted); }
.pal-item .kind { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); flex: none; }
.pal-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }

/* 404 */
.nf { text-align: center; padding: 40px 0 20px; }
.nf h1 { font-size: clamp(60px, 14vw, 120px); letter-spacing: -0.05em; color: var(--accent); line-height: 1; }
.nf p { color: var(--muted); margin-top: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; position: relative; }
  .hero-side { position: absolute; right: 0; top: -4px; }
  .hero .mark { width: 56px; border-radius: 16px; }
  .wordmark { padding-right: 70px; flex-wrap: wrap; }
  .gate-wrap { grid-template-columns: 1fr; gap: 14px; }
  .gate-wrap hr:last-child { display: none; }
  .gate { justify-content: center; width: 100%; }
  .gate .gate-text { min-width: 0; }
  .ev-card { grid-template-columns: 1fr; }
  .ev-stats { text-align: left; grid-template-columns: auto auto; justify-content: start; }
  .ev-link { justify-self: start; }
  .pgrid { grid-template-columns: 1fr; }
  .profile-head { grid-template-columns: 1fr; }
  .dock-btn { width: 40px; height: 40px; }
  .dock hr { margin: 0 2px; }
  .dock-btn[data-tip]::before { display: none; }
  .frame { margin-bottom: 120px; }
}
@media (max-width: 420px) {
  .readout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
  .readout b { font-size: 22px; }
  .dock-btn { width: 36px; height: 36px; }
  .dock-btn .ico { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg-grid::before, .marquee-track, .dock, .gate::after, .pal-box { animation: none !important; }
  .marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  * { transition-duration: 0.01ms !important; }
}
