/* =========================================================================
   طريق التميس المستحيل - Retro Arcade Styling, High-Contrast Banners & Layout
   ========================================================================= */

:root {
  --bg-deep: #180f0d;
  --bg-panel: #291915;
  --bg-card: #36201a;
  --border-warm: #78442a;
  --accent-gold: #fbbf24;
  --accent-amber: #f59e0b;
  --accent-orange: #ea580c;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
  --text-cream: #fff7ed;
  --text-muted: #fed7aa;
  --shadow-hard: 0 6px 0 #110907;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, #2f1b14 0%, #140b09 100%);
  color: var(--text-cream);
  font-family: "Cairo", "Changa", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* ---------------- Top HUD Bar ---------------- */
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(20, 11, 9, 0.95);
  border-bottom: 3px solid #4d2a1c;
  flex-shrink: 0;
  z-index: 20;
}

.hud-right,
.hud-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #f59e0b, #d97706);
  color: #1c0f0a;
  font-weight: 900;
  font-size: 0.95rem;
  padding: 5px 12px;
  border-radius: 10px;
  border: 2px solid #fde68a;
  box-shadow: 0 3px 0 #78350f;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.brand-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #78350f;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2b1914;
  border: 2px solid #5c3424;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 3px 0 #120907;
}

.deaths-chip {
  border-color: #b91c1c;
  background: #381414;
  color: #fecaca;
}

.deaths-chip.bump {
  animation: chipBump 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chipBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.18) rotate(-2deg); background: #7f1d1d; }
  100% { transform: scale(1); }
}

.timer-chip {
  border-color: #92400e;
  color: #fde68a;
}

.chip-sep {
  opacity: 0.45;
}

.chip-sub {
  color: #fef3c7;
}

.mono-num {
  font-family: "Changa", monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #38211a;
  color: var(--text-cream);
  border: 2px solid #6c3e2b;
  border-radius: 10px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #120907;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}

.icon-btn:hover {
  background: #4a2c23;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #120907;
}

.icon-btn.muted-off {
  opacity: 0.58;
  border-color: #4b2c20;
}

.pc-hint {
  font-size: 0.72rem;
  background: #1d100c;
  border: 1px solid #78442a;
  padding: 1px 5px;
  border-radius: 4px;
  color: #fcd34d;
}

/* ---------------- Canvas Stage ---------------- */
.stage-wrap {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  min-height: 0;
  overflow: hidden;
}

.canvas-frame {
  position: relative;
  width: 100%;
  max-width: 1120px;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 4px solid #6b3d28;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 0 2px #1c0f0b;
  overflow: hidden;
  background: #ffedd5;
}

@media (min-aspect-ratio: 16/9) {
  .canvas-frame {
    height: 100%;
    width: auto;
  }
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.screen-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 11;
  background: rgba(168, 85, 247, 0.42);
  animation: flashFade 0.38s ease-out forwards;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------------- High-Contrast Readable Banners (3.5s + Smooth Fade-Out) ---------------- */
.taunt-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(14, 7, 6, 0.94);
  color: #ffffff;
  border: 3px solid #fbbf24;
  border-radius: 999px;
  padding: 9px 24px;
  font-size: clamp(1rem, 2.35vw, 1.35rem);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  width: max-content;
  max-width: 92%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72), 0 0 0 2px rgba(220, 38, 38, 0.75);
  z-index: 16;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.55s ease, transform 0.35s ease;
  animation: tauntPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.taunt-emoji {
  font-size: 1.25em;
  flex-shrink: 0;
}

.taunt-banner.fading-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

@keyframes tauntPop {
  0% { transform: translateX(-50%) scale(0.65) rotate(-3deg); opacity: 0; }
  100% { transform: translateX(-50%) scale(1) rotate(0deg); opacity: 1; }
}

.warning-banner {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 9, 6, 0.93);
  color: #fef08a;
  border: 2.5px solid #f97316;
  border-radius: 999px;
  padding: 7px 20px;
  font-size: clamp(0.9rem, 2vw, 1.14rem);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  width: max-content;
  max-width: 92%;
  z-index: 15;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.68);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.warning-banner.fading-out {
  opacity: 0;
}

/* ---------------- Sleek Non-Spoiler Level Intro Card ---------------- */
.intro-card-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 7, 5, 0.52);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 18;
  opacity: 1;
  transition: opacity 0.28s ease;
}

.intro-card-backdrop.fading-out {
  opacity: 0;
  pointer-events: none;
}

