@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Press+Start+2P&display=swap');

:root {
  --bg-color: #0d1117;
  --bg-secondary: #161b22;
  --text-main: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --dino-gray: #58a6ff;
  --dino-dark: #1f6feb;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-hover: rgba(88, 166, 255, 0.4);
  --card-bg: rgba(22, 27, 34, 0.75);
  --card-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --btn-primary: #238636;
  --btn-primary-hover: #2ea043;
  --accent-cyan: #00f0ff;
  --accent-neon: #39d353;
  --accent-amber: #f2994a;
  --pixel-font: 'Press Start 2P', monospace;
  --ui-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --admin-font: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --transition-speed: 0.3s;
}

body:not(.night-mode) {
  --bg-color: #f6f8fa;
  --bg-secondary: #ffffff;
  --text-main: #1f2328;
  --text-secondary: #59636e;
  --text-muted: #8c959f;
  --dino-gray: #0969da;
  --dino-dark: #24292f;
  --border-color: rgba(31, 35, 40, 0.12);
  --border-hover: rgba(9, 105, 218, 0.4);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --btn-primary: #1f6feb;
  --btn-primary-hover: #1158c7;
  --accent-cyan: #0969da;
  --accent-neon: #1a7f37;
  --accent-amber: #bc4c00;
}

body.night-mode {
  --bg-color: #0b0f19;
  --bg-secondary: #111827;
  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --dino-gray: #38bdf8;
  --dino-dark: #0284c7;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(56, 189, 248, 0.4);
  --card-bg: rgba(17, 24, 39, 0.8);
  --card-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  --btn-primary: #38bdf8;
  --btn-primary-hover: #7dd3fc;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--ui-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
  user-select: none;
  -webkit-user-select: none;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Lights & Grid */
.bg-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(to right, rgba(128, 128, 128, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(128, 128, 128, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  transition: all 0.5s ease;
}

.glow-top {
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 350px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent 70%);
}

.glow-bottom {
  bottom: -15%;
  right: 15%;
  width: 500px;
  height: 300px;
  background: radial-gradient(circle, rgba(57, 211, 83, 0.25), transparent 70%);
}

/* Ambient Sky Flyers (Multi-directional, Collision-Free Corridors) */
.sky-flyers-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.sky-flyer {
  position: absolute;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.2));
  opacity: 0.85;
}

/* Corridor 1: Right to Left (High Sky ~10%) */
.flyer-rtl-1 {
  top: 10%;
  right: -90px;
  animation: flyRtlHigh 23s linear infinite;
}

/* Corridor 2: Left to Right (Mid-High ~30% - Flipped horizontally) */
.flyer-ltr-1 {
  top: 30%;
  left: -90px;
  animation: flyLtrMid 27s linear infinite;
  animation-delay: 5s;
}

/* Corridor 3: Right to Left (Mid-Low ~54%) */
.flyer-rtl-2 {
  top: 54%;
  right: -90px;
  animation: flyRtlLow 25s linear infinite;
  animation-delay: 11s;
}

/* Corridor 4: Left to Right (Bottom Cruise ~78% - Flipped horizontally) */
.flyer-ltr-2 {
  top: 78%;
  left: -90px;
  animation: flyLtrBottom 30s linear infinite;
  animation-delay: 17s;
}

/* Right to Left High Path */
@keyframes flyRtlHigh {
  0% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(calc(-28vw), -18px, 0); }
  55% { transform: translate3d(calc(-58vw), 15px, 0); }
  80% { transform: translate3d(calc(-82vw), -10px, 0); }
  100% { transform: translate3d(calc(-100vw - 180px), 0, 0); }
}

/* Left to Right Mid Path (Facing Right: scaleX(-1)) */
@keyframes flyLtrMid {
  0% { transform: scaleX(-1) translate3d(0, 0, 0); }
  30% { transform: scaleX(-1) translate3d(calc(32vw), 22px, 0); }
  65% { transform: scaleX(-1) translate3d(calc(68vw), -18px, 0); }
  100% { transform: scaleX(-1) translate3d(calc(100vw + 180px), 4px, 0); }
}

