/* ============================================
   THINK IQ — STYLES v2
   Palette: Deep Navy · Cyan · Magenta · Gold
   Font: Outfit (Google Fonts)
   ============================================ */

:root {
  --bg:        #07091A;
  --bg2:       #0C1128;
  --bg3:       #111830;
  --bg4:       #161E38;
  --cyan:      #00F5FF;
  --magenta:   #FF2D78;
  --gold:      #FFD700;
  --purple:    #7B2FFF;
  --orange:    #FF6B2B;
  --white:     #F0F4FF;
  --muted:     #3D4D70;
  --muted2:    #5A6A90;
  --card-back: #0E1428;
  --card-border: #1A2540;

  --font: 'Outfit', sans-serif;

  --shadow-cyan:    0 0 24px rgba(0,245,255,0.4);
  --shadow-magenta: 0 0 24px rgba(255,45,120,0.4);
  --shadow-gold:    0 0 24px rgba(255,215,0,0.4);
  --shadow-purple:  0 0 24px rgba(123,47,255,0.4);

  --radius: 16px;
  --radius-sm: 10px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ===== PARTICLE CANVAS ===== */
#particleCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* ===== BG GRID ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0,245,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,245,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
}

/* ===== FLOATING ORBS ===== */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,245,255,0.12), transparent 70%);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(255,45,120,0.1), transparent 70%);
  bottom: -80px; right: -80px;
  animation-delay: -3s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(123,47,255,0.1), transparent 70%);
  top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -5s;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  33%       { transform: translate(20px, -20px); }
  66%       { transform: translate(-15px, 15px); }
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
  overflow-y: auto;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ===== SPLASH SCREEN ===== */
.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 36px 24px 40px;
  width: 100%;
  max-width: 540px;
  position: relative;
  z-index: 2;
}

/* ===== HERO LOGO ===== */
.hero-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes heroEntrance {
  from { opacity: 0; transform: translateY(-30px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-logo-glow {
  position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,245,255,0.15) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.8; transform: translate(-50%,-50%) scale(1); }
  50%       { opacity: 1;   transform: translate(-50%,-50%) scale(1.2); }
}

.logo-icon-big svg {
  width: 88px; height: 88px;
  filter: drop-shadow(0 0 20px rgba(0,245,255,0.6)) drop-shadow(0 0 40px rgba(123,47,255,0.3));
  animation: logoSpin 0.8s cubic-bezier(0.34,1.56,0.64,1) both, logoPulse 4s ease-in-out 0.8s infinite;
}
@keyframes logoSpin {
  from { opacity: 0; transform: rotate(-20deg) scale(0.5); }
  to   { opacity: 1; transform: rotate(0deg) scale(1); }
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(0,245,255,0.6)) drop-shadow(0 0 40px rgba(123,47,255,0.3)); }
  50%       { filter: drop-shadow(0 0 30px rgba(255,45,120,0.7)) drop-shadow(0 0 50px rgba(255,215,0,0.2)); }
}

.hero-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.hero-title {
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.1s both;
}
.hero-think {
  color: var(--white);
  text-shadow: 0 0 40px rgba(240,244,255,0.2);
}
.hero-iq {
  background: linear-gradient(90deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s linear infinite;
}
@keyframes gradientShift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero-subtitle-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.2s both;
}
.hero-sub-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: dotBlink 2s ease-in-out infinite;
}
.hero-sub-dot:last-child { animation-delay: -1s; }
@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.hero-sub-text {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--muted2);
}

