/* BUG KONG - Design moderno cyberpunk */

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

:root {
  --neon-cyan: #00e5ff;
  --neon-pink: #ff2d78;
  --neon-green: #00ff88;
  --neon-yellow: #ffd60a;
  --neon-purple: #a855f7;
  --bg-dark: #07070f;
  --bg-panel: rgba(12, 16, 32, 0.72);
  --glass-border: rgba(0, 229, 255, 0.25);
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Orbitron', sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 0 40px rgba(0, 229, 255, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: var(--font-ui);
  color: #e8eeff;
  touch-action: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-dark);
}

#app-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#game-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 4 / 3;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(8px);
  container-type: size;
  container-name: game;
}

#game-viewport {
  position: absolute;
  inset: 0;
}

.game-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  container-type: size;
  container-name: stage;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.35));
}

.menu-brand-logo {
  position: relative;
  z-index: 1;
  height: clamp(40px, 8vw, 56px);
  margin: 0 auto 0.25rem;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #050510;
}

#crt-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.25) 100%);
  z-index: 5;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 1.25rem;
}

.screen.active { display: flex; }
.screen.hidden { display: none !important; }

/* Menu — deixa passar toque nas bordas (joystick fica por cima via z-index) */
#screen-menu {
  background: transparent;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem 0.75rem;
  pointer-events: none;
}

#screen-menu .menu-stack,
#screen-menu .menu-stack * {
  pointer-events: auto;
}

.menu-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(320px, 100%);
  max-height: 100%;
  transform-origin: center center;
}

@container game (max-height: 560px) {
  .menu-stack { transform: scale(0.92); }
}

@container game (max-height: 500px) {
  .menu-stack { transform: scale(0.84); }
}

.menu-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  width: 100%;
  align-items: center;
}

.menu-footer .museum-link {
  height: 100%;
  justify-content: center;
}

.museum-link img,
.creator-link img {
  width: min(96px, 90%);
  height: auto;
  object-fit: contain;
  margin-bottom: 0.15rem;
  pointer-events: none;
  border-radius: 4px;
}

.museum-card img {
  filter: drop-shadow(0 0 8px rgba(255, 45, 120, 0.35));
}

.creator-link img {
  filter: drop-shadow(0 0 8px rgba(0, 119, 255, 0.45));
}

.creator-link {
  color: #7eb8ff;
  background: rgba(0, 119, 255, 0.08);
  border-color: rgba(0, 119, 255, 0.28);
  text-shadow: 0 0 10px rgba(0, 119, 255, 0.35);
}

.creator-link:hover,
.creator-link:focus {
  background: rgba(0, 119, 255, 0.14);
  border-color: #7eb8ff;
}

.menu-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: url('assets/images/menu-bg.png') center / cover no-repeat;
}

.menu-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(7, 7, 15, 0.72) 0%,
    rgba(15, 10, 35, 0.55) 45%,
    rgba(7, 7, 15, 0.78) 100%
  );
}

.menu-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

.game-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  text-align: center;
  z-index: 1;
  line-height: 1.05;
  letter-spacing: 0.06em;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.85));
}

.title-bug {
  color: var(--neon-pink);
  text-shadow: 0 0 30px rgba(255, 45, 120, 0.6);
}

.title-kong {
  color: var(--neon-cyan);
  text-shadow: 0 0 30px rgba(0, 229, 255, 0.6);
}

