/* Stickman Fire & Fold - Authentic Notebook Paper Style & 3D Fold Animation */

:root {
  --wood-bg: #2d241e;
  --paper-cream: #fbf9f4;
  --paper-edge: #eae4d8;
  --line-blue: rgba(145, 185, 215, 0.45);
  --margin-red: rgba(235, 95, 95, 0.5);
  --pencil-black: #292929;
  --pencil-gray: #555555;
  --pencil-red: #c92a2a;
  --sticky-yellow: #fff9c4;
  --sticky-shadow: rgba(0, 0, 0, 0.15);
  --font-doodle: 'Patrick Hand', 'Caveat', cursive, sans-serif;
  --font-heading: 'Permanent Marker', 'Caveat Brush', cursive, sans-serif;
  --font-sketch: 'Permanent Marker', 'Caveat Brush', cursive, sans-serif;
  --font-script: 'Caveat Brush', 'Caveat', cursive, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body, button, select, input {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, select, input {
  touch-action: manipulation;
}

body {
  font-family: var(--font-doodle);
  background: radial-gradient(circle at center, #3a2e26 0%, #1e1713 100%);
  color: var(--pencil-black);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding: 8px 12px;
}

/* Header & Top Bar */
.game-header {
  position: relative;
  z-index: 20;
  width: 100%;
  max-width: 1280px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 6px;
  padding: 2px 8px;
}

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

.top-controls-break {
  display: none;
}

.header-label {
  font-size: 1.18rem;
  color: #fff2db;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  user-select: none;
}

.header-match-badge,
body.mode-campaign #headerMatchBadge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  height: 64px !important;
  box-sizing: border-box !important;
  padding: 0 18px !important;
  margin: 0 !important;
  background-color: #faf8f2 !important;
  background-image: linear-gradient(180deg, #ffffff 0%, #f6f3eb 100%) !important;
  color: #142850 !important;
  border: 2px solid #142850 !important;
  border-radius: 8px !important;
  box-shadow: 2px 2.5px 0px #142850, 0 2px 4px rgba(0, 0, 0, 0.15) !important;
  font-family: var(--font-doodle) !important;
  font-size: 1.18rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  user-select: none !important;
  white-space: nowrap !important;
  text-shadow: none !important;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, filter 0.15s ease !important;
}

body.mode-campaign #headerMatchBadge:hover,
.header-match-badge:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 2px 4.5px 0px #142850, 0 5px 8px rgba(0, 0, 0, 0.22) !important;
  filter: brightness(1.02) !important;
}

body.mode-campaign #headerMatchBadge:active,
.header-match-badge:active {
  transform: translateY(1px) scale(0.99) !important;
  box-shadow: 1px 1.5px 0px #142850, 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}

/* Hide game setup details at top on phone portrait devices during gameplay */
body.phone-portrait-layout.game-in-play #headerMatchBadge,
body.phone-portrait-layout.battle-active #headerMatchBadge,
body.is-phone-device.phone-portrait-layout.game-in-play #headerMatchBadge,
body.is-phone-device.phone-portrait-layout.battle-active #headerMatchBadge {
  display: none !important;
}

/* Remove large Fire Shot button in bottom section on phone */
body.is-phone-device #btnMobileFire,
body.is-phone-device #btnToolShot {
  display: none !important;
}

/* Side Titles running up and down outside both sides of the notebook paper */
.side-title {
  position: absolute;
  top: 50%;
  pointer-events: none;
  z-index: 25;
  white-space: nowrap;
  user-select: none;
  transition: color 0.2s ease;
}

.side-title-left {
  right: calc(100% + 14px);
  writing-mode: vertical-rl;
  transform: translateY(-50%) rotate(180deg);
}

.side-title-right {
  left: calc(100% + 14px);
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}

.side-title-stickman {
  font-family: var(--font-sketch);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: 6px;
  color: #dfd3c3;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.7), 0 0 1px #000;
  display: inline-block;
}

.side-title-firefold {
  font-family: var(--font-script);
  font-style: italic;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 4px;
  color: #f1dfa8;
  text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.7), 0 0 1px #000;
  display: inline-block;
  margin-block-start: 12px;
}

/* Doodle Button Style */
.doodle-btn {
  font-family: var(--font-doodle);
  font-size: 1.05rem;
  font-weight: 600;
  background: #fdfbf7;
  color: var(--pencil-black);
  border: 2px solid #333;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: 2px 3px 0px #222;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Stickman House Icon inside Home Button */
.home-icon {
  width: 21px;
  height: 21px;
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
  transition: transform 0.15s ease;
}

#btnHome:hover .home-icon,
.btn-round-options-home:hover .home-icon {
  transform: scale(1.1) rotate(-3deg);
}

/* Screen-reader only utility */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

/* Illustrated Model Buttons - Standalone buttons with hand-drawn stickman artwork */
.top-controls #btnToggleMute.btn-sound-model,
.top-controls #btnRules.btn-rules-model,
.top-controls #btnHeaderLeaveGame.btn-leave-game-model,
.top-controls #btnHome.btn-home-model,
.top-controls #btnCampaignMap.btn-campaign-map-model,
.top-controls #btnToggleMagnifier.btn-spyglass-model,
.top-controls #btnToggleMagnifier.btn-aim-assist-model,
.top-controls #btnUseBonusShots.btn-bonus-shots-model,
.top-controls #btnRestart.btn-replay-model,
.btn-sound-model,
.btn-rules-model,
.btn-leave-game-model,
.btn-home-model,
#btnCampaignMap.btn-campaign-map-model,
.btn-spyglass-model,
.btn-aim-assist-model,
.btn-bonus-shots-model,
.btn-replay-model {
  border-radius: 8px !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  padding: 0 !important;
  margin: 0 !important;
  height: 54px !important;
  width: auto !important;
  min-width: unset !important;
  max-width: unset !important;
  flex: 0 0 auto !important;
  display: inline-flex;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  transform: none !important;
  box-sizing: border-box !important;
  cursor: pointer;
  outline: none !important;
  position: relative;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease !important;
}

.top-controls #btnToggleMute.btn-sound-model,
.top-controls #btnRules.btn-rules-model,
.top-controls #btnHeaderLeaveGame.btn-leave-game-model,
.top-controls #btnHome.btn-home-model,
.top-controls #btnCampaignMap.btn-campaign-map-model,
.top-controls #btnToggleMagnifier.btn-spyglass-model,
.top-controls #btnToggleMagnifier.btn-aim-assist-model,
.top-controls #btnUseBonusShots.btn-bonus-shots-model,
.top-controls #btnRestart.btn-replay-model {
  background-color: transparent !important;
  background-image: none !important;
}

/* Inner Graphic Tile */
.btn-card-tile {
  width: auto !important;
  height: 54px !important;
  border-radius: 6px !important;
  border: none !important;
  overflow: visible !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
  position: relative !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

.btn-card-tile.tile-sound,
.btn-card-tile.tile-rules,
.btn-card-tile.tile-leave,
.btn-card-tile.tile-home,
.btn-card-tile.tile-map,
.btn-card-tile.tile-aim,
.btn-card-tile.tile-shots,
.btn-card-tile.tile-replay {
  background: transparent !important;
}

/* Bottom Label hidden on standalone buttons */
.btn-card-label {
  display: none !important;
}

/* Standardized Image sizing inside standalone stickman buttons */
.img-header-btn,
.img-campaign-map-btn {
  height: 54px !important;
  width: auto !important;
  max-height: 54px !important;
  max-width: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
  display: block !important;
  border-radius: 6px !important;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.22)) !important;
  image-rendering: -webkit-optimize-contrast !important;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.15s ease;
  pointer-events: none !important;
}

/* Sound Button State Switcher */
.btn-sound-model.sound-on .img-sound-off {
  display: none !important;
}
.btn-sound-model.sound-on .img-sound-on {
  display: block !important;
}
.btn-sound-model.sound-off .img-sound-on {
  display: none !important;
}
.btn-sound-model.sound-off .img-sound-off {
  display: block !important;
}

/* Aim Assist / Spyglass Button State Switcher */
.btn-spyglass-model.magnifier-on .img-spyglass-off,
.btn-aim-assist-model.magnifier-on .img-aim-assist-off {
  display: none !important;
}
.btn-spyglass-model.magnifier-on .img-spyglass-on,
.btn-aim-assist-model.magnifier-on .img-aim-assist-on {
  display: block !important;
}
.btn-spyglass-model.magnifier-off .img-spyglass-on,
.btn-aim-assist-model.magnifier-off .img-aim-assist-on {
  display: none !important;
}
.btn-spyglass-model.magnifier-off .img-spyglass-off,
.btn-aim-assist-model.magnifier-off .img-aim-assist-off {
  display: block !important;
}

/* Bonus Shots Live Count Badge Overlay */
.btn-bonus-shots-model {
  position: relative;
}
.btn-card-tile .bonus-shots-badge-overlay {
  position: absolute;
  top: 1px;
  right: 2px;
  background: #dc2626;
  color: #ffffff;
  font-family: var(--font-doodle), -apple-system, sans-serif;
  font-weight: 900;
  font-size: 0.72rem;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1.2px solid #142850;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 5;
}

/* Hover & Active Interactions for all Model Buttons */
.btn-sound-model:hover,
.btn-rules-model:hover,
.btn-leave-game-model:hover,
.btn-home-model:hover,
#btnCampaignMap.btn-campaign-map-model:hover,
.btn-spyglass-model:hover,
.btn-aim-assist-model:hover,
.btn-bonus-shots-model:hover,
.btn-replay-model:hover {
  transform: translateY(-2px) scale(1.03) rotate(0deg) !important;
  box-shadow: none !important;
  filter: brightness(1.04);
}

.btn-sound-model:hover .img-header-btn,
.btn-rules-model:hover .img-header-btn,
.btn-leave-game-model:hover .img-header-btn,
.btn-home-model:hover .img-header-btn,
.btn-spyglass-model:hover .img-header-btn,
.btn-aim-assist-model:hover .img-header-btn,
.btn-bonus-shots-model:hover .img-header-btn,
.btn-replay-model:hover .img-header-btn {
  filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.3)) !important;
}

.btn-sound-model:active,
.btn-rules-model:active,
.btn-leave-game-model:active,
.btn-home-model:active,
#btnCampaignMap.btn-campaign-map-model:active,
.btn-spyglass-model:active,
.btn-aim-assist-model:active,
.btn-bonus-shots-model:active,
.btn-replay-model:active {
  transform: translateY(2px) scale(0.97) rotate(0deg) !important;
  box-shadow: none !important;
  filter: brightness(0.97);
}

.btn-sound-model:active .img-header-btn,
.btn-rules-model:active .img-header-btn,
.btn-leave-game-model:active .img-header-btn,
.btn-home-model:active .img-header-btn,
.btn-spyglass-model:active .img-header-btn,
.btn-aim-assist-model:active .img-header-btn,
.btn-bonus-shots-model:active .img-header-btn,
.btn-replay-model:active .img-header-btn {
  filter: drop-shadow(0px 1px 1px rgba(0, 0, 0, 0.2)) !important;
}

.btn-sound-model:focus-visible,
.btn-rules-model:focus-visible,
.btn-leave-game-model:focus-visible,
.btn-home-model:focus-visible,
#btnCampaignMap.btn-campaign-map-model:focus-visible,
.btn-spyglass-model:focus-visible,
.btn-aim-assist-model:focus-visible,
.btn-bonus-shots-model:focus-visible,
.btn-replay-model:focus-visible {
  outline: 2px dashed #1e3a8a;
  outline-offset: 2px;
}

/* ==========================================================================
   Top Header Controls - Themed to match 100-Level Map Pill Button
   ========================================================================== */
.top-controls .doodle-btn:not(#btnCampaignMap):not(.btn-sound-model):not(.btn-rules-model):not(.btn-home-model):not(.btn-spyglass-model):not(.btn-aim-assist-model):not(.btn-bonus-shots-model):not(.btn-replay-model):not(.btn-leave-game-model) {
  height: 56px;
  /* Organic hand-cut paper pill outline */
  border-radius: 255px 22px 235px 24px / 24px 235px 22px 255px !important;
  border: 2.5px solid #142850 !important;
  /* Sketched ink marker drop shadow */
  box-shadow: 2px 3px 0px #142850, 0 3px 6px rgba(0, 0, 0, 0.18) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-doodle);
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  letter-spacing: 0.3px;
  padding: 0 10px !important;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, filter 0.15s ease !important;
}

.top-controls button[style*="display: none"],
.top-controls button[style*="display:none"],
.top-controls #btnHeaderLeaveGame[style*="display: none"],
.top-controls #btnHeaderLeaveGame[style*="display:none"],
.top-controls #btnHeaderLeaveGame.btn-leave-game-model[style*="display: none"],
.top-controls #btnHeaderLeaveGame.btn-leave-game-model[style*="display:none"],
.top-controls #btnCampaignMap[style*="display: none"],
.top-controls #btnCampaignMap[style*="display:none"],
.top-controls #btnUseBonusShots[style*="display: none"],
.top-controls #btnUseBonusShots[style*="display:none"],
.top-controls #btnRestart[style*="display: none"],
.top-controls #btnRestart[style*="display:none"],
body:not(.mode-campaign) .top-controls #btnCampaignMap,
body:not(.mode-campaign) .top-controls #btnUseBonusShots {
  display: none !important;
}

/* Subtle hand-drawn sticker tilt for legacy buttons only */
.top-controls #btnToggleMute:not(.btn-sound-model) { transform: rotate(-0.6deg); }
.top-controls #btnRules:not(.btn-rules-model) { transform: rotate(0.6deg); }
.top-controls #btnHome:not(.btn-home-model) { transform: rotate(-0.5deg); }
.top-controls #btnCampaignMap:not(.btn-campaign-map-model) { transform: rotate(-0.4deg); }
.top-controls #btnToggleMagnifier:not(.btn-aim-assist-model):not(.btn-spyglass-model) { transform: rotate(0.5deg); }
.top-controls #btnUseBonusShots:not(.btn-bonus-shots-model) { transform: rotate(-0.6deg); }
.top-controls #btnRestart:not(.btn-replay-model) { transform: rotate(0.6deg); }
.top-controls #btnHeaderLeaveGame:not(.btn-leave-game-model) { transform: rotate(-0.5deg); }

.top-controls #btnToggleMute.btn-sound-model,
.top-controls #btnRules.btn-rules-model,
.top-controls #btnHeaderLeaveGame.btn-leave-game-model,
.top-controls #btnHome.btn-home-model,
.top-controls #btnCampaignMap.btn-campaign-map-model,
.top-controls #btnToggleMagnifier.btn-aim-assist-model,
.top-controls #btnToggleMagnifier.btn-spyglass-model,
.top-controls #btnUseBonusShots.btn-bonus-shots-model,
.top-controls #btnRestart.btn-replay-model {
  transform: none !important;
}

.top-controls .doodle-btn:not(#btnCampaignMap):hover {
  transform: translateY(-2px) scale(1.03) rotate(0deg) !important;
  box-shadow: 2px 5px 0px #142850, 0 5px 8px rgba(0, 0, 0, 0.25) !important;
  filter: brightness(1.03);
}

.top-controls .doodle-btn:not(#btnCampaignMap):active {
  transform: translateY(2px) scale(0.98) rotate(0deg) !important;
  box-shadow: 0px 1px 0px #142850, 0 1px 3px rgba(0, 0, 0, 0.2) !important;
  filter: brightness(0.97);
}

/* Sound Button - Meadow Green Colored-Pencil Paper */
.top-controls #btnToggleMute.sound-on:not(.btn-sound-model) {
  background-color: #d1fae5 !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(180deg, #dcfce7 0%, #a7f3d0 45%, #6ee7b7 50%, #34d399 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #064e3b !important;
}
.top-controls #btnToggleMute.sound-off:not(.btn-sound-model) {
  background-color: #f1f5f9 !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #475569 !important;
}
/* Compact Sound Toggle Button */
.top-controls #btnToggleMute:not(.btn-sound-model) {
  padding: 4px 10px !important;
  font-size: 0.92rem !important;
  gap: 0 !important;
  min-width: 0 !important;
  letter-spacing: 0.2px !important;
}
.top-controls #btnToggleMute:not(.btn-sound-model) .sound-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.top-controls #btnToggleMute .sound-status-dot,
#btnToggleMute .sound-status-dot,
#btnModalSound .sound-status-dot {
  display: none !important;
}

/* Rules Button - Aged Parchment Scroll Paper & Quill (Matches Reference Design) */
.top-controls #btnRules:not(.btn-rules-model) {
  background-color: #faeb8f !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(180deg, #fef7b5 0%, #faea8c 50%, #f6de6b 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #4a2c11 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  font-family: var(--font-doodle), var(--font-heading), sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.98rem !important;
  letter-spacing: 0.4px !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) !important;
}

.top-controls #btnRules .rules-scroll-quill-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.top-controls #btnRules .rules-label {
  font-family: var(--font-doodle), var(--font-heading), sans-serif;
  font-weight: 700;
  color: #4a2c11;
  line-height: 1;
}

.btn-setup-rules .rules-scroll-quill-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.18));
}

/* Home Button - Sky & Sand Paper Horizon */
.top-controls #btnHome:not(.btn-home-model) {
  background-color: #e0f2fe !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(180deg, #e0f2fe 0%, #bae6fd 45%, #fed7aa 50%, #fdba74 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #0f172a !important;
}
.top-controls #btnHome .home-icon {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
  flex-shrink: 0;
}

/* ==========================================================================
   Spyglass Tool On/Off Button - Warm Antique Brass Parchment with Interactive Toggle Switch
   ========================================================================== */
.top-controls #btnToggleMagnifier:not(.btn-spyglass-model):not(.btn-aim-assist-model) {
  background-color: #ebd39b !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(180deg, #fbf2db 0%, #edd8a4 35%, #debe74 70%, #caa452 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #2b2318 !important;
  gap: 7px !important;
  padding: 0 9px !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.7), 
    inset 0 -1px 1px rgba(100, 70, 10, 0.2), 
    2px 3px 0px #142850, 
    0 3px 6px rgba(0, 0, 0, 0.18) !important;
  position: relative;
  overflow: visible;
}

.top-controls #btnToggleMagnifier:not(.btn-spyglass-model):not(.btn-aim-assist-model).magnifier-off {
  background-color: #e5d2a6 !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(180deg, #f5ecd9 0%, #e6d4a8 40%, #d1b673 80%, #bfa462 100%) !important;
  color: #3b3225 !important;
}

/* Stickman Icon */
.top-controls #btnToggleMagnifier .spyglass-stickman-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.top-controls #btnToggleMagnifier .spyglass-stickman-svg {
  width: 27px;
  height: 25px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0.5px 1px rgba(0, 0, 0, 0.18));
}

/* Label text "Spyglass" */
.top-controls #btnToggleMagnifier .spyglass-text-label {
  font-family: var(--font-doodle), var(--font-heading), 'Comic Neue', cursive, sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: #2b2318;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
  line-height: 1;
}

/* Functional Sliding Toggle Switch UI */
.top-controls #btnToggleMagnifier .spyglass-switch-ui {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.28);
  padding: 1.5px 4px;
  border-radius: 14px;
  border: 1px solid rgba(80, 50, 15, 0.2);
  box-shadow: inset 0 0.5px 1px rgba(0, 0, 0, 0.08);
  margin-inline-start: 1px;
}

.top-controls #btnToggleMagnifier .spyglass-switch-opt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  user-select: none;
  line-height: 1;
  transition: color 0.18s ease, opacity 0.18s ease;
  cursor: pointer;
}

/* Track */
.top-controls #btnToggleMagnifier .spyglass-track {
  width: 32px;
  height: 17px;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 1.5px 2.5px rgba(0, 0, 0, 0.35), inset 0 0 1px rgba(0, 0, 0, 0.4);
  transition: background 0.22s ease, border-color 0.22s ease;
  border: 1.5px solid rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  display: inline-block;
  flex-shrink: 0;
}

/* Slider Knob */
.top-controls #btnToggleMagnifier .spyglass-knob {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 65%, #e2e8f0 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 0.5px #ffffff, 0 0 0 0.5px rgba(0, 0, 0, 0.15);
  position: absolute;
  top: 0.5px;
  left: 1px;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ON State */
.top-controls #btnToggleMagnifier.magnifier-on .spyglass-track {
  background: linear-gradient(180deg, #6ee7b7 0%, #34d399 45%, #22c55e 70%, #16a34a 100%);
  border-color: #15803d;
}

.top-controls #btnToggleMagnifier.magnifier-on .spyglass-knob {
  transform: translateX(14px);
}

.top-controls #btnToggleMagnifier.magnifier-on .opt-on {
  color: #14532d;
  opacity: 1;
  font-weight: 900;
  text-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.6);
}

.top-controls #btnToggleMagnifier.magnifier-on .opt-off {
  color: #64533a;
  opacity: 0.55;
  font-weight: 700;
}

/* OFF State */
.top-controls #btnToggleMagnifier.magnifier-off .spyglass-track {
  background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 55%, #94a3b8 100%);
  border-color: #64748b;
}

.top-controls #btnToggleMagnifier.magnifier-off .spyglass-knob {
  transform: translateX(0px);
}

.top-controls #btnToggleMagnifier.magnifier-off .opt-off {
  color: #1e293b;
  opacity: 1;
  font-weight: 900;
  text-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.6);
}

.top-controls #btnToggleMagnifier.magnifier-off .opt-on {
  color: #64533a;
  opacity: 0.55;
  font-weight: 700;
}

/* Mobile & Small Screen Adaptations */
@media (max-width: 680px), (max-height: 500px) {
  .top-controls #btnToggleMagnifier {
    padding: 0 4px !important;
    gap: 3px !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-stickman-svg {
    width: 22px !important;
    height: 20px !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-text-label {
    font-size: 0.76rem !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-switch-ui {
    padding: 1px 2px !important;
    gap: 2px !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-switch-opt {
    font-size: 0.56rem !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-track {
    width: 25px !important;
    height: 14px !important;
  }
  .top-controls #btnToggleMagnifier .spyglass-knob {
    width: 10px !important;
    height: 10px !important;
  }
  .top-controls #btnToggleMagnifier.magnifier-on .spyglass-knob {
    transform: translateX(11px) !important;
  }
}

/* Extra Shots (Golden Paperclip) Button - Brushed Brass Plaque (Visible strictly and exclusively in 100 Level Mode) */
body:not(.mode-campaign) #btnUseBonusShots {
  display: none !important;
}
body.mode-campaign #btnUseBonusShots {
  display: inline-flex;
}

.top-controls #btnUseBonusShots:not(.btn-bonus-shots-model) {
  background-color: #edd06c !important;
  background-image: 
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0px, rgba(255, 255, 255, 0.08) 1px, transparent 1px, transparent 3px),
    linear-gradient(180deg, #fffef5 0%, #fceda2 12%, #f5db76 28%, #ecc958 45%, #dfb33b 50%, #c89c28 75%, #a47414 100%) !important;
  background-size: 100% 100%, 100% 100% !important;
  color: #422906 !important;
  border-style: solid !important;
  text-shadow: 0 1px 0 rgba(255, 248, 205, 0.85) !important;
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 240, 0.9),
    inset 0 0 0 1.5px rgba(255, 248, 190, 0.65),
    inset 0 -1.5px 0 rgba(140, 95, 15, 0.45),
    2px 3px 0px #142850, 
    0 3px 6px rgba(0, 0, 0, 0.18) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
}
.top-controls #btnUseBonusShots:not(.btn-bonus-shots-model):hover {
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 240, 0.95),
    inset 0 0 0 1.5px rgba(255, 248, 190, 0.75),
    inset 0 -1.5px 0 rgba(140, 95, 15, 0.5),
    2px 5px 0px #142850, 
    0 5px 8px rgba(0, 0, 0, 0.25) !important;
  filter: brightness(1.04) !important;
}
.top-controls #btnUseBonusShots .paperclip-gold-icon,
.top-controls #btnUseBonusShots .bonus-shots-icon {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 0 rgba(255, 250, 215, 0.85)) drop-shadow(0 1px 1px rgba(60, 40, 5, 0.4));
}
.top-controls #btnUseBonusShots.has-shots:not(.btn-bonus-shots-model) {
  animation: pulse-bonus-themed 2.5s infinite ease-in-out;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}
.top-controls #btnUseBonusShots.btn-bonus-shots-model.has-shots .img-header-btn {
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 4px rgba(234, 179, 8, 0.75)) !important;
}
@keyframes pulse-bonus-themed {
  0%, 100% {
    box-shadow: 
      inset 0 1px 0 rgba(255, 255, 240, 0.9),
      inset 0 0 0 1.5px rgba(255, 248, 190, 0.65),
      inset 0 -1.5px 0 rgba(140, 95, 15, 0.45),
      2px 3px 0px #142850, 
      0 3px 6px rgba(0, 0, 0, 0.18) !important;
  }
  50% {
    box-shadow: 
      inset 0 1px 0 rgba(255, 255, 240, 0.95),
      inset 0 0 0 1.5px rgba(255, 248, 190, 0.8),
      inset 0 -1.5px 0 rgba(140, 95, 15, 0.45),
      2px 3px 0px #142850, 
      0 0 14px rgba(234, 179, 8, 0.9) !important;
  }
}

/* Game Reset / Replay Level Button - Honey Parchment Paper matching Concept Art */
.top-controls #btnRestart:not(.btn-replay-model) {
  background-color: #fde68a !important;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(180deg, #fef9c3 0%, #fde68a 35%, #f59e0b 60%, #d97706 100%) !important;
  background-size: 4px 4px, 100% 100% !important;
  color: #3b1d06 !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  gap: 5px !important;
  padding: 0 9px !important;
}

.top-controls #btnRestart .replay-stickman-svg {
  width: 16px;
  height: 22px;
  flex-shrink: 0;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
  transition: transform 0.15s ease;
}

.top-controls #btnRestart .replay-arrow-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
  transition: transform 0.2s ease;
}

.top-controls #btnRestart:hover .replay-stickman-svg {
  transform: scale(1.08) translateX(1px);
}

.top-controls #btnRestart:hover .replay-arrow-svg {
  transform: rotate(45deg) scale(1.08);
}

body.phone-portrait-layout #btnRestart .replay-stickman-svg,
body.phone-landscape-layout #btnRestart .replay-stickman-svg {
  width: 13px !important;
  height: 18px !important;
}

body.phone-portrait-layout #btnRestart .replay-arrow-svg,
body.phone-landscape-layout #btnRestart .replay-arrow-svg {
  width: 12px !important;
  height: 12px !important;
}

/* Global phone-landscape-layout card button sizing */
body.phone-landscape-layout .top-controls {
  flex-wrap: nowrap !important;
}
body.phone-landscape-layout .top-controls .btn-sound-model,
body.phone-landscape-layout .top-controls .btn-rules-model,
body.phone-landscape-layout .top-controls .btn-leave-game-model,
body.phone-landscape-layout .top-controls .btn-home-model,
body.phone-landscape-layout .top-controls .btn-spyglass-model,
body.phone-landscape-layout .top-controls .btn-aim-assist-model,
body.phone-landscape-layout .top-controls .btn-bonus-shots-model,
body.phone-landscape-layout .top-controls .btn-replay-model,
body.phone-landscape-layout .top-controls #btnCampaignMap.btn-campaign-map-model {
  width: auto !important;
  min-width: unset !important;
  max-width: unset !important;
  height: 42px !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  border-radius: 6px !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
}
body.phone-landscape-layout .top-controls .btn-card-tile {
  height: 42px !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.phone-landscape-layout .top-controls .img-header-btn {
  height: 42px !important;
  max-height: 42px !important;
  width: auto !important;
}
body.phone-landscape-layout .top-controls .btn-card-label {
  display: none !important;
}
body.phone-landscape-layout .header-match-badge,
body.phone-landscape-layout.mode-campaign #headerMatchBadge {
  height: 42px !important;
  padding: 0 10px !important;
  font-size: 0.88rem !important;
  font-family: var(--font-doodle) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* Leave Game Button */
.top-controls #btnHeaderLeaveGame.btn-leave-game-model {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* Desktop compact single-row top controls in 100-level mode so all buttons stay in one row */
@media (min-width: 900px) {
  body.mode-campaign .top-controls {
    flex-wrap: nowrap;
    gap: 5px;
  }
  body.mode-campaign .top-controls .doodle-btn:not(#btnCampaignMap):not(.btn-sound-model):not(.btn-rules-model):not(.btn-home-model):not(.btn-spyglass-model):not(.btn-aim-assist-model):not(.btn-bonus-shots-model):not(.btn-replay-model) {
    padding: 0 8px !important;
    font-size: 0.92rem !important;
    height: 56px;
    gap: 4px;
    white-space: nowrap;
  }
  body.mode-campaign .top-controls .btn-sound-model,
  body.mode-campaign .top-controls .btn-rules-model,
  body.mode-campaign .top-controls .btn-home-model,
  body.mode-campaign .top-controls .btn-spyglass-model,
  body.mode-campaign .top-controls .btn-aim-assist-model,
  body.mode-campaign .top-controls .btn-bonus-shots-model,
  body.mode-campaign .top-controls .btn-replay-model,
  body.mode-campaign .top-controls #btnCampaignMap.btn-campaign-map-model {
    height: 64px !important;
    width: 92px !important;
    min-width: 92px !important;
    max-width: 92px !important;
    flex: 0 0 92px !important;
    padding: 3px 4px 2px 4px !important;
  }
  body.mode-campaign .header-match-badge {
    height: 64px !important;
    padding: 0 18px !important;
    font-size: 1.18rem !important;
    font-family: var(--font-doodle) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    white-space: nowrap !important;
  }
}

body.mode-campaign #p2Card .player-name,
body.mode-campaign.phone-portrait-layout #p2Card .player-name,
body.mode-campaign.is-phone-device.phone-portrait-layout #p2Card .player-name,
body.mode-campaign.phone-landscape-layout #p2Card .player-name,
body.mode-campaign.is-phone-device.phone-landscape-layout #p2Card .player-name {
  max-width: 140px !important;
  font-weight: 700;
}

.bonus-shots-icon {
  font-size: 1.15rem;
  display: inline-block;
  vertical-align: middle;
  margin-right: 3px;
}

@media (max-width: 680px) {
  .home-icon {
    width: 17px;
    height: 17px;
  }
  .map-dashed-path-icon {
    width: 17px;
    height: 17px;
  }
}

/* Ready / Attack Checkmark Icon */
.ready-attack-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
  transition: transform 0.15s ease;
}

#btnDoneSetup:hover .ready-attack-icon {
  transform: scale(1.15) rotate(6deg);
}

@media (max-width: 680px) {
  .ready-attack-icon {
    width: 18px;
    height: 18px;
  }
}

/* Green Checkmark Pulsating Animation (Brighter & Darker Green until clicked) */
.ready-checkmark-icon {
  color: #16a34a;
}

.checkmark-pulse-group {
  transform-origin: 12px 12px;
  animation: checkmarkGreenPulse 1.35s ease-in-out infinite;
}

@keyframes checkmarkGreenPulse {
  0%, 100% {
    color: #15803d; /* Darker, richer green */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 1px rgba(21, 128, 61, 0.35));
    transform: scale(1);
  }
  50% {
    color: #22c55e; /* Vibrant glowing brighter green */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 5px rgba(34, 197, 94, 0.95)) drop-shadow(0 0 9px rgba(74, 222, 128, 0.8));
    transform: scale(1.1);
  }
}

/* Stop pulsing once Ready button is clicked */
#btnDoneSetup.ready-clicked .checkmark-pulse-group,
.ready-checkmark-icon.pulse-stopped .checkmark-pulse-group {
  animation: none !important;
  color: #16a34a !important;
  transform: scale(1) !important;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2)) !important;
}

/* Build Battle Scene Stickman Hammer Icon */
.build-hammer-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-block;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
  transition: transform 0.15s ease;
}

#btnSetupAddStickmen:hover .build-hammer-icon,
#btnNonSetupAddStickmen:hover .build-hammer-icon {
  transform: scale(1.18) rotate(-8deg);
}

.setup-guidance-title .build-hammer-icon {
  width: 28px;
  height: 28px;
  margin-right: 6px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

@media (max-width: 680px) {
  .build-hammer-icon {
    width: 18px;
    height: 18px;
  }
  .setup-guidance-title .build-hammer-icon {
    width: 24px;
    height: 24px;
  }
}

.doodle-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 4px 0px #111;
  background: #fff;
}

