/* ==========================================================================
   Find the Mistake - Interactive Video Game Stylesheet
   Landing Dashboard & Distraction-Free Landscape Gameplay
   Theme: Tactical Safety Gold & Smoked Slate (Clean, Human-Designed)
   ========================================================================== */

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tactical Theme Surfaces */
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.92);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glass-bright: rgba(255, 255, 255, 0.22);

  /* Primary Accent: Safety Gold / Hazard Amber */
  --primary: #f59e0b;
  --primary-glow: rgba(245, 158, 11, 0.35);
  --primary-light: #fbbf24;
  --primary-dark: #d97706;

  --accent-cyan: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-orange: #f97316;

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.35);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-dark: #090d16;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-lg: 0 20px 45px -10px rgba(0, 0, 0, 0.8);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html,
body {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-main);
  color: var(--text-main);
  touch-action: manipulation;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #030712;
  background-image:
    linear-gradient(rgba(7, 10, 19, 0.72), rgba(3, 7, 18, 0.85)),
    url('assets/hazard-spotter-game-assets/home-bg.webp');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* Ambient Background Light */
.ambient-glow {
  position: fixed;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

/* ==========================================================================
   Portrait Warning Overlay
   ========================================================================== */
.portrait-warning-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: rgba(3, 7, 18, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

@media screen and (orientation: portrait) {
  .portrait-warning-overlay {
    display: flex !important;
  }
}

.portrait-warning-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-glass-bright);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-lg);
  animation: floatCard 3s ease-in-out infinite;
}

.rotate-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  animation: rotatePhone 2.5s infinite ease-in-out;
}

.rotate-icon-wrapper svg {
  width: 42px;
  height: 42px;
  fill: var(--primary);
}

.portrait-warning-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}

.portrait-warning-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

@keyframes rotatePhone {
  0% {
    transform: rotate(0deg);
  }

  35% {
    transform: rotate(-90deg);
  }

  65% {
    transform: rotate(-90deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

@keyframes floatCard {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* ==========================================================================
   Screen 1: Landing Dashboard (Clean, Focused, Responsive 2-Column Grid)
   ========================================================================== */
.landing-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 1.5vh, 16px);
  z-index: 100;
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  box-sizing: border-box;
  overflow-y: auto;
}

.landing-view.hidden,
.landing-view.hidden * {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.landing-card-container {
  width: 95%;
  max-width: 780px;
  max-height: 94dvh;
  background: rgba(18, 24, 38, 0.96);
  border: 1px solid var(--border-glass-bright);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.8vh, 14px);
  padding: clamp(10px, 2.2vh, 18px) clamp(12px, 2.5vw, 22px);
  overflow-y: auto;
  box-sizing: border-box;
}

.landing-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo-icon {
  width: clamp(32px, 5vh, 40px);
  height: clamp(32px, 5vh, 40px);
  min-width: clamp(32px, 5vh, 40px);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.brand-logo-icon svg {
  width: 60%;
  height: 60%;
  fill: #090d16;
}

.brand-title-text h1 {
  font-size: clamp(1rem, 2.4vh, 1.35rem);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
}

.brand-title-text span {
  font-size: clamp(0.64rem, 1.2vh, 0.72rem);
  color: var(--primary-light);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  display: block;
}

.landing-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-toggle-btn {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: clamp(0.66rem, 1.2vh, 0.74rem);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-toggle-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: var(--primary-light);
  color: var(--primary-light);
}

.icon-toggle-btn.highlight-fullscreen-prompt {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.35)) !important;
  border: 1.5px solid var(--primary-light) !important;
  color: #fff !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  animation: fullscreenHighlightPulse 2s infinite ease-in-out;
}

.icon-toggle-btn.highlight-fullscreen-prompt svg {
  color: var(--primary-light);
  filter: drop-shadow(0 0 3px var(--primary-light));
}

.icon-toggle-btn.highlight-fullscreen-prompt:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.55)) !important;
  border-color: #fef08a !important;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.75);
}

@keyframes fullscreenHighlightPulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3), inset 0 0 6px rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.7);
  }

  50% {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.7), inset 0 0 12px rgba(245, 158, 11, 0.3);
    border-color: #fef08a;
  }
}