.subtitle {
  font-size: clamp(0.55rem, 1.4vw, 0.72rem);
  font-weight: 500;
  color: rgba(0, 255, 136, 0.95);
  margin: 0.2rem 0 0.55rem;
  z-index: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  max-width: 420px;
  line-height: 1.4;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.ranking-preview {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.55rem;
  z-index: 1;
  width: 100%;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.ranking-preview h3 {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--neon-yellow);
  margin-bottom: 0.45rem;
  text-align: center;
  letter-spacing: 0.1em;
}

.ranking-preview ol {
  list-style: none;
  font-size: 0.76rem;
}

.ranking-preview-head,
.ranking-preview li {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.ranking-preview-head {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.2rem;
}

.ranking-preview li {
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ranking-preview li.ranking-empty {
  display: block;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  grid-column: 1 / -1;
}

.ranking-preview li:last-child { border-bottom: none; }
.ranking-preview .rank-pos { color: var(--neon-yellow); font-weight: 700; }
.ranking-preview .rank-name { color: var(--neon-cyan); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-preview .rank-score { color: var(--neon-green); font-weight: 600; text-align: right; }

.ranking-preview li.ranking-current,
#ranking-table tr.ranking-current td {
  background: rgba(255, 214, 10, 0.08);
}

.ranking-preview li.ranking-current .rank-name,
#ranking-table tr.ranking-current td:nth-child(2) {
  color: var(--neon-yellow);
}

.menu-form {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

#player-name {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#player-name::placeholder { color: rgba(255, 255, 255, 0.35); }

#player-name:focus {
  border-color: var(--neon-cyan);
  background: rgba(0, 229, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15);
}

.menu-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  width: 100%;
}

.menu-buttons .btn-primary {
  grid-column: 1 / -1;
}

.btn {
  padding: 0.62rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: #e8eeff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.btn:hover, .btn:focus {
  background: rgba(0, 229, 255, 0.12);
  border-color: var(--neon-cyan);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 229, 255, 0.15));
  border-color: rgba(0, 255, 136, 0.5);
  color: var(--neon-green);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.3), rgba(0, 229, 255, 0.25));
  box-shadow: 0 4px 24px rgba(0, 255, 136, 0.25);
}

.museum-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  color: var(--neon-cyan);
  font-family: var(--font-display);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.24);
  border-radius: var(--radius-sm);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.museum-link span {
  color: rgba(232, 238, 255, 0.68);
  font-family: var(--font-ui);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.museum-link:hover,
.museum-link:focus {
  background: rgba(0, 229, 255, 0.14);
  border-color: var(--neon-cyan);
  transform: translateY(-1px);
}

/* Splash */
#screen-splash {
  background: var(--bg-dark);
}

.splash-content { text-align: center; }

.splash-logo {
  font-size: 3.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.splash-text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.75rem;
  color: var(--neon-cyan);
  margin-top: 1rem;
}

.splash-sub {
  color: var(--neon-purple);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Modal panels */
.modal-panel, .quiz-panel {
  background: var(--bg-panel);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  max-width: 90%;
  max-height: 85%;
  overflow-y: auto;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
  text-align: center;
}

.modal-panel h2, .quiz-panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  color: var(--neon-yellow);
  margin-bottom: 1.1rem;
  letter-spacing: 0.08em;
}

.instructions-content, .credits-content {
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
  color: rgba(232, 238, 255, 0.85);
}

.instructions-content ul { margin: 0.5rem 0 0.5rem 1.5rem; }
.instructions-content li { margin: 0.35rem 0; }

/* Ranking table */
#ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
}

#ranking-table th {
  color: var(--neon-cyan);
  padding: 0.6rem;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3);
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#ranking-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#ranking-table tr:nth-child(1) td { color: var(--neon-yellow); font-weight: 600; }
#ranking-table tr:nth-child(2) td { color: #d4d4d8; }
#ranking-table tr:nth-child(3) td { color: #d97706; }

/* Quiz */
.quiz-panel { width: min(620px, 95%); }

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}

.quiz-icon { font-size: 1.5rem; }

