/* Bundled fonts (SIL Open Font License 1.1, see fonts/OFL-*.txt): the game needs no network to look right. */
@font-face { font-family: 'Fredoka'; src: url('../fonts/Fredoka.woff2') format('woff2'); font-weight: 300 700; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../fonts/Nunito.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }
/* Layout: one-screen arcade. Canvas fills the viewport; a thin HUD floats over it; overlays for start/win/lose. */
:root {
  /* Window insets. In a browser these are the safe-area values (0 on desktop and Android Chrome). The Android shell
     overrides them with the status-bar, navigation-bar and cutout insets it receives (Holebound.setInsets), because an
     Android WebView fills env() only for display cutouts. */
  --inset-top: env(safe-area-inset-top, 0px); --inset-right: env(safe-area-inset-right, 0px);
  --inset-bottom: env(safe-area-inset-bottom, 0px); --inset-left: env(safe-area-inset-left, 0px);

  --bg: #1b1e2b;
  --ground: #2d6a4f;
  --ground2: #40916c;
  --fg: #f6f3e8;
  --muted: #b8c0d9;
  --accent: #ffb703;
  --danger: #ef476f;
  --panel: rgba(27, 30, 43, 0.86);
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--body);
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}
#game3d, #game { position: fixed; inset: 0; display: block; width: 100%; height: 100%; }
#game { background: transparent; } /* 2D overlay: size tags, pop-ups, rings; the 3D scene renders underneath */
.hud {
  position: fixed; left: 0; right: 0; top: var(--inset-top);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, var(--inset-left));
  padding-right: calc(max(16px, var(--inset-right)) + 54px); /* room reserved for the pause button */
  pointer-events: none; font-variant-numeric: tabular-nums;
}
.hud .pill { min-width: 0; flex-shrink: 1; white-space: nowrap; }
#theme { display: inline-block; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
@media (max-width: 440px) {
  .hud { gap: 6px; }
  .hud .pill { padding: 5px 10px; font-size: 13px; gap: 5px; }
  .hud .pill small { font-size: 10px; }
  #theme { max-width: 6.5em; }
  #theme.score { max-width: 8em; text-transform: none; letter-spacing: 0; } /* the Graveyard's run score on a phone: "12,345 pts" */
}
.pill {
  background: var(--panel); border-radius: 999px; padding: 6px 14px;
  font-weight: 800; font-size: 15px; display: flex; gap: 8px; align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.pill small { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.pill .warn { color: var(--danger); }
.pausebtn {
  /* its own fixed corner: never pushed off-screen by the HUD, a full 44px touch target, clear of the joystick area */
  position: fixed; top: calc(var(--inset-top) + 8px); right: max(12px, var(--inset-right));
  width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 0;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  background: var(--panel); box-shadow: 0 2px 10px rgba(0,0,0,.35); pointer-events: auto; cursor: pointer; z-index: 3;
}
.pausebtn span { width: 5px; height: 16px; border-radius: 2px; background: var(--fg); }
.pausebtn:active { transform: scale(.94); box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pausebtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fx {
  position: fixed; left: max(16px, var(--inset-left)); bottom: calc(20px + var(--inset-bottom));
  display: flex; flex-direction: column; gap: 6px; pointer-events: none; font-variant-numeric: tabular-nums;
}
.fx .pill { font-size: 13px; padding: 5px 12px; }
.fx .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chase {
  position: fixed; right: max(16px, var(--inset-right)); bottom: calc(20px + var(--inset-bottom)); max-width: 46%;
  background: var(--panel); border-radius: 14px; padding: 6px 12px 9px; pointer-events: none; overflow: hidden;
  display: grid; gap: 1px; box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.chase small { color: var(--muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.chase b { font-size: 13px; line-height: 1.2; }
.chase span { font-size: 11px; color: var(--muted); line-height: 1.25; }
.chase i { position: absolute; left: 0; bottom: 0; height: 3px; width: 0%; background: var(--accent); transition: width .2s; }
.chase.done { background: var(--accent); color: #1b1e2b; }
.chase.done small, .chase.done span { color: rgba(27,30,43,.7); }
.help p { font-size: 14px; line-height: 1.45; color: var(--muted); }
.help p b { color: var(--fg); display: block; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.tut {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; max-width: min(360px, calc(100% - 32px));
  background: var(--accent); color: #1b1e2b; border-radius: 16px; padding: 12px 18px 14px; text-align: center;
  font-weight: 800; font-size: 15px; line-height: 1.35; pointer-events: none; overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,.45); animation: tutin .4s cubic-bezier(.2,1.4,.4,1) both;
}
.tut i { position: absolute; left: 0; bottom: 0; height: 4px; width: 0%; background: rgba(27,30,43,.5); transition: width .2s; }
.tut button { pointer-events: auto; margin-left: 10px; border: 0; border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 800; color: var(--accent); background: #1b1e2b; cursor: pointer; vertical-align: middle; }
@keyframes tutin { from { transform: translate(-50%, 20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tut { animation: none; } }
.combo {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--inset-top) + 58px);
  background: var(--panel); border-radius: 16px; padding: 6px 16px 10px; min-width: 120px;
  text-align: center; pointer-events: none; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.35); font-variant-numeric: tabular-nums;
}
.combo span { font-family: var(--display); font-size: 26px; color: var(--accent); display: block; line-height: 1; }
.combo small { color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.combo i { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); width: 100%; }
.combo.hot span { color: var(--danger); } .combo.hot i { background: var(--danger); }
.bar { position: fixed; left: 0; right: 0; bottom: 0; height: 8px; background: rgba(0,0,0,.4); }
.bar i { display: block; height: 100%; background: var(--accent); width: 0%; transition: width .2s; }
/* `hidden` must win over any display rule below (Chrome lets a class's display override the attribute; Safari doesn't) */
[hidden] { display: none !important; }
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(27,30,43,.72); backdrop-filter: blur(4px);
  padding-left: max(16px, var(--inset-left));
  padding-right: max(16px, var(--inset-right));
}
.card {
  background: var(--panel); border-radius: 24px; padding: 28px 24px; max-width: 360px; width: 100%;
  text-align: center; display: grid; gap: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
h1, h2 { font-family: var(--display); margin: 0; text-wrap: balance; line-height: 1.1; }
h1 { font-size: 44px; color: var(--accent); }
h2 { font-size: 32px; }
p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 15px; }
.stat { font-family: var(--display); font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bigstars { font-size: 44px; line-height: 1; letter-spacing: 4px; color: var(--accent); }
.bigstars .off { color: rgba(255,255,255,.15); }
.bigstars .pop { display: inline-block; animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.bigstars .pop:nth-child(2) { animation-delay: .15s; } .bigstars .pop:nth-child(3) { animation-delay: .3s; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.ratings { display: grid; gap: 8px; text-align: left; font-variant-numeric: tabular-nums; }
.ratings .row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline; font-size: 14px; }
.ratings .row small { color: var(--muted); }
.ratings .row b { color: var(--fg); }
.ratings .s { color: var(--accent); letter-spacing: 2px; font-size: 15px; }
.ratings .s .off { color: rgba(255,255,255,.15); }
.sub { font-family: var(--display); font-size: 16px; margin: 6px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ratings .row.hdr small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.newrec { color: var(--accent); font-weight: 800; font-size: 12px; margin-left: 6px; }
.ach { display: grid; gap: 6px; text-align: left; }
.ach .a { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.05); }
.ach .a .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #1b1e2b; font-weight: 800; font-size: 16px; }
.ach .a .t { font-size: 14px; font-weight: 800; }
.ach .a .d { font-size: 12px; color: var(--muted); }
.ach .a .rw { color: var(--accent); }
.ach .achfam { font-family: var(--display); font-size: 13px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin: 10px 0 2px; }
.ach .a.next { outline: 2px solid var(--accent); } .ach .a .t em { font-style: normal; font-size: 11px; color: var(--accent); margin-left: 6px; }
#endAch { margin-top: 6px; } #endAch > small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; } #endAch .row small { font-weight: 800; color: var(--accent); }
.ach .a.locked { opacity: .45; }
.ach button.a { font: inherit; color: var(--fg); box-shadow: none; text-align: left; cursor: pointer; border: 2px solid transparent; width: 100%; justify-self: stretch; }
.ach button.a.on { border-color: var(--danger); background: rgba(239,71,111,.12); }
.ach button.a .ic { background: rgba(255,255,255,.15); color: var(--muted); }
.ach button.a.on .ic { background: var(--danger); color: #fff; }
.ach button.a:active { transform: none; }
.mut { color: var(--danger); }
.bigstars .bonus, .ratings .s .bonus, .tile .st .bonus { color: var(--danger); }
.perks { font-size: 12px; color: var(--accent); letter-spacing: .02em; } .ach .a.locked .ic { background: rgba(255,255,255,.15); color: var(--muted); }
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--inset-top) + 100px); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.toast {
  background: var(--accent); color: #1b1e2b; border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: toast 6s ease both; max-width: 100%;
}
.toast small { font-weight: 500; opacity: .8; margin-right: 6px; }
@keyframes toast { 0% { transform: translateY(-20px); opacity: 0; } 5%, 92% { transform: none; opacity: 1; } 100% { transform: translateY(-10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast, .bigstars .pop { animation-duration: .01s; } }
.best { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.best.new { color: var(--accent); }
button {
  font: 800 18px var(--body); color: #1b1e2b; background: var(--accent); border: 0;
  border-radius: 999px; padding: 14px 28px; cursor: pointer; justify-self: center;
  box-shadow: 0 4px 0 #c98c00; transition: transform .08s;
}
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #c98c00; }
button:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.hint { font-size: 13px; }
.audio { display: grid; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.05); }
.audio label { display: grid; grid-template-columns: 110px 1fr 46px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.audio label b { color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }
.audio input[type=range] { width: 100%; accent-color: var(--accent); min-width: 0; }
.audio label.check { grid-template-columns: auto 1fr; cursor: pointer; }
.audio input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--danger); }
.audio input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.debug {
  position: fixed; left: max(16px, var(--inset-left)); right: max(16px, var(--inset-right));
  top: calc(var(--inset-top) + 52px); font: 500 11px ui-monospace, Menlo, monospace; color: #ffd166;
  background: rgba(0,0,0,.6); padding: 4px 8px; border-radius: 8px; pointer-events: none; white-space: pre-wrap; z-index: 5;
}
.danger-zone { display: grid; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
button.warn { color: var(--danger); box-shadow: inset 0 0 0 2px rgba(239,71,111,.5); }
button.warn-solid { background: var(--danger); color: #fff; box-shadow: 0 4px 0 #a8203f; }
button.warn-solid:active { box-shadow: 0 1px 0 #a8203f; }
.confirm { display: grid; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(239,71,111,.12); border: 2px solid rgba(239,71,111,.45); }
.confirm p { color: var(--fg); font-size: 14px; }
.seg { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.seg.three { grid-template-columns: 110px 1fr 1fr 1fr; }
.gfxhint { margin: -2px 0 0; font-size: 12px; color: var(--muted); text-align: left; }
@media (max-width: 400px) { .seg, .seg.three { grid-template-columns: 78px repeat(auto-fit, minmax(0, 1fr)); } .audio label { grid-template-columns: 78px 1fr 42px; } }
.segbtn { font: 800 13px var(--body); padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.06); color: var(--fg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); justify-self: stretch; }
.segbtn.on { background: var(--accent); color: #1b1e2b; box-shadow: none; }
.segbtn:active { transform: none; }
.bosscard {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 4; pointer-events: none;
  display: grid; justify-items: center; gap: 2px; padding: 14px 28px 16px; border-radius: 18px; text-align: center;
  --boss: #e63946;
  background: rgba(14, 6, 12, .84); box-shadow: 0 0 0 2px var(--boss), 0 0 40px var(--boss); box-shadow: 0 0 0 2px var(--boss), 0 0 40px color-mix(in srgb, var(--boss) 55%, transparent);
  animation: bosscard 2.8s ease both; max-width: calc(100% - 32px);
}
.bosscard small { color: var(--boss); color: color-mix(in srgb, var(--boss) 70%, #fff); font-size: 12px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; }
.bosscard b { font-family: var(--display); font-size: 34px; line-height: 1.1; color: #fff; text-shadow: 0 0 18px var(--boss); }
.bosscard span { color: #f1d9d9; font-size: 13px; }
@keyframes bosscard { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.96); } }
@media (prefers-reduced-motion: reduce) { .bosscard { animation-duration: 2.8s; animation-timing-function: steps(1, end); } }
.btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
button.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
button.ghost:active { box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.card { max-height: calc(100% - 24px); overflow-y: auto; }
.card.wide { max-width: 420px; }
/* Landscape phones: short viewport, so tighten the overlays and the HUD extras */
@media (max-height: 460px) {
  .card { padding: 16px 20px; gap: 8px; border-radius: 18px; }
  .card.wide { max-width: 560px; }
  h1 { font-size: 32px; } h2 { font-size: 24px; }
  .bigstars { font-size: 32px; }
  .combo { top: calc(var(--inset-top) + 50px); padding: 4px 12px 8px; }
  .combo span { font-size: 20px; }
  .tut { bottom: 60px; font-size: 13px; padding: 8px 14px 10px; }
  .chase { max-width: 36%; bottom: 14px; }
  .fx { bottom: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.tile {
  display: grid; gap: 4px; padding: 12px 10px; border-radius: 16px; text-align: center;
  background: rgba(255,255,255,.06); color: var(--fg); font: inherit; box-shadow: none;
  border: 2px solid transparent; cursor: pointer; transition: transform .08s, border-color .08s;
}
.tile:active { transform: scale(.96); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile .num { font-family: var(--display); font-size: 26px; line-height: 1; }
.tile .nm { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.tile .st { font-size: 14px; letter-spacing: 1px; color: var(--accent); }
.tile .st .off { color: rgba(255,255,255,.15); }
.tile.boss .num { color: var(--danger); }
.tile.current { border-color: var(--accent); }
.tile.locked { opacity: .4; cursor: default; }
.tile.done { opacity: .8; cursor: pointer; }
.tile.done .num::after { content: '\2713'; font-size: 14px; display: block; color: #06d6a0; }
.tile.locked .num::after { content: '\1F512'; font-size: 14px; display: block; }
.skingrid { grid-template-columns: repeat(2, 1fr); }
.tile.skin { opacity: 1; cursor: pointer; } .tile.skin canvas { width: 104px; height: 104px; border-radius: 16px; } .tile.skin.locked { opacity: .55; cursor: default; } .tile.skin .desc { font-size: 11px; color: var(--muted); line-height: 1.25; }
.tile.skin .price { color: var(--accent); font-weight: 800; } .tile.skin.armed { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; } .tile.skin.armed .price { color: #fff; }
.tile canvas { width: 72px; height: 72px; justify-self: center; border-radius: 50%; }
.tile .req { font-size: 11px; color: var(--muted); line-height: 1.3; }
.tile.locked .req { color: var(--muted); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .bar i, button { transition: none; } }

/* Reward shop */
.shop { display: grid; gap: 8px; width: min(100%, 420px); margin: 4px auto 6px; }
.boosts:has(.boost[hidden]) { grid-template-columns: 1fr; }
.shophead { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.shophead b { color: var(--accent); font-family: var(--display); font-size: 18px; }
.shophead small { color: var(--muted); font-size: 12px; }
.boosts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
button.boost { display: grid; gap: 2px; justify-items: start; text-align: left; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.06); color: var(--fg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); font-weight: 600; font-size: 14px; justify-self: stretch; }
button.boost:active { transform: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
button.boost b { font-size: 15px; } button.boost span { font-size: 11px; color: var(--muted); font-weight: 500; } button.boost small { font-size: 12px; color: var(--accent); font-weight: 800; }
button.boost.on { background: rgba(255,183,3,.16); box-shadow: inset 0 0 0 2px var(--accent); }
button.boost.on b::after { content: ' \2713'; color: var(--accent); }
button.boost.poor { opacity: .45; cursor: default; }
.coinline { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: 4px; }

/* Victory card (level 250 cleared) */
.card.victory { border: 1px solid rgba(255,183,3,.45); box-shadow: 0 0 0 6px rgba(255,183,3,.08), 0 0 80px rgba(255,183,3,.25), 0 12px 40px rgba(0,0,0,.5); animation: vglow 3s ease-in-out infinite alternate; }
.vlabel { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.vtitle { font-size: 38px; color: var(--accent); animation: pop .7s cubic-bezier(.2,1.6,.4,1) both; }
.vbosses { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.vbosses span { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--bc, var(--accent)); color: var(--bc, var(--accent)); animation: rise .5s cubic-bezier(.2,1.4,.4,1) both; animation-delay: var(--d, 0s); }
.vbosses span::before { content: '✓ '; }
.victory .ratings .row.total b { color: var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes vglow { from { box-shadow: 0 0 0 6px rgba(255,183,3,.08), 0 0 60px rgba(255,183,3,.18), 0 12px 40px rgba(0,0,0,.5); } to { box-shadow: 0 0 0 6px rgba(255,183,3,.14), 0 0 100px rgba(255,183,3,.32), 0 12px 40px rgba(0,0,0,.5); } }
@media (prefers-reduced-motion: reduce) { .card.victory, .vtitle, .vbosses span { animation: none; } }
@media (max-height: 700px) { .vtitle { font-size: 30px; } }

/* the clock's last ten seconds: the pill pulses red */
@keyframes clockPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.hud .pill:has(#time.warn) { animation: clockPulse .6s ease-in-out infinite; border-color: var(--danger); box-shadow: 0 0 0 2px rgba(239, 71, 111, .25); }

/* Reduce motion: no camera shake or chunk bursts (render3d.js reads this), no pulsing clock */
@media (prefers-reduced-motion: reduce) { .hud .pill:has(#time.warn) { animation: none; } }

/* progress transfer and error details */
.transfer textarea, #errText { width: 100%; box-sizing: border-box; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.35); color: var(--ink, #e8e8f0); border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 8px; resize: vertical; word-break: break-all; }

/* level chapters: one fold per 25 levels */
.chapter { border-radius: 14px; background: rgba(255,255,255,.04); margin: 0 0 8px; }
.chapter summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 10px 12px; font-size: 13px; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary .ch { font-family: var(--display); font-size: 15px; color: var(--fg); }
.chapter summary .rng { color: var(--muted); }
.chapter summary .chst { color: var(--accent); letter-spacing: .5px; white-space: nowrap; }
.chapter.locked summary { opacity: .55; }
.chapter.current { box-shadow: inset 0 0 0 2px var(--accent); }
.chapter > .grid, .chapter > .ratings { padding: 0 10px 12px; }
.graveUnlock { padding: 0 12px 12px; } .graveUnlock p { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.4; } .graveUnlock b { color: var(--fg); } .graveUnlock button[disabled] { opacity: .5; }
/* first-run control choice */
.ctlpick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.ctlpick button { display: grid; gap: 6px; padding: 16px 12px; border-radius: 16px; background: rgba(255,255,255,.06); color: var(--fg); font: inherit; border: 2px solid transparent; box-shadow: none; text-align: center; }
.ctlpick button b { font-family: var(--display); font-size: 20px; }
.ctlpick button small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.ctlpick button:focus-visible, .ctlpick button:active { border-color: var(--accent); }
@media (max-width: 440px) { .ctlpick { grid-template-columns: 1fr; } }
.chapters { display: grid; gap: 8px; }
.chapter summary .rng { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Studio branding (Orbit Punk Games) ---- */
.studio { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 10px; background: #07030f; color: #e9d8ff;
  font-family: Fredoka, Nunito, system-ui, sans-serif; opacity: 0; animation: studioIn .35s ease-out forwards; cursor: pointer; }
.studio img { width: min(55vmin, 320px); height: auto; border-radius: 6px; box-shadow: 0 0 48px rgba(170, 60, 255, .35); }
.studio small { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: #a98ad4; }
.studio b { font-size: 24px; font-weight: 600; letter-spacing: .02em; text-shadow: 0 0 18px rgba(190, 90, 255, .6); }
.studio.out { animation: studioOut .3s ease-in forwards; pointer-events: none; }
@keyframes studioIn { to { opacity: 1; } }
@keyframes studioOut { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .studio { animation-duration: .01s; } .studio.out { animation-duration: .01s; } }
button.studioline { display: inline-flex; align-items: center; gap: 8px; justify-self: center; background: none; border: 0; box-shadow: none; padding: 4px 8px; margin-top: -4px; color: var(--muted, #9aa3b5); font: 500 12px var(--body); cursor: pointer; opacity: .85; border-radius: 8px; }
button.studioline:hover, button.studioline:focus-visible { opacity: 1; }
button.studioline:active { transform: none; box-shadow: none; }
.studioline img { width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(190, 120, 255, .5); }
.studiocredit { margin: 0 0 10px; display: grid; justify-items: center; gap: 8px; }
.studiocredit img { width: min(100%, 300px); height: auto; border-radius: 8px; }
.studiocredit figcaption { font-size: 14px; }
.vstudio { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #c9a7ff; opacity: .9; }
