/* Overprint Games. Themes are set in Admin. Every colour below is a token, so a theme only redefines tokens. */
@font-face { font-family: 'Unbounded'; font-weight: 800; font-style: normal; font-display: swap; src: url('/assets/fonts/unbounded-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Unbounded'; font-weight: 500; font-style: normal; font-display: swap; src: url('/assets/fonts/unbounded-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/dm-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url('/assets/fonts/dm-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 600; font-style: normal; font-display: swap; src: url('/assets/fonts/sora-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fonts/sora-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 800; font-style: normal; font-display: swap; src: url('/assets/fonts/sora-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/figtree-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 500; font-style: normal; font-display: swap; src: url('/assets/fonts/figtree-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-style: normal; font-display: swap; src: url('/assets/fonts/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fonts/figtree-latin-700-normal.woff2') format('woff2'); }

/* Theme: overprint (default). Dark indigo paper, coral and aqua inks. */
:root {
  --bg: #12102b;
  --surface: #1a1740;
  --text: #efe9ff;
  --muted: #9a95c8;
  --accent: #2fe3d0;
  --accent-2: #ff5a6e;
  --accent-3: #7c6cff;
  --gold: #ffc93c;
  --strong: #efe9ff;
  --on-strong: #12102b;
  --on-accent: #12102b;
  --on-gold: #12102b;
  --line: rgba(124, 108, 255, 0.3);
  --line-strong: rgba(124, 108, 255, 0.6);
  --me-bg: rgba(47, 227, 208, 0.08);
  --header-bg: #12102b;
  --r: 0;
  --lift-btn: translate(-2px, -2px);
  --lift-card: translate(-3px, -3px);
  --shadow-btn: 4px 4px 0 var(--accent);
  --shadow-btn-alt: 4px 4px 0 var(--accent-2);
  --shadow-card: 6px 6px 0 var(--accent-2);
  --font-display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--text); }
img { max-width: 100%; height: auto; display: block; }
code { font: inherit; background: var(--surface); padding: 1px 6px; border: 1px solid var(--line); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim { color: var(--muted); }
.small { font-size: 12.5px; }
.lbl { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.kicker { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.kicker a { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--strong); color: var(--on-strong); padding: 8px 14px; z-index: 50; }
.skip:focus { left: 8px; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main.wrap { padding-block: 28px 56px; }
.narrow { max-width: 560px; margin: 0 auto; }
.narrow.wide { max-width: 760px; }

.h1 { margin: 0 0 14px; font: 800 clamp(26px, 5.4vw, 42px)/1.1 var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
.h2 { margin: 36px 0 14px; font: 800 clamp(18px, 3.4vw, 24px)/1.2 var(--font-display); }
.h3 { margin: 0 0 8px; font: 800 14px/1.3 var(--font-display); letter-spacing: 0.02em; }
.lede { margin: 0 0 18px; font-size: 15.5px; max-width: 58ch; }
.mis { text-shadow: 3px 2px 0 var(--accent-2), -3px -2px 0 var(--accent); }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--header-bg); padding-top: env(safe-area-inset-top, 0px); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { width: 34px; height: 22px; }
.brand-name { font: 800 15px var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; }
.brand-sub { font: 500 10.5px var(--font-mono); letter-spacing: 0.34em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; font-size: 13px; }
.nav a, .navbtn { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; }
.nav a:hover, .navbtn:hover { color: var(--accent); }
.nav a.btn, .nav a.btn:hover { color: var(--on-strong); }
.nav i { color: var(--muted); }
.navbtn { background: none; border: 0; font: inherit; cursor: pointer; }
.inline { display: inline; margin: 0; }

/* buttons and chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: 500 12.5px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--on-strong); background: var(--strong); border: 1px solid var(--strong);
  padding: 13px 22px; cursor: pointer; text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover:not(:disabled) { color: var(--on-strong); transform: var(--lift-btn); box-shadow: var(--shadow-btn); }
.btn.alt { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.alt:hover:not(:disabled) { color: var(--text); box-shadow: var(--shadow-btn-alt); }
.btn.small { padding: 8px 14px; font-size: 11px; }
.btn.danger-btn { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn.danger-btn:hover:not(:disabled) { box-shadow: var(--shadow-btn-alt); }
.btn:disabled { opacity: 0.45; cursor: default; }
.chip { font: 500 11.5px var(--font-mono); letter-spacing: 0.06em; color: var(--muted); background: transparent; border: 1px solid var(--line); padding: 7px 12px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.chip:hover { color: var(--text); border-color: var(--accent-3); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

/* flashes */
.flash { margin: 16px 0 0; padding: 10px 14px; border: 1px solid var(--line-strong); border-left-width: 4px; background: var(--surface); font-size: 13.5px; }
.flash-ok { border-left-color: var(--accent); }
.flash-err { border-left-color: var(--accent-2); }
.flash-info { border-left-color: var(--gold); }
.narrow .flash, .gamepage .flash { margin: 0 0 18px; }

/* hero */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); padding: 28px 0 8px; overflow: hidden; }
.hero-text { position: relative; z-index: 1; max-width: 640px; }
.hero-h { font-size: clamp(30px, 7.4vw, 60px); line-height: 1.06; margin-bottom: 20px; }
.hero-art { -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent 100%); mask-image: linear-gradient(90deg, #000 55%, transparent 100%); position: absolute; right: -60px; top: -10px; width: 420px; height: 300px; pointer-events: none; opacity: 0.9; }
.hero-art i { position: absolute; width: 260px; height: 260px; border-radius: 50%; mix-blend-mode: screen; animation: drift 14s ease-in-out infinite alternate; }
.hero-art i:first-child { left: 0; top: 10px; background: var(--accent-2); }
.hero-art i:last-child { left: 150px; top: 30px; background: var(--accent); animation-delay: -7s; }
@keyframes drift { to { transform: translate(14px, -10px); } }
@media (max-width: 760px) { .hero-art { opacity: 0.28; right: -140px; } }
@media (prefers-reduced-motion: reduce) { .hero-art i { animation: none; } .btn { transition: none; } }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head .h2 { margin-bottom: 14px; }

/* library grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 22px; }
.gcard { display: flex; flex-direction: column; text-decoration: none; color: var(--text); border: 1px solid var(--line); background: var(--surface); transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease; }
.gcard:hover { color: var(--text); transform: var(--lift-card); box-shadow: var(--shadow-card); border-color: var(--line-strong); }
.gcover { display: block; aspect-ratio: 40 / 21; overflow: hidden; background: var(--bg); border-bottom: 1px solid var(--line); }
.gcover img { width: 100%; height: 100%; object-fit: cover; }
.gbody { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; }
.gtitle { font: 800 18px/1.2 var(--font-display); }
.gtag { color: var(--muted); font-size: 13.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); padding: 1px 8px; color: var(--muted); }
.gmeta { font-size: 12.5px; color: var(--text); margin-top: 4px; }
.gmeta i { color: var(--gold); margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .gcard { transition: none; } .gcard:hover { transform: none; } }

.band { margin-top: 48px; padding: 22px 24px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.band p { margin: 0; max-width: 56ch; }

/* forms */
.form { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.form label { font-size: 12.5px; letter-spacing: 0.04em; margin-top: 8px; }
.form input[type=text], .form input[type=number], .form input[type=email], .form input[type=password], .form input:not([type]) {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  padding: 12px 14px; width: 100%; border-radius: 0;
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form .check { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; cursor: pointer; }
.form .check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form .btn { align-self: flex-start; margin-top: 10px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.box { border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; margin: 20px 0 0; }
.box.danger { border-color: var(--accent-2); }
.box .form { margin-bottom: 0; }
.prose h2 { margin-top: 28px; }
.prose p, .prose li { max-width: 62ch; }
.prose ul { padding-left: 20px; }
.code { background: var(--surface); border: 1px solid var(--line); padding: 14px; overflow-x: auto; font-size: 12.5px; }

/* game page */
.gamepage { display: flex; flex-direction: column; gap: 0; }
.gh { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.gh .lede { margin-bottom: 8px; }
.gplay { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-top: 8px; }
.gframe-wrap { position: relative; height: clamp(480px, 76vh, 780px); border: 1px solid var(--line-strong); background: var(--bg); }
.gframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.gframe-wrap:fullscreen { height: 100vh; border: 0; }
.gside { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.gside .box { margin: 0; }
.big { margin: 2px 0 6px; font: 800 clamp(28px, 5vw, 38px)/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.box-head .h3 { margin: 0; }
.box-head p { margin: 0; }
.tabs { display: flex; border: 1px solid var(--line); }
.tab { font: 500 11px var(--font-mono); letter-spacing: 0.06em; color: var(--muted); background: transparent; border: 0; padding: 5px 10px; cursor: pointer; }
.tab + .tab { border-left: 1px solid var(--line); }
.tab.on { background: var(--strong); color: var(--on-strong); }
.tab:not(.on):hover { color: var(--text); }
.board { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.board li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.board li:first-child { border-top: 0; }
.board .rk { color: var(--muted); }
.board li:nth-child(-n+3) .rk { color: var(--gold); }
.board .nm { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .nm:hover { color: var(--accent); }
.board .sc { font-weight: 500; }
.board li.me { background: var(--me-bg); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
.board .empty { display: block; color: var(--muted); }
.pill { display: inline-block; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; padding: 1px 8px; border: 1px solid var(--line-strong); color: var(--muted); }
.pill.good { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.pill.bad { border-color: var(--accent-2); color: var(--accent-2); }
.resultlinks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* share */
.share { display: flex; flex-wrap: wrap; gap: 8px; }
.share a, .share button {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); background: transparent; border: 1px solid var(--line-strong); font-size: 17px; cursor: pointer; text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.share a:hover, .share button:hover { background: var(--strong); color: var(--on-strong); border-color: var(--strong); }
.share [data-net=facebook]:hover { background: #1877f2; border-color: #1877f2; color: #fff; }
.share [data-net=reddit]:hover { background: #ff4500; border-color: #ff4500; color: #fff; }
.share [data-net=whatsapp]:hover { background: #25d366; border-color: #25d366; color: #0b1f12; }
.share [data-net=telegram]:hover { background: #29a9eb; border-color: #29a9eb; color: #fff; }
.share [data-net=bluesky]:hover { background: #1185fe; border-color: #1185fe; color: #fff; }
.share [data-net=linkedin]:hover { background: #0a66c2; border-color: #0a66c2; color: #fff; }
.share .copied { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* score page, profile */
.scorecard { max-width: 640px; margin: 0 auto; }
.scorebig { margin: 0 0 12px; font: 800 clamp(46px, 14vw, 88px)/1 var(--font-display); font-variant-numeric: tabular-nums; text-shadow: 4px 3px 0 var(--accent-2), -4px -3px 0 var(--accent); }
.metarow { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 26px; }
.metarow li { display: flex; flex-direction: column; }
.metarow strong { font: 800 18px var(--font-display); }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 14px; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--text); font-variant-numeric: tabular-nums; }
.line:last-of-type { border-bottom: 1px solid var(--line); }
.line:hover { color: var(--accent); }
.line-score { font: 800 17px var(--font-display); }
.line-rank { text-align: right; color: var(--muted); }

/* admin */
.wide-admin { max-width: 1000px; margin: 0 auto; }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 12px 0 8px; }
.stats3 div { padding-left: 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.stats3 div:first-child { padding-left: 0; border-left: 0; }
.stats3 strong { font: 800 26px var(--font-display); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-weight: 400; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:first-child td { border-top: 0; }
.tbl .num { text-align: right; }
.acts form { display: flex; gap: 6px; }
.mini { font: 500 11px var(--font-mono); color: var(--text); background: transparent; border: 1px solid var(--line-strong); padding: 4px 10px; cursor: pointer; }
.mini:hover { background: var(--strong); color: var(--on-strong); }
.mini.bad { border-color: var(--accent-2); color: var(--accent-2); }
.mini.bad:hover { background: var(--accent-2); color: var(--on-accent); }

/* footer */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; padding-bottom: env(safe-area-inset-bottom, 0px); }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 18px; }
.foot nav { display: flex; gap: 18px; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

@media (max-width: 920px) {
  .gplay { grid-template-columns: minmax(0, 1fr); }
  .gframe-wrap { height: min(78vh, 640px); height: min(78dvh, 640px); }
  .gtools .chip { min-height: 44px; padding-inline: 16px; }
}
@media (max-width: 560px) {
  main.wrap { padding-block: 20px 40px; }
  .nav a span, .navbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav a, .navbtn { padding: 8px 4px; font-size: 16px; }
  .nav a.btn { font-size: 11px; padding: 8px 12px; }
  .nav a.btn span { position: static; width: auto; height: auto; clip: auto; }
  .brand-sub { display: none; }
  .band { padding: 18px; }
  .line { grid-template-columns: minmax(0, 1fr) auto 44px; }
}

.modes { display: grid; gap: 10px; margin: 8px 0; }
.modes label { display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer; }
.modes input { margin-top: 3px; accent-color: var(--accent); }
.modes b { display: block; font-weight: 500; }
.modes span { display: block; font-size: 12px; color: var(--muted); }
.form input[type=number] { max-width: 120px; }

/* Leaderboards page, tab links, home boards */
.tabs a.tab { text-decoration: none; display: inline-block; }
.tabs.scroll { overflow-x: auto; max-width: 100%; }
.tabs.scroll .tab { white-space: nowrap; }
.lbhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 14px; }
.lbhead .tabs { flex-wrap: nowrap; }
.lbgame { display: flex; gap: 16px; align-items: center; margin: 4px 0 18px; }
.lbgame img { width: 120px; aspect-ratio: 40 / 21; object-fit: cover; border: 1px solid var(--line); flex: none; }
.lbgame .h2 { margin: 0 0 4px; }
.lbgame p { margin: 0 0 8px; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 18px; }
.pod { border: 1px solid var(--line); background: var(--surface); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pod .rk { font: 800 13px var(--font-display); color: var(--gold); letter-spacing: 0.06em; }
.pod .nm { font: 800 18px/1.2 var(--font-display); color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .nm:hover { color: var(--accent); }
.pod .sc { font: 500 15px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.pod.first { border-color: var(--gold); }
.pod.me { background: var(--me-bg); }
.lbtable .board li { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 11px 0; }
.mybox { margin: 0 0 18px; padding: 14px 18px; border: 1px solid var(--line); background: var(--surface); display: flex; gap: 12px 26px; flex-wrap: wrap; align-items: baseline; }
.mybox strong { font: 800 20px var(--font-display); font-variant-numeric: tabular-nums; }
.boards3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.boards3 .box { margin: 0; display: flex; flex-direction: column; }
.boards3 .board { flex: 1; }
.boards3 .more { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 560px) { .podium { grid-template-columns: minmax(0, 1fr); } .lbgame img { width: 84px; } }

/* Shared shape and type for the professional themes */
html[data-theme="portal"], html[data-theme="midnight"] {
  --r: 10px;
  --lift-btn: translateY(-1px);
  --lift-card: translateY(-3px);
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Figtree', 'Segoe UI', system-ui, sans-serif;
}
html[data-theme="portal"] body, html[data-theme="midnight"] body { font-size: 16px; line-height: 1.6; }
html[data-theme="portal"] .h1, html[data-theme="midnight"] .h1 { letter-spacing: -0.025em; }
html[data-theme="portal"] .h2, html[data-theme="midnight"] .h2,
html[data-theme="portal"] .h3, html[data-theme="midnight"] .h3 { font-weight: 700; letter-spacing: -0.01em; }
html[data-theme="portal"] .h3, html[data-theme="midnight"] .h3 { font-size: 15px; }
html[data-theme="portal"] .btn, html[data-theme="midnight"] .btn { font: 600 14px var(--font-display); letter-spacing: 0; text-transform: none; padding: 12px 20px; }
html[data-theme="portal"] .btn.small, html[data-theme="midnight"] .btn.small { padding: 8px 14px; font-size: 13px; }
html[data-theme="portal"] .btn.alt, html[data-theme="midnight"] .btn.alt { color: var(--text); }
html[data-theme="portal"] .brand-name, html[data-theme="midnight"] .brand-name { font-weight: 800; letter-spacing: 0.06em; }
html[data-theme="portal"] .brand-sub, html[data-theme="midnight"] .brand-sub { font-weight: 600; letter-spacing: 0.22em; }
html[data-theme="portal"] .kicker, html[data-theme="midnight"] .kicker { color: var(--accent); font-weight: 600; letter-spacing: 0.14em; }
html[data-theme="portal"] .kicker a, html[data-theme="midnight"] .kicker a { color: var(--muted); }
html[data-theme="portal"] .lbl, html[data-theme="midnight"] .lbl { font-weight: 600; letter-spacing: 0.1em; }
html[data-theme="portal"] .nav a, html[data-theme="midnight"] .nav a,
html[data-theme="portal"] .navbtn, html[data-theme="midnight"] .navbtn { font-weight: 500; }
html[data-theme="portal"] .nav a:hover, html[data-theme="midnight"] .nav a:hover { color: var(--accent); }
html[data-theme="portal"] .mis, html[data-theme="midnight"] .mis {
  text-shadow: none; color: transparent;
  background: linear-gradient(95deg, var(--accent) 0%, var(--accent-3) 55%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text;
}
html[data-theme="portal"] .scorebig, html[data-theme="midnight"] .scorebig { text-shadow: none; color: var(--accent); }
html[data-theme="portal"] .hero, html[data-theme="midnight"] .hero {
  padding: clamp(26px, 5vw, 52px); margin-top: 6px; border: 1px solid var(--line); border-radius: 20px;
  background: radial-gradient(900px 340px at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
              linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface));
}
html[data-theme="portal"] .hero-art, html[data-theme="midnight"] .hero-art { display: none; }
html[data-theme="portal"] .hero-h, html[data-theme="midnight"] .hero-h { font-size: clamp(30px, 6.4vw, 54px); }
html[data-theme="portal"] .gcard, html[data-theme="midnight"] .gcard { border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
html[data-theme="portal"] .gtitle, html[data-theme="midnight"] .gtitle { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
html[data-theme="portal"] .tags span, html[data-theme="midnight"] .tags span { border-radius: 99px; padding: 2px 10px; letter-spacing: 0.06em; font-weight: 500; }
html[data-theme="portal"] .gmeta i, html[data-theme="midnight"] .gmeta i { color: var(--gold); }
html[data-theme="portal"] .gframe-wrap, html[data-theme="midnight"] .gframe-wrap { border-radius: 16px; overflow: hidden; border-color: var(--line); box-shadow: 0 12px 36px rgba(0,0,0,.14); }
html[data-theme="portal"] .gframe-wrap:fullscreen, html[data-theme="midnight"] .gframe-wrap:fullscreen { border-radius: 0; }
html[data-theme="portal"] .box, html[data-theme="midnight"] .box { border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
html[data-theme="portal"] .band, html[data-theme="midnight"] .band { border-radius: 16px; }
html[data-theme="portal"] .tabs, html[data-theme="midnight"] .tabs { border-radius: 10px; overflow: hidden; }
html[data-theme="portal"] .tab, html[data-theme="midnight"] .tab { font-weight: 600; padding: 6px 12px; }
html[data-theme="portal"] .tbl th, html[data-theme="midnight"] .tbl th { font-weight: 600; }
html[data-theme="portal"] .tablewrap, html[data-theme="midnight"] .tablewrap { border-radius: 12px; }
html[data-theme="portal"] .tags, html[data-theme="midnight"] .tags { gap: 6px; }
html[data-theme="portal"] .pill, html[data-theme="midnight"] .pill { border-radius: 99px; padding: 2px 10px; font-weight: 600; }
html[data-theme="portal"] .pod, html[data-theme="midnight"] .pod { border-radius: 14px; }
html[data-theme="portal"] .lbgame img, html[data-theme="midnight"] .lbgame img { border-radius: 10px; }
html[data-theme="portal"] .mybox, html[data-theme="midnight"] .mybox { border-radius: 12px; }
html[data-theme="portal"] .form input[type=text], html[data-theme="midnight"] .form input[type=text],
html[data-theme="portal"] .form input[type=number], html[data-theme="midnight"] .form input[type=number],
html[data-theme="portal"] .form input[type=email], html[data-theme="midnight"] .form input[type=email],
html[data-theme="portal"] .form input[type=password], html[data-theme="midnight"] .form input[type=password] { border-radius: 10px; }
html[data-theme="portal"] .flash, html[data-theme="midnight"] .flash { border-radius: 10px; }
html[data-theme="portal"] .share a, html[data-theme="midnight"] .share a,
html[data-theme="portal"] .share button, html[data-theme="midnight"] .share button { border-radius: 12px; }
html[data-theme="portal"] .mini, html[data-theme="midnight"] .mini { border-radius: 8px; font-weight: 600; }
html[data-theme="portal"] .chip, html[data-theme="midnight"] .chip { border-radius: 99px; }
html[data-theme="portal"] code, html[data-theme="midnight"] code, html[data-theme="portal"] .code, html[data-theme="midnight"] .code { border-radius: 8px; }
html[data-theme="portal"] .board li.me, html[data-theme="midnight"] .board li.me { border-radius: 8px; }

/* Theme: portal. Light, professional game portal. */
html[data-theme="portal"] {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --text: #13203a;
  --muted: #5d6b85;
  --accent: #2457f0;
  --accent-2: #f0532f;
  --accent-3: #6d4aff;
  --gold: #e8a10c;
  --strong: #2457f0;
  --on-strong: #ffffff;
  --on-accent: #ffffff;
  --on-gold: #3b2a00;
  --line: #e1e6f0;
  --line-strong: #c7d0e2;
  --me-bg: rgba(36, 87, 240, 0.08);
  --header-bg: #ffffff;
  --shadow-btn: 0 8px 18px rgba(36, 87, 240, 0.28);
  --shadow-btn-alt: 0 6px 14px rgba(19, 32, 58, 0.12);
  --shadow-card: 0 14px 34px rgba(19, 32, 58, 0.14);
  color-scheme: light;
}
html[data-theme="portal"] .site-header { box-shadow: 0 6px 22px rgba(19, 32, 58, 0.05); }
html[data-theme="portal"] .gframe-wrap, html[data-theme="portal"] .gframe { background: #0b1020; }
html[data-theme="portal"] .btn.alt { border-color: var(--line-strong); background: var(--surface); }
html[data-theme="portal"] a:hover { color: #153ab8; }
html[data-theme="portal"] .nav a.btn:hover, html[data-theme="portal"] .btn:hover { color: var(--on-strong); }
html[data-theme="portal"] .btn.alt:hover { color: var(--text); }
html[data-theme="portal"] .board .nm:hover, html[data-theme="portal"] .line:hover { color: var(--accent); }
html[data-theme="portal"] .mini:hover { color: var(--on-strong); }
html[data-theme="portal"] .tabs { background: var(--surface); }

/* Theme: midnight. Dark, professional, same shapes and fonts as portal. */
html[data-theme="midnight"] {
  --bg: #0b1020;
  --surface: #131a2e;
  --text: #e8edf7;
  --muted: #8b97b3;
  --accent: #5b8cff;
  --accent-2: #ff7a59;
  --accent-3: #8b6cff;
  --gold: #ffc24a;
  --strong: #5b8cff;
  --on-strong: #07102a;
  --on-accent: #07102a;
  --on-gold: #2a1d00;
  --line: rgba(139, 151, 179, 0.2);
  --line-strong: rgba(139, 151, 179, 0.4);
  --me-bg: rgba(91, 140, 255, 0.14);
  --header-bg: #0b1020;
  --shadow-btn: 0 8px 20px rgba(91, 140, 255, 0.3);
  --shadow-btn-alt: 0 6px 16px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 16px 38px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
html[data-theme="midnight"] a:hover { color: #9db9ff; }
html[data-theme="midnight"] .nav a.btn:hover, html[data-theme="midnight"] .btn:hover { color: var(--on-strong); }
html[data-theme="midnight"] .btn.alt:hover { color: var(--text); }

/* Admin theme picker */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; margin: 8px 0 4px; }
.theme { display: grid; gap: 6px; align-content: start; padding: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; margin: 0; border-radius: var(--r); position: relative; }
.theme input { position: absolute; opacity: 0; pointer-events: none; }
.theme.on, .theme:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.theme:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme b { font: 700 15px var(--font-display); }
.theme > span:last-child { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.theme .sw { display: flex; height: 34px; border: 1px solid var(--line-strong); overflow: hidden; border-radius: var(--r); }
.theme .sw i { flex: 1; }

/* Fixes and hero cover */
.tabs.scroll { display: inline-flex; }
.lbtable .board li .rk { color: var(--muted); }
.lbtable .board li.me { padding-left: 10px; padding-right: 10px; }
.hero-cover { display: none; }
@media (min-width: 900px) {
  html[data-theme="portal"] .hero, html[data-theme="midnight"] .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 36px; align-items: center; }
  html[data-theme="portal"] .hero-cover, html[data-theme="midnight"] .hero-cover {
    display: block; position: relative; z-index: 1; text-decoration: none; color: var(--text);
    border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.22); transform: rotate(1.2deg); transition: transform 0.15s ease;
  }
  html[data-theme="portal"] .hero-cover:hover, html[data-theme="midnight"] .hero-cover:hover { transform: rotate(0deg) translateY(-3px); color: var(--text); }
  .hero-cover img { width: 100%; aspect-ratio: 40 / 21; object-fit: cover; }
  .hc-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
  .hc-bar b { font: 700 16px var(--font-display); }
  .hc-tag { flex-basis: 100%; font-size: 13.5px; color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) { .hero-cover { transition: none; } }

/* pinned "full screen" for touch devices */
.gframe-wrap.pfs { position: fixed !important; inset: 0; z-index: 9999; width: 100%; height: 100vh !important; height: 100dvh !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
html.pfs-lock, body.pfs-lock { overflow: hidden; overscroll-behavior: none; }
body.pfs-lock { position: fixed; left: 0; right: 0; width: 100%; }
.pfs-exit { position: absolute; z-index: 2; left: max(8px, env(safe-area-inset-left)); bottom: max(14px, calc(env(safe-area-inset-bottom) + 6px)); width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); background: rgba(255,255,255,.82); color: #111; font-size: 16px; display: grid; place-items: center; cursor: pointer; padding: 0; opacity: .75; }
.pfs-exit[hidden] { display: none; }
.pfs-back { position: absolute; z-index: 2; right: max(8px, env(safe-area-inset-right)); bottom: max(14px, calc(env(safe-area-inset-bottom) + 6px)); height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid rgba(0,0,0,.35); background: rgba(255,255,255,.82); color: #111; font: 600 14px/1 system-ui, sans-serif; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; opacity: .75; }
.pfs-back:hover, .pfs-exit:hover { opacity: 1; }
.pfs-back[hidden] { display: none; }
.gframe-wrap .gframe { touch-action: manipulation; }