.intro-card {
  background: linear-gradient(180deg, rgba(38, 20, 15, 0.97) 0%, rgba(20, 10, 8, 0.98) 100%);
  border: 3px solid var(--accent-gold);
  border-radius: 20px;
  padding: clamp(16px, 2.8vw, 26px) clamp(20px, 3.6vw, 36px);
  max-width: min(490px, 92%);
  text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.82), 0 6px 0 #120907;
  animation: introPop 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-card-backdrop.fading-out .intro-card {
  transform: translateY(-10px) scale(0.96);
  transition: transform 0.28s ease;
}

@keyframes introPop {
  from { transform: translateY(14px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.intro-stage-pill {
  display: inline-block;
  background: #78350f;
  color: #fde68a;
  border: 2px solid #fbbf24;
  border-radius: 999px;
  padding: 3px 16px;
  font-size: 0.88rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.intro-stage-title {
  margin: 4px 0 6px;
  color: #ffffff;
  font-size: clamp(1.35rem, 3.4vw, 1.95rem);
  font-weight: 900;
  line-height: 1.25;
}

.intro-stage-flavor {
  margin: 0 auto 14px;
  color: #fed7aa;
  font-size: clamp(0.95rem, 2.1vw, 1.12rem);
  font-weight: 800;
  line-height: 1.45;
}

.intro-card-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.ready-btn {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  color: #1c0f0a;
  border: 2.5px solid #fef9c3;
  border-radius: 12px;
  padding: 7px 28px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 900;
  box-shadow: 0 4px 0 #92400e;
  cursor: pointer;
}

.ready-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #92400e;
}

.intro-move-prompt {
  font-size: 0.78rem;
  color: #fdba74;
  font-weight: 700;
}

/* ---------------- Pause Menu Card ---------------- */
.pause-card {
  width: min(440px, 94%);
}

.pause-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pause-audio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  margin-top: 2px;
}

.audio-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  background: #2b1812;
  color: #ffedd5;
  border: 2px solid #6c3e2b;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 3px 0 #120907;
  cursor: pointer;
}

.audio-toggle-btn.muted-off {
  opacity: 0.62;
  background: #1f110d;
  border-color: #4b2c20;
}

/* ---------------- Modal Overlays ---------------- */
.overlay-screen {
  position: absolute;
  inset: 0;
  background: rgba(16, 8, 6, 0.86);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 25;
  overflow-y: auto;
}

.modal-card {
  background: linear-gradient(180deg, #351e17 0%, #22120e 100%);
  border: 3px solid var(--accent-gold);
  border-radius: 20px;
  padding: clamp(14px, 2.5vw, 24px);
  width: min(560px, 96%);
  max-height: 96%;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 12px 0 #120907, 0 20px 50px rgba(0, 0, 0, 0.75);
}

.badge-top {
  display: inline-block;
  background: #7c2d12;
  color: #fde68a;
  border: 2px solid #f59e0b;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.gold-badge {
  background: #854d0e;
  border-color: #fde047;
  color: #fef9c3;
}

.game-logo {
  margin: 4px 0 6px;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 4px 0 #78350f;
  line-height: 1.2;
}

.game-tagline {
  margin: 0 auto 12px;
  font-size: clamp(0.86rem, 1.95vw, 1rem);
  color: #ffedd5;
  line-height: 1.55;
  max-width: 470px;
}

.game-tagline strong {
  color: #fca5a5;
}

.hero-preview {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 2px dashed #78442a;
  border-radius: 12px;
  padding: 6px 16px;
  margin-bottom: 14px;
  font-size: 1.35rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  padding: 11px 22px;
  font-family: inherit;
  font-size: clamp(1rem, 2.3vw, 1.2rem);
  font-weight: 900;
  color: #1c0f0a;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  border: 3px solid #fef9c3;
  border-radius: 14px;
  box-shadow: 0 5px 0 #92400e;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

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

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #92400e;
}

.pulse-btn {
  animation: gentlePulse 1.8s infinite ease-in-out;
}

@keyframes gentlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 800;
  color: #ffedd5;
  background: #43261d;
  border: 2px solid #854d37;
  border-radius: 12px;
  box-shadow: 0 4px 0 #180c09;
  cursor: pointer;
}

.secondary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #180c09;
}

.controls-guide {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: #fed7aa;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
}

.control-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ctrl-tag {
  background: #5c3424;
  color: #fde68a;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 800;
}

kbd {
  background: #1a0e0b;
  border: 1px solid #78442a;
  border-radius: 4px;
  padding: 0 5px;
  font-family: monospace;
  color: #fde68a;
}

/* ---------------- Victory Card ---------------- */
.victory-title {
  margin: 6px 0 4px;
  font-size: clamp(1.25rem, 3.4vw, 1.85rem);
  color: #fde047;
  font-weight: 900;
}

.victory-sub {
  margin: 0 0 12px;
  color: #fed7aa;
  font-size: 0.95rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.32);
  border: 2px solid #6b3d28;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.full-stat {
  grid-column: 1 / -1;
  border-color: #b45309;
  background: rgba(146, 64, 14, 0.22);
}

