/* ==========================================================================
   MINIMALIST MATCHING GAME - MODERN STYLES
   Matches the uploaded screenshot design aesthetic
   ========================================================================== */

:root {
  --bg-app: #ebeef2;
  --bg-card: #ffffff;
  --color-dark: #222a36;
  --color-border: #2c3847;
  --color-active: #5ee432;
  /* Vibrant lime green border & line */
  --color-active-glow: rgba(94, 228, 50, 0.45);
  --color-error: #ff4757;
  --color-gray: #8892a0;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-active: 0 0 0 3px rgba(94, 228, 50, 0.5), 0 8px 20px rgba(94, 228, 50, 0.3);
  --radius-card: 20px;
  --radius-pill: 50px;
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  font-family: var(--font-main);
  color: var(--color-dark);
}

/* App Outer Container */
.game-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background-color: var(--bg-app);
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 580px;
  height: 100%;
  max-height: 840px;
  background-color: #f7f9fb;
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Top App Header */
.game-header {
  position: relative;
  z-index: 10;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-group-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 96px;
}

.header-group-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 96px;
}

.header-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  color: #37474f;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.header-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.header-btn:active {
  transform: scale(0.92);
}

.header-btn svg {
  width: 28px;
  height: 28px;
  stroke: #455a64;
  stroke-width: 2.2;
}

/* Close Game Button in Fullscreen & In-Game Header */
.header-btn.btn-close-game {
  color: #64748b;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-btn.btn-close-game svg {
  stroke: #64748b;
  stroke-width: 2.5;
  transition: stroke 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-btn.btn-close-game:hover {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.header-btn.btn-close-game:hover svg {
  stroke: #ef4444;
  transform: rotate(90deg);
}

.header-btn.btn-close-game:active {
  transform: scale(0.9);
  background-color: rgba(239, 68, 68, 0.22);
}

.header-btn.btn-close-game:active svg {
  stroke: #dc2626;
}

/* Exit button inside Pause Modal */
.btn-exit-action {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.32) !important;
  background: rgba(239, 68, 68, 0.04) !important;
}

.btn-exit-action:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #dc2626 !important;
}

/* Quiz Pill Badge */
.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  background: #ffffff;
  border: 2px solid #2f3640;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  max-width: 62%;
  min-width: 0;
}

.level-badge-text {
  font-size: clamp(0.92rem, 2.5vw, 1.22rem);
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #2f3640;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sub-header order indicator / hint banner */
.order-indicator {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 0 16px 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #546e7a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.order-badge-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid #cfd8dc;
  font-size: 0.8rem;
}

.order-badge-step .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-active);
  box-shadow: 0 0 6px var(--color-active);
}

/* Main Playing Area with Cards & Connecting Lines */
.game-play-area {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 48px 24px;
}

/* Canvas / SVG Line Overlay */
.connection-svg,
.connection-svg * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  z-index: 2;
  overflow: visible;
}

.connection-line {
  stroke: var(--color-active);
  stroke-width: 5.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(94, 228, 50, 0.45));
  transition: stroke 0.2s ease;
}

.connection-line.active-drag {
  stroke: #48cf28;
  stroke-dasharray: 6 3;
  animation: lineDash 0.8s linear infinite;
}

.connection-line.wrong-match {
  stroke: var(--color-error);
  filter: drop-shadow(0 2px 4px rgba(255, 71, 87, 0.5));
}

@keyframes lineDash {
  to {
    stroke-dashoffset: -18;
  }
}

/* Item Columns */
.column-items {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  height: 100%;
  width: clamp(74px, 22vw, 130px);
  gap: clamp(8px, 1.8vh, 18px);
  z-index: 3;
}

/* Item Cards - Fluid and perfectly proportioned */
.match-card {
  position: relative;
  width: clamp(72px, 22vw, 120px);
  height: clamp(72px, 22vw, 120px);
  max-height: 22vh;
  aspect-ratio: 1 / 1;
  border-radius: clamp(14px, 3.5vw, 22px);
  border: 2px solid #2f3640;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  touch-action: none;
  flex-shrink: 1;
}

.match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

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

