/* Touch-only gameplay layout. Desktop styles and input remain unchanged. */
#mobileControls[hidden], #mobilePause[hidden], #rotatePrompt[hidden],
#controlEditor[hidden], #editControls[hidden], #rotatePrompt button[hidden] { display: none !important; }
.mobile-help { display: none; }
.touch-device .mobile-help { display: block; }
.touch-device .desktop-help { display: none; }
body.touch-device {
  box-sizing: border-box; width: var(--view-width, 100%); max-width: 100%;
  height: var(--view-height, 100dvh); min-height: 0 !important;
  padding: 0 !important; overflow: hidden !important;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
.touch-device .spooky-btn, .touch-device .spooky-title,
.touch-device .game-title, .touch-device .game-rules h3 {
  font-family: Barnabey, sans-serif !important; font-weight: normal !important;
}
.mobile-entry #homeScreen { visibility: hidden; pointer-events: none; }
.touch-device #namePromptModal {
  box-sizing: border-box; width: var(--view-width); height: var(--view-height);
  padding: 16px; overflow-y: auto;
}
.touch-device #namePromptModal .dialog-content {
  box-sizing: border-box; width: min(400px, 100%); min-width: 0;
  max-height: 100%; overflow-y: auto; padding: 22px;
}
.touch-device #namePromptInput { box-sizing: border-box; min-width: 0; font-size: 18px !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.mobile-game {
  --stick-size: clamp(104px, calc(var(--view-height, 100dvh) * .31), 136px);
  --action-size: clamp(58px, calc(var(--view-height, 100dvh) * .18), 76px);
  overflow: hidden !important;
  overscroll-behavior: none;
  padding: 0 !important;
  width: var(--view-width, 100%); height: var(--view-height, 100dvh);
}
.mobile-game .game-container {
  position: fixed !important; inset: 0 !important;
  box-sizing: border-box; width: var(--view-width, 100%) !important; height: var(--view-height, 100dvh) !important;
  padding: calc(44px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)) !important;
  align-items: center !important; justify-content: center !important;
  flex-wrap: nowrap !important; gap: 0 !important; touch-action: none;
}
.mobile-game.mobile-local .game-container { padding-inline: calc(8px + env(safe-area-inset-left)) calc(8px + env(safe-area-inset-right)) !important; }
.mobile-game #gameCanvas {
  position: relative !important; inset: auto !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(var(--view-width, 100vw) - 20px) !important;
  max-height: calc(var(--view-height, 100dvh) - 54px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  aspect-ratio: 4 / 3; object-fit: contain;
  margin: 0 !important; border: 1px solid #f5d98045 !important; border-radius: 10px !important;
  flex-shrink: 1; box-shadow: 0 10px 38px #0009 !important; touch-action: none;
}
.mobile-game:not(.mobile-local) #gameCanvas {
  width: auto !important;
  max-width: calc(var(--view-width, 100vw) - var(--stick-size) - var(--action-size) - 48px) !important;
  transform: translateX(calc((var(--stick-size) - var(--action-size)) / 2));
}
.mobile-game .controls, .mobile-game #fullscreenToggle, .mobile-game #musicToggleBtn, .mobile-game #playerNameDisplay { display: none !important; }
/* Page atmosphere must not composite a second animated layer over touch play. */
.mobile-game #fogCanvas,
.mobile-game .vignette,
.mobile-game #spooky-decorations,
.mobile-game #spooky-trees { display: none !important; }
.music-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.music-toggle .music-off { display: none; }
.music-toggle.muted .music-off { display: block; }
/* A single quiet score line, not a row of outlined name cards. */
.mobile-game #scoreboard {
  position: fixed !important; top: env(safe-area-inset-top) !important;
  left: calc(10px + env(safe-area-inset-left)) !important;
  right: auto !important;
  width: calc(var(--view-width, 100vw) - 108px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important; min-width: 0 !important; max-width: none !important;
  height: 40px; box-sizing: border-box;
  display: flex !important; align-items: center; justify-content: flex-start; gap: 10px;
  padding: 0 !important; margin: 0 !important;
  background: none !important; border: 0 !important; border-radius: 0;
  box-shadow: none !important; backdrop-filter: none !important;
  transform: none !important; animation: none !important; transition: none !important;
  overflow: hidden; pointer-events: none; z-index: 1100;
}
.mobile-game #scoreboard h3, .mobile-game #scoreboard .rank,
.mobile-game #scoreboard::before, .mobile-game #scoreboard::after,
.mobile-game #scoreboard .score-item::before, .mobile-game #scoreboard .score-item::after { display: none !important; }
.mobile-game #scoreboard .score-item {
  flex: 0 1 132px; min-width: 0; max-width: 156px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 !important; margin: 0 !important; height: 28px;
  background: none !important; border: 0 !important; box-shadow: none !important;
  animation: none !important; transform: none !important;
}
.mobile-game #scoreboard .player-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 11px/1.3 system-ui, sans-serif !important; color: #dfdfd6 !important;
  margin: 0; letter-spacing: 0 !important; text-shadow: none !important;
}
.mobile-game #scoreboard .score {
  flex: 0 0 auto; padding: 0 !important; min-width: 0 !important;
  background: none !important; border: 0 !important; box-shadow: none !important;
  font: 700 14px/1 system-ui, sans-serif !important; color: #f5d980 !important;
  font-variant-numeric: tabular-nums; text-shadow: none !important;
}
.mobile-game #scoreboard .cursed-timer {
  order: -1; flex-shrink: 0; margin: 0 !important; padding-right: 10px;
  border-right: 1px solid #ffffff25;
  font: 600 12px/1 system-ui, sans-serif !important; text-shadow: none !important;
}
#mobileControls {
  --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  position: fixed; top: 0; left: 0; width: var(--view-width, 100vw); height: var(--view-height, 100dvh); z-index: 1100; pointer-events: none;
}
#mobileControls button, #mobilePause, .mobile-game #musicToggle {
  box-sizing: border-box; pointer-events: auto; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
  color: #f5eedc; font-family: system-ui, sans-serif;
}
#mobileStick {
  position: absolute; left: calc(12px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom));
  width: var(--stick-size); height: var(--stick-size); padding: 0;
  border: 1px solid #e7e0c530; border-radius: 50%;
  background: #09090d42; box-shadow: inset 0 0 20px #ffffff04, 0 10px 28px #0005;
}
.stick-ring { position: absolute; inset: 18%; border: 1px solid #e7e0c514; border-radius: 50%; pointer-events: none; }
#stickKnob {
  position: absolute; width: 52%; height: 52%; top: 24%; left: 24%;
  border: 1px solid #eee5cb65; box-sizing: border-box; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #b9b9a754, #686d6859);
  box-shadow: 0 3px 9px #0004; pointer-events: none;
}
#mobileStick.pressed { border-color: #f5d98080; }
#mobileStick.pressed #stickKnob { background: #c1ae7270; border-color: #f5d980b0; }
#mobileSprint {
  position: absolute; right: calc(12px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
  width: var(--action-size); height: var(--action-size);
  min-width: 44px; min-height: 44px;
  border: 1px solid #ecd99b66; border-radius: 50%; background: radial-gradient(circle at 38% 28%, #f5d98038, #09090d52 70%);
  display: flex; align-items: center; justify-content: center;
  padding: 0; box-shadow: 0 10px 28px #0005, inset 0 1px 0 #ffffff12; font: 18px/1 Barnabey, sans-serif;
}
#mobileSprint span { display: none !important; }
#mobileSprint svg { width: 46%; height: 46%; fill: #efd99a; filter: drop-shadow(0 1px 0 #0008); }
#mobileSprint.pressed { background: radial-gradient(circle at 38% 28%, #f5d98082, #9b7b3048 72%); border-color: #f5d980; transform: scale(.96); }
#mobilePause, .mobile-game #musicToggle {
  position: fixed !important; top: env(safe-area-inset-top) !important; bottom: auto !important; left: auto !important;
  width: 44px !important; height: 44px !important; min-height: 44px; padding: 11px !important;
  display: flex !important; align-items: center; justify-content: center;
  background: transparent !important; border: 0 !important; border-radius: 50%;
  box-shadow: none !important; font: 18px/1 system-ui, sans-serif !important;
  z-index: 1100; opacity: .85; transform: none !important;
}
#mobilePause { left: calc(var(--view-width, 100vw) - 52px - env(safe-area-inset-right)) !important; right: auto !important; }
.mobile-game #musicToggle { left: calc(var(--view-width, 100vw) - 96px - env(safe-area-inset-right)) !important; right: auto !important; }
#mobilePause svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
#mobileControls button:focus, #mobilePause:focus, #controlEditor button:focus { outline: none !important; box-shadow: none !important; }
#mobileControls button:focus-visible, #mobilePause:focus-visible, #controlEditor button:focus-visible { outline: 2px solid #f5d980 !important; outline-offset: 3px; }
#controlEditor {
  position: fixed; z-index: 16000;
  top: env(safe-area-inset-top); left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right));
  display: flex; gap: 10px; align-items: center; padding: 6px 10px;
  background: #16191af5; color: #eee9dc; border-radius: 10px;
  font: 12px/1.4 system-ui, sans-serif;
}
#controlEditor > div { flex: 1; min-width: 0; }
#controlEditor strong { display: block; font-size: 14px; }
#controlEditor button { min-height: 44px; padding: 6px 14px; border: 1px solid #ffffff30; border-radius: 8px; background: #ffffff0a; color: #eee9dc; font: 600 13px system-ui, sans-serif; }
#controlEditor #saveControls { color: #f5d980; }
.editing-controls #pauseScreen { display: none !important; }
.editing-controls #mobileControls { z-index: 15000; }
.editing-controls #mobileControls button { border-style: dashed; cursor: grab; outline: 5px solid #f5d98015; }
.editing-controls #musicToggle, .editing-controls #scoreboard { visibility: hidden; }
#rotatePrompt { position: fixed; inset: 0; z-index: 20000; display: flex; align-items: center; justify-content: center; text-align: center; overflow-y: auto; }
#rotatePrompt { padding: 18px; box-sizing: border-box; background: #12131a; color: #eee9dc; font: 14px/1.45 system-ui, sans-serif; }
#rotatePrompt h2 { font: clamp(24px, 8vw, 32px)/1.05 Barnabey, sans-serif; color: #f5d980; margin: 6px 0 8px; }
#rotatePrompt button { min-height: 44px; padding: 10px 20px; margin-top: 12px; background: #ffffff0d; border: 1px solid #ffffff30; border-radius: 8px; color: inherit; font: inherit; }
#rotatePrompt { width: var(--view-width, 100vw); height: var(--view-height, 100dvh); }
#rotatePrompt > div { width: min(440px, 100%); margin: auto; }
#rotatePrompt #rotateGreeting { color: #f5d980; overflow-wrap: anywhere; }
#rotatePrompt #rotateFullscreen { display: block; width: 100%; color: #f5d980; font: clamp(18px, 6vw, 24px)/1.1 Barnabey, sans-serif; }
#rotatePrompt button:disabled { opacity: .6; }
@media (orientation: portrait) {
  .touch-device #homeScreen { box-sizing: border-box; width: 100%; max-width: 100%; height: var(--view-height, 100dvh); padding: 16px; overflow-y: auto; flex-direction: column; gap: 14px; }
  .touch-device #homeScreen .home-left, .touch-device #homeScreen .home-right { width: 100%; min-width: 0; padding: 0; }
  .touch-device #homeScreen .game-title { font-size: clamp(28px, 9vw, 34px) !important; padding: 0 !important; }
  .touch-device #homeScreen .game-title::before, .touch-device #homeScreen .game-title::after { display: none; }
}
.touch-device #pauseScreen { padding: 16px; overflow-y: auto; background: #101218e8; }
.touch-device #pauseScreen .pause-content {
  box-sizing: border-box; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 20px; border: 1px solid #ffffff20 !important; border-radius: 16px;
  background: #191b22 !important; box-shadow: 0 12px 60px #0006 !important;
}
.touch-device #pauseScreen .pause-content::before, .touch-device #pauseScreen .pause-content::after,
.touch-device #pauseScreen .pause-message, .touch-device #pauseScreen .pause-hint { display: none !important; }
.touch-device #pauseScreen .pause-title { font: 32px/1 Barnabey, sans-serif !important; color: #f5d980 !important; text-shadow: none !important; letter-spacing: .04em !important; margin: 0 0 16px !important; }
.touch-device #pauseScreen .pause-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.touch-device #pauseScreen .spooky-btn {
  min-height: 44px; min-width: 0; margin: 0; padding: 10px 8px; border: 1px solid #ffffff25 !important;
  border-radius: 8px; background: #ffffff08 !important; box-shadow: none !important;
  font: 20px/1.2 Barnabey, sans-serif !important; color: #eee9dc; text-shadow: none !important; letter-spacing: .03em;
}
.touch-device #pauseScreen .spooky-btn::before, .touch-device #pauseScreen .spooky-btn::after { display: none; }
.touch-device #pauseScreen #resumeBtn { border-color: #f5d98065 !important; color: #f5d980; }
.touch-device #pauseScreen #hapticsToggle { font: 12px/1.3 system-ui, sans-serif !important; letter-spacing: 0; }
.touch-device #mobilePauseHint { margin: 14px 0 0; font: 12px/1.5 system-ui, sans-serif; color: #bbbebc; }
@media (orientation: landscape) and (max-height: 600px) {
  .touch-device #homeScreen { box-sizing: border-box; position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; margin: 0; padding: calc(16px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left)); flex-direction: row; align-items: center; gap: 18px; overflow-y: auto; }
  .touch-device #homeScreen .home-left, .touch-device #homeScreen .home-right { flex: 1; width: 50%; min-width: 0; max-width: none; padding: 0; }
  .touch-device #homeScreen .game-title { font-size: clamp(24px, 6vh, 36px) !important; width: 100%; box-sizing: border-box; padding: 0 !important; white-space: nowrap; margin-bottom: 10px !important; letter-spacing: .04em !important; text-shadow: none !important; -webkit-text-stroke: 0; filter: none; }
  .touch-device #homeScreen .game-title::before, .touch-device #homeScreen .game-title::after { display: none; }
  .touch-device #homeScreen .game-description { font: 12px/1.4 system-ui, sans-serif !important; margin-bottom: 12px !important; }
  .touch-device #homeScreen .menu-buttons { gap: 6px !important; }
  .touch-device #homeScreen .menu-buttons button { min-height: 44px; padding: 6px 10px !important; margin: 0; font: 18px/1.15 Barnabey, sans-serif !important; letter-spacing: .04em; animation: none; border: 1px solid #f5d98055 !important; border-radius: 8px; background: #16191acc !important; box-shadow: none !important; text-shadow: none !important; outline: none !important; }
  .touch-device #homeScreen .menu-buttons button::before, .touch-device #homeScreen .menu-buttons button::after { display: none; }
  .touch-device #homeScreen .menu-buttons button:focus-visible { outline: 2px solid #f5d980 !important; outline-offset: 2px; }
  .touch-device #playerNameDisplay { top: 5px !important; right: calc(16px + env(safe-area-inset-right)) !important; max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .touch-device #playerNameText { font: 12px/1.4 system-ui, sans-serif !important; text-shadow: none !important; }
  .touch-device #musicToggleBtn { width: 44px !important; height: 44px !important; top: 0 !important; bottom: auto !important; left: env(safe-area-inset-left) !important; right: auto !important; background: none !important; border: 0 !important; box-shadow: none !important; }
  .touch-device #homeScreen #localMultiplayerBtn { font-size: 14px !important; }
  .touch-device #homeScreen .game-rules { padding: 10px !important; box-shadow: none; border-color: #ffffff20; }
  .touch-device #homeScreen .game-rules p { font: 12px/1.4 system-ui, sans-serif !important; }
  .touch-device #homeScreen .home-right > div:nth-child(2) { display: none !important; }
  .touch-device #homeScreen .home-right > div:last-child { margin-top: 6px !important; }
}
.touch-device #homeScreen .menu-buttons button.controller-focused,
.touch-device #pauseScreen button.controller-focused,
.touch-device #controlEditor button.controller-focused {
  outline: 2px solid #f5d980 !important;
  outline-offset: 2px !important;
  box-shadow: none !important;
}