.stat-label {
  font-size: 0.82rem;
  color: #fdba74;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
}

.stat-rank {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fde047;
}

.victory-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.share-btn {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  border-color: #bbf7d0;
  box-shadow: 0 5px 0 #14532d;
  color: #052e16;
}

.share-feedback {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 900;
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.88);
  border: 2px solid #4ade80;
  border-radius: 999px;
  padding: 8px 18px;
  opacity: 1;
  transition: opacity 0.45s ease;
}

.share-feedback.fading-out {
  opacity: 0;
}

.hidden {
  display: none !important;
}

/* ---------------- Mobile Touch Controls ---------------- */
.touch-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 14px;
  gap: 16px;
  z-index: 30;
  pointer-events: none;
}

@media (hover: none) and (pointer: coarse), (max-width: 860px) {
  .touch-controls {
    display: flex;
  }
  .pc-hint {
    display: none;
  }
}

body.has-touch .touch-controls {
  display: flex;
}

.touch-dpad {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
  touch-action: none;
}

.touch-action {
  display: flex;
  align-items: center;
  pointer-events: auto;
  touch-action: none;
}

.touch-btn {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 237, 213, 0.16);
  backdrop-filter: blur(4px);
  border: 3px solid rgba(251, 191, 36, 0.55);
  color: #fff7ed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  touch-action: none;
  transition: transform 0.04s linear, background 0.06s linear;
}

.jump-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.28);
  border-color: rgba(253, 224, 71, 0.8);
}

.jump-label {
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 900;
  margin-top: -4px;
  color: #fef08a;
}

.touch-btn.pressed {
  transform: scale(0.91);
  background: rgba(251, 191, 36, 0.52);
  border-color: #fff;
}

@media (max-height: 540px) and (hover: none), (max-height: 540px) and (max-width: 960px) {
  .hud-bar {
    padding: 4px 10px;
  }
  .hud-chip, .brand-pill, .icon-btn {
    font-size: 0.76rem;
    padding: 3px 8px;
  }
  .stage-wrap {
    padding: 4px 8px;
  }
  .touch-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom, 6px);
    padding: 0 18px 8px;
  }
  .touch-btn {
    width: 62px;
    height: 62px;
    background: rgba(24, 14, 11, 0.36);
  }
  .jump-btn {
    width: 72px;
    height: 72px;
    background: rgba(245, 158, 11, 0.34);
  }
}

@media (max-width: 620px) {
  .hud-bar {
    padding: 6px 8px;
    gap: 5px;
  }
  .brand-title {
    display: none;
  }
  .chip-sep, .chip-sub {
    display: none;
  }
  .hud-chip {
    font-size: 0.78rem;
    padding: 3px 7px;
  }
  .stage-wrap {
    padding: 6px;
  }
  .taunt-banner {
    padding: 8px 16px;
    border-radius: 18px;
  }
}

/* ---------------- Death / Loss Taunt Overlay ---------------- */
.death-screen {
  background: rgba(24, 6, 6, 0.84);
  cursor: pointer;
}

