/*
Glyph Memory — Phase 1 CSS
- Focus: clean layout + responsiveness
- Visual identity/polish comes later
*/

:root {
  --bg: #0c0c0c;
  --panel: rgba(12, 12, 12, 0.72);
  --panelBorder: rgba(255, 215, 0, 0.22);
  --text: #f3f3f3;
  --muted: rgba(243, 243, 243, 0.75);
  --gold: #ffd700;
  --teal: #00ced1;
  --shadow: 0 18px 40px rgba(0,0,0,0.55);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 10%, rgba(0, 206, 209, 0.18), transparent 40%),
              radial-gradient(circle at 80% 90%, rgba(255, 215, 0, 0.14), transparent 42%),
              linear-gradient(180deg, rgba(0,0,0,0.25), rgba(0,0,0,0.75));
  transform: scale(1.02);
  filter: saturate(1.05);
  z-index: 0;
}

.view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: none;
  padding: 24px 16px;
}

.view--active { display: grid; }

/* Menu centers content */
#menuView.view--active {
  place-items: center;
}

.panel {
  width: min(520px, 92vw);
  padding: 22px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panelBorder);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel__header {
  margin-bottom: 18px;
}

.title {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 40px);
  letter-spacing: 0.5px;
}

.title--sm {
  font-size: clamp(20px, 3vw, 26px);
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

/* User Display - Compact single-line like navigation buttons */
.user-display {
  margin-top: 16px;
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 224, 102, 0.1), rgba(251, 191, 36, 0.05));
  border: 1px solid rgba(255, 224, 102, 0.3);
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-start;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-height: 48px;
}

.user-display:hover {
  background: linear-gradient(135deg, rgba(255, 224, 102, 0.15), rgba(251, 191, 36, 0.08));
  border-color: rgba(255, 224, 102, 0.5);
  box-shadow: 0 6px 16px rgba(255, 224, 102, 0.2);
  transform: translateY(-1px);
}

.user-display__avatar-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-display__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 224, 102, 0.5);
  box-shadow: 0 2px 8px rgba(255, 224, 102, 0.3);
  object-fit: cover;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.user-display:hover .user-display__avatar {
  border-color: rgba(255, 224, 102, 0.7);
  box-shadow: 0 6px 16px rgba(255, 224, 102, 0.4);
}

.user-display__info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.user-display__name {
  font-size: 16px;
  font-weight: 700;
  color: #ffe066;
  text-shadow: 0 0 10px rgba(255, 224, 102, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
  flex-shrink: 0;
}

.user-display__balance {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-display__balance-value {
  font-size: 15px;
  font-weight: 600;
  color: #fcd34d;
  line-height: 1;
  white-space: nowrap;
}

/* Login Message (shown when not logged in) */
.login-message {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.login-message:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.5);
}

.login-message__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s ease;
}

.login-message__link:hover {
  color: #ffed4e;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.login-message__icon {
  font-size: 18px;
}

.login-message__text {
  font-size: 14px;
}

/* 🏆 Leaderboard Section */
.leaderboard-section {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 215, 0, 0.18);
  background: rgba(0, 0, 0, 0.28);
}

.leaderboard-title {
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--gold);
  text-align: center;
  font-weight: 600;
}

.leaderboard-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: center;
}

.tab-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 120ms ease;
}

.tab-btn:hover {
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--text);
}

.tab-btn.active {
  border-color: rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.12);
  color: var(--gold);
  font-weight: 500;
}

.leaderboard-list {
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-entry {
  display: grid;
  grid-template-columns: 30px 1fr 60px 80px;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  align-items: center;
  transition: all 120ms ease;
}

.leaderboard-entry:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 215, 0, 0.15);
}

.leaderboard-rank {
  font-weight: 600;
  color: var(--gold);
  text-align: center;
  font-size: 14px;
}

.leaderboard-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-time {
  color: var(--teal);
  font-weight: 500;
  font-family: monospace;
  text-align: right;
}

.leaderboard-date {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 13px;
}

.leaderboard-loading {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 13px;
}

.leaderboard-error {
  text-align: center;
  color: rgba(255, 69, 0, 0.8);
  padding: 20px;
  font-size: 13px;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .leaderboard-entry {
    grid-template-columns: 25px 1fr 55px;
    gap: 6px;
    font-size: 12px;
  }
  
  .leaderboard-date {
    display: none; /* Hide date on mobile */
  }
  
  .leaderboard-time {
    font-size: 12px;
  }
}

.controls {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.controls--row {
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  outline: none;
}

.btn {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.28); }
.btn:active { transform: translateY(0px); }

.btn--primary {
  border-color: rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.12);
}