/* Right to Left Mid-Low Path */
@keyframes flyRtlLow {
  0% { transform: translate3d(0, 0, 0); }
  35% { transform: translate3d(calc(-38vw), 20px, 0); }
  70% { transform: translate3d(calc(-72vw), -22px, 0); }
  100% { transform: translate3d(calc(-100vw - 180px), 8px, 0); }
}

/* Left to Right Bottom Path (Facing Right: scaleX(-1)) */
@keyframes flyLtrBottom {
  0% { transform: scaleX(-1) translate3d(0, 0, 0); }
  40% { transform: scaleX(-1) translate3d(calc(42vw), -24px, 0); }
  75% { transform: scaleX(-1) translate3d(calc(76vw), 16px, 0); }
  100% { transform: scaleX(-1) translate3d(calc(100vw + 180px), -6px, 0); }
}

/* Side Floating Retro Game Decorations */
.side-decoration-container {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.side-left {
  left: clamp(16px, 3.5vw, 65px);
}

.side-right {
  right: clamp(16px, 3.5vw, 65px);
}

@media (max-width: 1300px) {
  .side-decoration-container {
    opacity: 0.45;
    transform: translateY(-50%) scale(0.85);
  }
}

@media (max-width: 1100px) {
  .side-decoration-container {
    display: none;
  }
}

.side-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
}

.decor-canvas {
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18));
}

.decor-tag {
  font-family: var(--pixel-font);
  font-size: 8px;
  color: var(--dino-gray);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.float-slow {
  animation: floatAnimSlow 4.5s ease-in-out infinite alternate;
}

.float-medium {
  animation: floatAnimMedium 3.6s ease-in-out infinite alternate;
}

.float-delayed {
  animation: floatAnimDelayed 5.2s ease-in-out infinite alternate;
}

@keyframes floatAnimSlow {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-14px) rotate(1.5deg); }
}

@keyframes floatAnimMedium {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-18px) rotate(-2deg); }
}

@keyframes floatAnimDelayed {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(12px) rotate(1deg); }
}

