:root {
  color-scheme: dark;
  --ink: #090706;
  --paper: #f5e7bd;
  --red: #b21f24;
  --red-bright: #ee3a31;
  --gold: #e7b84b;
  --gold-light: #ffe79a;
  --green: #173b31;
  --panel: rgba(16, 11, 9, 0.92);
  --line: rgba(231, 184, 75, 0.38);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--ink); }

body {
  color: var(--paper);
  font-family: "VT323", ui-monospace, monospace;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(143, 35, 29, 0.2), transparent 38rem),
    #090706;
}

button { font: inherit; }

button:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 4px; }

.screen {
  display: none;
  width: 100%;
  min-height: 100svh;
  position: relative;
}

.screen.is-active { display: flex; }

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--gold);
  font-size: clamp(0.7rem, 1vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.arcade-button {
  min-height: 3.2rem;
  border: 2px solid var(--gold);
  padding: 0.85rem 1.25rem;
  color: var(--paper);
  background: #1b1411;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 120ms ease, background 120ms ease;
}

.arcade-button:hover { transform: translate(-2px, -2px); background: #30201a; }
.arcade-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.arcade-button.primary { color: #130a08; background: var(--gold); }
.arcade-button.primary:hover { background: var(--gold-light); }

/* Opening */
#start-screen {
  justify-content: center;
  background: radial-gradient(circle at 50% 0%, #2a1712, #0d0a08 60%);
}

.start-copy {
  position: relative;
  z-index: 3;
  width: min(43rem, 52vw);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2rem, 6vw, 7rem);
  background: linear-gradient(90deg, #090706 0%, rgba(9, 7, 6, 0.98) 68%, transparent 100%);
}

.crest {
  width: clamp(5.5rem, 9vw, 8rem);
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: var(--crest-glow);
  animation: crest-glow 2.8s ease-in-out infinite;
}

/* Cahaya keemasan di sekeliling lambang (ikut bentuk PNG lutsinar). */
:root {
  --crest-glow: drop-shadow(0 0 2px rgba(255, 231, 154, .95)) drop-shadow(0 0 10px rgba(231, 184, 75, .8)) drop-shadow(0 0 26px rgba(238, 120, 40, .55));
  --crest-glow-strong: drop-shadow(0 0 3px rgba(255, 240, 180, 1)) drop-shadow(0 0 16px rgba(255, 200, 90, .95)) drop-shadow(0 0 40px rgba(238, 120, 40, .7));
}
@keyframes crest-glow { 50% { filter: var(--crest-glow-strong); } }
@media (prefers-reduced-motion: reduce) { .crest, .result-card img { animation: none; } }

.start-copy h1 {
  margin: 0;
  color: var(--paper);
  font-family: "Bungee", Impact, sans-serif;
  font-size: clamp(3.4rem, 7.65vw, 7.65rem);
  font-weight: 900;
  line-height: 0.76;
  letter-spacing: 0.01em;
  text-shadow: 5px 5px 0 #000;
}

.start-copy h1 span { color: var(--red-bright); }
.tagline { max-width: 32rem; margin: 1.5rem 0 2rem; font-size: clamp(0.9rem, 1.5vw, 1.15rem); }
.microcopy { margin: 1rem 0 0; color: rgba(245, 231, 189, 0.55); font-size: 0.7rem; }

.start-art { position: absolute; inset: 0 0 0 29%; overflow: hidden; }
.start-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #090706 0%, transparent 36%), linear-gradient(0deg, #090706 0%, transparent 35%); }
/* Poster pixel: versi kabur sebagai latar, versi penuh dalam bingkai emas. */
.start-art .poster-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; filter: blur(6px) brightness(.38) saturate(.9); transform: scale(1.08); }
.start-art .poster-frame { position: absolute; z-index: 1; top: 50%; left: 58%; height: min(88svh, 62rem); width: auto; max-width: 80%; object-fit: contain; transform: translate(-50%, -50%) rotate(1.5deg); image-rendering: pixelated; border: 4px solid var(--gold); box-shadow: 10px 10px 0 #000, 0 0 60px rgba(231, 184, 75, .25); }

.grain {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
}

/* Character select */
#select-screen { flex-direction: column; padding: clamp(1rem, 2.5vw, 2.5rem); gap: 1.2rem; background: linear-gradient(rgba(9,7,6,.84), rgba(9,7,6,.96)), url("assets/character-select.png?av=20261119j") center 30% / cover; image-rendering: pixelated; }

.select-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; }
.select-header h2 { margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(2.12rem, 4.25vw, 4.25rem); letter-spacing: 0.08em; color: var(--gold-light); text-shadow: 4px 4px 0 #000; }
.text-button { justify-self: start; border: 0; color: var(--paper); background: transparent; cursor: pointer; font-weight: 900; }
.year-mark { justify-self: end; color: var(--gold); font-size: clamp(1.2rem, 2vw, 2rem); font-weight: 900; letter-spacing: 0.15em; }

.select-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(18rem, .7fr); gap: 1rem; min-height: 0; }
/* Nisbah tetap 3:2 supaya kawasan klik (dalam %) sentiasa tepat di atas watak dalam gambar. */
.roster-panel { position: relative; align-self: center; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border: 2px solid var(--line); background: #130e0b; box-shadow: 0 14px 45px #000; }
.roster-panel img { display: block; width: 100%; height: 100%; object-fit: fill; image-rendering: pixelated; }
/* Lampu sorot pada watak dipilih: yang lain digelapkan, yang dipilih bercahaya & gambar zum sedikit ke arahnya. */
@property --sx { syntax: "<percentage>"; inherits: true; initial-value: 50%; }
@property --sy { syntax: "<percentage>"; inherits: true; initial-value: 61%; }
@property --sw { syntax: "<percentage>"; inherits: true; initial-value: 15%; }
@property --sh { syntax: "<percentage>"; inherits: true; initial-value: 42%; }
.roster-panel { --sx: 50%; --sy: 61%; --sw: 15%; --sh: 42%; transition: --sx 380ms ease, --sy 380ms ease, --sw 380ms ease, --sh 380ms ease; }
.roster-panel img { transform: scale(1.05); transform-origin: var(--sx) var(--sy); }
.roster-spotlight { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse var(--sw) var(--sh) at var(--sx) var(--sy), transparent 0%, transparent 55%, rgba(6, 4, 3, .82) 100%); }
.roster-glow { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen; background: radial-gradient(ellipse calc(var(--sw) * .9) calc(var(--sh) * .95) at var(--sx) var(--sy), rgba(255, 200, 100, .5) 0%, rgba(255, 150, 40, .2) 50%, transparent 72%); animation: roster-pulse 2.4s ease-in-out infinite; }
@keyframes roster-pulse { 50% { opacity: .65; } }
.roster-hotspot { position: absolute; z-index: 2; padding: 0; border: 0; background: transparent; cursor: pointer; }
.roster-hotspot.front { z-index: 3; }
.roster-hotspot span { display: none; }
.roster-hotspot:focus-visible { outline: 2px dashed rgba(255, 231, 154, .6); outline-offset: -4px; }
@media (prefers-reduced-motion: reduce) { .roster-panel { transition: none; } .roster-glow { animation: none; } }
.roster-hint { margin: .4rem 0 0; color: rgba(245, 231, 189, .6); font-size: .72rem; text-align: center; }
.roster-shade { position: absolute; inset: 0; box-shadow: inset 0 0 80px 15px #000; pointer-events: none; }

.fighter-panel { display: flex; flex-direction: column; justify-content: center; border: 2px solid var(--gold); padding: clamp(1.2rem, 2vw, 2rem); background: var(--panel); box-shadow: 8px 8px 0 #000; }
.fighter-kicker { color: var(--red-bright); font-size: .68rem; font-weight: 900; letter-spacing: .2em; }
.fighter-panel h3 { margin: .15rem 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(2.89rem, 5.1vw, 5.1rem); line-height: 1; letter-spacing: .08em; color: var(--gold-light); }
.fighter-panel > p { margin: .35rem 0 1rem; line-height: 1.5; color: rgba(245,231,189,.76); }
#fighter-role { color: var(--gold); font-weight: 900; text-transform: uppercase; }

.stat-list { display: grid; gap: .65rem; margin: .8rem 0 1.1rem; }
.stat-list div { display: grid; grid-template-columns: 4.8rem 1fr; align-items: center; gap: .6rem; font-size: .72rem; font-weight: 900; }
.stat-list i { display: block; height: .55rem; background: #32251f; border: 1px solid #5f493c; }
.stat-list b { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }
.special-card { margin-bottom: 1.2rem; padding: .75rem; border-left: 4px solid var(--red-bright); background: rgba(178,31,36,.13); }
.special-card span { display: block; font-size: .62rem; color: rgba(245,231,189,.55); }
.special-card strong { color: var(--gold-light); }

.fighter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; }
.fighter-card { position: relative; min-width: 0; display: grid; grid-template-columns: 3.2rem 1fr; grid-template-rows: 1fr 1fr; align-items: center; text-align: left; color: var(--paper); border: 1px solid var(--line); background: rgba(18,13,10,.92); padding: .45rem; cursor: pointer; overflow: hidden; }
.fighter-card:hover, .fighter-card.is-selected { border-color: var(--gold); background: #2b1c15; box-shadow: inset 0 -3px var(--red); }
.fighter-card strong { align-self: end; font-size: .88rem; }
.fighter-card small { align-self: start; color: var(--gold); font-size: .56rem; }
.mini-portrait { grid-row: 1/3; display: block; width: 2.75rem; height: 3.4rem; border: 1px solid rgba(231,184,75,.45); background-image: url("assets/character-select.png?av=20261119j"); background-repeat: no-repeat; background-size: 610%; image-rendering: pixelated; }
.portrait-pa { background-position: 13% 72%; }
.portrait-piji { background-position: 28% 12%; }
.portrait-ghaffar { background-position: 51% 15%; }
.portrait-kuda { background-position: 50% 73%; }
.portrait-mazli { background-position: 72% 12%; }
.portrait-abbas { background-position: 88% 70%; }

/* Game */
#game-screen { flex-direction: column; align-items: center; justify-content: center; padding: 0; background: #050505; }
.game-topbar { position: absolute; z-index: 6; inset: .8rem .8rem auto; width: auto; display: grid; grid-template-columns: minmax(18rem, 1fr) auto minmax(7rem, .55fr) auto auto; align-items: start; gap: .65rem; padding: 0; border: 0; background: transparent; pointer-events: none; }
.hud-player { display: flex; align-items: center; gap: .65rem; }
.hud-avatar { width: 4.8rem; height: 4.8rem; flex: 0 0 auto; display: block; color: transparent; overflow: hidden; border: 3px solid #f0449c; background-color: #162545; background-image: url("assets/apibesi-fighter-sprites.png?av=20261119j"); background-repeat: no-repeat; background-size: 600% auto; image-rendering: pixelated; box-shadow: 3px 3px 0 rgba(0,0,0,.72); }
.hud-sprite-pa { background-position: 0 16%; }
.hud-sprite-piji { background-position: 20% 16%; }
.hud-sprite-ghaffar { background-position: 40% 16%; }
.hud-sprite-kuda { background-position: 60% 16%; }
.hud-sprite-mazli { background-position: 80% 16%; }
.hud-sprite-abbas { background-position: 100% 16%; }
.hud-bars { width: min(100%, 18rem); }
.hud-line { display: flex; justify-content: space-between; margin-bottom: .2rem; padding: .28rem .5rem; color: #fff; background: #18345d; border: 2px solid #091830; box-shadow: 2px 2px 0 rgba(0,0,0,.55); }
.bar { height: .55rem; margin-top: .2rem; background: #1b2840; border: 2px solid #081323; transform: skewX(-14deg); }
.bar i { display: block; height: 100%; width: 100%; transition: width 120ms linear; }
.bar.health i { background: linear-gradient(90deg, #ff3f88, #ff72bc); }
.bar.maruah { height: .35rem; width: 75%; }
.bar.maruah i { width: 0; background: #2de9e6; }
.hud-hearts { display: flex; gap: .2rem; margin-top: .15rem; min-height: 1.15rem; color: #ff367e; font-size: 1.15rem; line-height: 1; text-shadow: 1px 1px 0 #fff, 2px 2px 0 #5b1539; transform: none; }
.hud-hearts .empty { color: #617088; text-shadow: 1px 1px 0 #15233b; }
.stage-title { align-self: start; padding: .3rem .65rem; text-align: center; background: rgba(8,20,41,.82); border: 2px solid rgba(255,255,255,.65); }
.stage-title span, .wave-box span { display: block; color: var(--red-bright); font-size: .56rem; letter-spacing: .15em; }
.stage-title strong { color: var(--gold-light); letter-spacing: .08em; }
.wave-box { justify-self: end; padding: .32rem .55rem; text-align: right; background: rgba(8,20,41,.82); border: 2px solid rgba(255,255,255,.65); }
.wave-box strong { color: #ff71b6; font-size: 1.2rem; }
.icon-button, .pause-button { width: 2.7rem; height: 2.7rem; border: 2px solid rgba(255,255,255,.75); color: #fff; background: rgba(18,40,66,.82); cursor: pointer; pointer-events: auto; }

.game-frame { position: relative; width: min(100vw, 1280px, calc(100svh * 16 / 9)); aspect-ratio: 16/9; overflow: hidden; border: 0; box-shadow: 0 12px 40px #000; background: #111; }
#game-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
.announcement { position: absolute; inset: 42% 0 auto; text-align: center; color: var(--gold-light); font-family: "Bungee", Impact, sans-serif; font-size: clamp(1.7rem, 5.1vw, 4.25rem); letter-spacing: .08em; text-shadow: 5px 5px 0 #000; pointer-events: none; opacity: 0; transform: scale(.82); transition: opacity 160ms ease, transform 180ms ease; }
.announcement.show { opacity: 1; transform: scale(1); }
.pause-button { position: absolute; top: 5.2rem; right: .8rem; z-index: 7; }
.pause-panel { position: absolute; z-index: 5; inset: 0; display: grid; place-content: center; gap: .8rem; text-align: center; background: rgba(5,4,3,.86); }
.pause-panel[hidden] { display: none; }
.pause-panel p { font-family: "Bungee", Impact, sans-serif; font-size: clamp(1.7rem, 4.25vw, 3.4rem); color: var(--gold-light); }

.controls-info { display: none; }
kbd { padding: .18rem .35rem; color: var(--gold-light); border: 1px solid var(--gold); background: #1c1410; box-shadow: 2px 2px #000; }
/* Kawalan sentuh: lihat bahagian "Telefon" di hujung fail. */
.touch-controls { display: none; }

/* Result */
.result-screen { align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(rgba(5,4,3,.78), rgba(5,4,3,.94)), url("assets/environments.png?av=20261119j") right bottom/200% 200%; }
.result-card { width: min(100%, 32rem); display: flex; flex-direction: column; align-items: stretch; text-align: center; padding: clamp(1.5rem, 4vw, 3rem); border: 2px solid var(--gold); background: rgba(16,11,9,.94); box-shadow: 12px 12px 0 #000; }
.result-card img { width: 6rem; height: 6rem; margin-bottom: .6rem; object-fit: contain; align-self: center; filter: var(--crest-glow); animation: crest-glow 2.8s ease-in-out infinite; }
.result-card h2 { margin: .2rem 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(3.4rem, 8.5vw, 5.95rem); line-height: 1; color: var(--gold-light); letter-spacing: .06em; }
.result-score { display: flex; justify-content: space-between; align-items: baseline; margin: 1rem 0 0; padding: .8rem 0; border-top: 1px solid var(--line); }
.result-score span { color: var(--red-bright); }
.result-score strong { color: var(--gold-light); font-size: 1.5rem; }
.result-score.secondary { margin-top: 0; margin-bottom: 1rem; }
.result-card .arcade-button + .arcade-button { margin-top: .7rem; }

@media (max-width: 860px) {
  .start-copy { width: 100%; align-items: center; text-align: center; background: linear-gradient(0deg, #090706 0%, rgba(9,7,6,.86) 70%, rgba(9,7,6,.45)); }
  .start-art { inset: 0; opacity: .46; }
  .start-art .poster-frame { display: none; }
  .start-art .poster-bg { filter: brightness(.7); }
  .start-copy h1 { font-size: clamp(4.3rem, 19vw, 8rem); }
  .select-layout { grid-template-columns: 1fr; }
  .roster-panel { min-height: 46vw; }
  .fighter-panel { min-height: 22rem; }
  .fighter-grid { grid-template-columns: repeat(3, 1fr); }
  .game-topbar { grid-template-columns: 1fr auto auto auto; gap: .4rem; }
  .stage-title { display: none; }
  .controls-info { display: none; }
  #game-screen { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .select-header { grid-template-columns: auto 1fr auto; }
  .select-header h2 { font-size: 2rem; }
  .text-button { font-size: 0; }
  .text-button::before { content: "←"; font-size: 1.4rem; }
  .fighter-grid { grid-template-columns: repeat(2, 1fr); }
  .game-topbar { padding: .3rem; }
  .hud-avatar { width: 3.5rem; height: 3.5rem; }
  .hud-bars { width: 10.5rem; }
  .hud-hearts { font-size: .8rem; }
  .wave-box span { display: none; }
  .wave-box strong { font-size: .8rem; }
  .icon-button { width: 2rem; height: 2rem; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }

/* Nama pemain & leaderboard */
.name-form { display: flex; flex-direction: column; gap: .45rem; width: min(100%, 26rem); }
.name-form label { color: var(--gold); font-size: .72rem; font-weight: 900; letter-spacing: .14em; }
.name-form input { width: 100%; padding: .8rem 1rem; border: 2px solid var(--gold); color: var(--gold-light); background: rgba(16, 11, 9, .92); box-shadow: 4px 4px 0 #000; font: 400 1.7rem "VT323", monospace; letter-spacing: .2em; text-align: center; text-transform: uppercase; }
.name-form input::placeholder { color: rgba(245, 231, 189, .35); }
.name-form input:focus { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.name-form input.is-invalid { border-color: var(--red-bright); animation: shake-x 240ms; }
.name-error { min-height: 1.1rem; margin: 0; color: var(--red-bright); font-size: .78rem; font-weight: 900; }
.start-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.start-actions .arcade-button { flex: 1 1 11rem; }
.link-button { padding: 0; border: 0; color: inherit; background: none; cursor: pointer; font-size: inherit; text-decoration: underline; }
@keyframes shake-x { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.result-rank { min-height: 1.2rem; margin: .2rem 0 1rem; color: var(--gold-light); font-weight: 900; letter-spacing: .08em; }

.leaderboard-panel { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(5, 4, 3, .88); }
.leaderboard-panel[hidden] { display: none; }
.leaderboard-card { width: min(100%, 30rem); max-height: calc(100svh - 2rem); overflow: auto; padding: clamp(1.2rem, 4vw, 2.2rem); border: 2px solid var(--gold); background: rgba(16, 11, 9, .97); box-shadow: 12px 12px 0 #000; text-align: center; }
.leaderboard-card h2 { margin: .1rem 0 .6rem; font-family: "Bungee", Impact, sans-serif; font-size: clamp(2.04rem, 5.95vw, 3.06rem); letter-spacing: .08em; color: var(--gold-light); text-shadow: 4px 4px 0 #000; }
.leaderboard-status { min-height: 1rem; margin: 0 0 .8rem; color: rgba(245, 231, 189, .6); font-size: .75rem; }
.leaderboard-list { margin: 0 0 1.2rem; padding: 0; list-style: none; counter-reset: rank; text-align: left; }
.leaderboard-list li { display: grid; grid-template-columns: 2.4rem 1fr auto; align-items: baseline; gap: .6rem; padding: .55rem .4rem; border-bottom: 1px solid var(--line); counter-increment: rank; }
.leaderboard-list li::before { content: counter(rank); color: var(--red-bright); font-weight: 900; text-align: right; }
.leaderboard-list li:nth-child(-n+3)::before { color: var(--gold-light); }
.leaderboard-list li.is-you { background: rgba(231, 184, 75, .16); }
.leaderboard-list .lb-name { font-weight: 900; letter-spacing: .1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-list .lb-name small { display: block; color: rgba(245, 231, 189, .55); font-size: .66rem; letter-spacing: .06em; }
.leaderboard-list .lb-score { color: var(--gold-light); font-weight: 900; font-variant-numeric: tabular-nums; }
.leaderboard-list .lb-empty { display: block; color: rgba(245, 231, 189, .55); text-align: center; }
.leaderboard-list .lb-empty::before { content: none; }

/* Jenama parodi & penafian */
.universe-badge { display: inline-flex; align-items: center; gap: .6rem; margin: -1rem 0 1.6rem; padding: .35rem .7rem; border: 2px solid var(--gold); color: var(--gold-light); background: rgba(178, 31, 36, .35); font-size: .72rem; font-weight: 900; letter-spacing: .18em; box-shadow: 3px 3px 0 #000; }
.universe-badge small { color: rgba(245, 231, 189, .7); font-size: .58rem; letter-spacing: .12em; }
.disclaimer { max-width: 30rem; margin: 1.1rem 0 0; padding: .6rem .8rem; border-left: 3px solid var(--red-bright); background: rgba(0, 0, 0, .45); color: rgba(245, 231, 189, .72); font-size: .66rem; line-height: 1.55; }
.disclaimer strong { color: var(--gold-light); }

/* ───────── Skrin utama gaya Cyberbana ───────── */
.home-shell { width: min(100%, 1240px); padding: 22px 32px 30px; }
.home-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 16px; }
.home-title { margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(22.5px, 3.5vw, 42.5px); color: var(--gold-light); text-shadow: 3px 3px 0 var(--red), 6px 6px 0 #000; letter-spacing: 2px; }
.home-title span { color: var(--red-bright); text-shadow: 3px 3px 0 #5a0d10, 6px 6px 0 #000; }
.home-sub { margin: 12px 0 0; font-family: "VT323", monospace; font-size: clamp(12.74px, .154.7vw, 18.2px); line-height: 1.7; color: var(--gold); letter-spacing: 2px; }
.home-lb { padding: 12px 16px; border: 3px solid var(--gold); color: var(--gold-light); background: #1a110c; font-family: "VT323", monospace; font-size: clamp(14.56px, .154.7vw, 18.2px); box-shadow: 4px 4px 0 #000; cursor: pointer; white-space: nowrap; }
.home-lb:hover { background: #2b1c15; }

.home-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border: 6px solid var(--gold); outline: 4px solid var(--red); outline-offset: -12px; box-shadow: 0 0 0 4px #000, 0 20px 50px #000; background: url("assets/apibesi-school-pixel-bg.png?av=20261119j") center bottom / cover; image-rendering: pixelated; }
.home-stage::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(10,6,4,.35), rgba(10,6,4,0) 45%); pointer-events: none; }
.home-cast { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.home-title-stack { position: absolute; inset: 3.5% 0 auto; z-index: 2; display: flex; flex-direction: column; align-items: center; margin: 0; }
.home-title-stack .crest { width: 8.5%; min-width: 54px; margin: 0; }
.home-logo { margin: .3% 0 0; text-align: center; line-height: .9; }
.home-logo .l1 { display: block; font-family: "Bungee", Impact, sans-serif; font-weight: 400; font-size: clamp(28.9px, 5.61vw, 71.4px); color: #fff4d6; letter-spacing: 3px;
  text-shadow: 0 5px 0 #c9a36a, 4px 4px 0 #1b0d08, -4px 4px 0 #1b0d08, 4px -4px 0 #1b0d08, -4px -4px 0 #1b0d08, 0 10px 0 #1b0d08; }
.home-logo .l1 b { font-weight: 400; color: var(--gold-light); text-shadow: 0 5px 0 #c27b12, 4px 4px 0 #1b0d08, -4px 4px 0 #1b0d08, 4px -4px 0 #1b0d08, -4px -4px 0 #1b0d08, 0 10px 0 #1b0d08; }
.home-logo .l2 { display: block; margin-top: 6px; font-family: "Bungee", Impact, sans-serif; font-weight: 400; font-size: clamp(22.1px, 4.08vw, 51px); color: var(--red-bright); letter-spacing: 4px;
  text-shadow: 0 5px 0 #7a0f12, 4px 4px 0 #1b0d08, -4px 4px 0 #1b0d08, 4px -4px 0 #1b0d08, -4px -4px 0 #1b0d08, 0 10px 0 #1b0d08; }
.home-ribbon { margin: 1.2% 0 0; padding: 8px 28px; background: #1b0d08; border: 3px solid var(--gold); color: var(--gold-light); font-family: "VT323", monospace; font-size: clamp(12.74px, .172.9vw, 21.84px); letter-spacing: 1px; box-shadow: 4px 4px 0 #000; clip-path: polygon(3% 0, 97% 0, 100% 50%, 97% 100%, 3% 100%, 0 50%); }
.home-title-stack .universe-badge { margin: .9% 0 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(7.5px, .8.75vw, 11.25px); letter-spacing: 1px; padding: 5px 8px; background: #3a0e0f; color: var(--gold-light); }
.home-title-stack .universe-badge small { color: #f5e7bd; }
.home-title-stack .universe-badge small { font-size: inherit; }
.home-buttons { display: flex; gap: 2%; width: 38%; margin-top: 1.8%; }
.big-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 2.1% 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(15px, 2.5vw, 32.5px); border: 4px solid #1b0d08; cursor: pointer; box-shadow: inset 0 -6px 0 rgba(0,0,0,.28), inset 0 4px 0 rgba(255,255,255,.35), 0 0 0 3px var(--gold-light), 6px 6px 0 3px #000; transition: transform 80ms; }
.big-btn:hover { transform: translate(-2px, -2px); }
.big-btn:active { transform: translate(2px, 2px); }
.big-btn.start { color: #fff8e6; background: var(--red-bright); text-shadow: 3px 3px 0 #5a0d10; }
.big-btn.score { color: #2b1704; background: var(--gold); text-shadow: 2px 2px 0 #fff2c4; }
.home-name { margin-top: 1.4%; font-family: "VT323", monospace; font-size: clamp(12.74px, .136.5vw, 18.2px); color: #fff; text-shadow: 2px 2px 0 #000; }
.home-title-stack input { margin-top: 6px; width: clamp(200px, 26%, 340px); padding: 10px; border: 3px solid var(--gold); background: rgba(20, 12, 8, .92); color: var(--gold-light); font-family: "Bungee", Impact, sans-serif; font-size: clamp(11.25px, 1.31vw, 17.5px); letter-spacing: 3px; text-align: center; text-transform: uppercase; box-shadow: 4px 4px 0 #000; }
.home-title-stack input::placeholder { color: rgba(245,231,189,.45); }
.home-title-stack input:focus { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.home-title-stack input.is-invalid { border-color: var(--red-bright); animation: shake-x 240ms; }
.home-title-stack .name-error { margin-top: 4px; padding: 0 8px; font-family: "Bungee", Impact, sans-serif; font-size: clamp(8.75px, .8.75vw, 11.25px); color: #fff; background: var(--red); }
.home-title-stack .name-error:empty { display: none; }

.home-keys { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 16px; }
.key-group { display: flex; gap: 8px; }
.key-group:last-child { justify-content: flex-end; }
.key { min-width: 54px; height: 50px; padding: 0 12px; display: grid; place-items: center; border: 3px solid #5d4636; background: #24170f; color: var(--paper); font-family: "VT323", monospace; font-size: 18.2px; box-shadow: 3px 3px 0 #000; }
.key.jump { border-color: #1f8a7a; color: #b9f1e6; background: #10302b; }
.key.hit { border-color: var(--red-bright); color: #ffd2cc; background: #3a1210; }
.key.sp { border-color: var(--gold); color: var(--gold-light); background: #33240e; }
.key.toggle { cursor: pointer; }
.key.toggle:hover { background: #33241a; }

.home-help { margin-top: 14px; font-size: 13px; line-height: 1.9; }
.home-help summary { display: none; }
.home-help p { margin: 0; }
.home-help .enter { color: #9fe6d6; }
.home-help .legend span { margin-right: 22px; white-space: nowrap; }
.home-help .legend b { color: var(--gold-light); font-family: "VT323", monospace; font-size: 16.38px; }
.home-help .tip { color: rgba(245,231,189,.72); }
.home-shell > .disclaimer { max-width: none; margin-top: 14px; font-size: 11px; }

@media (max-width: 760px) {
  .home-shell { padding: 14px 12px 22px; }
  .home-stage { aspect-ratio: 3 / 4; background-position: 30% bottom; }
  .home-title-stack { inset: 3% 0 auto; }
  .home-title-stack .crest { width: 17%; }
  .home-buttons { width: 88%; }
  .home-title-stack input { width: 80%; }
  .home-ribbon { padding: 6px 14px; }
  .home-keys { grid-template-columns: 1fr 1fr; }
  .home-keys .key-group:nth-child(2) { grid-column: 1 / -1; order: 3; justify-content: center; }
  .key { min-width: 44px; height: 44px; font-size: 8px; }
  .home-help summary { display: inline-block; padding: 8px 12px; border: 2px solid var(--gold); color: var(--gold-light); font-family: "VT323", monospace; font-size: 16.38px; cursor: pointer; list-style: none; }
  .home-help .legend span { display: inline-block; margin-right: 14px; }
}
.home-help .tip .rival { color: var(--gold-light); }

/* Babak pembuka */
.home-header-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#game-frame.is-story .game-topbar,
#game-frame.is-story .touch-controls,
#game-frame.is-story .pause-button { visibility: hidden; }
.skip-story { position: absolute; z-index: 9; top: 1rem; right: 1rem; padding: .7rem 1rem; border: 3px solid var(--gold); color: var(--gold-light); background: rgba(16, 11, 9, .85); font-family: "VT323", monospace; font-size: clamp(16.38px, 1.82vw, 21.84px); box-shadow: 4px 4px 0 #000; cursor: pointer; }
.skip-story:hover { background: #2b1c15; }
.skip-story[hidden] { display: none; }

/* ───────── Cara main (skrin utama) ───────── */
.howto { margin-top: 18px; padding: 18px 20px 20px; border: 3px solid var(--gold); background: rgba(20, 12, 8, .9); box-shadow: 6px 6px 0 #000; }
.howto-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.howto-head h2 { margin: 0; font-family: "Bungee", Impact, sans-serif; font-size: clamp(15px, 1.75vw, 20px); color: var(--gold-light); text-shadow: 3px 3px 0 var(--red); }
.howto-music { padding: 10px 12px; border: 3px solid #5d4636; background: #24170f; color: var(--paper); font-family: "VT323", monospace; font-size: 16.38px; box-shadow: 3px 3px 0 #000; cursor: pointer; }
.howto-music:hover { background: #33241a; }
.howto-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.keycard { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border: 3px solid #5d4636; background: #24170f; text-align: center; box-shadow: 3px 3px 0 #000; }
.keycard b { font-family: "VT323", monospace; font-size: clamp(12.74px, .136.5vw, 16.38px); color: var(--paper); letter-spacing: 1px; }
.keycard small { margin-top: -4px; font-size: 10px; color: rgba(245, 231, 189, .6); }
.keycard.jump { border-color: #1f8a7a; background: #10302b; }
.keycard.hit { border-color: var(--red-bright); background: #3a1210; }
.keycard.sp { border-color: var(--gold); background: #33240e; }
.caps { display: flex; gap: 6px; }
.howto kbd { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border: 2px solid #f5e7bd; border-bottom-width: 5px; border-radius: 4px; background: #f1ead6; color: #1b0d08; font-family: "VT323", monospace; font-size: 21.84px; box-shadow: 2px 2px 0 #000; }
.howto kbd.wide { min-width: 96px; }
.howto .howto-extra kbd, .howto .howto-tips kbd { min-width: 0; height: 22px; padding: 0 6px; border-bottom-width: 3px; font-size: 8px; vertical-align: middle; }
.howto-extra { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; font-size: 12px; color: rgba(245, 231, 189, .8); }
.howto-extra span { display: inline-flex; align-items: center; gap: 8px; }
.howto-extra .touch-note { color: #9fe6d6; }
.howto-mission { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.howto-mission h3 { margin: 0 0 8px; font-family: "VT323", monospace; font-size: 20.02px; color: var(--gold); }
.howto-mission ol { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.9; color: var(--paper); }
.howto-mission ol b { color: var(--gold-light); }
.howto-tips { margin: 10px 0 0; font-size: 12px; line-height: 1.9; color: rgba(245, 231, 189, .72); }
.howto-tips b { color: var(--gold-light); }
@media (max-width: 760px) {
  .howto { padding: 14px; }
  .howto-keys { grid-template-columns: repeat(3, 1fr); }
  .howto kbd { min-width: 28px; height: 28px; font-size: 10px; }
  .howto kbd.wide { min-width: 70px; }
}

/* ───────── Telefon & tablet (skrin sentuh) ───────── */
@media (hover: none) and (pointer: coarse) {
  #game-screen.is-active { position: fixed; inset: 0; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
  .touch-controls { display: flex; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
  .touch-controls button { -webkit-tap-highlight-color: transparent; touch-action: none; cursor: pointer; }

  /* D-pad */
  .dpad { display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: rgba(10, 8, 6, .55); box-shadow: inset 0 0 0 2px rgba(231, 184, 75, .45); touch-action: none; }
  .dpad button { width: var(--pad); height: var(--pad); border-radius: 50%; border: 3px solid rgba(255,255,255,.85); background: radial-gradient(circle at 35% 30%, #3b5687, #1a2c4f); color: #fff; font-size: calc(var(--pad) * .36); box-shadow: 0 5px 0 #0a1428, 0 6px 10px rgba(0,0,0,.45); }
  .dpad button span { pointer-events: none; }

  /* Butang tindakan susunan berlian (macam controller) */
  .action-pad { display: grid; grid-template-columns: repeat(3, var(--btn)); grid-template-rows: repeat(3, var(--btn)); gap: 2px; }
  .action-pad button { display: grid; place-items: center; align-content: center; gap: 1px; width: var(--btn); height: var(--btn); padding: 0; border-radius: 50%; border: 3px solid rgba(255,255,255,.9); color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,.55), 0 6px 10px rgba(0,0,0,.4); }
  .action-pad b { font-size: calc(var(--btn) * .34); line-height: 1; pointer-events: none; }
  .action-pad small { font-family: "VT323", monospace; font-size: calc(var(--btn) * .105); letter-spacing: 0; pointer-events: none; text-shadow: 1px 1px 0 #000; }
  .action-pad .special { grid-area: 1 / 2; background: radial-gradient(circle at 35% 30%, #f3c955, #b8861d); }
  .action-pad .punch { grid-area: 2 / 1; background: radial-gradient(circle at 35% 30%, #e0508f, #9b2160); }
  .action-pad .kick { grid-area: 2 / 3; background: radial-gradient(circle at 35% 30%, #f06aa7, #b23277); }
  .action-pad .jump { grid-area: 3 / 2; background: radial-gradient(circle at 35% 30%, #34b5b2, #136b6a); }
  .touch-controls button.is-pressed, .touch-controls button:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.55); filter: brightness(1.25); }
  .rotate-hint { display: none; }

  /* HUD lebih kecil supaya tak menutup permainan */
  .game-topbar { inset: .35rem .45rem auto; gap: .35rem; grid-template-columns: minmax(0, 1fr) auto auto auto auto; }
  .hud-avatar { width: 2.6rem; height: 2.6rem; border-width: 2px; }
  .hud-player { gap: .35rem; }
  .hud-bars { width: 9.5rem; }
  .hud-line { padding: .12rem .35rem; font-size: .62rem; }
  .bar { height: .4rem; }
  .hud-hearts { font-size: .7rem; min-height: .8rem; }
  .stage-title { display: block; padding: .15rem .4rem; }
  .stage-title span { font-size: .45rem; }
  .stage-title strong { font-size: .6rem; }
  .wave-box { padding: .15rem .4rem; }
  .wave-box span { font-size: .45rem; }
  .wave-box strong { font-size: .75rem; }
  .icon-button, .pause-button { width: 2rem; height: 2rem; font-size: .8rem; }
  .announcement { font-size: clamp(1.4rem, 5vw, 2.6rem); }
  .skip-story { top: .5rem; right: .5rem; padding: .5rem .7rem; font-size: 9px; }
}

/* Telefon LANDSKAP: game memenuhi skrin, butang di penjuru (separa lutsinar). */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  #game-screen.is-active { flex-direction: row; align-items: center; justify-content: center; background: #000; }
  .touch-controls { position: fixed; z-index: 20; inset: auto 0 0 0; justify-content: space-between; align-items: flex-end; padding: 0 max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); pointer-events: none;
    --pad: clamp(52px, 15vh, 74px); --btn: clamp(46px, 13.5vh, 66px); }
  .touch-controls > * { pointer-events: auto; opacity: .82; }
}

/* Telefon POTRET: game di atas, controller penuh di bawah. */
@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
  #game-screen.is-active { flex-direction: column; justify-content: flex-start; background: #0d0a08; padding-top: env(safe-area-inset-top); }
  .game-frame { width: 100vw; box-shadow: none; }
  .touch-controls { position: relative; flex: 1; width: 100%; justify-content: space-between; align-items: center; padding: 14px 14px max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(#2a1c14, #120c09); border-top: 4px solid var(--gold); box-shadow: inset 0 10px 18px rgba(0,0,0,.5);
    --pad: clamp(50px, 14.5vw, 76px); --btn: clamp(50px, 15vw, 72px); flex-wrap: wrap; align-content: center; column-gap: 8px; }
  .rotate-hint { display: block; order: -1; width: 100%; margin: 0 0 8px; text-align: center; color: rgba(245,231,189,.55); font-family: "VT323", monospace; font-size: 14.56px; }
}

/* Desktop: sembunyikan kawalan sentuh. */
@media (hover: hover) and (pointer: fine) { .touch-controls { display: none !important; } }

/* Kunci zum: elak zum tap-dua-kali di seluruh halaman; skrin permainan langsung tak boleh zum/tatal. */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
#game-screen.is-active, #game-screen.is-active * { touch-action: none; }

/* Desktop: legend kekunci di bawah skrin permainan supaya pemain tak lupa. */
@media (hover: hover) and (pointer: fine) {
  #game-screen.is-active { height: 100svh; }
  #game-screen .game-frame { width: min(100vw, 1280px, calc((100svh - 56px) * 16 / 9)); }
  #game-screen .controls-info { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 20px; width: min(100vw, 1280px, calc((100svh - 56px) * 16 / 9)); min-height: 56px; padding: 8px 14px; background: linear-gradient(#1c120d, #0c0806); border-top: 3px solid var(--gold); color: var(--paper); font-family: "VT323", monospace; font-size: 18.2px; letter-spacing: 1px; }
  .controls-info span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
  .controls-info kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border: 2px solid #f5e7bd; border-bottom-width: 4px; border-radius: 4px; background: #f1ead6; color: #1b0d08; font-family: "VT323", monospace; font-size: 18.2px; box-shadow: 1px 1px 0 #000; }
  .controls-info kbd.wide { min-width: 70px; }
  .controls-info .ci-jump { color: #9fe6d6; }
  .controls-info .ci-hit { color: #ffb3c4; }
  .controls-info .ci-sp { color: var(--gold-light); }
  .controls-info .ci-misc { color: rgba(245, 231, 189, .55); }
  #game-frame.is-story ~ .controls-info { visibility: hidden; }
}

/* Leaderboard 100 baris: senarai boleh ditatal, tajuk & butang TUTUP kekal kelihatan. */
.leaderboard-card { display: flex; flex-direction: column; overflow: hidden; }
.leaderboard-list { flex: 1; min-height: 0; max-height: 60svh; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }

/* Tanda dagang pembuat: logo AR (desktop: penjuru kanan bawah; telefon: tengah bawah), tak menghalang sentuhan. */
.brand-mark { position: fixed; z-index: 30; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); width: 40px; height: 40px; transform: translateX(-50%); opacity: .75; pointer-events: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
@media (hover: none) and (pointer: coarse) { .brand-mark { width: 32px; height: 32px; } }
@media (hover: hover) and (pointer: fine) { .brand-mark { left: auto; right: 16px; bottom: 16px; transform: none; } }

/* Lencana pemain online di skrin utama. */
.online-count { display: flex; align-items: center; gap: .5rem; margin: .45rem 0 0; color: #b9f5c4; font-family: "VT323", monospace; font-size: 16.38px; letter-spacing: .04em; text-shadow: 1px 1px 0 #000; }
.online-count[hidden] { display: none; }
.online-count i { width: 9px; height: 9px; border-radius: 50%; background: #3ee06b; box-shadow: 0 0 0 0 rgba(62,224,107,.7); animation: online-pulse 1.6s infinite; flex: none; }
@keyframes online-pulse { 0% { box-shadow: 0 0 0 0 rgba(62,224,107,.7); } 70% { box-shadow: 0 0 0 8px rgba(62,224,107,0); } 100% { box-shadow: 0 0 0 0 rgba(62,224,107,0); } }
@media (max-width: 600px) { .online-count { font-size: 7px; } }

/* Masthead "Projek: Api & Besi" (gambar) menggantikan logo teks. */
.home-logo .masthead { display: block; width: min(62%, 72vh); height: auto; margin: 0 auto; filter: drop-shadow(0 6px 0 rgba(0,0,0,.65)); }
@media (max-width: 600px) { .home-logo .masthead { width: 88%; } }

/* Pop up pasang game */
#install-pop { position: fixed; left: 50%; bottom: 18px; z-index: 9000; display: flex; align-items: center; gap: 12px;
  width: min(560px, calc(100vw - 32px)); padding: 12px 14px; background: #160f0c; border: 3px solid #e7b84b;
  box-shadow: 0 0 0 3px #000, 0 10px 30px rgba(0,0,0,.6); color: #f4ead2; font-family: "VT323", monospace;
  transform: translate(-50%, 140%); transition: transform .3s ease; }
#install-pop.is-open { transform: translate(-50%, 0); }
#install-pop img { width: 52px; height: 52px; image-rendering: pixelated; flex: none; }
#install-pop .ip-text { flex: 1; display: grid; gap: 6px; min-width: 0; }
#install-pop .ip-text b { font-size: .7rem; color: #e7b84b; }
#install-pop .ip-text small { font-size: .5rem; line-height: 1.6; color: #d9ccb0; font-family: inherit; }
#install-pop .ip-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
#install-pop button { font: inherit; font-size: .55rem; padding: 8px 10px; border: 2px solid #000; cursor: pointer; }
#install-pop .ip-yes { background: #ee3a31; color: #fff; }
#install-pop .ip-no { background: #2a211b; color: #d9ccb0; }

/* ───────── Pembetulan telefon (iPhone) ─────────
   1. Kanvas 1280x720 dikecilkan ke skrin telefon: "pixelated" pada skala bukan integer buat sprite
      nampak herot/bergerigi, jadi guna penskalaan licin.
   2. Elak takuk (notch) & Dynamic Island: game & butang ikut kawasan selamat.
   3. Butang kembali & jeda cukup besar untuk jari (≥44px). */
#game-canvas { image-rendering: auto; }
@media (hover: none) and (pointer: coarse) {
  .home-stage { image-rendering: auto; }
  .text-button { min-width: 48px; min-height: 48px; padding: 0 12px; border: 2px solid var(--gold); background: rgba(16,11,9,.85); color: var(--gold-light); box-shadow: 3px 3px 0 #000; }
  .select-header { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); }
  .icon-button, .pause-button { width: 2.75rem; height: 2.75rem; font-size: 1rem; }
  .pause-panel .arcade-button { min-height: 48px; min-width: 200px; }
}
@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .game-frame { width: min(calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right)), calc(100svh * 16 / 9)); }
}
/* Logo AR tak menutup butang/permainan di telefon semasa main. */
@media (hover: none) and (pointer: coarse) { body:has(#game-screen.is-active) .brand-mark { display: none; } }

/* Butang jeda kini dalam bar atas (sebelah butang bunyi), tak lagi menutup kiraan "HIT". */
.game-topbar .pause-button { position: static; }
.game-topbar:has(~ #game-frame.is-story) .pause-button, #game-frame.is-story .game-topbar .pause-button { visibility: hidden; }