.quiz-category {
  background: linear-gradient(135deg, var(--neon-purple), #6366f1);
  color: #fff;
  padding: 0.3rem 0.65rem;
  font-size: 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.quiz-enade {
  text-align: left;
  margin-bottom: 1.1rem;
  max-height: min(42vh, 280px);
  overflow-y: auto;
  padding-right: 0.35rem;
}

.quiz-context {
  font-size: clamp(0.82rem, 2.2vw, 0.95rem);
  line-height: 1.55;
  color: rgba(232, 238, 255, 0.88);
  font-weight: 400;
  margin-bottom: 0.85rem;
}

.quiz-command {
  font-size: clamp(0.9rem, 2.4vw, 1.05rem);
  line-height: 1.5;
  color: #fff;
  font-weight: 600;
  border-left: 3px solid var(--neon-cyan);
  padding-left: 0.65rem;
}

.quiz-question {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  line-height: 1.65;
  margin-bottom: 1.35rem;
  color: #fff;
  font-weight: 500;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.quiz-option {
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius-sm);
  color: #e8eeff;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.quiz-option:hover {
  border-color: var(--neon-cyan);
  background: rgba(0, 229, 255, 0.1);
  transform: translateX(4px);
}

.quiz-option.selected {
  border-color: var(--neon-cyan);
  background: rgba(0, 229, 255, 0.18);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.25);
  transform: translateX(4px);
}

.quiz-option.correct {
  border-color: var(--neon-green);
  background: rgba(0, 255, 136, 0.15);
}

.quiz-option.wrong {
  border-color: var(--neon-pink);
  background: rgba(255, 45, 120, 0.15);
}

.quiz-hint {
  margin-top: 1.1rem;
  font-size: 0.78rem;
  color: var(--neon-green);
  font-weight: 500;
}

.quiz-controls-hint {
  margin-top: 0.35rem;
  color: rgba(0, 229, 255, 0.85);
  display: none;
}

html.mobile-layout .quiz-controls-hint,
html.touch-device .quiz-controls-hint {
  display: block;
}

/* Game Over / Victory */
.gameover-panel h2 { color: var(--neon-pink); }
.victory-panel h2 { color: var(--neon-green); }

#gameover-score, #victory-score, #victory-message {
  margin: 1rem 0;
  font-size: 0.95rem;
  color: rgba(232, 238, 255, 0.85);
}

.pause-panel .btn { margin: 0.35rem; }

/* HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#hud.hidden { display: none; }

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(0.45rem, 1.4vw, 0.58rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  background: rgba(7, 7, 15, 0.55);
  border: 1px solid rgba(0, 229, 255, 0.15);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.hud-top {
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.4rem 0.65rem;
}

.hud-brand-logo {
  height: clamp(18px, 4.5vw, 46px);
  width: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.35));
}

.hud-player-strip {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.hud-player-strip #hud-name {
  color: var(--neon-cyan);
  font-size: clamp(0.48rem, 1.5vw, 0.62rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

.hud-player-strip #hud-score {
  color: var(--neon-yellow);
  font-size: clamp(0.52rem, 1.6vw, 0.68rem);
}

.hud-lives {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  flex-shrink: 0;
}

.hud-life-icon {
  height: clamp(14px, 4vw, 44px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 45, 120, 0.45));
  transition: opacity 0.2s, filter 0.2s;
}

.hud-life-icon.lost {
  opacity: 0.22;
  filter: grayscale(1) brightness(0.6);
}

.hud-top span { color: var(--neon-cyan); }
.hud-bottom span { color: var(--neon-green); }

#hud-lives { color: inherit !important; }

#hud-shield {
  color: var(--neon-cyan) !important;
  animation: shieldPulse 0.6s ease-in-out infinite alternate;
}

#hud-shield.hidden { display: none; }

@keyframes shieldPulse {
  from { opacity: 0.75; }
  to { opacity: 1; text-shadow: 0 0 12px var(--neon-cyan); }
}

#hud-fps {
  color: rgba(255, 255, 255, 0.4) !important;
  font-size: 0.38rem;
}

/* Touch controls */
#touch-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0.75rem;
  z-index: 25;
  pointer-events: none;
}

#touch-controls.hidden { display: none; }

#joystick, .touch-jump { pointer-events: auto; }

#joystick {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.08);
  border: 2px solid rgba(0, 229, 255, 0.35);
  touch-action: none;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

#joystick.active {
  border-color: rgba(0, 229, 255, 0.6);
  background: rgba(0, 229, 255, 0.14);
}

#joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.35);
  border: 2px solid rgba(0, 229, 255, 0.7);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
  pointer-events: none;
  will-change: transform;
}

#joystick.active #joystick-knob {
  background: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.5);
}

.touch-btn {
  width: 52px;
  height: 52px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--neon-cyan);
  font-size: 1.25rem;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  transition: background 0.15s;
}

.touch-btn:active {
  background: rgba(0, 229, 255, 0.35);
}

.touch-jump {
  width: 68px;
  height: 68px;
  border-color: rgba(0, 255, 136, 0.5);
  color: var(--neon-green);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  background: rgba(0, 255, 136, 0.12);
  touch-action: none;
}

/* ===== Layout mobile (celular / touch) ===== */
html.mobile-layout,
html.mobile-layout body {
  height: 100%;
  overflow: hidden;
}

html.mobile-layout #app {
  align-items: stretch;
  justify-content: stretch;
  padding:
    env(safe-area-inset-top, 0)
    env(safe-area-inset-right, 0)
    env(safe-area-inset-bottom, 0)
    env(safe-area-inset-left, 0);
}

html.mobile-layout #app-bg-canvas {
  display: none;
}

html.mobile-layout #game-container {
  display: flex !important;
  flex-direction: column !important;
  max-width: 100% !important;
  width: 100% !important;
  height: 100svh !important;
  height: 100dvh !important;
  max-height: 100svh !important;
  max-height: 100dvh !important;
  aspect-ratio: unset !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  container-type: normal;
}

html.mobile-layout #game-viewport {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  width: 100% !important;
  display: grid !important;
  place-items: center !important;
  container-type: size;
  container-name: viewport;
  background: #030308;
}

html.mobile-layout .game-stage {
  position: relative !important;
  inset: auto !important;
  width: min(100cqw, calc(100cqh * 4 / 3)) !important;
  height: min(100cqh, calc(100cqw * 3 / 4)) !important;
}

html.mobile-layout #game-canvas {
  width: 100%;
  height: 100%;
}

html.mobile-layout #touch-controls:not(.hidden) {
  display: flex !important;
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  min-height: 76px !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0.4rem 0.75rem !important;
  padding-bottom: max(0.4rem, env(safe-area-inset-bottom, 0)) !important;
  z-index: 30 !important;
  background: #07070f !important;
  border-top: 1px solid rgba(0, 229, 255, 0.2) !important;
  pointer-events: none;
}

html.mobile-layout #touch-controls.hidden {
  display: none !important;
}

/* HUD proporcional ao canvas (não à tela inteira) */
html.mobile-layout .game-stage #hud {
  padding: 1.5cqh 2cqw;
}

html.mobile-layout .game-stage .hud-row {
  padding: 1.2cqh 2cqw;
  font-size: clamp(7px, 2.8cqw, 11px);
  gap: 1cqw;
  border-radius: 4px;
}

html.mobile-layout .game-stage .hud-top {
  gap: 1.5cqw;
  padding: 1.2cqh 2cqw;
}

html.mobile-layout .game-stage .hud-brand-logo {
  height: clamp(12px, 7cqh, 22px) !important;
}

html.mobile-layout .game-stage .hud-life-icon {
  height: clamp(10px, 6cqh, 18px) !important;
  width: auto;
}

html.mobile-layout .game-stage .hud-lives {
  gap: 0.8cqw;
}

html.mobile-layout .game-stage .hud-player-strip #hud-name {
  font-size: clamp(7px, 2.6cqw, 10px);
  max-width: 9rem;
}

html.mobile-layout .game-stage .hud-player-strip #hud-score {
  font-size: clamp(7px, 2.8cqw, 11px);
}

html.mobile-layout .game-stage .hud-bottom {
  justify-content: center;
  flex-wrap: wrap;
  gap: 1cqw 2cqw;
  font-size: clamp(6px, 2.4cqw, 9px);
}

