/* Bomb Billiards — "mad scientist's underground billiards club" */
:root {
  --bg: #0b0d10;
  --bg2: #161a20;
  --panel: #1b1f26;
  --panel-hi: #262b34;
  --line: #3a414c;
  --text: #e9e4d6;
  --muted: #9aa3ad;
  --brass: #d6a84a;
  --brass-hi: #f3d488;
  --brass-lo: #7a5a1c;
  --hazard: #e3ad1f;
  --led: #ff4430;
  --ok: #6dffbf;
  --danger: #ff5a46;
  --font-display: "Russo One", "Chakra Petch", Impact, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-ui: "Chakra Petch", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-led: "Share Tech Mono", "Courier New", monospace;
  --hud-h: 60px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none;
}
body {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(40, 80, 76, 0.35), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 64px),
    linear-gradient(180deg, #12161b, #090a0c);
}
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; }

/* ------------------------------------------------------------ HUD */
#hud {
  position: fixed; left: 0; right: 0; top: 0; z-index: 5;
  height: calc(var(--hud-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  display: grid; grid-template-columns: auto 1fr auto 1fr; align-items: center; gap: 10px;
  background: linear-gradient(180deg, #2a3038, #171b21);
  border-bottom: 2px solid #0a0b0d;
  box-shadow: 0 3px 0 rgba(214,168,74,0.25), 0 8px 18px rgba(0,0,0,0.5);
  transition: transform .25s ease, opacity .25s ease;
}
#hud::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 4px;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, #15161a 8px 16px);
  opacity: .8;
}
#hud.hidden { transform: translateY(-110%); opacity: 0; pointer-events: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(180deg, #3a414c, #22272e);
  border: 1px solid #4b5360; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 2px 0 #0b0c0e;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 26px; line-height: 1;
}
.icon-btn:active { transform: translateY(1px); }
#btn-pause span { width: 4px; height: 14px; background: var(--text); border-radius: 1px; }
.hud-level { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.hud-level #hud-lv { font-family: var(--font-display); color: var(--brass); font-size: 13px; letter-spacing: 1px; }
.hud-level #hud-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-time {
  justify-self: center; display: flex; align-items: center; gap: 8px;
  padding: 4px 14px; border-radius: 8px;
  background: #0d0606; border: 2px solid #3a2222;
  box-shadow: inset 0 0 12px rgba(255,40,20,0.15), 0 0 0 2px #1b1f26;
}
.hud-time label { font-family: var(--font-display); font-size: 11px; color: #a46a5e; letter-spacing: 1px; }
.hud-time span {
  font-family: var(--font-led); font-size: 30px; color: var(--led); letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(255,68,48,.7);
}
.hud-time.warn span { color: #ff2a1a; }
.hud-time.crit { animation: crit .5s infinite alternate; }
.hud-time.crit span { color: #fff; text-shadow: 0 0 12px #ff2a1a, 0 0 2px #ff2a1a; }
.hud-time.penalty { animation: penalty .5s ease; }
@keyframes crit { from { transform: scale(1); box-shadow: inset 0 0 12px rgba(255,40,20,.2), 0 0 0 2px #1b1f26; } to { transform: scale(1.08); box-shadow: inset 0 0 18px rgba(255,40,20,.6), 0 0 18px rgba(255,40,20,.6); } }
@keyframes penalty { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.hud-right { justify-self: end; display: flex; gap: 14px; }
.hud-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.hud-stat label { font-family: var(--font-display); font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.hud-stat span { font-family: var(--font-led); font-size: 20px; color: var(--brass-hi); }
.hud-stat.bomb span { color: #ff8a5c; }

/* cursor hint when a shot is available */
body.in-game.cue-ready canvas#game { cursor: crosshair; }

/* ------------------------------------------------------------ banner */
#banner {
  position: fixed; left: 50%; top: 32%; z-index: 6; pointer-events: none;
  transform: translate(-50%, -50%) scale(.6); opacity: 0;
  font-family: var(--font-display); font-size: clamp(30px, 7vw, 64px); letter-spacing: 2px;
  color: #ffe08a; white-space: nowrap;
  -webkit-text-stroke: 2px #2a1600;
  text-shadow: 0 4px 0 #6b3a00, 0 0 24px rgba(255,170,40,.6);
}
#banner.show { animation: banner 1.2s cubic-bezier(.2,.9,.3,1.2) forwards; }
#banner.chain { color: #ff9be0; text-shadow: 0 4px 0 #6b0050, 0 0 24px rgba(255,80,200,.6); }
#banner.warn { color: #ff5a46; text-shadow: 0 4px 0 #500, 0 0 24px rgba(255,40,20,.7); }
#banner.clear { color: var(--ok); text-shadow: 0 4px 0 #04502f, 0 0 26px rgba(80,255,170,.6); }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
  30% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  75% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(.95); }
}

/* ------------------------------------------------------------ screens */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, visibility 0s linear .25s;
  overflow-y: auto; touch-action: pan-y;
}
.screen.active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s ease; }
#scr-title, #scr-levels { background: radial-gradient(ellipse at center, rgba(8,10,12,.45), rgba(8,10,12,.85)); }
.screen.overlay { background: rgba(6,8,10,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#scr-intro, #scr-pause, #scr-result { padding-top: calc(var(--hud-h) + 16px); }

.panel {
  position: relative; width: 100%; max-width: 420px;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid #4a525e; border-radius: 18px;
  padding: 22px 20px 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 4px #101317, 0 0 0 5px rgba(214,168,74,.35), 0 24px 60px rgba(0,0,0,.6);
}
.panel::before, .panel::after {
  content: ""; position: absolute; top: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--brass-hi), var(--brass-lo));
}
.panel::before { left: 10px; } .panel::after { right: 10px; }
.screen.active .panel { animation: panelIn .35s cubic-bezier(.2,.9,.3,1.15); }
@keyframes panelIn { from { transform: translateY(16px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.panel.wide { max-width: 760px; }
.panel h2 {
  margin: 0; text-align: center; font-family: var(--font-display); font-weight: 400;
  font-size: 30px; letter-spacing: 1px; color: #fff;
  text-shadow: 0 3px 0 #000;
}
.card-tag {
  width: max-content; margin: 0 auto 8px; padding: 3px 10px; border-radius: 4px;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 1.5px; color: #1a1205;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 10px, #f0c548 10px 20px);
}
.card-en { text-align: center; font-family: var(--font-display); color: var(--brass); letter-spacing: 2px; font-size: 13px; margin-top: 4px; }
.meta { display: flex; justify-content: center; gap: 10px; margin: 16px 0 12px; }
.meta span {
  flex: 1; max-width: 110px; text-align: center; padding: 8px 4px; border-radius: 10px;
  background: #101318; border: 1px solid #343b46; color: var(--muted); font-size: 12px;
}
.meta b { display: block; font-family: var(--font-led); font-size: 24px; color: var(--led); text-shadow: 0 0 6px rgba(255,68,48,.5); font-weight: 400; }
.hint { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--brass); background: rgba(214,168,74,.08); border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.55; color: #eadfc4; }
ul.goals { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
ul.goals li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
ul.goals li i { font-style: normal; color: #4a505a; font-size: 16px; }
ul.goals li.done { color: var(--text); }
ul.goals li.done i { color: #ffd34d; text-shadow: 0 0 8px rgba(255,200,60,.6); }
.tap-hint { text-align: center; margin-top: 10px; font-size: 12px; color: var(--muted); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* buttons */
.btn {
  display: block; width: 100%; padding: 13px 16px; border-radius: 12px;
  font-family: var(--font-display); font-size: 17px; letter-spacing: 1px; color: #e9e4d6;
  background: linear-gradient(180deg, #424a56, #2a3038);
  border: 1px solid #56606d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 4px 0 #0e1013, 0 6px 14px rgba(0,0,0,.4);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 0 #0e1013; }
.btn.primary {
  color: #2a1700;
  background: linear-gradient(180deg, #ffe39a, #e2a93a 55%, #b77d1e);
  border-color: #ffe7a8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 4px 0 #6b4510, 0 8px 22px rgba(226,169,58,.35);
}
.btn.primary:active { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 1px 0 #6b4510; }
.btn.ghost { background: transparent; box-shadow: none; border-color: #3d4450; color: var(--muted); }
.btn.big { padding: 16px; font-size: 22px; }
.btn small { display: block; font-family: var(--font-ui); font-size: 12px; letter-spacing: 0; opacity: .8; margin-top: 2px; }
.menu { display: grid; gap: 12px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn.primary, .btn-row .btn.primary + .btn:last-child { grid-column: 1 / -1; }
.link-btn { color: var(--muted); text-decoration: underline; font-size: 13px; }

/* ------------------------------------------------------------ title */
.title-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.logo { text-align: center; position: relative; }
.logo-bomb {
  width: 92px; height: 92px; margin: 0 auto -6px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #7d8796, #262a31 45%, #08090b);
  box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 0 -6px 12px rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  animation: bob 2.4s ease-in-out infinite;
}
.logo-bomb::before {
  content: ""; position: absolute; top: -10px; left: 50%; width: 22px; height: 14px; transform: translateX(-50%);
  background: linear-gradient(180deg, #e3c27a, #8b6a2a); border-radius: 3px;
}
.logo-bomb::after {
  content: ""; position: absolute; top: -26px; left: 58%; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #ffd04a 30%, rgba(255,100,0,0) 70%);
  animation: spark .15s infinite alternate;
}
.logo-bomb span {
  font-family: var(--font-led); font-size: 30px; color: var(--led); background: #120707; padding: 2px 8px; border-radius: 5px;
  text-shadow: 0 0 8px rgba(255,68,48,.8); border: 1px solid #4a4f57;
}
@keyframes bob { 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes spark { from { transform: scale(.8); opacity: .8; } to { transform: scale(1.25); opacity: 1; } }
.logo h1 { margin: 0; font-family: var(--font-display); font-weight: 400; line-height: .92; letter-spacing: 2px; }
.logo h1 span { display: block; }
.logo h1 span:first-child {
  font-size: clamp(56px, 16vw, 92px); color: #ff6a2a;
  -webkit-text-stroke: 3px #2a0d00; text-shadow: 0 6px 0 #6b1a00, 0 10px 30px rgba(255,90,30,.45);
}
.logo h1 span:last-child {
  font-size: clamp(30px, 8.6vw, 50px); color: var(--brass-hi);
  -webkit-text-stroke: 2px #2a1a00; text-shadow: 0 4px 0 #5a3c0a;
}
.tagline { margin: 12px 0 0; color: var(--muted); letter-spacing: 1.5px; font-size: 13px; }
.title-wrap .menu { width: 100%; max-width: 320px; }
.title-foot { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 14px; }
.title-foot b { color: #ffd34d; font-weight: 700; }

/* ------------------------------------------------------------ level select */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { flex: 1; }
.chip { font-family: var(--font-display); font-size: 14px; color: #ffd34d; padding: 6px 10px; border-radius: 999px; background: #101318; border: 1px solid #343b46; }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.lv-new { color: var(--brass); font-weight: 700; }
.lv-world {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px;
  margin: 6px 2px -2px; padding-bottom: 6px; border-bottom: 1px solid #353c47;
}
.lv-world:first-child { margin-top: 0; }
.lv-world b { font-family: var(--font-display); font-size: 12px; letter-spacing: 1.5px; color: var(--muted); }
.lv-world span { font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.lv-tile {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 14px; padding: 10px 6px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #313844, #1d2128);
  border: 1px solid #4a525e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 0 #0c0e11;
  transition: transform .1s ease, filter .15s;
}
.lv-tile:hover { filter: brightness(1.15); }
.lv-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #0c0e11; }
.lv-num { font-family: var(--font-led); font-size: 30px; color: var(--led); text-shadow: 0 0 8px rgba(255,68,48,.5); background: #120707; padding: 0 8px; border-radius: 6px; border: 1px solid #3a2222; }
.lv-name { font-weight: 700; font-size: 13px; text-align: center; }
.lv-stars { font-size: 15px; letter-spacing: 1px; }
.lv-best { font-size: 10px; color: var(--muted); font-family: var(--font-display); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lv-lock { font-family: var(--font-display); font-size: 11px; color: #6b727c; letter-spacing: 1px; }
.lv-tile.locked { filter: grayscale(1) brightness(.6); cursor: not-allowed; }
.lv-tile.locked .lv-num { color: #555; text-shadow: none; }
.lv-tile.perfect { border-color: var(--brass); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 0 #0c0e11, 0 0 16px rgba(214,168,74,.35); }
i.star { font-style: normal; color: #3d434c; }
i.star.on { color: #ffd34d; text-shadow: 0 0 8px rgba(255,200,60,.6); }

/* ------------------------------------------------------------ result */
.result h2 { font-size: 34px; }
#scr-result.win h2 { color: var(--ok); text-shadow: 0 3px 0 #04402a, 0 0 22px rgba(80,255,170,.4); }
#scr-result.lose h2 { color: var(--danger); text-shadow: 0 3px 0 #400, 0 0 22px rgba(255,60,40,.5); }
.stars.big { display: flex; justify-content: center; gap: 10px; margin: 14px 0 10px; font-size: 46px; }
.stars.big i.star { transition: color .2s; }
.stars.big i.star.pop { animation: starPop .45s cubic-bezier(.2,.9,.3,1.5); }
@keyframes starPop { from { transform: scale(2.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
#scr-result.lose .stars.big { display: none; }
#result-rows { margin: 8px 0 16px; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 2px; border-bottom: 1px dashed #343b46; font-size: 14px; color: var(--muted); }
.row b { font-family: var(--font-led); font-size: 19px; color: var(--brass-hi); font-weight: 400; }
.row.total { border-bottom: 0; padding-top: 10px; color: var(--text); font-size: 16px; }
.row.total b { font-size: 30px; color: #fff; text-shadow: 0 0 10px rgba(255,210,120,.5); }
.row em { font-style: normal; font-family: var(--font-display); font-size: 11px; color: #1a1205; background: var(--ok); padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
#result-rows ul.goals { margin: 12px 0 0; }
.tip { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 12px 0 0; }

/* ------------------------------------------------------------ settings */
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; border-bottom: 1px solid #2f353f; font-size: 16px; cursor: pointer; }
.toggle input { display: none; }
.toggle i { width: 50px; height: 28px; border-radius: 999px; background: #101318; border: 1px solid #3d4450; position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #6b727c; transition: transform .2s, background .2s; }
.toggle input:checked + i { background: rgba(214,168,74,.3); border-color: var(--brass); }
.toggle input:checked + i::after { transform: translateX(22px); background: var(--brass-hi); }
#scr-settings .btn { margin-top: 18px; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 14px 0 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 640px) {
  :root { --hud-h: 54px; }
  #hud { gap: 6px; grid-template-columns: auto 1fr auto auto; }
  .hud-level #hud-name { font-size: 13px; }
  .hud-time { padding: 3px 8px; gap: 4px; }
  .hud-time label { display: none; }
  .hud-time span { font-size: 24px; letter-spacing: 1px; }
  .hud-right { gap: 8px; }
  .hud-stat span { font-size: 16px; }
  .hud-stat label { font-size: 9px; }
  .icon-btn { width: 36px; height: 36px; }
  .level-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .panel { padding: 20px 16px 16px; }
}
@media (max-width: 380px) {
  .hud-level { display: none; }
  #hud { grid-template-columns: auto 1fr auto; }
  .hud-time { justify-self: start; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --hud-h: 46px; }
  .hud-time span { font-size: 22px; }
  .icon-btn { width: 34px; height: 34px; }
  .title-wrap { flex-direction: row; max-width: 720px; gap: 30px; flex-wrap: wrap; justify-content: center; }
  .logo-bomb { display: none; }
  .title-foot { width: 100%; justify-content: center; }
  .screen { align-items: flex-start; }
  #scr-title { align-items: center; }
  .level-grid { grid-template-columns: repeat(5, 1fr); }
  .lv-tile { aspect-ratio: auto; min-height: 110px; }
  .meta { margin: 10px 0 8px; }
  .meta b { font-size: 20px; }
  .meta span { padding: 5px 4px; }
  #scr-intro, #scr-pause, #scr-result { padding-top: calc(var(--hud-h) + 8px); }
  .panel.card { max-width: 560px; padding: 14px 18px 14px; }
  .panel h2 { font-size: 24px; }
  .card-tag { margin-bottom: 4px; }
  .hint { margin-bottom: 8px; padding: 7px 10px; font-size: 13px; }
  ul.goals { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; gap: 4px; }
  ul.goals li { font-size: 12px; }
  .btn.big { padding: 11px; font-size: 18px; }
  .tap-hint { display: none; }
  .stars.big { font-size: 34px; margin: 6px 0 4px; }
  .row { padding: 4px 2px; }
  .row.total b { font-size: 24px; }
  #result-rows { margin: 4px 0 10px; }
  #result-rows ul.goals { display: none; }
  .btn-row { grid-template-columns: 1fr 1fr 1fr; }
  .btn-row .btn.primary, .btn-row .btn.primary + .btn:last-child { grid-column: auto; }
  .menu { grid-template-columns: 1fr 1fr; }
  .menu .btn.big { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------ i18n + debug */
.meta b.txt { font-family: var(--font-ui); font-size: 18px; font-weight: 700; line-height: 1.6; }
#hud-debug {
  display: none; width: max-content; margin-top: 2px; padding: 0 5px; border-radius: 3px;
  font-family: var(--font-display); font-size: 9px; letter-spacing: 1px; color: #1a1205; background: var(--ok);
}
body.debug #hud-debug { display: block; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: #101318; border: 1px solid #3d4450; }
.seg button { padding: 6px 10px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.seg button.on { background: rgba(214,168,74,.3); color: var(--brass-hi); box-shadow: inset 0 0 0 1px var(--brass); }
.toggle.lang-row { cursor: default; }
.debug-row > span { display: flex; flex-direction: column; gap: 2px; padding-right: 12px; }
.debug-row small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.tip.debug-tip { color: var(--ok); margin: 6px 0 0; }
body.lang-en .hud-level #hud-name { font-size: 14px; }
.toggle i { flex-shrink: 0; }
.card-en:empty { display: none; }
#scr-pause .menu { margin-top: 18px; }

/* ------------------------------------------------------------ back buttons, meta icons, zh logo */
.panel-back { position: absolute; top: 12px; left: 12px; width: 36px; height: 36px; font-size: 24px; z-index: 1; }
.panel.has-back::before { display: none; }
.meta em { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-style: normal; }
.meta .ico { width: 14px; height: 14px; fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
body:not(.lang-en) .logo h1 span:first-child { letter-spacing: 6px; }
body:not(.lang-en) .logo h1 span:last-child { font-size: clamp(16px, 4.6vw, 26px); letter-spacing: 6px; margin-top: 8px; }
.meta .ico .f { fill: var(--brass); stroke: none; }
body:not(.lang-en) #banner { -webkit-text-stroke: 1px #2a1600; letter-spacing: 4px; }
body:not(.lang-en) .logo h1 span:first-child { -webkit-text-stroke: 2px #2a0d00; }
body:not(.lang-en) .logo h1 span:last-child { -webkit-text-stroke: 0; text-shadow: 0 2px 0 #3a2606; }

/* level select: 40 levels scroll; keep the panel top reachable and the header in view */
#scr-levels { align-items: flex-start; }
#scr-levels .panel { margin: auto; }
#scr-levels .panel-head {
  position: sticky; top: calc(-1 * max(16px, env(safe-area-inset-top))); z-index: 2;
  margin: -6px -6px 12px; padding: 6px;
  background: var(--panel-hi); border-radius: 10px;
}