.death-card {
  width: min(480px, 94%);
  border-color: #ef4444;
  background: linear-gradient(180deg, #3b1313 0%, #1d0909 100%);
  box-shadow: 0 12px 0 #120505, 0 20px 50px rgba(0, 0, 0, 0.85);
  animation: deathPop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes deathPop {
  0% { transform: scale(0.78) rotate(-2deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.death-badge {
  background: #991b1b;
  border-color: #f87171;
  color: #fee2e2;
}

.death-title {
  margin: 4px 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  color: #fca5a5;
  text-shadow: 0 4px 0 #450a0a;
}

.death-taunt-box {
  background: rgba(0, 0, 0, 0.38);
  border: 2px solid #fbbf24;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.death-big-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.death-taunt-text {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  font-weight: 900;
  color: #fef08a;
  line-height: 1.45;
}

.death-prompt {
  margin: 0 0 10px;
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  font-weight: 900;
  color: #ffffff;
  animation: gentlePulse 1.3s infinite ease-in-out;
}

.death-timer-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.death-timer-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #fbbf24);
  transition: width 0.08s linear;
}

.death-countdown-text {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fca5a5;
}

/* =========================================================================
   MOBILE UX & FULLSCREEN OVERHAUL (v3)
   ========================================================================= */
html,
body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

/* Always render overlays over the FULL viewport so modals never squish inside a small 16:9 mobile canvas */
.overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: max(10px, env(safe-area-inset-top, 10px)) max(10px, env(safe-area-inset-right, 10px)) max(10px, env(safe-area-inset-bottom, 10px)) max(10px, env(safe-area-inset-left, 10px));
}

.intro-card-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28; /* Below touchControls (40) so mobile players can move immediately to dismiss! */
  padding: 12px;
}

.touch-controls {
  z-index: 40;
}

/* Portrait Rotate Hint (ONLY shown on narrow portrait mobile screens) */
.rotate-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 12px;
  margin: 4px 12px 0;
  background: rgba(54, 32, 26, 0.9);
  border: 1.5px solid #92400e;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fde68a;
  flex-shrink: 0;
}

.rotate-fs-btn {
  background: linear-gradient(180deg, #fde047, #f59e0b);
  color: #1c0f0a;
  border: 1.5px solid #fef9c3;
  border-radius: 8px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

/* Mobile Portrait: maximize canvas width (edge-to-edge), show rotate hint, comfortable touch area */
@media (max-width: 860px) and (orientation: portrait) {
  .rotate-hint {
    display: flex;
  }

  .stage-wrap {
    padding: 4px 0;
    align-items: center;
  }

  .canvas-frame {
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-width: 3px;
  }

  .touch-controls {
    padding: 12px 18px max(18px, env(safe-area-inset-bottom, 18px));
  }

  .touch-btn {
    width: 78px;
    height: 78px;
  }

  .jump-btn {
    width: 90px;
    height: 90px;
  }
}

/* Mobile Landscape: TRUE FULL-HEIGHT edge-to-edge canvas + floating compact HUD + compact modals (ZERO scroll!) */
@media (max-height: 540px) and (orientation: landscape), (max-width: 960px) and (max-height: 540px) {
  .rotate-hint {
    display: none !important;
  }

  .hud-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 3px 10px;
    background: rgba(20, 11, 9, 0.72);
    backdrop-filter: blur(4px);
    border-bottom: 2px solid rgba(120, 68, 42, 0.55);
    z-index: 35;
  }

  .brand-title,
  .chip-sep,
  .chip-sub {
    display: none;
  }

  .brand-pill {
    padding: 3px 8px;
    font-size: 0.78rem;
  }

  .hud-chip,
  .icon-btn {
    font-size: 0.75rem;
    padding: 3px 7px;
    border-radius: 8px;
  }

  .stage-wrap {
    padding: 0;
    width: 100vw;
    height: 100dvh;
  }

  .canvas-frame {
    height: 100dvh;
    max-height: 100dvh;
    max-width: 100vw;
    width: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .taunt-banner {
    top: 42px;
    padding: 5px 14px;
    font-size: 0.88rem;
    border-width: 2px;
  }

  .warning-banner {
    top: 84px;
    padding: 4px 12px;
    font-size: 0.82rem;
  }

  .touch-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: max(6px, env(safe-area-inset-bottom, 6px));
    padding: 0 max(14px, env(safe-area-inset-right, 14px)) 4px max(14px, env(safe-area-inset-left, 14px));
  }

  .touch-btn {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(24, 14, 11, 0.42);
  }

  .jump-btn {
    width: 74px;
    height: 74px;
    background: rgba(245, 158, 11, 0.36);
  }

  /* Compact modals so EVERYTHING fits with zero scrolling on short landscape phones */
  .modal-card {
    padding: 12px 16px;
    max-height: 94dvh;
    width: min(500px, 92vw);
    border-radius: 16px;
  }

  .death-card {
    padding: 10px 16px;
    width: min(440px, 90vw);
  }

  .death-title {
    margin: 2px 0 6px;
    font-size: 1.35rem;
  }

  .death-taunt-box {
    padding: 8px 12px;
    margin-bottom: 8px;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  .death-big-emoji {
    font-size: 1.7rem;
  }

  .death-taunt-text {
    font-size: 1rem;
  }

  .death-prompt {
    margin: 0 0 6px;
    font-size: 0.92rem;
  }

  .game-logo {
    font-size: 1.4rem;
    margin: 2px 0 4px;
  }

  .game-tagline {
    font-size: 0.82rem;
    margin-bottom: 6px;
  }

  .hero-preview {
    padding: 3px 12px;
    margin-bottom: 8px;
    font-size: 1.05rem;
  }

  .controls-guide {
    margin-top: 8px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .intro-card {
    padding: 12px 18px;
    max-width: min(430px, 88vw);
  }

  .intro-stage-title {
    font-size: 1.25rem;
  }

  .intro-stage-flavor {
    font-size: 0.88rem;
    margin-bottom: 8px;
  }

  .victory-title {
    font-size: 1.2rem;
  }

  .victory-sub {
    font-size: 0.82rem;
    margin-bottom: 8px;
  }

  .stats-grid {
    gap: 6px;
    margin-bottom: 8px;
  }

  .stat-box {
    padding: 5px 8px;
  }

  .stat-value {
    font-size: 1.15rem;
  }
}
