*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #070910;
  --bg-glow: #141a2e;
  --panel: #101420;
  --panel-alt: #181f32;
  --border: #2a3552;
  --text: #f3f6ff;
  --muted: #b0bad4;
  --yellow: #ffd93d;
  --cyan: #22e5ff;
  --magenta: #f24ce0;
  --green: #2fe05e;
  --red: #ff4b5c;
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
}

html {
  scrollbar-gutter: stable;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: radial-gradient(circle at 50% 0%, var(--bg-glow) 0%, var(--bg) 72%);
}

.hidden {
  display: none !important;
}

.hide-cursor,
.hide-cursor * {
  cursor: none !important;
}

/* ================= APP SHELL ================= */
.app-shell {
  height: 100dvh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ================= TOP BAR ================= */
.top-bar {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 5px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-seal {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2b2108 0%, #141827 58%, #3c0f38 100%);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  font-weight: 800;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.brand-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text);
  white-space: nowrap;
}

.version-badge {
  flex: 0 0 auto;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 217, 61, 0.14);
  border: 1px solid rgba(255, 217, 61, 0.45);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: none;
}

a.version-badge:hover {
  background: rgba(255, 217, 61, 0.24);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.top-btn,
.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.top-btn:hover,
.top-link:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.top-btn.is-active {
  border-color: rgba(34, 229, 255, 0.6);
  color: var(--cyan);
  background: rgba(34, 229, 255, 0.12);
}

.top-btn:focus-visible,
.top-link:focus-visible,
.version-badge:focus-visible,
.corner-mute-btn:focus-visible,
.speed-btn:focus-visible,
.option-chip:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.loop-step-btn:focus-visible,
.loop-start-main:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ================= STAGE & 4:3 SPECTRUM CANVAS FRAME ================= */
.stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-frame {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
}

.canvas-frame:fullscreen {
  border: none;
  border-radius: 0;
  background: #000000;
}

#game-canvas {
  display: block;
  width: min(100cqw, calc(100cqh * 4 / 3));
  height: min(100cqh, calc(100cqw * 3 / 4));
  image-rendering: pixelated;
}

/* Subtle Corner Mute Button */
.corner-mute-btn {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(7, 9, 16, 0.85);
  border: 1px solid rgba(34, 229, 255, 0.5);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.corner-mute-btn:hover {
  background: rgba(16, 20, 32, 0.96);
  border-color: var(--yellow);
  color: var(--yellow);
}

.corner-mute-btn.is-muted {
  border-color: rgba(255, 75, 92, 0.72);
  color: #ff8a96;
}

/* Subtle Corner Toast for In-Game Graphics Mode Toggle */
.gfx-toast {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 7;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(7, 9, 16, 0.88);
  border: 1px solid rgba(34, 229, 255, 0.55);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.gfx-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================= OVERLAYS ================= */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.overlay-title.is-fullscreen-menu {
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 217, 61, 0.09) 0%, transparent 45%),
    radial-gradient(circle at 82% 85%, rgba(34, 229, 255, 0.08) 0%, transparent 48%),
    linear-gradient(180deg, #0b0f1b 0%, #070910 100%);
  padding: clamp(12px, 2.6cqh, 28px) clamp(16px, 3cqw, 36px);
}

.overlay-modal {
  background: rgba(5, 7, 14, 0.82);
  backdrop-filter: blur(4px);
}

/* ================= FULL-SCREEN MAIN MENU ================= */
.title-screen {
  width: 100%;
  max-width: 1120px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2.2cqh, 22px);
}

.menu-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
}

.best-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 217, 61, 0.12);
  border: 1px solid rgba(255, 217, 61, 0.42);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.title-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.title-logo {
  margin: 0;
  font-size: clamp(1.85rem, 5.4cqh, 3.3rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.05;
  color: var(--yellow);
  text-shadow: 0 3px 0 #8a5a00, 0 8px 24px rgba(255, 217, 61, 0.2);
}

.title-tagline {
  margin: 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: clamp(0.82rem, 1.85cqh, 0.96rem);
  line-height: 1.42;
  text-wrap: balance;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2cqw, 20px);
}

.menu-panel {
  background: rgba(16, 20, 32, 0.9);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: clamp(10px, 1.9cqh, 16px) clamp(12px, 1.6cqw, 16px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-heading {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yellow);
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(42, 53, 82, 0.75);
}

.controls-list,
.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.9cqh, 8px);
  font-size: clamp(0.75rem, 1.65cqh, 0.84rem);
  color: var(--text);
}