.doodle-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 1px 0px #111;
}

.doodle-btn.primary {
  background: #ffe066;
  border-color: #744210;
  box-shadow: 2px 3px 0px #744210;
}

.doodle-btn.active {
  background: #bae6fd;
  border-color: #0369a1;
  box-shadow: inset 1px 2px 3px rgba(0,0,0,0.2);
}

.doodle-btn:disabled,
button:disabled,
select:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Sound On/Off Button - High-Visibility Toggle */
.sound-toggle-btn {
  font-family: var(--font-doodle);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  border: 2.5px solid #15803d;
  background: #dcfce7;
  color: #14532d;
  box-shadow: 2px 3px 0px #14532d;
  transition: all 0.15s ease;
  user-select: none;
}

.sound-toggle-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 4px 0px #14532d;
  background: #bbf7d0;
}

.sound-toggle-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 1px 0px #14532d;
}

.sound-toggle-btn.sound-off {
  background: #fee2e2;
  color: #991b1b;
  border-color: #b91c1c;
  box-shadow: 2px 3px 0px #7f1d1d;
}

.sound-toggle-btn.sound-off:hover {
  background: #fecaca;
  box-shadow: 3px 4px 0px #7f1d1d;
}

.sound-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.9);
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sound-toggle-btn.sound-off .sound-status-dot {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.9);
}

/* Magnifier Tool On/Off Button - High-Visibility Toggle */
.magnifier-toggle-btn {
  font-family: var(--font-doodle);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  border: 2.5px solid #0284c7;
  background: #e0f2fe;
  color: #0369a1;
  box-shadow: 2px 3px 0px #0369a1;
  transition: all 0.15s ease;
  user-select: none;
}

.magnifier-toggle-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 4px 0px #0369a1;
  background: #bae6fd;
}

.magnifier-toggle-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 1px 0px #0369a1;
}

.magnifier-toggle-btn.magnifier-off {
  background: #f1f5f9;
  color: #475569;
  border-color: #64748b;
  box-shadow: 2px 3px 0px #334155;
}

.magnifier-toggle-btn.magnifier-off:hover {
  background: #e2e8f0;
  box-shadow: 3px 4px 0px #334155;
}

.magnifier-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0284c7;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.9);
  display: inline-block;
  flex-shrink: 0;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.magnifier-toggle-btn.magnifier-off .magnifier-status-dot {
  background: #94a3b8;
  box-shadow: 0 0 4px rgba(148, 163, 184, 0.5);
}

/* Status & Scoreboard Bar (Directly under notebook paper) */
.scoreboard-bar {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 8px;
  gap: 14px;
}

.player-card {
  flex: 1;
  background: var(--sticky-yellow);
  padding: 6px 14px;
  border: 2px solid #8d7b3a;
  border-radius: 4px 18px 5px 14px;
  box-shadow: 2px 3px 8px var(--sticky-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 11;
  transition: all 0.25s ease;
}

.player-card.active-turn {
  transform: translateY(-2px);
  border-width: 2.5px;
  border-color: #b91c1c;
  box-shadow: 0 0 0 1px #ef4444, 0 0 12px rgba(239, 68, 68, 0.4), 3px 4px 10px rgba(0,0,0,0.3);
  background: #fffbe6;
}

.player-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  vertical-align: middle;
}

.avatar-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(1.5px 2px 0px rgba(0, 0, 0, 0.22));
  transition: transform 0.2s ease;
}

.player-card.active-turn .avatar-svg {
  transform: scale(1.05);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.player-name-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.player-name-row.is-editable {
  cursor: pointer;
}

.player-name-row.is-editable:hover .player-name {
  text-decoration: underline dotted #64748b;
}

.player-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  letter-spacing: 0.5px;
}

.btn-card-rename {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0 3px;
  line-height: 1;
  opacity: 0.65;
  transition: all 0.15s ease;
  border-radius: 4px;
}

.btn-card-rename:hover {
  opacity: 1;
  transform: scale(1.15);
  background: rgba(254, 240, 138, 0.4);
}

.btn-card-rename:active {
  transform: scale(0.95);
}

.player-status-badge {
  font-size: 0.85rem;
  background: rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.stickmen-rack {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stick-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #22c55e;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stick-dot.eliminated {
  background: #dc2626;
  border-color: #991b1b;
  transform: scale(0.75);
  opacity: 0.85;
  position: relative;
}

.stick-dot.eliminated::after {
  content: '✕';
  position: absolute;
  top: -4px;
  left: 1px;
  font-size: 10px;
  color: #fff;
}

/* Center Instruction / Banner & Action Button Group */
.turn-banner-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 320px;
}

.turn-banner {
  font-family: var(--font-doodle);
  background: #ffffff;
  padding: 4px 14px;
  border: 2px dashed #444;
  border-radius: 12px;
  font-size: 1.02rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  box-shadow: 1px 2px 0px rgba(0,0,0,0.25);
  min-width: 280px;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.turn-banner.highlight {
  background: #fef08a;
  color: #854d0e;
  animation: pulse 1s infinite alternate;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

.turn-banner .turn-banner-line {
  display: inline;
}

.turn-banner .turn-banner-line1::after {
  content: ' • ';
}

.btn-banner-action {
  padding: 8px 24px;
  font-size: 1.35rem;
  font-weight: 800;
  border-radius: 14px;
  letter-spacing: 0.5px;
  cursor: pointer;
  background: #ffffff !important;
  color: #14532d;
  border: 3px solid #16a34a;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-banner-action:hover {
  transform: translateY(-1px);
}

/* Flashing green inward and outward for setup action buttons ("Ready/Attack" and "Finished") */
.btn-banner-action.flashing-border {
  animation: borderGreenFlash 1.2s ease-in-out infinite;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

@keyframes borderGreenFlash {
  0%, 100% {
    border-color: #22c55e;
    box-shadow: 
      2px 3px 0px rgba(0, 0, 0, 0.2),
      0 0 4px 1px rgba(34, 197, 94, 0.3),
      inset 0 0 3px 1px rgba(34, 197, 94, 0.2);
  }
  50% {
    border-color: #15803d;
    box-shadow: 
      2px 3px 0px rgba(0, 0, 0, 0.28),
      0 0 15px 5px rgba(34, 197, 94, 0.85),
      inset 0 0 10px 3px rgba(34, 197, 94, 0.55);
  }
}

@keyframes pulse {
  0% {
    background: #fef08a;
    box-shadow: 1px 2px 0px rgba(0, 0, 0, 0.25), 0 0 4px rgba(234, 179, 8, 0.4);
  }
  100% {
    background: #fde047;
    box-shadow: 1px 2px 0px rgba(0, 0, 0, 0.25), 0 0 14px rgba(234, 179, 8, 0.85);
  }
}

/* Desk & Notebook Stage */
.notebook-stage {
  width: 100%;
  max-width: 1200px;
  height: clamp(230px, min(56vw, calc(100vh - 220px)), 640px);
  position: relative;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

/* The physical paper notebook book */
.notebook-sheet {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 60;
  display: flex;
  background-color: var(--paper-cream);
  border-radius: 6px;
  box-shadow: 
    0 15px 35px rgba(0,0,0,0.5),
    0 3px 8px rgba(0,0,0,0.3),
    inset 0 0 40px rgba(215, 205, 185, 0.35);
  border: 1px solid #d5cfc2;
  isolation: isolate;
  background-clip: padding-box;
}

/* Spiral binder holes at the top */
.spiral-binder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 22px;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  z-index: 20;
  pointer-events: none;
}

.spiral-ring {
  width: 8px;
  height: 16px;
  background: linear-gradient(90deg, #666 0%, #aaa 45%, #fff 55%, #555 100%);
  border-radius: 4px;
  box-shadow: 0 3px 3px rgba(0,0,0,0.4);
}

/* In blank paper mode (default or selected), get rid of the marks at the top of the page */
.notebook-sheet.paper-blank .spiral-binder,
.notebook-sheet:not(.paper-ruled):not(.paper-grid) .spiral-binder {
  display: none !important;
}

/* Fold Crease in the exact middle (Fixed Book Spine) */
.crease-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.16) 0%,
    rgba(255,255,255,0.75) 45%,
    rgba(0,0,0,0.2) 100%
  );
  box-shadow: 0 0 8px rgba(0,0,0,0.15);
  z-index: 55;
  pointer-events: none;
}

/* Hide Fold Crease box in all modes */
.crease-tab {
  display: none !important;
}

/* Office Trash Can at Bottom Center Crease (Creation/Setup Phase only) */
.office-trash-can {
  --trash-scale: 1;
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) scale(var(--trash-scale, 1));
  transform-origin: center bottom;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 56;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.office-trash-can:hover {
  transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1.08));
}

/* While actively dragging, let pointer events pass through to canvas layers */
body.is-dragging-item #officeTrashCan {
  pointer-events: none;
}

/* Active drag-over highlight when dragging stickman/prop */
.office-trash-can.hover-active {
  transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1.22));
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.85)) drop-shadow(0 6px 12px rgba(0,0,0,0.4));
}

.office-trash-can.hover-active .trash-can-label {
  background: #ef4444;
  color: #ffffff;
  border-color: #991b1b;
  transform: scale(1.1);
}

.office-trash-can.hover-active .trash-can-body {
  animation: trashWiggle 0.4s infinite ease-in-out;
}

@keyframes trashWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* Squash and pop animation when an item is trashed */
.office-trash-can.trashed-anim {
  animation: trashPop 0.5s ease;
}

@keyframes trashPop {
  0% { transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1)); }
  30% { transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1.3)) rotate(-6deg); }
  60% { transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 0.88)) rotate(4deg); }
  80% { transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1.08)) rotate(-2deg); }
  100% { transform: translateX(-50%) scale(calc(var(--trash-scale, 1) * 1)) rotate(0deg); }
}

/* Phone / smaller screen scaling for Office Trash Can */
body.phone-portrait-layout .office-trash-can,
body.is-phone-device.phone-portrait-layout .office-trash-can {
  --trash-scale: 0.72;
  bottom: 3px;
}

@media (max-width: 680px) {
  .office-trash-can {
    --trash-scale: 0.72;
    bottom: 3px;
  }
}

body.phone-landscape-layout .office-trash-can,
body.is-phone-device:not(.phone-portrait-layout) .office-trash-can {
  --trash-scale: 0.65;
  bottom: 2px;
}

@media (max-height: 520px) {
  .office-trash-can {
    --trash-scale: 0.65;
    bottom: 2px;
  }
}

.trash-can-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.trash-can-svg {
  width: 44px;
  height: 50px;
  display: block;
}

.trash-can-label {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 1px;
  font-weight: 800;
  color: #555;
  background: rgba(254, 243, 199, 0.95);
  border: 1px solid #d97706;
  border-radius: 6px;
  padding: 1px 6px;
  margin-top: 1px;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Floating Stickman Pull-Up Ghost (Pulled from Button to Paper) */
.stickman-pull-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
  will-change: transform, left, top;
}

.stickman-pull-ghost canvas {
  width: 80px;
  height: 80px;
  display: block;
  position: relative;
  z-index: 2;
}

.stickman-pull-ghost .ghost-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 66px;
  height: 66px;
  transform: translate(-50%, -50%);
  border: 2.5px dashed #0284c7;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
  animation: ghostRingPulse 1.2s infinite ease-in-out;
  z-index: 1;
}

.stickman-pull-ghost.valid .ghost-ring {
  border-color: #16a34a;
  background: rgba(240, 253, 244, 0.8);
  box-shadow: 0 0 14px rgba(22, 163, 74, 0.55);
}

.stickman-pull-ghost.invalid .ghost-ring {
  border-color: #ef4444;
  background: rgba(254, 242, 242, 0.8);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.55);
}

@keyframes ghostRingPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}

body.is-pulling-stickman,
body.is-pulling-prop {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}

body.is-pulling-stickman *,
body.is-pulling-prop * {
  cursor: grabbing !important;
}

/* Notebook Page Halves */
.page-half {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--paper-cream);
  transform-origin: center center;
}

/* Optional Ruled Lines (if enabled) */
.notebook-sheet.paper-ruled .page-half,
.notebook-sheet.paper-ruled .flap-face-front {
  background-image: repeating-linear-gradient(
    transparent,
    transparent 23px,
    var(--line-blue) 24px
  );
}

.notebook-sheet.paper-ruled .page-left::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 48px;
  width: 2px;
  background: var(--margin-red);
  pointer-events: none;
  z-index: 2;
}

.notebook-sheet.paper-ruled .page-right::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 48px;
  width: 2px;
  background: var(--margin-red);
  pointer-events: none;
  z-index: 2;
}

/* Optional Graph Grid (if enabled) - Mirrored across center crease/fold */
.notebook-sheet.paper-grid .page-half,
.notebook-sheet.paper-grid .flap-face-front {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to right, var(--line-blue) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: left top;
}

/* Left page and left folding flap: anchor grid to the right edge (center crease) */
.notebook-sheet.paper-grid .page-left,
.notebook-sheet.paper-grid .folding-flap.left-flap .flap-face-front {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to left, var(--line-blue) 1px, transparent 1px);
  background-position: right top;
}

/* Right page and right folding flap: anchor grid to the left edge (center crease) */
.notebook-sheet.paper-grid .page-right,
.notebook-sheet.paper-grid .folding-flap.right-flap .flap-face-front {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to right, var(--line-blue) 1px, transparent 1px);
  background-position: left top;
}

/* Authentic Notebook Under-Page Layer (revealed when page lifts into 3D during fold) */
.under-shadow {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  background-color: var(--paper-cream);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: none !important;
  border-radius: 4px;
}
.under-shadow-left {
  left: 0;
  box-shadow: inset -6px 0 14px rgba(0, 0, 0, 0.06);
  border-right: 1px dashed rgba(0, 0, 0, 0.15);
}
.under-shadow-right {
  right: 0;
  box-shadow: inset 6px 0 14px rgba(0, 0, 0, 0.06);
  border-left: 1px dashed rgba(0, 0, 0, 0.15);
}
.under-shadow.active {
  opacity: 1;
}

/* Matching Ruled Lines on under-page (if enabled) */
.notebook-sheet.paper-ruled .under-shadow {
  background-image: repeating-linear-gradient(
    transparent,
    transparent 23px,
    var(--line-blue) 24px
  );
}

/* Matching Graph Grid on under-page (if enabled) - Mirrored across center crease */
.notebook-sheet.paper-grid .under-shadow {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to right, var(--line-blue) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: left top;
}
.notebook-sheet.paper-grid .under-shadow-left {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to left, var(--line-blue) 1px, transparent 1px);
  background-position: right top;
}
.notebook-sheet.paper-grid .under-shadow-right {
  background-image: 
    linear-gradient(var(--line-blue) 1px, transparent 1px),
    linear-gradient(to right, var(--line-blue) 1px, transparent 1px);
  background-position: left top;
}

/* Vacated States during paper fold: under-page smoothly masks canvases at z-index 35 */
.notebook-sheet.folding-vacated-left .under-shadow-left {
  opacity: 1 !important;
  z-index: 35 !important;
}

.notebook-sheet.folding-vacated-right .under-shadow-right {
  opacity: 1 !important;
  z-index: 35 !important;
}

/* Canvas layers - Hardware accelerated via dedicated GPU compositing layers */
.canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  image-rendering: auto;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: contents;
  contain: paint;
}

#freehandCanvas {
  z-index: 30;
}

#doodleCanvas {
  z-index: 31;
}

#gameCanvas {
  z-index: 32;
}

/* 3D Folding Overlay Container */
.fold-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  display: none;
}

.fold-overlay.active {
  display: block;
}

/* The swinging paper flap during fold */
.folding-flap {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  z-index: 65;
}

.folding-flap.left-flap {
  left: 0;
  transform-origin: right center;
}

.folding-flap.right-flap {
  right: 0;
  transform-origin: left center;
}

/* Flap faces (Front = Drawings + Ink Dot, Back = Blank Opaque Paper + Ink Dot) */
.flap-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-sizing: border-box;
  background-color: var(--paper-cream);
  overflow: hidden;
  transform-style: preserve-3d;
}

.flap-face-front {
  transform: rotateY(0deg) translateZ(1px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.flap-face-back {
  background-color: var(--paper-cream) !important;
  background-image: none !important;
  transform: rotateY(180deg) translateZ(1px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Front Face Borders: seamless flush edge matching the resting page without shrinking or detaching */
.folding-flap.left-flap .flap-face-front,
.folding-flap.right-flap .flap-face-front {
  border: none;
}

/* Back Face: rotated 180° so it faces outward when folded over, blank opaque paper (not see through) */
.folding-flap.left-flap .flap-face-back,
.folding-flap.right-flap .flap-face-back {
  border: none;
}

/* Fallback visibility toggles for browsers where 3D backface culling of canvas/stacking fails (e.g. Firefox) */
.folding-flap.flap-folded-over .flap-face-front {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.folding-flap:not(.flap-folded-over) .flap-face-back {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#flapCanvas {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: contents;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Placed shot dot visibly affixed to the 3D folding paper flap */
.flap-shot-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #334155, #0f172a 70%, #020617);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35), 0 2px 4px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 20;
  display: none;
}

.flap-back-dot {
  background: radial-gradient(circle at 35% 35%, #334155, #0f172a 70%, #020617);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35), 0 2px 4px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
}

/* True Book Page Turning Keyframes - Fixed Crease Spine, Swings Toward Viewer (+Z) */

/* Player 1: Turn Left Page to Right */
@keyframes turnBookPageLeftToRight {
  0% {
    transform: rotateY(0deg);
    box-shadow: none;
  }
  30% {
    box-shadow: -8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  50% {
    /* Standing arched toward viewer (+Z) along fixed center crease */
    transform: rotateY(90deg);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.45);
  }
  70% {
    box-shadow: 8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  100% {
    /* Landed flat on the opposite page */
    transform: rotateY(180deg);
    box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.25);
  }
}

/* Player 1: Turn Back from Right to Left (Unfold) */
@keyframes turnBookPageRightToLeft {
  0% {
    transform: rotateY(180deg);
    box-shadow: 4px 8px 16px rgba(0, 0, 0, 0.25);
  }
  30% {
    box-shadow: 8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: rotateY(90deg);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.45);
  }
  70% {
    box-shadow: -8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  100% {
    transform: rotateY(0deg);
    box-shadow: none;
  }
}

/* Player 2 / AI: Turn Right Page to Left */
@keyframes turnBookPageRightToLeftP2 {
  0% {
    transform: rotateY(0deg);
    box-shadow: none;
  }
  30% {
    box-shadow: 8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: rotateY(-90deg);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.45);
  }
  70% {
    box-shadow: -8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  100% {
    transform: rotateY(-180deg);
    box-shadow: -4px 8px 16px rgba(0, 0, 0, 0.25);
  }
}

/* Player 2 / AI: Turn Back from Left to Right (Unfold) */
@keyframes turnBookPageLeftToRightP2 {
  0% {
    transform: rotateY(-180deg);
    box-shadow: -4px 8px 16px rgba(0, 0, 0, 0.25);
  }
  30% {
    box-shadow: -8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  50% {
    transform: rotateY(-90deg);
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.45);
  }
  70% {
    box-shadow: 8px 16px 36px rgba(0, 0, 0, 0.35);
  }
  100% {
    transform: rotateY(0deg);
    box-shadow: none;
  }
}

.folding-left-active {
  animation: turnBookPageLeftToRight 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.unfolding-left-active {
  animation: turnBookPageRightToLeft 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.folding-right-active {
  animation: turnBookPageRightToLeftP2 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
.unfolding-right-active {
  animation: turnBookPageLeftToRightP2 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Curved Fold Direction Arrow matching illustration */
.game-fold-arrow {
  position: absolute;
  top: 35%;
  width: 140px;
  height: 70px;
  pointer-events: none;
  z-index: 70;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  transition: opacity 0.25s ease;
}

/* Dirt Tamper tool graphic during paper fold mark transfer */
.rubbing-hand {
  position: absolute;
  width: 80px;
  height: 100px;
  display: none;
  z-index: 75;
  pointer-events: none;
  transform: translate3d(-40px, -50px, 0);
  transform-origin: 40px 50px;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.rubbing-tamper {
  width: 80px;
  height: 100px;
  display: block;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}

.rubbing-active {
  display: block;
  animation: tamperTampMotion 0.54s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.rubbing-active .tamper-impact-fx {
  animation: tamperShockwave 0.54s ease-out forwards;
}

@keyframes tamperTampMotion {
  0% {
    transform: translate3d(-40px, -125px, 0) scale(0.92);
    opacity: 0;
  }
  14% {
    transform: translate3d(-40px, -135px, 0) scale(0.94);
    opacity: 1;
  }
  32% {
    transform: translate3d(-40px, -50px, 0) scaleX(1.06) scaleY(0.94); /* ONE SOLID DRAMATIC STOMP DOWN - CENTERED ON DOT */
  }
  38% {
    transform: translate3d(-40px, -50px, 0) scale(1.0); /* Locked firmly into place */
  }
  100% {
    transform: translate3d(-40px, -50px, 0) scale(1.0); /* Held solidly flat with zero bounce */
    opacity: 1;
  }
}

@keyframes tamperShockwave {
  0%, 30% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.6);
    transform-origin: 40px 50px;
  }
  33% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1.25);
    transform-origin: 40px 50px;
  }
  55% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1.6);
    transform-origin: 40px 50px;
  }
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(1.6);
    transform-origin: 40px 50px;
  }
}

/* ── Initial Game Setup Options (Player 1 Right Page) ── */
.setup-options-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  right: 0;
  margin: auto;
  width: min(44%, 380px);
  height: fit-content;
  max-height: min(96%, calc(100% - 10px));
  background: #fdfcf7;
  border: 2.5px solid #2d241e;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 
    4px 5px 0px rgba(45, 36, 30, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 14px 18px;
  z-index: 60;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 9px;
  user-select: none;
  pointer-events: auto;
  box-sizing: border-box;
  animation: setupPanelPop 0.25s ease-out;
}

.setup-options-panel:not(.panel-phone-landscape) > * {
  width: 100%;
  box-sizing: border-box;
}

.setup-options-panel:not(.panel-phone-landscape).is-pass-play #setupP1NameGroup,
.setup-options-panel:not(.panel-phone-landscape).is-pass-play #setupP2NameGroup {
  width: calc(50% - 5px) !important;
  display: flex !important;
  margin: 0 !important;
}

.setup-options-panel.is-pass-play #inputPlayer1Name,
.setup-options-panel.is-pass-play #inputPlayer2Name {
  font-size: 0.90rem !important;
  padding: 6px 8px !important;
}

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

/* Responsive adjustments for compact desktop viewports so menu stays comfortably embedded on right page */
@media (max-height: 720px), (max-width: 1050px) {
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) {
    padding: 10px 14px;
    gap: 6px;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-select,
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-input {
    padding: 6px 10px;
    font-size: 0.96rem;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-add-btn {
    padding: 6px 12px;
    font-size: 1.05rem;
    margin-top: 2px;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-intro {
    font-size: 0.88rem;
  }
}

.setup-options-panel.panel-left {
  left: 0;
  right: 50%;
}

.setup-panel-header {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  border-bottom: 2px dashed #b5a895;
  padding-bottom: 6px;
}

.setup-pin-clip {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.setup-title {
  font-family: var(--font-heading);
  font-size: 1.22rem;
  color: #241a14;
  letter-spacing: 0.5px;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.setup-badge {
  font-family: var(--font-doodle);
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1.5px solid #3b82f6;
  border-radius: 12px;
  padding: 1px 8px;
  letter-spacing: 0.3px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

/* Small Rules Button in Game Setup Menu Header (Left of Player 1 badge) */
.btn-setup-rules {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 8px;
  border: 1.5px solid #292929;
  border-radius: 8px;
  background-color: #faeb8f;
  background-image: linear-gradient(180deg, #fef7b5 0%, #faea8c 50%, #f6de6b 100%);
  color: #4a2c11;
  box-shadow: 1px 2px 0px #292929;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-setup-rules:hover {
  background-color: #fef08a;
  background-image: linear-gradient(180deg, #fffbeb 0%, #fef08a 50%, #fde047 100%);
  transform: translate(-1px, -1px);
  box-shadow: 2px 3px 0px #1e3a8a;
  border-color: #1e3a8a;
}

.btn-setup-rules:active {
  transform: translate(1px, 1px);
  box-shadow: 0px 0px 0px #292929;
}

body.phone-portrait-layout .btn-setup-rules,
@media (max-width: 680px) {
  .btn-setup-rules {
    font-size: 0.74rem !important;
    padding: 1.5px 6px !important;
  }
}

body.phone-landscape-layout .btn-setup-rules {
  font-size: 0.72rem !important;
  padding: 1px 5px !important;
}

.setup-intro {
  font-family: var(--font-doodle);
  font-size: 0.98rem;
  color: #574b41;
  line-height: 1.25;
  margin: 0;
}

.setup-option-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.setup-label {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: #3b2d24;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.3px;
}

.setup-label-icon {
  font-size: 1.1rem;
}

.setup-select,
.setup-input {
  width: 100%;
  font-family: var(--font-doodle);
  font-size: 1.05rem;
  font-weight: 700;
  background: #ffffff;
  color: #241a14 !important;
  border: 2px solid #2d241e;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 8px 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0px rgba(45, 36, 30, 0.25);
  transition: all 0.12s ease;
  outline: none;
}

.setup-input {
  cursor: text;
}

.setup-input::placeholder {
  color: #475569;
  font-weight: 700;
  opacity: 0.95;
}

.setup-select:has(option:checked:disabled),
.setup-select option[disabled] {
  color: #241a14 !important;
  font-weight: 700;
}

.setup-select:hover,
.setup-input:hover {
  background: #fffdf5;
  border-color: #111;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.35);
}

.setup-select:focus,
.setup-input:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.25), 2px 2px 0px #0284c7;
}

/* Game mode dropdown with stickman duel icon */
.game-mode-select-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.setup-game-mode-icons {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.setup-game-mode-icons .dropdown-game-mode-icon.stickman-duel-icon {
  width: 24px !important;
  height: 18px !important;
  flex-shrink: 0;
  display: block;
}

.setup-select.game-mode-select {
  padding-left: 40px !important;
  cursor: pointer;
}

body:not(.game-is-left):not(.battle-active) .setup-options-panel select.game-mode-select:not(:disabled) {
  pointer-events: auto !important;
  cursor: pointer !important;
  opacity: 1;
}

body.phone-portrait-layout .setup-options-panel .setup-select.game-mode-select,
.setup-options-panel.panel-phone-portrait .setup-select.game-mode-select {
  padding-left: 38px !important;
}

body.phone-portrait-layout .setup-options-panel .setup-game-mode-icons .stickman-duel-icon,
.setup-options-panel.panel-phone-portrait .setup-game-mode-icons .stickman-duel-icon {
  width: 22px !important;
  height: 17px !important;
}

/* Stickmen dropdown with rigid stickman icon */
.stickmen-select-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.setup-stickmen-icons {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.setup-stickmen-icons .dropdown-stickman-icon.rigid-stickman-icon {
  width: 17px !important;
  height: 30px !important;
  flex-shrink: 0;
  display: block;
}

.setup-select.stickmen-count-select {
  padding-left: 37px !important;
}

body.phone-portrait-layout .setup-options-panel .setup-select.stickmen-count-select,
.setup-options-panel.panel-phone-portrait .setup-select.stickmen-count-select {
  padding-left: 35px !important;
}

body.phone-portrait-layout .setup-options-panel .setup-stickmen-icons .rigid-stickman-icon,
.setup-options-panel.panel-phone-portrait .setup-stickmen-icons .rigid-stickman-icon {
  width: 15px !important;
  height: 26px !important;
}

/* Paper style dropdown with stickman paper icon */
.paper-select-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.setup-paper-icons {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.setup-paper-icons .dropdown-paper-icon.stickman-paper-icon {
  width: 18px !important;
  height: 22px !important;
  flex-shrink: 0;
  display: block;
}

.setup-select.paper-style-select {
  padding-left: 37px !important;
}

body.phone-portrait-layout .setup-options-panel .setup-select.paper-style-select,
.setup-options-panel.panel-phone-portrait .setup-select.paper-style-select {
  padding-left: 35px !important;
}

body.phone-portrait-layout .setup-options-panel .setup-paper-icons .stickman-paper-icon,
.setup-options-panel.panel-phone-portrait .setup-paper-icons .stickman-paper-icon {
  width: 16px !important;
  height: 20px !important;
}



.setup-add-btn {
  width: 100%;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  padding: 8px 16px;
  margin-top: 3px;
  margin-bottom: 2px;
  text-align: center;
  letter-spacing: 0.5px;
  box-shadow: 2px 3px 0px rgba(0, 0, 0, 0.3);
}

.setup-add-btn:not(.setup-begin-btn) {
  color: #1e293b !important;
  background: #fef9c3 !important;
  border: 2.5px solid #854d0e !important;
  box-shadow: 2px 3px 0px #854d0e !important;
}

.setup-add-btn:not(.setup-begin-btn):hover {
  background: #fef08a !important;
  border-color: #713f12 !important;
  box-shadow: 3px 4px 0px #713f12 !important;
}

.setup-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 3px 4px 0px rgba(0, 0, 0, 0.4);
}

.setup-add-btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
}

.setup-begin-btn {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #14532d !important;
  background: #f0fdf4 !important;
  border: 3px solid #16a34a !important;
  box-shadow: 2px 3px 0px #16a34a !important;
}

.setup-begin-sharpener-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 2px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.setup-begin-btn:hover .setup-begin-sharpener-icon {
  transform: scale(1.1) rotate(-3deg);
}

.setup-begin-btn:active .setup-begin-sharpener-icon {
  transform: scale(0.96) rotate(1deg);
}

.setup-begin-btn.setup-begin-disabled {
  opacity: 0.55 !important;
  filter: grayscale(40%) !important;
  cursor: not-allowed !important;
  border-color: #94a3b8 !important;
  color: #64748b !important;
  background: #f1f5f9 !important;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2) !important;
  animation: none !important;
  pointer-events: auto;
}

.setup-begin-btn.setup-begin-disabled:hover {
  transform: none !important;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2) !important;
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
}

.setup-param-missing {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.35), 2px 2px 0px #ef4444 !important;
  animation: paramShake 0.4s ease-in-out !important;
}

@keyframes paramShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.setup-panel-footer {
  margin-top: 4px;
  background: #fef3c7;
  border: 1.5px dashed #d97706;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setup-footer-arrow {
  font-size: 1.3rem;
  animation: bounceLeft 1.2s infinite ease-in-out;
  flex-shrink: 0;
  will-change: transform;
  transform: translateZ(0);
}

@keyframes bounceLeft {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-4px, 0, 0); }
}

.setup-footer-text {
  font-family: var(--font-doodle);
  font-size: 0.92rem;
  color: #78350f;
  line-height: 1.25;
}

/* ── Phone Portrait Mode: Setup Menu Popup Over Game Screen and Building Menus ── */
.setup-options-panel.panel-phone-portrait,
body.phone-portrait-layout .setup-options-panel {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: auto !important;
  height: fit-content !important;
  display: flex;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  --setup-popup-scale: 0.91;
  transform: scale(var(--setup-popup-scale, 0.91)) !important;
  transform-origin: center center !important;
  width: min(94vw, 360px) !important;
  max-width: 360px !important;
  max-height: min(90vh, 90dvh) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  padding: 8px 12px !important;
  border: 2.5px solid #2d241e !important;
  border-radius: 14px !important;
  background: #fdfcf7 !important;
  box-shadow: 
    0 0 0 200vmax rgba(0, 0, 0, 0.65),
    0 12px 36px rgba(0, 0, 0, 0.45),
    3px 4px 0px rgba(0, 0, 0, 0.3) !important;
  z-index: 500 !important;
  box-sizing: border-box !important;
  gap: 8px !important;
  animation: setupPanelPop 0.25s ease-out !important;
}

/* Setup menu popup scale: consistent 0.91 scale across desktop overflow and phone layouts */
.setup-options-panel.panel-phone-portrait,
.setup-options-panel.panel-phone-landscape,
body.is-phone-device .setup-options-panel.panel-phone-portrait,
body.is-phone-device .setup-options-panel.panel-phone-landscape,
body.phone-portrait-layout .setup-options-panel,
body.phone-landscape-layout .setup-options-panel {
  --setup-popup-scale: 0.91;
  transform: scale(var(--setup-popup-scale, 0.91)) !important;
}

.setup-options-panel.panel-phone-portrait .setup-panel-header,
body.phone-portrait-layout .setup-options-panel .setup-panel-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 6px !important;
  gap: 4px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.setup-options-panel.panel-phone-portrait .setup-pin-clip,
body.phone-portrait-layout .setup-options-panel .setup-pin-clip {
  font-size: 1.15rem !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}

.setup-options-panel.panel-phone-portrait .setup-title,
body.phone-portrait-layout .setup-options-panel .setup-title {
  font-size: 1.05rem !important;
  white-space: nowrap !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.setup-options-panel.panel-phone-portrait .btn-setup-rules,
body.phone-portrait-layout .setup-options-panel .btn-setup-rules {
  font-size: 0.70rem !important;
  padding: 1.5px 5px !important;
  flex-shrink: 0 !important;
}

.setup-options-panel.panel-phone-portrait .setup-badge,
body.phone-portrait-layout .setup-options-panel .setup-badge {
  font-size: 0.72rem !important;
  padding: 1.5px 5px !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.setup-options-panel.panel-phone-portrait .setup-intro,
body.phone-portrait-layout .setup-options-panel .setup-intro {
  display: block !important;
  font-size: 0.92rem !important;
  color: #574b41 !important;
  margin: 2px 0 !important;
}

.setup-options-panel.panel-phone-portrait .setup-option-group,
body.phone-portrait-layout .setup-options-panel .setup-option-group {
  width: 100% !important;
}

.setup-options-panel.panel-phone-portrait .setup-select,
.setup-options-panel.panel-phone-portrait .setup-input,
body.phone-portrait-layout .setup-options-panel .setup-select,
body.phone-portrait-layout .setup-options-panel .setup-input {
  width: 100% !important;
  font-size: 0.95rem !important;
  min-height: 40px !important;
  padding: 6px 12px !important;
}

.setup-options-panel.panel-phone-portrait .setup-add-btn,
body.phone-portrait-layout .setup-options-panel .setup-add-btn {
  width: 100% !important;
  font-size: 1.05rem !important;
  min-height: 42px !important;
  padding: 8px 12px !important;
  justify-content: center !important;
  margin-top: 4px !important;
}

.setup-options-panel.panel-phone-portrait .setup-panel-footer,
body.phone-portrait-layout .setup-options-panel .setup-panel-footer {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: 4px !important;
  font-size: 0.84rem !important;
}

.setup-options-panel.panel-phone-portrait .setup-footer-arrow,
body.phone-portrait-layout .setup-options-panel .setup-footer-arrow {
  animation: bounceUp 1.2s infinite ease-in-out !important;
}

@keyframes bounceUp {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -4px, 0); }
}

.non-setup-action-wrap.panel-phone-portrait,
body.phone-portrait-layout .non-setup-action-wrap {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 1200px !important;
  margin-top: 10px !important;
  margin-bottom: 24px !important;
  padding: 0 !important;
  z-index: 10 !important;
}

.non-setup-action-wrap.panel-phone-portrait .non-setup-add-btn,
body.phone-portrait-layout .non-setup-action-wrap .non-setup-add-btn {
  width: 100% !important;
  font-size: 1.05rem !important;
  min-height: 42px !important;
  padding: 8px 12px !important;
  justify-content: center !important;
}

/* ── Phone Landscape Mode: Two-Column Setup Menu Popup Over Game Screen ── */
.setup-options-panel.panel-phone-landscape,
body.phone-landscape-layout .setup-options-panel {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: auto !important;
  height: fit-content !important;
  --setup-popup-scale: 0.91;
  transform: scale(var(--setup-popup-scale, 0.91)) !important;
  transform-origin: center center !important;
  width: min(94vw, 620px) !important;
  max-width: 620px !important;
  max-height: min(94vh, 94dvh) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  padding: 6px 12px !important;
  border: 2.5px solid #2d241e !important;
  border-radius: 14px !important;
  background: #fdfcf7 !important;
  box-shadow: 
    0 0 0 200vmax rgba(0, 0, 0, 0.65),
    0 12px 36px rgba(0, 0, 0, 0.45),
    3px 4px 0px rgba(0, 0, 0, 0.3) !important;
  z-index: 500 !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  column-gap: 12px !important;
  row-gap: 6px !important;
  align-items: center !important;
  animation: setupPanelPop 0.25s ease-out !important;
}

/* Hide when display is explicitly none via JS inline style */
.setup-options-panel[style*="display: none"],
.setup-options-panel.panel-phone-portrait[style*="display: none"],
body.phone-portrait-layout .setup-options-panel[style*="display: none"],
.setup-options-panel.panel-phone-landscape[style*="display: none"],
body.phone-landscape-layout .setup-options-panel[style*="display: none"] {
  display: none !important;
}

.setup-options-panel.panel-phone-landscape .setup-panel-header,
body.phone-landscape-layout .setup-options-panel .setup-panel-header {
  grid-column: 1 / -1 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding-bottom: 2px !important;
  margin-bottom: 0 !important;
  gap: 5px !important;
  width: 100% !important;
}

.setup-options-panel.panel-phone-landscape .setup-title,
body.phone-landscape-layout .setup-options-panel .setup-title {
  font-size: 1.05rem !important;
  white-space: nowrap !important;
  margin: 0 !important;
}

.setup-options-panel.panel-phone-landscape .setup-badge,
body.phone-landscape-layout .setup-options-panel .setup-badge {
  font-size: 0.76rem !important;
  padding: 1px 6px !important;
}

.setup-options-panel.panel-phone-landscape .setup-intro,
body.phone-landscape-layout .setup-options-panel .setup-intro {
  grid-column: 1 / -1 !important;
  display: block !important;
  font-size: 0.78rem !important;
  color: #574b41 !important;
  margin: 0 0 2px 0 !important;
  width: 100% !important;
  text-align: center !important;
}

.setup-options-panel.panel-phone-landscape .setup-option-group,
body.phone-landscape-layout .setup-options-panel .setup-option-group {
  width: 100% !important;
  margin: 0 !important;
}

.setup-options-panel.panel-phone-landscape .setup-select-wrapper,
body.phone-landscape-layout .setup-options-panel .setup-select-wrapper {
  width: 100% !important;
  min-height: 30px !important;
  height: 30px !important;
}

.setup-options-panel.panel-phone-landscape .setup-select,
.setup-options-panel.panel-phone-landscape .setup-input,
body.phone-landscape-layout .setup-options-panel .setup-select,
body.phone-landscape-layout .setup-options-panel .setup-input {
  width: 100% !important;
  font-size: 0.84rem !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 2px 8px !important;
  box-sizing: border-box !important;
}

.setup-options-panel.panel-phone-landscape #btnSetupAddStickmen,
body.phone-landscape-layout .setup-options-panel #btnSetupAddStickmen {
  width: 100% !important;
  font-size: 0.82rem !important;
  min-height: 30px !important;
  height: 30px !important;
  padding: 2px 8px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  justify-content: center !important;
}

.setup-options-panel.panel-phone-landscape #btnSetupAddStickmen .build-hammer-icon,
body.phone-landscape-layout .setup-options-panel #btnSetupAddStickmen .build-hammer-icon {
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
}

/* Begin Button: Spans full width across bottom in non-pass-play modes */
.setup-options-panel.panel-phone-landscape #btnSetupBegin,
body.phone-landscape-layout .setup-options-panel #btnSetupBegin {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  font-size: 0.94rem !important;
  font-weight: bold !important;
  min-height: 34px !important;
  height: 34px !important;
  padding: 4px 12px !important;
  margin: 2px 0 0 0 !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

/* In Pass & Play mode: 2-column balanced with Begin paired with How to Build Scene on Row 5 */
.setup-options-panel.panel-phone-landscape.is-pass-play #btnSetupBegin,
body.phone-landscape-layout .setup-options-panel.is-pass-play #btnSetupBegin,
.setup-options-panel.panel-phone-landscape:has(#setupP2NameGroup:not([style*="none"])) #btnSetupBegin,
body.phone-landscape-layout .setup-options-panel:has(#setupP2NameGroup:not([style*="none"])) #btnSetupBegin {
  grid-column: 2 !important;
  margin: 0 !important;
  min-height: 30px !important;
  height: 30px !important;
}

.setup-options-panel.panel-phone-landscape .setup-begin-sharpener-icon,
body.phone-landscape-layout .setup-options-panel .setup-begin-sharpener-icon {
  width: 40px !important;
  height: 20px !important;
}

.setup-options-panel.panel-phone-landscape .setup-panel-footer,
body.phone-landscape-layout .setup-options-panel .setup-panel-footer {
  grid-column: 1 / -1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  margin-top: 2px !important;
  font-size: 0.78rem !important;
}

.setup-options-panel.panel-phone-landscape .setup-footer-arrow,
body.phone-landscape-layout .setup-options-panel .setup-footer-arrow {
  animation: bounceUp 1.2s infinite ease-in-out !important;
}

.non-setup-action-wrap.panel-phone-landscape,
body.phone-landscape-layout .non-setup-action-wrap {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 1200px !important;
  margin-top: 8px !important;
  margin-bottom: 16px !important;
  padding: 0 !important;
  z-index: 10 !important;
}

.non-setup-action-wrap.panel-phone-landscape .non-setup-add-btn,
body.phone-landscape-layout .non-setup-action-wrap .non-setup-add-btn {
  width: 100% !important;
  font-size: 0.98rem !important;
  min-height: 34px !important;
  padding: 6px 10px !important;
  justify-content: center !important;
}

/* ── Phone Portrait Mode: Ready/Attack Button Directly to the Right of Quick Deploy ── */
body.phone-portrait-layout .pose-header-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px 8px !important;
  margin-bottom: 4px !important;
}

body.phone-portrait-layout .pose-title-group {
  display: contents !important;
}

body.phone-portrait-layout .pose-header-row .pose-title-label {
  flex: 0 0 100% !important;
  width: 100% !important;
  margin-bottom: 2px !important;
  order: 1 !important;
}

body.phone-portrait-layout .pose-header-row #btnAutoDeploy {
  flex: 0 0 auto !important;
  order: 2 !important;
  margin: 0 !important;
  font-size: 0.82rem !important;
  padding: 3px 8px !important;
  min-height: 32px !important;
}

body.phone-portrait-layout .pose-header-row #stickmanDeployGroup {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  order: 3 !important;
  margin: 0 !important;
  width: auto !important;
  gap: 4px !important;
}

body.phone-portrait-layout .pose-header-row #btnDoneSetup {
  flex: 0 0 auto !important;
  margin: 0 !important;
  font-size: 0.82rem !important;
  padding: 3px 8px !important;
  min-height: 32px !important;
}