.btn--ghost {
  border-color: rgba(255, 215, 0, 0.22);
}

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: rgba(243,243,243,0.7);
  font-size: 13px;
}

.hint__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 206, 209, 0.7);
  box-shadow: 0 0 18px rgba(0, 206, 209, 0.35);
}

/* Best time line on menu */
.bestLine {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.28);
}

.bestLine__label {
  font-size: 12px;
  color: var(--muted);
}

.bestLine__value {
  font-size: 14px;
  letter-spacing: 0.4px;
}

/* Game view layout */
#gameView.view--active {
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 215, 0, 0.18);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar__right {
  display: flex;
  gap: 10px;
}

.stat {
  display: grid;
  gap: 4px;
}

.stat__label {
  font-size: 12px;
  color: var(--muted);
}

.stat__value {
  font-size: 18px;
  letter-spacing: 0.5px;
}

.boardWrap {
  display: grid;
  place-items: center;
  /* CRITICAL (January 15, 2026): Increased bottom padding to prevent cards from being cut off */
  padding-bottom: 40px;
}

.board {
  align-content: center;
  width: min(1400px, 96vw);
  display: grid;
  gap: 22px;
  margin: 0 auto;
  /* CRITICAL (January 15, 2026): Ensure bottom padding prevents cutting - cards fit grid field */
  padding: 24px;
  padding-bottom: 40px;
  grid-auto-rows: clamp(140px, 18vh, 200px);
  justify-content: center;
  /* Ensure board doesn't clip content */
  overflow: visible;
}

/* Cards */
.card {
  position: relative;
  height: 100%;
  width: 100%;
border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  /* CRITICAL (January 15, 2026): Contain content within grid cell - no overlap with adjacent cards */
  /* overflow: hidden keeps white frame glow contained within card boundaries */
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transform: translateZ(0);
  /* No external padding - cards fit exactly within grid cells */
  padding: 0;
  box-sizing: border-box;
}

.card[aria-disabled="true"] {
  cursor: default;
  opacity: 0.85;
}

.cardInner {
  position: absolute;
  /* CRITICAL (January 15, 2026): No inset - fill entire card for maximum glyph space */
  /* inset: 0 matches card padding: 0 - content fills entire card area */
  inset: 0;
  display: grid;
  place-items: center;
}

/* Simple flip states (Phase 1) */
.cardFront {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  position: relative;
  /* Ensure glyph face is above the card back */
  z-index: 2;
  /* White shimmer background for visibility - no thick inner frame border */
  background: 
    radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.15) 40%, rgba(255, 255, 255, 0.05) 70%, transparent 100%);
  border-radius: 12px;
  /* CRITICAL (January 15, 2026): No inner frame border - white shimmer only for visibility */
  /* No border - clean look, glyph fits grid field perfectly */
  border: none;
  /* White shimmer glow effect - subtle but visible */
  box-shadow: 
    inset 0 0 20px rgba(255, 255, 255, 0.2),
    inset 0 0 40px rgba(255, 255, 255, 0.1),
    0 0 15px rgba(255, 255, 255, 0.15);
  /* Contain content within card boundaries */
  overflow: hidden;
  width: 100%;
  height: 100%;
  /* Minimal padding - just enough for glyph to fit within grid field */
  padding: 4px;
  box-sizing: border-box;
}

.cardBack{
  /* Ensure the back is behind the front when flipped */
  z-index: 1;
}

.card.is-flipped .cardFront { 
  opacity: 1;
  /* White shimmer glow when card is flipped - visible but no thick inner frame borders */
  box-shadow: 
    inset 0 0 25px rgba(255, 255, 255, 0.3),
    inset 0 0 50px rgba(255, 255, 255, 0.15),
    0 0 20px rgba(255, 255, 255, 0.2),
    0 0 35px rgba(255, 255, 255, 0.1);
}
.card.is-flipped .cardBack { opacity: 0; }

/* CRITICAL (January 15, 2026): Removed ::before and ::after glow rings - no inner frame border per user request */
/* Glyphs now display cleanly centered without thick white frame borders */

.cardFront img {
  display: block;
  width: auto;
  height: auto;
  /* CRITICAL (January 15, 2026): Glyphs fit grid field perfectly - centered with minimal padding */
  /* max-width/height 90% ensures glyph fits within grid field without cutting */
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  object-position: center;
  /* Perfect centering via parent flex container */
  margin: 0 auto;
  position: relative;
  z-index: 1;
  /* White shimmer effect for visibility - especially important on mobile */
  /* Brightness and contrast boost + white glow drop-shadows for shimmer effect */
  filter: 
    brightness(1.3)
    contrast(1.3)
    drop-shadow(0 0 4px rgba(255, 255, 255, 0.8))
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.6))
    drop-shadow(0 0 12px rgba(255, 255, 255, 0.4))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
  mix-blend-mode: normal;
  opacity: 1;
  /* White shimmer glow - subtle white box-shadow for visibility (not a frame border) */
  box-shadow: 
    0 0 10px rgba(255, 255, 255, 0.4),
    0 0 20px rgba(255, 255, 255, 0.2);
}