/* Powerups and HUD style integrations */
.power-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #ecd99b66;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 28%, #f5d98038, #09090d52 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 10px 28px #0005, inset 0 1px 0 #ffffff12;
  flex-direction: column;
  gap: 1px;
}
.power-btn .power-label {
  font: 700 8px/1 system-ui, sans-serif;
  letter-spacing: .02em;
  color: #fff0c6;
}
.power-btn .power-icon, .power-btn .cycle-glyph { line-height: 1; }

/* Three separate thumb actions fit below the Survival minimap. */
body.survival-active #mobileSprint {
  width: 48px; height: 48px; min-width: 48px; min-height: 48px;
}
body.survival-active #mobileSprint svg { width: 18px; height: 18px; }
body.survival-active #mobileSprint span { font-size: 8px; }
.power-btn.pressed {
  background: radial-gradient(circle at 38% 28%, #f5d98082, #9b7b3048 72%);
  border-color: #f5d980;
  transform: scale(.96);
}
.editing-controls .power-btn {
  border-style: dashed !important;
  cursor: grab;
  outline: 5px solid #f5d98015 !important;
}
.power-icon {
  font-size: 18px;
}
.power-count {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}
.cycle-glyph {
  font-size: 20px;
  color: #efd99a;
}

.powerup-hud {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: calc(12px + env(safe-area-inset-left));
  display: flex;
  gap: 8px;
  background: rgba(16, 18, 24, 0.9);
  border: 1px solid rgba(245, 217, 128, 0.3);
  border-radius: 6px;
  padding: 3px 6px;
  z-index: 1090;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  pointer-events: auto;
}
body.touch-device .powerup-hud {
  pointer-events: none;
  flex-direction: column;
  top: calc(58px + env(safe-area-inset-top));
  bottom: auto;
  gap: 2px;
  padding: 2px;
}
body.touch-device .powerup-slot {
  padding: 2px;
}
.powerup-slot {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}
.powerup-slot.selected {
  background: rgba(245, 217, 128, 0.2);
  border-color: rgba(245, 217, 128, 0.5);
}
.powerup-slot.empty {
  opacity: 0.35;
}
.hud-icon {
  font-size: 14px;
}
.hud-count {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
}

/* Main menu mobile pass: keep the landing screen compact and readable before gameplay starts. */
.touch-device #homeScreen {
  visibility: visible;
  pointer-events: auto;
  box-sizing: border-box;
  width: var(--view-width, 100vw) !important;
  height: var(--view-height, 100dvh) !important;
  max-width: none !important;
  max-height: none !important;
  padding: calc(12px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)) !important;
  overflow-y: auto !important;
}