/* Ensure all buttons, selectors, and scenery palettes are completely visible in phone portrait */
body.phone-portrait-layout .top-controls {
  gap: 4px 6px !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .top-controls select {
  font-size: 0.8rem !important;
  padding: 4px 6px !important;
  min-height: 36px !important;
  max-width: calc(50% - 4px) !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  flex: 1 1 45% !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .top-controls .doodle-btn {
  font-size: 0.78rem !important;
  padding: 4px 6px !important;
  min-height: 34px !important;
  flex: 1 1 auto !important;
  max-width: calc(50% - 4px) !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout.mode-campaign .top-controls .sound-toggle-btn:not(.btn-sound-model),
body.phone-portrait-layout.mode-campaign #btnRules:not(.btn-rules-model),
body.phone-portrait-layout.mode-campaign #btnHome:not(.btn-home-model),
body.phone-portrait-layout.mode-campaign #btnHeaderLeaveGame:not(.btn-leave-game-model) {
  flex: 1 1 calc(33.333% - 4px) !important;
  max-width: calc(33.333% - 4px) !important;
  padding: 4px 2px !important;
  font-size: 0.72rem !important;
}
body.phone-portrait-layout.mode-campaign #btnCampaignMap:not(.btn-campaign-map-model),
body.phone-portrait-layout.mode-campaign .top-controls .magnifier-toggle-btn:not(.btn-spyglass-model):not(.btn-aim-assist-model),
body.phone-portrait-layout.mode-campaign #btnUseBonusShots:not(.btn-bonus-shots-model),
body.phone-portrait-layout.mode-campaign #btnRestart:not(.btn-replay-model) {
  flex: 1 1 calc(50% - 4px) !important;
  max-width: calc(50% - 4px) !important;
  font-size: 0.74rem !important;
  padding: 4px 3px !important;
  gap: 3px !important;
}
body.phone-portrait-layout.mode-campaign #btnUseBonusShots .paperclip-gold-icon,
body.phone-portrait-layout.mode-campaign #btnUseBonusShots .bonus-shots-icon {
  width: 19px !important;
  height: 19px !important;
}
body.phone-portrait-layout .top-controls .btn-sound-model,
body.phone-portrait-layout .top-controls .btn-rules-model,
body.phone-portrait-layout .top-controls .btn-leave-game-model,
body.phone-portrait-layout .top-controls .btn-home-model,
body.phone-portrait-layout .top-controls .btn-spyglass-model,
body.phone-portrait-layout .top-controls .btn-aim-assist-model,
body.phone-portrait-layout .top-controls .btn-bonus-shots-model,
body.phone-portrait-layout .top-controls .btn-replay-model,
body.phone-portrait-layout .top-controls #btnCampaignMap.btn-campaign-map-model {
  width: auto !important;
  min-width: unset !important;
  max-width: unset !important;
  height: 46px !important;
  flex: 0 0 auto !important;
  padding: 0 !important;
  border-radius: 6px !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
body.phone-portrait-layout .top-controls .btn-card-tile {
  height: 46px !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.phone-portrait-layout .top-controls .img-header-btn {
  height: 46px !important;
  max-height: 46px !important;
  width: auto !important;
}
body.phone-portrait-layout .top-controls .btn-card-label {
  display: none !important;
}
body.phone-portrait-layout:not(.mode-campaign) .top-controls .sound-toggle-btn:not(.btn-sound-model),
body.phone-portrait-layout:not(.mode-campaign) #btnRules:not(.btn-rules-model),
body.phone-portrait-layout:not(.mode-campaign) #btnHome:not(.btn-home-model),
body.phone-portrait-layout:not(.mode-campaign) #btnHeaderLeaveGame:not(.btn-leave-game-model) {
  flex: 1 1 calc(33.333% - 4px) !important;
  max-width: calc(33.333% - 4px) !important;
  padding: 4px 4px !important;
}
body.phone-portrait-layout:not(.mode-campaign) .top-controls .magnifier-toggle-btn:not(.btn-spyglass-model):not(.btn-aim-assist-model),
body.phone-portrait-layout:not(.mode-campaign) #btnRestart:not(.btn-replay-model) {
  flex: 1 1 calc(50% - 4px) !important;
  max-width: calc(50% - 4px) !important;
  font-size: 0.76rem !important;
}
body.phone-portrait-layout .top-controls .sound-toggle-btn:not(.btn-sound-model),
body.phone-portrait-layout .top-controls .magnifier-toggle-btn:not(.btn-spyglass-model):not(.btn-aim-assist-model) {
  font-size: 0.74rem !important;
  padding: 4px 6px !important;
}
body.phone-portrait-layout .top-controls .doodle-btn:not(#btnCampaignMap):not(.btn-sound-model):not(.btn-rules-model):not(.btn-home-model):not(.btn-spyglass-model):not(.btn-aim-assist-model):not(.btn-bonus-shots-model):not(.btn-replay-model) {
  height: 36px !important;
  border-radius: 255px 22px 235px 24px / 24px 235px 22px 255px !important;
  border: 2px solid #142850 !important;
  box-shadow: 2px 2.5px 0px #142850, 0 3px 4px rgba(0, 0, 0, 0.25) !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .top-controls .sound-status-dot,
body.phone-portrait-layout .top-controls .magnifier-status-dot {
  width: 8px !important;
  height: 8px !important;
}
body.phone-portrait-layout .stamp-selector {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px 5px !important;
  overflow-x: visible !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .stamp-btn {
  flex: 1 1 calc(25% - 5px) !important;
  max-width: calc(25% - 4px) !important;
  min-width: 60px !important;
  font-size: 0.76rem !important;
  padding: 4px 3px !important;
  min-height: 32px !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout #bgModeChooserRow {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 4px !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: visible !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout #bgModeChooserRow .bg-title-label {
  width: 100% !important;
  text-align: left !important;
  margin-bottom: 0 !important;
  font-size: 1.05rem !important;
}
body.phone-portrait-layout .bg-mode-controls {
  width: auto !important;
  max-width: 100% !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 4px !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}
body.phone-portrait-layout .mode-toggle {
  width: auto !important;
  max-width: 100% !important;
  display: inline-flex !important;
  flex-direction: row !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .mode-toggle-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 100% !important;
  text-align: center !important;
  border-top: none !important;
  border-left: none !important;
  font-size: 0.8rem !important;
  padding: 4px 8px !important;
  justify-content: center !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  min-height: 32px !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .mode-toggle-btn:first-child {
  border-left: none !important;
}
body.phone-portrait-layout .mode-toggle-btn .mode-btn-timer-icon {
  width: 18px !important;
  height: 18px !important;
  margin-left: 2px !important;
}
body.phone-portrait-layout .mode-toggle-btn + .mode-toggle-btn {
  border-left: 2px solid #333 !important;
}
body.phone-portrait-layout .btn-painter-draw {
  padding: 2px 6px !important;
}
body.phone-portrait-layout .painter-btn-svg {
  width: 25px !important;
  height: 21px !important;
}
body.phone-portrait-layout #themeRow #btnModeStamp,
body.phone-portrait-layout #themeRow .prebuilt-title-label {
  flex: 1 1 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  margin: 0 0 4px 0 !important;
  padding: 2px 0 !important;
  font-family: var(--font-heading) !important;
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #1f2937 !important;
  min-height: auto !important;
  text-align: left !important;
  justify-content: flex-start !important;
  white-space: normal !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .toolbar-row {
  width: 100% !important;
  max-width: 100% !important;
  flex-wrap: wrap !important;
  overflow: visible !important;
  gap: 5px 6px !important;
  padding: 4px 0 !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout #themeRow,
body.phone-portrait-layout #themeSelectRow {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 5px 6px !important;
}
body.phone-portrait-layout #themeRow .tool-section:first-child,
body.phone-portrait-layout #themeSelectRow .tool-section:first-child {
  display: flex !important;
  flex: 1 1 100% !important;
  align-items: center !important;
  gap: 4px !important;
  width: 100% !important;
  flex-wrap: wrap !important;
}
body.phone-portrait-layout #themeSelect {
  flex: 1 1 auto !important;
  min-width: 110px !important;
  max-width: calc(100% - 95px) !important;
  font-size: 0.8rem !important;
  padding: 3px 6px !important;
  min-height: 32px !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout #btnShuffleTheme {
  flex: 0 0 auto !important;
  font-size: 0.8rem !important;
  padding: 3px 8px !important;
  min-height: 32px !important;
}
body.phone-portrait-layout #propSelectorGroup {
  flex-direction: column !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.phone-portrait-layout #propSelectorGroup .tool-label {
  width: 100% !important;
  margin-bottom: 2px !important;
}
body.phone-portrait-layout .prop-palette {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 4px !important;
  overflow-x: visible !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .prop-btn {
  flex: 1 1 60px !important;
  min-width: 55px !important;
  max-width: calc(20% - 4px) !important;
  font-size: 0.72rem !important;
  padding: 3px 2px !important;
  min-height: 30px !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout #drawToolsRow {
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
}
body.phone-portrait-layout #drawToolsRow .tool-group {
  display: flex !important;
  flex: 0 0 auto !important;
  gap: 6px !important;
}
body.phone-portrait-layout #drawToolsRow .doodle-btn {
  font-size: 0.82rem !important;
  padding: 3px 8px !important;
  min-height: 32px !important;
}
body.phone-portrait-layout #drawToolsRow .draw-hint {
  flex: 1 1 100% !important;
  width: 100% !important;
  font-size: 0.72rem !important;
  white-space: normal !important;
  margin-top: 2px !important;
}
body.phone-portrait-layout .floating-toast {
  z-index: 950 !important;
  max-width: 90% !important;
  box-sizing: border-box !important;
  text-align: center !important;
  font-size: 1.15rem !important;
}
body.phone-portrait-layout .floating-toast.toast-with-sub {
  font-size: 1.2rem !important;
  padding: 8px 16px !important;
}
body.phone-portrait-layout .floating-toast .toast-shot-count {
  font-size: 0.92rem !important;
  margin-top: 4px !important;
}
body.phone-portrait-layout .modal-paper {
  padding: 16px 12px !important;
  width: 94vw !important;
  max-width: 94vw !important;
  max-height: 90vh !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}
body.phone-portrait-layout .modal-actions:not([style*="display: none"]):not(.is-hidden) {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .modal-actions .doodle-btn,
body.phone-portrait-layout .victory-actions-group .doodle-btn {
  font-size: 0.92rem !important;
  padding: 6px 10px !important;
  min-height: 36px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body.phone-portrait-layout #campaignMapModal .campaign-map-card {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 12px 10px !important;
}

body.phone-portrait-layout #campaignMapModal .campaign-map-header {
  padding-right: 42px !important;
}

body.phone-portrait-layout #campaignMapModal .campaign-map-footer {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding-top: 10px !important;
  margin-top: auto !important;
  flex: 0 0 auto !important;
}

body.phone-portrait-layout #btnCloseCampaignMapBtn {
  font-size: 1.05rem !important;
  padding: 8px 24px !important;
  display: inline-flex !important;
  visibility: visible !important;
}
body.phone-portrait-layout .lobby-tabs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  width: 100% !important;
}
body.phone-portrait-layout .lobby-tab-btn {
  flex: 1 1 calc(50% - 6px) !important;
  max-width: calc(50% - 4px) !important;
  font-size: 0.9rem !important;
  padding: 6px 4px !important;
  box-sizing: border-box !important;
}
body.phone-portrait-layout .room-actions-row {
  flex-direction: column !important;
  gap: 6px !important;
  width: 100% !important;
}
body.phone-portrait-layout .room-actions-row .doodle-btn {
  width: 100% !important;
  max-width: 100% !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}



/* ── Multiplayer Non-Setup Player Action: Build Your Battle Scene ── */
.non-setup-action-wrap {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.non-setup-action-wrap.panel-left {
  display: none !important;
}

.non-setup-action-wrap .non-setup-add-btn {
  width: auto;
  min-width: min(85%, 260px);
  font-size: 1.22rem;
  padding: 12px 24px;
  box-shadow: 
    3px 4px 0px rgba(45, 36, 30, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

/* Setup & Drawing Toolbar — 3-row clean layout */
.setup-toolbar {
  width: 100%;
  max-width: 1200px;
  background: #ffffff;
  border: 2px solid #333;
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 3px 4px 0px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* Each horizontal row */
.toolbar-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  overflow: hidden;
}

/* Thin separator between rows */
.toolbar-row + .toolbar-row {
  border-top: 1px dashed #ccc;
}

/* Actions row: theme + ready button — push ready to the right */
.toolbar-row--actions {
  justify-content: space-between;
}

/* A labeled section within a row */
.tool-section {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Pose section with title stacked above the pose buttons */
.pose-section-stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.pose-header-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.pose-title-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pose-header-row .pose-title-label {
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

#stickmanDeployGroup {
  display: inline-flex;
  align-items: center;
  gap: 10px !important;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.pose-section-stacked .stamp-selector {
  width: 100%;
}

.pose-title-label,
.bg-title-label,
.prebuilt-title-label {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 3vw, 1.76rem) !important;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: 0.3px;
  line-height: 1.2;
  white-space: normal;
  padding-left: 2px;
  margin-bottom: 2px;
}

#bgModeChooserRow {
  display: flex;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  width: 100%;
}

#bgModeChooserRow .bg-title-label {
  margin-bottom: 2px;
  white-space: normal;
  width: 100%;
  flex-shrink: 0;
}

#themeRow #btnModeStamp:empty,
#themeRow .prebuilt-title-label:empty {
  display: none !important;
}

#themeRow .tool-label,
#themeRowLabel {
  white-space: pre !important;
}

.bg-mode-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Old .tool-group kept for compatibility */
.tool-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* Vertical divider between sections */
.toolbar-divider {
  width: 1px;
  height: 28px;
  background: #ccc;
  flex-shrink: 0;
  margin: 0 4px;
}

/* Section labels */
.tool-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 2px;
}

/* Horizontally scrollable strip for stamp/prop buttons */
.stamp-selector {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 3px 0;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  flex: 1;
  min-width: 0;
}

/* Prop palette: wraps evenly across as many rows as the viewport needs */
.prop-palette {
  display: flex;
  flex-wrap: wrap;
  overflow-x: visible;
  overflow-y: visible;
  gap: 4px;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

/* Pose / deploy stamp buttons */
.stamp-btn {
  font-family: var(--font-doodle);
  font-size: 0.85rem;
  background: #fdfdfd;
  border: 1.5px solid #888;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.1s ease;
}

.stamp-btn:hover {
  background: #f0f0f0;
  border-color: #222;
}

.stamp-btn.selected {
  background: #fef08a;
  border-color: #854d0e;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.15);
  font-weight: bold;
}

/* Scenery prop buttons — stretch evenly within each row */
.prop-btn {
  font-family: var(--font-doodle);
  font-size: 0.85rem;
  background: #fdfdfd;
  border: 1.5px solid #888;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: grab;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  flex: 1 1 80px;
  max-width: 140px;
  min-width: 70px;
  box-sizing: border-box;
  text-align: center;
  transition: all 0.1s ease;
}

.prop-btn:hover {
  background: #f0f0f0;
  border-color: #222;
}

.prop-btn.selected {
  background: #bae6fd;
  border-color: #0284c7;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.15);
  font-weight: bold;
}

/* Propeller row: label + scrollable palette side-by-side */
#propSelectorGroup {
  gap: 8px;
}


/* Modals - GPU accelerated, visibility-isolated overlays (no expensive backdrop-filter) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000 !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  overscroll-behavior: contain !important;
  touch-action: none;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: opacity, visibility;
}

.modal-backdrop.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  z-index: 2000 !important;
}

.modal-paper {
  background: var(--paper-cream);
  width: 90%;
  max-width: 620px;
  max-height: 94vh;
  max-height: 94dvh;
  border: 3px solid #222;
  border-radius: 12px;
  padding: 24px 30px;
  box-shadow: 6px 8px 0px #111, 0 15px 30px rgba(0,0,0,0.4);
  position: relative;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow-y: auto;
  overscroll-behavior: contain !important;
  touch-action: pan-y;
}

.title-sketch {
  font-family: var(--font-sketch);
  font-weight: 700;
  letter-spacing: 2px;
  color: #1a1a1a;
}

.title-script {
  font-family: var(--font-script);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 1px;
  color: #92400e;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: #111;
  text-align: center;
  border-bottom: 2px dashed #999;
  padding-bottom: 8px;
}

.modal-content {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.modal-content p, .modal-content li {
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.modal-actions[style*="display: none"],
.modal-actions.is-hidden,
#standardVictoryActions[style*="display: none"],
#standardVictoryActions.is-hidden,
#campaignVictoryActions[style*="display: none"],
#campaignVictoryActions.is-hidden {
  display: none !important;
}

/* Base Rules Modal Styling */
.rules-modal-paper {
  max-width: 640px;
  max-height: 92vh;
  box-sizing: border-box;
}

.rules-modal-title {
  font-size: 1.7rem;
  margin-bottom: 10px;
}

.rules-step-badge {
  display: none;
}

.rules-content-wrap {
  max-height: calc(90vh - 150px);
}

.rules-page {
  display: block;
}

.rules-page p {
  margin-bottom: 10px;
  line-height: 1.5;
}

.rules-cheer-line {
  font-weight: bold;
  color: #15803d;
}

.rules-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-rules-exit {
  background: #ffffff !important;
  border-color: #4b5563 !important;
  color: #1f2937 !important;
}

.btn-rules-exit:hover {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #ef4444 !important;
}

.rules-modal-paper .modal-close,
#btnCloseRulesX {
  position: absolute !important;
  top: 10px !important;
  right: 12px !important;
  z-index: 30 !important;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: #374151 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 50% !important;
  border: 1.5px solid #6b7280 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.rules-modal-paper .modal-close:hover,
#btnCloseRulesX:hover,
.rules-modal-paper .modal-close:active,
#btnCloseRulesX:active {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border-color: #ef4444 !important;
  transform: scale(1.08) !important;
}

/* Hit / Miss Comic Floating Banner - GPU accelerated, layout-isolated */
.floating-toast {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0) scale(0.6);
  font-family: var(--font-heading);
  font-size: 2.8rem;
  padding: 10px 26px;
  border-radius: 16px;
  border: 4px solid #111;
  box-shadow: 5px 6px 0px #000;
  z-index: 950 !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease, visibility 0.2s ease;
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.floating-toast.hit,
.floating-toast.miss,
.floating-toast.normal,
.floating-toast.active {
  pointer-events: auto;
  cursor: pointer;
  visibility: visible;
}

.floating-toast.hit {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #7f1d1d;
  box-shadow: 6px 8px 0px #7f1d1d;
  transform: translate3d(-50%, -50%, 0) scale(1) rotate(-3deg);
  opacity: 1;
}

.floating-toast.miss {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #374151;
  box-shadow: 5px 6px 0px #374151;
  transform: translate3d(-50%, -50%, 0) scale(1) rotate(2deg);
  opacity: 1;
}

.floating-toast.normal {
  background: #fefce8;
  color: #854d0e;
  border-color: #a16207;
  box-shadow: 5px 6px 0px #a16207;
  transform: translate3d(-50%, -50%, 0) scale(1) rotate(-1.5deg);
  opacity: 1;
}

.floating-toast.toast-long {
  font-size: 1.15rem;
  max-width: min(92vw, 660px);
  text-align: center;
  line-height: 1.35;
  padding: 12px 22px;
  transform: translate3d(-50%, -50%, 0) scale(1) rotate(-1deg);
}

.floating-toast.toast-with-sub {
  font-size: 2.3rem;
  padding: 10px 24px;
  line-height: 1.25;
  text-align: center;
}

.floating-toast .toast-main-text {
  font-size: inherit;
  line-height: inherit;
}

.floating-toast .toast-shot-count {
  font-size: 1.25rem;
  font-family: var(--font-sketch, var(--font-heading));
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: 0.5px;
  color: inherit;
  opacity: 0.95;
  white-space: nowrap;
}

/* ── Red Level Announcement Popups on Phone Devices (Scaled down to 50%) ── */
body.phone-portrait-layout .floating-toast.toast-level-announce,
body.phone-landscape-layout .floating-toast.toast-level-announce,
body.is-phone-device .floating-toast.toast-level-announce {
  --toast-level-scale: 0.5;
  transform: translate3d(-50%, -50%, 0) scale(var(--toast-level-scale, 0.5)) rotate(-2deg) !important;
  transform-origin: center center !important;
  white-space: nowrap !important;
  max-width: none !important;
}

@media (max-width: 680px) {
  .floating-toast.toast-level-announce {
    --toast-level-scale: 0.5;
    transform: translate3d(-50%, -50%, 0) scale(var(--toast-level-scale, 0.5)) rotate(-2deg) !important;
    transform-origin: center center !important;
    white-space: nowrap !important;
    max-width: none !important;
  }
}

@media (max-height: 520px) and (max-width: 950px) {
  .floating-toast.toast-level-announce {
    --toast-level-scale: 0.5;
    transform: translate3d(-50%, -50%, 0) scale(var(--toast-level-scale, 0.5)) rotate(-2deg) !important;
    transform-origin: center center !important;
    white-space: nowrap !important;
    max-width: none !important;
  }
}

/* ── Extra Shots / Paperclip Popups on Phone Devices (Scaled down to 40%) ── */
body.phone-portrait-layout .floating-toast.toast-paperclip-bonus,
body.phone-landscape-layout .floating-toast.toast-paperclip-bonus,
body.is-phone-device .floating-toast.toast-paperclip-bonus {
  --toast-paperclip-scale: 0.4;
  transform: translate3d(-50%, -50%, 0) scale(var(--toast-paperclip-scale, 0.4)) rotate(-1.5deg) !important;
  transform-origin: center center !important;
  font-size: 1.15rem !important;
  padding: 8px 16px !important;
  white-space: nowrap !important;
  max-width: none !important;
}