.match-card img,
.match-card svg {
  width: 76%;
  height: 76%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.card-letter-text {
  font-size: clamp(3.2rem, 9.5vw, 5.2rem);
  font-weight: 900;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.01em;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.card-calc-text {
  font-size: clamp(1.15rem, 3.2vw, 1.55rem);
  font-weight: 900;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px 6px;
  box-sizing: border-box;
}

.card-calc-text.calc-medium {
  font-size: clamp(0.96rem, 2.5vw, 1.25rem);
  letter-spacing: -0.025em;
  padding: 4px 6px;
}

.card-calc-text.calc-long {
  font-size: clamp(0.82rem, 2.1vw, 1.05rem);
  letter-spacing: -0.03em;
  padding: 4px 6px;
}

.card-calc-text.calc-xl {
  font-size: clamp(0.64rem, 1.6vw, 0.82rem);
  letter-spacing: -0.04em;
  padding: 2px 4px;
  max-width: 100%;
}

/* Numeric Digits */
.card-digit-medium {
  font-size: clamp(1.35rem, 3.8vw, 1.85rem);
  font-weight: 900;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
}

.card-digit-long {
  font-size: clamp(1.05rem, 2.8vw, 1.38rem);
  font-weight: 900;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.025em;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.07);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
}

.card-digit-xl {
  font-size: clamp(0.74rem, 1.9vw, 0.98rem);
  font-weight: 900;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
}

.card-word-short {
  font-size: clamp(1.35rem, 3.8vw, 1.95rem);
  font-weight: 800;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px 6px;
  box-sizing: border-box;
}

.card-word-medium {
  font-size: clamp(1.12rem, 2.9vw, 1.45rem);
  font-weight: 800;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1.1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.07);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px 6px;
  box-sizing: border-box;
}

.card-word-long {
  font-size: clamp(0.86rem, 2.1vw, 1.1rem);
  font-weight: 800;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1.15;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px 6px;
  box-sizing: border-box;
}

.card-word-xl {
  font-size: clamp(0.68rem, 1.7vw, 0.88rem);
  font-weight: 800;
  color: #0f172a;
  user-select: none;
  pointer-events: none;
  line-height: 1.1;
  font-family: 'Fredoka', 'Quicksand', 'Nunito', system-ui, sans-serif;
  letter-spacing: -0.025em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-align: center;
  padding: 4px 4px;
  box-sizing: border-box;
}




/* Selected / Connecting Highlight */
.match-card.selected {
  border-color: var(--color-active);
  border-width: 3.5px;
  box-shadow: var(--shadow-active);
  transform: scale(1.05);
}

/* Matched State */
.match-card.matched {
  border-color: var(--color-active);
  border-width: 3.5px;
  box-shadow: 0 4px 14px rgba(94, 228, 50, 0.35);
}

/* Wrong Order / Error Shake */
.match-card.shake {
  animation: cardShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  border-color: var(--color-error);
}

@keyframes cardShake {

  10%,
  90% {
    transform: translate3d(-3px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(5px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-5px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(5px, 0, 0);
  }
}

/* Floating Clapping Badge Tile */
.clapping-badge {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.45), 0 0 15px rgba(255, 255, 255, 0.6);
  border: 2px solid #ffffff;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  animation: clappingPop 1.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.clapping-badge .clapping-icon {
  font-size: 1.4em;
  display: inline-block;
  animation: handClap 0.25s infinite alternate ease-in-out;
}

@keyframes clappingPop {
  0% {
    transform: translate(-50%, -50%) scale(0.4) rotate(-6deg);
    opacity: 0;
  }

  20% {
    transform: translate(-50%, -60%) scale(1.15) rotate(3deg);
    opacity: 1;
  }

  40% {
    transform: translate(-50%, -65%) scale(1) rotate(0deg);
    opacity: 1;
  }

  80% {
    transform: translate(-50%, -85%) scale(1.02);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -105%) scale(0.85);
    opacity: 0;
  }
}

@keyframes handClap {
  0% {
    transform: scale(1) rotate(0deg);
  }

  100% {
    transform: scale(1.25) rotate(-10deg);
  }
}

/* Connection Anchor Dots on cards */
.anchor-dot {
  position: absolute;
  width: clamp(8px, 2vw, 11px);
  height: clamp(8px, 2vw, 11px);
  border-radius: 50%;
  background-color: #2f3640;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s, background-color 0.2s, transform 0.2s;
}

.column-left .anchor-dot {
  right: -5px;
}

.column-right .anchor-dot {
  left: -5px;
}

.match-card.selected .anchor-dot,
.match-card.matched .anchor-dot {
  opacity: 1;
  background-color: var(--color-active);
  transform: translateY(-50%) scale(1.2);
}

/* ==========================================================================
   SCREEN 1: 3D LEVEL SELECTION SCREEN (Before actual level starts)
   ========================================================================== */

.level-select-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 0%, #ffffff 0%, #f1f5f9 100%);
  overflow: hidden;
  z-index: 10;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.level-select-screen.hidden {
  display: none !important;
}

.level-select-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.level-select-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(94, 228, 50, 0.15) 0%, rgba(46, 213, 115, 0.08) 100%);
  border: 1px solid rgba(94, 228, 50, 0.35);
  box-shadow: 0 2px 8px rgba(94, 228, 50, 0.15);
}

.brand-chip-sparkle {
  font-size: 0.95rem;
}

.brand-chip-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #15803d;
}

.level-select-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 24px;
}

.level-select-banner {
  text-align: center;
  margin-bottom: 18px;
}

.level-select-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #475569;
  background: #ffffff;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  margin-bottom: 6px;
}