/* Duplicate removed - see above for cardFront styles */

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  z-index: 20;
}

.panel--overlay {
  width: min(520px, 92vw);
}

.newBest {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.8px;
  border: 1px solid rgba(0, 206, 209, 0.45);
  background: rgba(0, 206, 209, 0.12);
  color: rgba(0, 206, 209, 0.95);
}

/* Small screens */
@media (max-width: 520px) {
  /* CRITICAL (January 15, 2026): Mobile board - ensure cards fit grid field without cutting */
  .board {
    grid-auto-rows: clamp(160px, 22vh, 240px);
    gap: 16px;
    padding: 16px;
    /* Increased bottom padding to prevent cards from being cut off on mobile */
    padding-bottom: 40px;
    overflow: visible;
  }
  
  .boardWrap {
    /* Ensure mobile board has enough bottom padding */
    padding-bottom: 40px;
  }
  
  .controls--row {
    grid-auto-flow: row;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar__right {
    justify-content: stretch;
  }
  .topbar__right .btn {
    width: 100%;
  }
  
  /* CRITICAL (January 15, 2026): Mobile styles - white shimmer for visibility, no inner frame border */
  .cardFront {
    /* White shimmer background on mobile - important for visibility on small screens */
    padding: 4px;
    background: 
      radial-gradient(circle at center, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.2) 40%, rgba(255, 255, 255, 0.08) 70%, transparent 100%);
    /* No border - removed inner frame border per user request */
    border: none;
    /* White shimmer glow effect on mobile - more prominent for visibility */
    box-shadow: 
      inset 0 0 25px rgba(255, 255, 255, 0.25),
      inset 0 0 50px rgba(255, 255, 255, 0.12),
      0 0 18px rgba(255, 255, 255, 0.18),
      0 0 30px rgba(255, 255, 255, 0.1);
  }
  
  .card.is-flipped .cardFront {
    /* Enhanced white shimmer when flipped on mobile */
    box-shadow: 
      inset 0 0 30px rgba(255, 255, 255, 0.35),
      inset 0 0 60px rgba(255, 255, 255, 0.18),
      0 0 25px rgba(255, 255, 255, 0.25),
      0 0 45px rgba(255, 255, 255, 0.12);
  }
  
  /* CRITICAL (January 15, 2026): No frame borders - white shimmer only for visibility */
  
  .cardFront img {
    /* CRITICAL (January 15, 2026): Mobile glyphs centered and fit grid field - white shimmer for visibility */
    /* Glyphs fit perfectly within grid field without cutting */
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    margin: 0 auto;
    /* White shimmer effect on mobile - more prominent for better visibility on small screens */
    filter: 
      brightness(1.4)
      contrast(1.4)
      drop-shadow(0 0 5px rgba(255, 255, 255, 0.9))
      drop-shadow(0 0 10px rgba(255, 255, 255, 0.7))
      drop-shadow(0 0 15px rgba(255, 255, 255, 0.5))
      drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8))
      drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
    /* White shimmer glow - subtle but visible (not a frame border) */
    box-shadow: 
      0 0 12px rgba(255, 255, 255, 0.5),
      0 0 24px rgba(255, 255, 255, 0.3);
  }
  
  /* User display mobile adjustments */
  .user-display {
    padding: 10px 16px;
    gap: 10px;
    min-height: 44px;
  }
  
  .user-display__avatar {
    width: 32px;
    height: 32px;
  }
  
  .user-display__name {
    font-size: 14px;
  }
  
  .user-display__balance-value {
    font-size: 13px;
  }
  
  .user-display__info {
    gap: 10px;
  }
  
  .login-message {
    padding: 10px 12px;
  }
  
  .login-message__link {
    font-size: 13px;
  }
  
  .login-message__icon {
    font-size: 16px;
  }
}


/* Ensure the HTML 'hidden' attribute actually hides overlays (override .overlay display) */
.overlay[hidden] { display: none !important; }