body.phone-portrait-layout .floating-toast.toast-paperclip-bonus .toast-main-text,
body.phone-landscape-layout .floating-toast.toast-paperclip-bonus .toast-main-text,
body.is-phone-device .floating-toast.toast-paperclip-bonus .toast-main-text {
  font-size: 1.15rem !important;
  white-space: nowrap !important;
}

body.phone-portrait-layout .floating-toast.toast-paperclip-bonus .toast-shot-count,
body.phone-landscape-layout .floating-toast.toast-paperclip-bonus .toast-shot-count,
body.is-phone-device .floating-toast.toast-paperclip-bonus .toast-shot-count {
  font-size: 0.92rem !important;
  white-space: nowrap !important;
}

@media (max-width: 680px) {
  .floating-toast.toast-paperclip-bonus {
    --toast-paperclip-scale: 0.4;
    transform: translate(-50%, -50%) scale(var(--toast-paperclip-scale, 0.4)) rotate(-1.5deg) !important;
    transform-origin: center center !important;
    font-size: 1.15rem !important;
    padding: 8px 16px !important;
    white-space: nowrap !important;
    max-width: none !important;
  }
  .floating-toast.toast-paperclip-bonus .toast-main-text {
    font-size: 1.15rem !important;
    white-space: nowrap !important;
  }
  .floating-toast.toast-paperclip-bonus .toast-shot-count {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
  }
}

@media (max-height: 520px) and (max-width: 950px) {
  .floating-toast.toast-paperclip-bonus {
    --toast-paperclip-scale: 0.4;
    transform: translate(-50%, -50%) scale(var(--toast-paperclip-scale, 0.4)) rotate(-1.5deg) !important;
    transform-origin: center center !important;
    font-size: 1.15rem !important;
    padding: 8px 16px !important;
    white-space: nowrap !important;
    max-width: none !important;
  }
  .floating-toast.toast-paperclip-bonus .toast-main-text {
    font-size: 1.15rem !important;
    white-space: nowrap !important;
  }
  .floating-toast.toast-paperclip-bonus .toast-shot-count {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
  }
}

/* ── Extra Shots / Paperclip Selection Modal ── */
#bonusShotsModal {
  z-index: 2000 !important;
}

.modal-paper.bonus-shots-modal-card {
  max-width: 420px;
  text-align: center;
  padding: 22px 26px;
  background: var(--paper-cream, #fdfbf7);
  border: 3px solid #1e293b;
  border-radius: 14px;
  box-shadow: 6px 8px 0px #1e293b, 0 15px 30px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.bonus-shots-modal-header {
  margin-bottom: 6px;
  padding: 0 24px;
}

.bonus-shots-title {
  font-family: var(--font-heading, 'Permanent Marker', cursive);
  font-size: 1.45rem;
  color: #1e293b;
  margin: 0 0 10px 0;
  border-bottom: 2px dashed #ca8a04;
  padding-bottom: 6px;
  line-height: 1.25;
}

.bonus-shots-modal-question {
  font-family: var(--font-heading, 'Permanent Marker', cursive);
  font-size: 1.18rem;
  line-height: 1.35;
  color: #1e293b;
  margin: 0 auto 16px auto;
  max-width: 95%;
  font-weight: 700;
  word-break: normal;
  overflow-wrap: break-word;
}

.bonus-shots-modal-question #bonusShotsModalCount {
  color: #b45309;
  font-weight: 800;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1.5px dashed #d97706;
  display: inline-block;
}

.bonus-shots-options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.bonus-shots-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.bonus-shots-choice-btn {
  font-family: var(--font-heading, 'Permanent Marker', cursive);
  font-size: 1.15rem;
  padding: 8px 18px;
  background: #fef3c7 !important;
  border: 2px solid #b45309 !important;
  color: #78350f !important;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 2px 3px 0px #78350f;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bonus-shots-choice-btn:hover {
  background: #fde68a !important;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 2px 4px 0px #78350f;
}

.bonus-shots-choice-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0px #78350f;
}

.bonus-shots-choice-btn.primary-choice {
  background: #fef08a !important;
  border-color: #92400e !important;
  font-weight: 800;
}

.bonus-shots-stepper-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.1);
  border: 2px dashed #d97706;
  border-radius: 12px;
  width: 100%;
  max-width: 320px;
  box-sizing: border-box;
}

.bonus-shots-stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.35rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  background: #fff !important;
  border: 2px solid #334155 !important;
  color: #1e293b !important;
  transition: all 0.1s ease;
}

.bonus-shots-stepper-btn:hover:not(:disabled) {
  background: #fef3c7 !important;
  border-color: #b45309 !important;
  transform: scale(1.08);
}

.bonus-shots-stepper-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bonus-shots-stepper-val {
  font-family: var(--font-heading, 'Permanent Marker', cursive);
  font-size: 1.5rem;
  font-weight: 800;
  min-width: 40px;
  text-align: center;
  color: #1e293b;
}

.bonus-shots-apply-btn {
  font-family: var(--font-heading, 'Permanent Marker', cursive);
  font-size: 1.1rem;
  padding: 6px 14px;
  background: #22c55e !important;
  border: 2px solid #15803d !important;
  color: #fff !important;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 2px 2px 0px #15803d;
  transition: all 0.15s ease;
}

.bonus-shots-apply-btn:hover {
  background: #16a34a !important;
  transform: translateY(-1px) scale(1.03);
}

/* Phone layout responsiveness */
body.phone-portrait-layout .modal-paper.bonus-shots-modal-card,
body.phone-landscape-layout .modal-paper.bonus-shots-modal-card,
body.is-phone-device .modal-paper.bonus-shots-modal-card {
  width: min(92vw, 360px) !important;
  max-width: min(92vw, 360px) !important;
  padding: 18px 14px !important;
  margin: auto !important;
  box-sizing: border-box !important;
}

body.phone-portrait-layout .bonus-shots-title,
body.phone-landscape-layout .bonus-shots-title,
body.is-phone-device .bonus-shots-title {
  font-size: 1.25rem !important;
}

body.phone-portrait-layout .bonus-shots-modal-question,
body.phone-landscape-layout .bonus-shots-modal-question,
body.is-phone-device .bonus-shots-modal-question {
  font-size: 1.02rem !important;
  line-height: 1.3 !important;
  margin-bottom: 12px !important;
  max-width: 96% !important;
}

body.phone-portrait-layout .bonus-shots-choice-btn,
body.phone-landscape-layout .bonus-shots-choice-btn,
body.is-phone-device .bonus-shots-choice-btn {
  font-size: 1.05rem !important;
  padding: 6px 14px !important;
}

body.phone-landscape-layout .bonus-shots-modal-card {
  max-height: 88vh;
  overflow-y: auto;
}

/* Setup Guidance Modal with "Got it!" Button */
#setupGuidanceModal {
  z-index: 1000 !important;
}

.modal-paper.setup-guidance-card {
  max-width: 520px;
  text-align: center;
  padding: 24px 28px;
}

.setup-guidance-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  color: #1e293b;
  margin-bottom: 14px;
}

.setup-guidance-content {
  padding: 16px 22px;
  background: rgba(255, 255, 255, 0.75);
  border: 1.5px dashed #ca8a04;
  border-radius: 10px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: center;
}

.setup-guidance-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  font-family: var(--font-doodle);
  font-size: 1.35rem;
  color: #1e293b;
}

.setup-guidance-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.3;
}

.setup-guidance-list li::before {
  content: "•";
  color: #d97706;
  font-size: 1.8rem;
  line-height: 0;
  flex-shrink: 0;
}

/* Victory Overlay */
.victory-card {
  text-align: center;
  padding: 10px;
}

#victoryModal .modal-paper.victory-card {
  max-width: min(94vw, 720px);
}

#campaignVictoryActions.campaign-actions-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap !important;
}

#campaignVictoryActions.campaign-actions-row .doodle-btn {
  font-size: 1.18rem;
  padding: 8px 16px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.campaign-actions-row .btn-text-line1,
.campaign-actions-row .btn-text-line2 {
  display: inline;
}

.victory-title {
  font-family: var(--font-heading);
  font-size: 2.6rem;
  color: #d97706;
  text-shadow: 2px 2px 0px #000;
  margin-bottom: 10px;
}

.victory-title.defeat-title {
  color: #dc2626;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.35);
}

.modal-paper.defeat-card {
  border-color: #b91c1c;
  box-shadow: 6px 8px 0px rgba(185, 28, 28, 0.4);
}

.victory-stats {
  background: #ffffff;
  border: 2px solid #444;
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0;
  font-size: 1.3rem;
  display: flex;
  justify-content: space-around;
}

/* Confetti particles - GPU hardware accelerated */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 95;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: contents;
}


.battle-badge {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  background: #fef08a;
  color: #713f12;
  border: 2px dashed #ca8a04;
  border-radius: 8px;
  padding: 4px 10px;
  font-weight: bold;
  white-space: nowrap;
}

/* ── Background Mode Toggle ─────────────────────────────── */
.mode-toggle {
  display: flex;
  gap: 0;
  border: 2px solid #333;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 2px 2px 0px #222;
}

.mode-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-doodle);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 5px 16px;
  border: none;
  background: #fdfbf7;
  color: #444;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.mode-btn-timer-icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
  transition: transform 0.15s ease;
}

.mode-toggle-btn:hover:not(:disabled) .mode-btn-timer-icon {
  transform: scale(1.12) rotate(-4deg);
}

.mode-toggle-btn.active .mode-btn-timer-icon {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.22));
}

.mode-toggle-btn + .mode-toggle-btn {
  border-left: 2px solid #333;
}

.mode-toggle-btn:hover:not(:disabled) {
  background: #f0f0f0;
}

/* Vibrant selection highlight */
.mode-toggle-btn.active {
  background: #fef08a !important; /* Bright notebook highlighter yellow */
  color: #78350f !important;
  font-weight: 800;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.18), inset 0 -2px 0 #b45309;
}

.mode-toggle-btn:disabled:not(.active) {
  opacity: 0.35;
  cursor: not-allowed;
  background: #e2e8f0;
  text-decoration: line-through;
}

.btn-painter-draw {
  padding: 3px 10px;
  cursor: pointer;
  line-height: 1;
}

.painter-btn-svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  transition: transform 0.15s ease;
}

.btn-painter-draw:hover:not(:disabled) .painter-btn-svg {
  transform: scale(1.08);
}

.btn-painter-draw.active .painter-btn-svg {
  transform: scale(1.04);
}

#themeRow #btnModeStamp,
#themeRow .prebuilt-title-label {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 3vw, 1.76rem) !important;
  font-weight: 800;
  color: #1f2937;
  letter-spacing: 0.3px;
  line-height: 1.2;
  margin-right: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  cursor: default;
}

.mode-lock-badge {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #d97706;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 8px;
  letter-spacing: 0.5px;
  animation: pulse 1s infinite alternate;
}

/* Draw-mode hint text */
.draw-hint {
  font-family: var(--font-doodle);
  font-size: 0.82rem;
  color: #777;
  font-style: italic;
  margin-left: 8px;
}

/* ── Drawing Mode Circular Stopwatch Clock Overlay ──────── */
.draw-overlay {
  position: absolute;
  top: 26px;
  width: auto;
  height: auto;
  pointer-events: none;
  z-index: 35;
  transition: opacity 0.4s ease;
}

.draw-overlay.fade-out {
  opacity: 0;
}

.draw-overlay.side-left {
  left: 26px;
  right: auto;
}

.draw-overlay.side-right {
  right: 26px;
  left: auto;
}

.stopwatch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* Classic stopwatch crown/knob */
.stopwatch-crown {
  width: 14px;
  height: 6px;
  background: #444;
  border: 1.5px solid #222;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  margin-bottom: -1px;
  z-index: 2;
}

/* Circular stopwatch clock case */
.draw-timer-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  background: #ffffff;
  border: 3px solid #292929;
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.draw-timer-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* start ring from top */
}

.draw-timer-bg {
  fill: none;
  stroke: rgba(0,0,0,0.06);
  stroke-width: 8;
}

.draw-timer-ticks {
  fill: none;
  stroke: rgba(0,0,0,0.18);
  stroke-width: 3;
  stroke-dasharray: 2 18.94;
}

.draw-timer-ring {
  fill: none;
  stroke: #2563eb;
  stroke-width: 8;
  stroke-linecap: round;
  /* circumference of r=40 is ~251.3 */
  stroke-dasharray: 251.3;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
}

.draw-timer-ring.warning { stroke: #f59e0b; }
.draw-timer-ring.danger  { stroke: #ef4444; }

/* Clock center text */
.draw-timer-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  line-height: 1;
}

.draw-timer-num {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  color: #1e293b;
  line-height: 1;
}

.draw-timer-unit {
  font-family: var(--font-heading);
  font-size: 0.62rem;
  color: #64748b;
  letter-spacing: 1px;
  margin-top: 1px;
}

/* Red flash animation when timer reaches zero */
@keyframes stopwatchFlashRed {
  0% {
    background-color: #ef4444;
    border-color: #991b1b;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.95), 0 4px 12px rgba(0,0,0,0.4);
    transform: scale(1.1);
  }
  25% {
    background-color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    transform: scale(1.0);
  }
  50% {
    background-color: #ef4444;
    border-color: #991b1b;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.95), 0 4px 12px rgba(0,0,0,0.4);
    transform: scale(1.1);
  }
  75% {
    background-color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
    transform: scale(1.0);
  }
  100% {
    background-color: #fee2e2;
    border-color: #b91c1c;
    box-shadow: 0 4px 10px rgba(185, 28, 28, 0.3);
    transform: scale(1.0);
  }
}

.draw-timer-wrap.flash-red {
  animation: stopwatchFlashRed 2s ease-in-out forwards !important;
}

.draw-timer-wrap.flash-red .draw-timer-num,
.draw-timer-wrap.expired .draw-timer-num {
  color: #b91c1c !important;
}

.draw-timer-wrap.expired {
  background: #fee2e2 !important;
  border-color: #b91c1c !important;
}

/* Draw overlay status label */
.draw-overlay-label {
  font-family: var(--font-doodle);
  font-size: 0.88rem;
  font-weight: 700;
  color: #333;
  background: rgba(255,255,255,0.92);
  border: 1.5px solid #444;
  border-radius: 8px;
  padding: 3px 10px;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.15);
  white-space: nowrap;
  margin-top: 6px;
  pointer-events: none;
}

@media (max-width: 1300px) {
  .side-title {
    display: none;
  }
}

/* ── Online Multiplayer Lobby Modal ────────────────────── */
.online-lobby-card {
  max-width: 660px;
  text-align: center;
  position: relative;
  padding: 28px 24px 24px 24px;
}

.online-lobby-card .victory-title {
  padding-left: 60px;
  padding-right: 60px;
  box-sizing: border-box;
}

.online-lobby-card #btnOnlineLobbyHome,
#btnOnlineLobbyHome.btn-lobby-corner-home {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.95rem;
  line-height: 1;
  min-width: 0 !important;
  min-height: 0 !important;
}

.online-lobby-card #btnOnlineLobbyHome svg,
#btnOnlineLobbyHome.btn-lobby-corner-home svg {
  width: 18px;
  height: 18px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 10;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  color: #4b5563;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

/* ── Lobby Initial Two-Button Choices ────────────────────── */
.lobby-initial-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 240px));
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  margin: 12px auto 18px auto;
  box-sizing: border-box;
}

.lobby-choice-btn {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  padding: 12px 14px;
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  justify-content: center;
  border-radius: 12px;
  cursor: pointer;
  background: #ffffff;
  border: 2.5px solid #2b2b2b;
  color: #1e3a8a;
  box-shadow: 3px 3px 0px #2b2b2b;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.lobby-choice-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px #2b2b2b;
}

.lobby-choice-btn.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 3px 3px 0px #1e3a8a;
}

.lobby-choice-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1e40af;
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px #1e3a8a;
}

.lobby-btn-icon {
  font-size: 1.35rem;
}

.lobby-back-btn {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  padding: 6px 14px;
  background: #f1f5f9;
  border: 2px solid #64748b;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 2px 2px 0px #64748b;
  transition: all 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.lobby-back-btn:hover {
  background: #e2e8f0;
  border-color: #334155;
  color: #1e293b;
  transform: translateY(-1px);
}

/* ── Online Reconnection Floating Banner ────────────────────────── */
.online-reconnecting-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  pointer-events: auto;
  width: auto;
  max-width: min(94vw, 580px);
  animation: reconnectSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes reconnectSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.online-reconnecting-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fffdf5;
  border: 2.5px solid #d97706;
  border-radius: 28px;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2), 3px 4px 0px rgba(0, 0, 0, 0.22);
  flex-wrap: wrap;
  justify-content: center;
}

.reconnecting-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #fde68a;
  border-top-color: #d97706;
  border-radius: 50%;
  animation: reconnectSpinnerAnim 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes reconnectSpinnerAnim {
  to {
    transform: rotate(360deg);
  }
}

.reconnecting-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-doodle);
}

.reconnecting-title {
  font-size: 0.95rem;
  color: #92400e;
  line-height: 1.2;
}

.reconnecting-subtitle {
  font-size: 0.82rem;
  color: #b45309;
  font-weight: 600;
}

.reconnecting-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ── In-Room Online Room Invite / Waiting Bar ────────────────────── */
.in-room-invite-card {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  pointer-events: auto;
  width: auto;
  max-width: min(92vw, 660px);
  animation: inRoomSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes inRoomSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.in-room-invite-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 7px 14px 7px 16px;
  background: #fffdfa;
  border: 2.5px solid #2b2b2b;
  border-radius: 30px;
  box-shadow: 3px 4px 0px rgba(0, 0, 0, 0.22);
  flex-wrap: wrap;
}

.in-room-invite-code-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-doodle);
  font-size: 0.95rem;
}

.in-room-invite-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #64748b;
}

.in-room-code-badge {
  font-family: 'Courier New', Courier, monospace, var(--font-heading);
  font-size: 1.15rem;
  font-weight: 900;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1.5px dashed #2563eb;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 1.5px;
}

.in-room-invite-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.in-room-btn {
  font-size: 0.88rem !important;
  padding: 4px 10px !important;
  min-height: 28px !important;
  line-height: 1 !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
}

.in-room-invite-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-doodle);
  font-size: 0.88rem;
  color: #374151;
  font-weight: 600;
}

.in-room-cancel-btn {
  background: #fee2e2;
  border: 1.5px solid #ef4444;
  color: #dc2626;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.12s ease;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
}

.in-room-cancel-btn:hover {
  background: #fecaca;
  transform: scale(1.1);
}

/* Columns container holding the separate, equally available sections */
.lobby-columns-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-bottom: 14px;
  align-items: stretch;
}

.lobby-section-card {
  background: #fffdf9;
  border: 2px solid #2b2b2b;
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  gap: 12px;
  width: 100%;
}

.lobby-action-heading-btn {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  padding: 7px 18px;
  width: 100%;
  max-width: 220px;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  background: #ffffff;
  border: 2px solid #2b2b2b;
  color: #1e3a8a;
  box-shadow: 2px 2px 0px #2b2b2b;
  transition: all 0.15s ease;
}

.lobby-action-heading-btn:hover {
  background: #eff6ff;
  border-color: #2563eb;
  transform: translateY(-1px);
}

.lobby-action-heading-btn.primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 2px 2px 0px #1e3a8a;
}

.lobby-action-heading-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1e40af;
}

.lobby-section-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 10px;
  flex: 1;
  justify-content: space-between;
}

.lobby-tab-btn {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  padding: 8px 18px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #f1ede4;
  color: #555;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lobby-view-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.room-code-display-box {
  width: 100%;
  background: #ffffff;
  border: 2px dashed #2563eb;
  border-radius: 12px;
  padding: 10px 8px;
  box-shadow: inset 0 2px 6px rgba(37, 99, 235, 0.08);
  box-sizing: border-box;
}

.room-code-label {
  display: block;
  font-family: var(--font-doodle);
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 1.2px;
  margin-bottom: 4px;
}

.room-code-text {
  font-family: 'Courier New', Courier, monospace, var(--font-heading);
  font-size: 1.75rem;
  font-weight: 900;
  color: #1d4ed8;
  letter-spacing: 2px;
  user-select: all;
  text-shadow: 1px 1px 0px rgba(0,0,0,0.1);
  line-height: 1.1;
}

.room-actions-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.room-actions-row button {
  padding: 6px 12px;
  font-size: 0.92rem;
}

.lobby-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-doodle);
  font-size: 0.88rem;
  color: #4b5563;
  margin-top: 2px;
  text-align: center;
  justify-content: center;
}

.status-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 1.6s infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.join-input-group {
  width: 100%;
  text-align: center;
}

.room-code-input {
  width: 100%;
  max-width: 220px;
  font-family: 'Courier New', Courier, monospace, var(--font-heading);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  padding: 8px 10px;
  border: 2px solid #333;
  border-radius: 10px;
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 2px 2px 0px #333;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.btn-connect-action {
  width: 100%;
  max-width: 220px;
  font-size: 1.05rem !important;
  padding: 8px 14px !important;
  margin-top: 6px;
  box-sizing: border-box;
}

.room-code-input:focus {
  border-color: #2563eb;
}

.lobby-error-msg {
  color: #dc2626;
  background: #fee2e2;
  border: 1.5px solid #ef4444;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-doodle);
  font-size: 0.9rem;
  font-weight: 600;
  width: 90%;
  margin-top: 8px;
}

/* ── Play Again Online Prompt Modals ────────────────────── */
.play-again-card {
  max-width: 480px;
  text-align: center;
  padding: 28px 24px 24px 24px;
}

.play-again-prompt-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  color: #1e3a8a;
  line-height: 1.35;
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.play-again-declined-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  color: #b91c1c;
  line-height: 1.35;
  border-bottom: 2px dashed #fca5a5;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.play-again-btn-group {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* ── Online Multiplayer Shot Time Limit Modal ────────────────────── */
.time-limit-card {
  max-width: 540px;
  width: 94%;
  text-align: center;
  padding: 24px 20px 20px 20px;
  position: relative;
  background: var(--paper-cream, #fbf9f4);
  border: 3px solid #292929;
  border-radius: 255px 20px 225px 20px/20px 225px 20px 255px;
  box-shadow: 6px 8px 0px rgba(0, 0, 0, 0.22), inset 0 0 40px rgba(254, 243, 199, 0.35);
}

.time-limit-tape-strip {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 86px;
  height: 20px;
  background: rgba(253, 230, 138, 0.8);
  border: 1px dashed rgba(180, 83, 9, 0.45);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.time-limit-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 2.5px dashed #4b5563;
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.time-limit-stickman-header-svg {
  filter: drop-shadow(1px 2px 0px rgba(0, 0, 0, 0.15));
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.time-limit-card:hover .time-limit-stickman-header-svg {
  transform: rotate(-4deg) scale(1.06);
}

.time-limit-header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.time-limit-title {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  color: #1e3a8a;
  margin: 0;
  line-height: 1.1;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
}

.time-limit-subtitle {
  font-family: var(--font-doodle), 'Patrick Hand', cursive;
  font-size: 0.95rem;
  color: #4b5563;
  font-weight: 700;
  margin-top: 2px;
}

.time-limit-prompt {
  font-family: var(--font-doodle), 'Patrick Hand', cursive;
  font-size: 1.15rem;
  color: #1f2937;
  font-weight: 700;
  margin: 0 0 14px 0;
  line-height: 1.3;
}

.time-limit-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

@media (max-width: 580px), (max-width: 680px) and (orientation: portrait) {
  .time-limit-options-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .time-limit-card {
    padding: 14px 8px 12px 8px !important;
    width: 88vw !important;
    max-width: 360px !important;
    margin: 0 auto !important;
  }
  .time-limit-title {
    font-size: 1.35rem !important;
  }
  .time-limit-subtitle {
    font-size: 0.82rem !important;
  }
  .time-limit-prompt {
    font-size: 1rem !important;
    margin-bottom: 8px !important;
  }
  .time-limit-stickman-header-svg {
    width: 38px !important;
    height: 38px !important;
  }
  .btn-time-limit {
    padding: 5px 6px !important;
    gap: 5px !important;
    min-height: 52px !important;
  }
  .time-limit-stickman-wrap,
  .time-btn-stickman-svg {
    width: 26px !important;
    height: 26px !important;
  }
  .btn-time-limit .time-limit-num {
    font-size: 1.15rem !important;
    white-space: nowrap !important;
  }
  .btn-time-limit .time-limit-label {
    font-size: 0.72rem !important;
  }
  .btn-time-limit .time-limit-vibe {
    font-size: 0.62rem !important;
  }
}

body.phone-portrait-layout .time-limit-options-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 6px !important;
}
body.phone-portrait-layout .time-limit-card {
  padding: 14px 8px 12px 8px !important;
  width: 88vw !important;
  max-width: 360px !important;
  margin: 0 auto !important;
}
body.phone-portrait-layout .btn-time-limit {
  padding: 5px 6px !important;
  gap: 5px !important;
  min-height: 52px !important;
}
body.phone-portrait-layout .time-limit-stickman-wrap,
body.phone-portrait-layout .time-btn-stickman-svg {
  width: 26px !important;
  height: 26px !important;
}
body.phone-portrait-layout .btn-time-limit .time-limit-num {
  font-size: 1.15rem !important;
  white-space: nowrap !important;
}
body.phone-portrait-layout .btn-time-limit .time-limit-label {
  font-size: 0.72rem !important;
}
body.phone-portrait-layout .btn-time-limit .time-limit-vibe {
  font-size: 0.62rem !important;
}

.btn-time-limit {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 2.5px solid #292929;
  border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
  background: #ffffff;
  color: #292929;
  cursor: pointer;
  box-shadow: 3px 4px 0px #292929;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
  min-height: 68px;
  position: relative;
  text-align: left;
}

.btn-time-limit:hover:not(:disabled) {
  transform: translate(-2px, -3px) rotate(-1deg);
  box-shadow: 5px 6px 0px #1e3a8a;
  border-color: #1e3a8a;
}

.btn-time-limit:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #292929;
}

/* Individual playful paper tints */
.btn-time-limit.btn-limit-0 {
  background: #ffffff;
}
.btn-time-limit.btn-limit-10 {
  background: #f0fdf4;
}
.btn-time-limit.btn-limit-7 {
  background: #fefce8;
}
.btn-time-limit.btn-limit-5 {
  background: #eff6ff;
}
.btn-time-limit.btn-limit-3 {
  background: #fff7ed;
}
.btn-time-limit.btn-limit-2 {
  background: #fef2f2;
}

.time-limit-stickman-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.time-btn-stickman-svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
  transition: transform 0.15s ease;
}

.btn-time-limit:hover .time-btn-stickman-svg {
  transform: scale(1.14);
}

.time-limit-badge-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
}

.btn-time-limit .time-limit-num {
  font-size: 1.4rem;
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1;
  color: #1e3a8a;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.btn-limit-2 .time-limit-num {
  color: #b91c1c;
}
.btn-limit-3 .time-limit-num {
  color: #c2410c;
}
.btn-limit-5 .time-limit-num {
  color: #1d4ed8;
}
.btn-limit-7 .time-limit-num {
  color: #854d0e;
}
.btn-limit-10 .time-limit-num {
  color: #15803d;
}
.btn-limit-0 .time-limit-num {
  color: #334155;
  font-size: 1.65rem;
}

.btn-time-limit .time-limit-label {
  font-size: 0.85rem;
  font-family: var(--font-doodle), 'Patrick Hand', cursive;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.1;
  margin-top: 1px;
}

.btn-time-limit .time-limit-vibe {
  font-size: 0.72rem;
  font-family: var(--font-doodle), 'Patrick Hand', cursive;
  color: #6b7280;
  line-height: 1.1;
  margin-top: 1px;
  font-style: italic;
}

/* Waiting Stickman Animation */
.time-limit-waiting-wrap {
  background: rgba(254, 243, 199, 0.6);
  border: 1.5px dashed #d97706;
  border-radius: 255px 12px 225px 12px/12px 225px 12px 255px;
  padding: 8px 16px;
  font-family: var(--font-doodle), 'Patrick Hand', cursive;
  font-weight: 700;
  color: #78350f;
}

@keyframes stickmanFootTap {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}

.tapping-foot-line {
  transform-origin: 20px 22px;
  animation: stickmanFootTap 0.8s ease-in-out infinite;
}

/* ── Multiplayer Rotating Player Round Options Modal ──────────────── */
.round-options-card {
  max-width: 480px;
  width: 92%;
  text-align: center;
  padding: 24px 22px 20px 22px;
}

.round-options-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.round-options-icon {
  font-size: 2rem;
  line-height: 1;
}

.round-options-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  color: #1e3a8a;
  margin: 0;
}

.round-options-prompt {
  font-family: var(--font-doodle);
  font-size: 1.15rem;
  color: #374151;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.35;
}

.round-options-prompt.is-waiting-prompt {
  font-family: var(--font-heading), 'Patrick Hand', cursive, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #92400e;
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 45%, #fde68a 100%);
  border: 2.5px dashed #d97706;
  border-radius: 12px;
  padding: 10px 18px;
  margin: 4px 0 16px 0;
  line-height: 1.3;
  letter-spacing: 0.5px;
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
  word-break: break-word;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: prompt-attention-pulse 2.8s ease-in-out infinite;
}

@keyframes prompt-attention-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  }
}

.round-options-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
  text-align: left;
}

.round-option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.round-option-label {
  font-family: var(--font-doodle);
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
}

.round-options-fields .round-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 1.05rem;
  font-family: var(--font-doodle);
  border: 2px solid #334155;
  border-radius: 10px;
  background-color: #ffffff;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
}

.round-options-fields .round-select:hover:not(:disabled) {
  border-color: #2563eb;
  background-color: #f8fafc;
}

.round-options-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn-round-options-home {
  font-family: var(--font-heading);
  background: #ffffff;
  color: #1e3a8a;
  border: 2.5px solid #1e3a8a;
  transition: all 0.15s ease;
}

.btn-round-options-home:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(30, 58, 138, 0.15);
}

.btn-round-options-leave {
  font-family: var(--font-heading);
  background: #fff1f2;
  color: #be123c;
  border: 2.5px solid #e11d48;
  transition: all 0.15s ease;
}

.btn-round-options-leave:hover:not(:disabled) {
  background: #ffe4e6;
  border-color: #be123c;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(190, 18, 60, 0.2);
}

@media (max-width: 600px) {
  .round-options-card {
    padding: 16px 12px;
    width: 92%;
    max-width: 92%;
    box-sizing: border-box;
    margin: 0 auto;
  }

  .round-options-title {
    font-size: 1.4rem;
  }

  .round-options-prompt {
    font-size: 1.05rem;
  }

  .round-options-prompt.is-waiting-prompt {
    font-size: 1.05rem;
    padding: 7px 10px;
    margin: 2px 0 12px 0;
    line-height: 1.25;
  }

  .round-options-fields .round-select {
    font-size: 0.95rem;
    padding: 8px 10px;
  }
}

/* ── Multiplayer Invited Participant Modal ────────────── */
.invited-participant-card {
  max-width: 420px;
  width: 90%;
  text-align: center;
  position: relative;
  padding: 24px 22px;
  background: var(--paper-cream);
  border: 3px solid #222;
  border-radius: 12px;
  box-shadow: 6px 8px 0px #111;
  transform: rotate(-0.5deg);
}

.invited-participant-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.invited-participant-icon {
  font-size: 1.8rem;
}

.invited-participant-title {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  margin: 0;
  border-bottom: none;
  padding-bottom: 0;
  color: #111;
}

.invited-participant-subtitle {
  font-family: var(--font-doodle, sans-serif);
  font-size: 1.15rem;
  color: #4b5563;
  margin: 4px 0 14px 0;
  line-height: 1.35;
}

.invited-participant-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  letter-spacing: 1px;
  background: #eff6ff;
  color: #1e40af;
  border: 2px dashed #3b82f6;
  border-radius: 8px;
  padding: 4px 14px;
  margin-bottom: 14px;
}

.invited-name-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.invited-name-group label {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #374151;
}

.invited-name-group input {
  width: 100%;
  max-width: 280px;
  text-align: center;
  font-size: 1.25rem;
  padding: 8px 12px;
  box-sizing: border-box;
}

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