.icon-toggle-btn.is-fullscreen {
  background: rgba(30, 41, 59, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  animation: none !important;
}

.icon-toggle-btn.is-fullscreen:hover {
  background: rgba(51, 65, 85, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  color: #fff !important;
}

.scenario-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: clamp(0.68rem, 1.2vh, 0.74rem);
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
}

/* 2-Column Responsive Body Grid */
.landing-body-grid {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: clamp(10px, 2vw, 16px);
  align-items: stretch;
}

@media (max-width: 580px) and (orientation: portrait) {
  .landing-body-grid {
    grid-template-columns: 1fr;
  }
}

.rules-summary {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: clamp(8px, 1.5vh, 12px) clamp(10px, 1.5vw, 14px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.rules-summary h3 {
  font-size: clamp(0.72rem, 1.35vh, 0.8rem);
  text-transform: uppercase;
  color: var(--primary-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.rules-list {
  list-style: none;
  font-size: clamp(0.7rem, 1.3vh, 0.78rem);
  color: var(--text-muted);
  line-height: 1.4;
}

.rules-list li {
  position: relative;
  padding-left: 12px;
  margin-bottom: 3px;
}

.rules-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

.landing-action-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(6px, 1.4vh, 10px);
}

.audio-controls-panel {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: clamp(6px, 1.2vh, 8px) clamp(8px, 1.4vw, 12px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quick-toggles-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(0.68rem, 1.2vh, 0.76rem);
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
}

.bgm-volume-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.vol-label {
  font-size: clamp(0.64rem, 1.1vh, 0.72rem);
  color: var(--text-muted);
  white-space: nowrap;
}

.vol-label strong {
  color: var(--primary-light);
  font-family: var(--font-mono);
}

.vol-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(51, 65, 85, 0.8);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.vol-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 17px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(51, 65, 85, 0.8);
  transition: .3s;
  border-radius: 18px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 11px;
  width: 11px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary);
}

input:checked+.slider:before {
  transform: translateX(15px);
}

.play-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: clamp(8px, 1.8vh, 12px) 16px;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #d97706 100%);
  color: var(--text-dark);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: clamp(0.85rem, 1.8vh, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 6px 20px -3px rgba(245, 158, 11, 0.45);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.play-action-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 24px -3px rgba(245, 158, 11, 0.6);
}

.play-action-btn:active {
  transform: translateY(1px) scale(0.99);
}

.play-action-btn svg {
  width: clamp(15px, 2.5vh, 20px);
  height: clamp(15px, 2.5vh, 20px);
  fill: currentColor;
}

.landing-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: clamp(0.66rem, 1.2vh, 0.72rem);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition-fast);
}

.link-btn.install-btn-active {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--primary-light);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-weight: 600;
}

.link-btn.install-btn-active:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--primary);
  color: #fff;
}

.standalone-badge {
  font-size: clamp(0.64rem, 1.1vh, 0.7rem);
  color: #34d399;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* ==========================================================================
   Screen 2: Pure Distraction-Free 16:9 Game Viewport
   ========================================================================== */
.game-viewport {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
}

.game-viewport.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

.game-viewport:not(.active),
.game-viewport:not(.active) * {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.stage-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc(100dvh * (16 / 9));
  max-height: calc(100dvw * (9 / 16));
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.9), 0 0 0 1px var(--border-glass);
}

.video-canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-video {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none !important;
  user-select: none;
  -webkit-user-select: none;
}

/* In-Stage Fullscreen Button */
.stage-fullscreen-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-glass-bright);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 35000 !important;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.stage-fullscreen-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: var(--primary);
  color: var(--primary-light);
  transform: scale(1.08);
}