/* Prevent dragging glyph images (no cheat drag-preview) */
.card img {
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   GLYPH VISIBILITY FIX (January 2026)
   Ensure the front face (glyph) ALWAYS renders above the back face.
   There are multiple `.cardBack` style blocks in this file; final overrides
   here avoid accidental stacking regressions from theming edits.
--------------------------------------------------------------------------- */
.card .cardInner.cardFront { z-index: 2 !important; }
.card .cardInner.cardBack { z-index: 1 !important; }


/* Fallback styling if a glyph image is missing */
.cardFront.missing {
  color: rgba(255, 215, 0, 0.85);
  font-size: 12px;
  letter-spacing: 1px;
}

/* Card back icon (polished) */
.cardBack{
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  /* deep glass */
  background:
    radial-gradient(120% 120% at 30% 20%, rgba(255,255,255,.10) 0%, rgba(255,255,255,.03) 35%, rgba(0,0,0,.18) 100%),
    linear-gradient(135deg, rgba(0,0,0,.28) 0%, rgba(0,0,0,.10) 45%, rgba(0,0,0,.24) 100%);

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.06),
    inset 0 -12px 24px rgba(0,0,0,.18);
}

/* slow moving sheen */
.cardBack::before{
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.18) 48%, transparent 60%);
  transform: translateX(-35%) rotate(12deg);
  opacity: .45;
  pointer-events: none;
  animation: backSheen 6.5s ease-in-out infinite;
}

@keyframes backSheen{
  0%   { transform: translateX(-45%) rotate(12deg); opacity: .28; }
  45%  { opacity: .55; }
  100% { transform: translateX(45%) rotate(12deg); opacity: .28; }
}

/* vignette + micro pattern */
.cardBack::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius: 18px;
  background:
    radial-gradient(80% 80% at 50% 50%, transparent 55%, rgba(0,0,0,.22) 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 2px, rgba(255,255,255,0) 2px 8px);
  mix-blend-mode: overlay;
  opacity: .35;
  pointer-events:none;
}

.backIcon{
  position: relative;
  width: clamp(44px, 18%, 72px);
  aspect-ratio: 1 / 1;
  transform: rotate(45deg);
  border-radius: 10px;
  z-index: 2;

  border: 2px solid rgba(212, 175, 55, .55);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.25),
    0 0 18px rgba(212, 175, 55, .16);

  background:
    radial-gradient(120% 120% at 30% 30%, rgba(0,255,210,.14) 0%, rgba(0,0,0,0) 55%),
    linear-gradient(135deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,.12) 100%);
}

.backIcon::before{
  content:"";
  position:absolute;
  inset: 22%;
  border-radius: 6px;
  border: 1px solid rgba(0,255,210,.22);
  box-shadow: 0 0 10px rgba(0,255,210,.10);
}

.backIcon::after{
  content:"";
  position:absolute;
  inset: -6px;
  border-radius: 14px;
  background: radial-gradient(closest-side, rgba(212,175,55,.12), transparent 70%);
  opacity: .85;
  pointer-events:none;
}

.backDots{
  position: absolute;
  inset: clamp(10px, 10%, 18px);
  border-radius: 14px;
  opacity: .40;
  background:
    radial-gradient(circle at 15% 20%, rgba(212,175,55,.55) 0 1px, transparent 2px),
    radial-gradient(circle at 85% 25%, rgba(0,255,210,.40) 0 1px, transparent 2px),
    radial-gradient(circle at 25% 85%, rgba(212,175,55,.45) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 80%, rgba(0,255,210,.35) 0 1px, transparent 2px);
  filter: blur(.2px);
}

/* hover polish */
@media (hover: hover) and (pointer: fine){
  .card:not(.matched):not(.is-flipped):hover{
    transform: translateY(-2px);
    box-shadow:
      0 18px 45px rgba(0,0,0,.35),
      inset 0 0 0 1px rgba(255,255,255,.06);
  }
  .card:not(.matched):not(.is-flipped):hover .backIcon{
    box-shadow:
      0 0 0 1px rgba(0,0,0,.25),
      0 0 22px rgba(212, 175, 55, .22);
    border-color: rgba(212, 175, 55, .70);
  }
}

/* tactile press */
.card:active{
  transform: translateY(0px) scale(.985);
}

/* 🧠 Back to Lab Button */
.lab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 20px;
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.08) 100%);
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 12px;
  color: var(--gold);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 12px rgba(255, 215, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
}

.lab-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 215, 0, 0.2) 48%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.lab-btn:hover::before {
  transform: translateX(100%);
}

.lab-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 215, 0, 0.15) 100%);
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 
    0 6px 20px rgba(255, 215, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 20px rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

.lab-btn:active {
  transform: translateY(0px) scale(0.98);
}

.lab-btn__icon {
  font-size: 20px;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
  transition: transform 0.3s ease;
}

.lab-btn:hover .lab-btn__icon {
  transform: rotate(15deg) scale(1.1);
}

.lab-btn__text {
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

0, 0, 0, 0.3);
}