@media (max-width: 600px) {
  .invited-participant-card {
    padding: 18px 14px;
    max-width: 95%;
  }
  .invited-participant-title {
    font-size: 1.4rem;
  }
  .invited-participant-subtitle {
    font-size: 1.05rem;
  }
  .invited-name-group input {
    font-size: 1.15rem;
  }
}

/* ── Still There Inactivity Modal ────────────────────── */
.still-there-card {
  max-width: 440px;
  width: 90%;
  text-align: center;
  padding: 26px 24px 22px 24px;
}

.still-there-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.still-there-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.still-there-title {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  color: #1e3a8a;
  margin: 0;
}

.still-there-prompt {
  font-family: var(--font-doodle);
  font-size: 1.25rem;
  color: #374151;
  font-weight: 700;
  margin: 0 0 20px 0;
  line-height: 1.4;
}

.still-there-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.btn-still-there-yes {
  font-size: 1.35rem !important;
  padding: 10px 34px !important;
  background: #22c55e !important;
  color: #ffffff !important;
  border: 2.5px solid #14532d !important;
  box-shadow: 2px 3px 0 #14532d !important;
  font-weight: 800 !important;
  cursor: pointer;
}

.btn-still-there-yes:hover:not(:disabled) {
  background: #16a34a !important;
  transform: translateY(-2px);
}

.btn-still-there-yes:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-still-there-leave {
  font-size: 1.05rem !important;
  padding: 8px 18px !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 2px dashed #94a3b8 !important;
  cursor: pointer;
}

.btn-still-there-leave:hover {
  background: #e2e8f0 !important;
  color: #334155 !important;
}

@media (max-width: 600px) {
  .still-there-card {
    padding: 20px 16px;
    max-width: 95%;
  }

  .still-there-title {
    font-size: 1.55rem;
  }

  .still-there-prompt {
    font-size: 1.1rem;
  }

  .btn-still-there-yes {
    font-size: 1.15rem !important;
    padding: 8px 24px !important;
  }
}

/* ── Detonator Shot Clock: Yellow Status Box completely removed in favor of the timer ── */
.turn-banner.has-detonator,
.turn-banner.has-detonator.highlight,
.turn-banner.has-detonator.detonator-alert {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  animation: none !important;
  min-width: 0 !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.turn-banner-group.has-detonator,
.turn-banner-group:has(.has-detonator) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.turn-banner.has-detonator .turn-banner-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.turn-banner.has-detonator .turn-banner-line1 {
  font-size: clamp(0.7rem, 1.8vw, 0.78rem);
  font-weight: 700;
  color: #1f2937;
  line-height: 1.15;
  margin-bottom: 2px;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.turn-banner.has-detonator .turn-banner-line1::after {
  content: '' !important;
}

.turn-banner.has-detonator .detonator-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  vertical-align: middle;
  font-weight: 800;
  margin: 0;
}

.turn-banner .detonator-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #141416;
  color: #ef4444;
  border: 2.5px solid #b91c1c;
  border-radius: 10px;
  padding: 3px 12px;
  font-family: 'Courier New', Courier, monospace, sans-serif;
  font-size: 1.75rem;
  letter-spacing: 1px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.85), 0 3px 6px rgba(0, 0, 0, 0.25);
  line-height: 1.15;
  box-sizing: border-box;
}

.turn-banner .detonator-icon {
  font-size: 1.55rem;
  display: inline-block;
  animation: fuseSparkle 0.3s infinite alternate;
}