/* Sleek Action Prompt Banner / Top Floating Timer */
.action-prompt-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(13, 20, 36, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(245, 158, 11, 0.55);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(245, 158, 11, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 25000 !important;
  opacity: 0;
  pointer-events: none !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.action-prompt-banner.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.prompt-icon {
  font-size: 0.95rem;
}

.prompt-text {
  font-size: clamp(0.72rem, 1.3vh, 0.84rem);
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.prompt-text:empty,
.prompt-icon:empty {
  display: none !important;
}

.action-prompt-banner.success-feedback {
  background: rgba(10, 28, 20, 0.95) !important;
  border-color: rgba(16, 185, 129, 0.7) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(16, 185, 129, 0.35) !important;
  padding: 6px 18px !important;
}

.action-prompt-banner.success-feedback .prompt-text {
  color: #34d399 !important;
}

.action-prompt-banner.failure-feedback {
  background: rgba(32, 16, 20, 0.95) !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(239, 68, 68, 0.35) !important;
  padding: 6px 18px !important;
}

.action-prompt-banner.failure-feedback .prompt-text {
  color: #f87171 !important;
}

.action-prompt-banner.times-up-feedback {
  background: rgba(45, 12, 16, 0.96) !important;
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(239, 68, 68, 0.4) !important;
  padding: 6px 18px !important;
}

.action-prompt-banner.times-up-feedback .prompt-text {
  color: #fca5a5 !important;
}

/* Prominent Timer Pill */
.prompt-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  padding: 2px 4px;
  border-radius: var(--radius-full);
  margin: 0;
  transition: all 0.2s ease;
}

.timer-ring-svg {
  width: 22px;
  height: 22px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 2.8;
}

.timer-ring-progress {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2.8;
  stroke-dasharray: 56.55;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.08s linear, stroke 0.25s ease;
}

.timer-countdown-val {
  font-family: var(--font-mono);
  font-size: clamp(0.88rem, 1.6vh, 1rem);
  font-weight: 900;
  color: #fbbf24;
  min-width: 28px;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1;
}

.prompt-timer-pill.urgent {
  animation: timerPulseUrgent 0.4s infinite alternate;
}

.prompt-timer-pill.urgent .timer-ring-progress {
  stroke: #ef4444;
}

.prompt-timer-pill.urgent .timer-countdown-val {
  color: #fca5a5;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.prompt-timer-pill.paused {
  border-color: rgba(59, 130, 246, 0.7);
  background: rgba(30, 58, 138, 0.4);
}

.prompt-timer-pill.paused .timer-ring-progress {
  stroke: #60a5fa;
}

.prompt-timer-pill.paused .timer-countdown-val {
  color: #93c5fd;
}

@keyframes timerPulseUrgent {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
  }
}

/* ==========================================================================
   Interactive Invisible Target Hit-Areas Over Video (Pure Scene View)
   ========================================================================== */
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  z-index: 9999 !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  background: transparent !important;
  box-shadow: none !important;
}

.grid-overlay.active {
  display: grid !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: crosshair;
  visibility: visible !important;
}

.grid-overlay:not(.active),
.grid-overlay:not(.active) * {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.grid-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 10000 !important;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  min-height: 0;
  min-width: 0;
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.grid-cell:hover,
.grid-cell:focus {
  background: rgba(245, 158, 11, 0.08);
  border: 1.5px dashed rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
}

.grid-cell:active {
  background: rgba(245, 158, 11, 0.2);
}

.grid-overlay.grid-locked .grid-cell:not(.selected-user) {
  pointer-events: none !important;
  cursor: default !important;
}

.grid-cell.selected-user {
  background: rgba(245, 158, 11, 0.3) !important;
  border: 2.5px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.55), inset 0 0 20px rgba(245, 158, 11, 0.35) !important;
  border-radius: var(--radius-sm) !important;
  animation: cellSelectedPulse 0.5s infinite alternate;
}

.grid-cell.cell-correct {
  background: rgba(16, 185, 129, 0.45) !important;
  border: 3px solid #10b981 !important;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.8), inset 0 0 25px rgba(16, 185, 129, 0.5) !important;
  border-radius: var(--radius-sm) !important;
  animation: cellResultPulse 0.6s infinite alternate;
  z-index: 10010 !important;
}

.grid-cell.cell-wrong {
  background: rgba(239, 68, 68, 0.45) !important;
  border: 3px solid #ef4444 !important;
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.8), inset 0 0 25px rgba(239, 68, 68, 0.5) !important;
  border-radius: var(--radius-sm) !important;
  animation: cellResultPulse 0.6s infinite alternate;
  z-index: 10010 !important;
}