/* ===== PREVIEW CARDS ===== */
.preview-cards {
  display: flex;
  gap: 10px;
  align-items: center;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.25s both;
}
.preview-card {
  width: 52px; height: 68px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  position: relative;
  overflow: hidden;
  border: 1.5px solid rgba(0,245,255,0.2);
  background: var(--bg3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.preview-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.preview-card span { position: relative; z-index: 1; }

.pc-1 { animation: pcFloat 3s ease-in-out infinite; border-color: rgba(0,245,255,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(0,245,255,0.15); }
.pc-2 { animation: pcFloat 3s ease-in-out -0.5s infinite; border-color: rgba(255,215,0,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,215,0,0.15); }
.pc-3 { animation: pcFloat 3s ease-in-out -1s infinite; width: 52px; height: 68px; }
.pc-4 { animation: pcFloat 3s ease-in-out -1.5s infinite; border-color: rgba(255,107,43,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,107,43,0.15); }
.pc-5 { animation: pcFloat 3s ease-in-out -2s infinite; }
.pc-6 { animation: pcFloat 3s ease-in-out -2.5s infinite; border-color: rgba(255,215,0,0.3); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(255,215,0,0.15); }

.pc-back {
  background: var(--card-back);
  border-color: rgba(123,47,255,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px rgba(123,47,255,0.15);
}
.pc-back::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 6px,
    rgba(0,245,255,0.04) 6px, rgba(0,245,255,0.04) 7px
  );
}
.pc-back-logo {
  font-size: 0.85rem !important;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.7;
}

@keyframes pcFloat {
  0%, 100% { transform: translateY(0px) rotate(-1deg); }
  50%       { transform: translateY(-8px) rotate(1deg); }
}

/* ===== TAGLINE ===== */
.tagline {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.3s both;
}
.tag-highlight   { color: var(--cyan);    text-shadow: 0 0 20px rgba(0,245,255,0.5); }
.tag-h2          { color: var(--magenta); text-shadow: 0 0 20px rgba(255,45,120,0.5); }
.tag-h3          { color: var(--gold);    text-shadow: 0 0 20px rgba(255,215,0,0.5); }

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--muted2);
  text-align: center;
  margin-bottom: 12px;
}

/* ===== DIFFICULTY ===== */
.difficulty-section {
  width: 100%;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.35s both;
}
.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 18px 8px 14px;
  background: var(--bg3);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
  color: var(--white);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
}
.diff-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(circle at 50% 0%, rgba(0,245,255,0.15), transparent 70%);
  pointer-events: none;
}
.diff-btn:hover .diff-glow,
.diff-btn.active .diff-glow { opacity: 1; }
.diff-btn:hover {
  border-color: rgba(0,245,255,0.5);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4), var(--shadow-cyan);
}
.diff-btn.active {
  border-color: var(--cyan);
  background: rgba(0,245,255,0.08);
  box-shadow: var(--shadow-cyan), 0 8px 30px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}
.diff-btn.active[data-diff="medium"] {
  border-color: var(--gold);
  background: rgba(255,215,0,0.07);
  box-shadow: var(--shadow-gold), 0 8px 30px rgba(0,0,0,0.3);
}
.diff-btn.active[data-diff="hard"] {
  border-color: var(--magenta);
  background: rgba(255,45,120,0.07);
  box-shadow: var(--shadow-magenta), 0 8px 30px rgba(0,0,0,0.3);
}
.diff-icon  { font-size: 1.5rem; margin-bottom: 2px; }
.diff-name  { font-size: 0.88rem; font-weight: 800; letter-spacing: 0.06em; }
.diff-desc  { font-size: 0.7rem; color: var(--muted2); font-weight: 500; }
.diff-pairs { font-size: 0.62rem; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; margin-top: 2px; }

/* ===== START BUTTON ===== */
.btn-start {
  position: relative;
  overflow: hidden;
  padding: 18px 52px;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.4s both;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--purple) 50%, var(--magenta) 100%);
  background-size: 200% auto;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.4s both, btnGradient 3s linear infinite;
}
@keyframes btnGradient {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}
.btn-start-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: skewX(-20deg);
  animation: btnShine 2.5s ease-in-out infinite;
}
@keyframes btnShine {
  0%   { left: -100%; }
  40%, 100% { left: 150%; }
}

/* ===== BEST SCORES ===== */
.best-scores {
  width: 100%;
  animation: heroEntrance 0.8s cubic-bezier(0.16,1,0.3,1) 0.45s both;
}
.scores-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.score-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
}
.score-divider {
  width: 1px;
  height: 40px;
  background: var(--card-border);
  flex-shrink: 0;
}
.score-diff-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 20px;
}
.easy-badge   { background: rgba(0,245,255,0.12); color: var(--cyan); }
.med-badge    { background: rgba(255,215,0,0.12);  color: var(--gold); }
.hard-badge   { background: rgba(255,45,120,0.12); color: var(--magenta); }
.score-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--white);
}