.turn-banner .detonator-digits {
  font-weight: 900;
  font-size: 1.95rem;
  color: #f87171;
  min-width: 72px;
  text-align: right;
  display: inline-block;
  letter-spacing: 1.5px;
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.turn-banner .detonator-instruction {
  font-size: 1.02rem;
  font-weight: 700;
  vertical-align: middle;
}

.turn-banner .detonator-badge.detonator-warning {
  background: #450a0a !important;
  border-color: #ef4444 !important;
  animation: detonatorPulse 0.35s infinite alternate !important;
}

.turn-banner .detonator-badge.detonator-warning .detonator-digits {
  color: #fca5a5 !important;
  text-shadow: 0 0 8px #ef4444;
}

@media (max-width: 600px) {
  .turn-banner .detonator-badge {
    font-size: 1.35rem !important;
    gap: 6px !important;
    padding: 2px 8px !important;
    border-width: 2px !important;
  }
  .turn-banner .detonator-icon {
    font-size: 1.2rem !important;
  }
  .turn-banner .detonator-digits {
    font-size: 1.45rem !important;
    min-width: 56px !important;
  }
  .turn-banner .detonator-instruction {
    font-size: 0.84rem !important;
  }
}

@keyframes fuseSparkle {
  0% { transform: scale(1) rotate(-3deg); filter: drop-shadow(0 0 2px #f59e0b); }
  100% { transform: scale(1.12) rotate(3deg); filter: drop-shadow(0 0 6px #ef4444); }
}

@keyframes detonatorPulse {
  0% { transform: scale(1); box-shadow: inset 0 0 4px #dc2626, 0 0 6px rgba(220, 38, 38, 0.5); }
  100% { transform: scale(1.06); box-shadow: inset 0 0 8px #ef4444, 0 0 14px rgba(239, 68, 68, 0.9); }
}

@keyframes detonatorBannerPulse {
  0% { border-color: #dc2626; background: #fee2e2; }
  100% { border-color: #991b1b; background: #fecaca; }
}

/* ── Mobile Aiming Loupe Overlay (Magnifying Circle with Crosshairs) ── */
.aim-loupe {
  --loupe-size: 110px;
  position: absolute;
  top: 0;
  left: 0;
  width: var(--loupe-size);
  height: var(--loupe-size);
  z-index: 80;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transform: translate3d(0, 0, 0);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: none !important;
  filter: none !important;
}

.aim-loupe-circle {
  position: relative;
  width: var(--loupe-size);
  height: var(--loupe-size);
  border-radius: 50%;
  border: 3px solid #1e293b;
  box-sizing: border-box;
  box-shadow: none !important;
  background: transparent !important;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  filter: none !important;
}

.aim-loupe.dragging .aim-loupe-circle {
  cursor: grabbing;
  border-color: #0284c7;
  box-shadow: none !important;
  transform: none !important;
}

.aim-loupe-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: none !important;
  filter: none !important;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Precise Hairline Crosshairs */
.aim-crosshair-h {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: #0f172a;
  transform: translateY(-50%);
  pointer-events: none;
  box-shadow: none !important;
}

.aim-crosshair-v {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1.5px;
  height: 100%;
  background: #0f172a;
  transform: translateX(-50%);
  pointer-events: none;
  box-shadow: none !important;
}

/* Center Targeting Pip */
.aim-crosshair-pip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border: 1.5px solid #ef4444;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-sizing: border-box;
  background: rgba(239, 68, 68, 0.15);
  box-shadow: none !important;
}

.aim-crosshair-pip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.5px;
  height: 2.5px;
  background: #ef4444;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Glass Reflection & Curvature Vignette (hidden to keep lines crisp without shadow artifacts) */
.aim-glass-reflection {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  display: none !important;
  background: none !important;
}

/* Aim Handle (Fingerprint thumb grip) - Shape of a fingerprint, 20% smaller than fire button, permanently anchored to bottom */
.aim-loupe-handle {
  position: absolute;
  top: 100% !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translateX(-50%);
  margin-top: 5px;
  margin-bottom: 0;
  width: calc(var(--loupe-size, 110px) * 0.34) !important;
  height: calc(var(--loupe-size, 110px) * 0.40) !important;
  min-width: calc(var(--loupe-size, 110px) * 0.34) !important;
  min-height: calc(var(--loupe-size, 110px) * 0.40) !important;
  aspect-ratio: 37 / 44;
  border-radius: 50% 50% 46% 46% / 55% 55% 45% 45% !important;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
  color: #38bdf8;
  border: 2px solid #38bdf8 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: grab;
  touch-action: none;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 85;
  padding: 0 !important;
}

/* Expanded touch target for effortless thumb dragging on mobile */
.aim-loupe-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 48px;
  min-height: 48px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border-radius: 50%;
}

.aim-fingerprint-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 82%;
  height: 86%;
  pointer-events: none;
  opacity: 0.9;
}

.aim-handle-label {
  position: relative;
  z-index: 2;
  font-family: inherit;
  font-size: 0.54rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.8px;
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 5px rgba(15, 23, 42, 0.9);
  margin-top: 15px;
  pointer-events: none;
  text-transform: uppercase;
  line-height: 1;
}

.aim-handle-bar {
  display: none !important;
}

.aim-loupe.dragging .aim-loupe-handle {
  cursor: grabbing;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-color: #7dd3fc !important;
  box-shadow: none !important;
  transform: translateX(-50%) scale(1.05) !important;
}

/* Fire Button attached to Loupe - A circle doubled in size above the magnifier, permanently anchored to top */
.aim-fire-btn {
  position: absolute;
  bottom: var(--aim-fire-bottom, 100%) !important;
  top: var(--aim-fire-top, auto) !important;
  left: var(--aim-fire-left, 50%) !important;
  transform: var(--aim-fire-transform, translateX(-50%));
  margin-bottom: var(--aim-fire-margin-bottom, 5px);
  margin-top: var(--aim-fire-margin-top, 0);
  width: calc(var(--loupe-size, 110px) * 0.5) !important;
  height: calc(var(--loupe-size, 110px) * 0.5) !important;
  min-width: calc(var(--loupe-size, 110px) * 0.5) !important;
  min-height: calc(var(--loupe-size, 110px) * 0.5) !important;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  box-sizing: border-box;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 2.5px solid #1e293b !important;
  box-shadow: none !important;
  opacity: 0.9 !important;
  z-index: 85;
  cursor: pointer;
  touch-action: manipulation;
  transition: none !important;
  animation: aimFirePulse 1.8s infinite ease-in-out;
}

.aim-fire-btn:hover {
  opacity: 0.95 !important;
}

/* Expanded touch target for finger accessibility on mobile */
.aim-fire-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 50px;
  min-height: 50px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border-radius: 50%;
}

.aim-fire-btn .aim-fire-text {
  display: none !important;
}

.aim-fire-btn .aim-fire-icon {
  font-size: 24px !important;
  line-height: 1 !important;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes aimFirePulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.08);
  }
}

.aim-fire-btn:active {
  transform: translateX(-50%) scale(0.92) !important;
  opacity: 0.75 !important;
}

/* Mobile toolbar fire action button */
.mobile-fire-action-btn {
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: bold;
  padding: 6px 14px !important;
  font-size: 0.92rem !important;
  border: 2px solid #111 !important;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
  animation: aimFirePulse 1.8s infinite ease-in-out;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT ENGINE (Tablets, Mobile Portrait & Landscape)
   ══════════════════════════════════════════════════════════ */

/* Large Tablets / Laptops below 1320px: Hide outer decorative side titles */
@media (max-width: 1320px) {
  .side-title {
    display: none !important;
  }
}

/* Medium Tablets & Narrow Desktops (under 960px) */
@media (max-width: 960px) {
  .game-header {
    justify-content: center;
    padding: 2px 4px;
    gap: 8px;
  }
  .top-controls {
    gap: 6px;
  }
  .doodle-btn {
    font-size: 0.95rem;
    padding: 4px 10px;
  }
  .scoreboard-bar {
    gap: 8px;
  }
  .turn-banner-group {
    min-width: 220px;
  }
  .turn-banner {
    min-width: 200px;
    font-size: 0.88rem;
    padding: 3px 8px;
  }
  .player-card {
    padding: 4px 8px;
  }
  .stick-dot {
    width: 12px;
    height: 12px;
  }
  .player-avatar {
    width: 32px;
    height: 32px;
    font-size: 1.35rem;
  }
  .player-name {
    font-size: 1.05rem;
  }
  .pose-header-row {
    gap: 8px;
  }
}

/* Mobile Devices & Small Tablets (under 680px) */
@media (max-width: 680px) {
  body {
    padding: 4px 6px;
  }
  .game-header {
    justify-content: center;
    margin-bottom: 4px;
    padding: 1px 2px;
    gap: 4px;
  }
  .header-label {
    display: none;
  }
  .top-controls {
    gap: 4px 6px;
    width: 100%;
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    box-sizing: border-box;
  }
  .top-controls select {
    font-size: 0.8rem;
    padding: 4px 6px;
    min-height: 36px;
    max-width: calc(50% - 4px);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    flex: 1 1 45%;
    box-sizing: border-box;
  }
  .top-controls .doodle-btn {
    font-size: 0.78rem;
    padding: 4px 6px;
    min-height: 34px;
    flex: 1 1 auto;
    max-width: calc(50% - 4px);
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
  }
  body.mode-campaign .top-controls .sound-toggle-btn:not(.btn-sound-model),
  body.mode-campaign #btnRules:not(.btn-rules-model),
  body.mode-campaign #btnHome:not(.btn-home-model),
  body.mode-campaign #btnHeaderLeaveGame:not(.btn-leave-game-model) {
    flex: 1 1 calc(33.333% - 4px);
    max-width: calc(33.333% - 4px);
    padding: 4px 4px;
  }
  body.mode-campaign #btnCampaignMap:not(.btn-campaign-map-model),
  body.mode-campaign .top-controls .magnifier-toggle-btn:not(.btn-spyglass-model),
  body.mode-campaign #btnUseBonusShots:not(.btn-bonus-shots-model),
  body.mode-campaign #btnRestart:not(.btn-replay-model) {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
  }
  body.mode-campaign #btnUseBonusShots .paperclip-gold-icon,
  body.mode-campaign #btnUseBonusShots .bonus-shots-icon {
    width: 22px !important;
  }
  .top-controls .doodle-btn:not(#btnCampaignMap):not(.btn-sound-model):not(.btn-rules-model):not(.btn-home-model):not(.btn-spyglass-model):not(.btn-aim-assist-model):not(.btn-bonus-shots-model):not(.btn-replay-model):not(.btn-leave-game-model) {
    height: 52px !important;
    border-radius: 255px 22px 235px 24px / 24px 235px 22px 255px !important;
    border: 2px solid #142850 !important;
    box-shadow: 2px 2.5px 0px #142850, 0 3px 4px rgba(0, 0, 0, 0.25) !important;
  }
  .top-controls .btn-sound-model,
  .top-controls .btn-rules-model,
  .top-controls .btn-leave-game-model,
  .top-controls .btn-home-model,
  .top-controls .btn-spyglass-model,
  .top-controls .btn-aim-assist-model,
  .top-controls .btn-bonus-shots-model,
  .top-controls .btn-replay-model,
  .top-controls #btnCampaignMap.btn-campaign-map-model {
    width: auto !important;
    min-width: unset !important;
    max-width: unset !important;
    height: 46px !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    border-radius: 6px !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
  }
  .top-controls .btn-card-tile {
    height: 46px !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .top-controls .img-header-btn {
    height: 46px !important;
    max-height: 46px !important;
    width: auto !important;
  }
  .top-controls .btn-card-label {
    display: none !important;
  }
  .top-controls-break {
    display: block !important;
    flex-basis: 100% !important;
    width: 100% !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.mode-campaign #headerMatchBadge {
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 360px !important;
    height: 50px !important;
    font-size: 0.96rem !important;
    font-family: var(--font-doodle) !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    justify-content: center !important;
    margin-bottom: 2px !important;
  }
  body:not(.mode-campaign) .top-controls .sound-toggle-btn:not(.btn-sound-model),
  body:not(.mode-campaign) #btnRules:not(.btn-rules-model),
  body:not(.mode-campaign) #btnHome:not(.btn-home-model),
  body:not(.mode-campaign) #btnHeaderLeaveGame:not(.btn-leave-game-model) {
    flex: 1 1 calc(33.333% - 4px);
    max-width: calc(33.333% - 4px);
  }
  body:not(.mode-campaign) .top-controls .magnifier-toggle-btn:not(.btn-spyglass-model):not(.btn-aim-assist-model),
  body:not(.mode-campaign) #btnRestart:not(.btn-replay-model) {
    flex: 1 1 calc(50% - 4px);
    max-width: calc(50% - 4px);
  }
  .top-controls .sound-toggle-btn,
  .top-controls .magnifier-toggle-btn {
    font-size: 0.78rem;
  }
  .header-match-badge {
    font-size: 0.82rem;
    padding: 2px 8px;
    gap: 4px;
  }
  /* When on phone portrait during active gameplay/battle, hide match setup details at the top */
  body.phone-portrait-layout.game-in-play #headerMatchBadge,
  body.phone-portrait-layout.battle-active #headerMatchBadge {
    display: none !important;
  }
  /* Remove large Fire Shot button in bottom section on phone */
  #btnMobileFire,
  #btnToolShot {
    display: none !important;
  }

  /* Setup options panel on small mobile screens (landscape / embedded) */
  .setup-options-panel:not(.panel-phone-portrait) {
    width: min(52%, 295px);
    padding: 8px 8px;
    gap: 4px;
  }
  .setup-panel-header {
    padding-bottom: 3px;
    gap: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
  }
  .setup-pin-clip {
    font-size: 1.0rem;
    flex-shrink: 0;
  }
  .setup-title {
    font-size: 0.96rem;
    white-space: nowrap;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
  }
  .btn-setup-rules {
    font-size: 0.68rem !important;
    padding: 1px 4px !important;
    flex-shrink: 0 !important;
  }
  .setup-badge {
    font-size: 0.68rem !important;
    padding: 1px 4px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  .setup-intro {
    display: none;
  }
  .setup-label {
    font-size: 0.8rem;
    gap: 3px;
  }
  .setup-label-icon {
    font-size: 0.9rem;
  }
  .setup-select,
  .setup-input {
    font-size: 0.82rem;
    padding: 3px 6px;
    min-height: 32px;
  }
  .setup-panel-footer {
    padding: 4px 6px;
    gap: 5px;
    margin-top: 2px;
  }
  .setup-footer-arrow {
    font-size: 1rem;
  }
  .setup-footer-text {
    font-size: 0.74rem;
  }
  .setup-add-btn {
    font-size: 0.88rem;
    padding: 5px 8px;
    min-height: 34px;
    letter-spacing: 0.2px;
  }
  .non-setup-action-wrap .non-setup-add-btn {
    font-size: 0.95rem;
    padding: 8px 16px;
    min-height: 36px;
    white-space: normal;
  }

  .notebook-stage {
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 60;
  }
  .notebook-sheet {
    width: 100%;
    max-width: 100%;
    position: relative;
    z-index: 60;
  }

  /* Scoreboard: Turn banner full-width on top, Player 1 and Player 2 side-by-side below */
  .scoreboard-bar {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 40px auto;
    gap: 5px;
    margin-top: 2px;
    margin-bottom: 6px;
    width: 100%;
    max-width: 100%;
  }

  /* When playing on a phone in portrait mode, move Player 1, Player 2, and the yellow status box directly above the paper once gameplay begins */
  body.game-in-play:not(.phone-landscape-layout) .game-header,
  body.battle-active:not(.phone-landscape-layout) .game-header {
    order: 1;
    margin-bottom: 2px;
  }
  body.game-in-play:not(.phone-landscape-layout) .scoreboard-bar,
  body.battle-active:not(.phone-landscape-layout) .scoreboard-bar {
    order: 2;
    margin-top: 1px;
    margin-bottom: 5px;
  }
  body.game-in-play:not(.phone-landscape-layout) .notebook-stage,
  body.battle-active:not(.phone-landscape-layout) .notebook-stage {
    order: 3;
    margin-bottom: 4px;
  }
  body.game-in-play:not(.phone-landscape-layout) .setup-toolbar,
  body.battle-active:not(.phone-landscape-layout) .setup-toolbar {
    order: 4;
  }
  body.game-in-play:not(.phone-landscape-layout) .ad-banner-container,
  body.battle-active:not(.phone-landscape-layout) .ad-banner-container {
    order: 9999 !important;
    margin-top: 6px !important;
  }
  .turn-banner-group {
    grid-column: 1 / 3;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .turn-banner {
    min-width: 0;
    width: 100%;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    box-sizing: border-box;
    font-size: clamp(0.72rem, 2.2vw, 0.82rem);
    padding: 2px 6px;
    line-height: 1.22;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
  }
  .turn-banner .turn-banner-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.22;
  }
  .turn-banner .turn-banner-line1::after {
    content: '';
  }
  #p1Card {
    grid-column: 1 / 2;
    grid-row: 2;
    width: 100%;
  }
  #p2Card {
    grid-column: 2 / 3;
    grid-row: 2;
    width: 100%;
  }
  .player-card {
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    padding: 3px 5px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .player-card.active-turn {
    transform: scale(1.01);
  }
  .player-info {
    gap: 4px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .player-avatar {
    width: 28px;
    height: 28px;
    font-size: 1.15rem;
    flex-shrink: 0;
  }
  .player-name-row {
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
  }
  .player-name {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85px;
  }
  .player-status-badge {
    font-size: 0.72rem;
    padding: 1px 3px;
    white-space: nowrap;
  }
  .stickmen-rack {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 2px;
    overflow: hidden;
  }
  .stick-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-width: 1.5px;
    flex-shrink: 0;
  }
  .stick-dot.eliminated::after {
    top: -5px;
    left: 0px;
    font-size: 8px;
  }

  /* Setup & Drawing Toolbar Mobile Layout */
  .setup-toolbar {
    padding: 4px 8px;
    border-radius: 8px;
  }
  .pose-header-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 6px;
    margin-bottom: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .pose-title-group {
    display: contents;
  }
  .pose-header-row .pose-title-label {
    flex: 0 0 100%;
    width: 100%;
    margin-bottom: 2px;
    order: 1;
  }
  .pose-header-row #btnAutoDeploy {
    flex: 1 1 auto;
    order: 2;
    margin: 0;
    font-size: 0.8rem;
    padding: 4px 8px;
    min-height: 32px;
    max-width: calc(50% - 4px);
    justify-content: center;
    box-sizing: border-box;
  }
  #stickmanDeployGroup {
    width: auto;
    display: inline-flex;
    align-items: center;
    order: 3;
    margin: 0;
    gap: 4px;
    flex: 1 1 auto;
    max-width: calc(50% - 4px);
    box-sizing: border-box;
  }
  #stickmanDeployGroup .doodle-btn,
  .pose-header-row #btnDoneSetup {
    flex: 1 1 auto;
    width: 100%;
    font-size: 0.82rem !important;
    padding: 4px 8px !important;
    min-height: 32px !important;
    justify-content: center !important;
    box-sizing: border-box;
  }
  .btn-banner-action {
    font-size: 0.92rem !important;
    padding: 5px 8px;
  }
  .stamp-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 5px;
    overflow-x: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .stamp-btn {
    flex: 1 1 calc(25% - 5px);
    max-width: calc(25% - 4px);
    min-width: 60px;
    font-size: 0.76rem;
    padding: 4px 3px;
    min-height: 32px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    box-sizing: border-box;
  }
  #bgModeChooserRow {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
    box-sizing: border-box;
  }
  #bgModeChooserRow .bg-title-label {
    width: 100%;
    text-align: left;
    margin-bottom: 0;
    font-size: 1.05rem !important;
  }
  .bg-mode-controls {
    width: auto !important;
    max-width: 100% !important;
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
    box-sizing: border-box;
    flex-shrink: 0 !important;
  }
  .mode-toggle {
    width: auto !important;
    max-width: 100% !important;
    display: inline-flex !important;
    flex-direction: row !important;
    border-radius: 8px;
    box-sizing: border-box;
  }
  .mode-toggle-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: 100% !important;
    text-align: center;
    border-top: none;
    border-left: none;
    font-size: 0.78rem;
    padding: 4px 8px;
    justify-content: center;
    white-space: nowrap;
    line-height: 1.2;
    min-height: 32px;
    box-sizing: border-box;
  }
  .mode-toggle-btn:first-child {
    border-left: none;
  }
  .mode-toggle-btn .mode-btn-timer-icon {
    width: 18px;
    height: 18px;
    margin-left: 2px;
  }
  .mode-toggle-btn + .mode-toggle-btn {
    border-left: 2px solid #333;
  }
  .btn-painter-draw {
    padding: 2px 6px;
  }
  .btn-painter-draw .painter-btn-svg {
    width: 25px;
    height: 21px;
  }
  #themeRow #btnModeStamp,
  #themeRow .prebuilt-title-label {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 0 4px 0 !important;
    padding: 2px 0 !important;
    font-family: var(--font-heading) !important;
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: #1f2937 !important;
    min-height: auto !important;
    text-align: left !important;
    justify-content: flex-start !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
  }
  .toolbar-row {
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: wrap !important;
    overflow: visible !important;
    gap: 5px 6px !important;
    padding: 4px 0 !important;
    box-sizing: border-box;
  }
  #themeRow,
  #themeSelectRow {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 5px 6px !important;
  }
  #themeRow .tool-section:first-child,
  #themeSelectRow .tool-section:first-child {
    display: flex !important;
    flex: 1 1 100% !important;
    align-items: center !important;
    gap: 4px !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }
  #themeSelect {
    flex: 1 1 auto !important;
    min-width: 110px !important;
    max-width: calc(100% - 95px) !important;
    font-size: 0.8rem !important;
    padding: 3px 6px !important;
    min-height: 32px !important;
    box-sizing: border-box;
  }
  #btnShuffleTheme {
    flex: 0 0 auto !important;
    font-size: 0.8rem !important;
    padding: 3px 8px !important;
    min-height: 32px !important;
  }
  #propSelectorGroup {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #propSelectorGroup .tool-label {
    width: 100% !important;
    margin-bottom: 2px !important;
  }
  .prop-palette {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
    overflow-x: visible !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .prop-btn {
    flex: 1 1 60px !important;
    min-width: 55px !important;
    max-width: calc(20% - 4px) !important;
    font-size: 0.72rem !important;
    padding: 3px 2px !important;
    min-height: 30px !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }
  #drawToolsRow {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
  }
  #drawToolsRow .tool-group {
    display: flex !important;
    flex: 0 0 auto !important;
    gap: 6px !important;
  }
  #drawToolsRow .doodle-btn {
    font-size: 0.82rem !important;
    padding: 3px 8px !important;
    min-height: 32px !important;
  }
  #drawToolsRow .draw-hint {
    flex: 1 1 100% !important;
    width: 100% !important;
    font-size: 0.72rem !important;
    white-space: normal !important;
    margin-top: 2px !important;
  }
  .draw-hint {
    font-size: 0.75rem;
    margin-left: 2px;
  }
  .draw-overlay {
    top: 8px;
  }
  .draw-timer-wrap {
    width: 62px;
    height: 62px;
  }
  .draw-timer-num {
    font-size: 1.3rem;
  }
  .draw-timer-unit {
    font-size: 0.52rem;
  }
  .draw-overlay.side-left {
    left: 8px;
  }
  .draw-overlay.side-right {
    right: 8px;
  }
  .game-fold-arrow {
    width: 80px;
    height: 40px;
  }
  .floating-toast {
    font-size: 1.8rem;
    padding: 6px 16px;
  }
  .floating-toast.toast-with-sub {
    font-size: 1.5rem;
    padding: 8px 18px;
  }
  .floating-toast .toast-shot-count {
    font-size: 1.05rem;
    margin-top: 4px;
  }

  /* Modals on Mobile Screens */
  .modal-paper,
  .campaign-map-card,
  .online-lobby-card {
    padding: 16px 12px !important;
    width: 94vw !important;
    max-width: 94vw !important;
    max-height: 90vh !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  .online-lobby-card #btnOnlineLobbyHome,
  #btnOnlineLobbyHome.btn-lobby-corner-home {
    top: 10px !important;
    right: 10px !important;
    padding: 3px 8px !important;
    font-size: 0.88rem !important;
    gap: 4px !important;
  }
  .online-lobby-card #btnOnlineLobbyHome svg,
  #btnOnlineLobbyHome.btn-lobby-corner-home svg {
    width: 16px !important;
    height: 16px !important;
  }
  .lobby-columns-container {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin-bottom: 8px !important;
  }
  .lobby-section-card {
    padding: 10px 8px !important;
    gap: 8px !important;
  }
  .lobby-action-heading-btn {
    font-size: 1.02rem !important;
    padding: 5px 12px !important;
  }
  .room-code-display-box {
    padding: 8px 6px !important;
  }
  .room-code-text {
    font-size: 1.55rem !important;
    letter-spacing: 2px !important;
  }
  .room-actions-row button {
    font-size: 0.85rem !important;
    padding: 4px 8px !important;
  }
  .room-code-input {
    font-size: 1.35rem !important;
    padding: 6px 8px !important;
  }
  .btn-connect-action {
    font-size: 0.98rem !important;
    padding: 6px 12px !important;
  }
  .modal-title {
    font-size: 1.35rem;
  }
  .modal-content {
    font-size: 1rem;
    line-height: 1.4;
    max-height: 52vh;
  }
  .modal-actions:not([style*="display: none"]):not(.is-hidden),
  .victory-actions-group:not([style*="display: none"]):not(.is-hidden) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .modal-actions button,
  .modal-actions .doodle-btn,
  .victory-actions-group button,
  .victory-actions-group .doodle-btn {
    font-size: 0.95rem !important;
    padding: 7px 10px !important;
    min-height: 38px !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }
  .play-again-btn-group {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .play-again-btn-group button {
    flex: 1 1 calc(50% - 6px) !important;
    max-width: calc(50% - 4px) !important;
  }
  #campaignVictoryActions.campaign-actions-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
  }
  body:not(.phone-portrait-layout) #campaignVictoryActions.campaign-actions-row button,
  body:not(.phone-portrait-layout) #campaignVictoryActions.campaign-actions-row .doodle-btn {
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    font-size: 0.8rem !important;
    padding: 5px 7px !important;
    min-height: 32px !important;
    white-space: nowrap !important;
  }
  .lobby-tabs {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .lobby-tab-btn {
    flex: 1 1 calc(50% - 6px) !important;
    max-width: calc(50% - 4px) !important;
    font-size: 0.9rem !important;
    padding: 6px 4px !important;
    box-sizing: border-box !important;
  }
  .room-code-text {
    font-size: 1.6rem;
    letter-spacing: 2px;
  }
  .room-code-input {
    width: 95%;
    font-size: 1.35rem;
    letter-spacing: 2px;
  }
  .room-actions-row {
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .room-actions-row .doodle-btn {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }
  .modal-close {
    top: 6px !important;
    right: 8px !important;
  }
  .victory-title {
    font-size: 1.8rem;
  }
  .victory-stats {
    font-size: 1rem;
    padding: 8px;
  }
}

/* ── Mobile Landscape Optimization ────────────────────────── */
@media (max-height: 520px) and (orientation: landscape) {
  body {
    padding: 2px 6px;
  }
  .game-header {
    margin-bottom: 2px;
    padding: 0 4px;
  }
  .header-label {
    display: none;
  }
  .top-controls {
    gap: 4px;
  }
  .top-controls select,
  .top-controls .doodle-btn {
    font-size: 0.8rem;
    padding: 2px 6px;
    min-height: 32px;
  }
  /* When on landscape phone during active gameplay/battle, hide match setup details at the top */
  body.game-in-play #headerMatchBadge,
  body.battle-active #headerMatchBadge {
    display: none !important;
  }
  /* Remove large Fire Shot button in bottom section on phone */
  #btnMobileFire,
  #btnToolShot {
    display: none !important;
  }
  .ad-banner-container {
    order: 10 !important;
    margin-top: 6px !important;
    padding: 2px 6px !important;
  }
  .game-header,
  body.game-in-play .game-header,
  body.battle-active .game-header {
    order: 1 !important;
  }
  .notebook-stage,
  body.game-in-play .notebook-stage,
  body.battle-active .notebook-stage {
    order: 2 !important;
    position: relative;
    z-index: 60;
    width: 75% !important;
    max-width: 75% !important;
    height: min(calc((100vh - 110px) * 0.75), 255px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-bottom: 2px !important;
  }
  .scoreboard-bar,
  body.game-in-play .scoreboard-bar,
  body.battle-active .scoreboard-bar {
    order: 3 !important;
    position: relative;
    z-index: 10;
    margin-top: 2px !important;
    margin-bottom: 2px !important;
    gap: 6px;
    display: flex;
    flex-direction: row;
    align-items: stretch !important;
  }
  .setup-toolbar,
  body.game-in-play .setup-toolbar,
  body.battle-active .setup-toolbar {
    order: 4 !important;
  }
  .turn-banner-group {
    grid-column: auto;
    width: auto;
    max-width: 44% !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
    align-self: center !important;
  }
  .turn-banner {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: clamp(0.68rem, 1.8vw, 0.78rem);
    padding: 3px 6px;
    line-height: 1.22;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .turn-banner .turn-banner-line {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.22;
  }
  .turn-banner .turn-banner-line1::after {
    content: '';
  }
  .player-card {
    flex: 1 1 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    align-self: stretch !important;
    padding: 2px 5px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    overflow: hidden !important;
    transform: none !important;
  }
  .player-card.active-turn {
    transform: none !important;
  }
  .player-card .player-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    overflow: hidden;
  }
  .player-card .player-name-row {
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
  }
  .player-card .player-name {
    font-size: 0.82rem !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 85px;
  }
  .player-card .player-status-badge {
    font-size: 0.72rem !important;
    padding: 1px 3px !important;
    white-space: nowrap !important;
    line-height: 1.15 !important;
  }
  .player-card .player-avatar {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    flex-shrink: 0 !important;
  }
  .player-card .stickmen-rack {
    flex-shrink: 0 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 2px !important;
    margin-left: auto !important;
  }
  .stick-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    border-width: 1.5px;
    flex-shrink: 0;
  }
  .setup-toolbar {
    padding: 2px 6px;
  }
  .toolbar-row {
    padding: 2px 0;
  }
  .pose-header-row {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-bottom: 1px;
  }
  .pose-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .pose-header-row .pose-title-label {
    flex: 0 0 auto;
    width: auto;
    order: 1;
  }
  .pose-title-group .doodle-btn {
    font-size: 0.78rem;
    padding: 2px 6px;
  }
  .mode-toggle {
    flex-direction: row;
  }
  .mode-toggle-btn {
    width: auto;
    border-top: none;
    border-left: 2px solid #333;
    padding: 3px 8px;
  }
  /* Background mode chooser in phone landscape: button placed under Create Your Scene text */
  #bgModeChooserRow {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 2px !important;
    padding: 2px 0 !important;
  }
  #bgModeChooserRow .bg-title-label {
    width: 100% !important;
    text-align: left !important;
    margin-bottom: 2px !important;
    font-size: 0.95rem !important;
  }
  #bgModeChooserRow .bg-mode-controls,
  #themeRow .bg-mode-controls,
  .bg-mode-controls {
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
  }
  #bgModeChooserRow .mode-toggle,
  #themeRow .mode-toggle,
  .mode-toggle {
    display: inline-flex !important;
    border-radius: 8px !important;
  }
  #bgModeChooserRow .mode-toggle-btn,
  #themeRow .mode-toggle-btn,
  .mode-toggle-btn {
    width: auto !important;
    font-size: 0.78rem !important;
    padding: 3px 8px !important;
    min-height: 28px !important;
    border: 2px solid #333 !important;
    border-radius: 8px !important;
    box-shadow: 2px 2px 0px #222 !important;
  }
  /* Scenery prop palette in landscape mode: wrap into multiple rows without horizontal scrollbar */
  #propSelectorGroup {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 4px 6px !important;
    overflow: visible !important;
    overflow-x: visible !important;
    scrollbar-width: none !important;
  }
  #propSelectorGroup::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  #propSelectorGroup .tool-label {
    flex-shrink: 0 !important;
    padding-top: 3px !important;
    font-size: 0.8rem !important;
    white-space: nowrap !important;
  }
  .prop-palette {
    display: flex !important;
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    overflow: visible !important;
    gap: 3px 4px !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .prop-palette::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  .prop-btn {
    flex: 1 1 70px !important;
    min-width: 60px !important;
    max-width: 120px !important;
    white-space: nowrap !important;
    font-size: 0.76rem !important;
    padding: 2px 6px !important;
    min-height: 26px !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
  .modal-paper {
    max-height: 94vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
  }
  .modal-content {
    max-height: 48vh !important;
  }

  /* ── Landscape Double-Column Round Options Modal ── */
  .round-options-card {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    column-gap: 14px !important;
    row-gap: 6px !important;
    align-items: center !important;
    width: min(94vw, 580px) !important;
    max-width: 580px !important;
    max-height: 94vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 16px 10px 16px !important;
    box-sizing: border-box !important;
  }
  .round-options-header {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding-bottom: 2px !important;
    margin-bottom: 2px !important;
  }
  .round-options-icon {
    font-size: 1.35rem !important;
  }
  .round-options-title {
    font-size: 1.2rem !important;
    margin: 0 !important;
  }
  .round-options-prompt {
    grid-column: 1 / -1 !important;
    font-size: 0.84rem !important;
    margin: 0 0 4px 0 !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }
  #roundOptionsFields {
    display: contents !important;
  }
  .round-option-group {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    margin: 0 !important;
  }
  .round-option-label {
    font-size: 0.78rem !important;
    white-space: nowrap !important;
  }
  .round-options-card .setup-select-wrapper {
    min-height: 28px !important;
    height: 28px !important;
    width: 100% !important;
  }
  .round-options-fields .round-select {
    font-size: 0.82rem !important;
    padding: 3px 6px !important;
    min-height: 28px !important;
    height: 28px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  #roundOptionsWaitingIndicator {
    grid-column: 1 / -1 !important;
    margin-top: 2px !important;
    margin-bottom: 2px !important;
    font-size: 0.8rem !important;
    justify-content: center !important;
  }
  #roundOptionsActionGroup {
    grid-column: 2 !important;
    grid-row: 4 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 0 !important;
    width: 100% !important;
  }
  #roundOptionsActionGroup button {
    font-size: 0.88rem !important;
    padding: 4px 10px !important;
    min-height: 30px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  /* ── Landscape Double-Column Online Multiplayer Lobby Modal ── */
  .online-lobby-card {
    display: grid !important;
    grid-template-columns: 1fr 1.15fr !important;
    column-gap: 16px !important;
    row-gap: 4px !important;
    width: min(95vw, 680px) !important;
    max-width: 680px !important;
    max-height: 94vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 16px 10px 16px !important;
    align-items: start !important;
    box-sizing: border-box !important;
    text-align: left !important;
  }
  .online-lobby-card .modal-close {
    top: 6px !important;
    right: 8px !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 1.1rem !important;
  }
  .online-lobby-card .victory-title {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    font-size: 1.2rem !important;
    margin: 0 !important;
    text-align: center !important;
    padding-bottom: 2px !important;
  }
  .online-lobby-card > p {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    font-size: 0.78rem !important;
    margin: 0 0 4px 0 !important;
    text-align: center !important;
    line-height: 1.2 !important;
  }
  .lobby-name-group {
    grid-column: 1 !important;
    grid-row: 3 !important;
    margin-bottom: 2px !important;
    text-align: left !important;
  }
  .lobby-name-group label {
    font-size: 0.72rem !important;
    margin-bottom: 2px !important;
    display: block !important;
    text-align: left !important;
  }
  #inputOnlinePlayerName {
    font-size: 0.88rem !important;
    padding: 3px 8px !important;
    height: 28px !important;
    min-height: 28px !important;
    max-width: 100% !important;
    margin: 0 !important;
    text-align: left !important;
    box-sizing: border-box !important;
  }
  .online-lobby-card #btnOnlineLobbyHome,
  #btnOnlineLobbyHome.btn-lobby-corner-home {
    position: absolute !important;
    top: 6px !important;
    right: 8px !important;
    grid-column: auto !important;
    grid-row: auto !important;
    margin: 0 !important;
    font-size: 0.82rem !important;
    padding: 2px 7px !important;
    min-height: 24px !important;
    min-width: 0 !important;
    gap: 4px !important;
    z-index: 10 !important;
  }
  .online-lobby-card #btnOnlineLobbyHome svg,
  #btnOnlineLobbyHome.btn-lobby-corner-home svg {
    width: 15px !important;
    height: 15px !important;
  }
  .lobby-columns-container {
    display: contents !important;
  }
  .lobby-section-card {
    background: #fffdf9 !important;
    border: 1.5px solid #2b2b2b !important;
    border-radius: 8px !important;
    padding: 4px 6px !important;
    gap: 4px !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }
  .lobby-action-heading-btn {
    font-size: 0.82rem !important;
    padding: 2px 8px !important;
    min-height: 24px !important;
    margin-bottom: 2px !important;
    max-width: 100% !important;
  }
  .lobby-section-content {
    gap: 4px !important;
    width: 100% !important;
  }
  .btn-connect-action {
    font-size: 0.82rem !important;
    padding: 3px 10px !important;
    min-height: 26px !important;
    margin-top: 2px !important;
    max-width: 100% !important;
  }
  #viewHostGame:not([style*="display: none"]) {
    grid-column: 1 !important;
    grid-row: 4 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 4px !important;
    box-sizing: border-box !important;
  }
  #viewJoinGame:not([style*="display: none"]) {
    grid-column: 2 !important;
    grid-row: 3 / span 3 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 5px !important;
    box-sizing: border-box !important;
  }
  #viewHostGame[style*="display: none"],
  #viewJoinGame[style*="display: none"] {
    display: none !important;
  }
  .room-code-display-box {
    padding: 5px 8px !important;
    border-radius: 8px !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .room-code-label {
    font-size: 0.7rem !important;
    margin-bottom: 2px !important;
    letter-spacing: 1px !important;
  }
  .room-code-text {
    font-size: 1.55rem !important;
    letter-spacing: 3px !important;
    line-height: 1.1 !important;
  }
  .room-actions-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .room-actions-row .doodle-btn {
    font-size: 0.78rem !important;
    padding: 3px 6px !important;
    min-height: 28px !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }
  .lobby-status-indicator {
    font-size: 0.74rem !important;
    margin-top: 2px !important;
    justify-content: center !important;
    line-height: 1.2 !important;
  }
  .join-input-group {
    margin-bottom: 0 !important;
    text-align: left !important;
    width: 100% !important;
  }
  .room-code-input {
    width: 100% !important;
    font-size: 1.15rem !important;
    padding: 4px 8px !important;
    height: 32px !important;
    min-height: 32px !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
  #btnConnectRoom {
    font-size: 0.88rem !important;
    padding: 4px 12px !important;
    min-height: 30px !important;
    margin-top: 4px !important;
  }
  #joinStatusMsg {
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-top: 4px !important;
  }
  .lobby-initial-choices {
    grid-column: 1 / -1 !important;
    grid-row: 4 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin: 4px auto 6px auto !important;
    width: 100% !important;
    max-width: 360px !important;
    box-sizing: border-box !important;
  }
  .lobby-choice-btn {
    font-size: 0.82rem !important;
    padding: 8px 6px !important;
    min-height: 48px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }
  .lobby-back-btn {
    font-size: 0.78rem !important;
    padding: 3px 8px !important;
    margin-top: 4px !important;
  }
  .in-room-invite-card {
    top: 4px !important;
    max-width: 95vw !important;
  }
  .in-room-invite-pill {
    padding: 3px 8px 3px 10px !important;
    gap: 6px !important;
    border-radius: 20px !important;
  }
  .in-room-code-badge {
    font-size: 0.95rem !important;
    padding: 1px 5px !important;
  }
  .in-room-btn {
    font-size: 0.78rem !important;
    padding: 2px 6px !important;
    min-height: 22px !important;
  }
  .in-room-invite-status {
    font-size: 0.75rem !important;
  }
  .online-reconnecting-banner {
    top: 4px !important;
    max-width: 96vw !important;
  }
  .online-reconnecting-content {
    padding: 4px 8px !important;
    gap: 6px !important;
  }
  .reconnecting-title {
    font-size: 0.82rem !important;
  }
  .reconnecting-subtitle {
    font-size: 0.72rem !important;
  }

  /* ── Landscape Play Again Prompt Modals ── */
  .play-again-card {
    padding: 12px 18px !important;
    max-width: 440px !important;
  }
  .play-again-prompt-title,
  .play-again-declined-title {
    font-size: 1.2rem !important;
    padding-bottom: 6px !important;
    margin-bottom: 10px !important;
  }
  .play-again-btn-group {
    gap: 12px !important;
  }
  .play-again-btn-group button {
    font-size: 1rem !important;
    padding: 4px 16px !important;
    min-height: 32px !important;
    min-width: 80px !important;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) {
    width: min(46%, 280px);
    padding: 6px 8px;
    gap: 4px;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-panel-header {
    padding-bottom: 2px;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-intro {
    display: none;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-title {
    font-size: 0.95rem;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-select {
    font-size: 0.78rem;
    padding: 2px 6px;
    min-height: 28px;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-add-btn {
    font-size: 0.78rem;
    padding: 3px 6px;
    min-height: 28px;
    letter-spacing: 0px;
    margin-top: 1px;
    margin-bottom: 1px;
  }
  .non-setup-action-wrap:not(.panel-phone-portrait):not(.panel-phone-landscape) .non-setup-add-btn {
    font-size: 0.82rem;
    padding: 4px 10px;
    min-height: 28px;
    white-space: normal;
  }
  .setup-options-panel:not(.panel-phone-portrait):not(.panel-phone-landscape) .setup-panel-footer {
    display: none;
  }
  .aim-loupe {
    --loupe-size: 110px;
    width: var(--loupe-size);
    height: var(--loupe-size);
  }
  .aim-loupe-circle {
    width: var(--loupe-size);
    height: var(--loupe-size);
    box-shadow: none !important;
  }
  .aim-fire-btn {
    width: calc(var(--loupe-size) * 0.5) !important;
    height: calc(var(--loupe-size) * 0.5) !important;
    min-width: calc(var(--loupe-size) * 0.5) !important;
    min-height: calc(var(--loupe-size) * 0.5) !important;
    bottom: var(--aim-fire-bottom, 100%) !important;
    top: var(--aim-fire-top, auto) !important;
    left: var(--aim-fire-left, 50%) !important;
    transform: var(--aim-fire-transform, translateX(-50%));
    margin-bottom: var(--aim-fire-margin-bottom, 5px);
    margin-top: var(--aim-fire-margin-top, 0);
    opacity: 0.9 !important;
    box-shadow: none !important;
  }
  .aim-fire-btn .aim-fire-icon {
    font-size: 20px !important;
  }
  .aim-loupe-handle {
    display: flex !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   Game Left State: Only Game Reset, Rules, and Sound work.
   Canvas drawing & stickmen adding blocked until Game Reset.
   ═══════════════════════════════════════════════════════════ */
body.game-is-left canvas.canvas-layer {
  pointer-events: none !important;
  cursor: not-allowed !important;
}

body.game-is-left .office-trash-can {
  pointer-events: none !important;
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

body.game-is-left .setup-options-panel {
  pointer-events: none !important;
  opacity: 0.45 !important;
}

body.game-is-left .header-match-badge {
  pointer-events: none !important;
  cursor: not-allowed !important;
}

body.game-is-left .setup-toolbar button:not(#btnRestart):not(#btnHome):not(#btnRules):not(#btnSetupRules):not(#btnToggleMute):not(#btnToggleMagnifier):not(#btnCloseRules):not(.sound-toggle-btn):not(.magnifier-toggle-btn),
body.game-is-left .setup-toolbar select,
body.game-is-left .setup-options-panel select,
body.game-is-left .setup-options-panel button:not(#btnSetupRules),
body.game-is-left .non-setup-action-wrap button,
body.game-is-left button:not(#btnRestart):not(#btnHome):not(#btnRules):not(#btnSetupRules):not(#btnToggleMute):not(#btnToggleMagnifier):not(#btnCloseRules):not(.sound-toggle-btn):not(.magnifier-toggle-btn):not(#btnModalSound):not(#btnCampaignModalSound):not(#btnCloseVictoryModal):not(#btnCampaignMap):not(#btnUseBonusShots):not(#btnPlayAgainDeclinedReset):not(#btnPlayAgainDeclinedOk):not(#btnClosePlayAgainDeclined):not(#btnRoundOptionsHome):not(#btnRoundOptionsLeaveGame):not(.btn-round-options-leave):not(#btnPlayAgainDeclinedHome):not(#btnInvitedParticipantStart):not(#btnInvitedParticipantHome):not(#btnOnlineLobbyHome) {
  pointer-events: none !important;
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

body.game-is-left #btnSetupRules,
body.game-is-left #btnToggleMagnifier,
body.game-is-left #playAgainDeclinedModal button,
body.game-is-left #invitedParticipantModal button,
body.game-is-left #onlineLobbyModal button {
  pointer-events: auto !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

/* ═══════════════════════════════════════════════════════════
   Game Reset Button Flashing Green on Outside After Leaving
   ═══════════════════════════════════════════════════════════ */
body.game-is-left #btnRestart,
#btnRestart.flashing-green-outside {
  animation: resetBtnGreenOutsideFlash 1.2s ease-in-out infinite !important;
  border-color: #22c55e !important;
  position: relative;
  z-index: 10;
  transform: translateZ(0);
  will-change: transform, box-shadow;
}

body.game-is-left #btnRestart:hover,
#btnRestart.flashing-green-outside:hover {
  background: #fff;
  transform: translate(-1px, -1px);
}

@keyframes resetBtnGreenOutsideFlash {
  0%, 100% {
    border-color: #22c55e;
    box-shadow: 
      0 0 0 2px rgba(34, 197, 94, 0.45),
      0 0 8px 2px rgba(34, 197, 94, 0.35),
      2px 3px 0px #222;
  }
  50% {
    border-color: #16a34a;
    box-shadow: 
      0 0 0 5px rgba(34, 197, 94, 0.9),
      0 0 20px 8px rgba(34, 197, 94, 0.75),
      2px 3px 0px #111;
  }
}

/* ═══════════════════════════════════════════════════════════
   Gameplay / Battle Phase: Remove Battle Phase button,
   the box it is in, and all setup controls
   ═══════════════════════════════════════════════════════════ */
body.battle-active .setup-toolbar,
body.battle-active #battleStatusGroup,
body.battle-active .battle-badge,
body.game-in-play .setup-toolbar,
body.game-in-play #battleStatusGroup,
body.game-in-play .battle-badge,
body.battle-active #bgModeChooserRow,
body.battle-active #stickmanPoseGroup,
body.battle-active #stickmanDeployGroup,
body.battle-active #btnAutoDeploy,
body.battle-active #btnDoneSetup,
body.battle-active #drawToolsRow,
body.battle-active #stampModeRows,
body.battle-active #themeRow,
body.battle-active #propSelectorGroup,
body.battle-active .stamp-selector,
body.game-in-play #bgModeChooserRow,
body.game-in-play #stickmanPoseGroup,
body.game-in-play #stickmanDeployGroup,
body.game-in-play #btnAutoDeploy,
body.game-in-play #btnDoneSetup,
body.game-in-play #drawToolsRow,
body.game-in-play #stampModeRows,
body.game-in-play #themeRow,
body.game-in-play #propSelectorGroup,
body.game-in-play .stamp-selector {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   Phone Portrait Gameplay Placement: Move Player 1, Player 2,
   and yellow status box (Scoreboard) directly above the paper
   ═══════════════════════════════════════════════════════════ */
body.phone-portrait-layout.game-in-play .game-header,
body.phone-portrait-layout.battle-active .game-header,
body.is-phone-device.phone-portrait-layout.game-in-play .game-header {
  order: 1;
  margin-bottom: 2px;
}

body.phone-portrait-layout.game-in-play .scoreboard-bar,
body.phone-portrait-layout.battle-active .scoreboard-bar,
body.is-phone-device.phone-portrait-layout.game-in-play .scoreboard-bar {
  order: 2;
  margin-top: 1px;
  margin-bottom: 5px;
}

body.phone-portrait-layout.game-in-play .notebook-stage,
body.phone-portrait-layout.battle-active .notebook-stage,
body.is-phone-device.phone-portrait-layout.game-in-play .notebook-stage {
  order: 3;
  margin-bottom: 4px;
}

body.phone-portrait-layout.game-in-play .setup-toolbar,
body.phone-portrait-layout.battle-active .setup-toolbar,
body.is-phone-device.phone-portrait-layout.game-in-play .setup-toolbar {
  order: 4;
}

/* Phone landscape layout classes: keep notebook stage above scoreboard */
body.phone-landscape-layout .game-header,
body.phone-landscape-layout.game-in-play .game-header {
  order: 1 !important;
}
body.phone-landscape-layout .notebook-stage,
body.phone-landscape-layout.game-in-play .notebook-stage,
body.is-phone-device.phone-landscape-layout .notebook-stage,
body.is-phone-device:not(.phone-portrait-layout) .notebook-stage {
  order: 2 !important;
  width: 75% !important;
  max-width: 75% !important;
  height: min(calc((100vh - 110px) * 0.75), 255px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 2px !important;
}
body.phone-landscape-layout .scoreboard-bar,
body.phone-landscape-layout.game-in-play .scoreboard-bar,
body.is-phone-device.phone-landscape-layout .scoreboard-bar,
body.is-phone-device:not(.phone-portrait-layout) .scoreboard-bar {
  order: 3 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  gap: 6px !important;
  margin-top: 2px !important;
  margin-bottom: 2px !important;
}
body.phone-landscape-layout .setup-toolbar,
body.phone-landscape-layout.game-in-play .setup-toolbar {
  order: 4 !important;
}
/* All phone layouts: portrait & landscape - Ads are strictly placed below all game components */
body.phone-portrait-layout .game-header,
body.is-phone-device.phone-portrait-layout .game-header {
  order: 1;
}
body.phone-portrait-layout:not(.game-in-play):not(.battle-active) .notebook-stage,
body.is-phone-device.phone-portrait-layout:not(.game-in-play):not(.battle-active) .notebook-stage {
  order: 2;
}
body.phone-portrait-layout:not(.game-in-play):not(.battle-active) .scoreboard-bar,
body.is-phone-device.phone-portrait-layout:not(.game-in-play):not(.battle-active) .scoreboard-bar {
  order: 3;
}
body.phone-portrait-layout:not(.game-in-play):not(.battle-active) .setup-toolbar,
body.is-phone-device.phone-portrait-layout:not(.game-in-play):not(.battle-active) .setup-toolbar {
  order: 4;
}

body.phone-portrait-layout .ad-banner-container,
body.phone-landscape-layout .ad-banner-container,
body.is-phone-device .ad-banner-container,
body.is-phone-device.phone-portrait-layout .ad-banner-container,
body.is-phone-device.phone-landscape-layout .ad-banner-container {
  order: 9999 !important;
  margin-top: 6px !important;
  position: relative !important;
  z-index: 5 !important;
  width: 100% !important;
}

body.phone-landscape-layout .turn-banner-group,
body.is-phone-device.phone-landscape-layout .turn-banner-group,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner-group {
  max-width: 44% !important;
  min-width: 0 !important;
  flex: 0 1 auto !important;
  align-self: center !important;
}

body.phone-landscape-layout .turn-banner,
body.is-phone-device.phone-landscape-layout .turn-banner,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  font-size: clamp(0.68rem, 1.8vw, 0.78rem) !important;
  padding: 3px 6px !important;
  line-height: 1.22 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

body.phone-landscape-layout .turn-banner .turn-banner-line,
body.is-phone-device.phone-landscape-layout .turn-banner .turn-banner-line,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner .turn-banner-line {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  line-height: 1.22 !important;
}

body.phone-landscape-layout .turn-banner .turn-banner-line1::after,
body.is-phone-device.phone-landscape-layout .turn-banner .turn-banner-line1::after,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner .turn-banner-line1::after {
  content: '' !important;
}

body.phone-landscape-layout .turn-banner.has-detonator,
body.is-phone-device.phone-landscape-layout .turn-banner.has-detonator,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner.has-detonator {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

body.phone-landscape-layout .turn-banner.has-detonator .turn-banner-line,
body.is-phone-device.phone-landscape-layout .turn-banner.has-detonator .turn-banner-line,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner.has-detonator .turn-banner-line {
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

body.phone-landscape-layout .turn-banner.has-detonator .detonator-instruction,
body.is-phone-device.phone-landscape-layout .turn-banner.has-detonator .detonator-instruction,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner.has-detonator .detonator-instruction {
  display: none !important;
}

body.phone-landscape-layout .turn-banner.has-detonator .turn-banner-line1,
body.is-phone-device.phone-landscape-layout .turn-banner.has-detonator .turn-banner-line1,
body.is-phone-device:not(.phone-portrait-layout) .turn-banner.has-detonator .turn-banner-line1 {
  font-size: clamp(0.65rem, 1.8vw, 0.74rem) !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
  margin-bottom: 2px !important;
}

body.phone-landscape-layout #p1Card,
body.phone-landscape-layout #p2Card,
body.is-phone-device.phone-landscape-layout #p1Card,
body.is-phone-device.phone-landscape-layout #p2Card,
body.is-phone-device:not(.phone-portrait-layout) #p1Card,
body.is-phone-device:not(.phone-portrait-layout) #p2Card,
body.phone-landscape-layout .player-card,
body.is-phone-device.phone-landscape-layout .player-card,
body.is-phone-device:not(.phone-portrait-layout) .player-card {
  flex: 1 1 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  align-self: stretch !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 3px 6px !important;
  gap: 4px !important;
  overflow: hidden !important;
  transform: none !important;
}

body.phone-landscape-layout .player-card.active-turn,
body.is-phone-device.phone-landscape-layout .player-card.active-turn,
body.is-phone-device:not(.phone-portrait-layout) .player-card.active-turn {
  transform: none !important;
}

body.phone-landscape-layout .player-card .player-info,
body.is-phone-device.phone-landscape-layout .player-card .player-info,
body.is-phone-device:not(.phone-portrait-layout) .player-card .player-info {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
}

body.phone-landscape-layout .player-card .player-name-row,
body.is-phone-device.phone-landscape-layout .player-card .player-name-row,
body.is-phone-device:not(.phone-portrait-layout) .player-card .player-name-row {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
}

body.phone-landscape-layout .player-card .player-name,
body.is-phone-device.phone-landscape-layout .player-card .player-name,
body.is-phone-device:not(.phone-portrait-layout) .player-card .player-name {
  font-size: 0.88rem !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 110px !important;
}

body.phone-landscape-layout .player-card .player-status-badge,
body.is-phone-device.phone-landscape-layout .player-card .player-status-badge,
body.is-phone-device:not(.phone-portrait-layout) .player-card .player-status-badge {
  font-size: 0.76rem !important;
  padding: 1px 4px !important;
  white-space: nowrap !important;
  line-height: 1.15 !important;
}

body.phone-landscape-layout .player-card .player-avatar,
body.is-phone-device.phone-landscape-layout .player-card .player-avatar,
body.is-phone-device:not(.phone-portrait-layout) .player-card .player-avatar {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  flex-shrink: 0 !important;
}

body.phone-landscape-layout .player-card .stickmen-rack,
body.is-phone-device.phone-landscape-layout .player-card .stickmen-rack,
body.is-phone-device:not(.phone-portrait-layout) .player-card .stickmen-rack {
  flex-shrink: 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 2px !important;
  margin-left: auto !important;
}

body.phone-landscape-layout .player-card .stick-dot,
body.is-phone-device.phone-landscape-layout .player-card .stick-dot,
body.is-phone-device:not(.phone-portrait-layout) .player-card .stick-dot {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  border-width: 1.5px !important;
  flex-shrink: 0 !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Phone Landscape Modal Popups: Double-Column Layout & Responsive Scaling
   Ensures Round Setup, Online Lobby, and all modals fit and scale cleanly
   ═════════════════════════════════════════════════════════════════════════ */

/* Universal Modal Paper Scaling - Zero Scroll on Phone Viewports */
body.phone-landscape-layout .modal-paper,
body.is-phone-device.phone-landscape-layout .modal-paper,
body.phone-portrait-layout .modal-paper,
body.is-phone-device.phone-portrait-layout .modal-paper {
  max-height: 94vh !important;
  overflow: hidden !important;
  padding: 10px 14px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .modal-content,
body.is-phone-device.phone-landscape-layout .modal-content {
  max-height: 48vh !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Upper Status Bar & Top Controls Resizing on Mobile (Phone Landscape)
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-landscape-layout .game-header,
body.is-phone-device.phone-landscape-layout .game-header {
  margin-bottom: 2px !important;
  padding: 1px 4px !important;
}

body.phone-landscape-layout .top-controls,
body.is-phone-device.phone-landscape-layout .top-controls {
  gap: 3px 5px !important;
}

body.phone-landscape-layout .top-controls .doodle-btn,
body.phone-landscape-layout .top-controls button,
body.is-phone-device.phone-landscape-layout .top-controls .doodle-btn,
body.is-phone-device.phone-landscape-layout .top-controls button {
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  font-size: 0.75rem !important;
}

body.phone-landscape-layout .top-controls .btn-card-tile,
body.is-phone-device.phone-landscape-layout .top-controls .btn-card-tile {
  width: auto !important;
  height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.phone-landscape-layout .top-controls .img-header-btn,
body.is-phone-device.phone-landscape-layout .top-controls .img-header-btn {
  height: 42px !important;
  max-height: 42px !important;
  width: auto !important;
}

body.phone-landscape-layout .header-match-badge,
body.phone-landscape-layout #headerMatchBadge,
body.is-phone-device.phone-landscape-layout .header-match-badge,
body.is-phone-device.phone-landscape-layout #headerMatchBadge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  padding: 0 10px !important;
  margin: 0 !important;
  font-size: 0.88rem !important;
  font-family: var(--font-doodle) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Rules Modal: Phone Landscape (Double-Column, Zero-Scroll Fit)
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-landscape-layout .rules-modal-paper,
body.is-phone-device.phone-landscape-layout .rules-modal-paper,
@media (max-height: 520px) and (orientation: landscape) {
  .rules-modal-paper {
    width: min(94vw, 760px) !important;
    max-width: min(94vw, 760px) !important;
    max-height: 94vh !important;
    padding: 6px 14px 8px 14px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
}

body.phone-landscape-layout .rules-modal-title,
body.is-phone-device.phone-landscape-layout .rules-modal-title {
  font-size: 1.12rem !important;
  margin: 0 0 4px 0 !important;
  padding-bottom: 2px !important;
  text-align: center !important;
}

body.phone-landscape-layout .rules-step-badge,
body.is-phone-device.phone-landscape-layout .rules-step-badge {
  display: none !important;
}

body.phone-landscape-layout .rules-content-wrap,
body.is-phone-device.phone-landscape-layout .rules-content-wrap {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  column-gap: 14px !important;
  row-gap: 4px !important;
  max-height: calc(94vh - 78px) !important;
  overflow: hidden !important;
  margin-bottom: 4px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .rules-page,
body.is-phone-device.phone-landscape-layout .rules-page {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  font-size: 0.74rem !important;
  line-height: 1.22 !important;
}

body.phone-landscape-layout .rules-page p,
body.is-phone-device.phone-landscape-layout .rules-page p {
  margin: 1.5px 0 !important;
  font-size: 0.74rem !important;
  color: #2b2b2b !important;
}

body.phone-landscape-layout .rules-modal-actions,
body.is-phone-device.phone-landscape-layout .rules-modal-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 10px !important;
  margin-top: 2px !important;
  width: 100% !important;
}

body.phone-landscape-layout .btn-rules-back,
body.phone-landscape-layout .btn-rules-continue,
body.is-phone-device.phone-landscape-layout .btn-rules-back,
body.is-phone-device.phone-landscape-layout .btn-rules-continue {
  display: none !important;
}

body.phone-landscape-layout .btn-rules-exit,
body.is-phone-device.phone-landscape-layout .btn-rules-exit {
  display: inline-flex !important;
  font-size: 0.86rem !important;
  padding: 3px 14px !important;
  min-height: 28px !important;
  height: 28px !important;
}

body.phone-landscape-layout .btn-close-rules,
body.is-phone-device.phone-landscape-layout .btn-close-rules {
  display: inline-flex !important;
  font-size: 0.86rem !important;
  padding: 3px 20px !important;
  min-height: 28px !important;
  height: 28px !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Rules Modal: Phone Portrait (2-Step Pagination with Continue Arrow)
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-portrait-layout .rules-modal-paper,
body.is-phone-device.phone-portrait-layout .rules-modal-paper {
  width: min(92vw, 360px) !important;
  max-width: min(92vw, 360px) !important;
  max-height: 92vh !important;
  padding: 12px 14px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

body.phone-portrait-layout .rules-modal-title,
body.is-phone-device.phone-portrait-layout .rules-modal-title {
  font-size: 1.25rem !important;
  margin: 0 0 3px 0 !important;
  padding-bottom: 4px !important;
  text-align: center !important;
}

body.phone-portrait-layout .rules-step-badge,
body.is-phone-device.phone-portrait-layout .rules-step-badge {
  display: block !important;
  font-size: 0.78rem !important;
  color: #92400e !important;
  font-weight: 700 !important;
  text-align: center !important;
  margin: 0 auto 6px auto !important;
  background: #fef3c7 !important;
  border-radius: 6px !important;
  padding: 1px 8px !important;
  width: fit-content !important;
  border: 1px dashed #d97706 !important;
}

body.phone-portrait-layout .rules-content-wrap,
body.is-phone-device.phone-portrait-layout .rules-content-wrap {
  display: block !important;
  max-height: none !important;
  overflow: hidden !important;
  margin-bottom: 8px !important;
}

body.phone-portrait-layout .rules-page,
body.is-phone-device.phone-portrait-layout .rules-page {
  display: none !important;
  flex-direction: column !important;
  gap: 6px !important;
}

body.phone-portrait-layout .rules-page.active,
body.is-phone-device.phone-portrait-layout .rules-page.active {
  display: flex !important;
}

body.phone-portrait-layout .rules-page p,
body.is-phone-device.phone-portrait-layout .rules-page p {
  font-size: 0.82rem !important;
  line-height: 1.32 !important;
  margin: 3px 0 !important;
}

body.phone-portrait-layout .rules-modal-actions,
body.is-phone-device.phone-portrait-layout .rules-modal-actions {
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
  margin-top: 8px !important;
}

body.phone-portrait-layout .rules-modal-actions .doodle-btn,
body.is-phone-device.phone-portrait-layout .rules-modal-actions .doodle-btn {
  font-size: 0.92rem !important;
  padding: 6px 16px !important;
  min-height: 34px !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Setup Guidance Modal: Zero-Scroll Scaling
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-landscape-layout .setup-guidance-card,
body.is-phone-device.phone-landscape-layout .setup-guidance-card {
  max-width: 500px !important;
  max-height: 94vh !important;
  padding: 8px 14px !important;
  overflow: hidden !important;
}

body.phone-landscape-layout .setup-guidance-title,
body.is-phone-device.phone-landscape-layout .setup-guidance-title {
  font-size: 1.15rem !important;
  margin-bottom: 4px !important;
}

body.phone-landscape-layout .setup-guidance-title svg,
body.is-phone-device.phone-landscape-layout .setup-guidance-title svg {
  width: 20px !important;
  height: 20px !important;
}

body.phone-landscape-layout .setup-guidance-content,
body.is-phone-device.phone-landscape-layout .setup-guidance-content {
  padding: 6px 12px !important;
}

body.phone-landscape-layout .setup-guidance-list,
body.is-phone-device.phone-landscape-layout .setup-guidance-list {
  font-size: 0.82rem !important;
  gap: 3px !important;
}

body.phone-landscape-layout #btnSetupGuidanceGotIt,
body.is-phone-device.phone-landscape-layout #btnSetupGuidanceGotIt {
  font-size: 0.95rem !important;
  padding: 4px 20px !important;
  min-height: 28px !important;
  margin-top: 6px !important;
}

body.phone-portrait-layout .setup-guidance-card,
body.is-phone-device.phone-portrait-layout .setup-guidance-card {
  max-width: min(92vw, 360px) !important;
  max-height: 94vh !important;
  padding: 14px 16px !important;
  overflow: hidden !important;
}

body.phone-portrait-layout .setup-guidance-title,
body.is-phone-device.phone-portrait-layout .setup-guidance-title {
  font-size: 1.35rem !important;
  margin-bottom: 8px !important;
}

body.phone-portrait-layout .setup-guidance-list,
body.is-phone-device.phone-portrait-layout .setup-guidance-list {
  font-size: 1.0rem !important;
  gap: 8px !important;
}

body.phone-portrait-layout #btnSetupGuidanceGotIt,
body.is-phone-device.phone-portrait-layout #btnSetupGuidanceGotIt {
  font-size: 1.15rem !important;
  padding: 8px 24px !important;
  min-height: 36px !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Bonus Shots Modal: Zero-Scroll Scaling
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-landscape-layout .bonus-shots-modal-card,
body.is-phone-device.phone-landscape-layout .bonus-shots-modal-card {
  max-width: min(94vw, 480px) !important;
  max-height: 94vh !important;
  padding: 8px 14px !important;
  overflow: hidden !important;
}

body.phone-landscape-layout .bonus-shots-title,
body.is-phone-device.phone-landscape-layout .bonus-shots-title {
  font-size: 1.15rem !important;
  margin-bottom: 2px !important;
}

body.phone-landscape-layout .bonus-shots-modal-question,
body.is-phone-device.phone-landscape-layout .bonus-shots-modal-question {
  font-size: 0.82rem !important;
  margin: 2px 0 6px 0 !important;
}

body.phone-landscape-layout .bonus-shots-options-container,
body.is-phone-device.phone-landscape-layout .bonus-shots-options-container {
  gap: 4px !important;
}

body.phone-landscape-layout .bonus-shots-modal-actions,
body.is-phone-device.phone-landscape-layout .bonus-shots-modal-actions {
  margin-top: 4px !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Rename Player Modal: Zero-Scroll Scaling
   ═════════════════════════════════════════════════════════════════════════ */
body.phone-landscape-layout .rename-modal-card,
body.is-phone-device.phone-landscape-layout .rename-modal-card,
body.phone-portrait-layout .rename-modal-card,
body.is-phone-device.phone-portrait-layout .rename-modal-card {
  max-height: 94vh !important;
  overflow: hidden !important;
  padding: 12px 16px !important;
}

/* Round Options Modal (.round-options-card) -> Double-Column Grid */
body.phone-landscape-layout .round-options-card,
body.is-phone-device.phone-landscape-layout .round-options-card {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  column-gap: 14px !important;
  row-gap: 6px !important;
  align-items: center !important;
  width: min(94vw, 580px) !important;
  max-width: 580px !important;
  max-height: 94vh !important;
  overflow: hidden !important;
  padding: 8px 16px 10px 16px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .round-options-header,
body.is-phone-device.phone-landscape-layout .round-options-header {
  grid-column: 1 / -1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding-bottom: 2px !important;
  margin-bottom: 2px !important;
}

body.phone-landscape-layout .round-options-icon,
body.is-phone-device.phone-landscape-layout .round-options-icon {
  font-size: 1.35rem !important;
}

body.phone-landscape-layout .round-options-title,
body.is-phone-device.phone-landscape-layout .round-options-title {
  font-size: 1.2rem !important;
  margin: 0 !important;
}

body.phone-landscape-layout .round-options-prompt,
body.is-phone-device.phone-landscape-layout .round-options-prompt {
  grid-column: 1 / -1 !important;
  font-size: 0.84rem !important;
  margin: 0 0 4px 0 !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

body.phone-landscape-layout .round-options-prompt.is-waiting-prompt,
body.is-phone-device.phone-landscape-layout .round-options-prompt.is-waiting-prompt {
  font-size: 0.88rem !important;
  padding: 3px 8px !important;
  margin: 0 0 4px 0 !important;
  border-width: 1.5px !important;
  animation: none !important;
}

body.phone-landscape-layout #roundOptionsFields,
body.is-phone-device.phone-landscape-layout #roundOptionsFields {
  display: contents !important;
}

body.phone-landscape-layout .round-option-group,
body.is-phone-device.phone-landscape-layout .round-option-group {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  margin: 0 !important;
}

body.phone-landscape-layout .round-option-label,
body.is-phone-device.phone-landscape-layout .round-option-label {
  font-size: 0.78rem !important;
  white-space: nowrap !important;
}

body.phone-landscape-layout .round-options-card .setup-select-wrapper,
body.is-phone-device.phone-landscape-layout .round-options-card .setup-select-wrapper {
  min-height: 28px !important;
  height: 28px !important;
  width: 100% !important;
}

body.phone-landscape-layout .round-options-fields .round-select,
body.is-phone-device.phone-landscape-layout .round-options-fields .round-select {
  font-size: 0.82rem !important;
  padding: 3px 6px !important;
  min-height: 28px !important;
  height: 28px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout #roundOptionsWaitingIndicator,
body.is-phone-device.phone-landscape-layout #roundOptionsWaitingIndicator {
  grid-column: 1 / -1 !important;
  margin-top: 2px !important;
  margin-bottom: 2px !important;
  font-size: 0.8rem !important;
  justify-content: center !important;
}

body.phone-landscape-layout #roundOptionsActionGroup,
body.is-phone-device.phone-landscape-layout #roundOptionsActionGroup {
  grid-column: 2 !important;
  grid-row: 4 !important;
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  justify-content: center !important;
  align-items: center !important;
  margin-top: 0 !important;
  width: 100% !important;
}

body.phone-landscape-layout #roundOptionsActionGroup button,
body.is-phone-device.phone-landscape-layout #roundOptionsActionGroup button {
  font-size: 0.88rem !important;
  padding: 4px 10px !important;
  min-height: 30px !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
}

/* Online Multiplayer Lobby Modal (.online-lobby-card) -> Double-Column Grid */
body.phone-landscape-layout .online-lobby-card,
body.is-phone-device.phone-landscape-layout .online-lobby-card {
  display: grid !important;
  grid-template-columns: 1fr 1.15fr !important;
  column-gap: 16px !important;
  row-gap: 4px !important;
  width: min(95vw, 680px) !important;
  max-width: 680px !important;
  max-height: 94vh !important;
  overflow: hidden !important;
  padding: 8px 16px 10px 16px !important;
  align-items: start !important;
  box-sizing: border-box !important;
  text-align: left !important;
}

body.phone-landscape-layout .online-lobby-card .modal-close,
body.is-phone-device.phone-landscape-layout .online-lobby-card .modal-close {
  top: 6px !important;
  right: 8px !important;
  width: 28px !important;
  height: 28px !important;
  font-size: 1.1rem !important;
}

body.phone-landscape-layout .online-lobby-card .victory-title,
body.is-phone-device.phone-landscape-layout .online-lobby-card .victory-title {
  grid-column: 1 / -1 !important;
  grid-row: 1 !important;
  font-size: 1.2rem !important;
  margin: 0 !important;
  text-align: center !important;
  padding-bottom: 2px !important;
}

body.phone-landscape-layout .online-lobby-card > p,
body.is-phone-device.phone-landscape-layout .online-lobby-card > p {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  font-size: 0.78rem !important;
  margin: 0 0 4px 0 !important;
  text-align: center !important;
  line-height: 1.2 !important;
}

body.phone-landscape-layout .lobby-name-group,
body.is-phone-device.phone-landscape-layout .lobby-name-group {
  grid-column: 1 !important;
  grid-row: 3 !important;
  margin-bottom: 2px !important;
  text-align: left !important;
}

body.phone-landscape-layout .lobby-name-group label,
body.is-phone-device.phone-landscape-layout .lobby-name-group label {
  font-size: 0.72rem !important;
  margin-bottom: 2px !important;
  display: block !important;
  text-align: left !important;
}

body.phone-landscape-layout #inputOnlinePlayerName,
body.is-phone-device.phone-landscape-layout #inputOnlinePlayerName {
  font-size: 0.88rem !important;
  padding: 3px 8px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-width: 100% !important;
  margin: 0 !important;
  text-align: left !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .online-lobby-card #btnOnlineLobbyHome,
body.is-phone-device.phone-landscape-layout .online-lobby-card #btnOnlineLobbyHome {
  position: absolute !important;
  top: 6px !important;
  right: 8px !important;
  grid-column: auto !important;
  grid-row: auto !important;
  margin: 0 !important;
  font-size: 0.82rem !important;
  padding: 2px 7px !important;
  min-height: 24px !important;
  min-width: 0 !important;
  gap: 4px !important;
  z-index: 10 !important;
}

body.phone-landscape-layout .online-lobby-card #btnOnlineLobbyHome svg,
body.is-phone-device.phone-landscape-layout .online-lobby-card #btnOnlineLobbyHome svg {
  width: 15px !important;
  height: 15px !important;
}

body.phone-landscape-layout .lobby-columns-container,
body.is-phone-device.phone-landscape-layout .lobby-columns-container {
  display: contents !important;
}

body.phone-landscape-layout .lobby-section-card,
body.is-phone-device.phone-landscape-layout .lobby-section-card {
  background: #fffdf9 !important;
  border: 1.5px solid #2b2b2b !important;
  border-radius: 8px !important;
  padding: 4px 6px !important;
  gap: 4px !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .lobby-action-heading-btn,
body.is-phone-device.phone-landscape-layout .lobby-action-heading-btn {
  font-size: 0.82rem !important;
  padding: 2px 8px !important;
  min-height: 24px !important;
  margin-bottom: 2px !important;
  max-width: 100% !important;
}

body.phone-landscape-layout .lobby-section-content,
body.is-phone-device.phone-landscape-layout .lobby-section-content {
  gap: 4px !important;
  width: 100% !important;
}

body.phone-landscape-layout .btn-connect-action,
body.is-phone-device.phone-landscape-layout .btn-connect-action {
  font-size: 0.82rem !important;
  padding: 3px 10px !important;
  min-height: 26px !important;
  margin-top: 2px !important;
  max-width: 100% !important;
}

body.phone-landscape-layout .lobby-initial-choices,
body.is-phone-device.phone-landscape-layout .lobby-initial-choices {
  grid-column: 1 / span 2 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  align-items: stretch !important;
  gap: 12px !important;
  margin: 4px auto !important;
  width: 100% !important;
  max-width: 440px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .lobby-choice-btn,
body.is-phone-device.phone-landscape-layout .lobby-choice-btn {
  font-size: 0.82rem !important;
  padding: 6px 10px !important;
  min-height: 44px !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .lobby-initial-choices[style*="display: none"],
body.is-phone-device.phone-landscape-layout .lobby-initial-choices[style*="display: none"],
body.phone-landscape-layout #viewHostGame[style*="display: none"],
body.is-phone-device.phone-landscape-layout #viewHostGame[style*="display: none"],
body.phone-landscape-layout #viewJoinGame[style*="display: none"],
body.is-phone-device.phone-landscape-layout #viewJoinGame[style*="display: none"] {
  display: none !important;
}

body.phone-landscape-layout #viewHostGame,
body.is-phone-device.phone-landscape-layout #viewHostGame {
  grid-column: 2 !important;
  grid-row: 3 / span 3 !important;
  display: flex;
  flex-direction: column !important;
  width: 100% !important;
  gap: 4px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout #viewJoinGame,
body.is-phone-device.phone-landscape-layout #viewJoinGame {
  grid-column: 2 !important;
  grid-row: 3 / span 3 !important;
  display: flex;
  flex-direction: column !important;
  width: 100% !important;
  gap: 5px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .room-code-display-box,
body.is-phone-device.phone-landscape-layout .room-code-display-box {
  padding: 5px 8px !important;
  border-radius: 8px !important;
  text-align: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout .room-code-label,
body.is-phone-device.phone-landscape-layout .room-code-label {
  font-size: 0.7rem !important;
  margin-bottom: 2px !important;
  letter-spacing: 1px !important;
}

body.phone-landscape-layout .room-code-text,
body.is-phone-device.phone-landscape-layout .room-code-text {
  font-size: 1.55rem !important;
  letter-spacing: 3px !important;
  line-height: 1.1 !important;
}

body.phone-landscape-layout .room-actions-row,
body.is-phone-device.phone-landscape-layout .room-actions-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 6px !important;
  width: 100% !important;
}

body.phone-landscape-layout .room-actions-row .doodle-btn,
body.is-phone-device.phone-landscape-layout .room-actions-row .doodle-btn {
  font-size: 0.78rem !important;
  padding: 3px 6px !important;
  min-height: 28px !important;
  flex: 1 1 auto !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

body.phone-landscape-layout .lobby-status-indicator,
body.is-phone-device.phone-landscape-layout .lobby-status-indicator {
  font-size: 0.74rem !important;
  margin-top: 2px !important;
  justify-content: center !important;
  line-height: 1.2 !important;
}

body.phone-landscape-layout .join-input-group,
body.is-phone-device.phone-landscape-layout .join-input-group {
  margin-bottom: 0 !important;
  text-align: left !important;
  width: 100% !important;
}

body.phone-landscape-layout .room-code-input,
body.is-phone-device.phone-landscape-layout .room-code-input {
  width: 100% !important;
  font-size: 1.15rem !important;
  padding: 4px 8px !important;
  height: 32px !important;
  min-height: 32px !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout #btnConnectRoom,
body.is-phone-device.phone-landscape-layout #btnConnectRoom {
  font-size: 0.88rem !important;
  padding: 4px 12px !important;
  min-height: 30px !important;
  margin-top: 4px !important;
}

body.phone-landscape-layout #joinStatusMsg,
body.is-phone-device.phone-landscape-layout #joinStatusMsg {
  font-size: 0.75rem !important;
  padding: 4px 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 4px !important;
}

/* Play Again Prompt Modals in Landscape */
body.phone-landscape-layout .play-again-card,
body.is-phone-device.phone-landscape-layout .play-again-card {
  padding: 12px 18px !important;
  max-width: 440px !important;
}

body.phone-landscape-layout .play-again-prompt-title,
body.phone-landscape-layout .play-again-declined-title,
body.is-phone-device.phone-landscape-layout .play-again-prompt-title,
body.is-phone-device.phone-landscape-layout .play-again-declined-title {
  font-size: 1.2rem !important;
  padding-bottom: 6px !important;
  margin-bottom: 10px !important;
}

body.phone-landscape-layout .play-again-btn-group,
body.is-phone-device.phone-landscape-layout .play-again-btn-group {
  gap: 12px !important;
}

body.phone-landscape-layout .play-again-btn-group button,
body.is-phone-device.phone-landscape-layout .play-again-btn-group button {
  font-size: 1rem !important;
  padding: 4px 16px !important;
  min-height: 32px !important;
  min-width: 80px !important;
}

/* Phone Portrait Scoreboard & Banner Adjustments */
body.phone-portrait-layout .scoreboard-bar,
body.is-phone-device.phone-portrait-layout .scoreboard-bar {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 40px auto !important;
  gap: 4px !important;
  padding: 3px 6px !important;
  align-items: stretch !important;
}

body.phone-portrait-layout .turn-banner-group,
body.is-phone-device.phone-portrait-layout .turn-banner-group {
  grid-column: 1 / 3 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body.phone-portrait-layout .turn-banner,
body.is-phone-device.phone-portrait-layout .turn-banner {
  min-width: 0 !important;
  width: 100% !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  box-sizing: border-box !important;
  font-size: clamp(0.72rem, 2.2vw, 0.82rem) !important;
  padding: 2px 6px !important;
  line-height: 1.22 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  overflow: hidden !important;
}

body.phone-portrait-layout .turn-banner .turn-banner-line,
body.is-phone-device.phone-portrait-layout .turn-banner .turn-banner-line {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  line-height: 1.22 !important;
}

body.phone-portrait-layout .turn-banner .turn-banner-line1::after,
body.is-phone-device.phone-portrait-layout .turn-banner .turn-banner-line1::after {
  content: '' !important;
}

body.phone-portrait-layout .turn-banner.has-detonator,
body.is-phone-device.phone-portrait-layout .turn-banner.has-detonator {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

body.phone-portrait-layout .turn-banner.has-detonator .detonator-wrap,
body.is-phone-device.phone-portrait-layout .turn-banner.has-detonator .detonator-wrap {
  margin: 0 !important;
}

body.phone-portrait-layout .turn-banner.has-detonator .detonator-instruction,
body.is-phone-device.phone-portrait-layout .turn-banner.has-detonator .detonator-instruction {
  display: none !important;
}

body.phone-portrait-layout .turn-banner.has-detonator .turn-banner-line1,
body.is-phone-device.phone-portrait-layout .turn-banner.has-detonator .turn-banner-line1 {
  display: none !important;
}

body.phone-portrait-layout #p1Card,
body.is-phone-device.phone-portrait-layout #p1Card {
  grid-column: 1 / 2 !important;
  grid-row: 2 !important;
  width: 100% !important;
}

body.phone-portrait-layout #p2Card,
body.is-phone-device.phone-portrait-layout #p2Card {
  grid-column: 2 / 3 !important;
  grid-row: 2 !important;
  width: 100% !important;
}

body.phone-portrait-layout .player-card,
body.is-phone-device.phone-portrait-layout .player-card {
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  padding: 3px 5px !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 2px !important;
}

body.phone-portrait-layout .player-info,
body.is-phone-device.phone-portrait-layout .player-info {
  gap: 4px !important;
  width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

body.phone-portrait-layout .player-avatar,
body.is-phone-device.phone-portrait-layout .player-avatar {
  width: 28px !important;
  height: 28px !important;
  font-size: 1.15rem !important;
  flex-shrink: 0 !important;
}

body.phone-portrait-layout .player-name-row,
body.is-phone-device.phone-portrait-layout .player-name-row {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  overflow: hidden !important;
}

body.phone-portrait-layout .player-name,
body.is-phone-device.phone-portrait-layout .player-name {
  font-size: 0.82rem !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 85px !important;
}

body.phone-portrait-layout .player-status-badge,
body.is-phone-device.phone-portrait-layout .player-status-badge {
  font-size: 0.72rem !important;
  padding: 1px 3px !important;
  white-space: nowrap !important;
}

body.phone-portrait-layout .stickmen-rack,
body.is-phone-device.phone-portrait-layout .stickmen-rack {
  width: 100% !important;
  max-width: 100% !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 2px !important;
  overflow: hidden !important;
}

body.phone-portrait-layout .stick-dot,
body.is-phone-device.phone-portrait-layout .stick-dot {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  border-width: 1.5px !important;
  flex-shrink: 0 !important;
}

/* Phone mode (portrait and landscape): Aim handle button active with fingerprint icon and full portrait magnifier settings */
body.phone-portrait-layout .aim-loupe-handle,
body.phone-landscape-layout .aim-loupe-handle,
body.is-phone-device.phone-landscape-layout .aim-loupe-handle,
body.is-phone-device .aim-loupe-handle {
  display: flex !important;
  width: calc(var(--loupe-size, 110px) * 0.34) !important;
  min-width: calc(var(--loupe-size, 110px) * 0.34) !important;
  height: calc(var(--loupe-size, 110px) * 0.40) !important;
  min-height: calc(var(--loupe-size, 110px) * 0.40) !important;
  aspect-ratio: 37 / 44 !important;
}

body.phone-portrait-layout .aim-loupe,
body.phone-landscape-layout .aim-loupe,
body.is-phone-device.phone-landscape-layout .aim-loupe,
body.is-phone-device .aim-loupe {
  --loupe-size: 110px !important;
  width: var(--loupe-size) !important;
  height: var(--loupe-size) !important;
  z-index: 100 !important;
}

body.phone-portrait-layout .aim-loupe-circle,
body.phone-landscape-layout .aim-loupe-circle,
body.is-phone-device.phone-landscape-layout .aim-loupe-circle,
body.is-phone-device .aim-loupe-circle {
  width: var(--loupe-size) !important;
  height: var(--loupe-size) !important;
}

body.phone-portrait-layout .aim-fire-btn,
body.phone-landscape-layout .aim-fire-btn,
body.is-phone-device.phone-landscape-layout .aim-fire-btn,
body.is-phone-device .aim-fire-btn {
  width: calc(var(--loupe-size, 110px) * 0.5) !important;
  height: calc(var(--loupe-size, 110px) * 0.5) !important;
  min-width: calc(var(--loupe-size, 110px) * 0.5) !important;
  min-height: calc(var(--loupe-size, 110px) * 0.5) !important;
  opacity: 0.9 !important;
}

/* Phone landscape layout: Background mode button placed under Create Your Scene text */
body.phone-landscape-layout #bgModeChooserRow,
body.is-phone-device.phone-landscape-layout #bgModeChooserRow,
body.is-phone-device:not(.phone-portrait-layout) #bgModeChooserRow {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 2px !important;
  padding: 2px 0 !important;
}

body.phone-landscape-layout #bgModeChooserRow .bg-title-label,
body.is-phone-device.phone-landscape-layout #bgModeChooserRow .bg-title-label,
body.is-phone-device:not(.phone-portrait-layout) #bgModeChooserRow .bg-title-label,
body.phone-landscape-layout #themeRow .prebuilt-title-label,
body.is-phone-device.phone-landscape-layout #themeRow .prebuilt-title-label,
body.is-phone-device:not(.phone-portrait-layout) #themeRow .prebuilt-title-label {
  width: 100% !important;
  text-align: left !important;
  margin-bottom: 2px !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
}

body.phone-landscape-layout .bg-mode-controls,
body.is-phone-device.phone-landscape-layout .bg-mode-controls,
body.is-phone-device:not(.phone-portrait-layout) .bg-mode-controls {
  width: auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

body.phone-landscape-layout .mode-toggle,
body.is-phone-device.phone-landscape-layout .mode-toggle,
body.is-phone-device:not(.phone-portrait-layout) .mode-toggle {
  display: inline-flex !important;
  border-radius: 8px !important;
}

body.phone-landscape-layout .mode-toggle-btn,
body.is-phone-device.phone-landscape-layout .mode-toggle-btn,
body.is-phone-device:not(.phone-portrait-layout) .mode-toggle-btn {
  width: auto !important;
  font-size: 0.78rem !important;
  padding: 3px 8px !important;
  min-height: 28px !important;
  border: 2px solid #333 !important;
  border-radius: 8px !important;
  box-shadow: 2px 2px 0px #222 !important;
}

body.phone-landscape-layout .btn-painter-draw,
body.is-phone-device.phone-landscape-layout .btn-painter-draw,
body.is-phone-device:not(.phone-portrait-layout) .btn-painter-draw {
  padding: 2px 6px !important;
}

body.phone-landscape-layout .btn-painter-draw .painter-btn-svg,
body.is-phone-device.phone-landscape-layout .btn-painter-draw .painter-btn-svg,
body.is-phone-device:not(.phone-portrait-layout) .btn-painter-draw .painter-btn-svg {
  width: 25px !important;
  height: 21px !important;
}

/* Phone landscape layout: wrap scenery prop palette into multiple rows and remove horizontal scrollbar */
body.phone-landscape-layout #propSelectorGroup,
body.is-phone-device.phone-landscape-layout #propSelectorGroup,
body.is-phone-device:not(.phone-portrait-layout) #propSelectorGroup {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  gap: 4px 6px !important;
  overflow: visible !important;
  overflow-x: visible !important;
  scrollbar-width: none !important;
}

body.phone-landscape-layout #propSelectorGroup::-webkit-scrollbar,
body.is-phone-device.phone-landscape-layout #propSelectorGroup::-webkit-scrollbar,
body.is-phone-device:not(.phone-portrait-layout) #propSelectorGroup::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body.phone-landscape-layout #propSelectorGroup .tool-label,
body.is-phone-device.phone-landscape-layout #propSelectorGroup .tool-label,
body.is-phone-device:not(.phone-portrait-layout) #propSelectorGroup .tool-label {
  flex-shrink: 0 !important;
  padding-top: 3px !important;
  font-size: 0.8rem !important;
  white-space: nowrap !important;
}

body.phone-landscape-layout .prop-palette,
body.is-phone-device.phone-landscape-layout .prop-palette,
body.is-phone-device:not(.phone-portrait-layout) .prop-palette {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  overflow: visible !important;
  gap: 3px 4px !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

body.phone-landscape-layout .prop-palette::-webkit-scrollbar,
body.is-phone-device.phone-landscape-layout .prop-palette::-webkit-scrollbar,
body.is-phone-device:not(.phone-portrait-layout) .prop-palette::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body.phone-landscape-layout .prop-btn,
body.is-phone-device.phone-landscape-layout .prop-btn,
body.is-phone-device:not(.phone-portrait-layout) .prop-btn {
  flex: 1 1 70px !important;
  min-width: 60px !important;
  max-width: 120px !important;
  white-space: nowrap !important;
  font-size: 0.76rem !important;
  padding: 2px 6px !important;
  min-height: 26px !important;
  justify-content: center !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

/* Phone playing mode: Fire button opacity (90% across all orientations) */
body.phone-portrait-layout .aim-fire-btn,
body.is-phone-device.phone-portrait-layout .aim-fire-btn,
body.is-phone-device:not(.phone-landscape-layout) .aim-fire-btn,
body.phone-landscape-layout .aim-fire-btn,
body.is-phone-device.phone-landscape-layout .aim-fire-btn {
  opacity: 0.9 !important;
}

body.phone-portrait-layout .aim-fire-btn:hover,
body.is-phone-device.phone-portrait-layout .aim-fire-btn:hover,
body.phone-landscape-layout .aim-fire-btn:hover,
body.is-phone-device.phone-landscape-layout .aim-fire-btn:hover {
  opacity: 0.95 !important;
}

body.phone-portrait-layout .aim-fire-btn:active,
body.is-phone-device.phone-portrait-layout .aim-fire-btn:active,
body.is-phone-device:not(.phone-landscape-layout) .aim-fire-btn:active,
body.phone-landscape-layout .aim-fire-btn:active,
body.is-phone-device.phone-landscape-layout .aim-fire-btn:active {
  opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════════
   Campaign 100-Levels Paper Odyssey Styles
   ═══════════════════════════════════════════════════════════ */
.campaign-map-card {
  max-width: 780px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #fcfaf5;
  border: 3px solid #3d3027;
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 4px 6px 0px rgba(0, 0, 0, 0.2);
  padding: 18px 24px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.campaign-map-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 2px dashed #b5a995;
  padding-bottom: 8px;
  padding-right: 48px; /* Dedicated clear space so top-right close X button is never covered */
}

#btnCloseCampaignMap.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 30 !important;
  width: 36px;
  height: 36px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  border: 1.5px solid #4a3b32;
  color: #3d3027;
  transition: all 0.15s ease;
}

#btnCloseCampaignMap.modal-close:hover {
  background: #fef08a;
  color: #000;
  transform: scale(1.08);
}

.campaign-map-badges {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.campaign-stars-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef3c7;
  border: 2px solid #b45309;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 4px 14px;
  font-family: var(--font-doodle);
  font-size: 1.15rem;
  font-weight: 700;
  color: #78350f;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
}

.campaign-bonus-shots-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fefce8;
  border: 2px dashed #b45309;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 4px 14px;
  font-family: var(--font-doodle);
  font-size: 1.15rem;
  font-weight: 700;
  color: #78350f;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.12);
}

.campaign-bonus-shots-icon {
  font-size: 1.15rem;
  display: inline-block;
  vertical-align: middle;
}

.campaign-map-subtitle {
  flex: 0 0 auto;
  font-family: var(--font-doodle);
  font-size: 1.12rem;
  color: #525252;
  margin: 8px 0 10px 0;
}

/* Chapter tabs (1 to 10) */
.campaign-chapter-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.campaign-chapter-tabs::-webkit-scrollbar {
  height: 6px;
}

.campaign-chapter-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chapter-tab-btn {
  white-space: nowrap;
  font-family: var(--font-doodle);
  font-size: 0.98rem;
  font-weight: 700;
  padding: 5px 12px;
  border: 2px solid #4a3b32;
  border-radius: 8px 8px 0 0;
  background: #f1ebd9;
  color: #3d3027;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chapter-tab-btn:hover {
  background: #fef08a;
  transform: translateY(-2px);
}

.chapter-tab-btn.active {
  background: #fef08a;
  border-bottom: 2px solid #fef08a;
  box-shadow: 0 -3px 6px rgba(0, 0, 0, 0.08);
  color: #1c1917;
}

.campaign-chapter-info {
  flex: 0 0 auto;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 8px;
  padding: 8px 14px;
  margin: 6px 0 12px 0;
}

/* 10 Level Cards Grid */
.campaign-levels-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
}

.campaign-map-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 14px;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100%;
  border-top: 1px dashed #b5a995;
  z-index: 20;
}

#btnCloseCampaignMapBtn {
  min-width: 140px;
  font-size: 1.15rem;
  padding: 8px 32px;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

@media (max-width: 640px) {
  .campaign-map-card {
    padding: 14px 10px !important;
  }
  .campaign-map-header {
    padding-right: 42px !important;
  }
  #btnCloseCampaignMap.modal-close {
    top: 8px !important;
    right: 8px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 1.25rem !important;
  }
  .campaign-levels-grid {
    grid-template-columns: repeat(2, 1fr);
    min-height: 100px;
  }
  .campaign-map-footer {
    padding-top: 10px !important;
  }
}

@media (max-height: 600px) {
  .campaign-map-card {
    max-height: 96vh !important;
    padding: 10px 14px !important;
  }
  .campaign-map-subtitle {
    display: none !important;
  }
  .campaign-chapter-info {
    padding: 4px 8px !important;
    margin: 4px 0 6px 0 !important;
  }
  .campaign-levels-grid {
    min-height: 80px !important;
  }
  .campaign-map-footer {
    padding-top: 6px !important;
    margin-top: 4px !important;
  }
}

.level-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid #4a3b32;
  border-radius: 10px;
  padding: 8px 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.15);
  min-height: 74px;
}

.level-card:hover:not(.locked) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 3px 5px 0px rgba(0, 0, 0, 0.22);
  background: #fef9c3;
}

.level-card.is-boss {
  border: 2.5px solid #b45309;
  background: #fffdf5;
}

.level-card.is-boss .level-num {
  color: #b45309;
}

.level-card.locked {
  opacity: 0.55;
  background: #f3f4f6;
  border-color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.level-num {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.1;
}

.level-boss-tag {
  font-size: 0.72rem;
  font-weight: 700;
  background: #fbbf24;
  color: #78350f;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.level-stars {
  font-size: 1.05rem;
  margin-top: 3px;
  letter-spacing: 2px;
  color: #f59e0b;
}

.level-card.locked .level-stars {
  color: #9ca3af;
}

.level-title-text {
  font-family: var(--font-body, "Patrick Hand", cursive, sans-serif);
  font-size: 0.76rem;
  color: #4b5563;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96%;
  margin-top: 2px;
  line-height: 1.15;
}

.level-card.is-boss .level-title-text {
  color: #92400e;
  font-weight: 700;
}



/* Campaign stars bounce animation in victory modal */
.campaign-stars-display {
  animation: starPopAnim 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes starPopAnim {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1.0); opacity: 1; }
}

/* ── Phone Portrait Mode: Campaign Level Victory / Defeat Modal Buttons ── */
body.phone-portrait-layout #campaignVictoryActions.campaign-actions-row,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions.campaign-actions-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  align-items: stretch !important;
  gap: 5px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 12px !important;
}

/* Remove green dot in Sound button only in phone portrait mode */
body.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound .sound-status-dot,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound .sound-status-dot {
  display: none !important;
}

/* Two levels of bold, legible text for all buttons in phone portrait mode */
body.phone-portrait-layout #campaignVictoryActions .btn-text-line1,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions .btn-text-line1 {
  display: block !important;
  white-space: nowrap !important;
  text-align: center !important;
  font-size: clamp(0.80rem, 2.5vw, 0.90rem) !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  letter-spacing: 0.2px !important;
  margin-bottom: 2px !important;
}

body.phone-portrait-layout #campaignVictoryActions .btn-text-line2,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions .btn-text-line2 {
  display: block !important;
  white-space: nowrap !important;
  text-align: center !important;
  font-size: clamp(0.76rem, 2.3vw, 0.84rem) !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  letter-spacing: 0.2px !important;
}

/* Sound button label layout in phone portrait mode */
body.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound .sound-label,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound .sound-label {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
}

/* Phone Portrait victory modal sizing & text responsiveness */
body.phone-portrait-layout #victoryModal .modal-paper,
body.is-phone-device.phone-portrait-layout #victoryModal .modal-paper {
  width: 95vw !important;
  max-width: 95vw !important;
  box-sizing: border-box !important;
  padding: 16px 8px !important;
  overflow-x: hidden !important;
}

body.phone-portrait-layout #victoryModal .victory-title,
body.is-phone-device.phone-portrait-layout #victoryModal .victory-title {
  font-size: 1.8rem !important;
}

body.phone-portrait-layout #victoryModal #victorySubtitle,
body.is-phone-device.phone-portrait-layout #victoryModal #victorySubtitle {
  font-size: 1.05rem !important;
  word-break: break-word !important;
  white-space: normal !important;
}

body.phone-portrait-layout #victoryModal .campaign-stars-display,
body.is-phone-device.phone-portrait-layout #victoryModal .campaign-stars-display {
  font-size: 1.8rem !important;
}

body.phone-portrait-layout #victoryModal .campaign-shot-accuracy-badge,
body.is-phone-device.phone-portrait-layout #victoryModal .campaign-shot-accuracy-badge {
  font-size: 1.05rem !important;
  white-space: normal !important;
}

/* All campaign action buttons sized equally with clean, high-contrast, legible typography */
body.phone-portrait-layout #campaignVictoryActions.campaign-actions-row button,
body.phone-portrait-layout #campaignVictoryActions.campaign-actions-row .doodle-btn,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions.campaign-actions-row button,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions.campaign-actions-row .doodle-btn {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 1 0% !important;
  min-width: 50px !important;
  max-width: calc(25% - 4px) !important;
  width: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  padding: 6px 2px !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
  text-align: center !important;
  border-radius: 8px !important;
  border-width: 2px !important;
  border-style: solid !important;
  box-shadow: 2px 3px 0px rgba(0, 0, 0, 0.25) !important;
}

/* Button color themes for clarity and polish */
body.phone-portrait-layout #campaignVictoryActions #btnCampaignNextLevel,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignNextLevel {
  background: #fde047 !important;
  border-color: #854d0e !important;
  color: #713f12 !important;
  box-shadow: 2px 3px 0px #854d0e !important;
}

body.phone-portrait-layout #campaignVictoryActions #btnCampaignReplayLevel,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignReplayLevel {
  background: #ffffff !important;
  border-color: #374151 !important;
  color: #1f2937 !important;
  box-shadow: 2px 3px 0px #374151 !important;
}