.level-select-title {
  font-size: clamp(1.45rem, 4vw, 1.85rem);
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.level-select-desc {
  font-size: 0.88rem;
  font-weight: 500;
  color: #64748b;
}

/* 3D Level Cards Grid */
.level-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  perspective: 1000px;
  padding: 4px 2px 12px;
}

/* 3D Level Card */
.level-card-3d {
  position: relative;
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 22px;
  border: 2px solid #e2e8f0;
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform-style: preserve-3d;
  box-shadow:
    0 6px 0 #cbd5e1,
    0 12px 24px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.2s ease;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.level-card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-25deg);
  transition: left 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 5;
}

.level-card-3d:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 14px 0 #cbd5e1,
    0 24px 36px rgba(15, 23, 42, 0.16),
    0 0 24px var(--theme-glow, rgba(94, 228, 50, 0.4)),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  border-color: var(--theme-color, #5ee432);
}

.level-card-3d:hover::before {
  left: 150%;
}

.level-card-3d:active {
  transform: translateY(2px) scale(0.98);
  box-shadow:
    0 2px 0 #cbd5e1,
    0 6px 12px rgba(15, 23, 42, 0.1);
}

.level-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 3D Orb for Level Number */
.level-orb-3d {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: var(--theme-gradient, linear-gradient(135deg, #5ee432, #2ed573));
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.22),
    0 8px 16px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.level-meta {
  flex: 1;
  min-width: 0;
}

.level-difficulty-badge {
  font-size: 0.76rem;
  color: #f59e0b;
  letter-spacing: 2.5px;
  margin-bottom: 3px;
}

.level-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.3px;
}

.level-pairs-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.05);
  color: #475569;
}

/* Mini Item Preview Chips */
.level-preview-thumbnails {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(241, 245, 249, 0.85);
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
}

.level-preview-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  flex-shrink: 0;
}

.level-preview-chip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.level-preview-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-left: 2px;
}