/* ===== SHARED BUTTONS ===== */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  border: none;
  border-radius: 50px;
  color: var(--bg);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 30px rgba(0,245,255,0.3);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 50px rgba(0,245,255,0.5);
}
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  padding: 14px 32px;
  background: transparent;
  border: 2px solid var(--card-border);
  border-radius: 50px;
  color: var(--muted2);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  border-color: var(--white);
  color: var(--white);
}

/* ===== GAME SCREEN ===== */
#gameScreen {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  overflow: hidden;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(7,9,26,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  position: relative;
  z-index: 20;
  flex-shrink: 0;
}

.btn-icon {
  width: 42px; height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--muted2);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-icon:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: var(--shadow-cyan);
}

.hud { display: flex; align-items: center; gap: 24px; }
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
}
.hud-center { min-width: 72px; }
.hud-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted2);
}
.hud-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}
.hud-value.neon-cyan { color: var(--cyan); text-shadow: 0 0 12px var(--cyan); }
.hud-value.timer-warning { color: var(--magenta); text-shadow: 0 0 12px var(--magenta); animation: timerPulse 0.5s ease infinite; }

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Progress bar */
.progress-bar-wrap { height: 3px; background: var(--bg3); flex-shrink: 0; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple), var(--magenta));
  background-size: 200% auto;
  transition: width 1s linear;
  box-shadow: 0 0 10px var(--cyan);
  animation: barShift 2s linear infinite;
}
@keyframes barShift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Combo display */
.combo-display {
  position: fixed;
  top: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
  opacity: 0;
}
.combo-display.show {
  animation: comboPop 1.3s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes comboPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.4) translateY(10px); }
  25%  { opacity: 1; transform: translateX(-50%) scale(1.25) translateY(-12px); }
  70%  { opacity: 1; transform: translateX(-50%) scale(1.05) translateY(-22px); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-50px); }
}

/* Game main */
.game-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
}

/* Card grid */
.card-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 680px;
}
.card-grid.grid-4x3 { grid-template-columns: repeat(4, 1fr); }
.card-grid.grid-4x4 { grid-template-columns: repeat(4, 1fr); }
.card-grid.grid-6x4 { grid-template-columns: repeat(6, 1fr); }

/* ===== CARDS ===== */
.card {
  aspect-ratio: 3/4;
  perspective: 900px;
  cursor: pointer;
}
.card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius);
}
.card.flipped .card-inner,
.card.matched .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ===== CARD BACK ===== */
.card-back {
  background: var(--card-back);
  border: 1.5px solid var(--card-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover:not(.flipped):not(.matched) .card-back {
  border-color: rgba(0,245,255,0.6);
  box-shadow: var(--shadow-cyan), inset 0 0 30px rgba(0,245,255,0.06);
  transform: scale(1.03);
}
.card:hover:not(.flipped):not(.matched) .card-inner {
  transform: translateY(-3px);
}

.card-back-pattern {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
/* Diagonal stripe texture */
.card-back-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(0,245,255,0.025) 10px,
    rgba(0,245,255,0.025) 11px
  );
}
/* Corner accent lines */
.card-back-pattern::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(0,245,255,0.08);
  border-radius: 10px;
}
/* Holographic shimmer overlay */
.card-back-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(0,245,255,0.04) 45%,
    rgba(123,47,255,0.04) 55%,
    transparent 70%
  );
  background-size: 200% 200%;
  animation: holoShift 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes holoShift {
  0%, 100% { background-position: 0% 0%; }
  50%       { background-position: 100% 100%; }
}

.card-back-logo {
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
  opacity: 0.55;
}

/* ===== CARD FRONT ===== */
.card-front {
  background: linear-gradient(145deg, var(--bg4) 0%, var(--bg3) 100%);
  border: 1.5px solid rgba(0,245,255,0.15);
  transform: rotateY(180deg);
  flex-direction: column;
  gap: 5px;
  position: relative;
}
/* Top-left corner accent */
.card-front::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 30px; height: 30px;
  border-top: 2px solid rgba(0,245,255,0.3);
  border-left: 2px solid rgba(0,245,255,0.3);
  border-radius: var(--radius) 0 0 0;
  pointer-events: none;
}
/* Bottom-right corner accent */
.card-front::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 30px; height: 30px;
  border-bottom: 2px solid rgba(123,47,255,0.3);
  border-right: 2px solid rgba(123,47,255,0.3);
  border-radius: 0 0 var(--radius) 0;
  pointer-events: none;
}