body.phone-portrait-layout #campaignVictoryActions #btnCampaignReplayLevel.primary,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignReplayLevel.primary {
  background: #fde047 !important;
  border-color: #854d0e !important;
  color: #713f12 !important;
  box-shadow: 2px 3px 0px #854d0e !important;
}

body.phone-portrait-layout #campaignVictoryActions #btnCampaignLeaveGame,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignLeaveGame {
  background: #ffffff !important;
  border-color: #374151 !important;
  color: #1f2937 !important;
  box-shadow: 2px 3px 0px #374151 !important;
}

body.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound.sound-on,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound.sound-on {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #14532d !important;
  box-shadow: 2px 3px 0px #15803d !important;
}

body.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound.sound-off,
body.is-phone-device.phone-portrait-layout #campaignVictoryActions #btnCampaignModalSound.sound-off {
  background: #fee2e2 !important;
  border-color: #dc2626 !important;
  color: #991b1b !important;
  box-shadow: 2px 3px 0px #991b1b !important;
}

/* Phone Landscape victory modal sizing & responsiveness: prevent viewport overflow */
body.phone-landscape-layout #victoryModal .modal-paper,
body.is-phone-device.phone-landscape-layout #victoryModal .modal-paper,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal .modal-paper {
  width: min(92vw, 680px) !important;
  max-width: min(92vw, 680px) !important;
  max-height: 94vh !important;
  max-height: 94dvh !important;
  box-sizing: border-box !important;
  padding: 8px 16px !important;
  overflow: hidden !important;
}