/* 3D Play Button Inside Level Card */
.btn-level-play-3d {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 13px;
  background: var(--btn-gradient, linear-gradient(135deg, #5ee432, #2ed573));
  color: #0f172a;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.5px;
  box-shadow:
    0 4px 0 var(--btn-shadow, #15803d),
    0 6px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s ease;
  pointer-events: none;
}

.level-card-3d:hover .btn-level-play-3d {
  box-shadow:
    0 5px 0 var(--btn-shadow, #15803d),
    0 10px 20px var(--theme-glow, rgba(94, 228, 50, 0.4));
  transform: translateY(-1px);
}

.btn-play-icon {
  font-size: 0.85rem;
}

/* Theme variables for the 5 levels */
.theme-level-1 {
  --theme-color: #5ee432;
  --theme-gradient: linear-gradient(135deg, #5ee432 0%, #10b981 100%);
  --theme-glow: rgba(94, 228, 50, 0.4);
  --btn-gradient: linear-gradient(135deg, #5ee432 0%, #2ed573 100%);
  --btn-shadow: #15803d;
}

.theme-level-2 {
  --theme-color: #ff9f43;
  --theme-gradient: linear-gradient(135deg, #ff9f43 0%, #ee5253 100%);
  --theme-glow: rgba(255, 159, 67, 0.45);
  --btn-gradient: linear-gradient(135deg, #ff9f43 0%, #ee5253 100%);
  --btn-shadow: #b91c1c;
}

.theme-level-3 {
  --theme-color: #00f2fe;
  --theme-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --theme-glow: rgba(0, 242, 254, 0.45);
  --btn-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  --btn-shadow: #1d4ed8;
}

.theme-level-4 {
  --theme-color: #a855f7;
  --theme-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --theme-glow: rgba(168, 85, 247, 0.45);
  --btn-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --btn-shadow: #581c87;
}

.theme-level-5 {
  --theme-color: #f59e0b;
  --theme-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --theme-glow: rgba(245, 158, 11, 0.45);
  --btn-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --btn-shadow: #9a3412;
}

.theme-level-6 {
  --theme-color: #ec4899;
  --theme-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --theme-glow: rgba(236, 72, 153, 0.45);
  --btn-gradient: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --btn-shadow: #9f1239;
}

.theme-level-7 {
  --theme-color: #06b6d4;
  --theme-gradient: linear-gradient(135deg, #06b6d4 0%, #0d9488 100%);
  --theme-glow: rgba(6, 182, 212, 0.45);
  --btn-gradient: linear-gradient(135deg, #06b6d4 0%, #0d9488 100%);
  --btn-shadow: #0f766e;
}

.theme-level-8 {
  --theme-color: #6366f1;
  --theme-gradient: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
  --theme-glow: rgba(99, 102, 241, 0.45);
  --btn-gradient: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
  --btn-shadow: #3730a3;
}

.theme-level-9 {
  --theme-color: #10b981;
  --theme-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --theme-glow: rgba(16, 185, 129, 0.45);
  --btn-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --btn-shadow: #065f46;
}

.theme-level-10 {
  --theme-color: #f97316;
  --theme-gradient: linear-gradient(135deg, #fb923c 0%, #dc2626 100%);
  --theme-glow: rgba(249, 115, 22, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb923c 0%, #dc2626 100%);
  --btn-shadow: #991b1b;
}

.theme-level-11 {
  --theme-color: #0284c7;
  --theme-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --theme-glow: rgba(2, 132, 199, 0.45);
  --btn-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --btn-shadow: #075985;
}

.theme-level-12 {
  --theme-color: #8b5cf6;
  --theme-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --theme-glow: rgba(139, 92, 246, 0.45);
  --btn-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --btn-shadow: #5b21b6;
}

.theme-level-13 {
  --theme-color: #eab308;
  --theme-gradient: linear-gradient(135deg, #fde047 0%, #ca8a04 100%);
  --theme-glow: rgba(234, 179, 8, 0.45);
  --btn-gradient: linear-gradient(135deg, #fde047 0%, #ca8a04 100%);
  --btn-shadow: #854d0e;
}

.theme-level-14 {
  --theme-color: #d946ef;
  --theme-gradient: linear-gradient(135deg, #e879f9 0%, #c026d3 100%);
  --theme-glow: rgba(217, 70, 239, 0.45);
  --btn-gradient: linear-gradient(135deg, #e879f9 0%, #c026d3 100%);
  --btn-shadow: #86198f;
}

.theme-level-15 {
  --theme-color: #14b8a6;
  --theme-gradient: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%);
  --theme-glow: rgba(20, 184, 166, 0.45);
  --btn-gradient: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%);
  --btn-shadow: #115e59;
}

.theme-level-16 {
  --theme-color: #f43f5e;
  --theme-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --theme-glow: rgba(244, 63, 94, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --btn-shadow: #9f1239;
}

.theme-level-17 {
  --theme-color: #3b82f6;
  --theme-gradient: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --theme-glow: rgba(59, 130, 246, 0.45);
  --btn-gradient: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --btn-shadow: #1e40af;
}

.theme-level-18 {
  --theme-color: #f97316;
  --theme-gradient: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  --theme-glow: rgba(249, 115, 22, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  --btn-shadow: #9a3412;
}

.theme-level-19 {
  --theme-color: #10b981;
  --theme-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --theme-glow: rgba(16, 185, 129, 0.45);
  --btn-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --btn-shadow: #065f46;
}

.theme-level-20 {
  --theme-color: #d97706;
  --theme-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  --theme-glow: rgba(217, 119, 6, 0.45);
  --btn-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  --btn-shadow: #78350f;
}

.theme-level-21 {
  --theme-color: #8b5cf6;
  --theme-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --theme-glow: rgba(139, 92, 246, 0.45);
  --btn-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --btn-shadow: #5b21b6;
}

.theme-level-22 {
  --theme-color: #06b6d4;
  --theme-gradient: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  --theme-glow: rgba(6, 182, 212, 0.45);
  --btn-gradient: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  --btn-shadow: #0e7490;
}

.theme-level-23 {
  --theme-color: #ec4899;
  --theme-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --theme-glow: rgba(236, 72, 153, 0.45);
  --btn-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --btn-shadow: #9d174d;
}

.theme-level-24 {
  --theme-color: #eab308;
  --theme-gradient: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
  --theme-glow: rgba(234, 179, 8, 0.45);
  --btn-gradient: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
  --btn-shadow: #854d0e;
}

.theme-level-25 {
  --theme-color: #6366f1;
  --theme-gradient: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
  --theme-glow: rgba(99, 102, 241, 0.45);
  --btn-gradient: linear-gradient(135deg, #818cf8 0%, #4f46e5 100%);
  --btn-shadow: #3730a3;
}

.theme-level-26 {
  --theme-color: #14b8a6;
  --theme-gradient: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);
  --theme-glow: rgba(20, 184, 166, 0.45);
  --btn-gradient: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);
  --btn-shadow: #115e59;
}

.theme-level-27 {
  --theme-color: #f43f5e;
  --theme-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --theme-glow: rgba(244, 63, 94, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --btn-shadow: #9f1239;
}

.theme-level-28 {
  --theme-color: #0284c7;
  --theme-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --theme-glow: rgba(2, 132, 199, 0.45);
  --btn-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --btn-shadow: #075985;
}

.theme-level-29 {
  --theme-color: #84cc16;
  --theme-gradient: linear-gradient(135deg, #a3e635 0%, #65a30d 100%);
  --theme-glow: rgba(132, 204, 22, 0.45);
  --btn-gradient: linear-gradient(135deg, #a3e635 0%, #65a30d 100%);
  --btn-shadow: #4d7c0f;
}

.theme-level-30 {
  --theme-color: #d97706;
  --theme-gradient: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
  --theme-glow: rgba(217, 119, 6, 0.45);
  --btn-gradient: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
  --btn-shadow: #78350f;
}

.theme-level-31 {
  --theme-color: #a855f7;
  --theme-gradient: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
  --theme-glow: rgba(168, 85, 247, 0.45);
  --btn-gradient: linear-gradient(135deg, #c084fc 0%, #9333ea 100%);
  --btn-shadow: #6b21a8;
}

.theme-level-32 {
  --theme-color: #0ea5e9;
  --theme-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --theme-glow: rgba(14, 165, 233, 0.45);
  --btn-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  --btn-shadow: #0369a1;
}

.theme-level-33 {
  --theme-color: #f59e0b;
  --theme-gradient: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  --theme-glow: rgba(245, 158, 11, 0.45);
  --btn-gradient: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
  --btn-shadow: #92400e;
}

.theme-level-34 {
  --theme-color: #ef4444;
  --theme-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  --theme-glow: rgba(239, 68, 68, 0.45);
  --btn-gradient: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  --btn-shadow: #991b1b;
}

.theme-level-35 {
  --theme-color: #10b981;
  --theme-gradient: linear-gradient(135deg, #6ee7b7 0%, #047857 100%);
  --theme-glow: rgba(16, 185, 129, 0.45);
  --btn-gradient: linear-gradient(135deg, #6ee7b7 0%, #047857 100%);
  --btn-shadow: #064e3b;
}

.theme-level-36 {
  --theme-color: #d946ef;
  --theme-gradient: linear-gradient(135deg, #f0abfc 0%, #a21caf 100%);
  --theme-glow: rgba(217, 70, 239, 0.45);
  --btn-gradient: linear-gradient(135deg, #f0abfc 0%, #a21caf 100%);
  --btn-shadow: #701a75;
}

.theme-level-37 {
  --theme-color: #06b6d4;
  --theme-gradient: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  --theme-glow: rgba(6, 182, 212, 0.45);
  --btn-gradient: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%);
  --btn-shadow: #164e63;
}

.theme-level-38 {
  --theme-color: #f59e0b;
  --theme-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --theme-glow: rgba(245, 158, 11, 0.45);
  --btn-gradient: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --btn-shadow: #78350f;
}

.theme-level-39 {
  --theme-color: #10b981;
  --theme-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --theme-glow: rgba(16, 185, 129, 0.45);
  --btn-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --btn-shadow: #064e3b;
}

.theme-level-40 {
  --theme-color: #8b5cf6;
  --theme-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --theme-glow: rgba(139, 92, 246, 0.45);
  --btn-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  --btn-shadow: #4c1d95;
}

.theme-level-41 {
  --theme-color: #3b82f6;
  --theme-gradient: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --theme-glow: rgba(59, 130, 246, 0.45);
  --btn-gradient: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --btn-shadow: #1e3a8a;
}

.theme-level-42 {
  --theme-color: #f43f5e;
  --theme-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --theme-glow: rgba(244, 63, 94, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
  --btn-shadow: #881337;
}

.theme-level-43 {
  --theme-color: #ea580c;
  --theme-gradient: linear-gradient(135deg, #fb923c 0%, #c2410c 100%);
  --theme-glow: rgba(234, 88, 12, 0.45);
  --btn-gradient: linear-gradient(135deg, #fb923c 0%, #c2410c 100%);
  --btn-shadow: #7c2d12;
}

.theme-level-44 {
  --theme-color: #0284c7;
  --theme-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --theme-glow: rgba(2, 132, 199, 0.45);
  --btn-gradient: linear-gradient(135deg, #38bdf8 0%, #0369a1 100%);
  --btn-shadow: #082f49;
}

.theme-level-45 {
  --theme-color: #ec4899;
  --theme-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --theme-glow: rgba(236, 72, 153, 0.45);
  --btn-gradient: linear-gradient(135deg, #f472b6 0%, #db2777 100%);
  --btn-shadow: #831843;
}

.theme-level-46 {
  --theme-color: #84cc16;
  --theme-gradient: linear-gradient(135deg, #a3e635 0%, #65a30d 100%);
  --theme-glow: rgba(132, 204, 22, 0.45);
  --btn-gradient: linear-gradient(135deg, #a3e635 0%, #65a30d 100%);
  --btn-shadow: #365314;
}

.theme-level-47 {
  --theme-color: #0369a1;
  --theme-gradient: linear-gradient(135deg, #0284c7 0%, #075985 100%);
  --theme-glow: rgba(3, 105, 161, 0.45);
  --btn-gradient: linear-gradient(135deg, #0284c7 0%, #075985 100%);
  --btn-shadow: #0c4a6e;
}

.theme-level-48 {
  --theme-color: #dc2626;
  --theme-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --theme-glow: rgba(220, 38, 38, 0.45);
  --btn-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --btn-shadow: #7f1d1d;
}

.theme-level-49 {
  --theme-color: #7c3aed;
  --theme-gradient: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%);
  --theme-glow: rgba(124, 58, 237, 0.45);
  --btn-gradient: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%);
  --btn-shadow: #4c1d95;
}

.theme-level-50 {
  --theme-color: #eab308;
  --theme-gradient: linear-gradient(135deg, #fde047 0%, #ca8a04 100%);
  --theme-glow: rgba(234, 179, 8, 0.55);
  --btn-gradient: linear-gradient(135deg, #fde047 0%, #ca8a04 100%);
  --btn-shadow: #713f12;
}




.level-select-footer {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background: #ffffff;
  flex-shrink: 0;
}

/* ==========================================================================
   SCREEN 2: ACTIVE GAMEPLAY VIEW & GAMETANIESHAK FOOTER BRANDING LOGO
   ========================================================================== */

.gameplay-view {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Clickable Quiz Pill Badge in Gameplay */
#level-badge-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#level-badge-clickable:hover {
  transform: scale(1.05);
  border-color: #5ee432;
  box-shadow: 0 4px 12px rgba(94, 228, 50, 0.25);
}

#level-badge-clickable:active {
  transform: scale(0.96);
}

/* Bottom Bar / GameTanieshak Branding Logo (Clean, small watermark branding) */
.game-footer {
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  flex-shrink: 0;
  user-select: none;
}

.footer-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.035);
  border: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.8rem;
  letter-spacing: 0.8px;
  transition: all 0.2s ease;
}

.footer-brand-logo:hover {
  background: rgba(94, 228, 50, 0.08);
  border-color: rgba(94, 228, 50, 0.3);
}

.brand-logo-symbol {
  font-size: 0.95rem;
}

.brand-logo-text {
  font-weight: 800;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.footer-brand-logo:hover .brand-logo-text {
  background: linear-gradient(135deg, #0f172a 0%, #16a34a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   MODALS: CONGRATULATIONS, PAUSE, & LEVEL CUSTOMIZER
   ========================================================================== */

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 24, 38, 0.68);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: clamp(12px, 3vw, 24px);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: clamp(20px, 4vw, 28px);
  padding: clamp(20px, 5vw, 32px) clamp(16px, 4vw, 28px);
  text-align: center;
  box-shadow: var(--shadow-md);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  max-height: 90vh;
}

.modal-overlay.open .modal-card {
  transform: scale(1) translateY(0);
}

/* Victory / Congratulations Modal Styling */
.victory-icon-wrap {
  width: clamp(68px, 14vw, 88px);
  height: clamp(68px, 14vw, 88px);
  border-radius: 50%;
  background: linear-gradient(135deg, #a8ff78 0%, #78ffd6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 8px 24px rgba(120, 255, 214, 0.4);
  font-size: clamp(2rem, 5vw, 2.5rem);
  animation: popVictory 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popVictory {
  0% {
    transform: scale(0);
  }

  70% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

.victory-title {
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 800;
  color: #2f3640;
  margin-bottom: 6px;
}

.victory-subtitle {
  font-size: clamp(0.85rem, 2.2vw, 0.95rem);
  color: #636e72;
  margin-bottom: 18px;
}

.stars-rating {
  font-size: clamp(1.6rem, 4vw, 2rem);
  margin-bottom: 20px;
  letter-spacing: 4px;
  color: #ffb142;
}

.btn-primary {
  width: 100%;
  padding: clamp(12px, 2.5vw, 14px) 24px;
  background: #2f3640;
  color: #ffffff;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(47, 54, 64, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
  margin-bottom: 10px;
  touch-action: manipulation;
}

.btn-primary:hover {
  background: #1e272e;
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: clamp(10px, 2.2vw, 12px) 24px;
  background: #f1f2f6;
  color: #2f3640;
  font-size: clamp(0.88rem, 2vw, 0.95rem);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease;
  touch-action: manipulation;
}

.btn-secondary:hover {
  background: #e4e7eb;
}

/* Pause & Settings Modal */
.modal-title {
  font-size: clamp(1.2rem, 3vw, 1.4rem);
  font-weight: 800;
  margin-bottom: 16px;
  color: #2f3640;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Level Customizer Full Screen / Deep Modal */
.customizer-card {
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vw, 24px);
  text-align: left;
}

.customizer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
  flex-shrink: 0;
}

.customizer-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
  flex: 1;
}

.customizer-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #718096;
  margin: 14px 0 8px;
}

.item-config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 8px;
  background: #fafafa;
}

.item-config-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid #2f3640;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

.item-config-preview img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.item-config-inputs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-input {
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
}

.upload-btn-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}

.upload-btn-label:hover {
  background: #cbd5e1;
}

/* Toast notifications */
.toast-msg {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2f3640;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: clamp(0.8rem, 2vw, 0.88rem);
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Floating Clapping Tile Animation */
.clapping-badge {
  position: absolute;
  z-index: 30;
  background: linear-gradient(135deg, #5ee432 0%, #2ed573 100%);
  color: #0f172a;
  font-weight: 800;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  padding: 8px 18px;
  border-radius: 50px;
  box-shadow: 0 8px 24px rgba(94, 228, 50, 0.45);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: floatClap 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}

@keyframes floatClap {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }

  25% {
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 1;
  }

  40% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  80% {
    transform: translate(-50%, -120%) scale(1.05);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -160%) scale(0.9);
    opacity: 0;
  }
}

/* Confetti canvas */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 101;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE BREAKPOINTS
   ========================================================================== */

/* Tablet Portrait & Small Laptops (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .game-container {
    max-width: 620px;
    max-height: 92vh;
    border-radius: 28px;
  }

  .column-items {
    width: 130px;
  }

  .match-card {
    width: 124px;
    height: 124px;
  }

  .game-play-area {
    padding: 16px 52px 28px;
  }
}

/* Mobile Screens (<= 767px) */
@media (max-width: 767px) {
  .game-viewport {
    padding: 0;
    height: 100%;
    /* iOS Safari full height support */
    height: 100dvh;
  }

  .game-container {
    border-radius: 0;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    height: 100dvh;
    border: none;
    box-shadow: none;
  }

  .game-header {
    height: 64px;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0);
  }

  .header-group-left {
    min-width: 76px;
  }

  .header-group-right {
    min-width: 76px;
    gap: 6px;
  }

  .header-btn {
    width: 40px;
    height: 40px;
  }

  .header-btn svg {
    width: 22px;
    height: 22px;
  }

  .level-badge {
    padding: 6px 20px;
  }

  .level-badge-text {
    font-size: 1.05rem;
  }

  .game-play-area {
    padding: 8px 18px 16px;
  }

  .column-items {
    width: clamp(74px, 24vw, 105px);
    gap: clamp(8px, 1.5vh, 14px);
  }

  .match-card {
    width: clamp(72px, 23vw, 100px);
    height: clamp(72px, 23vw, 100px);
    border-radius: 18px;
  }

  .game-footer {
    padding: 0 12px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Level Selection on Mobile */
  .level-select-header {
    height: 56px;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0);
  }

  .level-select-body {
    padding: 12px 14px 20px;
  }

  .level-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .level-select-title {
    font-size: 1.5rem;
  }
}

/* Small / Narrow Mobile Screens (<= 375px width e.g. iPhone SE) */
@media (max-width: 375px) {
  .game-header {
    height: 56px;
    padding: 0 8px;
  }

  .header-group-left {
    min-width: 64px;
  }

  .header-group-right {
    min-width: 64px;
    gap: 4px;
  }

  .level-card-3d {
    padding: 12px 14px;
    gap: 10px;
  }

  .level-orb-3d {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }

  .level-preview-chip {
    width: 30px;
    height: 30px;
  }

  .level-badge {
    padding: 5px 12px;
  }

  .level-badge-text {
    font-size: 0.92rem;
  }

  .header-btn {
    width: 34px;
    height: 34px;
  }

  .header-btn svg {
    width: 19px;
    height: 19px;
  }

  .column-items {
    width: 82px;
  }

  .match-card {
    width: 80px;
    height: 80px;
    border-radius: 15px;
  }

  .game-play-area {
    padding: 6px 12px 12px;
  }

  .footer-btn-text {
    display: none;
  }
}

/* Landscape Mode on Phones / Short Viewports (height <= 550px) */
@media (max-height: 550px) {
  .game-container {
    border-radius: 0;
    max-height: 100%;
  }

  .game-header {
    height: 48px;
    padding: 0 14px;
  }

  .header-group-left {
    min-width: 72px;
  }

  .header-group-right {
    min-width: 72px;
    gap: 6px;
  }

  .level-badge {
    padding: 4px 18px;
  }

  .level-badge-text {
    font-size: 0.95rem;
  }

  .header-btn {
    width: 36px;
    height: 36px;
  }

  .order-indicator {
    padding: 0 10px 4px;
    font-size: 0.78rem;
  }

  .game-play-area {
    padding: 4px 28px 8px;
  }

  .column-items {
    width: clamp(65px, 15vh, 90px);
    gap: 6px;
  }

  .match-card {
    width: clamp(62px, 15vh, 85px);
    height: clamp(62px, 15vh, 85px);
    border-radius: 12px;
  }

  .game-footer {
    height: 40px;
  }

  .level-dot {
    width: 24px;
    height: 24px;
  }
}

/* ==========================================================================
   GAME LOADER SCREEN: "gametanieshak" FLOATING STYLE
   ========================================================================== */
.game-loader-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #182236 0%, #0c121e 65%, #050810 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.game-loader-screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.game-loader-screen.fade-out {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
}

/* Background Ambient Orbs */
.loader-backdrop-effects {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.38;
  animation: orbDrift 8s infinite alternate ease-in-out;
}

.orb-1 {
  width: 340px;
  height: 340px;
  background: #5ee432;
  top: 15%;
  left: 20%;
  animation-duration: 9s;
}

.orb-2 {
  width: 320px;
  height: 320px;
  background: #00f2fe;
  bottom: 20%;
  right: 18%;
  animation-duration: 11s;
  animation-delay: -3s;
}

.orb-3 {
  width: 260px;
  height: 260px;
  background: #a855f7;
  top: 45%;
  left: 55%;
  animation-duration: 7s;
  animation-delay: -5s;
}

@keyframes orbDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, -25px) scale(1.12);
  }

  100% {
    transform: translate(-25px, 20px) scale(0.92);
  }
}

.floating-grid-mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 80%);
}

/* Loader Content Box */
.loader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  width: min(92vw, 560px);
}

/* Matching Word Chips (Looks like matching words!) */
.matching-words-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  animation: chipFloat 2.6s infinite ease-in-out;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.chip-game {
  background: rgba(94, 228, 50, 0.15);
  border: 1.5px solid #5ee432;
  color: #5ee432;
  animation-delay: 0s;
}

.chip-game .chip-dot {
  background: #5ee432;
  box-shadow: 0 0 8px #5ee432;
}

.chip-tanie {
  background: rgba(0, 242, 254, 0.15);
  border: 1.5px solid #00f2fe;
  color: #00f2fe;
  animation-delay: 0.4s;
}

.chip-tanie .chip-dot {
  background: #00f2fe;
  box-shadow: 0 0 8px #00f2fe;
}

.chip-shak {
  background: rgba(168, 85, 247, 0.15);
  border: 1.5px solid #c084fc;
  color: #c084fc;
  animation-delay: 0.8s;
}

.chip-shak .chip-dot {
  background: #c084fc;
  box-shadow: 0 0 8px #c084fc;
}

.chip-connector-line {
  position: relative;
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1px;
  overflow: hidden;
}

.connector-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #5ee432, transparent);
  animation: pulseConnector 1.4s infinite linear;
}

@keyframes pulseConnector {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes chipFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

/* Main Floating "gametanieshak" Typography */
.brand-floating-title {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(1px, 0.4vw, 4px);
  margin-bottom: clamp(12px, 3vh, 22px);
  max-width: 96vw;
}

.float-char {
  display: inline-block;
  font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(1.35rem, 6.2vw, 3.4rem);
  font-weight: 900;
  line-height: 1.1;
  text-transform: lowercase;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #ffffff 15%, #5ee432 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(94, 228, 50, 0.45));
  animation: floatChar 2.2s infinite ease-in-out;
  animation-delay: calc(var(--ci) * 0.11s);
  transform-origin: center bottom;
}

.float-char.accent-mid {
  background: linear-gradient(180deg, #ffffff 15%, #00f2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 4px 12px rgba(0, 242, 254, 0.45));
}

.float-char.accent-end {
  background: linear-gradient(180deg, #ffffff 15%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 4px 12px rgba(168, 85, 247, 0.45));
}

@keyframes floatChar {

  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  50% {
    transform: translateY(-14px) rotate(calc((var(--ci) - 6) * 1.5deg)) scale(1.06);
  }
}

/* Tagline / Subtitle */
.loader-tagline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(0.85rem, 2.2vw, 1.02rem);
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 24px;
  letter-spacing: 0.3px;
}

.sparkle-icon {
  font-size: 1.15em;
  display: inline-block;
  animation: sparkleTwinkle 1.6s infinite alternate ease-in-out;
}

@keyframes sparkleTwinkle {
  0% {
    transform: scale(0.8) rotate(0deg);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.25) rotate(25deg);
    opacity: 1;
  }
}

/* Progress Track & Bar */
.loader-progress-track {
  width: min(320px, 82vw);
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.loader-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ee432 0%, #00f2fe 55%, #a855f7 100%);
  box-shadow: 0 0 16px rgba(94, 228, 50, 0.8), 0 0 8px rgba(0, 242, 254, 0.6);
  position: relative;
  transition: width 0.08s linear;
}

.progress-glow-head {
  position: absolute;
  right: -2px;
  top: -2px;
  bottom: -2px;
  width: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 20px #00f2fe;
}

.loader-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(320px, 82vw);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #64748b;
}

.loading-percent {
  color: #5ee432;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* Desktop Web View (>= 768px) */
@media (min-width: 768px) {
  .float-char {
    font-size: clamp(2.4rem, 4.2vw, 3.8rem);
    filter: drop-shadow(0 6px 18px rgba(94, 228, 50, 0.5));
  }

  .loader-progress-track {
    width: 360px;
    height: 12px;
  }

  .loader-stats {
    width: 360px;
    font-size: 0.82rem;
  }
}

/* Mobile Screens (<= 480px) */
@media (max-width: 480px) {
  .brand-floating-title {
    gap: 1px;
    margin-bottom: 14px;
  }

  .float-char {
    font-size: clamp(1.3rem, 6.4vw, 1.85rem);
  }

  .loader-tagline {
    font-size: 0.82rem;
    margin-bottom: 18px;
  }

  .loader-progress-track {
    width: min(290px, 86vw);
    height: 8px;
  }

  .loader-stats {
    width: min(290px, 86vw);
    font-size: 0.72rem;
  }
}