.touch-device #mainMenu {
  width: min(520px, 100%);
  max-height: none;
  margin: auto;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 22px 18px;
  border-radius: 22px;
}

.touch-device #mainMenu::before {
  inset: 12px auto 12px 12px;
}

.touch-device #mainMenu .game-title {
  font-size: clamp(2.35rem, 14vw, 3.65rem) !important;
  line-height: 0.84 !important;
  margin-bottom: 10px !important;
  white-space: normal !important;
}

.touch-device #mainMenu .menu-kicker {
  margin-bottom: 8px;
  font-size: 0.66rem !important;
}

.touch-device #mainMenu .menu-lede {
  margin-bottom: 12px !important;
  font: 0.88rem/1.42 system-ui, sans-serif !important;
}

.touch-device #mainMenu .menu-actions {
  gap: 8px !important;
}

.touch-device #mainMenu .menu-action,
.touch-device #homeScreen #mainMenu .menu-buttons button {
  min-height: 50px;
  padding: 9px 11px !important;
  border-radius: 12px !important;
  border-color: rgba(245, 217, 128, 0.28) !important;
  background: linear-gradient(180deg, rgba(33, 29, 31, 0.94), rgba(13, 13, 16, 0.96)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055) !important;
  text-shadow: none !important;
  outline: none !important;
}