/* Out of lead losing on 100 level mode box: 70% of current size on phone in landscape mode */
body.phone-landscape-layout #victoryModal .modal-paper.defeat-card,
body.is-phone-device.phone-landscape-layout #victoryModal .modal-paper.defeat-card,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal .modal-paper.defeat-card,
body.phone-landscape-layout.mode-campaign #victoryModal .modal-paper.defeat-card,
body.is-phone-device.phone-landscape-layout.mode-campaign #victoryModal .modal-paper.defeat-card,
body.is-phone-device:not(.phone-portrait-layout).mode-campaign #victoryModal .modal-paper.defeat-card {
  --defeat-popup-scale: 0.7;
  transform: scale(var(--defeat-popup-scale, 0.7)) !important;
  transform-origin: center center !important;
}

@media (max-height: 520px) and (orientation: landscape) {
  body.mode-campaign #victoryModal .modal-paper.defeat-card,
  #victoryModal .modal-paper.defeat-card {
    --defeat-popup-scale: 0.7;
    transform: scale(var(--defeat-popup-scale, 0.7)) !important;
    transform-origin: center center !important;
  }
}

@media (max-height: 500px) {
  body.mode-campaign #victoryModal .modal-paper.defeat-card,
  #victoryModal .modal-paper.defeat-card {
    --defeat-popup-scale: 0.7;
    transform: scale(var(--defeat-popup-scale, 0.7)) !important;
    transform-origin: center center !important;
  }
}

body.phone-landscape-layout #victoryModal .victory-title,
body.is-phone-device.phone-landscape-layout #victoryModal .victory-title,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal .victory-title {
  font-size: 1.45rem !important;
  margin-bottom: 2px !important;
}

body.phone-landscape-layout #victoryModal #victorySubtitle,
body.is-phone-device.phone-landscape-layout #victoryModal #victorySubtitle,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal #victorySubtitle {
  font-size: 0.92rem !important;
  margin: 2px 0 !important;
}

body.phone-landscape-layout #victoryModal .campaign-stars-display,
body.is-phone-device.phone-landscape-layout #victoryModal .campaign-stars-display,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal .campaign-stars-display {
  font-size: 1.4rem !important;
  margin-bottom: 2px !important;
}

body.phone-landscape-layout #victoryModal .campaign-shot-accuracy-badge,
body.is-phone-device.phone-landscape-layout #victoryModal .campaign-shot-accuracy-badge,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal .campaign-shot-accuracy-badge {
  font-size: 0.95rem !important;
  margin-top: 2px !important;
}

body.phone-landscape-layout #campaignVictoryActions.campaign-actions-row,
body.is-phone-device.phone-landscape-layout #campaignVictoryActions.campaign-actions-row,
body.is-phone-device:not(.phone-portrait-layout) #campaignVictoryActions.campaign-actions-row {
  gap: 8px !important;
  margin-top: 4px !important;
  margin-bottom: 4px !important;
}

body.phone-landscape-layout #campaignVictoryActions.campaign-actions-row button,
body.phone-landscape-layout #campaignVictoryActions.campaign-actions-row .doodle-btn,
body.is-phone-device.phone-landscape-layout #campaignVictoryActions.campaign-actions-row button,
body.is-phone-device.phone-landscape-layout #campaignVictoryActions.campaign-actions-row .doodle-btn,
body.is-phone-device:not(.phone-portrait-layout) #campaignVictoryActions.campaign-actions-row button,
body.is-phone-device:not(.phone-portrait-layout) #campaignVictoryActions.campaign-actions-row .doodle-btn {
  font-size: 0.92rem !important;
  padding: 4px 10px !important;
  min-height: 38px !important;
  box-sizing: border-box !important;
}

body.phone-landscape-layout #victoryModal #victoryAdBanner.modal-banner-container,
body.is-phone-device.phone-landscape-layout #victoryModal #victoryAdBanner.modal-banner-container,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal #victoryAdBanner.modal-banner-container {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

body.phone-landscape-layout #victoryModal #victoryAdBanner .ad-banner-inner,
body.is-phone-device.phone-landscape-layout #victoryModal #victoryAdBanner .ad-banner-inner,
body.is-phone-device:not(.phone-portrait-layout) #victoryModal #victoryAdBanner .ad-banner-inner {
  min-height: 36px !important;
  padding: 2px 4px !important;
}

/* ── Google AdSense & H5 Games Ads Styles ──────────────────────── */
.ad-banner-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  margin-top: 6px;
  order: 9999 !important;
  position: relative;
  z-index: 5;
}

/* Prevent Google auto-ads or top anchor ads from appearing above game controls */
ins.adsbygoogle[data-anchor-status="displayed"],
ins.adsbygoogle[data-anchor-shown="true"],
.google-auto-placed,
.adsbygoogle-noablate {
  top: auto !important;
  bottom: 0 !important;
}

.ad-banner-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 728px;
  min-height: 52px;
  background: #fffdfa;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  box-sizing: border-box;
  box-shadow: 1px 2px 0px rgba(0, 0, 0, 0.05);
}

.ad-banner-label {
  font-family: var(--font-doodle, sans-serif);
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.mock-banner-content,
.ad-banner-fallback {
  font-family: var(--font-doodle, sans-serif);
  font-size: 0.88rem;
  color: #475569;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.mock-banner-content code,
.ad-banner-fallback code {
  background: #f1f5f9;
  padding: 1px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.82rem;
}

/* When Google AdSense fills an ad, hide the fallback banner text */
ins.adsbygoogle[data-ad-status="filled"] ~ .ad-banner-fallback,
ins.adsbygoogle iframe ~ .ad-banner-fallback {
  display: none !important;
}

/* Modal Banner Containers (Victory, Online Lobby, Campaign Map) */
.modal-banner-container {
  margin-top: 8px !important;
  margin-bottom: 2px !important;
  padding: 2px 4px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  order: unset !important;
}

.modal-banner-container .ad-banner-inner {
  min-height: 44px !important;
  padding: 2px 6px !important;
  background: #fffdf5 !important;
  border: 1.5px dashed #94a3b8 !important;
}

/* ── Full-Screen Interstitial Mock Ad Modal ──────────────────── */
.mock-ad-backdrop {
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.85) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: opacity, visibility;
}

.mock-ad-backdrop.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.mock-ad-card {
  width: 90%;
  max-width: 440px;
  background: #fffdfa;
  border: 3px solid #1e293b;
  border-radius: 14px;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  padding: 20px;
  box-shadow: 6px 8px 0px #0f172a;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: mockAdPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes mockAdPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.mock-ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed #e2e8f0;
  padding-bottom: 8px;
}

.mock-ad-tag {
  font-family: var(--font-heading, sans-serif);
  font-size: 0.85rem;
  font-weight: bold;
  color: #3b82f6;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 8px;
}

.mock-ad-countdown-wrap {
  font-family: var(--font-doodle, sans-serif);
  font-size: 0.95rem;
  color: #64748b;
}

.mock-ad-countdown-wrap b {
  color: #dc2626;
  font-size: 1.1rem;
}

.mock-ad-body {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.mock-ad-badge {
  font-family: var(--font-doodle, sans-serif);
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.mock-ad-title {
  font-family: var(--font-heading, sans-serif);
  font-size: 1.35rem;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.mock-ad-desc {
  font-family: var(--font-doodle, sans-serif);
  font-size: 1.05rem;
  color: #334155;
  margin: 0 0 14px 0;
  line-height: 1.35;
}

.mock-ad-cta-btn {
  display: inline-block;
  font-family: var(--font-heading, sans-serif);
  font-size: 1.05rem;
  font-weight: bold;
  color: #ffffff;
  background: #2563eb;
  border: 2px solid #1e40af;
  border-radius: 8px;
  padding: 6px 18px;
  box-shadow: 2px 3px 0px #1e40af;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.mock-ad-cta-btn:hover {
  transform: scale(1.04);
}

.mock-ad-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.mock-ad-skip-btn {
  font-family: var(--font-doodle, sans-serif);
  font-size: 1.05rem;
  padding: 6px 18px;
  min-width: 120px;
  text-align: center;
}

.mock-ad-skip-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#testOutput {
  display: none !important;
}

/* ==============================================================================
   Site Compliance & Legal Footer (AdSense & Policy Requirements)
   ============================================================================== */
.site-compliance-footer {
  width: 100%;
  max-width: 960px;
  margin: 16px auto 24px auto;
  padding: 12px 16px;
  text-align: center;
  font-family: var(--font-doodle, 'Patrick Hand', cursive, sans-serif);
  color: #475569;
  font-size: 0.95rem;
  box-sizing: border-box;
  order: 10000 !important;
  position: relative;
  z-index: 5;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-copyright {
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
}

.footer-copyright code {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 5px;
  border-radius: 4px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 12px;
}

.footer-link {
  color: #1e3a8a;
  text-decoration: none;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.footer-link:hover,
.footer-link:focus {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  text-decoration: underline;
}

.footer-sep {
  color: #94a3b8;
  user-select: none;
}

/* ==============================================================================
   Standalone Compliance Documents (privacy.html, terms.html, about.html)
   ============================================================================== */
.compliance-page-body {
  background: #f8fafc;
  min-height: 100vh;
  margin: 0;
  padding: 20px 14px 40px 14px;
  font-family: var(--font-body, 'Caveat', cursive, sans-serif);
  color: #1e293b;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.compliance-container {
  width: 100%;
  max-width: 840px;
  margin: 0 auto;
}

.compliance-nav-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  width: 100%;
}

.compliance-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: var(--font-doodle, 'Patrick Hand', cursive, sans-serif);
  font-size: 1.15rem;
  font-weight: bold;
  color: #0f172a;
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 8px;
  padding: 6px 16px;
  box-shadow: 2px 3px 0px #0f172a;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.compliance-back-btn:hover {
  transform: translateY(-1px);
  box-shadow: 3px 4px 0px #0f172a;
}

.compliance-paper {
  background: #fffdf7;
  border: 2px solid #2b2b2b;
  border-radius: 12px;
  box-shadow: 4px 6px 0px rgba(0, 0, 0, 0.15);
  padding: 36px 36px 36px 82px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.compliance-paper::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50px;
  width: 2px;
  height: 100%;
  background: #f87171;
  opacity: 0.75;
  pointer-events: none;
}

.compliance-header {
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.compliance-title {
  font-family: var(--font-heading, 'Cabin Sketch', cursive, sans-serif);
  font-size: 2.3rem;
  color: #0f172a;
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.compliance-subtitle {
  font-family: var(--font-doodle, 'Patrick Hand', cursive, sans-serif);
  font-size: 1.1rem;
  color: #64748b;
  margin: 0;
}

.compliance-section {
  margin-bottom: 26px;
}

.compliance-section h2 {
  font-family: var(--font-doodle, 'Patrick Hand', cursive, sans-serif);
  font-size: 1.55rem;
  color: #1e3a8a;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compliance-section p,
.compliance-section li {
  font-size: 1.25rem;
  line-height: 1.55;
  color: #334155;
  margin: 0 0 10px 0;
}

.compliance-section ul,
.compliance-section ol {
  padding-left: 28px;
  margin: 0 0 14px 0;
}

.compliance-section a {
  color: #2563eb;
  text-decoration: underline;
  font-weight: bold;
}

.compliance-section a:hover {
  color: #1d4ed8;
}

.compliance-highlight-box {
  background: #f0f9ff;
  border-left: 4px solid #0284c7;
  padding: 12px 18px;
  border-radius: 6px;
  margin: 14px 0;
}

.compliance-highlight-box p {
  margin: 0;
  font-size: 1.15rem;
}

@media (max-width: 600px) {
  .compliance-paper {
    padding: 24px 16px 28px 50px;
  }
  .compliance-paper::before {
    left: 24px;
  }
  .compliance-title {
    font-size: 1.85rem;
  }
  .compliance-section h2 {
    font-size: 1.35rem;
  }
  .compliance-section p,
  .compliance-section li {
    font-size: 1.15rem;
  }
}

/* ═════════════════════════════════════════════════════════════════════════
   100-Level Paper Odyssey Setup & Difficulty Modal
   ═════════════════════════════════════════════════════════════════════════ */
#campaignSetupModal .campaign-setup-card {
  max-width: 560px;
  padding: 22px 26px;
  border-radius: 12px;
  box-sizing: border-box;
}

.campaign-setup-header {
  text-align: center;
  margin-bottom: 12px;
}

.campaign-setup-title {
  font-size: 1.6rem;
  color: #1e293b;
  margin: 0 0 4px 0;
}

.campaign-setup-subtitle {
  font-size: 0.95rem;
  color: #475569;
  margin: 0;
}

.campaign-setup-section {
  margin-bottom: 14px;
  text-align: left;
}

.campaign-setup-label {
  font-family: var(--font-heading, sans-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}

.campaign-name-input-wrap {
  display: flex;
  justify-content: center;
}

.campaign-name-input {
  width: 100%;
  max-width: 320px;
  text-align: center;
  font-size: 1.2rem;
  padding: 8px 14px;
  cursor: text;
  border: 2px solid #334155;
  border-radius: 8px;
  background: #fff;
  font-family: var(--font-heading, sans-serif);
}

.campaign-name-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
}

.campaign-paper-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.campaign-paper-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 8px 10px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
}

.campaign-paper-card:hover {
  transform: translateY(-2px);
  border-color: #94a3b8;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.campaign-paper-card.selected {
  border: 2.5px solid #2563eb;
  background: #eff6ff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.22);
  transform: translateY(-2px);
}

.paper-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.badge-beginner {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-intermediate {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-expert {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.paper-card-icon-preview {
  margin: 4px 0 6px 0;
  display: flex;
  justify-content: center;
}

.paper-card-title {
  font-family: var(--font-heading, sans-serif);
  font-weight: 700;
  font-size: 0.96rem;
  color: #1e293b;
  margin-bottom: 2px;
}

.paper-card-desc {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.25;
  min-height: 38px;
}

.paper-card-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.72rem;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.campaign-paper-card.selected .paper-card-check {
  display: flex;
}

.campaign-setup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}

.btn-start-odyssey {
  font-size: 1.15rem;
  padding: 8px 28px;
}

.btn-cancel-odyssey {
  font-size: 1.05rem;
  padding: 8px 20px;
}

/* Phone Portrait Layout for 100-Level Setup Modal */
@media (max-width: 480px), (orientation: portrait) and (max-width: 600px) {
  body.phone-portrait-layout #campaignSetupModal .campaign-setup-card,
  body.is-phone-device.phone-portrait-layout #campaignSetupModal .campaign-setup-card {
    width: 94% !important;
    max-width: 95vw !important;
    padding: 14px 12px !important;
  }

  body.phone-portrait-layout .campaign-setup-title,
  body.is-phone-device.phone-portrait-layout .campaign-setup-title {
    font-size: 1.35rem !important;
  }

  body.phone-portrait-layout .campaign-setup-subtitle,
  body.is-phone-device.phone-portrait-layout .campaign-setup-subtitle {
    font-size: 0.85rem !important;
  }

  body.phone-portrait-layout .campaign-paper-cards,
  body.is-phone-device.phone-portrait-layout .campaign-paper-cards {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  body.phone-portrait-layout .campaign-paper-card,
  body.is-phone-device.phone-portrait-layout .campaign-paper-card {
    flex-direction: row !important;
    align-items: center !important;
    text-align: left !important;
    padding: 8px 12px !important;
    gap: 10px !important;
  }

  body.phone-portrait-layout .paper-card-desc,
  body.is-phone-device.phone-portrait-layout .paper-card-desc {
    min-height: unset !important;
  }

  body.phone-portrait-layout .paper-card-check,
  body.is-phone-device.phone-portrait-layout .paper-card-check {
    position: static !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }
}

/* Phone Landscape Layout for 100-Level Setup Modal */
body.phone-landscape-layout #campaignSetupModal .campaign-setup-card,
body.is-phone-device.phone-landscape-layout #campaignSetupModal .campaign-setup-card,
@media (max-height: 480px) and (orientation: landscape) {
  #campaignSetupModal .campaign-setup-card {
    max-width: 580px !important;
    max-height: 94vh !important;
    padding: 8px 14px !important;
    overflow: hidden !important;
  }

  #campaignSetupModal .campaign-setup-header {
    margin-bottom: 4px !important;
  }

  #campaignSetupModal .campaign-setup-title {
    font-size: 1.15rem !important;
    margin: 0 !important;
  }

  #campaignSetupModal .campaign-setup-subtitle {
    display: none !important;
  }

  #campaignSetupModal .campaign-setup-section {
    margin-bottom: 5px !important;
  }

  #campaignSetupModal .campaign-name-section {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    margin-bottom: 5px !important;
  }

  #campaignSetupModal .campaign-name-section .campaign-setup-label {
    margin-bottom: 0 !important;
    font-size: 0.9rem !important;
  }

  #campaignSetupModal .campaign-name-input {
    font-size: 0.95rem !important;
    padding: 4px 8px !important;
    max-width: 200px !important;
  }

  #campaignSetupModal .campaign-difficulty-section .campaign-setup-label {
    font-size: 0.86rem !important;
    margin-bottom: 3px !important;
    text-align: center !important;
  }

  #campaignSetupModal .campaign-paper-cards {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
  }

  #campaignSetupModal .campaign-paper-card {
    padding: 6px 4px !important;
    border-radius: 6px !important;
  }

  #campaignSetupModal .paper-card-badge {
    font-size: 0.65rem !important;
    padding: 1px 6px !important;
    margin-bottom: 2px !important;
  }

  #campaignSetupModal .paper-card-icon-preview svg {
    width: 32px !important;
    height: 20px !important;
  }

  #campaignSetupModal .paper-card-title {
    font-size: 0.82rem !important;
  }

  #campaignSetupModal .paper-card-desc {
    font-size: 0.68rem !important;
    line-height: 1.15 !important;
    min-height: unset !important;
  }

  #campaignSetupModal .campaign-setup-actions {
    margin-top: 6px !important;
    gap: 8px !important;
  }

  #campaignSetupModal .btn-start-odyssey {
    font-size: 0.92rem !important;
    padding: 5px 18px !important;
  }

  #campaignSetupModal .btn-cancel-odyssey {
    font-size: 0.88rem !important;
    padding: 5px 14px !important;
  }
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Doodle 101 / Creative Corner - Chapter 1 (Levels 1-10)
   Right-Page Exclusive Theme: Gray graphite pencil drawing studio sketch on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Left page is completely blank */
.notebook-sheet.stage-creative-corner .page-left {
  background-image: none !important;
}

.notebook-sheet.stage-creative-corner .folding-flap.left-flap .flap-face-front {
  background-image: none !important;
}

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-creative-corner .page-right,
.notebook-sheet.stage-creative-corner .under-shadow-right {
  background-image: url('../images/creative_corner_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects theme when folding over right side */
.notebook-sheet.stage-creative-corner .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/creative_corner_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Doodle Gulch (Frontier Camp) - Chapter 2 (Levels 11-20)
   Right-Page Exclusive Theme: Western frontier camp on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-doodle-gulch .page-right,
.notebook-sheet.stage-doodle-gulch .under-shadow-right {
  background-image: url('../images/doodle_gulch_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects Doodle Gulch when folding over right side */
.notebook-sheet.stage-doodle-gulch .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/doodle_gulch_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Dino Valley (Prehistoric Valley) - Chapter 3 (Levels 21-30)
   Right-Page Exclusive Theme: Prehistoric volcanic river valley on Player 2 side
   ═════════════════════════════════════════════════════════════════════════ */

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-dino-valley .page-right,
.notebook-sheet.stage-dino-valley .under-shadow-right {
  background-image: url('../images/dino_valley_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects Dino Valley when folding over right side */
.notebook-sheet.stage-dino-valley .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/dino_valley_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Medieval Realm (Castle Keep) - Chapter 4 (Levels 31-40)
   Right-Page Exclusive Theme: Light grey castle sketches on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-medieval-realm .page-right,
.notebook-sheet.stage-medieval .page-right,
.notebook-sheet.stage-medieval-realm .under-shadow-right,
.notebook-sheet.stage-medieval .under-shadow-right {
  background-image: url('../images/medieval_realm_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects Medieval Realm when folding over right side */
.notebook-sheet.stage-medieval-realm .folding-flap.right-flap .flap-face-front,
.notebook-sheet.stage-medieval .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/medieval_realm_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Construction & Diggers - Chapter 5 (Levels 41-50)
   Right-Page Exclusive Theme: Worksite backdrop in light grey on Player 2 side
   ═════════════════════════════════════════════════════════════════════════ */

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-construction .page-right,
.notebook-sheet.stage-construction .under-shadow-right {
  background-image: url('../images/construction_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects Construction when folding over right side */
.notebook-sheet.stage-construction .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/construction_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Pirate Cove Boss (Level 60 - Pirate Bob)
   Right-Page Exclusive Theme: Gray graphite pencil sailing ships sketch on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Left page is completely blank */
.notebook-sheet.stage-pirate-cove .page-left {
  background-image: none !important;
}

.notebook-sheet.stage-pirate-cove .folding-flap.left-flap .flap-face-front {
  background-image: none !important;
}

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-pirate-cove .page-right,
.notebook-sheet.stage-pirate-cove .under-shadow-right {
  background-image: url('../images/pirate_cove_boss_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects theme when folding over right side */
.notebook-sheet.stage-pirate-cove .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/pirate_cove_boss_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Wizard Study / Doodle Arcana Boss (Level 70 - Wizard Bob)
   Right-Page Exclusive Theme: Light grey sketched wizard study backdrop on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Left page is completely blank */
.notebook-sheet.stage-wizard-study .page-left,
.notebook-sheet.stage-wizard .page-left,
.notebook-sheet.stage-doodle-arcana .page-left {
  background-image: none !important;
}

.notebook-sheet.stage-wizard-study .folding-flap.left-flap .flap-face-front,
.notebook-sheet.stage-wizard .folding-flap.left-flap .flap-face-front,
.notebook-sheet.stage-doodle-arcana .folding-flap.left-flap .flap-face-front {
  background-image: none !important;
}

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-wizard-study .page-right,
.notebook-sheet.stage-wizard .page-right,
.notebook-sheet.stage-doodle-arcana .page-right,
.notebook-sheet.stage-wizard-study .under-shadow-right,
.notebook-sheet.stage-wizard .under-shadow-right,
.notebook-sheet.stage-doodle-arcana .under-shadow-right {
  background-image: url('../images/wizard_study_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects theme when folding over right side */
.notebook-sheet.stage-wizard-study .folding-flap.right-flap .flap-face-front,
.notebook-sheet.stage-wizard .folding-flap.right-flap .flap-face-front,
.notebook-sheet.stage-doodle-arcana .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/wizard_study_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Shadow Dojo (Nightfall) - Chapter 8 Boss (Level 80 - Ninja Bob)
   Right-Page Exclusive Theme: Light grey pagoda & bamboo sketches on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Left page is completely blank */
.notebook-sheet.stage-shadow-dojo .page-left,
.notebook-sheet.stage-ninja .page-left {
  background-image: none !important;
}

.notebook-sheet.stage-shadow-dojo .folding-flap.left-flap .flap-face-front,
.notebook-sheet.stage-ninja .folding-flap.left-flap .flap-face-front {
  background-image: none !important;
}

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-shadow-dojo .page-right,
.notebook-sheet.stage-ninja .page-right,
.notebook-sheet.stage-shadow-dojo .under-shadow-right,
.notebook-sheet.stage-ninja .under-shadow-right {
  background-image: url('../images/shadow_dojo_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects theme when folding over right side */
.notebook-sheet.stage-shadow-dojo .folding-flap.right-flap .flap-face-front,
.notebook-sheet.stage-ninja .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/shadow_dojo_bg.png') !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

/* ═════════════════════════════════════════════════════════════════════════
   Stage Theme: Cosmic Orbit - Chapter 9 Boss (Level 90 - Astronaut Bob)
   Right-Page Exclusive Theme: Light grey cosmic orbit sketches on Player 2 side;
   Left side (Player 1 territory) remains blank.
   ═════════════════════════════════════════════════════════════════════════ */

/* Left page is completely blank */
.notebook-sheet.stage-cosmic-orbit .page-left,
.notebook-sheet.stage-cosmic .page-left {
  background-image: none !important;
}

.notebook-sheet.stage-cosmic-orbit .folding-flap.left-flap .flap-face-front,
.notebook-sheet.stage-cosmic .folding-flap.left-flap .flap-face-front {
  background-image: none !important;
}

/* Theme ONLY on right page (target territory) */
.notebook-sheet.stage-cosmic-orbit .page-right,
.notebook-sheet.stage-cosmic .page-right,
.notebook-sheet.stage-cosmic-orbit .under-shadow-right,
.notebook-sheet.stage-cosmic .under-shadow-right {
  background-image: url('../images/cosmic_orbit_boss_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}

/* Folding flap synchronization: Right flap reflects theme when folding over right side */
.notebook-sheet.stage-cosmic-orbit .folding-flap.right-flap .flap-face-front,
.notebook-sheet.stage-cosmic .folding-flap.right-flap .flap-face-front {
  background-image: url('../images/cosmic_orbit_boss_bg.png') !important;
  background-size: cover !important;
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
}