.controls-list li,
.info-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.controls-list li {
  justify-content: space-between;
}

.key-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.loop-tag {
  flex: 0 0 auto;
  min-width: 58px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.tag-green {
  background: rgba(47, 224, 94, 0.15);
  border: 1px solid rgba(47, 224, 94, 0.5);
  color: #6df28e;
}

.tag-yellow {
  background: rgba(255, 217, 61, 0.14);
  border: 1px solid rgba(255, 217, 61, 0.5);
  color: var(--yellow);
}

.tag-magenta {
  background: rgba(242, 76, 224, 0.16);
  border: 1px solid rgba(242, 76, 224, 0.52);
  color: #ff8df2;
}

.panel-note {
  margin: 2px 0 0;
  font-size: clamp(0.72rem, 1.5cqh, 0.8rem);
  color: var(--muted);
  line-height: 1.35;
}

.menu-options-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.speed-chip {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(16, 20, 32, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.speed-chip.is-custom {
  background: rgba(255, 217, 61, 0.1);
  border-color: rgba(255, 217, 61, 0.55);
}

.speed-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.speed-chip.is-custom .speed-label {
  color: var(--yellow);
}

.speed-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.speed-btn {
  min-width: 26px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.speed-btn:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.speed-btn.is-default-selected {
  background: rgba(34, 229, 255, 0.16);
  border-color: rgba(34, 229, 255, 0.65);
  color: var(--cyan);
}

.speed-btn.is-custom-selected {
  background: rgba(255, 217, 61, 0.24);
  border-color: var(--yellow);
  color: var(--yellow);
}

.speed-hint {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.speed-chip.is-custom .speed-hint {
  color: #f6e7a6;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(16, 20, 32, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.option-chip:hover {
  border-color: var(--yellow);
}

.option-chip.is-custom {
  background: rgba(255, 217, 61, 0.1);
  border-color: rgba(255, 217, 61, 0.55);
}

.option-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.option-chip.is-custom .option-label {
  color: var(--yellow);
}

.option-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cyan);
}

.option-chip.is-custom .option-value {
  color: var(--yellow);
}

.menu-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 12px;
}

.loop-start-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  background: rgba(16, 20, 32, 0.94);
  border: 1px solid rgba(34, 229, 255, 0.55);
  box-shadow: 0 4px 16px rgba(34, 229, 255, 0.14);
  overflow: hidden;
}

.loop-step-btn,
.loop-start-main {
  border: none;
  background: transparent;
  color: var(--cyan);
  font-family: inherit;
  font-size: clamp(0.8rem, 1.65cqh, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.loop-step-btn {
  padding: clamp(8px, 1.5cqh, 12px) 11px;
  font-family: var(--font-mono);
  color: var(--text);
  border-inline: 1px solid rgba(34, 229, 255, 0.2);
}

.loop-step-btn:first-child {
  border-left: none;
}

.loop-step-btn:last-child {
  border-right: none;
}

.loop-start-main {
  padding: clamp(8px, 1.5cqh, 12px) clamp(12px, 1.4cqw, 16px);
  white-space: nowrap;
}

.loop-step-btn:hover:not(:disabled),
.loop-start-main:hover:not(:disabled) {
  background: rgba(34, 229, 255, 0.14);
  color: var(--yellow);
}

.loop-step-btn:disabled {
  opacity: 0.34;
  color: var(--muted);
  cursor: default;
}

/* ================= BUTTONS & KBD ================= */
kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: #0d1220;
  border: 1px solid #41517a;
  box-shadow: 0 1px 0 #05070e;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: baseline;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: clamp(8px, 1.5cqh, 12px) clamp(14px, 1.8cqw, 22px);
  border-radius: 8px;
  font-family: inherit;
  font-size: clamp(0.84rem, 1.75cqh, 0.96rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease, border-color 0.15s ease;
}

.btn-keys {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.9em;
  letter-spacing: 0.01em;
}

.btn-keys kbd {
  padding: 1px 4px;
  font-size: 0.68em;
}

.btn-keys .kbd-sep {
  opacity: 0.65;
  font-size: 0.78em;
  font-weight: 700;
}

.btn-primary:has(.btn-keys) {
  gap: 6px;
  padding-inline: clamp(10px, 1.3cqw, 16px);
}

.btn-primary {
  background: linear-gradient(180deg, #ffe25a 0%, #eab308 100%);
  border: 1px solid #fff099;
  color: #11131a;
  box-shadow: 0 4px 18px rgba(255, 217, 61, 0.28);
}

.btn-primary kbd {
  background: rgba(17, 19, 26, 0.18);
  border-color: rgba(17, 19, 26, 0.4);
  color: #11131a;
  box-shadow: none;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-danger {
  background: rgba(255, 75, 92, 0.18);
  border: 1px solid rgba(255, 75, 92, 0.65);
  color: #ff9ea8;
}

.btn-danger:hover {
  background: rgba(255, 75, 92, 0.3);
  color: #ffffff;
}

/* ================= MODALS (PAUSE & GAME OVER) ================= */
.modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: clamp(16px, 3cqh, 26px);
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.end-card {
  max-width: 520px;
}

.modal-title {
  margin: 0;
  font-size: clamp(1.35rem, 3.2cqh, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--yellow);
}

.modal-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.end-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.new-best-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(47, 224, 94, 0.18);
  border: 1px solid rgba(47, 224, 94, 0.6);
  color: #77f598;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.stats-grid {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat-box {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.stat-gold {
  color: var(--yellow);
}

/* ================= CONTROLS LEGEND FOOTER ================= */
.controls-legend {
  flex: 0 0 auto;
  padding: 5px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 0.74rem;
  color: var(--muted);
}

.legend-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.legend-sep {
  opacity: 0.5;
}

/* ================= COMPACT HEIGHT / HIGH-DPI ADAPTATIONS ================= */
@media (max-height: 640px) {
  .app-shell {
    padding: 4px 10px 5px;
    gap: 4px;
  }

  .top-bar {
    min-height: 34px;
    padding: 4px 10px;
  }

  .controls-legend {
    padding: 4px 10px;
    font-size: 0.71rem;
  }

  .title-screen {
    gap: 8px;
  }

  .menu-panel {
    padding: 8px 11px;
    gap: 6px;
  }
}

@media (max-width: 680px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

/* ================= ADAPTIVE TOUCH CONTROLS (MOBILE / TABLET ONLY) ================= */
.touch-controls {
  display: none;
}

html[data-touch="true"] .controls-legend {
  display: none;
}

html[data-touch="true"] .touch-controls:not(.hidden) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html[data-touch="true"] .corner-mute-btn {
  z-index: 8;
}

.touch-dpad-zone,
.touch-jump-zone {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.touch-zone-hint {
  position: absolute;
  left: 16px;
  bottom: 46px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.34);
  pointer-events: none;
}

.touch-dpad {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.touch-dpad.is-active {
  opacity: 1;
}

.touch-dpad-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 229, 255, 0.08) 0%, rgba(16, 20, 32, 0.42) 75%);
  border: 2px solid rgba(34, 229, 255, 0.44);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.45);
}

.touch-dir {
  position: absolute;
  font-size: 0.72rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.36);
  transition: color 0.08s ease;
}

.touch-dir-up {
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
}

.touch-dir-down {
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
}

.touch-dir-left {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.touch-dir-right {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.touch-dir.is-on {
  color: var(--yellow);
}

.touch-dpad-puck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 232, 102, 0.9), rgba(234, 179, 8, 0.72));
  border: 2px solid rgba(255, 250, 205, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.touch-jump-btn {
  position: absolute;
  right: 22px;
  bottom: 24px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 20, 32, 0.48);
  border: 2px solid rgba(255, 217, 61, 0.6);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transition: transform 0.08s ease, background-color 0.08s ease, border-color 0.08s ease;
}

.touch-jump-btn.is-active {
  transform: scale(0.94);
  background: rgba(255, 217, 61, 0.28);
  border-color: var(--bright-white, #ffffff);
}

@media (orientation: portrait) {
  html[data-touch="true"] .canvas-frame {
    flex-direction: column;
    justify-content: flex-start;
  }

  html[data-touch="true"] #game-canvas {
    width: min(100cqw, calc(58cqh * 4 / 3));
    height: min(58cqh, calc(100cqw * 3 / 4));
    flex: 0 0 auto;
  }

  html[data-touch="true"] .touch-controls:not(.hidden) {
    position: relative;
    inset: auto;
    align-self: stretch;
    flex: 1 1 auto;
    width: 100%;
    min-height: 150px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(7, 9, 16, 0.45);
  }

  html[data-touch="true"] .touch-zone-hint {
    bottom: 14px;
  }

  html[data-touch="true"] .touch-jump-btn {
    right: 24px;
    bottom: 24px;
  }
}