.touch-device #homeScreen #mainMenu button.menu-action-primary {
  min-height: 58px;
  border-color: rgba(245, 217, 128, 0.58) !important;
  background: linear-gradient(135deg, rgba(126, 89, 34, 0.9), rgba(43, 34, 23, 0.98)) !important;
}

.touch-device #mainMenu .menu-action span {
  font: clamp(0.98rem, 5vw, 1.18rem)/0.98 Barnabey, sans-serif !important;
  letter-spacing: 0.045em;
}

.touch-device #mainMenu .menu-action small {
  font: 0.68rem/1.15 system-ui, sans-serif !important;
}

.touch-device #mainMenu #localMultiplayerBtn:disabled span {
  font: clamp(0.72rem, 3.4vw, 0.86rem)/1.05 Barnabey, sans-serif !important;
}

.touch-device #mainMenu .menu-rule-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.touch-device #mainMenu .menu-rule-strip span {
  box-sizing: border-box;
  min-height: 38px;
  justify-content: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(238, 232, 216, 0.1);
  border-radius: 10px;
  font: 650 0.68rem/1.08 system-ui, sans-serif !important;
  text-align: center;
}

.touch-device #mainMenu .menu-rule-strip img {
  width: 17px;
  height: 17px;
}

.touch-device #mainMenu .rules-drawer summary {
  min-height: 44px;
  padding: 11px 12px;
  font-size: 0.94rem !important;
}