.card-emoji {
  font-size: clamp(1.5rem, 4.5vw, 2.6rem);
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}
.card.flipped .card-emoji,
.card.matched .card-emoji {
  animation: emojiPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes emojiPop {
  from { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.card-label {
  font-size: clamp(0.42rem, 1.1vw, 0.6rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted2);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* ===== MATCHED CARD ===== */
.card.matched .card-front {
  background: linear-gradient(145deg, rgba(0,245,255,0.12) 0%, rgba(0,245,255,0.04) 100%);
  border-color: var(--cyan);
  box-shadow: var(--shadow-cyan), inset 0 0 20px rgba(0,245,255,0.06);
}
.card.matched .card-front::before { border-color: rgba(0,245,255,0.6); }
.card.matched .card-front::after  { border-color: rgba(0,245,255,0.4); }
.card.matched .card-label { color: rgba(0,245,255,0.6); }

/* Matched pulse */
.card.matched .card-inner {
  animation: matchBounce 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes matchBounce {
  0%   { transform: rotateY(180deg) scale(1); }
  50%  { transform: rotateY(180deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* ===== WRONG CARD ===== */
.card.wrong .card-inner {
  animation: wrongShake 0.5s ease;
}
@keyframes wrongShake {
  0%, 100% { transform: rotateY(180deg) translateX(0); }
  20%       { transform: rotateY(180deg) translateX(-7px); }
  40%       { transform: rotateY(180deg) translateX(7px); }
  60%       { transform: rotateY(180deg) translateX(-4px); }
  80%       { transform: rotateY(180deg) translateX(4px); }
}
.card.wrong .card-front {
  border-color: var(--magenta);
  box-shadow: var(--shadow-magenta);
  background: linear-gradient(145deg, rgba(255,45,120,0.1) 0%, var(--bg3) 100%);
}

/* ===== RESULT SCREEN ===== */
.result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 24px;
  width: 100%;
  max-width: 480px;
  animation: heroEntrance 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
.result-icon {
  font-size: 5rem;
  animation: iconBounce 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
}
@keyframes iconBounce {
  from { opacity: 0; transform: scale(0.2) rotate(-15deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
.result-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.result-subtitle {
  font-size: 0.95rem;
  color: var(--muted2);
  text-align: center;
  font-weight: 400;
  line-height: 1.5;
}
.result-stats { display: flex; gap: 12px; width: 100%; }
.stat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
}
.stat-val {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0,245,255,0.4);
}
.stat-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted2);
}
.new-best {
  padding: 12px 28px;
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,215,0,0.05));
  border: 1px solid var(--gold);
  border-radius: 50px;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  animation: newBestGlow 1.5s ease infinite;
}
@keyframes newBestGlow {
  0%, 100% { box-shadow: var(--shadow-gold); }
  50%       { box-shadow: 0 0 40px rgba(255,215,0,0.6); }
}
.result-actions { display: flex; gap: 12px; align-items: center; }

/* ===== SCORE POPUP ===== */
.score-popup {
  position: fixed;
  pointer-events: none;
  z-index: 200;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
  animation: scoreFloat 1s ease forwards;
}
@keyframes scoreFloat {
  0%   { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.8); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .hero-title { font-size: 2.8rem; }
  .logo-icon-big svg { width: 68px; height: 68px; }
  .preview-card { width: 42px; height: 56px; font-size: 1.3rem; }
  .tagline { font-size: 1.2rem; }
  .hud { gap: 14px; }
  .hud-value { font-size: 1.2rem; }
  .card-grid { gap: 7px; }
  .card-grid.grid-6x4 { gap: 5px; }
  .result-title { font-size: 2rem; }
  .stat-val { font-size: 1.5rem; }
}
@media (max-height: 700px) {
  .splash-inner { gap: 18px; padding: 20px 24px; }
  .logo-icon-big svg { width: 60px; height: 60px; }
  .hero-title { font-size: 2.8rem; }
  .preview-cards { display: none; }
  .game-main { padding: 8px; }
  .card-grid { gap: 6px; }
  .game-header { padding: 10px 16px; }
  .hud-value { font-size: 1.1rem; }
}