html.mobile-layout .game-stage #hud-fps,
html.mobile-layout .game-stage #hud-questions {
  display: none !important;
}

/* Joystick compacto */
html.mobile-layout #joystick {
  width: 80px;
  height: 80px;
}

html.mobile-layout #joystick-knob {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
}

html.mobile-layout .touch-jump {
  width: 54px;
  height: 54px;
  font-size: 0.6rem;
}

/* Menu mobile */
html.mobile-layout #screen-menu {
  padding: 0.35rem 0.5rem 0.2rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

html.mobile-layout .menu-stack {
  width: min(100%, 300px);
  transform: scale(0.9);
  transform-origin: center top;
}

html.mobile-layout #game-container:has(#touch-controls:not(.hidden)) .menu-stack {
  transform: scale(0.84);
}

html.mobile-layout .menu-brand-logo {
  height: clamp(28px, 6cqh, 40px);
  margin-bottom: 0.1rem;
}

html.mobile-layout .game-title {
  font-size: clamp(1.25rem, 6cqw, 1.75rem);
}

html.mobile-layout .subtitle {
  font-size: clamp(0.45rem, 2.2cqw, 0.55rem);
  margin: 0.1rem 0 0.3rem;
}

html.mobile-layout .ranking-preview {
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.3rem;
  width: 100%;
}

html.mobile-layout .ranking-preview h3 {
  font-size: 0.55rem;
  margin-bottom: 0.25rem;
}

html.mobile-layout .ranking-preview ol {
  font-size: 0.65rem;
}

html.mobile-layout .menu-form {
  gap: 0.3rem;
}

html.mobile-layout #player-name {
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
}

html.mobile-layout .btn {
  padding: 0.48rem 0.5rem;
  font-size: 0.65rem;
}

html.mobile-layout .museum-link {
  font-size: 0.45rem;
  padding: 0.28rem 0.32rem;
}

html.mobile-layout .museum-link span {
  font-size: 0.42rem;
}

html.mobile-layout .museum-link img,
html.mobile-layout .creator-link img {
  width: min(64px, 80%);
}

html.mobile-layout .screen {
  padding: 0.5rem;
}

html.mobile-layout .modal-panel,
html.mobile-layout .quiz-panel {
  max-width: 96%;
  max-height: 88%;
  padding: 0.9rem;
}

html.mobile-layout .quiz-enade {
  max-height: min(34vh, 200px);
}

html.mobile-layout .quiz-context {
  font-size: 0.78rem;
  line-height: 1.45;
}

html.mobile-layout .quiz-command {
  font-size: 0.85rem;
}

html.mobile-layout .quiz-question {
  font-size: 0.85rem;
}

html.mobile-layout .quiz-option {
  padding: 0.65rem 0.8rem;
  font-size: 0.8rem;
}

html.mobile-layout .instructions-content,
html.mobile-layout .credits-content {
  font-size: 0.8rem;
  line-height: 1.5;
}

html.mobile-layout #ranking-table {
  font-size: 0.7rem;
}

/* Paisagem no celular */
@media (orientation: landscape) {
  html.mobile-layout .menu-stack {
    transform: scale(0.75);
  }

  html.mobile-layout #game-container:has(#touch-controls:not(.hidden)) .menu-stack {
    transform: scale(0.68);
  }

  html.mobile-layout #touch-controls:not(.hidden) {
    min-height: 64px !important;
    padding: 0.25rem 0.5rem !important;
  }

  html.mobile-layout #joystick {
    width: 68px;
    height: 68px;
  }

  html.mobile-layout #joystick-knob {
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
  }

  html.mobile-layout .touch-jump {
    width: 46px;
    height: 46px;
  }
}

@media (min-width: 769px) {
  #touch-controls { display: none !important; }
}

@media (min-width: 769px) {
  html.touch-device #touch-controls:not(.hidden) {
    display: flex !important;
    position: absolute !important;
  }
}

/* Screen shake */
.shake { animation: shake 0.3s ease-in-out; }

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}