.touch-device #homeScreen #mainMenu .rules-drawer {
  padding: 0 !important;
}

.touch-device #mainMenu .game-rules p {
  font: 0.78rem/1.35 system-ui, sans-serif !important;
}

.touch-device #mainMenu .menu-links {
  justify-content: center;
}

.touch-device #mainMenu .menu-action:focus,
.touch-device #mainMenu .menu-action.keyboard-focused,
.touch-device #mainMenu .menu-action.controller-focused,
.touch-device #homeScreen #mainMenu .menu-buttons button.controller-focused,
.touch-device #homeScreen #mainMenu .menu-buttons button:focus-visible {
  outline: 1px solid #f5d980 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 3px rgba(245, 217, 128, 0.12) !important;
}

@media (orientation: landscape) and (max-height: 600px) {
  .touch-device #homeScreen {
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)) !important;
  }
  .touch-device #mainMenu {
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: minmax(245px, 1fr) minmax(205px, 0.78fr);
    gap: 16px;
    padding: 16px 18px;
    border-radius: 20px;
  }
  .touch-device #mainMenu .game-title {
    font-size: clamp(2rem, 13vh, 2.9rem) !important;
    margin-bottom: 8px !important;
  }
  .touch-device #mainMenu .menu-lede,
  .touch-device #mainMenu .menu-note {
    display: none !important;
  }
  .touch-device #mainMenu .menu-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px !important;
  }
  .touch-device #mainMenu .menu-action,
  .touch-device #mainMenu .menu-action-primary {
    grid-column: auto;
    min-height: 50px;
    align-items: center;
    text-align: center;
    padding: 7px 8px !important;
  }
  .touch-device #mainMenu .menu-action small {
    display: none;
  }
  .touch-device #mainMenu .menu-action span {
    font-size: clamp(14px, 2vw, 18px) !important;
    white-space: nowrap;
    overflow-wrap: normal;
  }
  .touch-device #mainMenu #localMultiplayerBtn small {
    display: block;
    font-size: 9px !important;
  }
  .touch-device #mainMenu .menu-rule-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .touch-device #mainMenu .menu-rule-strip span {
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
  }
  .touch-device #mainMenu .rules-list .rule-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px !important;
  }
  .touch-device #mainMenu .rules-drawer[open] .rules-list {
    max-height: 72px;
    overflow-y: auto;
  }
}