/* Dev Mode Grid Outlines */
body.dev-mode-active .grid-overlay {
  background: rgba(0, 0, 0, 0.18) !important;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.5) !important;
}

body.dev-mode-active .grid-cell {
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.cell-number-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(3, 7, 18, 0.8);
  color: #fff;
  font-size: clamp(11px, 1.6vw, 15px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

@keyframes cellResultPulse {
  0% {
    transform: scale(0.97);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes cellSelectedPulse {
  0% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
  }
}

/* ==========================================================================
   Answer Confirmation Prompt Banner
   ========================================================================== */
.selection-confirm-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 25000 !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 92%;
}

.selection-confirm-banner.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.confirm-content {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(245, 158, 11, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 14px);
  white-space: nowrap;
}

.confirm-text {
  font-size: clamp(0.68rem, 1.3vh, 0.8rem);
  font-weight: 600;
  color: #fff;
}

.confirm-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: clamp(0.66rem, 1.2vh, 0.74rem);
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.confirm-btn.retap-btn {
  background: rgba(51, 65, 85, 0.85);
  border: 1px solid var(--border-glass-bright);
  color: var(--text-main);
}

.confirm-btn.retap-btn:hover {
  background: rgba(71, 85, 105, 0.95);
}

.confirm-btn.lock-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: var(--text-dark);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.confirm-btn.lock-btn:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

/* ==========================================================================
   Bottom Explanation Banner
   ========================================================================== */
.bottom-explanation-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 25000 !important;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-full);
  padding: 5px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90%;
  opacity: 0;
  pointer-events: none !important;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-explanation-banner.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.explanation-icon {
  font-size: 0.9rem;
}

.explanation-text {
  font-size: clamp(0.68rem, 1.3vh, 0.8rem);
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  text-align: center;
}

/* ==========================================================================
   Screen 3: In-Video Lower-Third HUD Dock (Pixel-Perfect Alignment)
   ========================================================================== */
.invideo-hud-dock {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  width: calc(100% - 24px);
  max-width: 900px;
  z-index: 30000 !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.invideo-hud-dock.timeout-hud,
.invideo-hud-dock:has(.hud-dock-content.timeout) {
  bottom: 35%;
}

.invideo-hud-dock.active {
  display: block !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  transform: translateX(-50%) translateY(0) !important;
}

.invideo-hud-dock:not(.active),
.invideo-hud-dock:not(.active) * {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.hud-dock-content {
  background: rgba(13, 20, 36, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  box-sizing: border-box;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hud-dock-content.success {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(16, 185, 129, 0.2);
  background: linear-gradient(90deg, rgba(8, 28, 20, 0.95) 0%, rgba(15, 23, 42, 0.96) 65%, rgba(15, 23, 42, 0.96) 100%);
}

.hud-dock-content.failure {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(239, 68, 68, 0.2);
  background: linear-gradient(90deg, rgba(34, 12, 16, 0.95) 0%, rgba(15, 23, 42, 0.96) 65%, rgba(15, 23, 42, 0.96) 100%);
}

.hud-dock-content.timeout {
  border-color: rgba(239, 68, 68, 0.55) !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(239, 68, 68, 0.25) !important;
  background: linear-gradient(90deg, rgba(34, 12, 16, 0.95) 0%, rgba(15, 23, 42, 0.96) 65%, rgba(15, 23, 42, 0.96) 100%) !important;
}

.hud-dock-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.hud-dock-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.hud-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  line-height: 1.1;
  flex-shrink: 0;
}

.hud-dock-content.success .hud-status-badge {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.hud-dock-content.failure .hud-status-badge {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.hud-dock-content.timeout .hud-status-badge {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
  animation: timerPulseUrgent 0.6s infinite alternate;
}

.hud-divider-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.hud-scenario-title {
  font-size: clamp(0.8rem, 1.2vw, 0.88rem);
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* Show scenario title and divider dot ONLY when timer is up */
.hud-dock-content:not(.timeout) .hud-scenario-title,
.hud-dock-content:not(.timeout) .hud-divider-dot {
  display: none !important;
}

.hud-dock-content.timeout .hud-scenario-title {
  display: block !important;
}

.hud-dock-content.timeout .hud-divider-dot {
  display: block !important;
}

.hud-explanation {
  font-size: clamp(0.72rem, 1.05vw, 0.78rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hud-dock-content.success .hud-explanation {
  color: #d1fae5;
}

.hud-dock-content.failure .hud-explanation {
  color: #fecaca;
}

.hud-dock-content.timeout .hud-explanation {
  display: none !important;
}

.hud-dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}

.hud-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

.hud-btn-icon,
.hud-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

.hud-btn-icon:hover,
.hud-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  transform: translateY(-1px);
}

.hud-btn-icon:active,
.hud-btn-secondary:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.1);
}

.hud-btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #0f172a;
  font-weight: 800;
  padding: 0 16px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

.hud-btn-primary:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.55);
  transform: translateY(-1px);
}

.hud-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Modal: PWA Installation Guide
   ========================================================================== */
.install-guide-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 12px;
  box-sizing: border-box;
}

.install-guide-modal.active {
  display: flex !important;
}

.install-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.install-modal-card {
  position: relative;
  width: 95%;
  max-width: 480px;
  max-height: 92dvh;
  background: #111827;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  z-index: 10;
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

@keyframes popIn {
  0% {
    transform: scale(0.94);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.install-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.install-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-modal-icon {
  font-size: 1.2rem;
}

.install-modal-title h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.install-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.install-modal-close:hover {
  color: #fff;
}

.install-modal-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.install-tabs {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.install-tab-btn {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.install-tab-btn.active {
  background: var(--primary);
  color: var(--text-dark);
}

.install-tab-pane {
  display: none;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.install-tab-pane.active {
  display: block;
}

.install-step-list {
  font-size: 0.76rem;
  color: var(--text-main);
  line-height: 1.45;
  padding-left: 18px;
}

.install-step-list li {
  margin-bottom: 4px;
}

.install-step-list strong {
  color: var(--primary-light);
}

.install-modal-actions {
  margin-top: 2px;
}

.modal-fullscreen-btn {
  width: 100%;
  padding: 8px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-glass-bright);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-fullscreen-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glass-bright);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   iOS / Mobile Immersive & Pseudo Fullscreen Fallback
   ========================================================================== */
html.pseudo-fullscreen,
body.pseudo-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.pseudo-fullscreen .landing-view {
  padding: clamp(4px, 1vh, 10px) env(safe-area-inset-right, 0px) clamp(4px, 1vh, 10px) env(safe-area-inset-left, 0px);
}

body.pseudo-fullscreen .game-viewport {
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}

body.pseudo-fullscreen .stage-wrapper {
  max-width: 100vw;
  max-width: 100dvw;
  max-height: 100vh;
  max-height: 100dvh;
}

/* Standalone PWA adjustments for iOS & Android */
@media all and (display-mode: standalone) {
  .landing-view {
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  }

  .game-viewport {
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  }
}

/* ==========================================================================
   TUTORIAL / DEMO SCENE STYLES
   ========================================================================== */

/* Skip Tutorial Button */
.skip-tutorial-btn {
  position: absolute;
  top: 10px;
  right: 48px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--primary-light);
  font-family: var(--font-main);
  font-size: 0.72rem;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 35000 !important;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.skip-tutorial-btn:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--primary);
  color: #ffffff;
  transform: translateY(-1px);
}

body.tutorial-mode-active .skip-tutorial-btn {
  display: flex !important;
}

/* Tutorial Floating Guide Banner */
.tutorial-guide-banner {
  position: absolute;
  top: clamp(14px, 2.8vh, 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 35000 !important;
  background: rgba(9, 14, 26, 0.96);
  border: 2px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 25px rgba(245, 158, 11, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-full);
  padding: clamp(8px, 1.5vh, 12px) clamp(18px, 2.5vw, 28px);
  display: none;
  align-items: center;
  gap: 12px;
  max-width: 92%;
  pointer-events: none;
  animation: tutorialBannerPop 0.45s cubic-bezier(0.16, 1, 0.3, 1), tutorialBannerGlow 2.5s infinite ease-in-out alternate;
}

body.tutorial-mode-active .tutorial-guide-banner.active {
  display: flex !important;
}

@keyframes tutorialBannerPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.92);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes tutorialBannerGlow {
  0% {
    border-color: rgba(245, 158, 11, 0.7);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 18px rgba(245, 158, 11, 0.3);
  }

  100% {
    border-color: #fbbf24;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.9), 0 0 32px rgba(245, 158, 11, 0.65);
  }
}

.tutorial-guide-banner .guide-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #090d16;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.3vw, 0.85rem);
  font-weight: 900;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.5);
}

.tutorial-guide-banner .guide-msg {
  font-family: var(--font-main);
  font-size: clamp(0.72rem, 1.7vw, 1.15rem);
  /* 0.92rem, 1.7vw, 1.15rem */
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Tutorial Hand / Spotlight Pointer */
.tutorial-pointer {
  position: absolute;
  z-index: 32000 !important;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translate(-50%, -50%);
}

.tutorial-pointer.active {
  opacity: 1;
  visibility: visible;
}

.pointer-hand {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 10px rgba(245, 158, 11, 0.6));
  animation: pointerBounce 1.2s infinite ease-in-out;
  transform-origin: center bottom;
  z-index: 1000;
}

@keyframes pointerBounce {

  0%,
  100% {
    transform: translateY(20px) scale(1.1);
  }

  50% {
    transform: translateY(15px) scale(0.8);
  }
}

.pointer-ping {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(245, 158, 11, 0.8);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
  animation: pointerRipple 1.3s cubic-bezier(0, 0.2, 0.8, 1) infinite;
  top: 35%;
  /*50%*/
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes pointerRipple {
  0% {
    width: 10px;
    height: 10px;
    opacity: 1;
  }

  100% {
    width: 70px;
    height: 70px;
    opacity: 0;
  }
}

.pointer-label {
  opacity: 0;
  margin-top: 20px;
  /*4px*/
  background: rgba(15, 23, 42, 0.9);
  color: var(--primary-light);
  border: 1px solid rgba(245, 158, 11, 0.6);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

/* Tutorial Highlighted Grid Tile Effect */
body.tutorial-mode-active .grid-cell.tutorial-target-tile {
  background: rgba(245, 158, 11, 0.28) !important;
  border: 2px solid #fbbf24 !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.7), inset 0 0 15px rgba(245, 158, 11, 0.4) !important;
  animation: targetTileGlow 1s infinite alternate;
}

@keyframes targetTileGlow {
  0% {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4), inset 0 0 10px rgba(245, 158, 11, 0.2);
  }

  100% {
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.9), inset 0 0 25px rgba(245, 158, 11, 0.6);
    border-color: #ffffff;
  }
}

/* Tutorial Graduation Modal */
.tutorial-graduation-modal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 40000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-graduation-modal.active {
  opacity: 1;
  visibility: visible;
}

.graduation-card {
  background: rgba(18, 24, 38, 0.96);
  border: 1.5px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: clamp(14px, 3vh, 24px) clamp(16px, 3vw, 28px);
  max-width: 440px;
  width: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tutorial-graduation-modal.active .graduation-card {
  transform: scale(1);
}

.graduation-badge {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.45);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.graduation-title {
  font-size: clamp(1.1rem, 2.2vh, 1.35rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.graduation-desc {
  font-size: clamp(0.74rem, 1.3vh, 0.82rem);
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.graduation-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.graduation-retry-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.graduation-retry-btn:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: rgba(245, 158, 11, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.graduation-start-btn {
  flex: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.graduation-start-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.6);
}

/* ==========================================================================
   TABLET & HIGH-RESOLUTION LANDSCAPE OPTIMIZATIONS
   (For Tablets, iPads, Desktops: e.g. 1024px+, 1280px+, 1920x1200, etc.)
   ========================================================================== */
@media (min-width: 768px) and (min-height: 480px) {

  /* Landing View Scaling */
  .landing-card-container {
    max-width: 880px;
    padding: 24px 32px;
    gap: 18px;
    border-radius: var(--radius-lg);
  }

  .brand-logo-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
  }

  .brand-title-text h1 {
    font-size: 1.55rem;
  }

  .brand-title-text span {
    font-size: 0.82rem;
  }

  .icon-toggle-btn {
    font-size: 0.85rem;
    padding: 6px 14px;
  }

  .scenario-badge {
    font-size: 0.85rem;
    padding: 5px 14px;
  }

  .rules-summary {
    padding: 16px 20px;
  }

  .rules-summary h3 {
    font-size: 0.96rem;
    margin-bottom: 10px;
  }

  .rules-list {
    font-size: 0.92rem;
    line-height: 1.6;
  }

  .rules-list li {
    margin-bottom: 6px;
    padding-left: 16px;
  }

  .audio-controls-panel {
    padding: 12px 18px;
    gap: 10px;
  }

  .toggle-item {
    font-size: 0.92rem;
    gap: 8px;
  }

  .switch {
    width: 38px;
    height: 20px;
  }

  .slider:before {
    height: 14px;
    width: 14px;
  }

  input:checked+.slider:before {
    transform: translateX(18px);
  }

  .vol-label {
    font-size: 0.88rem;
  }

  .play-action-btn {
    font-size: 1.15rem;
    padding: 14px 24px;
    gap: 10px;
  }

  .play-action-btn svg {
    width: 22px;
    height: 22px;
  }

  .link-btn {
    font-size: 0.85rem;
  }

  .link-btn.install-btn-active {
    padding: 6px 14px;
  }

  /* Stage / Gameplay HUD & Overlays */
  .stage-fullscreen-btn {
    width: 42px;
    height: 42px;
    top: 14px;
    right: 14px;
  }

  .stage-fullscreen-btn svg {
    width: 18px;
    height: 18px;
  }

  .skip-tutorial-btn {
    height: 42px;
    font-size: 0.88rem;
    padding: 0 16px;
    top: 14px;
    right: 64px;
  }

  .tutorial-guide-banner {
    top: 18px;
    padding: 8px 24px;
    gap: 10px;
  }

  .tutorial-guide-banner .guide-badge {
    font-size: 0.78rem;
    padding: 3px 10px;
  }

  .tutorial-guide-banner .guide-msg {
    font-size: 1.05rem;
  }

  .prompt-timer-pill {
    padding: 6px 16px;
    gap: 10px;
  }

  .timer-ring-svg {
    width: 28px;
    height: 28px;
  }

  .timer-countdown-val {
    font-size: 1.2rem;
    min-width: 34px;
  }

  .selection-confirm-banner {
    bottom: 22px;
  }

  .confirm-content {
    padding: 8px 22px;
    gap: 18px;
  }

  .confirm-text {
    font-size: 1.05rem;
  }

  .confirm-btn {
    font-size: 0.92rem;
    padding: 8px 16px;
    gap: 6px;
  }

  .bottom-explanation-banner {
    bottom: 20px;
    padding: 10px 24px;
  }

  .explanation-icon {
    font-size: 1.2rem;
  }

  .explanation-text {
    font-size: 0.98rem;
  }

  .hud-dock-content {
    min-height: 66px;
    padding: 12px 22px;
    border-radius: 18px;
  }

  .hud-status-badge {
    font-size: 0.85rem;
    padding: 4px 12px;
  }

  .hud-scenario-title {
    font-size: 1.08rem;
  }

  .hud-explanation {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .hud-btn {
    height: 40px;
    min-height: 40px;
    font-size: 0.92rem;
    padding: 0 18px;
    gap: 8px;
  }

  .pointer-hand {
    font-size: 3.2rem;
  }

  .pointer-label {
    font-size: 0.92rem;
    padding: 4px 12px;
    margin-top: 24px;
  }

  .tutorial-guide-banner {
    top: 24px;
    padding: 12px 30px;
    gap: 14px;
  }

  .tutorial-guide-banner .guide-badge {
    font-size: 0.88rem;
    padding: 5px 14px;
  }

  .tutorial-guide-banner .guide-msg {
    font-size: 1.15rem;
  }

  .graduation-card {
    max-width: 540px;
    padding: 30px 40px;
    gap: 16px;
  }

  .graduation-badge {
    font-size: 0.82rem;
    padding: 4px 14px;
  }

  .graduation-title {
    font-size: 1.6rem;
  }

  .graduation-desc {
    font-size: 1rem;
    line-height: 1.55;
  }

  .graduation-actions {
    gap: 14px;
    margin-top: 12px;
  }

  .graduation-retry-btn {
    font-size: 1rem;
    padding: 14px 22px;
  }

  .graduation-start-btn {
    font-size: 1.08rem;
    padding: 14px 26px;
  }
}

/* ==========================================================================
   DEMO MODE CINEMATIC INTRO SCREEN (Full pitch-black with center 'DEMO MODE')
   ========================================================================== */
.demo-intro-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background-color: #000000 !important;
  background: #000000 !important;
  z-index: 1000000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s ease;
}

.demo-intro-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto;
  transition: none;
  /* Instant 100% solid black on trigger */
}

.demo-intro-overlay.fading-out {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s ease !important;
}

/* Hide all UI banners, guide badges and controls while demo intro is active */
body.demo-intro-active .tutorial-guide-banner,
body.demo-intro-active .stage-top-controls,
body.demo-intro-active .skip-tutorial-btn,
body.demo-intro-active .action-prompt-banner,
body.demo-intro-active .selection-confirm-banner,
body.demo-intro-active .invideo-hud-dock,
body.demo-intro-active .tutorial-pointer {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.demo-intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.demo-intro-overlay.active .demo-intro-content {
  animation: demoIntroTextCinematic 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes demoIntroTextCinematic {
  0% {
    opacity: 0;
    transform: scale(0.86);
    letter-spacing: 0.1em;
  }

  20% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.05);
    letter-spacing: 0.22em;
  }
}

.demo-intro-tag {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.4vw, 0.92rem);
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--primary-light);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 5px 16px;
  border-radius: var(--radius-full);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.demo-intro-title {
  font-family: var(--font-main);
  font-size: clamp(2.4rem, 6.5vw, 4.8rem);
  font-weight: 900;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0;
  padding: 0 20px;
  line-height: 1.1;
  text-shadow:
    0 0 25px rgba(255, 255, 255, 0.5),
    0 0 60px rgba(245, 158, 11, 0.5),
    0 4px 14px rgba(0, 0, 0, 0.9);
}

.demo-intro-line {
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: var(--radius-full);
  box-shadow: 0 0 14px var(--primary);
  animation: demoIntroLineExpand 1.6s ease-out forwards;
}

@keyframes demoIntroLineExpand {
  0% {
    width: 20px;
    opacity: 0.4;
  }

  100% {
    width: 140px;
    opacity: 1;
  }
}
/* App title artwork: full landscape composition without scrolling. */
html,body{overflow:hidden;overscroll-behavior:none}body{font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
#landingView{padding:0!important;background:#372266;align-items:center;justify-content:center}.landing-card-container{display:none!important}
.hazard-home{position:relative;width:min(100vw,calc(100dvh * 1672 / 941));aspect-ratio:1672/941;max-height:100dvh;margin:auto;overflow:hidden}.hazard-home-bg{display:block;width:100%;height:100%;object-fit:contain}
#startPlayBtn{position:absolute;left:35%;top:65%;transform:translate(-50%,-50%);width:clamp(125px,20vw,340px);border:0;padding:0;background:none;cursor:pointer;transition:filter .2s,transform .2s;z-index:2}#startPlayBtn img{display:block;width:100%;height:auto}#startPlayBtn:hover{filter:brightness(1.12)}#startPlayBtn:active{transform:translate(-50%,-50%) scale(.95)}#startPlayBtn:disabled{opacity:.6}
.hazard-exit{position:absolute;top:max(10px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));display:grid;place-items:center;width:36px;height:36px;border-radius:10px;border:1px solid #ffffff6b;background:#40186eae;color:white;text-decoration:none;font-size:25px}
#installPwaBtn,#installModal,.dev-controls{display:none!important}button,a{-webkit-tap-highlight-color:transparent}button:focus-visible,a:focus-visible{outline:3px solid #e6b5ff;outline-offset:4px}

/* Centre Start in the clear area between the subtitle and instruction strip. */
#startPlayBtn{left:36.8%;top:68%;width:clamp(150px,24vw,400px)}