/* App Header */
.app-header {
  width: 100%;
  max-width: 1200px;
  padding: 20px 24px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--text-main);
  letter-spacing: 0.5px;
  padding: 8px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.version-tag {
  font-size: 9px;
  background: linear-gradient(135deg, #f2994a, #f2c94c);
  color: #000;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.offline-dot {
  width: 10px;
  height: 10px;
  background-color: #39d353;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px #39d353;
  animation: pulse-dot 1.8s infinite;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.icon-btn:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.sound-test-btn:active {
  transform: scale(0.95);
}

/* Views Management */
main {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 5;
  padding: 10px 20px 24px;
}

.view {
  display: none;
  width: 100%;
  max-width: 1040px;
  padding: 10px 20px 30px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Landing View Styles */
.landing-content {
  width: 100%;
  max-width: 820px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 20px;
}

/* Hero Badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pixel-font);
  font-size: 10px;
  color: var(--dino-gray);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-cyan);
}

/* Hero Mascot */
.dino-mascot-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.dino-mascot {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.dino-mascot:hover {
  transform: scale(1.08);
}

.dino-pixel-hero {
  image-rendering: pixelated;
  width: 100px;
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.25));
  animation: mascot-idle 2.4s ease-in-out infinite alternate;
}

@keyframes mascot-idle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.mascot-ground-line {
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin-top: 4px;
}

.offline-status {
  font-family: var(--pixel-font);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.landing-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  color: var(--text-main);
  background: linear-gradient(135deg, var(--text-main) 30%, var(--dino-gray) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 620px;
  margin-bottom: 28px;
}

/* 3D Tactile Pro Arcade Start Button */
.start-btn-container {
  margin-bottom: 36px;
  position: relative;
}

.btn-start-game.pro-glow-btn {
  font-family: var(--pixel-font);
  font-size: 14px;
  padding: 18px 44px;
  background: linear-gradient(180deg, #22272e 0%, #161b22 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 
    0 6px 0 #0d1117,
    0 12px 28px rgba(0, 240, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

body:not(.night-mode) .btn-start-game.pro-glow-btn {
  background: linear-gradient(180deg, #24292f 0%, #1a1f24 100%);
  box-shadow: 
    0 6px 0 #0d1117,
    0 12px 28px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-start-game.pro-glow-btn:hover {
  transform: translateY(-3px);
  border-color: var(--accent-cyan);
  box-shadow: 
    0 9px 0 #0d1117,
    0 16px 36px rgba(0, 240, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-start-game.pro-glow-btn:active {
  transform: translateY(4px);
  box-shadow: 
    0 2px 0 #0d1117,
    0 4px 12px rgba(0, 240, 255, 0.2);
}

.btn-game-icon {
  font-size: 20px;
}

.btn-shortcut-hint {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 3-Step Study Protocol Cards */
.steps-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .steps-container {
    grid-template-columns: 1fr;
  }
}

.step-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 18px;
  text-align: left;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
}

.step-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.15);
}

.step-num {
  font-family: var(--pixel-font);
  font-size: 24px;
  font-weight: 800;
  color: var(--border-color);
  position: absolute;
  top: 14px;
  right: 16px;
  opacity: 0.5;
}

.step-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.step-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Instructions Card */
.instructions-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.card-heading {
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.live-pill {
  font-size: 8px;
  background: #238636;
  color: #ffffff;
  padding: 3px 6px;
  border-radius: 4px;
  animation: pulse-dot 1.5s infinite;
}

.live-test-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -8px;
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .instruction-grid {
    grid-template-columns: 1fr;
  }
}

.inst-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s ease;
}

.inst-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.inst-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.inst-text strong {
  color: var(--text-main);
}

.key-badge-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.key-cap {
  font-family: var(--pixel-font);
  font-size: 11px;
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-bottom: 3px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  transition: all 0.1s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Keycap Active Glowing State when pressed */
.key-cap.active {
  background: var(--dino-dark) !important;
  color: #ffffff !important;
  border-color: var(--accent-cyan) !important;
  border-bottom-width: 1px !important;
  transform: translateY(2px);
  box-shadow: 0 0 12px var(--accent-cyan) !important;
}

/* Research Highlights Pills */
.research-highlights {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.highlight-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

.hl-icon {
  font-size: 14px;
}

  gap: 6px;
}

.key-cap {
  font-family: var(--pixel-font), monospace;
  font-size: 8.5px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-bottom: 2.5px solid var(--dino-gray);
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  white-space: nowrap;
}

.key-cap:hover {
  border-color: var(--dino-dark);
}

.inst-text {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ID Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--card-bg);
  border: 2px solid var(--dino-gray);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  padding: 32px 28px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  position: relative;
  animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--pixel-font);
  font-size: 13px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
}

.id-input {
  width: 100%;
  font-family: var(--pixel-font);
  font-size: 13px;
  padding: 14px 16px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.id-input:focus {
  border-color: var(--dino-dark);
  box-shadow: 0 0 0 3px rgba(83, 83, 83, 0.15);
}

.input-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.input-error {
  font-size: 12px;
  color: var(--accent-red);
  display: none;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.btn-start-submit {
  flex: 1;
  font-family: var(--pixel-font);
  font-size: 12px;
  padding: 14px 20px;
  background: var(--dino-dark);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.btn-start-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

body.night-mode .btn-start-submit {
  background: #8ab4f8;
  color: #1a1a1a;
}

#gameView {
  max-width: 1260px;
  width: 100%;
}

.game-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.game-top-bar {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pixel-font);
  font-size: 11px;
  color: var(--text-main);
  background: var(--bg-color);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.canvas-wrapper {
  width: 100%;
  max-width: 1200px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  transition: filter 0.4s ease;
}

body.night-mode #gameCanvas,
body.night-mode #landingMascotCanvas {
  filter: invert(0.92);
}

.game-controls-helper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.game-controls-helper span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Mobile Touch Bar */
.mobile-controls {
  display: none;
  gap: 16px;
  width: 100%;
  max-width: 400px;
  margin-top: 12px;
}

.mobile-btn {
  flex: 1;
  font-family: var(--pixel-font);
  font-size: 12px;
  padding: 16px;
  background: var(--card-bg);
  border: 2px solid var(--dino-gray);
  border-radius: 8px;
  color: var(--text-main);
  cursor: pointer;
  touch-action: manipulation;
}

.mobile-btn:active {
  background: var(--dino-gray);
  color: #fff;
}

@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }
  .landing-title {
    font-size: 22px;
  }
  .instruction-grid {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.app-footer {
  width: 100%;
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* ---------------------------------------------------- */
/* Game Top Bar & Attempts Indicator                   */
/* ---------------------------------------------------- */
.player-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.attempt-chip {
  font-family: var(--pixel-font);
  font-size: 11px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--btn-primary);
  font-weight: 700;
}

.admin-link-btn {
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------------------------------------------------- */
/* Attempt Result Modal                                 */
/* ---------------------------------------------------- */
#attemptResultModal {
  background: var(--bg-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
}

.result-modal-box {
  max-width: 480px;
}

.result-stats-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  font-family: var(--pixel-font);
  font-size: 14px;
  font-weight: 700;
}

.highlight-score {
  color: var(--accent-green);
  font-size: 18px;
}

.highlight-green {
  color: var(--accent-green) !important;
}

.result-message {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 20px;
}

/* ---------------------------------------------------- */
/* Admin Panel & Dashboard                              */
/* ---------------------------------------------------- */
.admin-body {
  background-color: var(--bg-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================================
   ADMIN PANEL STYLES (Modern Inter / Clean UI Typography)
   ======================================================== */
.admin-header,
.admin-main,
.admin-view,
.dashboard-container,
.login-card,
.kpi-card,
.breakdown-card,
.table-section-card,
.dino-table,
.dino-table th,
.dino-table td,
.search-input,
.filter-select,
.btn-export-action {
  font-family: var(--admin-font) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.admin-header {
  max-width: 1200px;
  border-bottom-color: var(--border-color);
  background: var(--card-bg);
}

.admin-main {
  width: 100%;
  max-width: 1100px;
  flex: 1;
  padding: 0 20px 40px;
  display: flex;
  flex-direction: column;
}

.admin-view {
  display: none;
  width: 100%;
}

.admin-view.active {
  display: block;
}

/* Admin Login Card */
.login-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px 30px;
  box-shadow: var(--card-shadow);
  text-align: center;
}

.login-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.login-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.login-header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-form {
  text-align: left;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.login-hint {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-color);
  padding: 10px;
  border-radius: 8px;
}

.login-hint code {
  font-family: var(--pixel-font);
  font-size: 10px;
  background: var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.dash-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary-action {
  background: var(--btn-primary);
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.btn-primary-action:hover {
  opacity: 0.9;
}

.btn-export-action {
  background: #059669;
  color: #ffffff;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
  letter-spacing: -0.01em;
}

.btn-export-action:hover {
  opacity: 0.9;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--card-shadow);
}

.kpi-icon {
  font-size: 26px;
  background: var(--bg-color);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.kpi-sub-stats {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.sub-stat-pill {
  font-size: 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 500;
}

.sub-stat-pill strong {
  color: var(--accent-green, #059669);
  font-size: 13px;
  font-weight: 700;
  margin-left: 2px;
}

/* Learning Curve Breakdown */
.breakdown-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.breakdown-item {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
}

.breakdown-num {
  font-size: 13px;
  color: var(--btn-primary);
  margin-bottom: 8px;
  font-weight: 600;
}

.breakdown-stats {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-stats div {
  display: flex;
  justify-content: space-between;
}

.breakdown-stats strong {
  font-size: 13px;
  font-weight: 600;
}

.empty-breakdown {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 10px;
}

/* Participants Table Section */
.table-section-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}

.search-box {
  flex: 1;
  min-width: 260px;
}

.search-input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.search-input:focus {
  border-color: var(--btn-primary);
}

.filter-group {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.filter-select:focus {
  border-color: var(--btn-primary);
}

/* Dino Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.dino-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.dino-table th {
  padding: 12px 14px;
  background: var(--bg-color);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.sortable-th:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}

body.night-mode .sortable-th:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sort-icon {
  display: inline-block;
  font-size: 11px;
  margin-left: 5px;
  color: #94a3b8;
  vertical-align: middle;
  transition: color 0.2s, transform 0.2s;
}

.sortable-th.active-sort {
  color: var(--accent-green, #059669);
  background: rgba(5, 150, 105, 0.05);
}

.sortable-th.active-sort .sort-icon {
  color: var(--accent-green, #059669);
  font-weight: 700;
}

.dino-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  font-size: 14px;
  font-weight: 400;
}

.dino-table tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

body.night-mode .dino-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.code-badge {
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-color);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: inline-block;
  white-space: nowrap;
}

.status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.status-active {
  background: #dbeafe;
  color: #1e40af;
}

body.night-mode .status-active {
  background: #1e3a8a;
  color: #bfdbfe;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

body.night-mode .status-completed {
  background: #064e3b;
  color: #a7f3d0;
}

.score-chip {
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-color);
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: inline-block;
  min-width: 52px;
  text-align: center;
  white-space: nowrap;
}

.empty-chip {
  color: #94a3b8;
  font-weight: 400;
  font-size: 14px;
}

.total-score-badge {
  font-size: 14px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
  display: inline-block;
  min-width: 65px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(5, 150, 105, 0.1);
}

body.night-mode .total-score-badge {
  background: #064e3b;
  border-color: #059669;
  color: #6ee7b7;
}

.btn-action-reset {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-reset:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

body.night-mode .btn-action-reset:hover {
  background: #7f1d1d;
  border-color: #b91c1c;
  color: #fecaca;
}

.rotating {
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------------------------------------------------- */
/* Action Buttons in Table & Edit Modal                 */
/* ---------------------------------------------------- */
.action-btns-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-action-edit,
.btn-action-delete {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-action-edit {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.btn-action-edit:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}

body.night-mode .btn-action-edit {
  background: #1e3a8a;
  border-color: #2563eb;
  color: #93c5fd;
}

body.night-mode .btn-action-edit:hover {
  background: #1d4ed8;
  color: #ffffff;
}

.btn-action-delete {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-action-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

body.night-mode .btn-action-delete {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}

body.night-mode .btn-action-delete:hover {
  background: #991b1b;
  color: #ffffff;
}

/* Modal Overlay & Container */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-form {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-action-cancel {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-action-cancel:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.night-mode .btn-action-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========================================================
   RESULTS & LEADERBOARD VIEW STYLES
   ======================================================== */
.results-main {
  width: 100%;
  max-width: 960px;
  padding: 10px 20px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
}

.results-section {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#btnResultContinue {
  display: none !important;
}

#btnResultExit {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  margin: 0 auto !important;
}

/* ========================================================
   COMPREHENSIVE RESPONSIVE ENGINE (< 768px & < 480px)
   ======================================================== */
@media (max-width: 768px) {
  html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden !important;
    position: relative;
  }

  /* App Shell & Header */
  .app-header {
    padding: 12px 14px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .brand-badge {
    padding: 6px 10px;
    font-size: 9.5px;
    gap: 6px;
  }

  .brand-badge .version-tag {
    font-size: 7.5px;
    padding: 1px 4px;
  }

  .header-actions {
    gap: 6px;
    display: flex;
    align-items: center;
  }

  .icon-btn {
    padding: 6px 10px;
    font-size: 11.5px;
    gap: 4px;
    border-radius: 14px;
    white-space: nowrap;
  }

  .sound-test-btn {
    padding: 6px 8px;
  }

  main,
  .results-main,
  .admin-main {
    width: 100% !important;
    max-width: 100vw !important;
    padding: 0 10px 24px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .view {
    width: 100% !important;
    max-width: 100% !important;
    padding: 6px 4px 20px !important;
    box-sizing: border-box !important;
  }

  /* Landing Screen Typography & Layout */
  .landing-content {
    width: 100% !important;
    padding: 4px 2px 16px !important;
    box-sizing: border-box !important;
  }

  .hero-badge {
    font-size: 8.5px;
    padding: 6px 12px;
    margin-bottom: 12px;
  }

  .dino-mascot-wrapper {
    margin-bottom: 12px;
  }

  .dino-pixel-hero {
    width: 76px;
  }

  .offline-status {
    font-size: 9.5px;
    letter-spacing: 1px;
    margin-bottom: 6px;
  }

  .landing-title {
    font-size: 24px !important;
    margin-bottom: 8px;
    line-height: 1.25;
  }

  .landing-desc {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 18px;
    padding: 0 4px;
  }

  .start-btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
  }

  .btn-start-game.pro-glow-btn {
    width: 100%;
    max-width: 320px;
    padding: 15px 18px;
    font-size: 12px;
    justify-content: center;
    gap: 8px;
  }

  /* Protocol Step Cards */
  .steps-container {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
    width: 100%;
  }

  .step-card {
    padding: 14px 16px;
    border-radius: 12px;
  }

  .step-num {
    font-size: 18px;
    top: 10px;
    right: 14px;
  }

  .step-icon {
    font-size: 20px;
    margin-bottom: 6px;
  }

  .step-title {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .step-desc {
    font-size: 12px;
  }

  /* Instructions Card */
  .instructions-card {
    padding: 16px 12px;
    border-radius: 12px;
    margin-bottom: 16px;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .card-heading {
    font-size: 9.5px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .instruction-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
  }

  .inst-item {
    padding: 12px;
    border-radius: 10px;
    gap: 8px;
  }

  .inst-text {
    font-size: 12px;
  }

  .key-cap {
    font-size: 9px;
    padding: 4px 8px;
  }

  /* Research Highlights */
  .research-highlights {
    gap: 6px;
    width: 100%;
  }

  .highlight-item {
    font-size: 10px;
    padding: 6px 10px;
    gap: 6px;
  }

  /* Gameplay Screen Mobile Optimization */
  .game-container {
    width: 100%;
    padding: 0;
    gap: 10px;
    box-sizing: border-box;
  }

  .game-top-bar {
    padding: 8px 10px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .player-chip,
  .attempt-chip {
    font-size: 9px;
    padding: 5px 8px;
  }

  .canvas-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    border-width: 1.5px;
    border-radius: 8px;
    box-sizing: border-box;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1200 / 250;
    display: block;
  }

  .game-controls-helper {
    font-size: 11px;
    gap: 10px;
  }

  .mobile-controls {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px;
    margin-top: 6px;
    box-sizing: border-box;
  }

  .mobile-btn {
    flex: 1;
    min-height: 54px;
    padding: 14px 8px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  /* Dashboard & Results Page Mobile */
  .dashboard-header {
    margin-bottom: 14px !important;
    width: 100%;
    box-sizing: border-box;
  }

  .dash-title {
    font-size: 20px !important;
    line-height: 1.25;
    margin-bottom: 4px;
  }

  .dash-subtitle {
    font-size: 11.5px;
    line-height: 1.4;
  }

  /* Compact 2x2 KPI Grid on Mobile */
  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .kpi-card {
    padding: 10px 8px !important;
    gap: 8px !important;
    border-radius: 10px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .kpi-content {
    min-width: 0 !important;
    overflow: hidden;
  }

  .kpi-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .kpi-label {
    font-size: 10px !important;
    line-height: 1.2 !important;
    word-break: break-word;
  }

  .kpi-value {
    font-size: 16px !important;
  }

  /* Table Section & Scroll Containment */
  .table-section-card {
    padding: 8px 6px !important;
    border-radius: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .table-toolbar {
    padding: 8px 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .search-box {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .search-input {
    width: 100% !important;
    padding: 9px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  /* Smooth Touch Momentum Table Scrolling */
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 8px !important;
    display: block !important;
    box-sizing: border-box !important;
  }

  .dino-table {
    min-width: 440px !important;
    width: 100% !important;
    border-collapse: collapse;
  }

  .dino-table th,
  .dino-table td {
    padding: 8px 6px !important;
    font-size: 11.5px !important;
  }

  .code-badge {
    font-size: 10.5px !important;
    padding: 3px 6px !important;
  }

  .score-chip,
  .empty-chip {
    font-size: 10.5px !important;
    padding: 3px 6px !important;
    min-width: 32px !important;
  }

  .total-score-badge {
    font-size: 11.5px !important;
    padding: 3px 6px !important;
  }

  .status-badge {
    font-size: 9.5px !important;
    padding: 3px 5px !important;
  }

  .table-footer-info {
    padding: 8px 10px !important;
    font-size: 10px !important;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start !important;
  }

  /* Modal Mobile Adaptations */
  .modal-box {
    width: 92% !important;
    max-width: 380px !important;
    padding: 22px 16px !important;
    border-radius: 12px !important;
  }

  .id-input {
    font-size: 16px !important;
    padding: 12px 14px !important;
  }
}

@media (max-width: 380px) {
  .landing-title {
    font-size: 20px !important;
  }

  .kpi-label {
    font-size: 9px !important;
  }

  .kpi-value {
    font-size: 14px !important;
  }

  .dino-table {
    min-width: 400px !important;
  }
}

/* ==========================================================================
   AGE CATEGORY SELECTION & ADMIN FILTER STYLES
   ========================================================================== */

/* Participant Modal: Age Selection Grid */
.age-select-group {
  margin-top: 14px;
  animation: fadeIn 0.25s ease-out;
}

.age-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.age-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  text-align: center;
}

.age-option-btn:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.15);
}

.age-option-btn.selected {
  border-color: #2563eb;
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.12), rgba(16, 185, 129, 0.08));
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35), 0 8px 20px rgba(37, 99, 235, 0.2);
  transform: translateY(-2px);
}

.age-option-btn .age-icon {
  font-size: 24px;
  margin-bottom: 4px;
  transition: transform 0.2s ease;
}

.age-option-btn:hover .age-icon,
.age-option-btn.selected .age-icon {
  transform: scale(1.15);
}

.age-option-btn .age-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.age-option-btn .age-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

.age-option-btn.selected .age-title {
  color: #2563eb;
}

body.night-mode .age-option-btn.selected .age-title {
  color: #60a5fa;
}

/* Existing Participant Age Badge (Attempts 2 and 3) */
.existing-age-badge {
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(16, 185, 129, 0.08));
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  animation: fadeIn 0.25s ease-out;
}

.existing-age-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.existing-age-icon {
  font-size: 22px;
}

.existing-age-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.existing-age-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Age Badges in Tables (Admin & Results) */
.badge-age {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.badge-age-kichik {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-age-orta {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-age-yuqori {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-age-none {
  background: rgba(107, 114, 128, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(107, 114, 128, 0.25);
}

/* Admin Panel Filter Select for Age */
.filter-select-age {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  min-width: 190px;
}

.filter-select-age:hover,
.filter-select-age:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 500px) {
  .age-options-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .age-option-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    text-align: left;
  }
  .age-option-btn .age-icon {
    margin-bottom: 0;
  }
  .filter-select-age {
    width: 100%;
  }
}
