/* ═══════════════════════════════════════════════════════
   DUELZONE  ·  Main Menu Styles
   ═══════════════════════════════════════════════════════ */

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

/* ── GLOBAL SCROLLBAR REMOVAL ──────────────────────────── */
/* Hide all scrollbars globally — webkit, firefox, IE/Edge */
* {
  scrollbar-width: none !important;      /* Firefox */
  -ms-overflow-style: none !important;   /* IE/Edge */
}
*::-webkit-scrollbar {
  display: none !important;              /* Chrome/Safari/Opera */
  width: 0 !important;
  height: 0 !important;
}
*::-webkit-scrollbar-track,
*::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-corner {
  display: none !important;
}

/* ── Design tokens ─────────────────────────────────────── */
:root {
  --bg:          #07080f;
  --surface:     #0d0f1c;
  --surface-2:   #12152a;
  --border:      rgba(255,255,255,0.07);
  --text:        #e2e8ff;
  --muted:       #4a5080;
  --title-from:  #00e5ff;
  --title-to:    #f50057;
  --radius:      18px;
  --transition:  0.32s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Body & fonts ──────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── Atmospheric layers ────────────────────────────────── */
/*
   FIX: All decorative background layers get pointer-events: none.
   These are position:fixed and cover the full viewport — without this,
   they silently swallow every click before it ever reaches a card.
*/

/* Deep radial fog blob */
.bg-fog {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 50%,  rgba(0,229,255,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 80% 60%,  rgba(245,0,87,0.06)  0%, transparent 70%),
    radial-gradient(ellipse 80% 80% at 50% 100%, rgba(0,230,118,0.04) 0%, transparent 70%);
  pointer-events: none; /* ✅ decorative — never intercept clicks */
  z-index: 0;
}

/* Horizontal scanlines */
.bg-scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none; /* ✅ decorative — never intercept clicks */
  z-index: 1;
}

/* Subtle perspective grid at the bottom */
.bg-grid {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40vh;
  background:
    linear-gradient(to bottom, transparent, rgba(0,229,255,0.03)),
    repeating-linear-gradient(90deg, rgba(0,229,255,0.07) 0px, transparent 1px, transparent 80px),
    repeating-linear-gradient(0deg,  rgba(0,229,255,0.07) 0px, transparent 1px, transparent 80px);
  pointer-events: none; /* ✅ decorative — never intercept clicks */
  mask-image: linear-gradient(to bottom, transparent, black);
  z-index: 1;
}

/* ── Utility ─────────────────────────────────────────────── */
/* Single source of truth for hiding screens and elements */
.hidden { display: none !important; }

/* ── Performance: skip rendering of off-screen game screens ────────────
   content-visibility:auto tells the browser to skip layout+paint for any
   screen not currently visible — eliminating the cost of compositing 30+
   game screens simultaneously. contain:layout style paint stops each
   screen's internals from causing global layout recalculations. */
[id^="screen-"] {
  contain: layout style paint;
}
/* FIX 4: 'auto' is for scroll-offscreen visibility skipping — it does nothing on
   display:none elements. 'hidden' is the correct value: it preserves the rendering
   state in memory so switching back is instant, while still skipping all layout/paint. */
[id^="screen-"].hidden {
  content-visibility: hidden;
}

/* ── Screen layout ───────────────────────────────────────── */
/*
  Both screens sit in the same document. Only one is visible at a time.
  JS adds/removes .hidden to switch between them.
  Both fill the full viewport and center their content.
*/

/* ── Page shell (Hub screen) ───────────────────────────── */
#screen-hub {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 24px 40px;
  gap: 48px;
  overflow-y: auto;
}

/* ── Header ────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  gap: 24px;
  opacity: 0;
  transform: translateY(-30px);
  animation: slideDown 0.7s 0.1s cubic-bezier(0.23,1,0.32,1) forwards;
}

.header-center { text-align: center; }

.sword {
  font-size: 2rem;
  opacity: 0.5;
  filter: drop-shadow(0 0 8px var(--title-from));
  user-select: none;
}
.sword.left  { transform: scaleX(-1); }

/* Gradient shimmer title */
#title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, var(--title-from) 0%, #b06aff 50%, var(--title-to) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
  line-height: 1;
}

@keyframes shimmer {
  0%   { background-position: 0%   center; }
  100% { background-position: 200% center; }
}

#subtitle {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
  font-size: clamp(0.75rem, 1.5vw, 0.95rem);
  letter-spacing: 0.45em;
  color: var(--muted);
  margin-top: 8px;
  text-transform: uppercase;
}

/* Decorative line under subtitle */
.title-bar {
  width: 80px;
  height: 2px;
  margin: 10px auto 0;
  background: linear-gradient(90deg, var(--title-from), var(--title-to));
  border-radius: 2px;
  opacity: 0.6;
}

/* ── Arena grid ────────────────────────────────────────── */
#arena-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 860px;
}

/* ── Cards ─────────────────────────────────────────────── */
.arena-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  /*
    FIX: Removed `isolation: isolate`.
    isolation:isolate created a new stacking context where .card-glow
    (position:absolute; inset:0) would sit in the same hit-test layer as
    .card-inner even at z-index:-1 in certain browsers, silently eating
    pointer events from buttons inside .card-inner.
    We manage stacking explicitly via z-index on child elements instead.
  */
  pointer-events: auto; /* ✅ explicit — never inherited as none */
  z-index: 0;

  /* Staggered entrance */
  opacity: 0;
  transform: translateY(40px) scale(0.96);
  animation: cardIn 0.6s cubic-bezier(0.23,1,0.32,1) forwards;

  transition:
    transform var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

/* Each card enters with a staggered delay */
/* Cards 1-8 (first fold, both columns): nice stagger */
.arena-card:nth-child(1)  { animation-delay: 0.06s; }
.arena-card:nth-child(2)  { animation-delay: 0.10s; }
.arena-card:nth-child(3)  { animation-delay: 0.14s; }
.arena-card:nth-child(4)  { animation-delay: 0.18s; }
.arena-card:nth-child(5)  { animation-delay: 0.22s; }
.arena-card:nth-child(6)  { animation-delay: 0.26s; }
.arena-card:nth-child(7)  { animation-delay: 0.30s; }
.arena-card:nth-child(8)  { animation-delay: 0.34s; }
/* Cards 9-16: faster stagger — user may be scrolling */
.arena-card:nth-child(9)  { animation-delay: 0.38s; }
.arena-card:nth-child(10) { animation-delay: 0.40s; }
.arena-card:nth-child(11) { animation-delay: 0.42s; }
.arena-card:nth-child(12) { animation-delay: 0.44s; }
.arena-card:nth-child(13) { animation-delay: 0.46s; }
.arena-card:nth-child(14) { animation-delay: 0.48s; }
.arena-card:nth-child(15) { animation-delay: 0.50s; }
.arena-card:nth-child(16) { animation-delay: 0.52s; }
/* Cards 17-27: minimal delay — already off-screen at load */
.arena-card:nth-child(17) { animation-delay: 0.54s; }
.arena-card:nth-child(18) { animation-delay: 0.56s; }
.arena-card:nth-child(19) { animation-delay: 0.58s; }
.arena-card:nth-child(20) { animation-delay: 0.60s; }
.arena-card:nth-child(21) { animation-delay: 0.60s; }
.arena-card:nth-child(22) { animation-delay: 0.60s; }
.arena-card:nth-child(23) { animation-delay: 0.60s; }
.arena-card:nth-child(24) { animation-delay: 0.60s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(32px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Hover lift + glow — only on true pointer devices, not touch (prevents iOS sticky hover) */
@media (hover: hover) {
  .arena-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow:
      0 0 0 1px var(--accent),
      0 20px 60px -10px color-mix(in srgb, var(--accent) 40%, transparent),
      0 8px  24px -4px  color-mix(in srgb, var(--accent) 25%, transparent);
  }
  .arena-card:hover .card-top-bar { height: 4px; }
  .arena-card:hover .card-glow { opacity: 0.12; }
  .arena-card:hover .card-icon {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
    box-shadow: 0 0 20px -4px var(--accent);
  }
}

/* Shine sweep on hover */
.arena-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.07) 50%, transparent 60%);
  background-size: 200% 100%;
  background-position: 200% 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  border-radius: var(--radius);
}
@keyframes cardShine {
  from { background-position: 200% 0; }
  to   { background-position: -50% 0; }
}

.arena-card:active {
  transform: translateY(-4px) scale(1.01);
  transition-duration: 0.1s;
}

/* On touch devices: stronger tap feedback — users need to feel the tap */
@media (hover: none) and (pointer: coarse) {
  .arena-card:active {
    transform: scale(0.97);
    border-color: var(--accent);
    transition-duration: 0.08s;
  }
}

/* Colored top accent bar */
.card-top-bar {
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px 2px var(--accent);
  transition: height var(--transition);
  pointer-events: none; /* ✅ FIX: decorative bar was intercepting clicks at the card top */
}

/* ── Ambient glow behind card ── */
.card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 110%, var(--accent), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none; /* ✅ decorative absolute fill — must never intercept clicks */
  z-index: 0;           /* ✅ FIX: was z-index:-1 inside isolation:isolate which caused
                               hit-test ambiguity. Now z-index:0 but pointer-events:none
                               means it never captures events. .card-inner is z-index:1
                               so it always paints and hit-tests above this layer. */
}

/* ── Card inner layout ─────────────────────────────────── */
.card-inner {
  /*
    FIX: Added position:relative + z-index:1.
    Without this, .card-inner (static flow) had no explicit stacking guarantee
    over .card-glow (position:absolute). Now it is unambiguously above the glow
    layer in all browsers, ensuring all child elements (icon, text, button)
    receive pointer events correctly.
  */
  position: relative;
  z-index: 1;
  pointer-events: auto; /* ✅ explicit — inherit must never override this */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 28px 24px;
  /* Extra right padding keeps card-actions clear of the absolute-positioned bookmark button */
  padding-right: 50px;
}

/* Icon wrapper */
.card-icon {
  width: 64px;
  height: 64px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  flex-shrink: 0;
}

/* Text */
.card-text { flex: 1; }

.card-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  transition: color var(--transition);
}

.card-desc {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

/* Play button — base (non-card context fallback) */
.card-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 30px;
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform 0.15s;
}

/* ── Hub PLAY buttons — pill with accent gradient (matches reference) ── */
.arena-card .card-btn {
  overflow: hidden;
  border-radius: 30px;
  border: 1.5px solid var(--accent);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 18%, transparent),
    color-mix(in srgb, var(--accent)  6%, transparent));
  box-shadow:
    0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--accent) 20%, transparent);
}

@media (hover: hover) {
  .arena-card .card-btn:hover,
  .arena-card:hover .card-btn {
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 35%, transparent),
      color-mix(in srgb, var(--accent) 18%, transparent));
    box-shadow:
      0 0 20px -4px color-mix(in srgb, var(--accent) 60%, transparent),
      inset 0 1px 0 color-mix(in srgb, var(--accent) 30%, transparent);
    transform: translateY(-1px);
  }
  .card-btn:hover .btn-arrow { transform: translateX(3px); }
}

.arena-card .card-btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}
.card-btn:active { transform: scale(0.95); }

.btn-arrow {
  transition: transform var(--transition);
}

/* ── Card Actions Row (PLAY + SETUP side by side) ───────── */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

/* ── Setup (⚙) button on hub cards ─────────────────────── */
.card-setup-btn {
  display: none; /* hidden on desktop — shown only on mobile via media query */
}
.arena-card .card-setup-btn {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: color-mix(in srgb, var(--accent) 55%, transparent);
}

/* ── Per-color card hover glow (matches reference data-color attrs) ── */
@media (hover: hover) {
  .arena-card[data-color="cyan"]:hover   { border-color: rgba(0,229,255,0.45);  box-shadow: 0 0 0 1px rgba(0,229,255,0.35),  0 20px 60px -10px rgba(0,229,255,0.35); }
  .arena-card[data-color="orange"]:hover { border-color: rgba(255,109,0,0.45);  box-shadow: 0 0 0 1px rgba(255,109,0,0.35),  0 20px 60px -10px rgba(255,109,0,0.35); }
  .arena-card[data-color="green"]:hover  { border-color: rgba(0,230,118,0.45);  box-shadow: 0 0 0 1px rgba(0,230,118,0.35), 0 20px 60px -10px rgba(0,230,118,0.35); }
  .arena-card[data-color="pink"]:hover   { border-color: rgba(245,0,87,0.45);   box-shadow: 0 0 0 1px rgba(245,0,87,0.35),   0 20px 60px -10px rgba(245,0,87,0.35); }
  .arena-card[data-color="purple"]:hover { border-color: rgba(170,0,255,0.45);  box-shadow: 0 0 0 1px rgba(170,0,255,0.35),  0 20px 60px -10px rgba(170,0,255,0.35); }
  .arena-card[data-color="blue"]:hover   { border-color: rgba(41,121,255,0.45); box-shadow: 0 0 0 1px rgba(41,121,255,0.35), 0 20px 60px -10px rgba(41,121,255,0.35); }
  .arena-card[data-color="yellow"]:hover { border-color: rgba(255,214,0,0.45);  box-shadow: 0 0 0 1px rgba(255,214,0,0.35),  0 20px 60px -10px rgba(255,214,0,0.35); }
  .arena-card[data-color="red"]:hover    { border-color: rgba(255,82,82,0.45);  box-shadow: 0 0 0 1px rgba(255,82,82,0.35),  0 20px 60px -10px rgba(255,82,82,0.35); }
}

/* ── Footer ────────────────────────────────────────────── */
#footer {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-align: center;
  opacity: 0;
  animation: fadeIn 0.6s 1s ease forwards;
}

/* ── Launch overlay ────────────────────────────────────── */
/*
  FIX: Added visibility:hidden to the inactive state.
  opacity:0 + pointer-events:none is usually sufficient, but during the
  0.3s fade-out CSS transition, there is a brief window where the overlay
  is still partially visible. Using visibility:hidden removes the element
  from hit-testing entirely in its resting state, making this bulletproof.
  visibility transitions instantly on .active so the spinner appears
  immediately without any perceptible flicker.
*/
/* ══════════════════════════════════════════════════════════
   GAME LOADING SCREEN
   ══════════════════════════════════════════════════════════ */
#launch-overlay {
  position: fixed;
  inset: 0;
  background: #07080f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s;
}

#launch-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#launch-overlay.fade-out {
  opacity: 0;
}

#launch-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
}

/* ── Logo pulse ── */
.launch-logo-wrap {
  position: relative;
  animation: launch-logo-in 0.5s cubic-bezier(0.23,1,0.32,1) both;
}

.launch-dz-logo {
  height: 80px;
  width: auto;
  filter: drop-shadow(0 0 30px var(--launch-color, #00e5ff));
  animation: launch-logo-pulse 2s ease-in-out infinite;
}

@keyframes launch-logo-in {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes launch-logo-pulse {
  0%,100% { filter: drop-shadow(0 0 20px var(--launch-color, #00e5ff)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 45px var(--launch-color, #00e5ff)); transform: scale(1.04); }
}

/* ── Orbit ring ── */
.launch-ring-outer {
  position: relative;
  width: 96px;
  height: 96px;
  animation: launch-ring-in 0.5s 0.1s cubic-bezier(0.23,1,0.32,1) both;
}

@keyframes launch-ring-in {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.launch-ring-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.06);
}

/* Outer spinning arc */
.launch-ring-outer::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--launch-color, #00e5ff);
  border-right-color: var(--launch-color, #00e5ff);
  animation: launch-spin 1s linear infinite;
}

/* Inner counter-spinning arc */
.launch-ring-outer::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: var(--launch-color, #00e5ff);
  opacity: 0.5;
  animation: launch-spin 0.7s linear infinite reverse;
}

/* Orbiting dot */
.launch-ring-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--launch-color, #00e5ff);
  border-radius: 50%;
  top: -4px;
  left: calc(50% - 4px);
  box-shadow: 0 0 12px var(--launch-color, #00e5ff);
  transform-origin: 4px 52px;
  animation: launch-spin 1s linear infinite;
}

@keyframes launch-spin { to { transform: rotate(360deg); } }

/* ── Text ── */
.launch-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: launch-text-in 0.5s 0.2s cubic-bezier(0.23,1,0.32,1) both;
}

@keyframes launch-text-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

#launch-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.45em;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  animation: launch-label-blink 1.4s ease-in-out infinite;
}

@keyframes launch-label-blink {
  0%,100% { opacity: 0.3; }
  50%      { opacity: 0.7; }
}

#launch-game {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--launch-color, #00e5ff);
  text-shadow: 0 0 40px var(--launch-color, #00e5ff);
}

/* ── Progress bar ── */
.launch-progress-track {
  width: 220px;
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  animation: launch-text-in 0.5s 0.3s cubic-bezier(0.23,1,0.32,1) both;
}

.launch-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--launch-color, #00e5ff), rgba(255,255,255,0.8));
  border-radius: 3px;
  box-shadow: 0 0 10px var(--launch-color, #00e5ff);
  transition: width 0.1s linear;
}

/* ── VGWA Credit ── */
.launch-credit {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.2);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  animation: launch-text-in 0.5s 0.35s cubic-bezier(0.23,1,0.32,1) both;
}

.launch-vgwa-logo {
  height: 20px;
  width: auto;
  opacity: 0.35;
  filter: grayscale(1);
}

/* ── Shared animations ─────────────────────────────────── */
@keyframes slideDown {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  to { opacity: 1; }
}

/* ── Responsive ────────────────────────────────────────── */

/* Tablet (720px and below) — 2 columns, slightly tighter */
@media (max-width: 720px) {
  #arena-grid {
    gap: 14px;
    padding: 0 2px;
  }
  #screen-hub { padding: 64px 12px 32px !important; gap: 28px; }
  .card-inner { padding: 18px 16px 16px; padding-right: 44px; gap: 12px; }
  .card-icon  { width: 52px; height: 52px; border-radius: 12px; }
  .card-title { font-size: 0.9rem; }
  .card-desc  { font-size: 0.78rem; }
  .card-btn   { padding: 8px 14px; font-size: 0.64rem; }
  .card-setup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
  }
  .arena-card .card-setup-btn {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: color-mix(in srgb, var(--accent) 55%, transparent);
  }
  .arena-card .card-setup-btn:active {
    transform: rotate(45deg) scale(0.95);
  }
  .card-setup-btn svg { width: 11px; height: 11px; }
  .sword      { font-size: 1.5rem; }
  #title      { font-size: clamp(2rem, 8vw, 3.5rem); }
}

/* ── Small phones (≤480px) — vertical card layout ──────────────────
   FIXED: removed horizontal flex-direction which was causing
   game names to truncate to 1 letter on narrow 2-col cards.
   duelzone-mobile-fix.css handles the detailed card rules.
   ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-hub { padding: 56px 10px 24px !important; gap: 16px; }
  #arena-grid { gap: 10px; }

  /* Vertical layout — works in all screen sizes */
  .card-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 36px 12px 14px;
    gap: 8px;
  }
  .card-icon  { width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; }
  .card-icon svg { width: 20px !important; height: 20px !important; }
  .card-text  { width: 100%; min-width: 0; }
  .card-title { font-size: 0.72rem; letter-spacing: 0.01em; margin-bottom: 2px; white-space: normal; }
  .card-desc  { display: none; }
  .card-btn   { width: 100%; justify-content: center; min-height: 36px; padding: 0 8px; font-size: 0.60rem; letter-spacing: 0.10em; margin-top: 4px; }
  .card-btn .btn-arrow { display: none; }
  /* Bookmark — top right, not overlapping PLAY */
  .card-save-btn { top: 8px; right: 8px; bottom: auto; width: 24px; height: 24px; }
  .card-save-btn svg { width: 11px; height: 11px; }
  .card-setup-btn { width: 22px; height: 22px; }
  .card-actions { gap: 6px; }

  #title    { font-size: clamp(1.6rem, 8.5vw, 2.2rem); letter-spacing: 0.07em; }
  #subtitle { font-size: 0.60rem; letter-spacing: 0.25em; margin-top: 4px; }
  .title-bar { width: 56px; margin-top: 6px; }
  .sword    { display: none; }
}

/* ── Very small phones (≤390px) ───────────────────────────────────── */
@media (max-width: 390px) {
  #arena-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-inner { padding: 12px 32px 10px 12px; gap: 6px; }
  .card-icon  { width: 34px; height: 34px; }
  .card-title { font-size: 0.66rem; }
  .card-btn   { min-height: 32px; font-size: 0.56rem; }
  #title      { font-size: 1.55rem; }
  #screen-hub { padding: 52px 10px 20px !important; gap: 14px; }
}


/* ════════════════════════════════════════════════════════════
   SCREEN 2: Tic Tac Toe
   All rules scoped under #screen-ttt to prevent collisions
   with hub classes that share the same names.
   ════════════════════════════════════════════════════════════ */

/* TTT CSS variables — override hub vars inside this screen only */
#screen-ttt {
  --ttt-bg:        #0d0d0f;
  --ttt-surface:   #16161a;
  --ttt-border:    #2a2a30;
  --ttt-x:         #ff4d6d;
  --ttt-o:         #4cc9f0;
  --ttt-bot:       #b388ff;
  --ttt-text:      #e8e8f0;
  --ttt-muted:     #6b6b7e;
  --ttt-accent:    #f8f800;
  --ttt-radius:    12px;

  /* Screen layout */
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 24px 40px;
  font-family: 'DM Mono', monospace;
  color: var(--ttt-text);
}

/* Back to Hub button */
#back-to-hub {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  margin-bottom: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  background: transparent;
  color: var(--ttt-muted);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
#back-to-hub:hover {
  color: var(--ttt-text);
  border-color: var(--ttt-accent);
  background: rgba(248,248,0,0.06);
}

/* TTT App shell */
#ttt-app {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 420px;
}

/* Subtle grid texture behind TTT */
#screen-ttt::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--ttt-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--ttt-border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.25;
  pointer-events: none;
  z-index: -1;
}

/* TTT Header */
#ttt-header { text-align: center; }

#mode-label {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--ttt-accent);
  margin-bottom: 4px;
  transition: color 0.3s;
}

#ttt-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.8rem, 8vw, 4rem);
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--ttt-text);
  font-weight: 400;
}

/* Mode selector */
#mode-selector {
  display: flex;
  gap: 10px;
  width: 100%;
}

.mode-btn {
  flex: 1;
  padding: 11px 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  background: var(--ttt-surface);
  color: var(--ttt-muted);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.mode-btn:hover { color: var(--ttt-text); border-color: #444; }
.mode-btn.active { background: var(--ttt-accent); color: #000; border-color: var(--ttt-accent); font-weight: 500; }

/* Difficulty selector */
#difficulty-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--ttt-surface);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  padding: 10px 14px;
  gap: 12px;
}
#diff-label { font-size: 0.65rem; letter-spacing: 0.2em; color: var(--ttt-muted); flex-shrink: 0; }
#diff-buttons { display: flex; gap: 8px; }
.diff-btn {
  padding: 7px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--ttt-muted);
  border: 1px solid var(--ttt-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.diff-btn:hover { color: var(--ttt-text); border-color: #444; }
.diff-btn.active#btn-easy   { background: #2a9d2a; border-color: #2a9d2a; color: #fff; }
.diff-btn.active#btn-medium { background: #e08c00; border-color: #e08c00; color: #fff; }
.diff-btn.active#btn-hard   { background: #cc2222; border-color: #cc2222; color: #fff; }

/* Scorecards — prefixed .ttt-* to avoid hub class name collisions */
#scorecards { display: flex; align-items: center; gap: 12px; width: 100%; }

.ttt-scorecard {
  flex: 1;
  background: var(--ttt-surface);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ttt-scorecard.active { border-color: var(--ttt-accent); box-shadow: 0 0 18px -4px var(--ttt-accent); }

.ttt-mark { font-family: 'Bebas Neue', sans-serif; font-size: 2rem; line-height: 1; }
.ttt-mark.x   { color: var(--ttt-x);   }
.ttt-mark.o   { color: var(--ttt-o);   }
.ttt-mark.bot { color: var(--ttt-bot); }

.ttt-name  { font-size: 0.65rem; letter-spacing: 0.15em; color: var(--ttt-muted); text-transform: uppercase; }
.ttt-score { font-family: 'Bebas Neue', sans-serif; font-size: 1.6rem; color: var(--ttt-text); line-height: 1; }
.ttt-vs    { font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem; letter-spacing: 0.1em; color: var(--ttt-muted); flex-shrink: 0; }

/* Status banner */
#status-wrap {
  width: 100%;
  background: var(--ttt-surface);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  padding: 14px 20px;
  text-align: center;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#status { font-size: 0.95rem; letter-spacing: 0.06em; color: var(--ttt-text); transition: color 0.2s; }
#status.win  { color: var(--ttt-accent); font-size: 1.05rem; }
#status.draw { color: var(--ttt-muted);  font-size: 1.05rem; }
#status.thinking { color: var(--ttt-bot); animation: blink 0.7s ease infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: 0.4; } }

/* Board */
#board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
#board.disabled { pointer-events: none; opacity: 0.75; }

.cell {
  aspect-ratio: 1;
  background: var(--ttt-surface);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.cell:hover:not(.taken) { background: #1e1e24; border-color: #444; transform: scale(1.03); }
.cell.x { color: var(--ttt-x); border-color: rgba(255,77,109,0.35); }
.cell.o { color: var(--ttt-o); border-color: rgba(76,201,240,0.35); }
#board.bot-mode .cell.o { color: var(--ttt-bot); border-color: rgba(179,136,255,0.35); }
.cell.winner { animation: cellPulse 0.7s ease forwards; }
@keyframes cellPulse { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1.06); } }
@keyframes cellPop   { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.cell.x, .cell.o { animation: cellPop 0.2s ease forwards; }

/* Restart button */
#restart {
  width: 100%;
  padding: 15px;
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  background: transparent;
  color: var(--ttt-text);
  border: 1px solid var(--ttt-border);
  border-radius: var(--ttt-radius);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
#restart:hover { background: var(--ttt-accent); border-color: var(--ttt-accent); color: #000; }

/* TTT Responsive */
@media (max-width: 480px) {
  #screen-ttt { padding: 16px 16px 32px; }
  #ttt-app    { gap: 14px; }
}


/* ════════════════════════════════════════════════════════════
   SHARED GAME SCREEN STYLES (RPS, Tap Battle, 2048 Duel)
   ════════════════════════════════════════════════════════════ */

/* Generic back button for all game screens */
.back-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  margin-bottom: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  background: transparent;
  color: var(--ttt-muted, #6b6b7e);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  z-index: 20;
  position: relative;
}
.back-btn:hover {
  color: #e8e8f0;
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

/* Shared game header */
.game-header { text-align: center; margin-bottom: 4px; }
.game-mode-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: #f8f800;
  margin-bottom: 4px;
  transition: color 0.3s;
  text-transform: uppercase;
}
.game-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  letter-spacing: 0.08em;
  line-height: 1;
  color: #e8e8f0;
  font-weight: 400;
}

/* Shared mode selector that works in all game screens */
.game-mode-selector {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

/* Shared difficulty row */
.diff-label-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: #6b6b7e;
  flex-shrink: 0;
}
.diff-btn-group { display: flex; gap: 8px; }

/* Shared restart button */
.restart-btn {
  width: 100%;
  max-width: 480px;
  padding: 15px;
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  background: transparent;
  color: #e8e8f0;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.restart-btn:hover { background: #f8f800; border-color: #f8f800; color: #000; }


/* ════════════════════════════════════════════════════════════
   SCREEN 3: Rock Paper Scissors
   ════════════════════════════════════════════════════════════ */
#screen-rps {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 40px;
  font-family: 'DM Mono', monospace;
  color: #e8e8f0;
  gap: 16px;
}

#rps-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 480px;
}

#rps-bestof-selector, #rps-difficulty-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
}

/* Scorecards */
#rps-scorecards {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.rps-scorecard {
  flex: 1;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.rps-scorecard.active {
  border-color: #f8f800;
  box-shadow: 0 0 18px -4px #f8f800;
}
.rps-player-name {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: #6b6b7e;
  text-transform: uppercase;
}
.rps-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  color: #e8e8f0;
  line-height: 1;
}
.rps-round-wins {
  font-size: 0.6rem;
  color: #6b6b7e;
  letter-spacing: 0.12em;
}
.rps-vs {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: #6b6b7e;
  flex-shrink: 0;
}

#rps-best-of-display {
  font-size: 0.7rem;
  color: #6b6b7e;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Choices display */
#rps-choices-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 20px 12px;
  min-height: 110px;
}
.rps-choice-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.rps-choice-emoji {
  font-size: 2.8rem;
  display: block;
  transition: transform 0.3s cubic-bezier(0.23,1,0.32,1), opacity 0.2s;
  transform-origin: center;
}
.rps-choice-emoji.reveal {
  animation: rpsReveal 0.4s cubic-bezier(0.23,1,0.32,1) forwards;
}
@keyframes rpsReveal {
  0%  { transform: scale(0) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.25) rotate(5deg); opacity: 1; }
  100%{ transform: scale(1) rotate(0deg); opacity: 1; }
}
.rps-choice-label {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: #6b6b7e;
  text-transform: uppercase;
}
#rps-result-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: #e8e8f0;
  text-align: center;
  min-width: 80px;
  text-align: center;
}
#rps-result-text.win  { color: #f8f800; }
#rps-result-text.lose { color: #ff4d6d; }
#rps-result-text.draw { color: #6b6b7e; }

/* Pick buttons */
.rps-pick-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.rps-pick-prompt {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: #f8f800;
  text-transform: uppercase;
  text-align: center;
}
.rps-btn-row {
  display: flex;
  gap: 12px;
  width: 100%;
}
.rps-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 8px;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 2rem;
  color: #6b6b7e;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  line-height: 1;
}
.rps-btn span { font-size: 0.65rem; letter-spacing: 0.1em; }
.rps-btn:hover {
  background: #1e1e24;
  border-color: #00e676;
  color: #00e676;
  transform: translateY(-3px) scale(1.03);
}
.rps-btn:active { transform: scale(0.97); }
.rps-btn .rps-btn-emoji { font-size: 2rem; }


/* ════════════════════════════════════════════════════════════
   SCREEN 4: Tap Battle
   ════════════════════════════════════════════════════════════ */
#screen-tapbattle {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 0;
  font-family: 'DM Mono', monospace;
  color: #e8e8f0;
  overflow: hidden;
}
#screen-tapbattle .back-btn {
  align-self: flex-start;
  margin-left: 16px;
  margin-bottom: 8px;
}

#tap-header-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}
#tap-top-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 600px;
  padding: 0 16px;
  margin-bottom: 12px;
}
.tap-mode-row {
  display: flex;
  gap: 10px;
  width: 100%;
}
#tap-difficulty-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
}

/* The main tap arena — splits into two halves */
#tap-arena {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 860px;
  gap: 0;
  position: relative;
  min-height: 420px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #2a2a30;
  margin: 0 auto;
}
.tap-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 20px;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  background: #16161a;
}
#tap-left  { border-right: 1px solid #2a2a30; }
.tap-side:active { background: #1e1e24; }

.tap-player-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
}
#tap-left  .tap-player-label { color: #00e5ff; }
#tap-right .tap-player-label { color: #f50057; }

.tap-count {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4.5rem, 14vw, 8rem);
  line-height: 1;
  color: #e8e8f0;
  transition: transform 0.05s;
}
#tap-left  .tap-count { color: #00e5ff; text-shadow: 0 0 30px rgba(0,229,255,0.4); }
#tap-right .tap-count { color: #f50057; text-shadow: 0 0 30px rgba(245,0,87,0.4); }

.tap-count.bump {
  animation: tapBump 0.12s ease;
}
@keyframes tapBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.16); }
  100% { transform: scale(1); }
}
.tap-progress-wrap {
  width: 85%;
  height: 10px;
  background: #2a2a30;
  border-radius: 5px;
  overflow: hidden;
}
.tap-progress-bar {
  --tap-color: #00e5ff;
  height: 100%;
  width: 0%;
  background: var(--tap-color);
  border-radius: 5px;
  transition: width 0.1s ease;
  box-shadow: 0 0 8px var(--tap-color);
}
/* Key hint badge — shows keyboard shortcut on laptop */
.tap-key-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 8px;
  padding: 5px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#tap-left  .tap-key-badge { color: #00e5ff; border-color: rgba(0,229,255,0.25); background: rgba(0,229,255,0.07); }
#tap-right .tap-key-badge { color: #f50057; border-color: rgba(245,0,87,0.25);  background: rgba(245,0,87,0.07);  }

.tap-tap-hint {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
}
/* Hide key badges on touch-only devices */
@media (hover: none) and (pointer: coarse) {
  .tap-key-badge { display: none; }
}

/* Divider with countdown */
.tap-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  flex-shrink: 0;
  background: #0d0f1c;
  border-left: 1px solid #2a2a30;
  border-right: 1px solid #2a2a30;
  pointer-events: none;
}
.tap-countdown {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: #6b6b7e;
  text-align: center;
  line-height: 1.4;
  transition: color 0.2s, font-size 0.2s;
  white-space: pre-line;
}
.tap-countdown.active {
  font-size: 2.4rem;
  color: #f8f800;
  animation: countFlash 0.3s ease;
}
.tap-countdown.go {
  color: #00e676;
  font-size: 1.6rem;
}
@keyframes countFlash {
  0% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Win overlay */
#tap-win-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7,8,15,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: 16px;
  backdrop-filter: blur(4px);
}
#tap-win-overlay.hidden { display: none; }
#tap-win-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
#tap-win-emoji { font-size: 3.5rem; animation: winBounce 0.5s ease; }
@keyframes winBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
#tap-win-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  color: #f8f800;
  letter-spacing: 0.08em;
}
#tap-win-overlay .restart-btn {
  width: auto;
  padding: 12px 32px;
}


/* ════════════════════════════════════════════════════════════
   SCREEN 5: 2048 Duel
   ════════════════════════════════════════════════════════════ */
#screen-duel2048 {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 32px;
  font-family: 'DM Mono', monospace;
  color: #e8e8f0;
  gap: 12px;
}

#d2048-header { text-align: center; }

#d2048-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 720px;
}
.d2048-mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.d2048-mode-row .mode-btn { flex: 1; min-width: 100px; }

#d2048-difficulty-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
}

#d2048-status-bar {
  background: #16161a;
  border: 1px solid #2a2a30;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #e8e8f0;
  text-align: center;
  width: 100%;
  max-width: 720px;
}

/* Arena: two grids side by side */
#d2048-arena {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  justify-content: center;
}

.d2048-player-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}
.d2048-player-section.active-turn .d2048-board {
  border-color: #f8f800;
  box-shadow: 0 0 20px -4px #f8f800;
}

.d2048-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.d2048-player-name {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6b6b7e;
}
.d2048-score-label {
  font-size: 0.68rem;
  color: #6b6b7e;
  letter-spacing: 0.06em;
}
.d2048-score {
  color: #e8e8f0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
}

/* 2048 board — CSS Grid */
.d2048-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: #16161a;
  border: 2px solid #2a2a30;
  border-radius: 12px;
  padding: 8px;
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.3s;
}

.d2048-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(0.9rem, 3vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  background: #0d0f1c;
  color: transparent;
  transition: background 0.15s, transform 0.12s;
  user-select: none;
}

/* Tile color map */
.d2048-cell[data-v="2"]    { background:#1e3a2e; color:#7fffd4; }
.d2048-cell[data-v="4"]    { background:#1e2e3a; color:#7fd4ff; }
.d2048-cell[data-v="8"]    { background:#2e1e3a; color:#d47fff; }
.d2048-cell[data-v="16"]   { background:#3a1e2e; color:#ff7fd4; }
.d2048-cell[data-v="32"]   { background:#3a2a1e; color:#ffd47f; }
.d2048-cell[data-v="64"]   { background:#3a1e1e; color:#ff7f7f; }
.d2048-cell[data-v="128"]  { background:#2a3a1e; color:#b5ff7f; font-size: clamp(0.75rem,2.5vw,1.1rem); }
.d2048-cell[data-v="256"]  { background:#1e3a3a; color:#7fffff; font-size: clamp(0.75rem,2.5vw,1.1rem); }
.d2048-cell[data-v="512"]  { background:#1a1a3a; color:#9999ff; font-size: clamp(0.75rem,2.5vw,1.1rem); }
.d2048-cell[data-v="1024"] { background:#3a3a1a; color:#ffff99; font-size: clamp(0.65rem,2vw,0.9rem); }
.d2048-cell[data-v="2048"] { background:#ff6d00; color:#fff; font-size: clamp(0.65rem,2vw,0.9rem); animation: tile2048 0.4s ease; }
@keyframes tile2048 {
  0%  { transform: scale(1); box-shadow: 0 0 0 0 #ff6d00; }
  50% { transform: scale(1.2); box-shadow: 0 0 30px 10px #ff6d00; }
  100%{ transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}
.d2048-cell.new-tile { animation: tileAppear 0.2s ease forwards; }
@keyframes tileAppear {
  0%   { transform: scale(0); opacity: 0; }
  80%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
.d2048-cell.merged { animation: tileMerge 0.2s ease; }
@keyframes tileMerge {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.d2048-vs-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  align-self: center;
}
.d2048-vs-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: #6b6b7e;
}

.d2048-controls-hint {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: #6b6b7e;
  text-transform: uppercase;
}

/* Responsive 2048 board */
@media (max-width: 540px) {
  #d2048-arena { flex-direction: column; align-items: center; }
  .d2048-player-section { max-width: 300px; width: 100%; }
  .d2048-vs-col { padding: 4px 0; }
  #d2048-status-bar { font-size: 0.7rem; }
}

@media (max-width: 420px) {
  #screen-tapbattle { padding-bottom: 0; }
  #tap-arena { min-height: 340px; }
  .tap-count { font-size: 3.5rem; }
  .rps-btn {
    padding: 10px 4px;
    min-width: 0;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
  }
  .rps-btn > span:first-child,
  .rps-btn .rps-btn-emoji { font-size: 1.5rem; }
  .rps-btn span { font-size: 0.6rem; letter-spacing: 0.04em; }
  .rps-btn-row { gap: 6px; }
}

/* ════════════════════════════════════════════════════════════
   2048 DUEL — IMPROVED (overrides old cell-based rules)
   ════════════════════════════════════════════════════════════ */

/* Board: grid for background slots, relative for absolute tiles */
.d2048-board {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 6px !important;
  padding: 8px !important;
  background: #0b0d18 !important;
  border: 2px solid #2a2a30 !important;
  border-radius: 14px !important;
  width: 100% !important;
  aspect-ratio: unset !important;   /* height driven by slot content */
  position: relative !important;
  transition: border-color 0.25s, box-shadow 0.3s !important;
  overflow: hidden;
}

/* Active player board glow */
.d2048-player-section.active-turn .d2048-board {
  border-color: #aa00ff !important;
  box-shadow: 0 0 24px -4px rgba(170,0,255,0.5) !important;
}

/* Background slots — purely decorative, positioned by CSS grid */
.d2048-slot {
  aspect-ratio: 1;
  background: #16182a;
  border-radius: 7px;
  pointer-events: none;
}

/* ── Tiles: absolutely positioned, animated ── */
.d2048-tile {
  position: absolute !important;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  letter-spacing: 0.03em;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  /* No transition by default — set dynamically in JS when moving */
}

/* ── Tile colour palette ── */
.d2048-tile[data-v="2"]    { background:#1a3527; color:#6effc5; font-size: 1.4em; }
.d2048-tile[data-v="4"]    { background:#16253a; color:#6ecfff; font-size: 1.4em; }
.d2048-tile[data-v="8"]    { background:#271a3a; color:#c96eff; font-size: 1.4em; }
.d2048-tile[data-v="16"]   { background:#3a1a28; color:#ff6ec9; font-size: 1.4em; }
.d2048-tile[data-v="32"]   { background:#3a2a14; color:#ffc96e; font-size: 1.4em; }
.d2048-tile[data-v="64"]   { background:#3a1a14; color:#ff6e6e; font-size: 1.4em; }
.d2048-tile[data-v="128"]  { background:#203a14; color:#9eff6e; font-size: 1.2em; }
.d2048-tile[data-v="256"]  { background:#143a3a; color:#6effff; font-size: 1.2em; }
.d2048-tile[data-v="512"]  { background:#14143a; color:#8080ff; font-size: 1.2em; }
.d2048-tile[data-v="1024"] { background:#3a3a14; color:#ffff80; font-size: 1em;   }
.d2048-tile[data-v="2048"] {
  background: linear-gradient(135deg, #ff6d00, #ffab00);
  color: #fff;
  font-size: 1em;
  box-shadow: 0 0 24px 6px rgba(255,109,0,0.7);
}
.d2048-tile[data-v="4096"] {
  background: linear-gradient(135deg, #aa00ff, #f50057);
  color: #fff;
  font-size: 0.9em;
  box-shadow: 0 0 28px 8px rgba(170,0,255,0.7);
}
.d2048-tile[data-v="8192"] {
  background: linear-gradient(135deg, #00e5ff, #00e676);
  color: #000;
  font-size: 0.9em;
  box-shadow: 0 0 32px 10px rgba(0,229,255,0.7);
}

/* ── Tile animations ── */
@keyframes tileSpawn {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.18) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); }
}
@keyframes tileMergePop {
  0%   { transform: scale(1);    z-index: 6; }
  35%  { transform: scale(1.25); z-index: 6; }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
@keyframes boardShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-5px); }
  40%     { transform: translateX(5px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}

.tile-new   { animation: tileSpawn    0.22s cubic-bezier(0.23,1,0.32,1) forwards; }
.tile-merge { animation: tileMergePop 0.24s cubic-bezier(0.23,1,0.32,1) forwards; }
.board-shake { animation: boardShake 0.3s ease; }

/* ── Stat chips in player header ── */
.d2048-player-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-bottom: 4px;
}
.d2048-stats-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.d2048-stat-chip {
  background: #16182a;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1;
  min-width: 52px;
}
.d2048-stat-lbl {
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  color: #4a506a;
  text-transform: uppercase;
}
.d2048-stat-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  color: #c8ccee;
  line-height: 1;
}
/* Score chip gets accent colour when > 0 */
.d2048-stat-chip:first-child .d2048-stat-val { color: #aa00ff; }

/* ── Win overlay ── */
#d2048-win-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 14, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 0;
  animation: winFadeIn 0.4s ease forwards;
}
#d2048-win-overlay.hidden { display: none !important; }
@keyframes winFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#d2048-win-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}
#d2048-win-trophy {
  font-size: 4rem;
  animation: trophySpin 0.6s cubic-bezier(0.23,1,0.32,1) forwards;
}
@keyframes trophySpin {
  0%   { transform: scale(0) rotate(-30deg); }
  70%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}
#d2048-win-text {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.6rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #aa00ff, #ff6d00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
#d2048-win-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: #6b6b7e;
}

/* ── 2048 screen needs relative positioning for the win overlay ── */
#screen-duel2048 {
  position: relative !important;
}

/* ════════════════════════════════════════════════════════════
   HAND CRICKET STYLES
   ════════════════════════════════════════════════════════════ */

#screen-cricket {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
}

#cricket-app {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Setup grid */
.cricket-setup-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.cricket-setup-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cricket-mode-desc {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Wicket selector */
.cricket-wicket-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.cricket-wicket-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(118,255,3,0.4);
  background: transparent;
  color: #76ff03;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.cricket-wicket-btn:hover { background: rgba(118,255,3,0.15); }

#cric-wicket-display {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: #76ff03;
  min-width: 32px;
  text-align: center;
}

/* Toss */
.cricket-toss-inner {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.cricket-section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.1em;
  color: #76ff03;
}

.cricket-toss-inst {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* Numpad */
.cricket-numpad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.cricket-num-btn {
  background: var(--surface-2);
  border: 1px solid rgba(118,255,3,0.25);
  border-radius: 10px;
  color: #e2e8ff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  padding: 12px 0;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}
.cricket-num-btn:hover {
  border-color: #76ff03;
  color: #76ff03;
  background: rgba(118,255,3,0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(118,255,3,0.2);
}
.cricket-num-btn:active {
  transform: translateY(0);
  transition-duration: 0.05s;
}
.cricket-num-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Reveal row */
.cricket-reveal-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.cricket-reveal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 90px;
}

.cricket-reveal-lbl {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
}

.cricket-reveal-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  color: #76ff03;
  line-height: 1;
  transition: transform 0.25s cubic-bezier(0.23,1,0.32,1);
}
.cricket-reveal-num.pop {
  animation: numPop 0.3s cubic-bezier(0.23,1,0.32,1);
}
@keyframes numPop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.cricket-reveal-result {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px;
  text-align: center;
  min-width: 60px;
}

/* Big message */
.cricket-big-msg {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #76ff03, #00e676);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Scoreboard */
.cricket-scoreboard {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.cricket-score-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.cricket-score-name {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.cricket-score-runs {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.8rem;
  color: #76ff03;
  line-height: 1;
}

.cricket-score-wkt {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.cricket-score-vs {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: #3a3a5a;
  letter-spacing: 0.1em;
}

/* Info bar */
.cricket-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* Result screen */
.cricket-result-inner {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: winFadeIn 0.4s ease forwards;
}

#cric-result-trophy {
  font-size: 4rem;
  animation: trophySpin 0.6s cubic-bezier(0.23,1,0.32,1) forwards;
}

#cric-result-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #76ff03, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#cric-result-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.cricket-final-scores {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: #e2e8ff;
  margin-top: 6px;
}

/* Active batting panel highlight */
.cricket-score-panel.batting .cricket-score-runs {
  color: #76ff03;
  text-shadow: 0 0 16px rgba(118,255,3,0.5);
}
.cricket-score-panel.bowling .cricket-score-runs {
  color: #4a5080;
}

/* OUT flash animation */
@keyframes outFlash {
  0%, 100% { color: #ff1744; }
  50%       { color: #ff6d00; }
}
.out-flash { animation: outFlash 0.5s ease 3; }



/* ════════════════════════════════════════════════════════════════
   GAME HOME PAGES — Lobby/Setup screens for every game
   ════════════════════════════════════════════════════════════════ */

/* Home panel fills the screen, scrollable */
.game-home-panel {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;   /* always start from top */
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 70px 16px 48px;       /* top pad clears the menu button */
  animation: ghpSlideIn 0.35s cubic-bezier(0.23,1,0.32,1) both;
  box-sizing: border-box;
}
@keyframes ghpSlideIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Back button to hub — top-left */
.ghp-back-hub {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}
.ghp-back-hub:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}

/* Back button within game → goes back to setup */
.ghp-back-game {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
  position: relative;
  z-index: 10;
}
.ghp-back-game:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
}

/* Central content column */
.ghp-wrap {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

/* Hero section: icon + title + tagline */
.ghp-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 8px 0 4px;
}

.ghp-icon-wrap {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--ghp-accent, #00e5ff) 30%, transparent);
  box-shadow:
    0 0 32px -8px var(--ghp-accent, #00e5ff),
    inset 0 0 20px -10px color-mix(in srgb, var(--ghp-accent, #00e5ff) 20%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ghpIconPulse 3s ease-in-out infinite;
}
@keyframes ghpIconPulse {
  0%, 100% { box-shadow: 0 0 24px -8px var(--ghp-accent, #00e5ff), inset 0 0 20px -10px color-mix(in srgb, var(--ghp-accent, #00e5ff) 15%, transparent); }
  50%       { box-shadow: 0 0 40px -4px var(--ghp-accent, #00e5ff), inset 0 0 24px -8px color-mix(in srgb, var(--ghp-accent, #00e5ff) 25%, transparent); }
}

.ghp-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--ghp-accent, #00e5ff), color-mix(in srgb, var(--ghp-accent, #00e5ff) 60%, #fff));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.ghp-tagline {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Rules card */
.ghp-rules {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}

.ghp-rules-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.ghp-rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.ghp-rules-list li {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
  padding-left: 20px;
  position: relative;
}

.ghp-rules-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--ghp-accent, #00e5ff);
  font-size: 0.75rem;
  top: 2px;
}

.ghp-rules-list strong {
  color: var(--ghp-accent, #00e5ff);
  -webkit-text-fill-color: initial;
}

/* Settings card */
.ghp-settings {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ghp-setting-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Big start button */
.ghp-start-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg,
    var(--ghp-accent, #00e5ff),
    color-mix(in srgb, var(--ghp-accent, #00e5ff) 70%, #fff));
  color: #000;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 4px 24px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 60%, transparent);
}
.ghp-start-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 32px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 70%, transparent);
}
.ghp-start-btn:active {
  transform: translateY(0) scale(0.99);
  transition-duration: 0.08s;
}

/* Game play panel animation */
.game-play-panel {
  width: 100%;
  animation: ghpSlideIn 0.3s cubic-bezier(0.23,1,0.32,1) both;
}

/* ═══════════════════════════
   CRICKET: Clicked numpad button highlight
   ═══════════════════════════ */
.cricket-num-btn.selected {
  background: rgba(118,255,3,0.22) !important;
  border-color: #76ff03 !important;
  color: #76ff03 !important;
  box-shadow: 0 0 20px rgba(118,255,3,0.5), inset 0 0 12px rgba(118,255,3,0.1) !important;
  transform: scale(1.08) !important;
  transition: all 0.12s cubic-bezier(0.23,1,0.32,1) !important;
}

/* Screen containers that now hold home + game panels */
#screen-ttt,
#screen-rps,
#screen-tapbattle,
#screen-duel2048 {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  padding: 0;
}

/* Game play panels get padding */
#ttt-play-panel,
#rps-play-panel:not(.hidden),
#tap-play-panel,
#d2048-play-panel {
  display: flex;
  flex-direction: column;
  padding: 20px 16px 40px;
  width: 100%;
}

/* Small mode label chip at top of game screen */
.game-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .ghp-icon-wrap { width: 72px; height: 72px; border-radius: 18px; }
  .ghp-title { font-size: 1.8rem; }
  .ghp-rules, .ghp-settings { padding: 14px 16px; }
}

/* ═══════════════════════════════════════════════════════
   ENHANCED BUTTON COLORS & VISUAL UPGRADES
   ═══════════════════════════════════════════════════════ */

/* ── Hub PLAY buttons — per-card accent colors ── */
.arena-card .card-btn {
  position: relative;
  overflow: hidden;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  padding: 10px 20px;
  border-radius: 30px;
  border: 1.5px solid var(--accent);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--accent) 18%, transparent),
    color-mix(in srgb, var(--accent) 6%, transparent));
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.28s cubic-bezier(0.23,1,0.32,1);
  box-shadow:
    0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--accent) 20%, transparent);
  z-index: 5;
}
@media (hover: hover) {
  .arena-card .card-btn:hover,
  .arena-card:hover .card-btn {
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 35%, transparent),
      color-mix(in srgb, var(--accent) 18%, transparent));
    box-shadow:
      0 0 20px -4px color-mix(in srgb, var(--accent) 60%, transparent),
      inset 0 1px 0 color-mix(in srgb, var(--accent) 30%, transparent);
    transform: translateY(-1px);
  }
}
.arena-card .card-btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.08s;
}

/* ── diff-btn / mode-btn colorful upgrade ── */
.diff-btn {
  background: var(--surface-2);
  border: 1.5px solid rgba(255,255,255,0.12);
  color: #8899cc;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 8px 18px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.23,1,0.32,1);
  white-space: nowrap;
}
.diff-btn:hover {
  border-color: rgba(255,255,255,0.28);
  color: #ccd6ff;
  background: rgba(255,255,255,0.07);
  transform: translateY(-1px);
}
.diff-btn.active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 25%, #0d0f1c),
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 12%, #0d0f1c));
  border-color: var(--ghp-accent,#00e5ff);
  color: var(--ghp-accent,#00e5ff);
  box-shadow:
    0 0 14px -4px color-mix(in srgb, var(--ghp-accent,#00e5ff) 55%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--ghp-accent,#00e5ff) 18%, transparent);
}

/* ── mode-btn inside game screen ── */
.mode-btn {
  background: var(--surface-2);
  border: 1.5px solid rgba(255,255,255,0.10);
  color: #7788bb;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  padding: 7px 16px;
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.23,1,0.32,1);
}
.mode-btn:hover { border-color: rgba(255,255,255,0.24); color: #ccd6ff; background: rgba(255,255,255,0.06); }
.mode-btn.active {
  background: linear-gradient(135deg, rgba(0,229,255,0.22), rgba(0,229,255,0.08));
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 14px -4px rgba(0,229,255,0.45);
}

/* ── restart / action buttons ── */
.restart-btn,
#restart,
#c4-btn-reset,
#rps-restart,
#tap-restart,
#d2048-restart,
#cric-play-again,
#d2048-win-restart {
  background: linear-gradient(135deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  border: 1.5px solid rgba(255,255,255,0.18);
  color: #ccd6ff;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  padding: 11px 28px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  display: block;
  margin: 16px auto 0;
}
.restart-btn:hover,
#restart:hover,
#c4-btn-reset:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.06));
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px -4px rgba(255,255,255,0.15);
}

/* ── ghp-start-btn colors ── */
.ghp-start-btn {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 90%, #000) 0%,
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 70%, #000) 100%);
  color: #000;
  border: none;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
}

/* ── Back buttons ── */
.ghp-back-hub, .ghp-back-game,
#cricket-back-btn, #ttt-home-back,
#rps-home-back, #tap-home-back,
#d2048-home-back, #c4-home-back,
#ttt-back-to-home, #rps-back-to-home,
#tap-back-to-home, #d2048-back-to-home,
#c4-back-to-home, #pb-main-back,
#ah-main-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  width: -moz-fit-content;
  max-width: fit-content;
  align-self: flex-start;
  flex-shrink: 0;
  position: absolute;
  /* FIX: pushed down below the hamburger (44px tall at top:16px → bottom at 60px; +12px gap = 72px) */
  top: 72px;
  left: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #8899cc;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.22s;
  z-index: 20;
}
.ghp-back-hub:hover, .ghp-back-game:hover,
#cricket-back-btn:hover, #ttt-home-back:hover,
#rps-home-back:hover, #tap-home-back:hover,
#d2048-home-back:hover, #c4-home-back:hover,
#ttt-back-to-home:hover, #rps-back-to-home:hover,
#tap-back-to-home:hover, #d2048-back-to-home:hover,
#c4-back-to-home:hover, #pb-main-back:hover,
#ah-main-back:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
  color: #ccd6ff;
  transform: translateX(-2px);
}

/* ── Screen game play panels — centered content ── */
#screen-ttt,
#screen-rps,
#screen-tapbattle,
#screen-duel2048,
#screen-c4,
#screen-cricket,
#screen-airhockey,
#screen-passbreach {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
}

/* Play panels inside each game screen */
#ttt-play-panel,
#rps-play-panel:not(.hidden),
#tap-play-panel,
#d2048-play-panel,
#c4-play-panel,
#ah-play-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100dvh;
  padding: 16px 16px 40px;
}

#ttt-app,
#rps-app,
#d2048-app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}


#screen-c4 {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  padding: 0;
}
#c4-play-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 16px 40px;
  width: 100%;
}
#c4-app {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
#c4-game-header {
  text-align: center;
  padding-top: 8px;
}
.c4-eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: #ff6d00;
  text-transform: uppercase;
  opacity: 0.75;
}
#c4-game-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.12em;
  color: #ff6d00;
  text-shadow: 0 0 24px rgba(255,109,0,0.4);
  margin-top: 2px;
}
#c4-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.c4-player-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 10px 16px;
  flex: 1;
  transition: all 0.25s;
}
.c4-player-card.active-turn {
  border-color: rgba(255,109,0,0.5);
  box-shadow: 0 0 20px -4px rgba(255,109,0,0.3);
  background: rgba(255,109,0,0.06);
}
.c4-disc-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.c4-disc-dot.red    { background: #ff4444; box-shadow: 0 0 8px rgba(255,68,68,0.6); }
.c4-disc-dot.yellow { background: #ffcc00; box-shadow: 0 0 8px rgba(255,204,0,0.6); }
.c4-player-label {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
}
.c4-player-score {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}
#c4-status-wrap {
  text-align: center;
  flex-shrink: 0;
  min-width: 80px;
}
#c4-status-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}
#c4-status-text.win { color: #ffd700; font-weight: 700; font-size: 0.82rem; }
#c4-status-text.draw { color: #8899cc; }
#c4-status-text.thinking { color: #ff6d00; opacity: 0.8; }
#c4-status-text.p1-turn { color: #ff8844; }
#c4-status-text.p2-turn { color: #ffcc44; }

/* Drop zone */
#c4-drop-zone {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 462px;
  padding: 0 3px;
}
.c4-drop-cell { position: relative; height: 24px; display: flex; align-items: center; justify-content: center; }
.c4-ghost-disc {
  width: 38px; height: 38px; border-radius: 50%;
  opacity: 0; transform: scale(0.7);
  transition: opacity 0.15s, transform 0.15s;
}

/* Board */
#c4-board-wrap {
  position: relative;
  width: 100%;
  max-width: 462px;
}
#c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: linear-gradient(145deg, #1a0a3a, #0d0520);
  border-radius: 16px;
  padding: 10px;
  border: 2px solid rgba(255,109,0,0.2);
  box-shadow: 0 8px 40px -8px rgba(255,109,0,0.2), inset 0 0 30px rgba(0,0,0,0.4);
}
.c4-board-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(ellipse at 35% 35%, #0a0018, #050010);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8), inset 0 0 0 1px rgba(255,255,255,0.04);
  transition: background 0.1s;
}
.c4-board-cell.red {
  background: radial-gradient(ellipse at 35% 30%, #ff7777, #cc2222);
  box-shadow: 0 0 12px rgba(255,68,68,0.5), inset 0 -2px 4px rgba(0,0,0,0.4);
}
.c4-board-cell.yellow {
  background: radial-gradient(ellipse at 35% 30%, #ffee44, #cc9900);
  box-shadow: 0 0 12px rgba(255,204,0,0.5), inset 0 -2px 4px rgba(0,0,0,0.4);
}
.c4-board-cell.winner-cell {
  animation: c4Pulse 0.5s ease-in-out infinite alternate;
}
@keyframes c4Pulse {
  from { filter: brightness(1); box-shadow: 0 0 12px rgba(255,255,255,0.3); }
  to   { filter: brightness(1.4); box-shadow: 0 0 28px rgba(255,255,255,0.7); }
}
.c4-board-cell.dropping {
  animation: c4Drop 0.32s cubic-bezier(0.3, 0, 0.8, 0.6);
}
@keyframes c4Drop {
  from { transform: translateY(-160px); opacity: 0.5; }
  to   { transform: translateY(0);      opacity: 1; }
}
#c4-col-overlays {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  border-radius: 12px;
  overflow: hidden;
}
.c4-col-overlay {
  cursor: pointer;
  border-radius: 4px;
  background: transparent;
  transition: background 0.15s;
}
.c4-col-overlay:hover { background: rgba(255,109,0,0.08); }
#c4-board-wrap.locked .c4-col-overlay { cursor: not-allowed; pointer-events: none; }

/* ── RPS buttons colorful upgrade ── */
.rps-btn {
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 1.5px solid rgba(0,230,118,0.25);
  color: #00e676;
  border-radius: 16px;
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  transition: all 0.22s cubic-bezier(0.23,1,0.32,1);
  min-width: 88px;
}
.rps-btn .rps-btn-emoji, .rps-btn > span:first-child { font-size: 2rem; }
.rps-btn:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(0,230,118,0.18), rgba(0,230,118,0.06));
  border-color: #00e676;
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 8px 24px -4px rgba(0,230,118,0.35);
}
.rps-btn:active:not(:disabled) { transform: scale(0.97); transition-duration: 0.08s; }
.rps-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Cricket numpad upgrade ── */
.cricket-num-btn {
  background: linear-gradient(145deg, var(--surface-2), rgba(118,255,3,0.05));
  border: 1.5px solid rgba(118,255,3,0.2);
  color: #76ff03;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.23,1,0.32,1);
}
.cricket-num-btn:hover:not(:disabled) {
  background: rgba(118,255,3,0.15);
  border-color: #76ff03;
  box-shadow: 0 0 18px -4px rgba(118,255,3,0.5);
  transform: translateY(-2px) scale(1.06);
}
.cricket-num-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Tap battle side buttons ── */
#tap-left  { background: linear-gradient(180deg, rgba(0,229,255,0.07), rgba(0,229,255,0.02)); border-right: 1.5px solid rgba(0,229,255,0.15); }
#tap-right { background: linear-gradient(180deg, rgba(245,0,87,0.07),  rgba(245,0,87,0.02));  border-left:  1.5px solid rgba(245,0,87,0.15); }
#tap-left:active  { background: rgba(0,229,255,0.18); }
#tap-right:active { background: rgba(245,0,87,0.18); }

/* ── Progress bars colorful ── */
.tap-progress-bar {
  background: linear-gradient(90deg, var(--tap-color, #00e5ff), color-mix(in srgb, var(--tap-color, #00e5ff) 60%, #fff));
  box-shadow: 0 0 12px color-mix(in srgb, var(--tap-color, #00e5ff) 70%, transparent);
  border-radius: 4px;
  height: 100%;
  width: 0%;
  transition: width 0.08s linear;
}

/* ── Win overlay ── */
#d2048-win-overlay, #tap-win-overlay {
  background: radial-gradient(ellipse at 50% 40%, rgba(13,15,28,0.97), rgba(7,8,15,0.99));
  backdrop-filter: blur(6px);
}

/* ── Status text colors ── */
#status.win   { color: #ffd700; }
#status.draw  { color: #8899cc; }
#status.thinking { color: #00e5ff; }

/* ── TTT board cell ── */
.cell {
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 2px solid rgba(0,229,255,0.1);
  border-radius: 16px;
  transition: all 0.22s;
}
.cell:hover:not(.taken) {
  background: rgba(0,229,255,0.08);
  border-color: rgba(0,229,255,0.3);
  box-shadow: 0 0 20px -4px rgba(0,229,255,0.2);
}
.cell.x { color: #00e5ff; text-shadow: 0 0 20px rgba(0,229,255,0.6); }
.cell.o { color: #f50057; text-shadow: 0 0 20px rgba(245,0,87,0.6); }
.cell.winner { 
  background: linear-gradient(145deg, rgba(255,215,0,0.22), rgba(255,165,0,0.1)); 
  border-color: #ffd700;
  box-shadow: 0 0 24px -4px rgba(255,215,0,0.5);
  animation: tttWinPulse 0.6s ease-in-out infinite alternate;
}
@keyframes tttWinPulse {
  from { box-shadow: 0 0 16px -4px rgba(255,215,0,0.4); }
  to   { box-shadow: 0 0 32px -2px rgba(255,215,0,0.8); }
}

/* ── Card hover glow colors per game ── */
@media (hover: hover) {
  .arena-card[data-color="cyan"]:hover   { border-color: rgba(0,229,255,0.35); box-shadow: 0 0 40px -8px rgba(0,229,255,0.25); }
  .arena-card[data-color="orange"]:hover { border-color: rgba(255,109,0,0.35); box-shadow: 0 0 40px -8px rgba(255,109,0,0.25); }
  .arena-card[data-color="green"]:hover  { border-color: rgba(0,230,118,0.35); box-shadow: 0 0 40px -8px rgba(0,230,118,0.25); }
  .arena-card[data-color="pink"]:hover   { border-color: rgba(245,0,87,0.35);  box-shadow: 0 0 40px -8px rgba(245,0,87,0.25); }
  .arena-card[data-color="purple"]:hover { border-color: rgba(170,0,255,0.35); box-shadow: 0 0 40px -8px rgba(170,0,255,0.25); }
}

/* ── ghp-title gradient ── */
.ghp-title {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 90%, #fff),
    color-mix(in srgb, var(--ghp-accent,#00e5ff) 60%, #fff));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

/* ── Scorecard highlight on active turn ── */
.ttt-scorecard.active {
  border-color: rgba(0,229,255,0.45) !important;
  box-shadow: 0 0 18px -4px rgba(0,229,255,0.28) !important;
}
#card-p2.active {
  border-color: rgba(245,0,87,0.45) !important;
  box-shadow: 0 0 18px -4px rgba(245,0,87,0.28) !important;
}

/* ── Diff label text ── */
.diff-label-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.diff-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 480px) {
  .c4-player-card { padding: 8px 12px; }
  .c4-player-score { font-size: 1rem; }
  #c4-board { padding: 8px; gap: 4px; }
  .c4-ghost-disc { width: 28px; height: 28px; }
}

/* ═══════════════════════════════════════════════════════════════
   CANVAS GAMES — Air Hockey + Ping Pong
   Shared layout + per-game theme
═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════
   AIR HOCKEY — Neon Ice Edition
   ═══════════════════════════════════════════════════════════════ */

/* ── HOME PANEL ───────────────────────────────────────────────── */

/* Animated rink mini-preview */
.ah-home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 8px;
}
.ah-rink-preview {
  width: 160px;
  height: 220px;
  background: linear-gradient(180deg, #020c18 0%, #040f24 50%, #020c18 100%);
  border: 2px solid #00e5ff;
  border-radius: 12px;
  box-shadow: 0 0 30px rgba(0,229,255,0.35), inset 0 0 20px rgba(0,229,255,0.04);
  position: relative;
  overflow: hidden;
}
.ah-rink-inner { position: absolute; inset: 0; }
.ah-rink-line {
  position: absolute;
  top: 50%; left: 8px; right: 8px; height: 1px;
  background: rgba(0,229,255,0.25);
  transform: translateY(-50%);
}
.ah-rink-circle {
  position: absolute;
  top: 50%; left: 50%;
  width: 50px; height: 50px;
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 50%;
  transform: translate(-50%,-50%);
}
.ah-goal {
  position: absolute;
  left: 50%;
  width: 64px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 3px;
}
.ah-goal--top { top: 0; background: rgba(0,229,255,0.4); box-shadow: 0 0 12px rgba(0,229,255,0.6); }
.ah-goal--bot { bottom: 0; background: rgba(255,64,129,0.4); box-shadow: 0 0 12px rgba(255,64,129,0.6); }
.ah-paddle-preview {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  left: 50%;
  transform: translateX(-50%);
}
.ah-paddle-p1 {
  bottom: 28px;
  background: radial-gradient(circle at 35% 35%, #fff, #00e5ff, #003344);
  border: 2px solid #00e5ff;
  box-shadow: 0 0 14px rgba(0,229,255,0.7);
}
.ah-paddle-p2 {
  top: 28px;
  background: radial-gradient(circle at 35% 35%, #fff, #ff4081, #440022);
  border: 2px solid #ff4081;
  box-shadow: 0 0 14px rgba(255,64,129,0.7);
}
.ah-puck-preview {
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle at 35% 35%, #e8f8ff, #70d8ff, #003355);
  border: 1.5px solid rgba(120,210,255,0.6);
  box-shadow: 0 0 14px rgba(0,229,255,0.8);
  animation: ahPuckFloat 2s ease-in-out infinite;
}
@keyframes ahPuckFloat {
  0%,100% { transform: translate(-50%,-50%) scale(1); box-shadow: 0 0 14px rgba(0,229,255,0.8); }
  50%     { transform: translate(-40%,-60%) scale(1.08); box-shadow: 0 0 24px rgba(0,229,255,1); }
}

.ah-home-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #00e5ff;
  text-shadow: 0 0 30px rgba(0,229,255,0.6), 0 0 60px rgba(0,229,255,0.2);
  text-align: center;
}
.ah-home-sub {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: rgba(0,229,255,0.45);
  text-transform: uppercase;
  text-align: center;
}

/* Rules */
.ah-home-rules {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px auto 0;
}
.ah-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,229,255,0.04);
  border: 1px solid rgba(0,229,255,0.1);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.ah-rule-icon { font-size: 1.1rem; flex-shrink: 0; }

/* Settings */
.ah-home-settings {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 16px auto 0;
}
.ah-setting-block { display: flex; flex-direction: column; gap: 8px; }
.ah-setting-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(0,229,255,0.5);
  font-family: 'DM Mono', monospace;
}
.ah-pill-group { display: flex; gap: 6px; flex-wrap: wrap; }
.ah-pill {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,229,255,0.15);
  border-radius: 20px;
  color: rgba(255,255,255,0.5);
  font-family: 'DM Mono', monospace;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.18s;
}
.ah-pill.active {
  background: rgba(0,229,255,0.15);
  border-color: #00e5ff;
  color: #00e5ff;
  box-shadow: 0 0 14px -4px rgba(0,229,255,0.5);
}
.ah-pill:hover:not(.active) {
  border-color: rgba(0,229,255,0.35);
  color: rgba(0,229,255,0.7);
}

/* Start button */
.ah-start-btn {
  width: 100%;
  max-width: 400px;
  margin: 20px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(0,229,255,0.2), rgba(0,229,255,0.07));
  border: 1px solid rgba(0,229,255,0.45);
  border-radius: 14px;
  color: #00e5ff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 4px 20px rgba(0,229,255,0.08);
  position: relative;
  overflow: hidden;
}
.ah-start-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,229,255,0.14), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.ah-start-btn:hover::before { transform: translateX(100%); }
.ah-start-btn:hover {
  background: linear-gradient(135deg, rgba(0,229,255,0.3), rgba(0,229,255,0.12));
  border-color: #00e5ff;
  box-shadow: 0 4px 30px rgba(0,229,255,0.3), 0 0 0 1px rgba(0,229,255,0.15);
  transform: translateY(-2px);
}
.ah-start-btn:active { transform: scale(0.97); }
.ah-start-arrow { margin-left: auto; opacity: 0.5; }

/* ── PLAY PANEL ────────────────────────────────────────────────── */
.ah-play-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: #020c18;
}

/* Score bar */
.ah-scorebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.6);
  border-bottom: 1px solid rgba(0,229,255,0.12);
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}
.ah-back-btn {
  background: rgba(0,229,255,0.07);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 8px;
  color: rgba(0,229,255,0.6);
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.18s;
  flex-shrink: 0;
}
.ah-back-btn:hover { color: #00e5ff; border-color: #00e5ff; background: rgba(0,229,255,0.12); }

.ah-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.ah-score-block.ah-score-p1 { align-items: flex-start; padding-left: 4px; }
.ah-score-block.ah-score-p2 { align-items: flex-end;   padding-right: 4px; }
.ah-score-name {
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  font-family: 'DM Mono', monospace;
}
.ah-score-num {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  line-height: 1;
  transition: transform 0.15s;
}
.ah-score-p1 .ah-score-num { color: #00e5ff; text-shadow: 0 0 16px rgba(0,229,255,0.7); }
.ah-score-p2 .ah-score-num { color: #ff4081; text-shadow: 0 0 16px rgba(255,64,129,0.7); }
.ah-score-pip-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.ah-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all 0.2s;
}
.ah-pip.ah-pip--on {
  background: var(--pip-color, #00e5ff);
  border-color: var(--pip-color, #00e5ff);
  box-shadow: 0 0 6px var(--pip-color, #00e5ff);
}

.ah-score-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
}
#ah-match-status {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.25);
}

.ah-pause-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.ah-pause-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Canvas wrapper */
.ah-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #020c18;
}
.ah-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  box-shadow:
    0 0 0 2px rgba(0,229,255,0.15),
    0 0 50px rgba(0,229,255,0.1),
    0 20px 60px rgba(0,0,0,0.8);
  border-radius: 2px;
}

/* Goal flash overlay */
.ah-goal-flash {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  pointer-events: none;
  z-index: 30;
  animation: ahGoalFlash 1.1s cubic-bezier(0.23,1,0.32,1) both;
}
.ah-goal-flash--p1 {
  color: #00e5ff;
  text-shadow: 0 0 40px rgba(0,229,255,1), 0 0 80px rgba(0,229,255,0.5);
  background: radial-gradient(ellipse 70% 40% at 50% 50%, rgba(0,229,255,0.12) 0%, transparent 100%);
}
.ah-goal-flash--p2 {
  color: #ff4081;
  text-shadow: 0 0 40px rgba(255,64,129,1), 0 0 80px rgba(255,64,129,0.5);
  background: radial-gradient(ellipse 70% 40% at 50% 50%, rgba(255,64,129,0.12) 0%, transparent 100%);
}
@keyframes ahGoalFlash {
  0%   { opacity: 0; transform: scale(0.5); }
  20%  { opacity: 1; transform: scale(1.15); }
  60%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.2); }
}

/* Win overlay */
.ah-overlay-msg {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2,12,24,0.88);
  backdrop-filter: blur(8px);
  z-index: 50;
  padding: 32px;
  animation: ahOverlayIn 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
@keyframes ahOverlayIn {
  from { opacity: 0; } to { opacity: 1; }
}
.ah-win-icon { font-size: 4rem; animation: ahIconPop 0.5s cubic-bezier(0.23,1,0.32,1) both; }
@keyframes ahIconPop { from { transform: scale(0); } 70% { transform: scale(1.3); } to { transform: scale(1); } }
.ah-win-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
}
.ah-win-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em;
}
.ah-win-btn {
  width: 100%;
  max-width: 240px;
  padding: 13px 20px;
  background: linear-gradient(135deg, rgba(0,229,255,0.18), rgba(0,229,255,0.07));
  border: 1px solid rgba(0,229,255,0.4);
  border-radius: 12px;
  color: #00e5ff;
  font-family: 'DM Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.ah-win-btn:hover {
  background: rgba(0,229,255,0.25);
  border-color: #00e5ff;
  box-shadow: 0 0 20px rgba(0,229,255,0.3);
  transform: translateY(-2px);
}
.ah-win-btn--sec {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.45);
}
.ah-win-btn--sec:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
  box-shadow: none;
}

/* ── Keep canvas-* classes for Ping Pong etc. ──────────────────── */
.canvas-game-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: #07101f;
}
.canvas-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.35);
}
.canvas-scoreboard {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 40px;
  padding: 5px 18px;
}
.canvas-player { display: flex; align-items: baseline; gap: 5px; }
.canvas-player-right { flex-direction: row-reverse; }
.canvas-player-label { font-size: 0.6rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); font-family: 'DM Mono', monospace; }
.canvas-score { font-size: 1.6rem; font-weight: 900; font-family: 'DM Mono', monospace; color: #fff; min-width: 1.3ch; text-align: center; line-height: 1; }
.canvas-sep { font-size: 1.1rem; color: rgba(255,255,255,0.3); font-weight: 700; }
.canvas-pause-btn { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; color: #fff; font-size: 1rem; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s; flex-shrink: 0; }
.canvas-pause-btn:hover { background: rgba(255,255,255,0.15); }
.canvas-rally { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 40px; }
.canvas-rally-label { font-size: 0.52rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-family: 'DM Mono', monospace; }
.canvas-rally-val { font-size: 1.1rem; font-weight: 800; font-family: 'DM Mono', monospace; color: #ffd600; }
.canvas-field { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 12px 8px 16px; }
.canvas-field canvas { display: block; max-width: 100%; max-height: 100%; border-radius: 16px; border: 2px solid rgba(255,255,255,0.08); touch-action: none; box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04); }
.pp-theme .canvas-field canvas { box-shadow: 0 0 60px rgba(0,0,0,0.7), 0 0 40px rgba(255,214,0,0.08), 0 0 0 1px rgba(255,214,0,0.1); }
.canvas-overlay-msg { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(4,12,28,0.88); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.14); border-radius: 20px; padding: 22px 40px; font-size: 1.65rem; font-weight: 900; color: #fff; text-align: center; letter-spacing: 0.04em; z-index: 99; pointer-events: auto; min-width: 200px; animation: overlayPop 0.2s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes overlayPop { from { transform: translate(-50%,-50%) scale(0.8); opacity: 0; } to { transform: translate(-50%,-50%) scale(1); opacity: 1; } }

/* Hub card accents */
.arena-card[style*="--accent:#2979ff"] .card-btn { background: linear-gradient(135deg, #1565c0 0%, #2979ff 55%, #82b1ff 100%); color: #fff; }
.arena-card[style*="--accent:#00ff88"] .card-btn { background: linear-gradient(135deg, #00b35a 0%, #00ff88 55%, #80ffbb 100%); color: #001a0d; }
@media (hover: hover) {
  .arena-card[style*="--accent:#2979ff"]:hover .card-glow, .arena-card[style*="--accent:#2979ff"]:focus-visible .card-glow { background: radial-gradient(ellipse at 50% 80%, rgba(41,121,255,0.45) 0%, transparent 70%); opacity: 1; }
  .arena-card[style*="--accent:#2979ff"] .card-btn:hover { background: linear-gradient(135deg, #1976d2 0%, #448aff 55%, #90caf9 100%); box-shadow: 0 0 26px rgba(41,121,255,0.6); }
  .arena-card[style*="--accent:#00ff88"]:hover .card-glow, .arena-card[style*="--accent:#00ff88"]:focus-visible .card-glow { background: radial-gradient(ellipse at 50% 80%, rgba(0,255,136,0.45) 0%, transparent 70%); opacity: 1; }
  .arena-card[style*="--accent:#00ff88"] .card-btn:hover { background: linear-gradient(135deg, #00cc66 0%, #33ffaa 55%, #99ffd6 100%); box-shadow: 0 0 26px rgba(0,255,136,0.6); }
}

/* Mobile */
@media (max-width: 480px) {
  .ah-home-title { font-size: 1.45rem; }
  .ah-rink-preview { width: 130px; height: 180px; }
  .ah-score-num { font-size: 1.8rem; }
  .ah-win-title { font-size: 1.4rem; }
}

/* ═══════════════════════════════════════════════════════════════

/* ═══════════════════════════════════════════════════════════════
   CODE BREAKER — complete UI overhaul
   ═══════════════════════════════════════════════════════════════ */

:root {
  --pb-green:  #00ff88;
  --pb-purple: #b44fff;
  --pb-red:    #ff4444;
  --pb-yellow: #ffd700;
  --pb-blue:   #00cfff;
  --pb-dim:    rgba(0,255,136,0.08);
}

#screen-passbreach {
  position: relative;
  z-index: 10;
  font-family: 'DM Mono', monospace;
}

/* ── HOME PANEL ─────────────────────────────────────────────────── */
.pb-home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0 10px;
}

/* Animated lock */
.pb-home-lock-anim {
  position: relative;
  width: 80px;
  height: 88px;
  margin-bottom: 4px;
}
.pb-lock-outer { position: relative; width: 80px; }
.pb-lock-shackle {
  width: 40px; height: 30px;
  border: 5px solid var(--pb-green);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  margin: 0 auto;
  animation: pbShackleOpen 3s ease-in-out infinite;
  transform-origin: bottom left;
  filter: drop-shadow(0 0 8px rgba(0,255,136,0.6));
}
@keyframes pbShackleOpen {
  0%,60%,100% { transform: rotate(0deg) translateY(0); }
  70%,90%     { transform: rotate(-25deg) translateY(-4px); }
}
.pb-lock-body {
  width: 80px; height: 54px;
  background: linear-gradient(160deg, rgba(0,255,136,0.15), rgba(0,255,136,0.04));
  border: 2px solid var(--pb-green);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 0 20px rgba(0,255,136,0.2), inset 0 0 20px rgba(0,255,136,0.05);
}
.pb-lock-keyhole {
  width: 14px; height: 20px;
  background: var(--pb-green);
  border-radius: 7px 7px 3px 3px;
  position: relative;
  box-shadow: 0 0 10px rgba(0,255,136,0.8);
}
.pb-lock-keyhole::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 8px;
  background: var(--pb-green);
  border-radius: 0 0 3px 3px;
}

.pb-home-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--pb-green);
  text-shadow: 0 0 30px rgba(0,255,136,0.5);
  text-align: center;
}
.pb-home-sub {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(0,255,136,0.5);
  text-transform: uppercase;
  text-align: center;
}

.pb-home-digits-preview {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.pb-preview-dot {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: rgba(0,255,136,0.15);
  border: 2px solid rgba(0,255,136,0.3);
  animation: pbDotPulse 2s ease-in-out infinite;
}
.pb-preview-dot:nth-child(2) { animation-delay: 0.25s; }
.pb-preview-dot:nth-child(3) { animation-delay: 0.5s; }
.pb-preview-dot:nth-child(4) { animation-delay: 0.75s; }
@keyframes pbDotPulse {
  0%,100% { background: rgba(0,255,136,0.1); }
  50%     { background: rgba(0,255,136,0.35); box-shadow: 0 0 8px rgba(0,255,136,0.4); }
}

/* Rules cards */
.pb-home-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  margin: 12px auto 0;
}
.pb-rule-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,255,136,0.12);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.02em;
}
.pb-rule-card--special {
  grid-column: 1 / -1;
  border-color: rgba(255,68,68,0.2);
  background: rgba(255,68,68,0.04);
}
.pb-rule-icon { font-size: 1.1rem; flex-shrink: 0; }

/* Settings */
.pb-home-settings {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 16px auto 0;
}
.pb-setting-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pb-setting-label {
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(0,255,136,0.5);
}
.pb-pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pb-pill {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,255,136,0.18);
  border-radius: 20px;
  color: rgba(255,255,255,0.55);
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.pb-pill.active {
  background: rgba(0,255,136,0.15);
  border-color: var(--pb-green);
  color: var(--pb-green);
  box-shadow: 0 0 12px -4px rgba(0,255,136,0.4);
}
.pb-pill:hover:not(.active) {
  border-color: rgba(0,255,136,0.4);
  color: rgba(0,255,136,0.7);
}
.pb-diff-hint {
  opacity: 0.5;
  font-size: 0.62em;
}

/* Start button */
.pb-start-btn {
  width: 100%;
  max-width: 400px;
  margin: 20px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(0,255,136,0.08));
  border: 1px solid rgba(0,255,136,0.5);
  border-radius: 14px;
  color: var(--pb-green);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 4px 20px rgba(0,255,136,0.1);
  position: relative;
  overflow: hidden;
}
.pb-start-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,255,136,0.12), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.pb-start-btn:hover::before { transform: translateX(100%); }
.pb-start-btn:hover {
  background: linear-gradient(135deg, rgba(0,255,136,0.32), rgba(0,255,136,0.15));
  border-color: var(--pb-green);
  box-shadow: 0 4px 30px rgba(0,255,136,0.3), 0 0 0 1px rgba(0,255,136,0.2);
  transform: translateY(-2px);
}
.pb-start-btn:active { transform: scale(0.97); }
.pb-start-icon { font-size: 1.1rem; }
.pb-start-arrow { margin-left: auto; opacity: 0.6; }

/* ── PLAY PANEL ─────────────────────────────────────────────────── */
#pb-play-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100dvh;
  width: 100%;
  padding: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 20%, rgba(0,255,136,0.06) 0%, transparent 70%);
}

#pb-game-wrap { width: 100%; max-width: 420px; margin: 0 auto; }

.pb-phase { width: 100%; animation: pbPhaseIn 0.3s cubic-bezier(0.23,1,0.32,1) both; }
@keyframes pbPhaseIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pb-phase.hidden { display: none !important; }

/* Game container */
.pb-game-container {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 0 16px;
}

/* Top bar */
.pb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(0,255,136,0.1);
  backdrop-filter: blur(6px);
}
.pb-topbar-back {
  background: none;
  border: 1px solid rgba(0,255,136,0.2);
  border-radius: 8px;
  color: rgba(0,255,136,0.6);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.pb-topbar-back:hover { color: var(--pb-green); border-color: var(--pb-green); }
.pb-topbar-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: rgba(0,255,136,0.6);
}
.pb-topbar-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.pb-score-label { font-size: 0.52rem; letter-spacing: 0.2em; color: rgba(0,255,136,0.4); }
.pb-score-num { font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem; color: var(--pb-yellow); line-height:1; }

/* HUD */
.pb-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.3);
}
.pb-timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.pb-timer-ring {
  position: relative;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.pb-timer-svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.pb-timer-track { fill: none; stroke: rgba(255,255,255,0.07); stroke-width: 4; }
.pb-timer-fill {
  fill: none;
  stroke: var(--pb-green);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 176;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.pb-timer-fill.warning { stroke: var(--pb-yellow); }
.pb-timer-fill.danger  { stroke: var(--pb-red); animation: pbTimerFlash 0.5s ease-in-out infinite; }
@keyframes pbTimerFlash { 0%,100% { opacity:1; } 50% { opacity: 0.3; } }
.pb-timer-val {
  position: relative; z-index:1;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
  color: var(--pb-green);
  line-height: 1;
  transition: color 0.3s;
}
.pb-timer-val.warning { color: var(--pb-yellow); }
.pb-timer-val.danger  { color: var(--pb-red); }
.pb-timer-label { font-size: 0.5rem; letter-spacing: 0.2em; color: rgba(0,255,136,0.35); }

.pb-hud-stats {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,255,136,0.1);
  border-radius: 12px;
  padding: 10px 14px;
}
.pb-hud-stat { display: flex; flex-direction: column; align-items: center; flex:1; gap:2px; }
.pb-hud-num { font-family: 'Bebas Neue', sans-serif; font-size: 1.6rem; color: var(--pb-green); line-height:1; }
.pb-hud-lbl { font-size: 0.48rem; letter-spacing: 0.2em; color: rgba(0,255,136,0.4); }
.pb-hud-divider { width: 1px; height: 36px; background: rgba(0,255,136,0.15); }

.pb-hint-btn {
  background: rgba(180,79,255,0.1);
  border: 1px solid rgba(180,79,255,0.3);
  border-radius: 12px;
  color: var(--pb-purple);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.4;
  text-align: center;
  flex-shrink: 0;
}
.pb-hint-btn:hover { background: rgba(180,79,255,0.2); border-color: var(--pb-purple); box-shadow: 0 0 14px -4px rgba(180,79,255,0.4); }
.pb-hint-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* 4-cell current guess display */
.pb-current-guess {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: rgba(0,0,0,0.2);
}
.pb-cell {
  width: 58px; height: 66px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(0,255,136,0.18);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--pb-green);
  line-height: 1;
  transition: all 0.15s cubic-bezier(0.23,1,0.32,1);
  position: relative;
}
.pb-cell--filled {
  border-color: var(--pb-green);
  background: rgba(0,255,136,0.1);
  box-shadow: 0 0 14px -4px rgba(0,255,136,0.4), inset 0 0 10px rgba(0,255,136,0.05);
  transform: scale(1.04);
}
.pb-cell--active::after {
  content: '';
  position: absolute;
  bottom: 8px;
  width: 20px; height: 2px;
  background: var(--pb-green);
  border-radius: 2px;
  animation: pbBlink 0.9s ease-in-out infinite;
}
@keyframes pbBlink { 0%,100% { opacity:1; } 50% { opacity:0; } }

/* History */
.pb-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,255,136,0.15) transparent;
}
.pb-hist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pbRowIn 0.2s ease;
}
@keyframes pbRowIn { from { opacity:0; transform:translateX(-8px); } to { opacity:1; transform:translateX(0); } }
.pb-hist-num {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.2);
  min-width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.pb-hist-tiles { display: flex; gap: 5px; }
.pb-hist-tile {
  width: 36px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  border: 2px solid transparent;
  animation: pbTileFlip 0.35s ease both;
}
@keyframes pbTileFlip {
  0%   { transform: rotateX(-90deg); opacity:0; }
  100% { transform: rotateX(0);      opacity:1; }
}
.pb-hist-tile--correct { background: rgba(0,255,136,0.2); border-color: var(--pb-green); color: var(--pb-green); box-shadow: 0 0 10px rgba(0,255,136,0.25); }
.pb-hist-tile--present { background: rgba(255,215,0,0.15); border-color: var(--pb-yellow); color: var(--pb-yellow); box-shadow: 0 0 10px rgba(255,215,0,0.2); }
.pb-hist-tile--absent  { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.25); }
.pb-hist-summary { display:flex; gap:6px; margin-left:4px; }
.pb-hist-c { font-size: 0.7rem; color: var(--pb-green); }
.pb-hist-p { font-size: 0.7rem; color: var(--pb-yellow); }
.pb-hist-row--hint {
  background: rgba(180,79,255,0.07);
  border: 1px solid rgba(180,79,255,0.2);
  border-radius: 8px;
  padding: 6px 10px;
}
.pb-hist-hint-text { font-size: 0.72rem; color: rgba(180,79,255,0.9); letter-spacing: 0.06em; }
.pb-hist-hint-text strong { color: var(--pb-green); }

/* ── NUMPAD ────────────────────────────────────────────────── */
.pb-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(0,255,136,0.08);
}
.pb-numpad-key {
  background: linear-gradient(160deg, rgba(255,255,255,0.06) 0%, rgba(0,0,0,0.3) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #e0f8f0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  line-height: 1;
  padding: 14px 0;
  cursor: pointer;
  transition: all 0.1s cubic-bezier(0.23,1,0.32,1);
  text-align: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.07);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;
}
.pb-numpad-key::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,255,136,0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.1s;
}
.pb-numpad-key:hover {
  background: linear-gradient(160deg, rgba(0,255,136,0.14) 0%, rgba(0,255,136,0.04) 100%);
  border-color: rgba(0,255,136,0.35);
  color: var(--pb-green);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5), 0 0 20px -6px rgba(0,255,136,0.3);
}
.pb-numpad-key:active,
.pb-numpad-key.pb-numpad-press {
  transform: scale(0.9) translateY(1px);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
  transition-duration: 0.05s;
}
.pb-numpad-key.pb-numpad-press::after { opacity: 1; }
.pb-numpad-key.pb-numpad-shake {
  animation: pbNumShake 0.25s ease;
  border-color: rgba(255,68,68,0.5);
  color: var(--pb-red);
}
@keyframes pbNumShake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-4px); }
  75%     { transform: translateX(4px); }
}
.pb-numpad-zero { grid-column: 1 / 2; }
.pb-numpad-enter {
  grid-column: 2 / 3;
  background: linear-gradient(160deg, rgba(0,255,136,0.18) 0%, rgba(0,255,136,0.06) 100%) !important;
  border-color: rgba(0,255,136,0.3) !important;
  color: var(--pb-green) !important;
  font-size: 1.5rem !important;
}
.pb-numpad-enter:not(:disabled):hover {
  background: linear-gradient(160deg, rgba(0,255,136,0.32) 0%, rgba(0,255,136,0.12) 100%) !important;
  box-shadow: 0 0 24px -4px rgba(0,255,136,0.5) !important;
}
.pb-numpad-enter:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pb-numpad-del {
  grid-column: 3 / 4;
  color: var(--pb-red) !important;
  border-color: rgba(255,68,68,0.18) !important;
  font-family: 'DM Mono', monospace !important;
  font-size: 1.3rem !important;
}
.pb-numpad-del:hover {
  background: linear-gradient(160deg, rgba(255,68,68,0.15) 0%, rgba(255,68,68,0.04) 100%) !important;
  border-color: rgba(255,68,68,0.5) !important;
  box-shadow: 0 0 16px -4px rgba(255,68,68,0.3) !important;
}

/* ── RESULT SCREEN ─────────────────────────────────────────────── */
.pb-result-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
.pb-result-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pb-particle {
  position: absolute;
  border-radius: 50%;
  animation: pbParticleFly var(--dur,0.8s) ease-out var(--delay,0s) both;
}
@keyframes pbParticleFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx,50px), var(--dy,-80px)) scale(0); opacity: 0; }
}
.pb-result-card {
  width: 100%;
  max-width: 380px;
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(0,255,136,0.2);
  border-radius: 24px;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 2;
  animation: pbPhaseIn 0.4s cubic-bezier(0.23,1,0.32,1) both;
}
.pb-result-card--win {
  border-color: rgba(0,255,136,0.5);
  box-shadow: 0 0 60px -10px rgba(0,255,136,0.25), 0 0 0 1px rgba(0,255,136,0.1);
}
.pb-result-icon { font-size: 3.5rem; animation: pbIconBounce 0.5s cubic-bezier(0.23,1,0.32,1); }
@keyframes pbIconBounce { 0% { transform:scale(0); } 70% { transform:scale(1.3); } 100% { transform:scale(1); } }
.pb-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--pb-green);
  line-height: 1;
  text-align: center;
}
.pb-result-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.5;
}
.pb-result-code-reveal {
  display: flex;
  gap: 10px;
  margin: 4px 0;
}
.pb-reveal-tile {
  width: 52px; height: 58px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  animation: pbRevealBounce 0.5s cubic-bezier(0.23,1,0.32,1) both;
}
@keyframes pbRevealBounce {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.15) rotate(2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.pb-reveal-tile--won { background: rgba(0,255,136,0.2); border: 2px solid var(--pb-green); color: var(--pb-green); box-shadow: 0 0 16px rgba(0,255,136,0.3); }
.pb-reveal-tile--lost { background: rgba(255,68,68,0.15); border: 2px solid var(--pb-red); color: var(--pb-red); }

.pb-result-stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  padding: 14px 16px;
}
.pb-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
}
.pb-stat-row strong { color: rgba(255,255,255,0.85); font-weight: 600; }
.pb-stat-row--score strong { font-size: 1.1rem; }

.pb-result-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.pb-action-btn {
  flex: 1;
  padding: 13px 16px;
  background: linear-gradient(135deg, rgba(0,255,136,0.15), rgba(0,255,136,0.06));
  border: 1px solid rgba(0,255,136,0.35);
  border-radius: 12px;
  color: var(--pb-green);
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.23,1,0.32,1);
}
.pb-action-btn:hover {
  background: linear-gradient(135deg, rgba(0,255,136,0.28), rgba(0,255,136,0.12));
  border-color: var(--pb-green);
  box-shadow: 0 0 20px -4px rgba(0,255,136,0.4);
  transform: translateY(-2px);
}
.pb-action-btn:active { transform: scale(0.97); }
.pb-btn-secondary {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.4);
}
.pb-btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
  box-shadow: none;
}

/* Screen shake on wrong */
@keyframes pbWrongShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.pb-wrong-shake { animation: pbWrongShake 0.35s ease; }

/* Back button */
#pb-main-back { position: absolute; top: 16px; left: 16px; z-index: 20; }

/* Glitch win effect */
.pb-result-title[data-text] { position: relative; }
@keyframes pbGlitch {
  0%       { clip-path: inset(0 0 95% 0); transform: translate(-2px,0); }
  5%       { clip-path: inset(15% 0 65% 0); transform: translate(2px,0); }
  10%      { clip-path: inset(50% 0 30% 0); transform: translate(-2px,0); }
  15%,100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

/* Mobile */
@media (max-width: 480px) {
  .pb-home-title { font-size: 1.5rem; }
  .pb-cell { width: 50px; height: 58px; font-size: 1.7rem; }
  .pb-hist-tile { width: 32px; height: 34px; font-size: 1rem; }
  .pb-numpad-key { padding: 12px 0; font-size: 1.5rem; }
  .pb-result-card { padding: 28px 20px; }
}


/* ═══════════════════════════════════════════════════════════════
   MEMORY FLIP DUEL — Styles
   Accent: #c084fc (violet)
═══════════════════════════════════════════════════════════════ */

/* ── MFD CSS Variables ─────────────────────────────────────── */
:root {
  --mfd-accent:      #c084fc;
  --mfd-accent-dim:  rgba(192, 132, 252, 0.18);
  --mfd-accent-glow: rgba(192, 132, 252, 0.55);
  --mfd-p1:          #60a5fa;  /* blue   — Player 1 */
  --mfd-p1-glow:     rgba(96, 165, 250, 0.5);
  --mfd-p2:          #f472b6;  /* pink   — Player 2 / Bot */
  --mfd-p2-glow:     rgba(244, 114, 182, 0.5);
  --mfd-match:       #34d399;  /* emerald — matched cards */
  --mfd-card-bg:     #0d1029;
  --mfd-card-face:   #131630;
  --mfd-radius:      12px;
  --mfd-transition:  0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Play Wrap ─────────────────────────────────────────────── */
.mfd-play-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px 32px;
  position: relative;
}

/* ── App Shell ─────────────────────────────────────────────── */
#mfd-app {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 48px;
}

/* ── Header ────────────────────────────────────────────────── */
#mfd-header {
  text-align: center;
}
#mfd-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--mfd-accent), #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  letter-spacing: 2px;
  margin: 0;
}
#mfd-mode-label {
  font-size: 0.7rem;
  letter-spacing: 4px;
  color: var(--mfd-accent);
  opacity: 0.6;
  margin-top: 2px;
  text-transform: uppercase;
  font-family: 'Orbitron', sans-serif;
}

/* ── Scoreboard ────────────────────────────────────────────── */
#mfd-scoreboard {
  width: 100%;
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.mfd-score-card {
  flex: 1;
  background: var(--mfd-card-face);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--mfd-radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--mfd-transition), box-shadow var(--mfd-transition);
}
.mfd-score-card.mfd-active-p1 {
  border-color: var(--mfd-p1);
  box-shadow: 0 0 20px -4px var(--mfd-p1-glow), inset 0 0 24px -12px rgba(96,165,250,0.12);
}
.mfd-score-card.mfd-active-p2 {
  border-color: var(--mfd-p2);
  box-shadow: 0 0 20px -4px var(--mfd-p2-glow), inset 0 0 24px -12px rgba(244,114,182,0.12);
}
.mfd-player-label {
  font-size: 0.65rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
}
.mfd-score-card#mfd-card-p1 .mfd-player-label { color: var(--mfd-p1); }
.mfd-score-card#mfd-card-p2 .mfd-player-label { color: var(--mfd-p2); }
.mfd-score-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.mfd-score-bar {
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  position: relative;
}
.mfd-score-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--mfd-bar-pct, 0%);
  border-radius: 99px;
  transition: width 0.5s var(--mfd-transition);
}
#mfd-bar-p1::after { background: var(--mfd-p1); }
#mfd-bar-p2::after { background: var(--mfd-p2); }

#mfd-vs-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}
.mfd-vs {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  letter-spacing: 2px;
}

/* ── Turn Indicator ────────────────────────────────────────── */
#mfd-turn-banner {
  width: 100%;
  display: flex;
  justify-content: center;
}
#mfd-turn-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  color: #fff;
  transition: background var(--mfd-transition), border-color var(--mfd-transition);
}
#mfd-turn-indicator.mfd-turn-p1 {
  border-color: var(--mfd-p1);
  background: rgba(96,165,250,0.1);
  color: var(--mfd-p1);
}
#mfd-turn-indicator.mfd-turn-p2 {
  border-color: var(--mfd-p2);
  background: rgba(244,114,182,0.1);
  color: var(--mfd-p2);
}
#mfd-turn-indicator.mfd-turn-thinking {
  border-color: rgba(192,132,252,0.5);
  background: rgba(192,132,252,0.1);
  color: var(--mfd-accent);
  animation: mfd-thinking-pulse 1.2s ease-in-out infinite;
}
@keyframes mfd-thinking-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ── Card Grid ─────────────────────────────────────────────── */
#mfd-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

/* ── Individual Card ───────────────────────────────────────── */
.mfd-card {
  aspect-ratio: 3/4;
  perspective: 600px;
  cursor: pointer;
  border-radius: var(--mfd-radius);
  /* No pointer-events by default — controlled via JS */
  user-select: none;
  -webkit-user-select: none;
}

.mfd-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.25, 0.8, 0.25, 1);
  border-radius: var(--mfd-radius);
}

/* Flipped state */
.mfd-card.mfd-flipped .mfd-card-inner {
  transform: rotateY(180deg);
}

/* Matched state */
.mfd-card.mfd-matched .mfd-card-inner {
  transform: rotateY(180deg);
}
.mfd-card.mfd-matched .mfd-card-back {
  border-color: var(--mfd-match);
  box-shadow:
    0 0 0 2px var(--mfd-match),
    0 0 18px -4px rgba(52,211,153,0.6),
    inset 0 0 20px -10px rgba(52,211,153,0.15);
}

/* Card face sides */
.mfd-card-front,
.mfd-card-back {
  position: absolute;
  inset: 0;
  border-radius: var(--mfd-radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.07);
}

/* Front = face-down (pattern visible when not flipped) */
.mfd-card-front {
  background:
    linear-gradient(135deg,
      rgba(192,132,252,0.1) 0%,
      rgba(13,16,41,0.9) 40%,
      rgba(192,132,252,0.06) 100%),
    var(--mfd-card-bg);
  border-color: rgba(192,132,252,0.2);
  overflow: hidden;
}
.mfd-card-front::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 9px;
  border: 1px solid rgba(192,132,252,0.12);
  background: repeating-linear-gradient(
    45deg,
    transparent 0px,
    transparent 6px,
    rgba(192,132,252,0.04) 6px,
    rgba(192,132,252,0.04) 7px
  );
}
.mfd-card-front .mfd-card-symbol {
  font-size: 1.1rem;
  opacity: 0.15;
  color: var(--mfd-accent);
  z-index: 1;
}

/* Back = face-up (emoji visible when flipped) */
.mfd-card-back {
  background: var(--mfd-card-face);
  transform: rotateY(180deg);
  border-color: rgba(255,255,255,0.1);
  flex-direction: column;
  gap: 4px;
}
.mfd-card-back .mfd-card-emoji {
  font-size: clamp(1.2rem, 6vw, 1.8rem);
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
}
.mfd-card-back .mfd-card-pair-label {
  font-size: 0.5rem;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
}

/* Hover effect on interactive cards */
.mfd-card:not(.mfd-flipped):not(.mfd-matched):hover .mfd-card-inner {
  transform: rotateY(8deg) scale(1.04);
}
.mfd-card:not(.mfd-flipped):not(.mfd-matched):active .mfd-card-inner {
  transform: rotateY(4deg) scale(0.97);
}

/* Flip ripple animation */
@keyframes mfd-match-pop {
  0%   { transform: rotateY(180deg) scale(1); }
  30%  { transform: rotateY(180deg) scale(1.12); }
  60%  { transform: rotateY(180deg) scale(0.96); }
  100% { transform: rotateY(180deg) scale(1); }
}
.mfd-card.mfd-match-anim .mfd-card-inner {
  animation: mfd-match-pop 0.45s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

/* Shake animation for mismatch */
@keyframes mfd-shake {
  0%,100% { transform: rotateY(180deg) translateX(0); }
  20%     { transform: rotateY(180deg) translateX(-5px); }
  40%     { transform: rotateY(180deg) translateX(5px); }
  60%     { transform: rotateY(180deg) translateX(-4px); }
  80%     { transform: rotateY(180deg) translateX(4px); }
}
.mfd-card.mfd-shake-anim .mfd-card-inner {
  animation: mfd-shake 0.4s ease-in-out forwards;
}

/* ── Result Overlay ────────────────────────────────────────── */
#mfd-result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,8,15,0.88);
  border-radius: 18px;
  z-index: 100;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: mfd-result-in 0.4s cubic-bezier(0.23,1,0.32,1) forwards;
}
@keyframes mfd-result-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
#mfd-result-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 24px;
  background: var(--mfd-card-face);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  box-shadow: 0 8px 48px -8px rgba(0,0,0,0.8), 0 0 0 1px rgba(192,132,252,0.15);
  max-width: 280px;
  width: 90%;
  text-align: center;
}
#mfd-result-icon {
  font-size: 3rem;
  line-height: 1;
}
#mfd-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--mfd-accent);
}
#mfd-result-scores {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  font-family: 'Orbitron', sans-serif;
}
#mfd-result-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
#mfd-result-btns button {
  padding: 10px 20px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
}
#mfd-result-btns button:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--mfd-accent);
}
#mfd-play-again {
  background: linear-gradient(135deg, var(--mfd-accent), #e879f9) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 700 !important;
}
#mfd-play-again:hover {
  filter: brightness(1.15) !important;
}

/* ── Controls ──────────────────────────────────────────────── */
#mfd-controls {
  display: flex;
  gap: 10px;
}
#mfd-controls button {
  padding: 10px 22px;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.22s;
}
#mfd-controls button:hover {
  border-color: var(--mfd-accent);
  color: var(--mfd-accent);
  background: rgba(192,132,252,0.08);
}

/* ── MFD Play Wrap position context for result overlay ─────── */
#mfd-app {
  position: relative;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 400px) {
  #mfd-grid { gap: 5px; }
  .mfd-card-back .mfd-card-emoji { font-size: 1.1rem; }
  .mfd-score-val { font-size: 1.8rem; }
}


/* ═══════════════════════════════════════════════════════════════
   CONNECT DOTS DUEL
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cdd-accent:      #ff9100;
  --cdd-accent-dim:  rgba(255, 145, 0, 0.18);
  --cdd-accent-glow: rgba(255, 145, 0, 0.55);
  --cdd-p1:          #60a5fa;
  --cdd-p1-glow:     rgba(96, 165, 250, 0.5);
  --cdd-p2:          #fb7185;
  --cdd-p2-glow:     rgba(251, 113, 133, 0.5);
  --cdd-dot:         #e2e8f0;
  --cdd-line-empty:  rgba(255,255,255,0.08);
  --cdd-line-hover:  rgba(255,255,255,0.22);
  --cdd-box-bg:      rgba(13, 16, 41, 0.6);
  --cdd-radius:      10px;
}

.cdd-play-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(160deg, #060818 0%, #0d0f1c 60%, #080d1a 100%);
  padding: 0 16px 32px;
  box-sizing: border-box;
}

#cdd-app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

/* Header */
#cdd-header { text-align: center; }
#cdd-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1rem, 4.5vw, 1.4rem);
  font-weight: 900;
  margin: 0 0 2px;
  background: linear-gradient(90deg, var(--cdd-accent), #ffcc80);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
#cdd-mode-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  color: var(--cdd-accent);
  margin: 0;
  opacity: 0.75;
  text-transform: uppercase;
}

/* Scoreboard */
#cdd-scoreboard {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.cdd-score-card {
  flex: 1;
  background: #131630;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--cdd-radius);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.cdd-score-card.cdd-active-p1 {
  border-color: var(--cdd-p1);
  box-shadow: 0 0 18px -4px var(--cdd-p1-glow);
}
.cdd-score-card.cdd-active-p2 {
  border-color: var(--cdd-p2);
  box-shadow: 0 0 18px -4px var(--cdd-p2-glow);
}
.cdd-player-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
}
#cdd-card-p1 .cdd-player-label { color: var(--cdd-p1); }
#cdd-card-p2 .cdd-player-label { color: var(--cdd-p2); }
.cdd-score-val {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 900;
  color: #f1f5f9;
  line-height: 1;
}
#cdd-vs-wrap { flex-shrink: 0; }
.cdd-vs {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 900;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.1em;
}

/* Turn indicator */
#cdd-turn-banner {
  width: 100%;
  display: flex;
  justify-content: center;
}
#cdd-turn-indicator {
  padding: 8px 22px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #94a3b8;
  transition: border-color 0.35s, color 0.35s, background 0.35s, box-shadow 0.35s;
  text-transform: uppercase;
}
#cdd-turn-indicator.cdd-turn-p1 {
  border-color: var(--cdd-p1);
  color: var(--cdd-p1);
  background: rgba(96,165,250,0.07);
  box-shadow: 0 0 12px -4px var(--cdd-p1-glow);
}
#cdd-turn-indicator.cdd-turn-p2 {
  border-color: var(--cdd-p2);
  color: var(--cdd-p2);
  background: rgba(251,113,133,0.07);
  box-shadow: 0 0 12px -4px var(--cdd-p2-glow);
}
#cdd-turn-indicator.cdd-turn-thinking {
  border-color: var(--cdd-accent);
  color: var(--cdd-accent);
  background: rgba(255,145,0,0.07);
  box-shadow: 0 0 12px -4px var(--cdd-accent-glow);
  animation: cdd-pulse 1s ease-in-out infinite;
}
@keyframes cdd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Grid wrap */
#cdd-grid-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

/* ── CDD Grid — columns/rows set by JS gridTemplateColumns/Rows ── */
#cdd-grid {
  display: grid;
  gap: 0;
  user-select: none;
  /* No overflow, no transform — plain grid */
}

/* ── Dot cells (even row & col) ── */
.cdd-dot {
  width:  100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.cdd-dot::after {
  content: '';
  width:  12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cdd-dot);
  box-shadow: 0 0 5px rgba(226,232,240,0.5);
  flex-shrink: 0;
}

/* ── Horizontal line cells (even row, odd col) ── */
.cdd-cell-hline {
  width:  100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Entire cell area is tappable */
}
.cdd-cell-hline:not(.drawn):hover .cdd-bar-h,
.cdd-cell-hline:not(.drawn):active .cdd-bar-h {
  background: rgba(255,255,255,0.4);
}
.cdd-bar-h {
  width:  calc(100% - 6px);
  height: 10px;
  border-radius: 5px;
  background: rgba(255,255,255,0.12);
  transition: background 0.15s;
  pointer-events: none; /* bar is visual only — cell handles clicks */
  flex-shrink: 0;
}

/* ── Vertical line cells (odd row, even col) ── */
.cdd-cell-vline {
  width:  100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cdd-cell-vline:not(.drawn):hover .cdd-bar-v,
.cdd-cell-vline:not(.drawn):active .cdd-bar-v {
  background: rgba(255,255,255,0.4);
}
.cdd-bar-v {
  width:  10px;
  height: calc(100% - 6px);
  border-radius: 5px;
  background: rgba(255,255,255,0.12);
  transition: background 0.15s;
  pointer-events: none;
  flex-shrink: 0;
}

/* ── Drawn line states ── */
.cdd-cell-hline.drawn,
.cdd-cell-vline.drawn {
  cursor: default;
  pointer-events: none; /* drawn lines cannot be re-clicked */
}
.cdd-bar-h.bar-drawn.drawn-p1,
.cdd-bar-v.bar-drawn.drawn-p1 {
  background: var(--cdd-p1);
  box-shadow: 0 0 8px var(--cdd-p1-glow);
}
.cdd-bar-h.bar-drawn.drawn-p2,
.cdd-bar-v.bar-drawn.drawn-p2 {
  background: var(--cdd-p2);
  box-shadow: 0 0 8px var(--cdd-p2-glow);
}

/* ── Box cells (odd row, odd col) ── */
.cdd-cell-box {
  width:  100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background 0.35s ease;
  pointer-events: none; /* boxes are not interactive */
}
.cdd-cell-box.completed-p1 {
  background: rgba(96,165,250,0.22);
  box-shadow: inset 0 0 14px rgba(96,165,250,0.12);
}
.cdd-cell-box.completed-p2 {
  background: rgba(251,113,133,0.22);
  box-shadow: inset 0 0 14px rgba(251,113,133,0.12);
}
.cdd-box-label {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.4rem, 1.2vw, 0.65rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.cdd-cell-box.completed-p1 .cdd-box-label {
  color: var(--cdd-p1); opacity: 0.9; transform: scale(1);
}
.cdd-cell-box.completed-p2 .cdd-box-label {
  color: var(--cdd-p2); opacity: 0.9; transform: scale(1);
}
.cdd-box-just-claimed { animation: cdd-box-pop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes cdd-box-pop {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ── Locked grid (bot thinking) ── */
#cdd-grid.locked .cdd-cell-hline,
#cdd-grid.locked .cdd-cell-vline {
  cursor: not-allowed;
  pointer-events: none;
}
#cdd-grid.locked .cdd-line:not(.drawn)::after { background: rgba(255,255,255,0.04); }

/* Game over overlay */
#cdd-result {
  position: fixed;
  inset: 0;
  background: rgba(6,8,24,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  /* z-index must beat #dz-universal-topbar (200) and wrapper (5) stacking contexts */
  z-index: 9999;
  pointer-events: all;
  animation: cdd-fade-in 0.35s ease;
  /* Ensure it renders above everything on mobile WebKit */
  isolation: isolate;
}
#cdd-result.hidden { display: none !important; pointer-events: none; }
@keyframes cdd-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#cdd-result-inner {
  background: #0d1029;
  border: 1px solid rgba(255,145,0,0.25);
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 0 60px -12px rgba(255,145,0,0.3);
  animation: cdd-slide-up 0.4s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  z-index: 1;
  pointer-events: all;
}
@keyframes cdd-slide-up {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
#cdd-result-icon { font-size: 3rem; margin-bottom: 8px; line-height: 1; }
#cdd-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: #f1f5f9;
  margin-bottom: 10px;
}
#cdd-result-scores {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.05rem;
  color: #94a3b8;
  margin-bottom: 24px;
}
#cdd-result-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#cdd-result-btns button {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 48px;
  min-width: 120px;
  position: relative;
  z-index: 1;
  pointer-events: all;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#cdd-result-btns button:active { transform: scale(0.95); }
#cdd-play-again {
  background: linear-gradient(135deg, var(--cdd-accent), #ffcc02);
  color: #000;
  box-shadow: 0 4px 16px -4px rgba(255,145,0,0.5);
}
#cdd-result-hub {
  background: rgba(255,255,255,0.07);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.1) !important;
}

/* Controls */
#cdd-controls { display: flex; gap: 10px; margin-top: 4px; justify-content: center; flex-wrap: wrap; }
#cdd-controls button {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.15s, opacity 0.15s;
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#cdd-controls button:active { transform: scale(0.95); }
#cdd-reset-btn {
  background: rgba(255,145,0,0.12);
  border: 1px solid rgba(255,145,0,0.3) !important;
  color: var(--cdd-accent);
}
#cdd-reset-btn:hover { background: rgba(255,145,0,0.2); }
#cdd-hub-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #64748b;
}
#cdd-hub-btn:hover { background: rgba(255,255,255,0.1); color: #94a3b8; }

/* ══════════════════════════════════════════════════════════
   CHESS DUEL STYLES
   ══════════════════════════════════════════════════════════ */

#chess-game {
  min-height: 100vh;
  background: var(--bg, #0a0a12);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

#chess-game.hidden {
  display: none !important;
  pointer-events: none;
}

/* ── Home / Setup ──────────────────────────────────────── */
#chess-home {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

/* ── App layout ─────────────────────────────────────────── */
#chess-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 0.75rem 1rem 2rem;
  box-sizing: border-box;
  position: relative;
}

/* ── Header ─────────────────────────────────────────────── */
#chess-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 520px;
  margin-bottom: 0.5rem;
}

#chess-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  color: #ffd600;
  letter-spacing: 2px;
  margin: 0;
}

#chess-turn-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.chess-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  display: inline-block;
}
.chess-dot.white { background: #f0d9b5; }
.chess-dot.black { background: #1a1a2e; border-color: #888; }

/* ── Main area ───────────────────────────────────────────── */
#chess-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 520px;
}

/* ── Captured pieces ─────────────────────────────────────── */
.chess-captured {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 28px;
  font-size: 0.8rem;
  color: #aaa;
  font-family: 'Rajdhani', sans-serif;
  width: 100%;
  flex-wrap: wrap;
}

.chess-cap-label {
  color: #666;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

#chess-cap-white-pieces,
#chess-cap-black-pieces {
  font-size: 1.1rem;
  letter-spacing: 1px;
}

/* ── Board wrapper ───────────────────────────────────────── */
#chess-board-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
}

#chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #333;
  box-shadow: 0 0 30px rgba(255, 214, 0, 0.15);
  user-select: none;
}

/* ── Squares ─────────────────────────────────────────────── */
.chess-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s;
  font-size: clamp(20px, 5.5vw, 44px);
  line-height: 1;
}

.chess-sq.light { background: #f0d9b5; }
.chess-sq.dark  { background: #b58863; }

.chess-sq.selected {
  background: rgba(20, 85, 30, 0.7) !important;
  box-shadow: inset 0 0 0 3px #4caf50;
}

.chess-sq.legal-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(20, 85, 30, 0.5);
  pointer-events: none;
}

.chess-sq.legal-capture::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: inset 0 0 0 5px rgba(20, 85, 30, 0.5);
  pointer-events: none;
}

.chess-sq.in-check {
  background: rgba(200, 30, 30, 0.75) !important;
}

.chess-sq.last-from { background: rgba(205, 210, 30, 0.45) !important; }
.chess-sq.last-to   { background: rgba(205, 210, 30, 0.65) !important; }

.chess-sq.locked {
  cursor: not-allowed;
}

/* Piece glyph */
.chess-piece {
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
  line-height: 1;
  display: block;
}

/* Rank/file labels */
.chess-label-rank {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.55rem;
  font-family: 'DM Mono', monospace;
  color: rgba(0,0,0,0.45);
  pointer-events: none;
  line-height: 1;
}
.chess-sq.dark .chess-label-rank { color: rgba(255,255,255,0.4); }

.chess-label-file {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: 0.55rem;
  font-family: 'DM Mono', monospace;
  color: rgba(0,0,0,0.45);
  pointer-events: none;
  line-height: 1;
}
.chess-sq.dark .chess-label-file { color: rgba(255,255,255,0.4); }

/* ── Status ──────────────────────────────────────────────── */
#chess-status {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  color: #ffd600;
  min-height: 1.4em;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0.25rem 0;
}

/* ── Controls ────────────────────────────────────────────── */
#chess-controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

#chess-controls button {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.5rem 1.25rem;
  border: 1.5px solid #444;
  border-radius: 6px;
  background: transparent;
  color: #ccc;
  cursor: pointer;
  transition: all 0.18s;
}
#chess-controls button:hover {
  border-color: #ffd600;
  color: #ffd600;
}

/* ── Result overlay ──────────────────────────────────────── */
#chess-result {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 4px;
}
#chess-result.hidden { display: none; }

#chess-result-inner {
  background: #14141f;
  border: 1.5px solid #ffd600;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 320px;
}

#chess-result-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

#chess-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  color: #ffd600;
  margin-bottom: 0.4rem;
  letter-spacing: 2px;
}

#chess-result-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  color: #aaa;
  margin-bottom: 1.5rem;
}

#chess-result-btns {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

#chess-result-btns button {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0.55rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s;
}

#chess-play-again {
  background: #ffd600;
  color: #000;
  border: none;
}
#chess-play-again:hover { background: #ffe033; }

#chess-result-hub {
  background: transparent;
  color: #ccc;
  border: 1.5px solid #444;
}
#chess-result-hub:hover { border-color: #ffd600; color: #ffd600; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
  #chess-header { padding: 0 0.25rem; }
  #chess-board-wrap { max-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════
   CHESS — DuelZone
   Performance-optimised: zero filter/drop-shadow on pieces,
   no infinite animations on cells, no backdrop-filter on modals.
   ═══════════════════════════════════════════════════════════════ */

/* ── Wrapper ── */
.chess-play-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #0c0c10;
}

#chess-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px 28px;
  min-height: 100vh;
  background: #0c0c10;
}

/* ── Header ── */
#chess-header {
  width: 100%;
  max-width: 820px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 14px;
}

#chess-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  color: #f5c518;
  margin: 0;
  flex: 1;
  letter-spacing: 0.05em;
}

#chess-turn-banner {
  background: #18140a;
  border: 1px solid #3a3010;
  border-radius: 100px;
  padding: 7px 20px;
}

#chess-turn-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #c8a84a;
  letter-spacing: 0.05em;
}

/* Check — opacity only, GPU-cheap */
#chess-turn-text.chess-turn-check {
  color: #ff4040;
  animation: chess-check-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes chess-check-pulse {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}

/* ── Main layout ── */
#chess-main-layout {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  align-items: flex-start;
}

/* ── Board wrap — walnut frame via borders only, no ::before pseudo ── */
#chess-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

/* ── Board ── */
#chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(480px, 90vw);
  height: min(480px, 90vw);
  border-radius: 3px;
  overflow: hidden;
  /* Multi-ring wood frame effect — pure box-shadow, no GPU filter */
  box-shadow:
    0 0 0 4px #5c3510,
    0 0 0 8px #3a2008,
    0 0 0 9px #1a0e04,
    0 6px 28px rgba(0,0,0,0.85);
}

/* ── Cells ── */
.chess-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  /* NO transition — eliminates per-cell repaint cost */
}

.chess-light { background: #eedcb2; }
.chess-dark  { background: #7c4e2e; }

/* Hover: instant colour shift, no transition cost */
.chess-light:hover { background: #e5d3a5; }
.chess-dark:hover  { background: #8d5c36; }

/* Selected */
.chess-cell.chess-selected {
  background: #5dc95d !important;
}

/* Last move */
.chess-cell.chess-last-move {
  background: #ccc040 !important;
  opacity: 0.85;
}

/* King in check — opacity pulse, NO box-shadow animation (expensive) */
.chess-cell.chess-in-check {
  background: #e03030 !important;
  animation: chess-check-cell 0.7s ease-in-out infinite alternate;
}
@keyframes chess-check-cell {
  from { opacity: 0.75; }
  to   { opacity: 1; }
}

/* ── Legal move dot — static, no pulse animation ── */
.chess-cell.chess-move-target::after {
  content: '';
  position: absolute;
  width: 32%;
  height: 32%;
  background: rgba(0,0,0,0.24);
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
}

/* ── Capture ring — static, no pulse animation ── */
.chess-cell.chess-capture-target::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 4px solid rgba(200, 40, 40, 0.55);
  border-radius: 50%;
  pointer-events: none;
  z-index: 6;
}

/* ── Labels ── */
.chess-rank-label {
  position: absolute; top: 2px; left: 3px;
  font-size: 0.58rem; font-weight: 700; line-height: 1;
  pointer-events: none; z-index: 2;
}
.chess-file-label {
  position: absolute; bottom: 2px; right: 3px;
  font-size: 0.58rem; font-weight: 700; line-height: 1;
  pointer-events: none; z-index: 2;
}
.chess-dark  .chess-rank-label,
.chess-dark  .chess-file-label { color: rgba(238,220,178,0.6); }
.chess-light .chess-rank-label,
.chess-light .chess-file-label { color: rgba(70,35,8,0.5); }

/* ════════════════════════════════════════════════════
   PIECES — ZERO filter/drop-shadow (main lag source)
   
   Outline technique: text-shadow at 4 cardinal offsets,
   0px blur → sharp hard edge. text-shadow is CPU-composited
   once per text node, NOT re-evaluated every GPU frame.
   ════════════════════════════════════════════════════ */
.chess-piece {
  font-size: min(7.4vw, 44px);
  line-height: 1;
  position: relative;
  z-index: 10;
  pointer-events: none;
  display: block;
  text-align: center;
  /* Single fast transform — NO will-change (avoids 32 GPU compositor layers) */
  transition: transform 0.1s ease;
}

.chess-cell:hover .chess-piece    { transform: scale(1.12) translateY(-2px); }
.chess-cell.chess-selected .chess-piece { transform: scale(1.18) translateY(-3px); }

/* ── WHITE pieces: pure #ffffff with thin dark outline ── */
.chess-piece-w {
  color: #ffffff;
  /* 4-directional text-shadow = clean outline, single CPU pass */
  text-shadow:
    -1.2px  0px   0 #2a1800,
     1.2px  0px   0 #2a1800,
     0px   -1.2px 0 #2a1800,
     0px    1.2px 0 #2a1800,
     0px    2px   3px rgba(0,0,0,0.7);
}

/* ── BLACK pieces: pure #000000 with crisp white outline ── */
.chess-piece-b {
  color: #000000;
  text-shadow:
    -1.2px  0px   0 #ffffff,
     1.2px  0px   0 #ffffff,
     0px   -1.2px 0 #ffffff,
     0px    1.2px 0 #ffffff,
     0px    2px   4px rgba(0,0,0,0.8);
}

/* ── Captured pieces ── */
.chess-captured-row {
  min-height: 26px;
  padding: 3px 4px;
  width: min(480px, 90vw);
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  align-items: center;
}

.chess-cap-piece { font-size: 1rem; line-height: 1; }

.chess-cap-w {
  color: #ffffff;
  text-shadow:
    -1px 0 0 #333, 1px 0 0 #333,
     0 -1px 0 #333, 0 1px 0 #333;
}

.chess-cap-b {
  color: #000000;
  text-shadow:
    -1px 0 0 #ddd, 1px 0 0 #ddd,
     0 -1px 0 #ddd, 0 1px 0 #ddd;
}

/* ── Sidebar ── */
#chess-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 150px;
  max-width: 210px;
}

#chess-move-list-wrap,
#chess-fen-wrap {
  background: #111008;
  border: 1px solid #2c2208;
  border-radius: 10px;
  overflow: hidden;
}

.chess-sidebar-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: #6a5520;
  text-transform: uppercase;
  padding: 7px 10px 5px;
  border-bottom: 1px solid #2c2208;
}

#chess-move-list {
  font-family: 'DM Mono', monospace;
  font-size: 0.73rem;
  color: #aa9050;
  padding: 8px 10px;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.85;
}

#chess-move-list::-webkit-scrollbar { width: 3px; }
#chess-move-list::-webkit-scrollbar-thumb { background: #3a2c10; border-radius: 2px; }

#chess-fen-display {
  font-family: 'DM Mono', monospace;
  font-size: 0.55rem;
  color: #4a3c18;
  padding: 7px 10px;
  word-break: break-all;
  line-height: 1.55;
}

.chess-move-num  { color: #3e3010; font-size: 0.66rem; }
.chess-move-san  { display: inline-block; margin-right: 4px; padding: 0 3px; border-radius: 3px; cursor: default; }
.chess-san-w     { color: #d0b870; }
.chess-san-b     { color: #9a7438; }
.chess-san-latest { background: rgba(245,197,24,0.15); color: #f5c518; }

/* ── Promotion modal — solid bg, NO backdrop-filter ── */
.chess-promo-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8,8,12,0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 500;
}

.chess-promo-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  color: #f5c518;
  letter-spacing: 0.1em;
}

.chess-promo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chess-promo-btn {
  background: #1a1408;
  border: 1.5px solid #3a2c10;
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  width: 136px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.chess-promo-btn:hover {
  border-color: #f5c518;
  background: #261e0c;
  transform: scale(1.06) translateY(-2px);
}

.chess-promo-icon { font-size: 2.2rem; display: block; line-height: 1; }
.chess-promo-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.05em; color: #a88430;
}

/* Override piece filters inside promo */
.chess-promo-btn .chess-piece-w { color: #ffffff; }
.chess-promo-btn .chess-piece-b { color: #000000; }

/* ── Result overlay — solid bg, NO backdrop-filter ── */
.chess-result-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8,8,12,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}

#chess-result-inner {
  background: #161208;
  border: 2px solid #f5c518;
  border-radius: 20px;
  padding: 40px 52px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 0 0 1px rgba(245,197,24,0.08), 0 20px 60px rgba(0,0,0,0.9);
  animation: chess-result-enter 0.35s ease both;
}

@keyframes chess-result-enter {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

#chess-result-icon  { font-size: 4rem; line-height: 1; }
#chess-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.7rem; color: #f5c518; letter-spacing: 0.05em;
}
#chess-result-detail {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem; color: #6e5820; letter-spacing: 0.08em; text-transform: uppercase;
}

#chess-result-btns { display: flex; gap: 10px; justify-content: center; margin-top: 6px; }

#chess-result-btns button {
  background: transparent;
  border: 1.5px solid #3a2c10;
  border-radius: 8px;
  color: #b89030;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem; font-weight: 700;
  padding: 10px 24px; cursor: pointer;
  letter-spacing: 0.05em;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

#chess-result-btns button:hover {
  border-color: #f5c518; color: #f5c518;
  background: rgba(245,197,24,0.08);
}

/* ── Controls ── */
#chess-controls { display: flex; gap: 10px; margin-top: 12px; }

#chess-reset-btn {
  background: transparent;
  border: 1px solid #2e2410; border-radius: 8px;
  color: #6a5420; font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem; font-weight: 600; padding: 7px 22px;
  cursor: pointer; letter-spacing: 0.06em;
  transition: border-color 0.15s, color 0.15s;
}
#chess-reset-btn:hover { border-color: #f5c518; color: #f5c518; }

/* ── Diff group wraps for 6 buttons ── */
.chess-diff-group { flex-wrap: wrap !important; gap: 6px !important; }
.chess-diff-unbeatable {
  background: linear-gradient(135deg, #1a0010, #3d0030) !important;
  border-color: #ff006a !important;
  color: #ff79c6 !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(255,0,106,0.6);
}
.chess-diff-unbeatable:hover {
  background: linear-gradient(135deg, #2d0018, #600050) !important;
  border-color: #ff4da6 !important;
  color: #ffb3d9 !important;
  box-shadow: 0 0 14px rgba(255,0,106,0.45) !important;
}
.chess-diff-unbeatable.active {
  background: linear-gradient(135deg, #ff006a, #9b0038) !important;
  border-color: #ff4da6 !important;
  color: #fff !important;
  box-shadow: 0 0 18px rgba(255,0,106,0.7) !important;
}

/* ── Play As buttons ── */
.chess-color-white { border-color: rgba(255,252,220,0.28) !important; color: rgba(255,252,200,0.55) !important; }
.chess-color-white.active, .chess-color-white:hover {
  background: rgba(255,250,210,0.10) !important;
  border-color: #fffde0 !important; color: #fffde0 !important;
}

.chess-color-black { border-color: rgba(160,130,255,0.28) !important; color: rgba(160,130,255,0.55) !important; }
.chess-color-black.active, .chess-color-black:hover {
  background: rgba(100,60,220,0.12) !important;
  border-color: #c4b4ff !important; color: #c4b4ff !important;
}

/* ── Start buttons ── */
.ghp-start-btns { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }

.ghp-start-btn {
  flex: 1; min-width: 160px;
  background: transparent;
  border: 2px solid var(--ghp-accent, #f5c518);
  border-radius: 10px;
  color: var(--ghp-accent, #f5c518);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem; font-weight: 700;
  padding: 14px 20px; cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.ghp-start-btn:hover {
  background: var(--ghp-accent, #f5c518);
  color: #000; transform: scale(1.02);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  #chess-main-layout { flex-direction: column; align-items: center; }
  #chess-sidebar { max-width: 100%; width: min(480px, 90vw); flex-direction: row; }
  #chess-move-list-wrap { flex: 1; }
  #chess-fen-wrap { flex: 1; }
  #chess-move-list { max-height: 90px; }
}


/* ═══════════════════════════════════════════════════════════════
   BATTLESHIP — all rules scoped under #screen-battleship
   ═══════════════════════════════════════════════════════════════ */

#screen-battleship {
  position: relative;
  min-height: 100vh;
  background: #0a0f1e;
  color: #e2e8f0;
  font-family: 'Rajdhani', sans-serif;
  padding: 1rem 0.5rem 3rem;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════
   BATTLESHIP  ·  All styles scoped under #screen-battleship
   ═══════════════════════════════════════════════════════════════ */

#screen-battleship {
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #0a1628 0%, #020b18 70%);
  color: #e2e8f0;
  font-family: 'Rajdhani', sans-serif;
  padding: 1rem 0.5rem 3rem;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* Subtle animated ocean scanline */
#screen-battleship::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 3px,
    rgba(6,182,212,0.015) 3px,
    rgba(6,182,212,0.015) 4px
  );
  pointer-events: none;
  z-index: 0;
}

#bs-app {
  max-width: 980px;
  margin: 0 auto;
  padding-top: 3.5rem;
  position: relative;
  z-index: 1;
}

/* ── Header ──────────────────────────────────────────────────── */
#bs-header {
  text-align: center;
  margin-bottom: 1.2rem;
}

#bs-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  color: #06b6d4;
  margin: 0 0 0.5rem;
  letter-spacing: 0.06em;
  text-shadow: 0 0 30px rgba(6,182,212,0.4);
}

/* ── Turn Indicator ──────────────────────────────────────────── */
#screen-battleship .bs-turn-indicator {
  display: inline-block;
  padding: 0.35rem 1.2rem;
  border-radius: 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.3s, color 0.3s;
  min-height: 1.8rem;
}
#screen-battleship .bs-turn-placement { background: #1e3a5f; color: #93c5fd; }
#screen-battleship .bs-turn-player    { background: #14532d; color: #4ade80; }
#screen-battleship .bs-turn-ai        { background: #4c1d1d; color: #f87171; }

/* ── Shared Overlay backdrop ─────────────────────────────────── */
#screen-battleship .bs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 11, 24, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  backdrop-filter: blur(6px);
  animation: bs-overlay-in 0.25s ease;
}
@keyframes bs-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Shared Card (used by overlays) ──────────────────────────── */
#screen-battleship .bs-card {
  background: linear-gradient(135deg, #0d1f3c 0%, #0a1628 100%);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: 1.5rem;
  padding: 2.5rem 2.5rem 2rem;
  text-align: center;
  max-width: 500px;
  width: 92%;
  box-shadow:
    0 0 0 1px rgba(6,182,212,0.1),
    0 20px 60px rgba(0,0,0,0.7),
    0 0 40px rgba(6,182,212,0.08);
  animation: bs-card-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes bs-card-in {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

#screen-battleship .bs-card-icon {
  font-size: 2.8rem;
  margin-bottom: 0.6rem;
  display: block;
}

#screen-battleship .bs-card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  color: #06b6d4;
  margin: 0 0 1.75rem;
  letter-spacing: 0.05em;
}

/* ── Mode Selection ──────────────────────────────────────────── */
#screen-battleship .bs-mode-btns {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

#screen-battleship .bs-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 160px;
  padding: 1.2rem 1.4rem;
  border-radius: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Rajdhani', sans-serif;
}

#screen-battleship .bs-mode-icon {
  font-size: 2rem;
  line-height: 1;
}

#screen-battleship .bs-mode-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#screen-battleship .bs-mode-sub {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.7;
  font-family: 'Rajdhani', sans-serif;
}

#screen-battleship .bs-mode-pvp {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
  color: #a5b4fc;
}
#screen-battleship .bs-mode-pvp:hover {
  background: rgba(99,102,241,0.3);
  border-color: #818cf8;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.3);
}

#screen-battleship .bs-mode-bot {
  background: rgba(6,182,212,0.12);
  border-color: rgba(6,182,212,0.35);
  color: #67e8f9;
}
#screen-battleship .bs-mode-bot:hover {
  background: rgba(6,182,212,0.25);
  border-color: #22d3ee;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(6,182,212,0.3);
}

/* ── Difficulty Selection ─────────────────────────────────────── */
#screen-battleship .bs-diff-btns {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

#screen-battleship .bs-diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 110px;
  padding: 1rem 1rem;
  border-radius: 0.9rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

#screen-battleship .bs-diff-icon  { font-size: 1.6rem; line-height: 1; }
#screen-battleship .bs-diff-label { font-family: 'Orbitron', sans-serif; font-size: 0.72rem; font-weight: 700; }
#screen-battleship .bs-diff-sub   { font-size: 0.68rem; opacity: 0.65; }

#screen-battleship .bs-diff-easy {
  background: rgba(22,163,74,0.15);
  border-color: rgba(22,163,74,0.4);
  color: #86efac;
}
#screen-battleship .bs-diff-easy:hover {
  background: rgba(22,163,74,0.3);
  border-color: #4ade80;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(22,163,74,0.3);
}

#screen-battleship .bs-diff-medium {
  background: rgba(202,138,4,0.15);
  border-color: rgba(202,138,4,0.4);
  color: #fde047;
}
#screen-battleship .bs-diff-medium:hover {
  background: rgba(202,138,4,0.3);
  border-color: #facc15;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(202,138,4,0.3);
}

#screen-battleship .bs-diff-hard {
  background: rgba(220,38,38,0.15);
  border-color: rgba(220,38,38,0.4);
  color: #fca5a5;
}
#screen-battleship .bs-diff-hard:hover {
  background: rgba(220,38,38,0.3);
  border-color: #f87171;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(220,38,38,0.3);
}

/* ── Pass-Turn (PvP) Screen ──────────────────────────────────── */
#screen-battleship .bs-passturn-card {
  border-color: rgba(99,102,241,0.4);
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.15),
    0 20px 60px rgba(0,0,0,0.7),
    0 0 50px rgba(99,102,241,0.1);
}

#screen-battleship .bs-passturn-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
  animation: bs-pulse 2s ease-in-out infinite;
}
@keyframes bs-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%       { transform: scale(1.1); opacity: 0.8; }
}

#screen-battleship .bs-passturn-msg {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: #c7d2fe;
  line-height: 1.7;
  margin-bottom: 0.6rem;
}

#screen-battleship .bs-passturn-hint {
  font-size: 0.82rem;
  color: #475569;
  margin: 0 0 1.75rem;
}

#screen-battleship .bs-passturn-action {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.8rem 2.5rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  min-width: 200px;
}
#screen-battleship .bs-passturn-action:hover {
  background: linear-gradient(135deg, #818cf8, #6366f1);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99,102,241,0.5);
}
#screen-battleship .bs-passturn-action:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ── Placement Bar ───────────────────────────────────────────── */
#bs-placement-bar {
  background: linear-gradient(135deg, #0d1f3c, #0a1628);
  border: 1px solid rgba(30,64,175,0.6);
  border-radius: 1rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.9rem;
}
#bs-placement-bar.bs-hidden { display: none; }

#bs-placement-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

#screen-battleship .bs-placement-label {
  font-size: 0.85rem;
  color: #64748b;
  margin-left: auto;
}

#bs-ship-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

#screen-battleship .bs-ship-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(30,41,59,0.7);
  border-radius: 0.5rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #1e3a5f;
  font-size: 0.82rem;
  opacity: 0.45;
  transition: all 0.2s;
}
#screen-battleship .bs-ship-item.bs-ship-active {
  opacity: 1;
  border-color: #06b6d4;
  background: rgba(6,182,212,0.1);
  box-shadow: 0 0 10px rgba(6,182,212,0.2);
}
#screen-battleship .bs-ship-item.bs-ship-placed {
  opacity: 0.3;
  text-decoration: line-through;
}
#screen-battleship .bs-ship-name { color: #cbd5e1; font-weight: 600; }
#screen-battleship .bs-block {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: #334155;
  border-radius: 2px;
  margin: 0 1px;
}
#screen-battleship .bs-block-placed { background: #22c55e; }

/* ── Message ─────────────────────────────────────────────────── */
#bs-message {
  text-align: center;
  min-height: 1.8rem;
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1rem;
  padding: 0.4rem 1rem;
  transition: color 0.2s;
}
#bs-message.bs-msg-error { color: #f87171; }

/* ── Boards Layout ───────────────────────────────────────────── */
#bs-boards {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

#screen-battleship .bs-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#screen-battleship .bs-board-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  color: #475569;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
  align-self: center;
  transition: color 0.3s;
}

/* Grid labels */
#screen-battleship .bs-grid-labels-row {
  display: grid;
  grid-template-columns: 20px repeat(10, 1fr);
  width: 100%;
  margin-bottom: 2px;
}
#screen-battleship .bs-grid-labels-row span,
#screen-battleship .bs-grid-labels-row .bs-corner {
  text-align: center;
  font-size: 0.6rem;
  color: #334155;
  line-height: 1;
}
#screen-battleship .bs-grid-with-labels { display: flex; gap: 2px; }
#screen-battleship .bs-grid-labels-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 18px;
}
#screen-battleship .bs-grid-labels-col span {
  font-size: 0.56rem;
  color: #334155;
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Grid */
#screen-battleship .bs-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}

#screen-battleship .bs-cell {
  width:  clamp(26px, 3.8vw, 38px);
  height: clamp(26px, 3.8vw, 38px);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.6rem, 1.5vw, 0.9rem);
  transition: background 0.15s, transform 0.1s, box-shadow 0.1s;
  user-select: none;
  box-sizing: border-box;
}

/* Player cells */
#screen-battleship .bs-cell-player {
  background: #071526;
  border: 1px solid #0f2744;
  cursor: default;
}
#screen-battleship .bs-cell-player.bs-ship-cell {
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
  border-color: #3b82f6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
#screen-battleship .bs-cell-player.bs-preview-valid {
  background: #14532d;
  border-color: #22c55e;
}
#screen-battleship .bs-cell-player.bs-preview-invalid {
  background: #7f1d1d;
  border-color: #ef4444;
}

/* Enemy/attack cells */
#screen-battleship .bs-cell-ai {
  background: #040e1c;
  border: 1px solid #0f2744;
}
#screen-battleship .bs-cell-ai.bs-clickable { cursor: crosshair; }
#screen-battleship .bs-cell-ai.bs-clickable:hover {
  background: #1e3a8a;
  border-color: #3b82f6;
  transform: scale(1.12);
  z-index: 1;
  box-shadow: 0 0 8px rgba(59,130,246,0.5);
}

/* Hit / miss / sunk / reveal */
#screen-battleship .bs-hit  { background: #7f1d1d !important; border-color: #ef4444 !important; }
#screen-battleship .bs-miss { background: #0f172a !important; border-color: #1e293b !important; color: #334155; }
#screen-battleship .bs-sunk { background: #450a0a !important; border-color: #b91c1c !important; }
#screen-battleship .bs-reveal { background: #0e3040 !important; border-color: #06b6d4 !important; }

/* ── Controls ────────────────────────────────────────────────── */
#bs-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 0.75rem;
}

/* ── Buttons ─────────────────────────────────────────────────── */
#screen-battleship .bs-btn {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #030712;
  border: none;
  border-radius: 0.55rem;
  padding: 0.55rem 1.3rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
#screen-battleship .bs-btn:hover {
  background: linear-gradient(135deg, #22d3ee, #06b6d4);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(6,182,212,0.4);
}
#screen-battleship .bs-btn:active { transform: translateY(0); box-shadow: none; }

#screen-battleship .bs-btn-secondary {
  background: rgba(30,41,59,0.8);
  color: #64748b;
  border: 1px solid #1e293b;
}
#screen-battleship .bs-btn-secondary:hover {
  background: #1e293b;
  color: #94a3b8;
  box-shadow: none;
  transform: none;
}

#screen-battleship .bs-btn-ghost {
  background: transparent;
  color: #64748b;
  border: 1px solid #1e3a5f;
}
#screen-battleship .bs-btn-ghost:hover {
  background: rgba(30,58,95,0.5);
  color: #94a3b8;
  border-color: #2563eb;
  box-shadow: none;
  transform: none;
}

#screen-battleship .bs-btn-confirm {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
}
#screen-battleship .bs-btn-confirm:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 14px rgba(22,163,74,0.4);
}

/* ── Result Overlay ──────────────────────────────────────────── */
#bs-result-panel {
  z-index: 200;
}
#bs-result-panel .bs-card {
  border-color: rgba(6,182,212,0.4);
  max-width: 380px;
}
#bs-result-inner { /* uses .bs-card styles */ }

#bs-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  color: #06b6d4;
  margin-bottom: 0.5rem;
}
#bs-result-detail {
  font-size: 1rem;
  color: #64748b;
  margin-bottom: 1.75rem;
  line-height: 1.5;
}
#bs-result-btns {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Utility ─────────────────────────────────────────────────── */
#screen-battleship .bs-hidden { display: none !important; }

/* ── Animations ──────────────────────────────────────────────── */

/* Miss: water splash ripple */
@keyframes bs-splash {
  0%   { box-shadow: 0 0 0 0 rgba(96,165,250,0.7); background: #1e3a5f !important; }
  60%  { box-shadow: 0 0 0 10px rgba(96,165,250,0); }
  100% { box-shadow: 0 0 0 0 rgba(96,165,250,0); }
}
#screen-battleship .bs-anim-splash {
  animation: bs-splash 0.9s ease-out forwards;
}

/* Hit: explosion flash */
@keyframes bs-explode {
  0%   { background: #fbbf24 !important; transform: scale(1.25); }
  30%  { background: #f97316 !important; transform: scale(1.15); }
  100% { background: #7f1d1d !important; transform: scale(1); }
}
#screen-battleship .bs-anim-explode {
  animation: bs-explode 0.7s ease-out forwards;
}

/* Sunk: flash then smoke */
@keyframes bs-sunk-flash {
  0%, 40%, 80% { background: #fef08a !important; border-color: #facc15 !important; }
  20%, 60%     { background: #7f1d1d !important; }
  100%         { background: #7f1d1d !important; }
}
#screen-battleship .bs-anim-sunk-flash {
  animation: bs-sunk-flash 0.5s ease-out forwards;
}

@keyframes bs-smoke {
  0%   { opacity: 1; }
  50%  { background: #292524 !important; border-color: #57534e !important; }
  100% { opacity: 0.6; }
}
#screen-battleship .bs-anim-smoke {
  animation: bs-smoke 0.8s ease-out forwards;
}

/* Screen shake */
@keyframes bs-shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px) rotate(-1deg); }
  30%      { transform: translateX(5px)  rotate(1deg); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(3px); }
  75%      { transform: translateX(-2px); }
}
#screen-battleship .bs-anim-shake {
  animation: bs-shake 0.5s cubic-bezier(.36,.07,.19,.97) forwards;
}

/* Board win/lose glow */
@keyframes bs-glow-win {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 0 4px rgba(34,197,94,0.5), 0 0 30px rgba(34,197,94,0.3); }
}
@keyframes bs-glow-lose {
  0%, 100% { box-shadow: none; }
  50%      { box-shadow: 0 0 0 4px rgba(239,68,68,0.5), 0 0 30px rgba(239,68,68,0.3); }
}
#screen-battleship .bs-anim-glow-win  { animation: bs-glow-win  1.5s ease-in-out forwards; }
#screen-battleship .bs-anim-glow-lose { animation: bs-glow-lose 1.5s ease-in-out forwards; }

/* Victory / defeat card entrance */
@keyframes bs-victory-enter {
  0%   { transform: scale(0.6) rotate(-4deg); opacity: 0; }
  70%  { transform: scale(1.05) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}
@keyframes bs-defeat-enter {
  0%   { transform: translateY(-40px); opacity: 0; }
  100% { transform: translateY(0);     opacity: 1; }
}
#screen-battleship .bs-anim-victory-enter { animation: bs-victory-enter 0.9s cubic-bezier(.34,1.56,.64,1) forwards; }
#screen-battleship .bs-anim-defeat-enter  { animation: bs-defeat-enter  0.6s ease-out forwards; }

/* Floating "Sunk!" text */
#screen-battleship .bs-sunk-label {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239,68,68,0.9);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 2rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  animation: bs-sunk-float 1.8s ease-out forwards;
}
@keyframes bs-sunk-float {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-50px); }
}

/* Confetti pieces */
#screen-battleship .bs-confetti-piece {
  position: absolute;
  border-radius: 2px;
  pointer-events: none;
  animation: bs-confetti-fall linear forwards;
}
@keyframes bs-confetti-fall {
  0%   { transform: translateY(-20px) rotate(0deg);    opacity: 1; }
  100% { transform: translateY(200px) rotate(720deg);  opacity: 0; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  #bs-boards { gap: 1.25rem; }
  #bs-placement-controls { gap: 0.4rem; }
  #screen-battleship .bs-card { padding: 2rem 1.5rem 1.75rem; }
  #screen-battleship .bs-mode-btn { min-width: 130px; padding: 1rem; }
  #bs-result-title { font-size: 1.3rem; }
}

/* ═══════════════════════════════════════════════════════════════
   CHECKERS  ·  All styles scoped under #screen-checkers
   ═══════════════════════════════════════════════════════════════ */

#screen-checkers {
  min-height: 100vh;
  color: var(--text, #e2e8ff);
  font-family: 'Rajdhani', sans-serif;
  padding: 1rem 0.5rem 3rem;
  box-sizing: border-box;
}

#ck-app {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 3.5rem;
}

/* Header */
#ck-header {
  text-align: center;
  margin-bottom: 1rem;
}

#ck-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.3rem, 4vw, 2rem);
  color: #e85d04;
  margin: 0 0 0.4rem;
  letter-spacing: 0.05em;
}

/* Turn indicator */
#screen-checkers .ck-turn-indicator {
  display: inline-block;
  padding: 0.35rem 1.1rem;
  border-radius: 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.3s;
  min-height: 1.8rem;
}
#screen-checkers .ck-turn-p1       { background: #7f1d1d; color: #fca5a5; }
#screen-checkers .ck-turn-p2       { background: #1c1917; color: #d4d4d8; border: 1px solid #3f3f46; }
#screen-checkers .ck-turn-ai       { background: #1e1b4b; color: #a5b4fc; }
#screen-checkers .ck-turn-gameover { background: #134e4a; color: #5eead4; }

/* Message */
#ck-message {
  text-align: center;
  min-height: 1.5rem;
  font-size: 0.95rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
  padding: 0.3rem;
}
#screen-checkers .ck-msg-warn  { color: #fbbf24; font-weight: 700; }
#screen-checkers .ck-msg-error { color: #f87171; }

/* Game area layout */
#ck-game-area {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Score panels */
#screen-checkers .ck-score-panel {
  min-width: 80px;
  text-align: center;
  padding: 0.6rem 0.5rem;
  background: #0f172a;
  border-radius: 0.6rem;
  border: 1px solid #1e293b;
}
#screen-checkers .ck-score-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
}
#screen-checkers .ck-score-count {
  font-size: 0.75rem;
  color: #64748b;
}

/* Board wrapper */
#ck-board-wrap {
  flex-shrink: 0;
}

/* Board grid */
#ck-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  border: 3px solid #334155;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(232,93,4,0.15);
  width: clamp(280px, 70vw, 480px);
  height: clamp(280px, 70vw, 480px);
}

/* Squares */
#screen-checkers .ck-square {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.15s;
  cursor: default;
}
#screen-checkers .ck-light {
  background: #d4a76a;
}
#screen-checkers .ck-dark {
  background: #5c3d1e;
  cursor: pointer;
}
#screen-checkers .ck-dark:hover {
  background: #6b4a28;
}

/* Selection + highlights */
#screen-checkers .ck-selected {
  background: #1d4ed8 !important;
  box-shadow: inset 0 0 0 2px #60a5fa;
}
#screen-checkers .ck-multijump {
  background: #7e22ce !important;
  box-shadow: inset 0 0 0 2px #c084fc;
}
#screen-checkers .ck-forced {
  background: #7f1d1d !important;
  box-shadow: inset 0 0 0 2px #f87171;
  animation: ck-forced-pulse 1s ease-in-out infinite;
}
@keyframes ck-forced-pulse {
  0%,100% { box-shadow: inset 0 0 0 2px #f87171, 0 0 0 0 rgba(248,113,113,0); }
  50%     { box-shadow: inset 0 0 0 2px #f87171, 0 0 0 4px rgba(248,113,113,0.3); }
}

/* Valid destination dot */
#screen-checkers .ck-valid-dest {
  background: #064e3b !important;
}
#screen-checkers .ck-dest-dot {
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(52,211,153,0.7);
  pointer-events: none;
  animation: ck-dot-pulse 1.1s ease-in-out infinite;
}
@keyframes ck-dot-pulse {
  0%,100% { transform: scale(1); opacity: 0.8; }
  50%     { transform: scale(1.2); opacity: 1; }
}

/* Pieces */
#screen-checkers .ck-piece {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s;
  box-sizing: border-box;
  user-select: none;
  box-shadow: 0 3px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
}
#screen-checkers .ck-piece:hover {
  transform: scale(1.08);
}
#screen-checkers .ck-p1 {
  background: radial-gradient(circle at 35% 35%, #ef4444, #991b1b);
  border: 2px solid #fca5a5;
}
#screen-checkers .ck-p2 {
  background: radial-gradient(circle at 35% 35%, #52525b, #18181b);
  border: 2px solid #71717a;
}
#screen-checkers .ck-king {
  box-shadow: 0 3px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2), 0 0 10px rgba(250,204,21,0.4);
  border-color: #fbbf24 !important;
}
#screen-checkers .ck-crown {
  font-size: clamp(0.6rem, 1.8vw, 0.9rem);
  line-height: 1;
  color: #fbbf24;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Controls ─────────────────────────────────────────────── */
#ck-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
#screen-checkers .ck-btn {
  background: #e85d04;
  color: #030712;
  border: none;
  border-radius: 0.5rem;
  padding: 0.55rem 1.4rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
#screen-checkers .ck-btn:hover {
  background: #fb923c;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232,93,4,0.35);
}
#screen-checkers .ck-btn:active { transform: translateY(0); box-shadow: none; }

#screen-checkers .ck-btn-secondary {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}
#screen-checkers .ck-btn-secondary:hover {
  background: #273548;
  color: #cbd5e1;
  box-shadow: none;
}

/* ── Overlay panels ────────────────────────────────────────── */
#screen-checkers .ck-overlay-panel {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
#screen-checkers .ck-panel-inner {
  background: #0f172a;
  border: 2px solid #e85d04;
  border-radius: 1.25rem;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 460px;
  width: 92%;
  box-shadow: 0 0 40px rgba(232,93,4,0.2);
}
#screen-checkers .ck-panel-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.25rem;
  color: #e85d04;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}
#screen-checkers .ck-mode-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
#screen-checkers .ck-mode-btn {
  min-width: 150px;
  padding: 1rem 1.2rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
#screen-checkers .ck-mode-sub {
  display: block;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(3,7,18,0.65);
  margin-top: 0.2rem;
}
#screen-checkers .ck-diff-easy   { background: #16a34a; }
#screen-checkers .ck-diff-easy:hover   { background: #22c55e; }
#screen-checkers .ck-diff-medium { background: #ca8a04; }
#screen-checkers .ck-diff-medium:hover { background: #eab308; }
#screen-checkers .ck-diff-hard   { background: #dc2626; }
#screen-checkers .ck-diff-hard:hover   { background: #ef4444; }

/* Result panel */
#ck-result-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.7rem;
  color: #e85d04;
  margin-bottom: 0.5rem;
}
#ck-result-detail {
  font-size: 1rem;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}
#screen-checkers .ck-result-btns {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes ck-move-flash {
  0%   { background: rgba(251,191,36,0.6) !important; }
  100% { background: transparent; }
}
#screen-checkers .ck-anim-move {
  animation: ck-move-flash 0.3s ease-out forwards;
}

@keyframes ck-land-pop {
  0%   { transform: scale(1.3); }
  60%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
#screen-checkers .ck-anim-land .ck-piece {
  animation: ck-land-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes ck-capture-vanish {
  0%   { opacity: 1;  transform: scale(1); }
  50%  { opacity: 0.4; transform: scale(1.3); filter: brightness(2); }
  100% { opacity: 0;  transform: scale(0.3); }
}
#screen-checkers .ck-anim-capture .ck-piece {
  animation: ck-capture-vanish 0.45s ease-out forwards;
}

@keyframes ck-win-enter {
  0%   { opacity: 0; transform: scale(0.75) translateY(20px); }
  60%  { opacity: 1; transform: scale(1.04) translateY(-3px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes ck-lose-enter {
  0%   { opacity: 0; transform: scale(1.1) translateY(-15px); filter: blur(3px); }
  60%  { opacity: 1; transform: scale(0.98) translateY(2px); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
#screen-checkers #ck-result-inner.ck-anim-win-enter {
  animation: ck-win-enter 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
}
#screen-checkers #ck-result-inner.ck-anim-lose-enter {
  animation: ck-lose-enter 0.6s ease-out forwards;
}

/* ── Utility ─────────────────────────────────────────────── */
#screen-checkers .ck-hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 540px) {
  #ck-game-area { gap: 0.4rem; }
  #screen-checkers .ck-score-panel { min-width: 56px; padding: 0.4rem 0.3rem; }
  #screen-checkers .ck-score-label { font-size: 0.7rem; }
  #screen-checkers .ck-score-count { font-size: 0.65rem; }
  #ck-result-title { font-size: 1.3rem; }
}


/* ══════════════════════════════════════════════════════════════
   DARTS DUEL  —  screen-darts styles
══════════════════════════════════════════════════════════════ */

#screen-darts {
  min-height: 100vh;
  background: var(--bg, #0d0d0d);
  color: #fff;
  font-family: Rajdhani, sans-serif;
  display: flex;
  flex-direction: column;
}

/* ── Play panel layout ─────────────────────────────────────── */
#darts-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: inherit;
  padding-bottom: 1.5rem;
}

#darts-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
#darts-header h2 {
  flex: 1;
  text-align: center;
  font-family: Orbitron, sans-serif;
  font-size: 1.2rem;
  color: #ff1744;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}
#darts-timer-display {
  font-family: Orbitron, sans-serif;
  font-size: 1rem;
  color: #ff1744;
  min-width: 3.5rem;
  text-align: right;
}

/* ── Score bar ─────────────────────────────────────────────── */
#darts-score-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 500px;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  margin-bottom: 0.5rem;
}

.darts-player-score {
  flex: 1;
  text-align: center;
  border-radius: 10px;
  padding: 0.4rem 0.5rem;
  transition: background 0.25s, box-shadow 0.25s;
}
.darts-player-score.darts-active-player {
  background: rgba(255,23,68,0.15);
  box-shadow: 0 0 10px rgba(255,23,68,0.35);
}
.darts-player-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: #aaa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.darts-score-num {
  font-family: Orbitron, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.darts-active-player .darts-score-num { color: #ff1744; }
.darts-throw-row { min-height: 1.2rem; margin-top: 0.2rem; display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.darts-throw-chip {
  background: rgba(255,255,255,0.12);
  border-radius: 5px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffd600;
}

#darts-turn-badge {
  flex: 0 0 auto;
  text-align: center;
  padding: 0 0.5rem;
}
#darts-turn-text {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
#darts-dart-pips {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-top: 4px;
}
.darts-pip {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: inline-block;
  transition: background 0.2s;
}
.darts-pip.darts-pip-active { background: #ff1744; box-shadow: 0 0 6px #ff1744; }

/* ── Canvas area ───────────────────────────────────────────── */
#darts-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#darts-board {
  cursor: crosshair;
  border-radius: 50%;
  touch-action: none;
  user-select: none;
  max-width: 100%;
  display: block;
}
#darts-aim-hint {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.4rem;
  text-align: center;
  pointer-events: none;
}

/* ── Score popup ───────────────────────────────────────────── */
#darts-score-popup {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-family: Orbitron, sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  pointer-events: none;
  text-shadow: 0 0 20px currentColor;
  z-index: 50;
}
.darts-pop-anim {
  animation: darts-pop-kf 1.4s ease-out forwards;
}
@keyframes darts-pop-kf {
  0%   { opacity:1; transform:translate(-50%,-50%) scale(0.7); }
  20%  { opacity:1; transform:translate(-50%,-50%) scale(1.15); }
  60%  { opacity:1; transform:translate(-50%,-70%) scale(1); }
  100% { opacity:0; transform:translate(-50%,-110%) scale(0.85); }
}

/* ── Result overlay ────────────────────────────────────────── */
#darts-result {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  backdrop-filter: blur(6px);
}
#darts-result.hidden { display: none; }
#darts-result-inner {
  background: #181818;
  border: 1px solid rgba(255,23,68,0.4);
  border-radius: 18px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 0 40px rgba(255,23,68,0.25);
  animation: darts-result-in 0.5s cubic-bezier(0.22,1,0.36,1);
}
@keyframes darts-result-in {
  from { transform: scale(0.7); opacity:0; }
  to   { transform: scale(1);   opacity:1; }
}
#darts-result-icon { font-size: 3.5rem; line-height: 1; margin-bottom: 0.5rem; }
#darts-result-title { font-family: Orbitron, sans-serif; font-size: 1.5rem; color: #ff1744; margin-bottom: 0.4rem; }
#darts-result-detail { color: #aaa; font-size: 0.95rem; margin-bottom: 1.5rem; }
#darts-result-btns { display: flex; gap: 0.75rem; justify-content: center; }
#darts-result-btns button {
  background: rgba(255,23,68,0.2);
  border: 1px solid rgba(255,23,68,0.5);
  color: #fff;
  border-radius: 8px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  font-family: Orbitron, sans-serif;
  font-size: 0.8rem;
  transition: background 0.2s;
}
#darts-result-btns button:hover { background: rgba(255,23,68,0.45); }

/* ── Confetti pieces ───────────────────────────────────────── */
.darts-confetti-piece {
  position: absolute;
  top: -10px;
  pointer-events: none;
  animation: darts-fall linear forwards;
  z-index: 90;
}
@keyframes darts-fall {
  from { transform: translateY(-10px) rotate(0deg); opacity:1; }
  to   { transform: translateY(100vh) rotate(720deg); opacity:0; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .darts-score-num { font-size: 1.4rem; }
  #darts-header h2 { font-size: 1rem; }
}



/* ═══════════════════════════════════════════════════════════════
   PULL THE ROPE — Tug of War Duel  ★ Enhanced UI ★
   All rules use IDs/classes that MATCH the actual HTML:
   #ptr-fill-left / #ptr-fill-right, .ptr-tap-label, .ptr-key-hint,
   .ptr-zone-flash, .ptr-pname-1/2, .ptr-result-overlay, etc.
   ═══════════════════════════════════════════════════════════════ */

#screen-ropewar {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Play wrap ───────────────────────────────────────────── */
.ptr-play-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: #07080f;
  background-image:
    radial-gradient(ellipse 70% 50% at 10% 50%, rgba(0,200,255,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 90% 50%, rgba(255,61,0,0.06) 0%, transparent 70%);
  overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────── */
#ptr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.65);
  border-bottom: 1px solid rgba(255,61,0,0.18);
  min-height: 52px;
  gap: 12px;
  position: relative;
  z-index: 20;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
}

#ptr-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.22em;
  background: linear-gradient(90deg, #00c8ff 0%, #fff 45%, #ff3d00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(255,61,0,0.4));
  flex: 1;
  text-align: center;
}

/* ── Round score display in header ──────────────────────── */
.ptr-round-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 4px 12px;
  flex-shrink: 0;
}
.ptr-rounds-p1 {
  color: #00c8ff;
  text-shadow: 0 0 8px rgba(0,200,255,0.7);
  letter-spacing: 0.2em;
  font-size: 1rem;
}
.ptr-rounds-p2 {
  color: #ff3d00;
  text-shadow: 0 0 8px rgba(255,61,0,0.7);
  letter-spacing: 0.2em;
  font-size: 1rem;
}
.ptr-rounds-label {
  color: #546e7a;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ptr-timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ff9100;
  text-shadow: 0 0 12px rgba(255,145,0,0.5);
  min-width: 48px;
  text-align: right;
  transition: color 0.2s;
}
.ptr-timer.ptr-timer-urgent {
  color: #ff1744;
  text-shadow: 0 0 16px rgba(255,23,68,0.7);
  animation: ptr-timer-flash 0.5s ease-in-out infinite alternate;
}
@keyframes ptr-timer-flash {
  from { opacity: 1; }
  to   { opacity: 0.4; }
}

/* ── Arena ───────────────────────────────────────────────── */
#ptr-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ── Player name row ─────────────────────────────────────── */
#ptr-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 0;
}

.ptr-pname {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.14em;
}
.ptr-pname-1 {
  color: #00c8ff;
  text-shadow: 0 0 18px rgba(0,200,255,0.7);
}
.ptr-pname-2 {
  color: #ff3d00;
  text-shadow: 0 0 18px rgba(255,61,0,0.7);
}

.ptr-vs {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: #2a2a44;
}

/* ── Rope track ──────────────────────────────────────────── */
#ptr-rope-track {
  position: relative;
  height: 76px;
  margin: 12px 56px 6px;
  display: flex;
  align-items: center;
}

/* The rope line itself */
#ptr-rope-line {
  position: absolute;
  left: 0; right: 0;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #00c8ff 0%, #2a2a44 50%, #ff3d00 100%);
  transition: background 0.1s;
  box-shadow:
    0 2px 12px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Center divider tick */
#ptr-rope-line::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px; bottom: -4px;
  width: 2px;
  background: rgba(255,255,255,0.25);
  transform: translateX(-50%);
  border-radius: 1px;
}

#ptr-fill-left {
  position: absolute;
  left: 0;
  height: 12px;
  width: 0%;
  background: linear-gradient(90deg, rgba(0,200,255,0.75), rgba(0,200,255,0.1));
  border-radius: 6px 0 0 6px;
  pointer-events: none;
  transition: width 0.04s linear;
  box-shadow: 4px 0 16px rgba(0,200,255,0.35);
}

#ptr-fill-right {
  position: absolute;
  right: 0;
  height: 12px;
  width: 0%;
  background: linear-gradient(270deg, rgba(255,61,0,0.75), rgba(255,61,0,0.1));
  border-radius: 0 6px 6px 0;
  pointer-events: none;
  transition: width 0.04s linear;
  box-shadow: -4px 0 16px rgba(255,61,0,0.35);
}

/* Goal posts */
.ptr-goal {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  z-index: 4;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.35));
}
.ptr-goal-left  { left: -42px; }
.ptr-goal-right { right: -42px; }

/* Sliding knot */
#ptr-knot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.75rem;
  z-index: 6;
  pointer-events: none;
  line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,220,80,0.75)) drop-shadow(0 2px 6px rgba(0,0,0,0.7));
}

/* Taut rope: vibrate knot when near edge */
#ptr-rope-track.ptr-taut #ptr-knot {
  animation: ptr-knot-vibrate 0.1s linear infinite;
}
@keyframes ptr-knot-vibrate {
  0%,100% { transform: translate(-50%, -50%) translateY(0)   scale(1.05); }
  25%      { transform: translate(-50%, -50%) translateY(-3px) scale(0.95); }
  75%      { transform: translate(-50%, -50%) translateY(3px)  scale(1.05); }
}

/* ── Stamina bars ─────────────────────────────────────────── */
#ptr-stamina-row {
  display: flex;
  gap: 12px;
  padding: 4px 16px;
}
.ptr-stam-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ptr-stam-wrap-r { flex-direction: row-reverse; }

.ptr-stam-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: #3a3a60;
  white-space: nowrap;
  flex-shrink: 0;
}
.ptr-stam-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.5);
}
.ptr-stam-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: width 0.05s linear;
}
.ptr-stam-fill-1 {
  background: linear-gradient(90deg, #006aad, #00c8ff);
  box-shadow: 0 0 8px rgba(0,200,255,0.4);
}
.ptr-stam-fill-2 {
  background: linear-gradient(90deg, #cc2000, #ff3d00);
  box-shadow: 0 0 8px rgba(255,61,0,0.4);
}

/* ── Rhythm beat indicator ───────────────────────────────── */
#ptr-beat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0;
}

#ptr-beat-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e1e30;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.05s, box-shadow 0.05s;
}
#ptr-beat-dot.ptr-beat-on {
  background: #ffcc00;
  border-color: #ffcc00;
  box-shadow: 0 0 20px rgba(255,204,0,0.9), 0 0 40px rgba(255,204,0,0.3);
  animation: ptr-beat-pop 0.15s ease both;
}
@keyframes ptr-beat-pop {
  0%   { transform: scale(0.65); }
  60%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.ptr-beat-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: #3a3a60;
  text-transform: uppercase;
}

/* ── Controls hint ───────────────────────────────────────── */
#ptr-controls-hint {
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  color: #2c2c4a;
  padding: 4px 0 6px;
  text-transform: uppercase;
}

/* ── Play area: the two large tap zones ─────────────────── */
#ptr-play-area {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

#ptr-zone-divider {
  width: 2px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255,255,255,0.06) 20%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.06) 80%,
    transparent 100%);
  flex-shrink: 0;
  pointer-events: none;
}

.ptr-tap-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  transition: background 0.07s;
}

/* Scanline texture */
.ptr-tap-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.05) 3px,
    rgba(0,0,0,0.05) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* P1 zone — cool cyan */
.ptr-zone-1 {
  background:
    radial-gradient(ellipse 60% 55% at 30% 50%, rgba(0,200,255,0.1) 0%, transparent 70%),
    linear-gradient(160deg, rgba(0,80,140,0.3) 0%, rgba(0,30,60,0.5) 100%);
}
.ptr-zone-1:active {
  background: rgba(0,180,255,0.2);
}

/* P2 zone — hot orange-red */
.ptr-zone-2 {
  background:
    radial-gradient(ellipse 60% 55% at 70% 50%, rgba(255,61,0,0.1) 0%, transparent 70%),
    linear-gradient(200deg, rgba(140,30,0,0.3) 0%, rgba(60,10,0,0.5) 100%);
}
.ptr-zone-2:active {
  background: rgba(255,80,0,0.2);
}

/* Flash animation — JS adds/removes .ptr-zone-flash */
.ptr-tap-zone.ptr-zone-flash {
  animation: ptr-zone-flash 0.15s ease both;
}
@keyframes ptr-zone-flash {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(2.0); }
  100% { filter: brightness(1); }
}

.ptr-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  position: relative;
  z-index: 2;
}

.ptr-tap-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.4rem, 9vw, 5.5rem);
  letter-spacing: 0.1em;
  line-height: 1;
}
.ptr-zone-1 .ptr-tap-label {
  color: rgba(0,200,255,0.22);
  text-shadow: 0 0 30px rgba(0,200,255,0.15);
}
.ptr-zone-2 .ptr-tap-label {
  color: rgba(255,80,0,0.22);
  text-shadow: 0 0 30px rgba(255,80,0,0.15);
}

/* Brighten labels when flash active */
.ptr-zone-1.ptr-zone-flash .ptr-tap-label { color: rgba(0,200,255,0.7); }
.ptr-zone-2.ptr-zone-flash .ptr-tap-label { color: rgba(255,80,0,0.7); }

.ptr-key-hint {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.18);
  text-transform: uppercase;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3px 10px;
  border-radius: 6px;
}

/* ── Countdown overlay ───────────────────────────────────── */
#ptr-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,8,15,0.88);
  backdrop-filter: blur(6px);
  z-index: 50;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(6rem, 22vw, 12rem);
  letter-spacing: 0.05em;
  color: #e2e8ff;
  pointer-events: none;
}
#ptr-countdown.hidden { display: none; }

.ptr-countdown-num {
  animation: ptr-cd-pop 0.35s cubic-bezier(.34,1.56,.64,1) both;
  background: linear-gradient(135deg, #fff 0%, #90caf9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 40px rgba(120,180,255,0.6));
}
.ptr-countdown-go {
  animation: ptr-cd-pop 0.35s cubic-bezier(.34,1.56,.64,1) both;
  background: linear-gradient(135deg, #ffcc00 0%, #ff3d00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 60px rgba(255,61,0,0.8));
}

@keyframes ptr-cd-pop {
  from { opacity: 0; transform: scale(0.45) rotate(-10deg); }
  to   { opacity: 1; transform: scale(1)    rotate(0deg); }
}

/* ── Result overlay ──────────────────────────────────────── */
.ptr-result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7,8,15,0.90);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

#ptr-result-inner {
  background: linear-gradient(160deg, #141028 0%, #0c0818 100%);
  border: 2px solid rgba(255,61,0,0.5);
  border-radius: 22px;
  padding: 38px 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow:
    0 0 0 1px rgba(255,61,0,0.12),
    0 0 80px rgba(255,61,0,0.18),
    0 24px 80px rgba(0,0,0,0.85),
    inset 0 1px 0 rgba(255,255,255,0.06);
  animation: ptr-result-in 0.4s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes ptr-result-in {
  from { opacity: 0; transform: scale(0.82) translateY(28px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

#ptr-result-icon {
  font-size: 4.2rem;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(255,200,0,0.6));
}

#ptr-result-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.1em;
  color: #ff3d00;
  text-shadow: 0 0 32px rgba(255,61,0,0.5);
}

#ptr-result-detail {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  color: #4a3860;
  letter-spacing: 0.08em;
}

#ptr-result-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

#ptr-result-btns button {
  background: transparent;
  border: 1.5px solid #3a2010;
  border-radius: 10px;
  color: #b06030;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 24px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.12s;
}
#ptr-result-btns button:hover {
  border-color: #ff3d00;
  color: #ff3d00;
  background: rgba(255,61,0,0.1);
  transform: translateY(-2px);
}

/* ── Stats strip on home page ────────────────────────────── */
.ptr-stats-strip {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #3a3a60;
  text-transform: uppercase;
}
.ptr-stats-strip b {
  color: #ff3d00;
  font-weight: 700;
}

/* ── Special mode button group wraps on small screens ─────── */
.ptr-smode-group {
  flex-wrap: wrap !important;
}

/* ── Confetti pieces ─────────────────────────────────────── */
.ptr-confetti {
  position: absolute;
  top: -12px;
  pointer-events: none;
  animation: ptr-confetti-fall linear both;
  z-index: 90;
}
@keyframes ptr-confetti-fall {
  0%   { transform: translateY(0)     rotate(0deg)   scaleX(1);  opacity: 1; }
  35%  { transform: translateY(35vh)  rotate(320deg) scaleX(-1); opacity: 1; }
  70%  { transform: translateY(70vh)  rotate(640deg) scaleX(1);  opacity: 1; }
  100% { transform: translateY(110vh) rotate(960deg) scaleX(-1); opacity: 0; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  #ptr-rope-track {
    margin-left: 44px;
    margin-right: 44px;
  }
  .ptr-goal-left  { left: -34px; }
  .ptr-goal-right { right: -34px; }
  #ptr-result-inner { padding: 28px 24px; }
  #ptr-result-btns button { padding: 9px 16px; }
}

@media (max-width: 360px) {
  #ptr-result-btns { flex-direction: column; align-items: center; }
  .ptr-tap-label   { font-size: 2rem; }
}


/* ═══════════════════════════════════════════════════════════════
   DUELZONE IMPROVEMENTS — Additional CSS
   ═══════════════════════════════════════════════════════════════ */

/* ── Chess: Hint highlight ────────────────────────────────── */
.chess-hint-highlight {
  background: rgba(255, 215, 0, 0.35) !important;
  box-shadow: inset 0 0 0 3px rgba(255, 215, 0, 0.8) !important;
  animation: chess-hint-pulse 0.6s ease-in-out infinite alternate;
}
@keyframes chess-hint-pulse {
  from { background: rgba(255, 215, 0, 0.25) !important; }
  to   { background: rgba(255, 215, 0, 0.50) !important; }
}

/* Chess: King in check ring */
.chess-check-ring {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 3px solid rgba(255, 60, 60, 0.9);
  pointer-events: none;
  animation: chess-check-ring-pulse 0.5s ease-in-out infinite alternate;
  z-index: 5;
}
@keyframes chess-check-ring-pulse {
  from { border-color: rgba(255,60,60,0.6); box-shadow: 0 0 6px rgba(255,60,60,0.4); }
  to   { border-color: rgba(255,60,60,1.0); box-shadow: 0 0 18px rgba(255,60,60,0.8); }
}

/* Chess: Undo / Hint buttons */
#chess-undo-btn, #chess-hint-btn, #chess-setup-btn {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.18);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.05em;
}
#chess-undo-btn:hover  { background: rgba(100,150,255,0.18); border-color: #6496ff; }
#chess-hint-btn:hover  { background: rgba(255,215,0,0.18);   border-color: #ffd700; }
#chess-setup-btn:hover { background: rgba(245,197,24,0.18);  border-color: #f5c518; color: #f5c518; }

/* ── Battleship: Radar ping on miss ──────────────────────── */
.bs-radar-ping {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(100,200,255,0.7);
  transform: translate(-50%, -50%) scale(1);
  animation: bs-ping-expand 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 20;
}
@keyframes bs-ping-expand {
  0%   { transform: translate(-50%,-50%) scale(0.3); opacity: 0.9; }
  100% { transform: translate(-50%,-50%) scale(4);   opacity: 0; }
}

/* Battleship: Sunk ship cell outline */
[data-sunk-ship] {
  outline: 2px solid rgba(255,120,0,0.7);
  outline-offset: -2px;
  box-shadow: inset 0 0 8px rgba(255,80,0,0.3);
}

/* ── Checkers: King promotion toast ──────────────────────── */
.ck-king-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  font-weight: 900;
  font-size: 0.65rem;
  padding: 3px 7px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
  animation: ck-toast-pop 1.4s ease-out forwards;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 10px rgba(251,191,36,0.6);
}
@keyframes ck-toast-pop {
  0%   { opacity: 0; transform: translate(-50%,-60%) scale(0.6); }
  15%  { opacity: 1; transform: translate(-50%,-80%) scale(1.2); }
  30%  { transform: translate(-50%,-80%) scale(1.0); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-120%) scale(0.8); }
}

/* Checkers: King promotion cell flash */
.ck-anim-king-promote {
  animation: ck-king-flash 0.7s ease-out;
}
@keyframes ck-king-flash {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(2.5) saturate(2); }
  50%  { filter: brightness(1.6); }
  100% { filter: brightness(1); }
}

/* Checkers: Move history */
#ck-move-history {
  max-height: 80px;
  overflow-y: auto;
  font-size: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px 0;
}
.ck-hist-entry {
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Rajdhani', monospace;
  white-space: nowrap;
}
.ck-hist-p1 { background: rgba(239,68,68,0.2); color: #fca5a5; }
.ck-hist-p2 { background: rgba(71,85,105,0.3); color: #94a3b8; }
.ck-hist-cap { color: #fbbf24; font-weight: 700; }

/* ── Ping Pong: Score pop animation ──────────────────────── */
.pp-score-pop {
  animation: pp-score-pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes pp-score-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.55); color: #fbbf24; }
  100% { transform: scale(1); }
}

/* Ping Pong: Serve indicator */
.pp-serve-ind {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 12px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  animation: pp-serve-fade 1.8s ease-out forwards;
}
.pp-serve-top { top: 8px; background: rgba(0,229,255,0.2); color: #00e5ff; border: 1px solid rgba(0,229,255,0.4); }
.pp-serve-bot { bottom: 8px; background: rgba(245,0,87,0.2);  color: #f50057; border: 1px solid rgba(245,0,87,0.4); }
@keyframes pp-serve-fade {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.8); }
  15%  { opacity: 1; transform: translateX(-50%) scale(1.05); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(0.95); }
}

/* ── Darts: BUST flash overlay already created by JS ──────── */
/* Darts: Checkout hint */
#darts-checkout-hint {
  background: rgba(0,229,255,0.12);
  border: 1px solid rgba(0,229,255,0.35);
  color: #7dd3fc;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.04em;
  text-align: center;
  animation: darts-checkout-appear 0.3s ease-out;
  margin-top: 4px;
}
#darts-checkout-hint.hidden { display: none; }
@keyframes darts-checkout-appear {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tanks: Map label ─────────────────────────────────────── */
#tanks-map-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: rgba(0,229,255,0.6);
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 4px;
}

/* ── Hub Improvements ────────────────────────────────────── */
/* Recently played badge */
.game-card-hot::after {
  content: '🔥 HOT';
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #ff6b35, #f7c59f);
  color: #1a0a00;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.08em;
  font-family: 'Orbitron', sans-serif;
}
.game-card-new::after {
  content: '✨ NEW';
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.08em;
  font-family: 'Orbitron', sans-serif;
}

/* ── Global dark/light mode toggle ──────────────────────── */
body.light-mode {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --border-color: rgba(0,0,0,0.1);
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* ── Starcatcher: Evil star indicator flash ──────────────── */
.sc-evil-flash {
  animation: sc-evil-flash 0.3s ease-out;
}
@keyframes sc-evil-flash {
  0%   { filter: brightness(1) hue-rotate(0deg); }
  50%  { filter: brightness(1.8) hue-rotate(300deg); }
  100% { filter: brightness(1) hue-rotate(0deg); }
}


/* ═══════════════════════════════════════════════════════════════
   NEW GAMES CSS
   ═══════════════════════════════════════════════════════════════ */

/* ── Snake Duel ──────────────────────────────────────────────── */
#snake-play { display: flex; }

/* ── Typing Race ─────────────────────────────────────────────── */
.tw-done    { color: rgba(255,255,255,0.28); }
.tw-current { font-weight: 700; }
.tw-correct { color: #4ade80; }
.tw-wrong   { color: #f87171; text-decoration: underline; }
.tw-pending { color: rgba(255,255,255,0.6); }
.tw-future  { color: rgba(255,255,255,0.3); }

/* ── Blackjack ───────────────────────────────────────────────── */
.bj-card {
  width: 52px; height: 72px;
  background: #fff;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  font-size: 1rem;
  font-weight: 900;
  font-family: Georgia, serif;
  position: relative;
  flex-shrink: 0;
}
.bj-card-back { background: #1e1b4b; color: #a78bfa; font-size: 2rem; }
.bj-card-rank { font-size: 1.1rem; line-height: 1; }
.bj-card-suit { font-size: 1.4rem; line-height: 1; }
.bj-action-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: opacity 0.15s, transform 0.1s;
}
.bj-action-btn:hover:not(:disabled) { opacity: 0.85; transform: scale(0.97); }
.bj-action-btn:disabled { opacity: 0.3; cursor: not-allowed; }


/* ═══════════════════════════════════════════════════════════════
   GHP v2 — New Game Home Panel UI (Snake, Typing, Minesweeper, BJ)
   ═══════════════════════════════════════════════════════════════ */

.ghp-v2 {
  background: #07080f;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.ghp-v2::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(var(--ghp-rgb, 0,230,118), 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.ghp-back-v2 {
  position: absolute;
  /* FIX: pushed down below the hamburger menu */
  top: 72px;
  left: 16px;
  width: fit-content;
  width: -moz-fit-content;
  max-width: fit-content;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.18s;
  z-index: 2;
}
.ghp-back-v2:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.ghp-v2 .ghp-wrap {
  width: 100%;
  max-width: 520px;
  padding: 60px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.ghp-hero-v2 {
  text-align: center;
  padding-bottom: 4px;
}
.ghp-icon-v2 {
  width: 72px; height: 72px;
  font-size: 2.2rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 0 32px rgba(var(--ghp-rgb, 0,230,118), 0.18);
}
.ghp-title-v2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  margin: 0 0 6px;
  color: var(--ghp-accent, #00e676);
  letter-spacing: 0.04em;
}
.ghp-tagline-v2 {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.45);
  margin: 0;
  letter-spacing: 0.06em;
}

.ghp-rules-v2 {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 18px;
}
.ghp-rules-v2 .ghp-rules-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  margin: 0 0 10px;
}
.ghp-rules-v2 .ghp-rules-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ghp-rules-v2 .ghp-rules-list li {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.65);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}
.ghp-rules-v2 .ghp-rules-list li::before {
  content: '›';
  position: absolute; left: 0;
  color: var(--ghp-accent, #00e676);
  font-weight: 900;
}

/* Word count / always-visible option row */
.ghp-wc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 14px;
}
.ghp-wc-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Mode selector — the big two-button toggle */
.ghp-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ghp-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 12px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.ghp-mode-btn .mode-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 2px;
}
.ghp-mode-btn .mode-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.04em;
}
.ghp-mode-btn .mode-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
}
.ghp-mode-btn.active {
  border-color: var(--ghp-accent, #00e676);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 20px rgba(var(--ghp-rgb, 0,230,118), 0.15), inset 0 0 20px rgba(var(--ghp-rgb, 0,230,118), 0.05);
}
.ghp-mode-btn.active .mode-label {
  color: var(--ghp-accent, #00e676);
}
.ghp-mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}

/* Bot settings panel (shown/hidden) */
.ghp-bot-settings {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  animation: slideDown 0.22s ease;
}
.ghp-bot-settings.hidden { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ghp-diff-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Pill-style difficulty buttons */
.ghp-diff-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ghp-pill {
  flex: 1;
  min-width: 70px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.55);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  white-space: nowrap;
}
.ghp-pill:hover:not(.active) {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.8);
}
.ghp-pill.active {
  border-color: var(--ghp-accent, #00e676);
  background: rgba(255,255,255,0.09);
  color: var(--ghp-accent, #00e676);
  font-weight: 700;
}

/* Big start button */
.ghp-start-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: var(--ghp-accent, #00e676);
  color: #000;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.ghp-start-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 60%);
  pointer-events: none;
}
.ghp-start-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}
.ghp-start-btn:active {
  transform: translateY(0);
}
.ghp-start-btn[data-mode="bot"] {
  background: linear-gradient(135deg, var(--ghp-accent, #00e676), rgba(var(--ghp-rgb,0,230,118),0.75));
}

/* Result overlay buttons */
.ghp-result-btn-primary {
  background: var(--rb-color, #00e676);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.06em;
  transition: all 0.18s;
  box-shadow: 0 0 16px rgba(0,0,0,0.3);
}
.ghp-result-btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.ghp-result-btn-secondary {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 12px 28px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 600;
}
.ghp-result-btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* Live WPM badge in typing game */
.typ-wpm-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  transition: color 0.3s;
}
.typ-wpm-badge.active { color: #fbbf24; border-color: rgba(251,191,36,0.4); }

/* ═══════════════════════════════════════════════════
   NEW GAME STYLES: Tetris, Bomberman, DrawGuess,
   Pixel Racer, Reaction Duel
   ═══════════════════════════════════════════════════ */


/* Draw & Guess color button active state */
.dg-color.active { outline: 3px solid #fff; outline-offset: 2px; }
.dg-brush.active { background: rgba(255,255,255,0.3) !important; border-color: #fff !important; }

/* Reaction Duel signal glow */
#rd-signal-bg {
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
#rd-tap-p1:active, #rd-tap-p2:active { transform: scale(0.95); }


/* ═══════════════════════════════════════════════
   DuelZone · Mobile & Fullscreen Additions
   ═══════════════════════════════════════════════ */

/* Fullscreen button */
.dz-fs-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dz-fs-btn:hover, .dz-fs-btn:active {
  background: rgba(255,255,255,0.16);
}

/* Top bar for play screens */
.dz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 4px 0 8px;
  box-sizing: border-box;
}
.dz-topbar .dz-fs-btn {
  flex-shrink: 0;
}

/* Virtual d-pad controls */
.dz-dpad-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.dz-dpad-row {
  display: flex;
  gap: 0;
}
.dz-dpad-btn {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.08s;
}
.dz-dpad-btn:active, .dz-dpad-btn.pressed {
  background: rgba(255,255,255,0.28);
}
.dz-action-btn {
  min-width: 64px;
  height: 52px;
  background: rgba(255,200,0,0.18);
  border: 1px solid rgba(255,200,0,0.4);
  border-radius: 8px;
  color: #ffd600;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'Rajdhani', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  padding: 0 10px;
}
.dz-action-btn:active, .dz-action-btn.pressed {
  background: rgba(255,200,0,0.38);
}
.dz-mobile-ctrl-wrap {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 10px 4px;
  box-sizing: border-box;
  gap: 8px;
}
.dz-ctrl-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  font-family: 'Rajdhani', sans-serif;
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}



/* Pixel racer canvas responsive */
#pr-canvas {
  max-width: 100%;
  height: auto !important;
  touch-action: none;
}

/* Bomberman canvas responsive */
#bm-canvas {
  max-width: 100% !important;
  height: auto !important;
  touch-action: none;
}

/* Checkers board responsive */
#checkers-canvas {
  max-width: 100% !important;
  height: auto !important;
  touch-action: none;
}

/* Reaction duel tap buttons - larger on mobile */
@media (max-width: 600px) {
  #rd-tap-p1, #rd-tap-p2 {
    padding: 22px 40px !important;
    font-size: 1.2rem !important;
  }
  .bj-card {
    min-width: 38px !important;
    font-size: 0.85rem !important;
  }
  #pr-canvas {
    width: 100% !important;
  }
}


/* ╔══════════════════════════════════════════════════════════════════════════╗
   ║  MOBILE COMPATIBILITY — Full overhaul for phones ≤ 480px               ║
   ║  Covers: safe-area, touch targets, chess, hub, all game screens         ║
   ╚══════════════════════════════════════════════════════════════════════════╝ */

/* ── 1. Global base fixes ─────────────────────────────────────────────────── */
:root {
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

/* Prevent iOS font-boost and double-tap zoom */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Smooth momentum scroll everywhere */
body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* All interactive elements — min 44×44px Apple/Google touch target */
button,
[role="button"],
.arena-card,
.card-btn,
.diff-btn,
.chess-diff-btn,
.chess-color-btn,
.back-btn,
input[type="button"],
input[type="submit"] {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent text inputs from zooming iOS (needs 16px) */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-size: 16px !important;
}


/* ── 2. Hub / Home screen ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-hub {
    padding: calc(var(--safe-top) + 28px) calc(var(--safe-left) + 14px)
             calc(var(--safe-bottom) + 28px) calc(var(--safe-right) + 14px);
    gap: 28px;
  }

  #title {
    font-size: clamp(2rem, 10vw, 3rem);
    letter-spacing: 0.06em;
  }

  #subtitle {
    font-size: 0.68rem;
    letter-spacing: 0.25em;
  }

  #arena-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .card-inner {
    padding: 18px 16px 16px;
    gap: 12px;
  }

  .card-icon {
    width: 52px;
    height: 52px;
  }

  .card-title { font-size: 1rem; }
  .card-desc  { font-size: 0.82rem; }

  .card-btn {
    padding: 10px 18px;
    font-size: 0.7rem;
    min-height: 44px;
  }
}


/* ── 3. Back buttons on all screens ──────────────────────────────────────── */
@media (max-width: 640px) {
  /* Universal back button padding safe area */
  .back-btn,
  [id$="-back"],
  [id$="-hub-btn"],
  [id$="-back-btn"],
  [class*="back-btn"] {
    padding: 10px 16px;
    min-height: 44px;
    min-width: 44px;
    font-size: 0.8rem;
  }
}


/* ── 4. Chess — full mobile overhaul ──────────────────────────────────────── */
@media (max-width: 600px) {
  #chess-app {
    padding: calc(var(--safe-top) + 8px) 8px calc(var(--safe-bottom) + 20px);
  }

  #chess-header {
    gap: 8px;
    padding: 4px 0 10px;
    flex-wrap: wrap;
  }

  #chess-title {
    font-size: 1rem;
    letter-spacing: 0.03em;
  }

  #chess-turn-banner {
    padding: 5px 12px;
  }

  #chess-turn-text {
    font-size: 0.8rem;
  }

  /* Board scales by itself (min(480px,90vw)) but tighten the wrap */
  #chess-board-wrap {
    width: 100%;
  }

  #chess-board {
    width: min(92vw, 420px);
    height: min(92vw, 420px);
  }

  /* Sidebar: horizontal strip below the board */
  #chess-main-layout {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  #chess-sidebar {
    max-width: 100%;
    width: min(92vw, 420px);
    flex-direction: row;
    gap: 8px;
    min-width: unset;
  }

  #chess-move-list-wrap,
  #chess-fen-wrap {
    flex: 1;
    min-width: 0;
  }

  #chess-move-list { max-height: 80px; }

  /* Controls row — bigger buttons, no overflow */
  #chess-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    width: min(92vw, 420px);
  }

  #chess-reset-btn,
  #chess-undo-btn,
  #chess-hint-btn,
  #chess-setup-btn {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    font-size: 0.82rem;
    padding: 10px 8px;
  }

  /* Difficulty buttons */
  .chess-diff-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: min(92vw, 420px);
  }

  .chess-diff-btn,
  .diff-btn {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
    font-size: 0.72rem;
    padding: 8px 6px;
    text-align: center;
  }

  .chess-diff-unbeatable {
    flex: 1 1 100% !important;
  }

  /* Play-as buttons */
  .chess-color-btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.76rem;
  }

  /* Promo modal */
  .chess-promo-grid {
    gap: 10px;
  }

  .chess-promo-btn {
    min-width: 56px;
    min-height: 56px;
  }

  .chess-promo-icon { font-size: 1.8rem; }

  /* Result overlay */
  #chess-result-btns {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #chess-result-btns button {
    min-height: 48px;
    width: 100%;
  }
}


/* ── 5. Tic Tac Toe ───────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-ttt {
    padding: calc(var(--safe-top) + 12px) 10px
             calc(var(--safe-bottom) + 20px);
  }

  #ttt-grid {
    width: min(88vw, 300px);
    height: min(88vw, 300px);
  }

  .ttt-cell {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  #diff-buttons { flex-wrap: wrap; }
  .diff-btn { min-height: 44px; padding: 8px 12px; }
}


/* ── 6. Connect 4 ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #c4-board {
    gap: 4px;
    padding: 6px;
  }

  .c4-cell {
    width: min(11vw, 44px);
    height: min(11vw, 44px);
  }
}




/* ── 8. Blackjack ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .bj-card {
    min-width: 42px !important;
    min-height: 58px !important;
    font-size: 0.82rem !important;
    padding: 4px !important;
  }

  #bj-controls button,
  #bj-bet-controls button {
    min-height: 48px;
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  #bj-controls {
    flex-wrap: wrap;
    gap: 8px;
  }

  #bj-controls button {
    flex: 1 1 calc(50% - 8px);
  }
}


/* ── 9. Tetris ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #tetris-canvas,
  #tetris-board {
    max-width: 90vw !important;
    height: auto !important;
  }

  /* Virtual d-pad for tetris */
  #tetris-controls,
  .tetris-dpad {
    gap: 8px;
  }

  .tetris-btn,
  #tetris-controls button {
    min-width: 52px;
    min-height: 52px;
    font-size: 1.1rem;
  }
}


/* ── 10. Snake ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #snake-canvas,
  #sn-canvas {
    max-width: 90vw !important;
    height: auto !important;
  }

  .snake-dpad,
  #snake-dpad {
    gap: 6px;
  }

  .snake-dpad button,
  #snake-dpad button {
    min-width: 52px;
    min-height: 52px;
    font-size: 1.2rem;
  }
}


/* ── 11. Canvas-based games — all scale + touch ───────────────────────────── */
@media (max-width: 600px) {
  #pingpong-canvas,
  #pong-canvas,
  #bm-canvas,
  #pr-canvas,
  #space-canvas,
  #star-canvas,
  #tanks-canvas,
  #ah-canvas,
  .canvas-field canvas {
    max-width: 98vw !important;
    height: auto !important;
    touch-action: none;
  }
}


/* ── 12. Battleship ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #bs-boards {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  #bs-grid-player,
  #bs-grid-enemy,
  .bs-grid {
    --cell: min(9vw, 40px);
  }

  #bs-placement-controls {
    flex-wrap: wrap;
    gap: 6px;
  }

  #bs-placement-controls button {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
  }
}


/* ── 13. Memory Flip ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #mf-grid,
  .memory-grid {
    gap: 8px;
  }

  .mf-card,
  .memory-card {
    min-width: 56px;
    min-height: 56px;
  }
}


/* ── 14. Darts ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #darts-board {
    width: min(88vw, 320px) !important;
    height: min(88vw, 320px) !important;
  }

  .darts-scores {
    gap: 6px;
  }

  .darts-score-num {
    font-size: 1.3rem;
  }
}


/* ── 15. Typing Duel ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #typing-input,
  #typing-area textarea,
  .typing-input {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 12px;
    border-radius: 8px;
  }

  #typing-text,
  .typing-text {
    font-size: 0.9rem;
    line-height: 1.6;
  }
}


/* ── 16. Checkers ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #ck-board,
  #checkers-canvas {
    width: min(90vw, 360px) !important;
    height: min(90vw, 360px) !important;
  }
}


/* ── 17. Pass & Breach ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #pb-display,
  .pb-code-display {
    font-size: 1.6rem;
    letter-spacing: 0.2em;
  }

  .pb-input-row {
    gap: 8px;
    flex-wrap: wrap;
  }
}


/* ── 18. Cricket ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #cricket-board {
    font-size: 0.8rem;
  }

  .ckt-col {
    min-width: unset;
    flex: 1;
  }
}


/* ── 19. RPS ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #rps-choices {
    gap: 10px;
  }

  .rps-choice-btn {
    min-width: 70px;
    min-height: 70px;
    font-size: 1.8rem;
  }
}


/* ── 20. 2048 Duel ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .d2048-board {
    width: min(42vw, 160px) !important;
    height: min(42vw, 160px) !important;
    gap: 3px !important;
    padding: 3px !important;
  }

  .d2048-tile {
    font-size: 0.7rem !important;
  }
}


/* ── 21. Draw & Guess ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #dg-canvas,
  .draw-canvas {
    width: 100% !important;
    height: auto !important;
    touch-action: none;
  }

  .dg-color-palette,
  .draw-palette {
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  .dg-color-btn,
  .draw-color-btn {
    width: 32px;
    height: 32px;
  }
}


/* ── 22. Connect Dots ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #cd-canvas,
  .dots-canvas {
    width: 92vw !important;
    height: 92vw !important;
    max-width: 360px;
    max-height: 360px;
  }
}


/* ── 23. Tap Battle ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #screen-tapbattle {
    padding-bottom: calc(var(--safe-bottom) + 0px);
  }

  .tap-zone {
    min-height: 38vh;
  }
}


@media (max-width: 480px) {
}


/* ── 25. Pixel Racer ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #pr-canvas {
    width: 96vw !important;
    height: auto !important;
  }
}


/* ── 26. Space Dodge ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #space-canvas,
  #sd-canvas {
    width: 92vw !important;
    height: auto !important;
    max-height: 70vh;
  }
}


/* ── 27. Global screen padding — safe area for all game screens ──────────── */
@media (max-width: 600px) {
  [id^="screen-"] {
    padding-left:   calc(var(--safe-left)   + 0px);
    padding-right:  calc(var(--safe-right)  + 0px);
    padding-bottom: calc(var(--safe-bottom) + 8px);
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* Any "back to hub" or header bar — add safe-area top */
  .game-header,
  .play-header,
  [id$="-header"]:not(#chess-header) {
    padding-top: calc(var(--safe-top) + 4px);
  }
}


/* ── 28. Result/overlay modals — full-width buttons on phone ─────────────── */
@media (max-width: 480px) {
  [id$="-result-btns"],
  [id$="-modal-btns"],
  .result-btns,
  .modal-btns {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100%;
  }

  [id$="-result-btns"] button,
  [id$="-modal-btns"] button,
  .result-btns button,
  .modal-btns button {
    width: 100%;
    min-height: 48px;
  }
}


/* ── 29. Scrollable overflow for tall game UIs ────────────────────────────── */
@media (max-width: 600px) {
  #screen-cricket,
  #screen-darts,
  #screen-blackjack,
  #screen-chess,
  #screen-battleship,
  #screen-checkers,
}


/* ── 30. Landscape phone orientation ─────────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #screen-hub {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  #chess-app {
    padding-top: 4px;
  }

  #chess-board {
    width: min(56vh, 360px);
    height: min(56vh, 360px);
  }

  #chess-main-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  #chess-sidebar {
    flex-direction: column;
    max-width: 180px;
    width: 180px;
  }
}


/* ── Carrom accent ─────────────────────────────────────── */
.arena-card[style*="--accent:#ffab40"] .card-btn {
  background: linear-gradient(135deg, #e65100 0%, #ff9800 55%, #ffcc80 100%);
  color: #1a0800;
}
.arena-card[style*="--accent:#ffab40"] .card-btn:hover {
  background: linear-gradient(135deg, #f57c00 0%, #ffb300 55%, #ffe082 100%);
  box-shadow: 0 0 26px rgba(255,171,64,0.6);
}


/* ══════════════════════════════════════════════════════════
   FLOATING HAMBURGER BUTTON
   ══════════════════════════════════════════════════════════ */

/* The hamburger floats top-left over everything */
.hamburger-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  background: rgba(10,12,22,0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: background 0.22s, border-color 0.22s, box-shadow 0.22s;
}

.hamburger-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
  box-shadow: 0 4px 24px rgba(0,229,255,0.15);
}

.hamburger-btn.open {
  background: rgba(0,229,255,0.12);
  border-color: rgba(0,229,255,0.45);
  box-shadow: 0 4px 24px rgba(0,229,255,0.25);
}

.ham-line {
  display: block;
  width: 20px;
  height: 2px;
  background: rgba(255,255,255,0.8);
  border-radius: 2px;
  transition: all 0.32s cubic-bezier(0.23,1,0.32,1);
  transform-origin: center;
}

.hamburger-btn.open .ham-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background: #00e5ff;
  width: 22px;
}
.hamburger-btn.open .ham-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.open .ham-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  background: #00e5ff;
  width: 22px;
}

/* Saved-games badge on hamburger */
.hamburger-btn .nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: linear-gradient(135deg, #f50057, #aa00ff);
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #07080f;
  pointer-events: none;
}

/* ── Dropdown Menu ── */


.dz-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

/* Dropdown section label */
.dropdown-section-label {
  padding: 10px 18px 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 18px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.65);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.dropdown-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.dropdown-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.dropdown-item:hover svg { opacity: 1; }

.dropdown-item.active {
  background: rgba(0,229,255,0.08);
  color: #00e5ff;
}
.dropdown-item.active svg { opacity: 1; color: #00e5ff; }

.dropdown-item--legal {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.38);
  padding: 9px 18px;
}
.dropdown-item--legal:hover { color: rgba(255,255,255,0.75); }

.dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 4px 14px;
}

.dd-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #f50057, #aa00ff);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Music toggle in dropdown */
.dd-music-toggle {
  margin-left: auto;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1.5px solid rgba(0,229,255,0.5);
  color: #00e5ff;
  background: rgba(0,229,255,0.08);
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.dd-music-toggle.off {
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
}
#dd-music-btn.muted svg {
  opacity: 0.35;
}

/* Backdrop to close menu on outside click */
#dz-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
}
#dz-menu-backdrop.active { display: block; }

/* ── Side Panels ── */
.dz-side-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 340px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(10,12,25,0.99) 0%, rgba(6,8,18,0.99) 100%);
  border-right: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 60px rgba(0,0,0,0.65);
  visibility: hidden;
  opacity: 0;
  transform: translateX(-100%);
  pointer-events: none;
  transition: visibility 0.35s, opacity 0.35s ease, transform 0.35s cubic-bezier(0.23,1,0.32,1);
}

.dz-side-panel.open {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.95);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}

.panel-header svg {
  width: 17px;
  height: 17px;
  opacity: 0.75;
  flex-shrink: 0;
}

/* Saved panel header accent */
#dz-saved-panel .panel-header { border-bottom-color: rgba(245,0,87,0.2); }
#dz-saved-panel .panel-header svg { color: #f50057; opacity: 0.9; }
#dz-recent-panel .panel-header { border-bottom-color: rgba(170,0,255,0.2); }
#dz-recent-panel .panel-header svg { color: #aa00ff; opacity: 0.9; }

.panel-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
}
.panel-close:hover { color: #fff; background: rgba(255,255,255,0.1); }
.panel-close svg { width: 16px; height: 16px; }

.panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* Scrollbar styling */
.panel-list::-webkit-scrollbar { width: 4px; }
.panel-list::-webkit-scrollbar-track { background: transparent; }
.panel-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 14px;
}

.panel-empty svg { width: 44px; height: 44px; opacity: 0.15; }
.panel-empty p {
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
}
.panel-empty span {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.2);
  line-height: 1.5;
  max-width: 200px;
}

/* Enhanced panel game items */
.panel-game-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.22s, border-color 0.22s, transform 0.22s, box-shadow 0.22s;
  position: relative;
  overflow: hidden;
  animation: panelItemIn 0.3s cubic-bezier(0.23,1,0.32,1) both;
}

@keyframes panelItemIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.panel-game-item:nth-child(1) { animation-delay: 0.05s; }
.panel-game-item:nth-child(2) { animation-delay: 0.10s; }
.panel-game-item:nth-child(3) { animation-delay: 0.15s; }
.panel-game-item:nth-child(4) { animation-delay: 0.20s; }
.panel-game-item:nth-child(5) { animation-delay: 0.25s; }
.panel-game-item:nth-child(6) { animation-delay: 0.30s; }
.panel-game-item:nth-child(7) { animation-delay: 0.35s; }
.panel-game-item:nth-child(8) { animation-delay: 0.40s; }

.panel-game-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--pg-accent, #00e5ff);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity 0.22s;
}

.panel-game-item:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.15);
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.panel-game-item:hover::before { opacity: 1; }

.panel-game-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.panel-game-name {
  flex: 1;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
}

.panel-game-meta {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  font-family: 'Rajdhani', sans-serif;
  margin-top: 2px;
}

.panel-game-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.panel-game-action {
  font-size: 0.68rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
.panel-game-action:hover {
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 12px rgba(255,255,255,0.1);
}

/* Panel clear button */
.panel-clear-btn {
  margin: 8px 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
  border-radius: 10px;
  padding: 9px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  width: calc(100% - 24px);
  transition: background 0.2s, color 0.2s;
  text-align: center;
  flex-shrink: 0;
}
.panel-clear-btn:hover { background: rgba(255,50,50,0.1); color: rgba(255,100,100,0.8); border-color: rgba(255,50,50,0.2); }

/* Panel backdrop */
#dz-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1040;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
}
#dz-panel-backdrop.active { display: block; }

/* ══════════════════════════════════════════════════════════
   HUB HEADER (inside screen-hub) — matches reference design
   ══════════════════════════════════════════════════════════ */

/* #header is defined at the top of this file with slideDown animation.
   The .header-center, .sword, and #title shimmer are all defined there too.
   No overrides needed here — the reference design is fully restored. */

/* ── Adjust screen-hub top padding (no fixed navbar now, just floating hamburger) ── */
#screen-hub {
  padding-top: 72px !important;
}

/* On mobile, reduce top padding so more game cards are visible 
   in the first fold without scrolling */
@media (max-width: 720px) {
  #screen-hub {
    padding-top: 60px !important;
  }
}
@media (max-width: 480px) {
  #screen-hub {
    padding-top: 52px !important;
  }
}

/* ══════════════════════════════════════════════════════════
   GAME CARD SAVE BUTTON
   ══════════════════════════════════════════════════════════ */
.card-save-btn {
  position: absolute;
  top: auto;
  bottom: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.22s ease;
  z-index: 10;
}

.card-save-btn svg {
  width: 15px;
  height: 15px;
}

.card-save-btn:hover {
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.25);
}

.card-save-btn.saved {
  background: rgba(0,229,255,0.12);
  border-color: rgba(0,229,255,0.4);
  color: #00e5ff;
}

.card-save-btn.saved svg {
  fill: #00e5ff;
}

/* ══════════════════════════════════════════════════════════
   PROFESSIONAL FOOTER (home only)
   ══════════════════════════════════════════════════════════ */
#footer {
  width: 100%;
  max-width: 1100px;
  background: rgba(13, 15, 28, 0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  overflow: hidden;
  margin-top: 12px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 32px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-logo-dz {
  height: 40px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0,229,255,0.2));
}

.footer-brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-copyright {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.04em;
}

.footer-vgwa-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.05em;
}

.footer-logo-vgwa {
  height: 20px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(170,0,255,0.25));
}

.footer-vgwa-tag strong {
  color: rgba(255,255,255,0.55);
  font-weight: 700;
}

.footer-tagline {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.2s;
  padding: 2px 4px;
}

.footer-link:hover { color: rgba(255,255,255,0.75); }

.footer-divider {
  color: rgba(255,255,255,0.1);
  font-size: 0.75rem;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════
   LEGAL MODALS — animated open/close, no blur bug
   ══════════════════════════════════════════════════════════ */

/* Backdrop: always in DOM, transitions in/out */
#dz-legal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
#dz-legal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal wrapper: always in DOM, invisible by default */
.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.legal-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Inner card slides up on open, slides down on close */
.legal-modal-inner {
  position: relative;
  z-index: 2010;
  background: #0d0f1c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: 0 40px 80px rgba(0,0,0,0.65);
  overflow: hidden;
  transform: translateY(36px) scale(0.96);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1), opacity 0.4s ease;
}
.legal-modal.active .legal-modal-inner {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.legal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.legal-modal-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.06em;
}

.legal-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.modal-close-btn svg { width: 16px; height: 16px; }

.legal-content {
  padding: 28px 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.legal-content h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #00e5ff;
  letter-spacing: 0.05em;
}

.legal-content h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
}

.legal-content p {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
}

.legal-date {
  font-size: 0.78rem !important;
  color: rgba(255,255,255,0.3) !important;
  font-style: italic;
}

.legal-link {
  color: #00e5ff;
  text-decoration: none;
  transition: opacity 0.2s;
}

.legal-link:hover { opacity: 0.75; text-decoration: underline; }

/* About VGWA block */
.about-vgwa-block {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(170,0,255,0.2);
  border-radius: 14px;
  padding: 18px;
}

.legal-vgwa-logo {
  height: 50px;
  width: auto;
  flex-shrink: 0;
}

/* Contact cards */
.contact-header-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
}

.contact-logo {
  height: 46px;
  width: auto;
  object-fit: contain;
}

.contact-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.2s, background 0.2s;
}

.contact-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(0,229,255,0.2);
}

.contact-card svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: rgba(0,229,255,0.7);
}

.contact-card div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-card strong {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.03em;
}

.contact-card a {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .nav-logo-dz  { height: 30px; }
  .nav-logo-vgwa { height: 26px; }
  .dz-side-panel {
    width: 100% !important;
    max-width: 400px;
    left: 0;
    right: 0;
    margin: 0 auto;
  }
  
  .contact-cards { grid-template-columns: 1fr; }
  .footer-brand { flex-direction: column; text-align: center; }
  .footer-inner { padding: 20px 16px; }
}


/* ══════════════════════════════════════════════════════════
   GAME LOADING OVERLAY  (added fix)
   ══════════════════════════════════════════════════════════ */
.dz-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #07080f;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.dz-loading-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.dz-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.dz-loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dz-spin-ring {
  position: absolute;
  border-radius: 50%;
  border-style: solid;
  border-color: transparent;
  animation: dzSpin 1.2s linear infinite;
}
.dz-spin-ring--1 { width:80px; height:80px; border-top-color:#00e5ff; border-width:3px; animation-duration:1.1s; }
.dz-spin-ring--2 { width:60px; height:60px; border-top-color:#b06aff; border-width:2.5px; animation-duration:0.85s; animation-direction:reverse; }
.dz-spin-ring--3 { width:40px; height:40px; border-top-color:#f50057; border-width:2px; animation-duration:1.4s; }
@keyframes dzSpin { to { transform: rotate(360deg); } }
.dz-spin-icon {
  font-size: 1.5rem;
  animation: dzPulseIcon 1.4s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
@keyframes dzPulseIcon { 0%,100%{transform:scale(1);opacity:1;} 50%{transform:scale(1.15);opacity:.8;} }
.dz-loading-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.4rem);
  letter-spacing: 0.12em;
  background: linear-gradient(90deg, #00e5ff, #b06aff, #f50057);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s linear infinite;
}
.dz-loading-bar-wrap {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.dz-loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg,#00e5ff,#b06aff,#f50057);
  border-radius: 4px;
  transition: width 0.08s linear;
}
.dz-loading-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: dzFadePulse 1.6s ease-in-out infinite;
}
@keyframes dzFadePulse { 0%,100%{opacity:.4;} 50%{opacity:.9;} }

/* ── Card save button (added fix) ── */
.card-save-btn {
  position: absolute;
  top: auto;
  bottom: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
  color: rgba(255,255,255,0.35);
  padding: 0;
}
.card-save-btn svg { width:14px; height:14px; transition: all 0.2s; }
.card-save-btn:hover { background:rgba(0,0,0,.65); color:rgba(255,255,255,.75); border-color:rgba(255,255,255,.3); }
.card-save-btn.saved { color:#f50057; border-color:rgba(245,0,87,.5); background:rgba(245,0,87,.1); }
.card-save-btn.saved svg { fill:#f50057; }

/* ══════════════════════════════════════════════════════════
   REDESIGNED HAMBURGER MENU  (v2)
   ══════════════════════════════════════════════════════════ */

/* ── Trigger button ── */
.hamburger-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  width: 46px;
  height: 46px;
  background: rgba(7,8,15,0.85);
  border: 1.5px solid rgba(0,229,255,0.18);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 0 0 rgba(0,229,255,0), 0 6px 28px rgba(0,0,0,0.55);
  transition: border-color 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
  overflow: visible;
}
.hamburger-btn:hover {
  border-color: rgba(0,229,255,0.45);
  box-shadow: 0 0 18px rgba(0,229,255,0.18), 0 6px 28px rgba(0,0,0,0.55);
  background: rgba(0,229,255,0.07);
}
.hamburger-btn.open {
  border-color: rgba(0,229,255,0.6);
  box-shadow: 0 0 28px rgba(0,229,255,0.28), 0 6px 28px rgba(0,0,0,0.55);
  background: rgba(0,229,255,0.10);
}

/* Pulsing glow ring (shows when open) */
.ham-glow-ring {
  position: absolute;
  inset: -5px;
  border-radius: 18px;
  border: 1.5px solid rgba(0,229,255,0.22);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
  animation: hamRingPulse 2s ease-in-out infinite;
}
.hamburger-btn.open .ham-glow-ring { opacity: 1; }
@keyframes hamRingPulse {
  0%,100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.06); opacity: 0.12; }
}

.ham-lines-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}
.ham-line {
  display: block;
  width: 20px;
  height: 2px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  transition: all 0.35s cubic-bezier(0.23,1,0.32,1);
  transform-origin: center;
}
.ham-line--mid { width: 14px; opacity: 0.55; }
.ham-line--bot { width: 17px; }

.hamburger-btn.open .ham-line         { background: #00e5ff; width: 20px; opacity: 1; }
.hamburger-btn.open .ham-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open .ham-line--mid    { transform: scaleX(0); opacity: 0; }
.hamburger-btn.open .ham-line--bot    { transform: translateY(-7px) rotate(-45deg); }

/* Badge */
.hamburger-btn .nav-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: linear-gradient(135deg, #f50057, #aa00ff);
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #07080f;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(245,0,87,0.5);
}

/* ── Dropdown panel ── */

.dz-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}

/* Header strip */
.dd-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,229,255,0.04);
}
.dd-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #00e5ff, #aa00ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 0.65rem;
  color: #07080f;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(0,229,255,0.3);
}
.dd-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dd-header-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  color: #fff;
  letter-spacing: 0.1em;
  line-height: 1;
}
.dd-header-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.62rem;
  color: rgba(0,229,255,0.55);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dd-close-x {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.dd-close-x:hover { background: rgba(255,82,82,0.12); border-color: rgba(255,82,82,0.3); color: #ff5252; }
.dd-close-x svg { width: 13px; height: 13px; }

/* Groups */
.dd-group {
  padding: 10px 0 2px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dd-group:last-of-type { border-bottom: none; }
.dd-group-label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.18);
  text-transform: uppercase;
  padding: 0 18px 6px;
}

/* Nav items */
.dropdown-item.ddi-nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.72);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
  text-align: left;
  position: relative;
  border-radius: 0;
}
.ddi-nav:hover { background: rgba(255,255,255,0.06); color: #fff; }
.ddi-nav.active { background: rgba(0,229,255,0.07); }

/* Special highlight for Saved & Recent nav items */
#dd-saved-btn {
  background: linear-gradient(90deg, rgba(245,0,87,0.06) 0%, transparent 100%);
  border-left: 2px solid rgba(245,0,87,0.4);
}
#dd-saved-btn:hover {
  background: linear-gradient(90deg, rgba(245,0,87,0.14) 0%, rgba(245,0,87,0.02) 100%);
  color: #ff4488;
  border-left-color: #f50057;
}
#dd-recent-btn {
  background: linear-gradient(90deg, rgba(170,0,255,0.06) 0%, transparent 100%);
  border-left: 2px solid rgba(170,0,255,0.4);
}
#dd-recent-btn:hover {
  background: linear-gradient(90deg, rgba(170,0,255,0.14) 0%, rgba(170,0,255,0.02) 100%);
  color: #cc44ff;
  border-left-color: #aa00ff;
}
#dd-home-btn {
  border-left: 2px solid transparent;
}

/* Icon wraps */
.ddi-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: box-shadow 0.22s, transform 0.22s;
}
.ddi-icon-wrap svg { width: 16px; height: 16px; }
.ddi-nav:hover .ddi-icon-wrap { transform: scale(1.08); }
.ddi-cyan   { background: rgba(0,229,255,0.12);  color: #00e5ff; }
.ddi-pink   { background: rgba(245,0,87,0.12);   color: #f50057; }
.ddi-violet { background: rgba(170,0,255,0.12);  color: #aa00ff; }
.ddi-green  { background: rgba(0,230,118,0.12);  color: #00e676; }
.ddi-orange { background: rgba(255,109,0,0.12);  color: #ff6d00; }
.ddi-nav:hover .ddi-cyan   { box-shadow: 0 0 10px rgba(0,229,255,0.35); }
.ddi-nav:hover .ddi-pink   { box-shadow: 0 0 10px rgba(245,0,87,0.35); }
.ddi-nav:hover .ddi-violet { box-shadow: 0 0 10px rgba(170,0,255,0.35); }
.ddi-nav:hover .ddi-green  { box-shadow: 0 0 10px rgba(0,230,118,0.35); }

.ddi-label { flex: 1; }
.ddi-arrow {
  color: rgba(255,255,255,0.2);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s, color 0.2s;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ddi-nav:hover .ddi-arrow { transform: translateX(4px); color: rgba(255,255,255,0.55); }

/* dd-badge */
.dd-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #f50057, #aa00ff);
  color: #fff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(245,0,87,0.4);
}

/* Music toggle pill */
.dd-music-toggle {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1.5px solid rgba(0,230,118,0.5);
  color: #00e676;
  background: rgba(0,230,118,0.08);
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.dd-music-toggle.off {
  border-color: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.28);
  background: transparent;
}
#dd-music-btn.muted .ddi-icon-wrap { opacity: 0.4; }

/* Legal grid pills */
.dd-group--legal { padding-bottom: 8px; }
.dd-legal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px 14px 8px;
}
.ddi-legal-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  cursor: pointer;
  color: rgba(255,255,255,0.45);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.18s ease;
}
.ddi-legal-pill svg { width: 16px; height: 16px; opacity: 0.55; transition: opacity 0.18s; }
.ddi-legal-pill:hover {
  background: rgba(0,229,255,0.07);
  border-color: rgba(0,229,255,0.2);
  color: rgba(0,229,255,0.85);
  transform: translateY(-1px);
}
.ddi-legal-pill:hover svg { opacity: 1; }

/* Footer strip */
.dd-footer {
  padding: 10px 18px 12px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.dd-footer-copy {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.06em;
}

/* Backdrop */
#dz-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#dz-menu-backdrop.active { display: block; }

/* stagger item entrance animation */
.dz-dropdown.open .dropdown-item.ddi-nav,
.dz-dropdown.open .ddi-legal-pill {
  animation: ddItemIn 0.32s cubic-bezier(0.23,1,0.32,1) both;
}
.dz-dropdown.open .dd-group:nth-child(2) .ddi-nav:nth-child(2) { animation-delay: 0.04s; }
.dz-dropdown.open .dd-group:nth-child(2) .ddi-nav:nth-child(3) { animation-delay: 0.08s; }
.dz-dropdown.open .dd-group:nth-child(2) .ddi-nav:nth-child(4) { animation-delay: 0.12s; }
.dz-dropdown.open .dd-group:nth-child(3) .ddi-nav:nth-child(2) { animation-delay: 0.16s; }
.dz-dropdown.open .dd-group:nth-child(4) .ddi-legal-pill:nth-child(1) { animation-delay: 0.20s; }
.dz-dropdown.open .dd-group:nth-child(4) .ddi-legal-pill:nth-child(2) { animation-delay: 0.24s; }
.dz-dropdown.open .dd-group:nth-child(4) .ddi-legal-pill:nth-child(3) { animation-delay: 0.28s; }
.dz-dropdown.open .dd-group:nth-child(4) .ddi-legal-pill:nth-child(4) { animation-delay: 0.32s; }
@keyframes ddItemIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}


/* ══════════════════════════════════════════════════════════
   REDESIGNED LEGAL MODALS  (v2)
   ══════════════════════════════════════════════════════════ */

/* Reset old legal modal styles */
.legal-modal, .legal-modal-inner, .legal-modal-header,
.legal-content, .modal-close-btn, .legal-logo { all: unset; }

/* Backdrop */
#dz-legal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
#dz-legal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal outer shell */
.lm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.lm-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Two-panel shell */
.lm-shell {
  display: flex;
  width: 100%;
  max-width: 820px;
  max-height: calc(100vh - 32px);
  background: #08090f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.04) inset;
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.23,1,0.32,1), opacity 0.4s ease;
}
.lm-modal.active .lm-shell {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ── Sidebar ── */
.lm-sidebar {
  width: 190px;
  flex-shrink: 0;
  background: rgba(4,5,10,0.9);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 28px 0 20px;
  overflow-y: auto;
}
.lm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 20px 22px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.lm-sb-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lm-sb-dot--about   { background: #00e5ff; box-shadow: 0 0 8px #00e5ff; }
.lm-sb-dot--privacy { background: #00e676; box-shadow: 0 0 8px #00e676; }
.lm-sb-dot--terms   { background: #aa00ff; box-shadow: 0 0 8px #aa00ff; }
.lm-sb-dot--contact { background: #f50057; box-shadow: 0 0 8px #f50057; }

.lm-nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}
.lm-nav-link {
  display: block;
  padding: 8px 20px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.38);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.18s, background 0.18s, padding-left 0.18s;
  border-left: 2px solid transparent;
  cursor: pointer;
}
.lm-nav-link:hover { color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.03); padding-left: 24px; }
.lm-nav-link--active { color: rgba(255,255,255,0.85) !important; border-left-color: #00e5ff; background: rgba(0,229,255,0.05) !important; padding-left: 22px; }

.lm-sidebar-other { margin-top: auto; padding: 16px 14px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.lm-sidebar-other-label {
  display: block;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.46rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.15);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.lm-sidebar-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255,255,255,0.28);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 6px;
  text-align: left;
  border-radius: 6px;
  letter-spacing: 0.03em;
  transition: color 0.18s, background 0.18s;
}
.lm-sidebar-link:hover { color: rgba(0,229,255,0.8); background: rgba(0,229,255,0.06); }

/* ── Body ── */
.lm-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Top bar */
.lm-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  background: rgba(255,255,255,0.015);
}
.lm-topbar-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lm-topbar-icon svg { width: 20px; height: 20px; }
.lm-icon--about   { background: rgba(0,229,255,0.1);  color: #00e5ff; box-shadow: 0 0 20px rgba(0,229,255,0.2); }
.lm-icon--privacy { background: rgba(0,230,118,0.1);  color: #00e676; box-shadow: 0 0 20px rgba(0,230,118,0.2); }
.lm-icon--terms   { background: rgba(170,0,255,0.1);  color: #aa00ff; box-shadow: 0 0 20px rgba(170,0,255,0.2); }
.lm-icon--contact { background: rgba(245,0,87,0.1);   color: #f50057; box-shadow: 0 0 20px rgba(245,0,87,0.2); }

.lm-page-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(0.9rem,2vw,1.15rem);
  color: #fff;
  letter-spacing: 0.06em;
  margin: 0 0 2px;
  line-height: 1.1;
}
.lm-page-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.06em;
  margin: 0;
}
.lm-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.lm-close:hover { background: rgba(255,82,82,0.12); border-color: rgba(255,82,82,0.3); color: #ff5252; transform: rotate(90deg); }
.lm-close svg { width: 14px; height: 14px; }

/* Scroll content area */
.lm-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
.lm-content::-webkit-scrollbar { width: 4px; }
.lm-content::-webkit-scrollbar-track { background: transparent; }
.lm-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Hero card */
.lm-hero-card {
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 6px;
  border: 1px solid;
}
.lm-hero--about { background: rgba(0,229,255,0.05); border-color: rgba(0,229,255,0.15); }
.lm-hero-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.65);
  margin-bottom: 16px;
}
.lm-hero-stat-row {
  display: flex;
  gap: 24px;
}
.lm-stat { display: flex; flex-direction: column; gap: 2px; }
.lm-stat-num {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: #00e5ff;
  line-height: 1;
}
.lm-stat-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Highlight bar */
.lm-highlight-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid;
}
.lm-highlight-bar svg { width: 18px; height: 18px; flex-shrink: 0; }
.lm-highlight--green  { background: rgba(0,230,118,0.07);  border-color: rgba(0,230,118,0.22);  color: rgba(0,230,118,0.9); }
.lm-highlight--blue   { background: rgba(0,229,255,0.07);  border-color: rgba(0,229,255,0.22);  color: rgba(0,229,255,0.9); }
.lm-highlight--pink   { background: rgba(245,0,87,0.07);   border-color: rgba(245,0,87,0.22);   color: rgba(245,0,87,0.9); }

/* Section rows */
.lm-section {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  align-items: flex-start;
}
.lm-section:last-of-type { border-bottom: none; }

.lm-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.lm-section-icon svg { width: 16px; height: 16px; }
.lm-si--cyan   { background: rgba(0,229,255,0.1);  color: #00e5ff; }
.lm-si--violet { background: rgba(170,0,255,0.1);  color: #aa00ff; }
.lm-si--pink   { background: rgba(245,0,87,0.1);   color: #f50057; }
.lm-si--orange { background: rgba(255,109,0,0.1);  color: #ff6d00; }
.lm-si--green  { background: rgba(0,230,118,0.1);  color: #00e676; }

.lm-section-body { flex: 1; }
.lm-section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
  margin: 0 0 6px;
}
.lm-section-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.55);
  margin: 0;
}
.lm-link { color: #00e5ff; text-decoration: none; transition: opacity 0.2s; }
.lm-link:hover { opacity: 0.75; text-decoration: underline; }

.lm-cta-btn {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  background: rgba(0,229,255,0.1);
  border: 1px solid rgba(0,229,255,0.3);
  border-radius: 8px;
  color: #00e5ff;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
}
.lm-cta-btn:hover { background: rgba(0,229,255,0.18); border-color: rgba(0,229,255,0.55); transform: translateX(2px); }

/* VGWA card */
.lm-vgwa-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  background: rgba(170,0,255,0.06);
  border: 1px solid rgba(170,0,255,0.18);
  border-radius: 16px;
  margin: 4px 0;
}
.lm-vgwa-logo-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(170,0,255,0.1);
  border: 1px solid rgba(170,0,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.lm-vgwa-img { height: 38px; width: auto; object-fit: contain; }
.lm-vgwa-name {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: rgba(170,0,255,0.9);
  letter-spacing: 0.06em;
  margin: 0 0 5px;
}
.lm-vgwa-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

/* Contact grid */
.lm-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0;
}
.lm-contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s ease;
}
.lm-cc-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lm-cc-icon svg { width: 15px; height: 15px; }
.lm-cc-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lm-cc-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.lm-cc-val {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lm-cc-arrow { font-size: 1rem; opacity: 0.3; transition: all 0.2s; flex-shrink: 0; }
.lm-contact-card:hover .lm-cc-arrow { opacity: 0.8; transform: translateX(3px); }

.lm-cc--cyan   { background: rgba(0,229,255,0.04);  border-color: rgba(0,229,255,0.14);  color: rgba(0,229,255,0.75); }
.lm-cc--violet { background: rgba(170,0,255,0.04);  border-color: rgba(170,0,255,0.14);  color: rgba(170,0,255,0.75); }
.lm-cc--green  { background: rgba(0,230,118,0.04);  border-color: rgba(0,230,118,0.14);  color: rgba(0,230,118,0.75); }
.lm-cc--pink   { background: rgba(245,0,87,0.04);   border-color: rgba(245,0,87,0.14);   color: rgba(245,0,87,0.75); }
.lm-cc--cyan:hover   { background: rgba(0,229,255,0.09);  border-color: rgba(0,229,255,0.3); }
.lm-cc--violet:hover { background: rgba(170,0,255,0.09);  border-color: rgba(170,0,255,0.3); }
.lm-cc--green:hover  { background: rgba(0,230,118,0.09);  border-color: rgba(0,230,118,0.3); }
.lm-cc--pink:hover   { background: rgba(245,0,87,0.09);   border-color: rgba(245,0,87,0.3); }
.lm-cc-icon { background: currentColor; color: inherit; }
.lm-cc--cyan   .lm-cc-icon { background: rgba(0,229,255,0.1);  color: #00e5ff; }
.lm-cc--violet .lm-cc-icon { background: rgba(170,0,255,0.1);  color: #aa00ff; }
.lm-cc--green  .lm-cc-icon { background: rgba(0,230,118,0.1);  color: #00e676; }
.lm-cc--pink   .lm-cc-icon { background: rgba(245,0,87,0.1);   color: #f50057; }

/* Logo footer row */
.lm-logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 8px;
}
.lm-logos-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.1); }
.lm-footer-logo { height: 32px; width: auto; object-fit: contain; opacity: 0.65; transition: opacity 0.2s; }
.lm-footer-logo:hover { opacity: 1; }

/* Responsive */
@media (max-width: 640px) {
  .lm-sidebar { display: none; }
  .lm-shell { max-height: 95vh; border-radius: 20px; }
  .lm-contact-grid { grid-template-columns: 1fr; }
  
}

/* ══════════════════════════════════════════════════════════
   OPENING SPLASH ANIMATION
   ══════════════════════════════════════════════════════════ */

.dz-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #030408;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.65s cubic-bezier(0.4,0,0.2,1), transform 0.65s cubic-bezier(0.4,0,0.2,1);
}
.dz-splash--exit {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}
.dz-splash--gone {
  display: none !important;
}

/* Particle canvas */
.dz-splash-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Concentric pulsing rings */
.dz-splash-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.dz-splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid;
  animation: splashRingPulse 3s ease-in-out infinite;
}
.dz-splash-ring--1 {
  width: 260px; height: 260px;
  border-color: rgba(0,229,255,0.18);
  animation-delay: 0s;
}
.dz-splash-ring--2 {
  width: 400px; height: 400px;
  border-color: rgba(170,0,255,0.12);
  animation-delay: 0.5s;
}
.dz-splash-ring--3 {
  width: 560px; height: 560px;
  border-color: rgba(245,0,87,0.07);
  animation-delay: 1s;
}
@keyframes splashRingPulse {
  0%,100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.07); opacity: 0.4; }
}

/* Center content block */
.dz-splash-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Logo */
.dz-splash-logo-wrap {
  position: relative;
  margin-bottom: 24px;
  animation: splashLogoIn 0.5s cubic-bezier(0.23,1,0.32,1) 0.05s both;
}
.dz-splash-logo {
  height: 90px;
  width: auto;
  filter: drop-shadow(0 0 30px rgba(0,229,255,0.6)) drop-shadow(0 0 60px rgba(170,0,255,0.35));
  animation: splashLogoFloat 4s ease-in-out infinite;
}
.dz-splash-logo-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(0,229,255,0.18) 0%, transparent 70%);
  border-radius: 50%;
  animation: splashGlowPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.6) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes splashLogoFloat {
  0%,100% { transform: translateY(0px); }
  50%     { transform: translateY(-8px); }
}
@keyframes splashGlowPulse {
  0%,100% { opacity: 0.6; transform: scale(1); }
  50%     { opacity: 1;   transform: scale(1.2); }
}

/* Wordmark — letter by letter */
.dz-splash-wordmark {
  display: flex;
  gap: 3px;
  margin-bottom: 10px;
}
.dz-splash-char {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: 1;
  background: linear-gradient(135deg, #00e5ff 0%, #aa00ff 50%, #f50057 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  transform: translateY(30px) rotateX(-40deg);
  animation: splashCharIn 0.4s cubic-bezier(0.23,1,0.32,1) calc(0.15s + var(--i) * 0.05s) both;
  text-shadow: none;
  filter: drop-shadow(0 0 10px rgba(0,229,255,0.5));
}
.dz-splash-char--gap {
  margin-left: 14px;
}
@keyframes splashCharIn {
  from { opacity: 0; transform: translateY(30px) rotateX(-40deg); }
  to   { opacity: 1; transform: translateY(0) rotateX(0); }
}

/* Tagline */
.dz-splash-tagline {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  letter-spacing: 0.35em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  margin-bottom: 36px;
  opacity: 0;
  animation: splashFadeUp 0.4s ease 0.6s both;
}

/* Progress bar */
.dz-splash-bar-wrap {
  width: min(320px, 70vw);
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
  opacity: 0;
  animation: splashFadeUp 0.4s ease 0.65s both;
}
.dz-splash-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e5ff, #aa00ff, #f50057);
  border-radius: 3px;
  transition: width 0.18s ease;
  box-shadow: 0 0 12px rgba(0,229,255,0.7);
}

/* Loading text */
.dz-splash-loading-txt {
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: rgba(0,229,255,0.5);
  text-transform: uppercase;
  opacity: 0;
  animation: splashFadeUp 0.4s ease 0.7s both;
}

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

/* ── Additional legal styles ── */
.lm-tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.lm-tag {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
  text-transform: uppercase;
}
.lm-tag--cyan   { background: rgba(0,229,255,0.08);  border-color: rgba(0,229,255,0.3);  color: #00e5ff; }
.lm-tag--violet { background: rgba(170,0,255,0.08);  border-color: rgba(170,0,255,0.3);  color: #aa00ff; }
.lm-tag--green  { background: rgba(0,230,118,0.08);  border-color: rgba(0,230,118,0.3);  color: #00e676; }
.lm-tag--pink   { background: rgba(245,0,87,0.08);   border-color: rgba(245,0,87,0.3);   color: #f50057; }
.lm-tag--orange { background: rgba(255,109,0,0.08);  border-color: rgba(255,109,0,0.3);  color: #ff6d00; }

.lm-info-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.lm-info-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 8px 12px;
}
.lm-info-key {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(0,229,255,0.7);
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 2px;
  min-width: 80px;
}
.lm-info-val {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.85rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.5);
}

/* Contact primary card */
.lm-contact-grid--wide { grid-template-columns: 1fr; }
.lm-cc--primary {
  grid-column: 1 / -1;
  border-width: 1.5px !important;
  padding: 16px 18px !important;
  position: relative;
}
.lm-cc--primary .lm-cc-icon { width: 40px !important; height: 40px !important; }
.lm-cc--primary .lm-cc-val {
  font-size: 0.88rem !important;
  color: #00e5ff !important;
  font-weight: 600;
}
.lm-cc-primary-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(0,229,255,0.15);
  border: 1px solid rgba(0,229,255,0.4);
  color: #00e5ff;
  flex-shrink: 0;
}
/* make secondary cards 2-col again below primary */
.lm-contact-grid--wide a:not(.lm-cc--primary) {
  display: flex;
}
@media (min-width: 400px) {
  .lm-contact-grid--wide {
    grid-template-columns: 1fr 1fr;
  }
  .lm-cc--primary {
    grid-column: 1 / -1;
  }
}


/* ══════════════════════════════════════════════════════
   MOBILE COMPATIBILITY — Comprehensive fixes
   ══════════════════════════════════════════════════════ */

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Prevent text-size inflation on rotate */
* { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* ─── All game screens: proper mobile containment ─── */
[id^="screen-"] {
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ─── Game home panels ─── */
.game-home-panel {
  padding: clamp(48px, 8vw, 64px) clamp(14px, 4vw, 24px) clamp(32px, 6vw, 48px);
}

.ghp-wrap {
  width: 100%;
  max-width: 480px;
}

/* ─── Buttons: large tap targets on mobile ─── */
button {
  min-height: 36px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ghp-start-btn {
  width: 100%;
  min-height: 52px;
  font-size: clamp(0.85rem, 3.5vw, 1rem);
}

.ghp-pill {
  min-height: 40px;
  padding: 8px 16px;
  font-size: clamp(0.75rem, 3vw, 0.9rem);
}

.diff-btn {
  min-height: 38px;
  padding: 7px 12px;
}

/* ─── Arena hub grid — always 2 columns ─── */
#arena-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(10px, 2.5vw, 20px);
}

@media (max-width: 400px) {
  #arena-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* ─── Top bar ─── */
.dz-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(7, 8, 15, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  gap: 8px;
  flex-shrink: 0;
}

/*
 * FIX: position:sticky inside overflow:hidden breaks in all browsers.
 * The play panels for Sudoku, Ludo and Carrom use overflow:hidden,
 * which prevents the sticky topbar from anchoring correctly and
 * causes game content to be pushed off-screen to the bottom.
 * Fix: make the topbar position:relative (normal flow) inside those panels.
 */
#sdk-play  .dz-topbar,
#ludo-play .dz-topbar,
#carrom-play .dz-topbar {
  position: relative;
  top: auto;
}

/*
 * Also ensure the play panels themselves have a proper height so
 * flex:1 children correctly fill the remaining space.
 * Using height + min-height gives us a defined height for flex children.
 * The !important is needed to override inline min-height:100vh on these divs.
 */
#sdk-play,
#ludo-play,
#carrom-play {
  height: 100dvh !important;
  min-height: unset !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

/* Ensure the inner scrollable containers fill remaining flex space */
#sdk-app,
#ludo-app {
  flex: 1;
  min-height: 0;    /* critical: lets flexbox shrink below content size */
}

/* ─── Canvas games: always responsive ─── */
canvas {
  max-width: 100% !important;
  height: auto;
  display: block;
  touch-action: none;
  /* Promote canvas to its own GPU compositor layer so RAF drawing
     doesn't trigger a full-page repaint on every frame. */
  will-change: transform;
}

/* ─── Darts board: responsive sizing ─── */
#darts-board {
  width: min(400px, 92vw) !important;
  height: min(400px, 92vw) !important;
}

/* ─── Ping Pong ─── */
#pp-canvas {
  width: 100% !important;
  height: auto !important;
}

/* ─── Tetris ─── */
#tetris-canvas-p1,
#tetris-canvas-p2 {
  max-width: 100% !important;
  height: auto !important;
}

/* ─── Air Hockey ─── */
#ah-canvas {
  width: min(480px, 96vw) !important;
  height: auto !important;
}

/* ─── Carrom ─── */
#carrom-canvas {
  width: min(480px, 96vw) !important;
  height: min(480px, 96vw) !important;
}

/* ─── Fullscreen toggle btn ─── */
.dz-fs-btn {
  font-size: 0.75rem;
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Legal modals — mobile ─── */
@media (max-width: 640px) {
  .lm-modal {
    flex-direction: column;
  }
  .lm-sidebar {
    width: 100% !important;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    gap: 6px;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .lm-sidebar-nav {
    display: none;
  }
  .lm-body {
    padding: 20px 16px;
  }
}

/* ─── Hamburger/dropdown ─── */
@media (max-width: 420px) {
  
}

/* ─── Hub title ─── */
@media (max-width: 360px) {
  #title {
    font-size: clamp(1.8rem, 9vw, 2.8rem);
  }
  .arena-card .card-inner {
    padding: 16px 14px 14px;
  }
  .card-game-name {
    font-size: 0.78rem;
  }
}

/* ─── Side panels ─── */
.dz-side-panel {
  max-width: min(340px, 100vw);
}

/* ─── Cricket / long game screens ─── */
#cricket-app,
#cricket-setup:not(.hidden),
#cricket-game {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 0 12px;
}

/* ─── 2048 Duel ─── */
#d2048-play-panel,
#d2048-grid-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Password Breaker ─── */
#pb-play-panel {
  overflow-y: auto;
  padding: 0 12px;
}

/* ─── Memory Flip ─── */
#mfd-play .mfd-grid,
.mfd-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(72px, 18vw), 1fr));
  gap: 8px;
}

/* ─── Connect Dots ─── */
#cdd-play canvas,
#cdd-canvas {
  width: min(400px, 94vw) !important;
  height: min(400px, 94vw) !important;
}

/* ─── Splash — mobile safe area ─── */
.dz-splash {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ─── General scroll containers ─── */
.game-scroll-wrap,
[id$="-play"],
[id$="-play-panel"] {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 100dvh;
}

/* ─── Result overlays ─── */
[id$="-result"] .ghp-result-btn-primary,
[id$="-result"] .ghp-result-btn-secondary {
  min-height: 44px;
  font-size: clamp(0.8rem, 3.5vw, 0.95rem);
}


/* ════════════════════════════════════════════════════════════════
   UNIVERSAL MOBILE FIXES — all game screens
   ════════════════════════════════════════════════════════════════ */

/* Make every game screen fill the phone without overflow */
@media (max-width: 600px) {

  /* ── Panels: full-width slide-in on phone ── */
  .dz-side-panel {
    width: 100% !important;
    border-right: none;
    border-bottom: none;
  }

  /* Hamburger closer to edge on phone */
  .hamburger-btn {
    top: 12px !important;
    left: 12px !important;
  }

  /* ── All game screens: fill viewport, scrollable ── */
  [id^="screen-"]:not(#screen-hub) {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  /* ── Game Home panels (GHP) ── */
  .game-home-panel {
    padding: 16px 14px 32px !important;
  }
  .ghp-wrap {
    max-width: 100% !important;
    padding: 0 4px !important;
  }
  .ghp-title { font-size: clamp(1.4rem, 7vw, 2.2rem) !important; }
  .ghp-tagline { font-size: 0.8rem !important; }
  .ghp-icon-wrap { width: 60px !important; height: 60px !important; }
  .ghp-start-btn {
    width: 100% !important;
    padding: 14px !important;
    font-size: 0.85rem !important;
  }
  .ghp-rules-list li { font-size: 0.82rem !important; }
  .diff-btn { font-size: 0.72rem !important; padding: 7px 12px !important; }
  .ghp-setting-row { flex-wrap: wrap !important; gap: 8px !important; }

  /* ── Back buttons ── */
  .ghp-back-hub, .ghp-back-v2, .dz-back-btn {
    font-size: 0.75rem !important;
    padding: 8px 14px !important;
    top: 12px !important;
    left: 12px !important;
  }

  /* ── In-game canvases: scale to fit ── */
  canvas {
    max-width: 100% !important;
    height: auto !important;
    touch-action: none;
  }

  /* ── Score bars & headers inside games ── */
  .game-header, .score-bar, [class*="header"] {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ── Generic game containers ── */
  .game-container, .game-wrap, [class*="-container"], [class*="-wrap"] {
    padding: 8px !important;
    max-width: 100% !important;
  }

  /* ── Topbar (back+fullscreen row in game screens) ── */
  .dz-topbar {
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  .dz-fs-btn {
    font-size: 0.7rem !important;
    padding: 6px 10px !important;
  }

  /* ── Dropdown: slightly wider on phone ── */
  
}

/* ── Extra-small phones ── */
@media (max-width: 380px) {
  .ddi-nav { padding: 9px 12px 9px 10px !important; font-size: 0.82rem !important; }
  .ddi-icon-wrap { width: 28px !important; height: 28px !important; }
  .panel-header { padding: 18px 14px 14px !important; }
  .panel-game-item { padding: 10px 12px !important; }
  .panel-game-name { font-size: 0.83rem !important; }
  .panel-game-action { padding: 4px 9px !important; font-size: 0.6rem !important; }
}

/* Label wrap for two-line nav items */
.ddi-label-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ddi-label-wrap .ddi-label { line-height: 1.1; }
.ddi-sub {
  font-size: 0.62rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 400;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Special (Saved / Recent) nav items: taller, boxed feel */
.ddi-nav--special {
  padding: 11px 16px 11px 14px !important;
  margin: 2px 8px;
  border-radius: 12px !important;
  border-left: none !important;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s !important;
}
#dd-saved-btn.ddi-nav--special {
  background: linear-gradient(100deg, rgba(245,0,87,0.09) 0%, rgba(245,0,87,0.03) 100%) !important;
  border: 1px solid rgba(245,0,87,0.2) !important;
}
#dd-saved-btn.ddi-nav--special:hover {
  background: linear-gradient(100deg, rgba(245,0,87,0.18) 0%, rgba(245,0,87,0.06) 100%) !important;
  border-color: rgba(245,0,87,0.45) !important;
  box-shadow: 0 4px 20px rgba(245,0,87,0.15) !important;
  transform: translateY(-1px) !important;
  color: #ff4d8b !important;
}
#dd-recent-btn.ddi-nav--special {
  background: linear-gradient(100deg, rgba(170,0,255,0.09) 0%, rgba(170,0,255,0.03) 100%) !important;
  border: 1px solid rgba(170,0,255,0.2) !important;
}
#dd-recent-btn.ddi-nav--special:hover {
  background: linear-gradient(100deg, rgba(170,0,255,0.18) 0%, rgba(170,0,255,0.06) 100%) !important;
  border-color: rgba(170,0,255,0.45) !important;
  box-shadow: 0 4px 20px rgba(170,0,255,0.15) !important;
  transform: translateY(-1px) !important;
  color: #cc55ff !important;
}



/* ╔══════════════════════════════════════════════════════════════════╗
   ║  LANDSCAPE PHONE — Horizontal Screen Game Fixes                  ║
   ║  Targets: Tanks · SpaceDodge · StarCatcher · Bomberman ·         ║
   ║           Tetris · PingPong                                       ║
   ║  Trigger: orientation:landscape AND max-height:520px             ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* ── Base landscape reset for all canvas-heavy game screens ── */
@media screen and (orientation: landscape) and (max-height: 520px) {

  /* NOTE: screen-* selectors removed from this group — they were causing
     #screen-tetris etc. to inherit display:flex and appear below the hub.
     Game screens are now hidden in landscape via the rules at end of file. */

  /* ── Play panels: column layout fills full height ── */
  #tanks-play-panel,
  #sd-play-panel,
  #sc-play-panel,
  #bm-play,
  #pp-wrap {
    display: flex !important;
    flex-direction: column;
  }

  /* tetris-play landscape auto-show rule REMOVED — it caused Tetris to appear
     randomly during other games whenever tetris-play lacked the .hidden class.
     Tetris layout in landscape is now handled only when explicitly active. */

  /* ── HUD bars: ultra-compact single row ── */
  #tanks-hud, #sd-hud, #sc-hud {
    width: 100% !important;
    min-height: 40px !important;
    max-height: 44px !important;
    padding: 3px 8px !important;
    flex-shrink: 0 !important;
    overflow: hidden;
  }

  /* ── HUD text: smaller to fit ── */
  #tanks-hud span, #sd-hud span, #sc-hud span {
    font-size: 12px !important;
  }
  #sc-timer { font-size: 18px !important; }
  #sd-timer { font-size: 16px !important; }
  #sc-p1-score, #sc-p2-score { font-size: 18px !important; }

  /* HP bars: shorter width to save space */
  #tanks-p1-hud [style*="width:100px"],
  #tanks-p2-hud [style*="width:100px"],
  #sd-p1-hp-bar, #sd-p2-hp-bar {
    width: 55px !important;
    height: 8px !important;
  }

  /* ── Topbar inside HUD: tiny ── */
  .dz-topbar {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    gap: 6px !important;
  }
  .dz-topbar button,
  .ghp-back-game {
    font-size: 0.68rem !important;
    padding: 4px 8px !important;
    min-height: 30px !important;
  }
  .dz-fs-btn {
    font-size: 0.68rem !important;
    padding: 4px 7px !important;
    min-height: 30px !important;
    min-width: 34px !important;
  }

  /* ── Canvases: take remaining flex space, never exceed viewport ── */
  #tanks-canvas, #sd-canvas, #sc-canvas, #bm-canvas, #pp-canvas {
    flex-shrink: 1 !important;
    max-height: calc(100dvh - 44px - 108px) !important;
    max-width: 100% !important;
    object-fit: contain;
    display: block !important;
    margin: 0 auto !important;
  }

  /* PingPong canvas: fills the canvas-wrap which itself fills space */
  #pp-canvas {
    max-height: calc(100dvh - 80px) !important;
    width: auto !important;
    height: auto !important;
  }
  #pp-canvas-wrap {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    width: 100% !important;
    padding: 0 !important;
    border-radius: 6px !important;
  }
  #pp-header {
    padding: 4px 10px !important;
    min-height: 40px !important;
  }
  #pp-score-row {
    padding: 2px 10px 4px !important;
  }
  .pp-sval { font-size: 22px !important; }
  #pp-hint-bar { display: none !important; }

  /* ── Mobile controls: ultra-compact strip at bottom ── */
  #tanks-mobile-controls {
    flex-shrink: 0 !important;
    padding: 3px 6px !important;
    max-height: 108px !important;
    overflow: hidden;
    width: 100% !important;
  }
  #bm-mobile-controls {
    flex-shrink: 0 !important;
    padding: 2px 4px !important;
    max-height: 108px !important;
    width: 100% !important;
  }

  /* Bomberman canvas wrapper */
  #bm-play > div:first-child { /* score row */
    padding: 2px 8px !important;
    margin-bottom: 2px !important;
    font-size: 0.78rem !important;
    gap: 16px !important;
  }
  #bm-canvas {
    flex-shrink: 1 !important;
    max-height: calc(100dvh - 42px - 112px) !important;
    max-width: 100% !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* Tetris: each player panel more compact */
  #tetris-player-1, #tetris-player-2,
  #tetris-play > div {
    gap: 3px !important;
  }
  #tetris-canvas-p1, #tetris-canvas-p2 {
    max-height: calc(100dvh - 56px) !important;
    max-width: 48vw !important;
    display: block !important;
  }
  #tetris-next-p1, #tetris-next-p2 {
    width: 60px !important;
    height: 60px !important;
  }
  .dz-topbar button#tetris-back-play,
  .dz-topbar .dz-fs-btn { margin-bottom: 0 !important; }

  /* Hide hint texts to save space */
  #tanks-play-panel > div:last-of-type,
  #sd-play-panel > div:last-of-type,
  #sc-play-panel > div:last-of-type,
  #bm-play > div:last-of-type {
    display: none !important;
  }
  #tetris-p2-keys { display: none !important; }

  /* Pause button in space dodge */
  #sd-pause-btn {
    font-size: 0.65rem !important;
    padding: 2px 7px !important;
  }
}

/* ── Very short landscape (≤400px height, e.g. iPhone SE landscape) ── */
@media screen and (orientation: landscape) and (max-height: 400px) {

  #tanks-canvas, #sd-canvas, #sc-canvas, #bm-canvas, #pp-canvas {
    max-height: calc(100dvh - 40px - 96px) !important;
  }
  #bm-canvas {
    max-height: calc(100dvh - 38px - 100px) !important;
  }
  #tanks-mobile-controls, #bm-mobile-controls {
    max-height: 96px !important;
  }
  #tanks-hud, #sd-hud, #sc-hud {
    max-height: 38px !important;
    padding: 2px 6px !important;
  }
}

/* ── Portrait fixes for the same games (portrait-specific improvements) ── */
@media screen and (orientation: portrait) and (max-width: 480px) {

  /* Tetris portrait: boards side by side, smaller cells */
  #tetris-play {
    flex-direction: row !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding: 6px 4px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }
  #tetris-canvas-p1, #tetris-canvas-p2 {
    max-width: 44vw !important;
  }
  #tetris-next-p1, #tetris-next-p2 {
    width: 56px !important;
    height: 56px !important;
  }
  #tetris-p2-keys { font-size: 0.58rem !important; }

  /* Bomberman portrait: full-width centered */
  #bm-play {
    padding: 4px !important;
    align-items: center;
  }
  #bm-canvas {
    max-width: 100% !important;
    display: block;
    margin: 0 auto;
  }
  #bm-mobile-controls {
    width: 100%;
    display: flex;
    justify-content: space-around;
  }

  /* Tanks portrait: compact HUD */
  #tanks-hud { gap: 4px; flex-wrap: wrap; padding: 4px 6px !important; }
  #tanks-p1-hud [style*="width:100px"],
  #tanks-p2-hud [style*="width:100px"] { width: 60px !important; }
}

@media (min-width: 700px) {
}

/* ═══════════════════════════════════════════════════════════════════
   HUB BUTTON OVERLAP FIX
   The hamburger menu sits at position:fixed top:16px left:16px (44×44px).
   All "← Hub" back buttons were ALSO at top:16px left:16px, causing overlap.
   Fix: push every hub/back button to top:72px (below hamburger bottom + gap).
   The hamburger is NOT moved. Content padding is NOT changed.
   The buttons are position:absolute/fixed and out-of-flow — moving them
   does NOT require adjusting content padding at all.
   ═══════════════════════════════════════════════════════════════════ */

/* Override inline styles on battleship + checkers hub buttons
   (they use style="position:absolute;top:1rem;left:1rem" directly in HTML) */
#bs-hub-btn,
#ck-hub-btn {
  top: 72px !important;
  left: 16px !important;
}

/* All "← Hub" and "← Setup" back buttons: move below the hamburger */
.ghp-back-hub,
.ghp-back-v2,
.ghp-back-game {
  top: 72px !important;
}

/* EXCEPTION: buttons that live INSIDE a .dz-topbar flexbox are already
   in normal flow — reset their absolute positioning so they stay in-place */
.dz-topbar .ghp-back-game,
.dz-topbar .ghp-back-hub {
  position: static !important;
  top: auto !important;
  left: auto !important;
  width: fit-content !important;
  width: -moz-fit-content !important;
  max-width: fit-content !important;
  flex-shrink: 0 !important;
}

/*
 * FIX: sdk-app and ludo-app must have an explicit height (not just flex:1)
 * for their internal overflow-y:auto scroll to work properly.
 * flex:1 alone gives min-height:0 by default in strict flex, which can
 * cause the container to collapse or overflow incorrectly.
 */
#sdk-app {
  min-height: 0;
  flex: 1 1 0;
}

#ludo-app {
  min-height: 0;
  flex: 1 1 0;
}

/*
 * FIX: The global `canvas { height: auto }` rule can override
 * ludo-canvas which uses position:absolute; inset:0; height:100%.
 * Override it back to 100% for the absolutely-positioned ludo canvas.
 */
#ludo-canvas,
#carrom-canvas {
  height: 100% !important;
}

/* ═══════════════════════════════════════════════════════════════
   PATCH v2: Chess setup + mobile layout + spacing fixes
═══════════════════════════════════════════════════════════════ */

/* Chess difficulty buttons — always wrap on small screens */
.chess-diff-group {
  flex-wrap: wrap !important;
  gap: 6px !important;
}
.chess-diff-group .diff-btn {
  flex: 1 1 calc(50% - 6px);
  min-width: 90px;
  text-align: center;
  white-space: nowrap;
  padding: 8px 12px !important;
  font-size: 0.82rem !important;
}
@media (max-width: 400px) {
  .chess-diff-group .diff-btn {
    flex: 1 1 100%;
  }
}


/* Bomberman: mobile layout fix — controls below canvas */
#bm-play {
  flex-direction: column !important;
}
#bm-mobile-controls {
  width: 100% !important;
  display: block !important;
}
@media (max-width: 768px) {
  #bm-canvas {
    max-height: calc(100vh - 220px) !important;
    width: auto !important;
    display: block;
    margin: 0 auto;
  }
}

/* Star catcher: mobile controls strip */
#sc-mobile-controls button:active {
  opacity: 0.75;
  transform: scale(0.94);
}

/* Space dodge: mobile joystick panel */
#sd-mobile-joysticks {
  flex-shrink: 0;
}
@media (max-width: 768px) {
  #sd-canvas {
    max-height: calc(100vh - 250px) !important;
  }
}

/* Carrom canvas: respect flex sizing properly */
#carrom-canvas {
  max-height: calc(100dvh - 160px) !important;
  width: auto !important;
  height: auto !important;
}

/* Sudoku: fix potential blank screen issue — ensure sdk-play shows */
#sdk-play:not(.hidden) {
  display: flex !important;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS (from mobile.css)
   ═══════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   DuelZone · Mobile Optimization System  (mobile.css)
   
   ISOLATION RULES:
   - Sections 1 & 2: New elements & fullscreen — safe globally
   - Sections 3–8: All existing-element overrides are inside @media
   - Desktop (769px+) is NEVER touched by any rule here
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. UNIVERSAL WRAPPER — brand new elements, no conflicts ───── */

#dz-universal-wrapper {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #07080f;
  position: relative;
  z-index: 5;
  overflow: hidden;
}

#dz-universal-wrapper.dz-active {
  display: flex;
}

#dz-universal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: rgba(7, 8, 15, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  min-height: 44px;
  box-sizing: border-box;
}

.dz-univ-back-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.75);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  min-width: 64px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.dz-univ-back-btn:active {
  background: rgba(255,255,255,0.18);
  transform: scale(0.97);
}

.dz-univ-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
}

.dz-univ-fs-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.75);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 1rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.dz-univ-fs-btn:active {
  background: rgba(255,255,255,0.2);
  transform: scale(0.95);
}

.dz-univ-fs-btn.fs-active {
  color: #00e5ff;
  border-color: rgba(0,229,255,0.4);
  background: rgba(0,229,255,0.1);
}

#dz-game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  min-height: 0;
}

/* Game screen moved inside wrapper fills the area completely */
#dz-game-area > [id^="screen-"] {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#dz-universal-controls {
  width: 100%;
  max-width: 820px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 12px;
  gap: 16px;
  flex-shrink: 0;
  box-sizing: border-box;
}

#dz-universal-controls:empty {
  display: none;
  padding: 0;
}

/* ── 2. FULLSCREEN — works on all devices, no interference ────── */

#dz-universal-wrapper:fullscreen,
#dz-universal-wrapper:-webkit-full-screen,
#dz-universal-wrapper:-moz-full-screen {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #07080f;
}

:fullscreen #dz-universal-topbar,
:-webkit-full-screen #dz-universal-topbar,
:-moz-full-screen #dz-universal-topbar {
  background: rgba(0,0,0,0.85);
}

:fullscreen canvas,
:-webkit-full-screen canvas,
:-moz-full-screen canvas {
  max-width: 100vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

:fullscreen #dz-universal-controls,
:-webkit-full-screen #dz-universal-controls,
:-moz-full-screen #dz-universal-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(7,8,15,0.9);
  padding: 8px 12px 16px;
  z-index: 200;
}

/* ════════════════════════════════════════════════════════════════
   SECTIONS 3–8: ALL INSIDE @media — desktop is never touched
   ════════════════════════════════════════════════════════════════ */

/* ── 3. TABLET & MOBILE (≤ 768px) ────────────────────────────── */

@media (max-width: 768px) {

  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  #screen-hub {
    padding: 36px 16px 32px;
    gap: 24px;
    overflow-x: hidden;
    width: 100%;
  }

  #arena-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  canvas {
    max-width: 100%;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  #tanks-canvas,
  #bm-canvas,
  #sc-canvas,
  #sd-canvas,
  #ping-canvas,
  #checkers-canvas,
  #pr-canvas,
  #ah-canvas,
  #airhockey-canvas,
  #dg-canvas,
  #draw-canvas {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    touch-action: none;
  }

  .dz-dpad-btn {
    width: clamp(48px, 13vw, 60px);
    height: clamp(48px, 13vw, 60px);
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    border-radius: 10px;
  }

  .dz-action-btn {
    min-width: clamp(56px, 15vw, 76px);
    height: clamp(48px, 13vw, 60px);
    font-size: clamp(0.75rem, 2.2vw, 0.95rem);
    border-radius: 10px;
    padding: 0 10px;
  }

  .dz-mobile-ctrl-wrap {
    padding: 8px 6px 6px;
    gap: 10px;
    justify-content: center;
  }

  #tanks-mobile-controls {
    width: 100%;
    max-width: 820px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px 0;
  }

  #bm-mobile-controls {
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 0;
  }


  #rd-tap-p1,
  #rd-tap-p2 {
    min-height: 80px;
    font-size: 1.3rem;
    border-radius: 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .bj-card {
    min-width: clamp(34px, 9vw, 50px);
    font-size: clamp(0.72rem, 2.5vw, 0.95rem);
  }

  #chess-board-container,
  .chess-board-wrap {
    max-width: min(90vw, 480px);
    margin: 0 auto;
  }

  .dz-fs-btn {
    min-height: 38px;
    min-width: 44px;
    padding: 6px 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .dz-topbar {
    padding: 6px 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .game-home-panel,
  .ghp-v2 {
    padding: 20px 16px 24px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(100vh - 60px);
  }

  .ghp-start-btn {
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  button,
  [role="button"] {
    min-height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  [id$="-play"] *,
  [id$="-play-panel"] * {
    -webkit-user-select: none;
    user-select: none;
  }

  input[type="text"],
  input[type="number"],
  textarea {
    -webkit-user-select: text;
    user-select: text;
  }

  #tanks-hud {
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 8px;
  }

  .d2048-board      { max-width: min(90vw, 420px); margin: 0 auto; }
  #bs-placement-grid,
  #bs-attack-grid   { max-width: min(90vw, 360px); margin: 0 auto; }
  .mfd-board        { max-width: min(95vw, 480px); margin: 0 auto; }
  #cdd-board        { max-width: min(95vw, 480px); margin: 0 auto; overflow: hidden; }


  #sd-joystick-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
  }
  #checkers-canvas {
    display: block;
    margin: 0 auto;
  }
}

/* ── 4. SMALL PHONE (≤ 480px) ─────────────────────────────────── */

@media (max-width: 480px) {

  #screen-hub {
    padding: 24px 12px 24px;
    gap: 16px;
  }

  #arena-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 4px;
  }

  .arena-card .card-inner {
    padding: 14px 12px 12px;
  }

  .arena-card .card-title {
    font-size: 0.78rem;
  }

  .arena-card .card-desc {
    font-size: 0.66rem;
  }

  .ghp-title {
    font-size: 1.4rem;
  }

  .ghp-start-btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-size: 1rem;
  }

  .ghp-mode-btn {
    padding: 10px 16px;
    font-size: 0.82rem;
    min-height: 42px;
  }

  #dz-universal-topbar {
    padding: 5px 8px;
  }

  .dz-univ-title {
    font-size: 0.62rem;
    padding: 0 4px;
  }

  .dz-univ-back-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
    min-width: 52px;
  }

  .dz-univ-fs-btn {
    padding: 5px 8px;
    font-size: 0.88rem;
    min-width: 36px;
  }


  #rd-tap-p1,
  #rd-tap-p2 {
    min-height: 90px;
    font-size: 1.4rem;
  }


  .darts-num-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 0.9rem;
  }
}

/* ── 5. VERY SMALL (≤ 360px) ──────────────────────────────────── */

@media (max-width: 360px) {

  #arena-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dz-dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  .dz-action-btn {
    height: 44px;
    min-width: 52px;
    font-size: 0.72rem;
  }
}

/* ── 6. LANDSCAPE PHONE (short viewport) ─────────────────────── */

@media screen and (orientation: landscape) and (max-height: 500px) {

  #dz-universal-topbar {
    padding: 4px 10px;
    min-height: 36px;
  }

  .dz-univ-back-btn,
  .dz-univ-fs-btn {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  #dz-universal-controls {
    padding: 4px 8px 8px;
  }

  .dz-dpad-btn {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .dz-action-btn {
    height: 42px;
    font-size: 0.75rem;
  }

  .game-home-panel,
  .ghp-v2 {
    padding: 8px 12px 12px;
    gap: 8px;
  }

  #screen-hub {
    padding: 16px 12px;
    gap: 12px;
  }
}

/* ── 7. SAFE AREA — notch phones only ────────────────────────── */

@media (max-width: 768px) {
  @supports (padding: env(safe-area-inset-bottom)) {

    body {
      padding-top: env(safe-area-inset-top);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }

    #dz-universal-controls {
      padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    :fullscreen #dz-universal-controls,
    :-webkit-full-screen #dz-universal-controls {
      padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
  }
}

/* ── 8. TOUCH POINTER — touchscreen devices only ─────────────── */

@media (pointer: coarse) {

  button,
  .card-btn,
  .ghp-mode-btn,
  .ghp-start-btn,
  .ghp-back-hub,
  .ghp-back-game,
  .dz-fs-btn {
    min-height: 40px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .chess-square {
    min-width: 36px;
    min-height: 36px;
  }
}

/* ── Feature 8: Mine tab bar — mobile only ───────────────────── */


/* ── Feature 6: Onboarding — mobile tweaks ───────────────────── */
@media (max-width: 480px) {
  #dz-ob-box {
    padding: 28px 20px 24px;
  }

  #dz-ob-title { font-size: 1.15rem; }
  #dz-ob-tips li { font-size: 0.85rem; padding: 8px 12px; }
  #dz-ob-close { font-size: 0.82rem; padding: 12px 20px; }
}


/* ── Carrom canvas responsive ───────────────────────────────── */
@media (max-width: 768px) {
  #carrom-canvas {
    max-width: 100%;
    touch-action: none;
  }
  #carrom-canvas-wrap {
    padding: 2px 6px 6px;
  }
}

@media (max-width: 480px) {
  #carrom-score-p,
  #carrom-score-ai {
    font-size: 1.3rem !important;
  }
  #carrom-timer {
    font-size: 0.95rem !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   LANDSCAPE PHONE — Wide-canvas game optimizations
   Targets: Tanks, SpaceDodge, StarCatcher, Bomberman, Tetris,
            PingPong, Checkers, Territory, Battleship
   ════════════════════════════════════════════════════════════════ */

/* ── 9. Landscape phone — game-area fills viewport horizontally ── */
@media screen and (orientation: landscape) and (max-height: 500px) {

  /* Game screens: remove vertical padding to maximize canvas space */
  #tanks-play-panel,
  #sd-play-panel,
  #sc-play-panel,
  #bm-play,
  #pp-wrap {
    padding: 0 !important;
    min-height: 100dvh;
    justify-content: flex-start;
  }

  /* HUDs: go ultra-compact in landscape */
  #tanks-hud,
  #sd-hud,
  #sc-hud {
    padding: 3px 8px !important;
    min-height: 32px;
  }

  /* HP bars shrink a bit */
  #tanks-hud [style*="width:100px"],
  #sd-p1-hp-bar,
  #sd-p2-hp-bar {
    width: 70px !important;
  }

  /* Canvas: max out available height */
  #tanks-canvas,
  #sd-canvas,
  #sc-canvas,
  #bm-canvas,
  #pp-canvas {
    max-height: calc(100dvh - 80px);
    width: auto !important;
    max-width: 100%;
    object-fit: contain;
  }

  /* Tetris: side-by-side boards stay compact */
  #tetris-play {
    padding: 4px 8px !important;
  }

  /* Mobile controls strip: compact row in landscape */
  #tanks-mobile-controls {
    padding: 4px 8px !important;
    gap: 8px;
  }

  /* Bomberman canvas wrapper */
  #bm-play > div:first-child {
    padding: 4px 8px !important;
  }
}

/* ── 10. Tanks: mobile controls always fill width nicely ───────── */
@media (max-width: 768px) {
  #tanks-mobile-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 4px;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
  }

  /* Tanks HUD: stack HP bar under label on very small screens */
  #tanks-p1-hud,
  #tanks-p2-hud {
    gap: 5px;
    flex-wrap: wrap;
  }

  #tanks-p1-hud [style*="width:100px"],
  #tanks-p2-hud [style*="width:100px"] {
    width: 70px !important;
  }
}

/* ── 11. Tetris: stack panels vertically on portrait phones ──────── */
@media (max-width: 640px) and (orientation: portrait) {
  #tetris-play {
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
  }

  /* Each player panel takes full width, boards centered */
  #tetris-player-1,
  #tetris-player-2 {
    width: 100% !important;
    max-width: 220px;
    margin: 0 auto;
  }
}

/* ── 12. Bomberman: canvas centered with breathing room ──────────── */
@media (max-width: 560px) {
  #bm-canvas {
    display: block;
    margin: 0 auto;
  }

  #bm-play {
    padding: 6px 4px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100dvh;
  }
}

/* ── 13. PingPong: canvas fills width in portrait ────────────────── */
@media (max-width: 768px) {
  #pp-canvas-wrap {
    width: 100%;
    padding: 0;
  }
  #pp-canvas {
    width: 100% !important;
    height: auto !important;
  }
  #pp-wrap {
    padding: 0 4px !important;
  }
}

/* ── 14. StarCatcher: canvas fills width ─────────────────────────── */
@media (max-width: 768px) {
  #sc-play-panel {
    padding: 4px 0 !important;
  }
  #sc-canvas {
    display: block;
    margin: 0 auto;
  }
}

/* ── 15. SpaceDodge: compact HUD for portrait ────────────────────── */
@media (max-width: 480px) {
  #sd-hud {
    gap: 4px;
    padding: 4px 6px !important;
  }
  #sd-p1-hp-bar,
  #sd-p2-hp-bar {
    width: 60px !important;
  }
  #sd-timer {
    font-size: 16px !important;
  }
}

/* ── 16. Rotate prompt polish ─────────────────────────────────────── */
#dz-rotate-prompt {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}


/* ── 18. Checkers: board responsive ──────────────────────────────── */
@media (max-width: 480px) {
  #ck-board-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: calc(100vw - 16px);
  }
  #ck-game-area {
    flex-direction: column !important;
    align-items: center;
  }
  #ck-score-left,
  #ck-score-right {
    display: flex;
    gap: 12px;
    align-items: center;
  }
}


/* ═══════════════════════════════════════════════════════
   FIX: 3-bar menu FIXED position, Back button below it
   Hub back button never overlaps with hamburger menu
   ═══════════════════════════════════════════════════════ */

/* Universal top bar: strict flex layout, no overlap */
#dz-universal-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 200 !important;
  flex-wrap: nowrap !important;
}

/* Back button: always on left, never overlaps right-side menu */
#dz-univ-back {
  order: 1 !important;
  flex-shrink: 0 !important;
  z-index: 201 !important;
}

/* Game title: center, compressed so it never pushes buttons out */
#dz-univ-game-title {
  order: 2 !important;
  flex: 1 !important;
  text-align: center !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  padding: 0 8px !important;
  font-size: 0.78rem !important;
}

/* Fullscreen btn: hidden (removed) */
#dz-univ-fs {
  display: none !important;
}

/* 3-bar hamburger menu: always on far right, never moves */
/* ══ hamburger always fixed top-right, above ALL game panels ══ */
#dz-hamburger, .hamburger-btn {
  position: fixed !important;
  top: 16px !important;
  right: 16px !important;
  left: auto !important;
  z-index: 9999 !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
/* In a game: show ☰ game btn, hide hub hamburger */
body.dz-in-game #dz-ig-menu-btn {
  display: flex !important;
}
body.dz-in-game #dz-hamburger,
body.dz-in-game .hamburger-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Dropdown opens from top-right */
#dz-dropdown {
  z-index: 9998 !important;
}

/* ═══════════════════════════════════════════════════════════
   PING PONG — Scoped styles (from index.html inline)
   ═══════════════════════════════════════════════════════════ */
  /* ═══ Ping Pong — scoped styles ══════════════════════════════ */
  #pp-wrap {
    background:#07080f; min-height:100vh;
    display:flex; flex-direction:column; align-items:center;
    overflow-x:hidden; position:relative;
    -webkit-user-select:none; user-select:none;
  }
  #pp-wrap::before {
    content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
    background:
      radial-gradient(ellipse 60% 50% at 15% 25%, rgba(0,229,255,.07) 0%, transparent 70%),
      radial-gradient(ellipse 50% 60% at 85% 75%, rgba(0,229,255,.05) 0%, transparent 70%);
  }

  /* ── Header ── */
  #pp-header {
    position:relative; z-index:2; width:100%; max-width:740px;
    display:flex; align-items:center; justify-content:space-between;
    padding:12px 16px 4px; box-sizing:border-box;
  }
  #pp-back-btn, #pp-setup-btn, #pp-pause-btn {
    background:none; border:1.5px solid rgba(0,229,255,.3); color:#00e5ff;
    font-family:'Rajdhani',sans-serif; font-size:13px; font-weight:700;
    padding:7px 14px; border-radius:8px; cursor:pointer; letter-spacing:.06em;
    transition:background .2s, border-color .2s; min-width:64px;
    -webkit-tap-highlight-color:transparent; touch-action:manipulation;
  }
  #pp-back-btn:hover,#pp-setup-btn:hover,#pp-pause-btn:hover { background:rgba(0,229,255,.1); border-color:rgba(0,229,255,.6); }
  #pp-title-bar {
    font-family:'Orbitron',sans-serif; font-size:clamp(15px,4vw,21px); font-weight:900;
    background:linear-gradient(90deg,#00e5ff,#80f0ff,#00e5ff);
    -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
    letter-spacing:.06em;
  }

  /* ── Score row ── */
  #pp-score-row {
    position:relative; z-index:2; display:flex; align-items:center; gap:16px;
    padding:2px 16px 6px; font-family:'Orbitron',sans-serif; width:100%; max-width:740px;
    box-sizing:border-box; justify-content:center;
  }
  .pp-score-block { text-align:center; min-width:80px; }
  .pp-slabel { font-size:10px; letter-spacing:.12em; margin-bottom:2px; }
  .pp-slabel.p1c { color:#00cfff; }
  .pp-slabel.p2c { color:#ff6060; }
  .pp-sval { font-size:clamp(28px,9vw,48px); font-weight:900; line-height:1; }
  .pp-sval.p1c { color:#00cfff; text-shadow:0 0 18px rgba(0,207,255,.5); }
  .pp-sval.p2c { color:#ff6060; text-shadow:0 0 18px rgba(255,96,96,.5); }
  #pp-score-sep { font-size:22px; color:#2a3050; font-weight:900; }

  /* ── Canvas wrap — fills remaining viewport ── */
  #pp-canvas-wrap {
    position:relative; z-index:2;
    border:2px solid rgba(0,229,255,.18); border-radius:12px; overflow:hidden;
    box-shadow:0 0 40px rgba(0,229,255,.1), 0 0 0 1px rgba(255,255,255,.04) inset;
    width:calc(100vw - 24px); max-width:740px;
    touch-action:none; cursor:ns-resize;
  }
  #pp-canvas { display:block; width:100%; height:auto; background:#060810; touch-action:none; }

  /* ── Hint bar below canvas ── */
  #pp-hint-bar {
    position:relative; z-index:2;
    font-family:'Rajdhani',sans-serif; font-size:11px; color:#3a4560;
    letter-spacing:.08em; text-align:center;
    padding:6px 16px 14px; width:100%; max-width:740px; box-sizing:border-box;
  }
  #pp-hint-bar span { color:#4a5a70; }

  /* ── Overlay ── */
  #pp-overlay {
    position:absolute; inset:0; z-index:20;
    display:flex; align-items:center; justify-content:center;
    background:rgba(5,7,15,.93); border-radius:10px;
  }
  #pp-overlay.pp-hidden { display:none; }
  .pp-panel { display:flex; flex-direction:column; align-items:center; width:100%; padding:20px 16px; box-sizing:border-box; }
  .pp-panel.pp-hidden { display:none; }

  .pp-ov-logo {
    font-family:'Orbitron',sans-serif; font-size:clamp(22px,6vw,34px); font-weight:900;
    color:#00e5ff; letter-spacing:.08em; margin-bottom:4px;
    text-shadow:0 0 28px rgba(0,229,255,.7);
  }
  .pp-ov-tag {
    font-family:'Rajdhani',sans-serif; font-size:clamp(12px,3vw,14px); color:#5a6888;
    letter-spacing:.1em; margin-bottom:20px;
  }

  /* Control hint inside overlay */
  .pp-ctrl-hint {
    font-family:'Rajdhani',sans-serif; font-size:12px; color:#4a5570;
    letter-spacing:.09em; margin-bottom:20px; text-align:center; line-height:1.7;
  }
  .pp-ctrl-hint b { color:#6a7a90; }

  /* Mode buttons */
  .pp-mode-row { display:flex; gap:10px; margin-bottom:14px; }
  .pp-mdbtn {
    font-family:'Rajdhani',sans-serif; font-size:14px; font-weight:700; letter-spacing:.06em;
    padding:9px 18px; border-radius:9px; cursor:pointer; border:1.5px solid rgba(255,255,255,.15);
    background:rgba(255,255,255,.04); color:#8090b0;
    transition:all .2s; -webkit-tap-highlight-color:transparent; touch-action:manipulation;
  }
  .pp-mdbtn.active { border-color:rgba(0,229,255,.5); background:rgba(0,229,255,.12); color:#00e5ff; }

  /* Difficulty */
  #pp-diff-row { display:flex; gap:8px; margin-bottom:20px; }
  #pp-diff-row.pp-hidden { display:none; }
  .pp-diffbtn {
    font-family:'Orbitron',sans-serif; font-size:11px; font-weight:700; letter-spacing:.07em;
    padding:7px 14px; border-radius:7px; cursor:pointer;
    border:1.5px solid rgba(255,255,255,.12); background:rgba(255,255,255,.04); color:#5a6888;
    transition:all .2s; -webkit-tap-highlight-color:transparent; touch-action:manipulation;
  }
  .pp-diffbtn.active          { border-color:rgba(0,229,255,.45); background:rgba(0,229,255,.10); color:#00e5ff; }
  .pp-diffbtn[data-d="easy"].active { border-color:rgba(100,230,100,.45); background:rgba(100,230,100,.10); color:#64e664; }
  .pp-diffbtn[data-d="hard"].active { border-color:rgba(255,80,80,.45);   background:rgba(255,80,80,.10);   color:#ff5050; }

  /* Action buttons */
  .pp-ov-playbtn {
    font-family:'Orbitron',sans-serif; font-size:clamp(12px,3.5vw,15px); font-weight:700;
    letter-spacing:.1em; padding:12px 38px; border-radius:10px; cursor:pointer;
    border:2px solid rgba(0,229,255,.5); background:rgba(0,229,255,.13); color:#00e5ff;
    transition:all .2s; -webkit-tap-highlight-color:transparent; margin:4px;
    box-shadow:0 0 20px rgba(0,229,255,.15); touch-action:manipulation;
  }
  .pp-ov-playbtn:hover,.pp-ov-playbtn:active { background:rgba(0,229,255,.26); box-shadow:0 0 28px rgba(0,229,255,.35); }
  .pp-ov-menubtn {
    font-family:'Rajdhani',sans-serif; font-size:13px; font-weight:700; letter-spacing:.06em;
    padding:9px 22px; border-radius:8px; cursor:pointer; margin:4px;
    border:1.5px solid rgba(255,255,255,.12); background:rgba(255,255,255,.04); color:#5a6888;
    transition:all .2s; -webkit-tap-highlight-color:transparent; touch-action:manipulation;
  }
  .pp-ov-menubtn:hover { background:rgba(255,255,255,.08); color:#8090b0; }

  #pp-result-title {
    font-family:'Orbitron',sans-serif; font-size:clamp(20px,6vw,30px); font-weight:900;
    color:#00e5ff; letter-spacing:.06em; margin-bottom:6px;
    text-shadow:0 0 28px rgba(0,229,255,.7);
  }
  #pp-result-sub { font-family:'Rajdhani',sans-serif; font-size:14px; color:#5a6888; letter-spacing:.1em; margin-bottom:22px; }
  #pp-pause-title {
    font-family:'Orbitron',sans-serif; font-size:clamp(22px,6vw,34px); font-weight:900;
    color:#00e5ff; letter-spacing:.08em; margin-bottom:22px;
    text-shadow:0 0 28px rgba(0,229,255,.6);
  }

/* ═══════════════════════════════════════════════════════════
   KEYFRAME ANIMATIONS (from inline styles in index.html)
   ═══════════════════════════════════════════════════════════ */
@keyframes ldResIn { from { opacity: 0; transform: scale(0.85) } to { opacity: 1; transform: scale(1) } }
@keyframes crResIn { from { opacity: 0; transform: scale(0.9) } to { opacity: 1; transform: scale(1) } }

/* ═══════════════════════════════════════════════════════════
   RIPPLE ANIMATION (from script.js injection)
   ═══════════════════════════════════════════════════════════ */
@keyframes ripple-expand { to { transform: scale(3); opacity: 0 } }

/* ═══════════════════════════════════════════════════════════
   ROTATE PROMPT ANIMATION (from mobile.js injection)
   ═══════════════════════════════════════════════════════════ */
@keyframes dzSpin { 0%,100% { transform: rotate(0deg) } 35% { transform: rotate(90deg) } 65% { transform: rotate(90deg) } }

/* ═══════════════════════════════════════════════════════════
   LUDO — Scoped styles (new side-button layout)
   ═══════════════════════════════════════════════════════════ */

  /* ── App container ─────────────────────────────────── */
  #ludo-app {
    font-family: 'Rajdhani', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0 4px 12px;
    box-sizing: border-box;
    gap: 0;
  }

  /* ── Main layout: 3-column CSS grid
        col 1 = left button  (56px)
        col 2 = board canvas (flexible)
        col 3 = right button (56px)
        row 1 = top button   (56px)
        row 2 = board        (auto)
        row 3 = bottom button(56px)
  ─────────────────────────────────────────────── */
  #ludo-layout {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    grid-template-rows: 56px 1fr 56px;
    gap: 6px;
    width: 100%;
    max-width: calc(var(--ludo-board-size, 380px) + 124px);
    align-self: center;
  }

  /* Board wrap: grid row 2 / col 2 center cell */
  #ludo-bwrap {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(0,0,0,0.7),
                0 0 0 1.5px rgba(255,255,255,0.09);
    width: 100%;
    max-width: var(--ludo-board-size, 380px);
    justify-self: center;
    align-self: center;
  }
  #ludo-bwrap::before { content: ''; display: block; padding-top: 100%; }
  #ludo-cv {
    position: absolute; inset: 0;
    cursor: pointer; touch-action: none;
    border-radius: 14px;
    width: 100%; height: 100%;
  }

  /* ── Side tap buttons ─────────────────────────────── */
  .ludo-side-btn {
    --lsb-color: #fff;
    --lsb-dark:  #aaa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 2px solid var(--lsb-color);
    background: color-mix(in srgb, var(--lsb-color) 10%, transparent);
    border-radius: 14px;
    padding: 4px 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s, transform 0.12s,
                box-shadow 0.18s, opacity 0.22s;
    overflow: hidden;
  }

  /* Top button: grid row 1 / col 2 */
  .ludo-side-btn[data-pos="top"]    { grid-column:2; grid-row:1; flex-direction:row; padding:0 8px; gap:6px; border-radius:16px; }
  /* Bottom button: grid row 3 / col 2 */
  .ludo-side-btn[data-pos="bottom"] { grid-column:2; grid-row:3; flex-direction:row; padding:0 8px; gap:6px; border-radius:16px; }
  /* Left button: grid row 2 / col 1 */
  .ludo-side-btn[data-pos="left"]   { grid-column:1; grid-row:2; border-radius:14px; }
  /* Right button: grid row 2 / col 3 */
  .ludo-side-btn[data-pos="right"]  { grid-column:3; grid-row:2; border-radius:14px; }

  /* Disabled / inactive = dim */
  .ludo-side-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    pointer-events: none;
  }

  /* Active player — highlighted border + glow */
  .ludo-side-btn.lsb-active {
    background: color-mix(in srgb, var(--lsb-color) 22%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--lsb-color) 55%, transparent),
                inset 0 0 8px color-mix(in srgb, var(--lsb-color) 18%, transparent);
    border-color: var(--lsb-color);
  }

  /* Can-roll state — pulsing call-to-action */
  .ludo-side-btn.lsb-canroll {
    animation: lsbPulse 1.2s ease-in-out infinite;
  }
  @keyframes lsbPulse {
    0%,100% {
      transform: scale(1);
      box-shadow: 0 0 14px color-mix(in srgb, var(--lsb-color) 40%, transparent);
    }
    50% {
      transform: scale(1.05);
      box-shadow: 0 0 28px color-mix(in srgb, var(--lsb-color) 70%, transparent),
                  0 0 0 4px color-mix(in srgb, var(--lsb-color) 18%, transparent);
    }
  }

  /* Bot / rolling state — subtle shimmer */
  .ludo-side-btn.lsb-rolling {
    animation: lsbShimmer 0.6s linear infinite;
    opacity: 0.7;
  }
  @keyframes lsbShimmer {
    0%,100% { opacity:0.7; }
    50%      { opacity:1;   }
  }

  /* Finished player — faded out */
  .ludo-side-btn.lsb-done {
    opacity: 0.18;
    pointer-events: none;
  }

  /* Button internal text elements */
  .lsb-emoji {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
  }
  .lsb-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.45rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lsb-color);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    max-width: 52px;
  }
  /* Horizontal buttons (top/bottom) get bigger name text */
  .ludo-side-btn[data-pos="top"]    .lsb-name,
  .ludo-side-btn[data-pos="bottom"] .lsb-name {
    font-size: 0.55rem;
    max-width: none;
  }
  .lsb-score {
    font-family: 'DM Mono', monospace;
    font-size: 0.58rem;
    color: rgba(255,255,255,0.55);
    line-height: 1;
  }

  /* ── Message bar ──────────────────────────────────── */
  #ludo-msg {
    width: 100%;
    max-width: calc(var(--ludo-board-size, 380px) + 124px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    margin-top: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    font-size: 0.85rem;
    color: rgba(220,230,255,0.85);
    min-height: 40px;
    box-sizing: border-box;
    transition: border-color 0.3s, background 0.3s;
    flex-shrink: 0;
  }
  #ludo-msg-icon { font-size:1.1rem; flex-shrink:0; }
  #ludo-msg-txt  { flex:1; line-height:1.35; }

  /* ── Music btn ──────────────────────────────────── */
  #ludo-music-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    margin-top: 6px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  #ludo-music-btn.on {
    background: rgba(255,23,68,0.14);
    border-color: rgba(255,23,68,0.38);
    color: #ff6b81;
    animation: ldMusicGlow 2.2s ease-in-out infinite;
  }
  @keyframes ldMusicGlow { 0%,100%{opacity:1} 50%{opacity:0.6} }

  /* ── Pass-device overlay (bots multi-human mode only) */
  #ludo-pass-overlay {
    position:fixed; inset:0; z-index:120;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    background:rgba(4,5,16,0.96);
    backdrop-filter:blur(8px);
    animation:ldPassIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
    padding:20px;
  }
  #ludo-pass-overlay.hidden { display:none; }
  @keyframes ldPassIn { from{opacity:0;transform:scale(0.88)} to{opacity:1;transform:scale(1)} }
  #ludo-pass-box {
    background:linear-gradient(160deg,#0e1022,#18080f);
    border-radius:22px; padding:36px 32px;
    text-align:center; max-width:320px; width:100%;
    border:2px solid var(--po-color,rgba(255,255,255,0.15));
    box-shadow:0 0 60px color-mix(in srgb,var(--po-color,#fff) 20%,transparent);
  }
  #ludo-pass-emoji  { font-size:2.8rem; margin-bottom:12px; }
  #ludo-pass-title  { font-family:'Orbitron',sans-serif; font-size:1.5rem; font-weight:900; color:var(--po-color,#fff); letter-spacing:0.04em; margin-bottom:6px; }
  #ludo-pass-sub    { font-family:'Rajdhani',sans-serif; font-size:0.92rem; color:rgba(200,210,255,0.65); margin-bottom:26px; line-height:1.4; }
  #ludo-pass-btn {
    padding:14px 40px; border:none; border-radius:28px;
    background:var(--po-color,#ff1744); color:#fff;
    font-family:'Orbitron',sans-serif; font-size:0.75rem;
    font-weight:700; letter-spacing:0.12em; cursor:pointer; text-transform:uppercase;
    box-shadow:0 4px 24px color-mix(in srgb,var(--po-color,#ff1744) 45%,transparent);
    transition:transform 0.1s, box-shadow 0.15s;
    -webkit-tap-highlight-color:transparent;
  }
  #ludo-pass-btn:hover  { transform:translateY(-2px); }
  #ludo-pass-btn:active { transform:scale(0.94); }

  /* ── Setup preview pills ──────────────────────────── */
  .lsetup-pill {
    display:inline-flex; align-items:center; gap:5px;
    padding:3px 10px; border-radius:20px;
    font-family:'DM Mono',monospace; font-size:0.63rem;
  }

  /* ── PvP name inputs ─────────────────────────────── */
  .lpvp-name-field {
    display:flex; align-items:center; gap:8px;
    background:rgba(255,255,255,0.04);
    border:1px solid rgba(255,255,255,0.09);
    border-radius:10px; padding:7px 10px;
    transition:border-color 0.2s;
  }
  .lpvp-name-field:focus-within {
    border-color:var(--lnf-color,rgba(255,255,255,0.3));
    background:rgba(255,255,255,0.06);
  }
  .lpvp-name-dot {
    width:9px; height:9px; border-radius:50%;
    background:var(--lnf-color,#888); flex-shrink:0;
    box-shadow:0 0 6px var(--lnf-color,#888);
  }
  .lpvp-name-input {
    flex:1; background:none; border:none; outline:none;
    color:#fff; font-family:'Rajdhani',sans-serif;
    font-size:0.88rem; font-weight:600;
  }
  .lpvp-name-input::placeholder { color:rgba(255,255,255,0.22); }

  /* ── Responsive: very small screens ─────────────── */
  @media (max-width: 360px) {
    #ludo-layout {
      grid-template-columns: 44px 1fr 44px;
      grid-template-rows:    44px 1fr 44px;
      gap: 4px;
    }
    .lsb-name  { font-size: 0.38rem; }
    .lsb-emoji { font-size: 1rem; }
  }

/* ═══════════════════════════════════════════════════════════
   SUDOKU — Scoped styles (from sudoku.js injection)
   ═══════════════════════════════════════════════════════════ */
  /* ─── Sudoku app container ─── */
  #sdk-app {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    /* Ensure app never exceeds parent height */
    max-height: 100%;
  }

  /* ─── Stats bar ─── */
  .sdk-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 2px 7px;
    flex-shrink: 0;
  }
  .sdk-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .sdk-stat-lbl {
    font-family: 'DM Mono', monospace;
    font-size: 0.55rem; letter-spacing: 0.3em;
    color: rgba(255,255,255,0.28); text-transform: uppercase;
  }
  .sdk-stat-val {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700; font-size: 0.88rem; color: #e2e8ff;
  }
  #sdk-timer-val { color: #6c63ff; }
  #sdk-diff-badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.2em;
    padding: 3px 10px; border-radius: 20px;
    background: rgba(108,99,255,0.15);
    border: 1px solid rgba(108,99,255,0.35);
    color: #6c63ff; text-transform: uppercase;
  }
  .sdk-hearts { display: flex; gap: 4px; }
  .sdk-heart { font-size: 0.95rem; transition: opacity 0.3s, transform 0.3s; }
  .sdk-heart.lost { opacity: 0.18; transform: scale(0.65); }

  /* ─── Grid wrapper ─── */
  .sdk-grid-wrap {
    width: 100%;
    /* Use a square that fits both width AND available vertical space */
    /* --sdk-grid-size is set via JS based on available height */
    max-width: min(100%, var(--sdk-grid-size, 420px));
    align-self: center;
    position: relative;
    flex-shrink: 1;
  }
  .sdk-grid-wrap::before {
    content: ''; display: block; padding-top: 100%;
  }
  #sdk-grid {
    position: absolute; inset: 0;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    border: 2.5px solid rgba(108,99,255,0.65);
    border-radius: 7px;
    overflow: hidden;
    background: #0b0d1a;
    box-shadow: 0 0 28px rgba(108,99,255,0.12), inset 0 0 0 1px rgba(108,99,255,0.06);
  }

  /* ─── Cell ─── */
  .sdk-cell {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    box-sizing: border-box;
    border-right: 1px solid rgba(255,255,255,0.055);
    border-bottom: 1px solid rgba(255,255,255,0.055);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(0.78rem, 3.2vw, 1.25rem);
    cursor: pointer;
    transition: background 0.1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
  }
  /* thick box borders */
  .sdk-cell[data-col="2"],.sdk-cell[data-col="5"]{ border-right:  2px solid rgba(108,99,255,0.55); }
  .sdk-cell[data-row="2"],.sdk-cell[data-row="5"]{ border-bottom: 2px solid rgba(108,99,255,0.55); }
  .sdk-cell[data-col="8"]{ border-right: none; }
  .sdk-cell[data-row="8"]{ border-bottom: none; }

  /* state colours */
  .sdk-cell.given       { color: #c8ceff; }
  .sdk-cell.user-entry  { color: #a29bff; }
  .sdk-cell.error-entry { color: #f50057 !important; background: rgba(245,0,87,0.09) !important; }
  .sdk-cell.selected    { background: rgba(108,99,255,0.28) !important; }
  .sdk-cell.peer-hi     { background: rgba(108,99,255,0.07); }
  .sdk-cell.same-val    { background: rgba(108,99,255,0.16); }

  /* hint flash */
  .sdk-cell.hint-flash { animation: sdkHintFlash 0.6s ease; }
  @keyframes sdkHintFlash {
    0%,100% { background: rgba(108,99,255,0.28); }
    50%     { background: rgba(108,99,255,0.55); box-shadow: inset 0 0 10px rgba(108,99,255,0.6); }
  }
  /* correct pulse */
  .sdk-cell.correct-flash { animation: sdkCorrectFlash 0.4s ease; }
  @keyframes sdkCorrectFlash {
    0%   { background: rgba(0,230,118,0.3); }
    100% { background: transparent; }
  }

  /* ─── Notes grid ─── */
  .sdk-notes {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    grid-template-rows: repeat(3,1fr);
    width: 94%; height: 94%;
    gap: 0;
  }
  .sdk-n {
    display: flex; align-items: center; justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: clamp(0.3rem, 0.9vw, 0.5rem);
    color: rgba(108,99,255,0.65);
    line-height: 1;
  }

  /* ─── Action row ─── */
  .sdk-actions {
    display: flex; gap: 7px;
    margin: 7px 0 7px;
    flex-shrink: 0;
  }
  .sdk-act {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    padding: 8px 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s, border-color 0.12s;
    touch-action: manipulation;
  }
  .sdk-act:active { background: rgba(108,99,255,0.18); }
  .sdk-act.on { background: rgba(108,99,255,0.2); border-color: rgba(108,99,255,0.5); }
  .sdk-act-icon { font-size: 1.05rem; }
  .sdk-act-lbl {
    font-family: 'DM Mono', monospace; font-size: 0.52rem;
    letter-spacing: 0.12em; color: rgba(255,255,255,0.38);
    text-transform: uppercase;
  }
  .sdk-act-sub { font-family:'DM Mono',monospace; font-size:0.5rem; color:rgba(108,99,255,0.7); }

  /* ─── Number pad ─── */
  .sdk-numpad {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 5px;
    flex-shrink: 0;
    margin-bottom: 6px;
  }
  .sdk-nbtn {
    aspect-ratio: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, transform 0.08s;
    touch-action: manipulation;
    gap: 1px;
  }
  .sdk-nbtn:active { transform: scale(0.88); background: rgba(108,99,255,0.28); }
  .sdk-nbtn.used { opacity: 0.22; pointer-events: none; }
  .sdk-nv {
    font-family: 'Orbitron', sans-serif; font-weight: 700;
    font-size: clamp(0.78rem, 3vw, 1.1rem); color: #e2e8ff; line-height: 1;
  }
  .sdk-nc {
    font-family: 'DM Mono', monospace; font-size: 0.48rem;
    color: rgba(255,255,255,0.28);
  }


/* ═══════════════════════════════════════════════════════════════
   DZ: Territory Wars & Space Dodge — Landscape-first game layout
   ═══════════════════════════════════════════════════════════════ */

/*
 * Portrait warning should appear for Territory and Space Dodge
 * the same way it does for Tanks. The JS (dzGamePortraitCheck)
 * handles per-game triggering; CSS class .dz-needs-landscape
 * forces the overlay when portrait + phone.
 */
body.dz-game-landscape-required #dz-portrait-warn {
  display: flex !important;
}
/* Override: if user dismissed, JS removes the class — CSS alone handles it */





/* ── GLOBAL BACK BUTTON SIZE FIX ──────────────────────────────────────────
   Ensure back buttons NEVER stretch full-width regardless of container type.
   Uses !important to override any conflicting flex/block context.           */
.ghp-back-hub,
.ghp-back-game,
.ghp-back-v2,
.dz-back-btn {
  width: fit-content !important;
  width: -moz-fit-content !important;
  max-width: fit-content !important;
  align-self: flex-start !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}


/* ══════════════════════════════════════════════════════════════
   FIX 6: Prevent scroll bounce / overscroll on fixed game panels
   Applies to all position:fixed play panels set by DuelZone fixes
   ══════════════════════════════════════════════════════════════ */

/* Also lock body overscroll when any game is active */


/* ══════════════════════════════════════════════════════════════
   FIX 7: Landscape mode — compact layouts for portrait-first games
   These games work in both orientations but need landscape tweaks
   ══════════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════════════
   FIX 9: Single-column hub grid on very small phones (≤400px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  #arena-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    max-width: 100% !important;
  }
  .arena-card {
    width: 100%;
  }
  .card-inner {
    padding: 16px 14px 14px;
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }
  .card-icon {
    flex-shrink: 0;
    width: 48px !important;
    height: 48px !important;
  }
  .card-text {
    flex: 1;
    text-align: left;
  }
  .card-title {
    font-size: 0.92rem !important;
    margin-bottom: 3px;
  }
  .card-desc {
    display: block !important;
    font-size: 0.72rem !important;
  }
  .card-btn {
    flex-shrink: 0;
  }
}

/* ══════════════════════════════════════════════════════════════
   Territory Wars: direct-tap mobile improvements
   ══════════════════════════════════════════════════════════════ */
/* Touch active feedback on capturable cells */
/* Bigger tap target area on mobile */

/* ══════════════════════════════════════════════════════════════
   HAMBURGER MENU — Always visible, top-right, above ALL panels
   ══════════════════════════════════════════════════════════════ */

/* Nuclear override — hamburger is ALWAYS on top, no exceptions */
#dz-hamburger {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: rgba(13,15,28,0.92);
  border: 1.5px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Dropdown opens from top-right */
#dz-dropdown {
  position: fixed !important;
  top: 74px !important;
  right: 16px !important;
  left: auto !important;
  z-index: 99998 !important;
  transform-origin: top right !important;
}

/* Give game panel headings right padding so title never hides behind hamburger */

/* ══════════════════════════════════════════════════════════════
   SUDOKU — Top-left nav bar inside play panel
   Sits at top-left; hamburger stays at top-right — no overlap
   ══════════════════════════════════════════════════════════════ */
#sdk-topbar {
  position: fixed !important;
  top: 12px !important;
  left: 14px !important;
  z-index: 60 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Hide sdk-topbar when play panel is hidden */
#sdk-play.hidden #sdk-topbar {
  display: none !important;
}

/* ── Tetris & Reaction Setup buttons ── */
#tetris-back-play,
#rd-back-play {
  position: fixed !important;
  top: 72px !important;
  left: 16px !important;
  z-index: 60 !important;
}

/* ═══════════════════════════════════════════════════════════════
   PHONE UI — Dropdown Menu & Legal Modals full mobile overhaul
   ═══════════════════════════════════════════════════════════════ */

/* ── Dropdown: full-width bottom sheet on phones ── */
@media (max-width: 540px) {
  
  .dz-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}
  /* drag handle indicator */
  .dd-header::before {
    content: '';
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
  }
  .dd-header { position: relative; padding-top: 20px; }

  /* bigger tap targets */
  .dropdown-item.ddi-nav {
    padding: 13px 18px !important;
    font-size: 1rem !important;
  }
  .ddi-icon-wrap {
    width: 38px !important;
    height: 38px !important;
  }
  .ddi-legal-pill {
    padding: 13px 10px !important;
    font-size: 0.78rem !important;
    gap: 8px !important;
  }
  .ddi-legal-pill svg { width: 18px !important; height: 18px !important; }
  .dd-group-label { font-size: 0.55rem !important; padding: 0 18px 8px !important; }
  .dd-group { padding: 12px 0 4px !important; }
  .dd-footer { padding: 14px 18px 20px !important; }
  .dd-footer-copy { font-size: 0.72rem !important; }
  .dd-footer-email { font-size: 0.68rem !important; }
}

/* ── Legal Modal Shells: full-screen on phones ── */
@media (max-width: 600px) {
  .lm-modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .lm-shell {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 24px 24px 0 0 !important;
    flex-direction: column !important;
    transform: translateY(40px) scale(1) !important;
  }
  .lm-modal.active .lm-shell {
    transform: translateY(0) scale(1) !important;
  }

  /* Sidebar becomes a horizontal scrolling tab bar */
  .lm-sidebar {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: auto !important;
    padding: 14px 14px 0 !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.07) !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    gap: 6px !important;
    flex-shrink: 0 !important;
    background: rgba(4,5,10,0.98) !important;
    scrollbar-width: none;
  }
  .lm-sidebar::-webkit-scrollbar { display: none; }

  /* Brand pill */
  .lm-sidebar-brand {
    display: flex !important;
    align-items: center !important;
    gap: 7px !important;
    padding: 8px 12px !important;
    background: rgba(0,229,255,0.07) !important;
    border: 1px solid rgba(0,229,255,0.2) !important;
    border-radius: 20px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin-bottom: 8px !important;
    font-size: 0.68rem !important;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    align-self: center !important;
  }
  .lm-sb-dot { width: 7px !important; height: 7px !important; border-radius: 50% !important; }

  /* Nav links as pills */
  .lm-nav-links {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: center !important;
  }
  .lm-nav-link {
    display: block !important;
    white-space: nowrap !important;
    padding: 7px 14px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 20px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    color: rgba(255,255,255,0.5) !important;
    text-decoration: none !important;
    transition: all 0.15s !important;
    letter-spacing: 0.03em !important;
    margin-bottom: 8px !important;
  }
  .lm-nav-link--active, .lm-nav-link:hover {
    background: rgba(0,229,255,0.1) !important;
    border-color: rgba(0,229,255,0.3) !important;
    color: #00e5ff !important;
  }
  /* Hide "Also See" section in collapsed tab bar */
  .lm-sidebar-other { display: none !important; }

  /* Body full width */
  .lm-body {
    width: 100% !important;
    min-width: 0 !important;
    border-left: none !important;
  }
  .lm-content {
    padding: 18px 16px 32px !important;
    max-height: calc(92vh - 110px) !important;
  }
  .lm-topbar {
    padding: 16px 16px 12px !important;
    gap: 10px !important;
  }
  .lm-topbar-icon {
    width: 36px !important;
    height: 36px !important;
    flex-shrink: 0 !important;
  }
  .lm-page-title { font-size: 1rem !important; }
  .lm-page-sub { font-size: 0.72rem !important; }
  .lm-close {
    width: 32px !important;
    height: 32px !important;
    flex-shrink: 0 !important;
  }

  /* Contact cards single column */
  .lm-contact-grid,
  .lm-contact-grid--wide {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .lm-contact-card { padding: 14px 14px !important; gap: 12px !important; }
  .lm-cc-icon { width: 36px !important; height: 36px !important; flex-shrink: 0 !important; }
  .lm-cc-label { font-size: 0.68rem !important; }
  .lm-cc-val { font-size: 0.82rem !important; word-break: break-all !important; }
  .lm-cc-primary-badge { font-size: 0.55rem !important; padding: 3px 8px !important; }

  /* Sections */
  .lm-section { gap: 12px !important; padding: 14px 0 !important; }
  .lm-section-icon { width: 36px !important; height: 36px !important; flex-shrink: 0 !important; }
  .lm-section-title { font-size: 0.88rem !important; }
  .lm-section-text { font-size: 0.82rem !important; line-height: 1.6 !important; }

  /* Hero card */
  .lm-hero-card { padding: 16px !important; }
  .lm-hero-text { font-size: 0.82rem !important; line-height: 1.6 !important; }
  .lm-hero-stat-row { gap: 10px !important; }
  .lm-stat-num { font-size: 1.3rem !important; }

  /* Highlight bar */
  .lm-highlight-bar { padding: 12px 14px !important; font-size: 0.82rem !important; gap: 10px !important; }
  .lm-highlight-bar svg { width: 18px !important; height: 18px !important; flex-shrink: 0 !important; }

  /* Tag row wraps nicely */
  .lm-tag-row { gap: 6px !important; flex-wrap: wrap !important; }
  .lm-tag { font-size: 0.68rem !important; padding: 4px 10px !important; }

  /* CTA button full width */
  .lm-cta-btn { width: 100% !important; padding: 14px !important; font-size: 0.9rem !important; }

  /* VGWA card */
  .lm-vgwa-card { flex-direction: column !important; padding: 16px !important; gap: 12px !important; }

  /* Footer logos */
  .lm-logos-row { padding: 14px 0 4px !important; gap: 12px !important; }
  .lm-footer-logo { height: 26px !important; }

  /* Response time */
  #contact-time .lm-section-icon { width: 32px !important; height: 32px !important; }
}

/* ── Dropdown footer email link ── */
.dd-footer-email {
  display: block;
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  color: rgba(0,229,255,0.5);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.dd-footer-email:hover { color: rgba(0,229,255,0.85); }

/* ── Hub footer: wrap email nicely on mobile ── */
@media (max-width: 480px) {
  .footer-links {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: center !important;
  }
  .footer-divider { display: none !important; }
  .footer-link { font-size: 0.75rem !important; padding: 6px 14px !important; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   DUELZONE — UNIFIED BUTTON SYSTEM v2
   Single source of truth for every button across hub + all game setups.
   Placed at the end so it always wins specificity cleanly.
   ═══════════════════════════════════════════════════════════════════════════

   DESIGN TOKENS
   ─────────────
   --btn-radius-pill  : pill shape — hub PLAY cards, back navigation
   --btn-radius-base  : chip shape — diff / mode selectors
   --btn-radius-block : rectangular — start / CTA blocks
   --btn-height       : universal minimum touch target
   --btn-font-main    : Orbitron  (headings / CTA)
   --btn-font-alt     : Rajdhani  (labels / secondary)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --btn-radius-pill  : 30px;
  --btn-radius-base  : 10px;
  --btn-radius-block : 14px;
  --btn-height       : 44px;
  --btn-font-main    : 'Orbitron', sans-serif;
  --btn-font-alt     : 'Rajdhani', sans-serif;
  --btn-transition   : all 0.22s cubic-bezier(0.23, 1, 0.32, 1);
}


/* ── § A  HUB PLAY BUTTONS  (.card-btn on arena-card) ─────────────────────
   Pill shape, accent-coloured border + subtle gradient fill.
   Consistent across all hub cards via --accent CSS variable.
   ────────────────────────────────────────────────────────────────────────── */

.arena-card .card-btn {
  /* Shape */
  border-radius: var(--btn-radius-pill) !important;
  /* Sizing */
  min-height: var(--btn-height);
  padding: 10px 22px !important;
  /* Typography */
  font-family: var(--btn-font-main) !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.16em !important;
  white-space: nowrap;
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  /* Interaction */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
  /* Colour — inherits from .card-btn which already uses --accent */
}

.arena-card .card-btn:active {
  transform: scale(0.96) !important;
  transition-duration: 0.08s !important;
}


/* ── § B  SETUP OPTION CHIPS  (.diff-btn, inside .diff-btn-group) ──────────
   Pill chips used for difficulty, mode, player-count, colour selectors.
   Every game's setup screen uses these — they must all look identical.
   ────────────────────────────────────────────────────────────────────────── */

.diff-btn {
  /* Shape */
  border-radius: var(--btn-radius-pill) !important;
  /* Sizing */
  min-height: var(--btn-height);
  padding: 9px 20px !important;
  /* Typography */
  font-family: var(--btn-font-alt) !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  white-space: nowrap;
  /* Appearance — inactive */
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.13) !important;
  color: rgba(255, 255, 255, 0.55) !important;
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
  position: relative;
  overflow: hidden;
}

/* Active / selected chip — uses the per-game accent */
.diff-btn.active {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ghp-accent, #00e5ff) 22%, transparent),
    color-mix(in srgb, var(--ghp-accent, #00e5ff)  9%, transparent)) !important;
  border-color: var(--ghp-accent, #00e5ff) !important;
  color: var(--ghp-accent, #00e5ff) !important;
  box-shadow:
    0 0 16px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 50%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--ghp-accent, #00e5ff) 18%, transparent) !important;
}

@media (hover: hover) {
  .diff-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.09) !important;
    border-color: rgba(255, 255, 255, 0.26) !important;
    color: rgba(255, 255, 255, 0.85) !important;
    transform: translateY(-1px);
  }
}

.diff-btn:active {
  transform: scale(0.96) !important;
  transition-duration: 0.07s !important;
}

/* The group container: wraps chips with consistent spacing */
.diff-btn-group {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
}

/* The label above a diff-btn-group */
.diff-label-text {
  font-family: 'DM Mono', monospace !important;
  font-size: 0.62rem !important;
  letter-spacing: 0.28em !important;
  color: var(--muted, #4a5080) !important;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

/* Setting row = label + group */
.ghp-setting-row {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  width: 100%;
}


/* ── § C  MODE SELECTOR CARDS  (.ghp-mode-btn) ─────────────────────────────
   Larger icon+label cards used by Tetris, Carrom, Reaction Duel, etc.
   Standardised size and feel while keeping the icon-card aesthetic.
   ────────────────────────────────────────────────────────────────────────── */

.ghp-mode-btn {
  /* Shape */
  border-radius: var(--btn-radius-base) !important;
  /* Sizing */
  min-height: 72px !important;
  padding: 14px 12px !important;
  /* Layout */
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  flex: 1 !important;
  /* Appearance — inactive */
  background: rgba(255, 255, 255, 0.04) !important;
  border: 2px solid rgba(255, 255, 255, 0.10) !important;
  /* Interaction */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
}

.ghp-mode-btn.active {
  border-color: var(--ghp-accent, #00e5ff) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 0 20px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 40%, transparent),
    inset 0 0 20px -8px color-mix(in srgb, var(--ghp-accent, #00e5ff) 12%, transparent) !important;
}

.ghp-mode-btn.active .mode-label {
  color: var(--ghp-accent, #00e5ff) !important;
}

@media (hover: hover) {
  .ghp-mode-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
  }
}


/* ── § D  CTA START BUTTON  (.ghp-start-btn) ───────────────────────────────
   The big "▶ START GAME" block button. Full-width, solid accent fill.
   ────────────────────────────────────────────────────────────────────────── */

.ghp-start-btn {
  /* Shape */
  border-radius: var(--btn-radius-block) !important;
  /* Sizing */
  width: 100% !important;
  min-height: 56px !important;
  padding: 15px 20px !important;
  /* Typography */
  font-family: var(--btn-font-main) !important;
  font-size: 0.9rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.18em !important;
  color: #000 !important;
  /* Appearance */
  border: none !important;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ghp-accent, #00e5ff) 92%, #fff),
    color-mix(in srgb, var(--ghp-accent, #00e5ff) 72%, #000)) !important;
  box-shadow:
    0 4px 24px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 55%, transparent),
    0 1px 0 color-mix(in srgb, var(--ghp-accent, #00e5ff) 30%, transparent) inset !important;
  /* Layout */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  /* Interaction */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
  margin-top: 4px;
}

@media (hover: hover) {
  .ghp-start-btn:hover {
    transform: translateY(-2px) scale(1.01) !important;
    box-shadow:
      0 8px 32px -4px color-mix(in srgb, var(--ghp-accent, #00e5ff) 65%, transparent),
      0 1px 0 color-mix(in srgb, var(--ghp-accent, #00e5ff) 30%, transparent) inset !important;
  }
}

.ghp-start-btn:active {
  transform: scale(0.98) !important;
  transition-duration: 0.07s !important;
}

/* When two start buttons appear side by side (Chess, Darts) */
.ghp-start-btns {
  display: flex !important;
  gap: 10px !important;
  width: 100%;
  flex-wrap: wrap;
}

.ghp-start-btns .ghp-start-btn {
  flex: 1 !important;
  min-width: 120px;
}


/* ── § E  BACK / NAVIGATION BUTTONS ────────────────────────────────────────
   Used at top-left of every game screen. Ghost pill style.
   ────────────────────────────────────────────────────────────────────────── */

.ghp-back-hub,
.ghp-back-game,
.ghp-back-v2,
.dz-back-btn,
#cricket-back-btn,
#ttt-home-back,   #ttt-back-to-home,
#rps-home-back,   #rps-back-to-home,
#tap-home-back,   #tap-back-to-home,
#d2048-home-back, #d2048-back-to-home,
#c4-home-back,    #c4-back-to-home,
#pb-main-back,
#ah-main-back,
#sdk-back-hub {
  /* Shape */
  border-radius: var(--btn-radius-pill) !important;
  /* Sizing */
  min-height: 38px !important;
  padding: 7px 16px !important;
  /* Typography */
  font-family: var(--btn-font-alt) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  /* Appearance */
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: rgba(200, 212, 255, 0.75) !important;
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  width: fit-content !important;
  width: -moz-fit-content !important;
  flex-shrink: 0;
  /* Interaction */
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
  /* Position — keep absolute for standalone panels, see ludo override below */
  position: absolute !important;
  top: 72px !important;
  left: 16px !important;
  z-index: 20 !important;
}

@media (hover: hover) {
  .ghp-back-hub:hover,
  .ghp-back-game:hover,
  .ghp-back-v2:hover,
  .dz-back-btn:hover,
  #cricket-back-btn:hover, #ttt-home-back:hover, #ttt-back-to-home:hover,
  #rps-home-back:hover, #rps-back-to-home:hover,
  #tap-home-back:hover, #tap-back-to-home:hover,
  #d2048-home-back:hover, #d2048-back-to-home:hover,
  #c4-home-back:hover, #c4-back-to-home:hover,
  #pb-main-back:hover, #ah-main-back:hover, #sdk-back-hub:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    color: #fff !important;
    transform: translateX(-2px);
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   LUDO TOPBAR FIX
   The #ludo-play topbar uses .dz-topbar (display:flex, space-between).
   .ghp-back-hub and .ghp-back-game are globally position:absolute which
   removes them from the flex flow, causing them to float over the canvas
   and the topbar to appear visually empty.
   Override: inside that specific topbar, restore them to normal flex items.
   ═══════════════════════════════════════════════════════════════════════════ */

#ludo-play .dz-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 8px 14px !important;
  background: rgba(7, 8, 15, 0.95) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  flex-shrink: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  position: relative !important;  /* prevent sticky from breaking overflow:hidden */
  top: auto !important;
  z-index: 10 !important;
}

/* Re-anchor the back buttons to normal flex items inside ludo topbar */
#ludo-play .dz-topbar .ghp-back-hub,
#ludo-play .dz-topbar .ghp-back-game {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  align-self: center !important;
}

/* Hub button in ludo topbar — slightly muted, left side */
#ludo-play .dz-topbar .ghp-back-hub {
  color: rgba(255, 100, 100, 0.75) !important;
  border-color: rgba(255, 100, 100, 0.2) !important;
}

#ludo-play .dz-topbar .ghp-back-hub:hover {
  background: rgba(255, 23, 68, 0.12) !important;
  border-color: rgba(255, 23, 68, 0.4) !important;
  color: #ff5252 !important;
  transform: none !important;
}

/* Setup button in ludo topbar — right side */
#ludo-play .dz-topbar .ghp-back-game {
  color: rgba(200, 212, 255, 0.65) !important;
}

#ludo-play .dz-topbar .ghp-back-game:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #fff !important;
  transform: none !important;
}


/* ── § F  RESULT OVERLAY BUTTONS  (.ghp-result-btn-primary / secondary) ────
   Shown in the win/lose overlay after a game. Consistent pill sizing.
   ────────────────────────────────────────────────────────────────────────── */

.ghp-result-btn-primary {
  /* Shape */
  border-radius: var(--btn-radius-pill) !important;
  /* Sizing */
  min-height: var(--btn-height) !important;
  padding: 11px 28px !important;
  /* Typography */
  font-family: var(--btn-font-main) !important;
  font-size: 0.8rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
  color: #000 !important;
  /* Appearance */
  background: var(--rb-color, #00e676) !important;
  border: none !important;
  box-shadow: 0 4px 20px -4px color-mix(in srgb, var(--rb-color, #00e676) 50%, transparent) !important;
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
}

.ghp-result-btn-primary:active {
  transform: scale(0.96) !important;
  transition-duration: 0.07s !important;
}

.ghp-result-btn-secondary {
  /* Shape */
  border-radius: var(--btn-radius-pill) !important;
  /* Sizing */
  min-height: var(--btn-height) !important;
  padding: 11px 28px !important;
  /* Typography */
  font-family: var(--btn-font-main) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  color: rgba(255, 255, 255, 0.7) !important;
  /* Appearance */
  background: rgba(255, 255, 255, 0.07) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: var(--btn-transition) !important;
}

@media (hover: hover) {
  .ghp-result-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.13) !important;
    border-color: rgba(255, 255, 255, 0.32) !important;
    color: #fff !important;
  }
}

.ghp-result-btn-secondary:active {
  transform: scale(0.96) !important;
  transition-duration: 0.07s !important;
}


/* ── § G  MOBILE RESPONSIVE OVERRIDES ──────────────────────────────────────
   Ensure everything stays consistent and touch-friendly on small screens.
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

  /* Diff chips: slightly more compact padding */
  .diff-btn {
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    min-height: 42px !important;
  }

  /* Start button: always full-width, easy to tap */
  .ghp-start-btn {
    min-height: 52px !important;
    font-size: 0.84rem !important;
  }

  /* Mode cards: shorter on mobile */
  .ghp-mode-btn {
    min-height: 60px !important;
    padding: 10px 8px !important;
  }

  /* Result buttons: symmetrical sizing on phone */
  .ghp-result-btn-primary,
  .ghp-result-btn-secondary {
    padding: 12px 22px !important;
    font-size: 0.78rem !important;
  }

}

@media (max-width: 480px) {

  .diff-btn {
    padding: 7px 14px !important;
    font-size: 0.78rem !important;
    min-height: 40px !important;
  }

  .ghp-start-btn {
    min-height: 50px !important;
    font-size: 0.8rem !important;
    letter-spacing: 0.14em !important;
  }

  .ghp-mode-btn {
    min-height: 56px !important;
  }

  .ghp-mode-btn .mode-label {
    font-size: 0.66rem !important;
  }

  .ghp-mode-btn .mode-sub {
    font-size: 0.66rem !important;
  }

  /* Hub card play button */
  .arena-card .card-btn {
    padding: 8px 14px !important;
    font-size: 0.6rem !important;
  }

}

/* ── END UNIFIED BUTTON SYSTEM v2 ────────────────────────────────────────── */


/* ═══════════════════════════════════════════════════════════════════════════
   GAME UI FIXES  — Reaction Duel · Rock Paper Scissors · Connect Dots
   ═══════════════════════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════════════════════════
   § 1  REACTION DUEL — Full mobile overhaul
   All critical layout was inline; these rules override/fix.
   ══════════════════════════════════════════════════════════ */

/* Play panel — replace the inline position:fixed layout with
   a proper flex column that respects the topbar */
#rd-play {
  position: fixed !important;
  inset: 0 !important;
  background: #07080f !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
  z-index: 50 !important;
  padding: 0 !important; /* topbar handles its own padding */
  font-family: 'Rajdhani', sans-serif !important;
}

/* Topbar inside rd-play — same sticky strip as other games */
#rd-play .dz-topbar {
  width: 100% !important;
  align-self: stretch !important;
  flex-shrink: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background: rgba(7, 8, 15, 0.96) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  padding: 8px 14px !important;
}

/* Scroll content area below the topbar */
#rd-play > *:not(.dz-topbar) {
  flex-shrink: 0;
}

/* Title */
#rd-play > div[style*="text-align:center"] {
  margin-top: 12px !important;
  margin-bottom: 8px !important;
  padding: 0 16px;
}

/* Scores row */
#rd-play > div[style*="gap:40px"] {
  gap: clamp(16px, 6vw, 40px) !important;
  margin-bottom: 12px !important;
  font-size: clamp(0.85rem, 3vw, 1rem) !important;
  padding: 0 16px;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

/* Signal circle — was 260px fixed; make it responsive */
#rd-signal-bg {
  width:  min(220px, 60vw) !important;
  height: min(220px, 60vw) !important;
  margin-bottom: 14px !important;
  flex-shrink: 0;
}

#rd-signal-emoji {
  font-size: clamp(2.4rem, 10vw, 4rem) !important;
}

#rd-signal-text {
  font-size: clamp(1rem, 4vw, 1.4rem) !important;
  margin-top: 6px !important;
}

/* Status message */
#rd-status {
  font-size: clamp(0.85rem, 3.5vw, 1rem) !important;
  margin-bottom: 14px !important;
  padding: 0 16px;
  text-align: center;
}

/* TAP buttons — larger, full-width on mobile */
#rd-play > div[style*="gap:24px"] {
  display: flex !important;
  gap: clamp(10px, 3vw, 24px) !important;
  width: 100% !important;
  max-width: 440px !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}

#rd-tap-p1,
#rd-tap-p2 {
  flex: 1 !important;
  width: auto !important;
  height: clamp(60px, 16vw, 80px) !important;
  font-size: clamp(0.82rem, 3vw, 1rem) !important;
  border-radius: 14px !important;
  font-family: 'Orbitron', sans-serif !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 0.1s, box-shadow 0.1s !important;
  letter-spacing: 0.06em !important;
}

#rd-tap-p1:active { transform: scale(0.94) !important; }
#rd-tap-p2:active { transform: scale(0.94) !important; }

/* Keyboard hint */
#rd-play > div[style*="0.7rem"] {
  font-size: 0.65rem !important;
  margin-top: 8px !important;
  padding-bottom: 20px;
}

/* Result overlay — centred in viewport */
#rd-result {
  padding: 16px !important;
}

#rd-result > div {
  padding: 28px 24px !important;
  max-width: min(340px, 94vw) !important;
  width: 100% !important;
}

#rd-result-title {
  font-size: clamp(1.2rem, 5vw, 1.7rem) !important;
}


/* ══════════════════════════════════════════════════════════
   § 2  ROCK PAPER SCISSORS — Fix text overlap + logic UX
   ══════════════════════════════════════════════════════════ */

/* P2 win result — positive colour (green), NOT red "lose" */
#rps-result-text.p2win {
  color: #00e676;
}

/* In-game mode/bestof/diff controls — hide during active game.
   JS adds .rps-game-active to #rps-app when a round is in progress. */
#rps-app.rps-game-active .game-mode-selector,
#rps-app.rps-game-active #rps-bestof-selector,
#rps-app.rps-game-active #rps-difficulty-selector,
#rps-app.rps-game-active .game-header {
  display: none !important;
}

/* Play panel — full-height scrollable column */
/* FIX: use :not(.hidden) so the ID selector never overrides .hidden {display:none} */
#rps-play-panel:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  min-height: 100dvh !important;
  padding: 0 !important;
}

#rps-app {
  width: 100% !important;
  max-width: 480px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 14px !important;
  /* BUG 3 FIX: was 12px — scorecards were hidden under the fixed hamburger button
     (top:16px + height:44px = 60px bottom edge, +12px gap = 72px clearance needed).
     Also overrides the inline style="padding-top:54px" on #rps-app in HTML which
     was itself insufficient (54px < 60px hamburger bottom edge). */
  padding: 72px 16px 32px !important;
  box-sizing: border-box !important;
}

/* ── RPS pick buttons — fix label overflow ── */
.rps-btn-row {
  display: flex !important;
  gap: clamp(6px, 2.5vw, 12px) !important;
  width: 100% !important;
}

.rps-btn {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding: clamp(12px, 4vw, 20px) clamp(4px, 1.5vw, 8px) !important;
  border-radius: 14px !important;
  min-width: 0 !important;   /* allow flex shrink */
  overflow: hidden !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: background 0.15s, border-color 0.15s, transform 0.1s !important;
}

/* Emoji: responsive size */
.rps-btn > span:first-child,
.rps-btn .rps-btn-emoji {
  font-size: clamp(1.6rem, 6vw, 2.4rem) !important;
  line-height: 1 !important;
  display: block !important;
}

/* Text label under emoji — NEVER overflow/wrap oddly */
.rps-btn span:not(:first-child),
.rps-btn span:last-child {
  font-size: clamp(0.52rem, 1.8vw, 0.72rem) !important;
  letter-spacing: 0.08em !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  display: block !important;
  text-align: center !important;
}

.rps-btn:active {
  transform: scale(0.96) !important;
  transition-duration: 0.07s !important;
}

/* Choices display area */
#rps-choices-display {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 14px 12px !important;
  min-height: 90px !important;
  box-sizing: border-box !important;
}

.rps-choice-box {
  flex: 1 !important;
  min-width: 0 !important;
}

.rps-choice-emoji {
  font-size: clamp(1.8rem, 7vw, 2.8rem) !important;
}

#rps-result-text {
  flex-shrink: 0 !important;
  font-size: clamp(1rem, 4vw, 1.4rem) !important;
  min-width: clamp(52px, 15vw, 80px) !important;
  text-align: center !important;
}

/* Scorecards */
#rps-scorecards {
  width: 100% !important;
  gap: 8px !important;
}

.rps-scorecard {
  padding: 12px 8px !important;
}

/* Pick prompt text */
.rps-pick-prompt {
  font-size: clamp(0.68rem, 2.5vw, 0.8rem) !important;
  letter-spacing: 0.08em !important;
}


/* ══════════════════════════════════════════════════════════
   § 3  CONNECT DOTS DUEL — Complete UI overhaul
   ══════════════════════════════════════════════════════════ */

/* ── Whole play wrapper ── */
/* FIX: use :not(.hidden) so .hidden { display:none !important } is never
   overridden. Both rules are !important with equal specificity (one class
   each); the last declaration wins in CSS — scoping to :not(.hidden) means
   this display:flex only applies when the panel is actually visible. */
.cdd-play-wrap:not(.hidden) {
  display: flex !important;
}
.cdd-play-wrap {
  min-height: 100dvh !important;
  flex-direction: column !important;
  align-items: center !important;
  background: linear-gradient(160deg, #05071a 0%, #0a0d20 60%, #070b18 100%) !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  position: relative !important;
}

/* ── App column ── */
#cdd-app {
  width: 100% !important;
  max-width: 560px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 14px 24px !important;
  box-sizing: border-box !important;
  flex: 1 !important;
}

/* ── Header: title + mode label, single row ── */
#cdd-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  /* BUG 5 FIX: was padding: 4px 2px 0 which overrode the inline padding-top:54px.
     Hamburger is top:16px + height:44px = 60px bottom edge; +12px gap = 72px needed. */
  padding: 72px 2px 0 !important;
}

#cdd-title {
  font-family: 'Orbitron', sans-serif !important;
  font-size: clamp(0.9rem, 3.5vw, 1.2rem) !important;
  font-weight: 900 !important;
  margin: 0 !important;
  background: linear-gradient(90deg, var(--cdd-accent), #ffcc80) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

#cdd-mode-label {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.18em !important;
  color: var(--cdd-accent) !important;
  opacity: 0.8 !important;
  text-transform: uppercase !important;
  margin: 0 !important;
  background: rgba(255,145,0,0.12) !important;
  border: 1px solid rgba(255,145,0,0.25) !important;
  border-radius: 20px !important;
  padding: 2px 10px !important;
}

/* ── Scoreboard: horizontal, card + vs + card ── */
#cdd-scoreboard {
  display: flex !important;
  align-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
}

.cdd-score-card {
  flex: 1 !important;
  background: rgba(255,255,255,0.04) !important;
  border: 1.5px solid rgba(255,255,255,0.08) !important;
  border-radius: 12px !important;
  padding: 10px 8px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 2px !important;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s !important;
}

.cdd-score-card.cdd-active-p1 {
  background: rgba(96,165,250,0.09) !important;
  border-color: var(--cdd-p1) !important;
  box-shadow: 0 0 16px -4px var(--cdd-p1-glow) !important;
}

.cdd-score-card.cdd-active-p2 {
  background: rgba(251,113,133,0.09) !important;
  border-color: var(--cdd-p2) !important;
  box-shadow: 0 0 16px -4px var(--cdd-p2-glow) !important;
}

.cdd-player-label {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
}

.cdd-score-val {
  font-family: 'Orbitron', sans-serif !important;
  font-size: clamp(1.6rem, 5vw, 2.2rem) !important;
  font-weight: 900 !important;
  color: #f1f5f9 !important;
  line-height: 1 !important;
}

#cdd-vs-wrap {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  width: 32px !important;
}

.cdd-vs {
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.72rem !important;
  font-weight: 900 !important;
  color: rgba(255,255,255,0.2) !important;
  letter-spacing: 0.08em !important;
}

/* ── Turn indicator ── */
#cdd-turn-banner {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
}

#cdd-turn-indicator {
  padding: 8px 24px !important;
  border-radius: 30px !important;
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  transition: border-color 0.3s, color 0.3s, background 0.3s, box-shadow 0.3s !important;
  border: 1.5px solid rgba(255,255,255,0.1) !important;
  background: rgba(255,255,255,0.03) !important;
  color: #94a3b8 !important;
}

/* ── Grid wrap — responsive, centered, never overflows ── */
#cdd-grid-wrap {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 4px 0 !important;
  overflow: visible !important;
  /* Let grid set its own size; wrapper just centers it */
  flex-shrink: 0 !important;
}

#cdd-grid {
  /* JS sets column/row sizes via style. CSS ensures it fits viewport. */
  max-width: min(500px, calc(100vw - 28px)) !important;
  max-height: min(500px, calc(100vw - 28px)) !important;
  user-select: none !important;
  touch-action: none !important;
}

/* ── Line hit-targets: larger on touch ── */
@media (pointer: coarse) {
  .cdd-line.h-line::before {
    top:    -16px !important;
    bottom: -16px !important;
  }
  .cdd-line.v-line::before {
    left:  -16px !important;
    right: -16px !important;
  }
  /* Slightly thicker visual lines on mobile */
  .cdd-line.h-line::after {
    height: 9px !important;
  }
  .cdd-line.v-line::after {
    width: 9px !important;
  }
}

/* ── Controls row (Reset button) ── */
#cdd-controls {
  display: flex !important;
  gap: 10px !important;
  justify-content: center !important;
  width: 100% !important;
}

#cdd-reset-btn {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  padding: 10px 28px !important;
  border-radius: 30px !important;
  background: rgba(255,145,0,0.10) !important;
  border: 1.5px solid rgba(255,145,0,0.3) !important;
  color: var(--cdd-accent) !important;
  cursor: pointer !important;
  text-transform: uppercase !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: background 0.2s, transform 0.1s !important;
  min-height: 44px !important;
}

#cdd-reset-btn:hover { background: rgba(255,145,0,0.18) !important; }
#cdd-reset-btn:active { transform: scale(0.96) !important; }

/* ── Result overlay ── */
#cdd-result-inner {
  background: linear-gradient(160deg, #0d1029, #10142e) !important;
  border: 1.5px solid rgba(255,145,0,0.3) !important;
  border-radius: 20px !important;
  padding: clamp(20px, 6vw, 32px) clamp(16px, 5vw, 28px) !important;
  max-width: min(320px, 92vw) !important;
  width: 100% !important;
  box-shadow: 0 0 60px -12px rgba(255,145,0,0.3) !important;
}

#cdd-result-icon {
  font-size: clamp(2rem, 7vw, 2.8rem) !important;
  margin-bottom: 10px !important;
}

#cdd-result-title {
  font-family: 'Orbitron', sans-serif !important;
  font-size: clamp(1rem, 4vw, 1.3rem) !important;
  font-weight: 900 !important;
  color: #f1f5f9 !important;
  margin-bottom: 8px !important;
}

#cdd-result-scores {
  font-family: 'Rajdhani', sans-serif !important;
  font-size: clamp(0.85rem, 3vw, 0.95rem) !important;
  color: #94a3b8 !important;
  margin-bottom: 20px !important;
  line-height: 1.5 !important;
}

#cdd-result-btns {
  display: flex !important;
  gap: 10px !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
}

/* Play Again — accent solid fill */
#cdd-play-again {
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.06em !important;
  padding: 11px 22px !important;
  border-radius: 30px !important;
  border: none !important;
  background: linear-gradient(135deg, var(--cdd-accent), #ffcc02) !important;
  color: #000 !important;
  cursor: pointer !important;
  min-height: 44px !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: transform 0.15s, filter 0.15s !important;
  box-shadow: 0 4px 20px -4px rgba(255,145,0,0.5) !important;
}
#cdd-play-again:hover { filter: brightness(1.1) !important; transform: translateY(-1px) !important; }
#cdd-play-again:active { transform: scale(0.96) !important; }

/* Hub button — ghost pill */
#cdd-result-hub {
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  padding: 11px 22px !important;
  border-radius: 30px !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1.5px solid rgba(255,255,255,0.15) !important;
  color: rgba(255,255,255,0.7) !important;
  cursor: pointer !important;
  min-height: 44px !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  transition: background 0.2s, border-color 0.2s !important;
}
#cdd-result-hub:hover { background: rgba(255,255,255,0.12) !important; border-color: rgba(255,255,255,0.3) !important; }
#cdd-result-hub:active { transform: scale(0.96) !important; }

/* ── CDD mobile overrides ── */
@media (max-width: 480px) {
  #cdd-app {
    padding: 8px 10px 20px !important;
    gap: 8px !important;
  }

  .cdd-score-card {
    padding: 8px 6px !important;
    border-radius: 10px !important;
  }

  .cdd-player-label {
    font-size: 0.6rem !important;
  }

  .cdd-score-val {
    font-size: 1.5rem !important;
  }

  #cdd-turn-indicator {
    font-size: 0.78rem !important;
    padding: 7px 18px !important;
  }

  #cdd-reset-btn {
    font-size: 0.78rem !important;
    padding: 9px 22px !important;
  }
}

/* ── END GAME UI FIXES ── */

/* ══════════════════════════════════════════════════════════════
   IN-GAME FLOATING MENU BUTTON
   ══════════════════════════════════════════════════════════════ */
.dz-ig-menu-btn {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 9500;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(13, 15, 28, 0.92);
  border: 1.5px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.55);
}
.dz-ig-menu-btn:hover {
  background: rgba(0,229,255,0.12);
  border-color: rgba(0,229,255,0.45);
}
.dz-ig-menu-btn.open {
  background: rgba(0,229,255,0.18);
  border-color: rgba(0,229,255,0.6);
}
.igm-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}
.igm-line {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.82);
  transition: all 0.25s ease;
  transform-origin: center;
}
.dz-ig-menu-btn.open .igm-line:first-child  { transform: translateY(7px) rotate(45deg); background: #00e5ff; }
.dz-ig-menu-btn.open .igm-line--mid          { opacity: 0; transform: scaleX(0); }
.dz-ig-menu-btn.open .igm-line--bot          { transform: translateY(-7px) rotate(-45deg); background: #00e5ff; }

/* ══ SIDE PANEL ══ */
.dz-ig-menu {
  position: fixed;
  top: 0; left: 0;
  width: 270px;
  height: 100dvh;
  z-index: 9600;
  background: linear-gradient(160deg, #0b0d1a 0%, #0f1120 100%);
  border-right: 1px solid rgba(255,255,255,0.09);
  box-shadow: 6px 0 40px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.dz-ig-menu.open { transform: translateX(0); }

.igm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.igm-header-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg,#00e5ff,#0055ff);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.68rem; font-weight: 900;
  color: #fff; letter-spacing: 0.04em;
  flex-shrink: 0;
}
.igm-header-title {
  flex: 1;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.55);
}
.igm-close-x {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.38); padding: 4px;
  border-radius: 6px; display: flex; align-items: center;
  transition: color 0.18s;
}
.igm-close-x:hover { color: rgba(255,255,255,0.85); }
.igm-close-x svg { width: 16px; height: 16px; }

.igm-body {
  flex: 1; padding: 14px 10px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
}

.igm-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
  text-align: left;
}
.igm-item:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.14); transform: translateX(3px); }
.igm-item:active { transform: translateX(1px); }

#igm-hub-btn:hover   { background: rgba(0,229,255,0.08); border-color: rgba(0,229,255,0.3); }
#igm-hub-btn:hover   .igm-item-icon { background: rgba(0,229,255,0.15); color: #00e5ff; }
#igm-setup-btn:hover { background: rgba(170,0,255,0.08); border-color: rgba(170,0,255,0.3); }
#igm-setup-btn:hover .igm-item-icon { background: rgba(170,0,255,0.15); color: #aa00ff; }
#igm-volume-btn:hover { background: rgba(0,230,118,0.08); border-color: rgba(0,230,118,0.3); }
#igm-volume-btn:hover .igm-item-icon { background: rgba(0,230,118,0.15); color: #00e676; }

.igm-item-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6); flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}
.igm-item-icon svg { width: 17px; height: 17px; }
.igm-item-label { flex: 1; font-family: 'Rajdhani', sans-serif; font-size: 0.95rem; font-weight: 600; color: rgba(255,255,255,0.82); letter-spacing: 0.03em; }
.igm-item-arrow { color: rgba(255,255,255,0.22); font-size: 1.1rem; flex-shrink: 0; }

.igm-vol-toggle {
  font-family: 'Orbitron', sans-serif; font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.08em; color: #00e676;
  background: rgba(0,230,118,0.1); border: 1px solid rgba(0,230,118,0.28);
  border-radius: 5px; padding: 2px 7px; flex-shrink: 0;
  transition: all 0.2s;
}
.igm-vol-toggle.off { color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); }

.igm-footer {
  padding: 12px 14px;
  font-family: 'Rajdhani', sans-serif; font-size: 0.67rem;
  color: rgba(255,255,255,0.18); letter-spacing: 0.08em;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0; text-align: center;
}

.dz-ig-menu-backdrop {
  position: fixed; inset: 0; z-index: 9550;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.28s;
}
.dz-ig-menu-backdrop.active { opacity: 1; pointer-events: auto; }

@media (max-width: 480px) {
  .dz-ig-menu { width: 250px; }
  .dz-ig-menu-btn { top: 8px; left: 8px; width: 40px; height: 40px; }
}






/* ═══════════════════════════════════════════════════════════════
   DUELZONE — DEFINITIVE MENU & UI OVERRIDES
   Single source of truth — these rules win over everything above.
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. Hub hamburger button: fixed top-left ─────────────────── */
#dz-hamburger,
.hamburger-btn {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  bottom: auto !important;
  z-index: 1100 !important;
}

/* ─── 2. Hub left-slide panel ─────────────────────────────────── */
#dz-dropdown,
.dz-dropdown {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  bottom: 0 !important;
  width: 290px !important;
  max-width: 88vw !important;
  height: 100dvh !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  border-right: 1px solid rgba(255,255,255,0.09) !important;
  background: linear-gradient(160deg, #0b0d1a 0%, #0f1120 100%) !important;
  box-shadow: 6px 0 48px rgba(0,0,0,0.75) !important;
  z-index: 1090 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateX(-100%) !important;
  transform-origin: left center !important;
  transition: opacity 0.28s ease, transform 0.3s cubic-bezier(0.4,0,0.2,1), visibility 0.28s !important;
  pointer-events: none !important;
}
#dz-dropdown.open,
.dz-dropdown.open {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateX(0) !important;
  pointer-events: auto !important;
}
#dz-menu-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1085 !important;
  background: rgba(0,0,0,0.55) !important;
  backdrop-filter: blur(3px) !important;
  -webkit-backdrop-filter: blur(3px) !important;
  display: none !important;
}
#dz-menu-backdrop.active { display: block !important; }

/* ─── 3. In-game menu button ──────────────────────────────────── */
#dz-ig-menu-btn {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  z-index: 1100 !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 10px !important;
  background: rgba(13,15,28,0.92) !important;
  border: 1.5px solid rgba(255,255,255,0.15) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  cursor: pointer !important;
  display: none !important;           /* shown only in games via body.dz-in-game */
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.55) !important;
  transition: background 0.2s, border-color 0.2s !important;
  padding: 0 !important;
  flex-direction: column !important;
}
#dz-ig-menu-btn:hover  { background: rgba(0,229,255,0.12) !important; border-color: rgba(0,229,255,0.45) !important; }
#dz-ig-menu-btn.open   { background: rgba(0,229,255,0.18) !important; border-color: rgba(0,229,255,0.6) !important; }
#dz-ig-menu-btn .igm-lines {
  display: flex !important; flex-direction: column !important;
  gap: 5px !important; width: 20px !important; align-items: center !important;
}
#dz-ig-menu-btn .igm-line {
  display: block !important; width: 20px !important; height: 2px !important;
  border-radius: 2px !important; background: rgba(255,255,255,0.85) !important;
  transition: all 0.25s ease !important; transform-origin: center !important;
}
#dz-ig-menu-btn.open .igm-line:first-child { transform: translateY(7px) rotate(45deg) !important; background: #00e5ff !important; }
#dz-ig-menu-btn.open .igm-line--mid        { opacity: 0 !important; transform: scaleX(0) !important; }
#dz-ig-menu-btn.open .igm-line--bot        { transform: translateY(-7px) rotate(-45deg) !important; background: #00e5ff !important; }

/* ── Hide game menu btn on hub, show hamburger on hub ──────────
   Pure CSS — no JS needed. Uses the :not(.hidden) state of screen-hub.
   When #screen-hub is visible (!.hidden), the game btn hides.
   When #screen-hub is hidden, the game btn shows. ──────────── */

/* Game btn hidden when hub is active */
#screen-hub:not(.hidden) ~ * #dz-ig-menu-btn,
body:has(#screen-hub:not(.hidden)) #dz-ig-menu-btn {
  display: none !important;
}

/* Hub hamburger hidden when a game screen is active */
body:has([id^="screen-"]:not(#screen-hub):not(.hidden)) #dz-hamburger {
  display: none !important;
}

/* ─── 4. In-game slide panel ──────────────────────────────────── */
#dz-ig-menu {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 270px !important; max-width: 88vw !important; height: 100dvh !important;
  z-index: 10500 !important;
  background: linear-gradient(160deg, #0b0d1a 0%, #0f1120 100%) !important;
  border-right: 1px solid rgba(255,255,255,0.09) !important;
  box-shadow: 6px 0 48px rgba(0,0,0,0.8) !important;
  display: flex !important; flex-direction: column !important;
  transform: translateX(-100%) !important;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1) !important;
  overflow-y: auto !important; overflow-x: hidden !important;
}
#dz-ig-menu.open { transform: translateX(0) !important; }

/* In-game panel internals */
.igm-header {
  display: flex !important; align-items: center !important; gap: 10px !important;
  padding: 16px 14px !important;
  background: rgba(255,255,255,0.03) !important;
  border-bottom: 1px solid rgba(255,255,255,0.07) !important;
  flex-shrink: 0 !important;
}
.igm-header-logo {
  width: 34px !important; height: 34px !important; border-radius: 8px !important;
  background: linear-gradient(135deg,#00e5ff,#0055ff) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.68rem !important; font-weight: 900 !important;
  color: #fff !important; flex-shrink: 0 !important; letter-spacing: 0.04em !important;
}
.igm-header-title {
  flex: 1 !important; font-family: 'Orbitron', sans-serif !important;
  font-size: 0.62rem !important; font-weight: 700 !important;
  letter-spacing: 0.18em !important; color: rgba(255,255,255,0.55) !important;
}
.igm-close-x {
  background: none !important; border: none !important; cursor: pointer !important;
  color: rgba(255,255,255,0.38) !important; padding: 4px !important;
  border-radius: 6px !important; display: flex !important; align-items: center !important;
  transition: color 0.18s !important;
}
.igm-close-x:hover { color: rgba(255,255,255,0.9) !important; }
.igm-close-x svg   { width: 16px !important; height: 16px !important; }
.igm-body {
  flex: 1 !important; padding: 16px 10px !important;
  display: flex !important; flex-direction: column !important;
  gap: 8px !important; overflow-y: auto !important;
}
.igm-item {
  display: flex !important; align-items: center !important; gap: 12px !important;
  width: 100% !important; padding: 14px 12px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,0.07) !important;
  background: rgba(255,255,255,0.03) !important;
  cursor: pointer !important;
  transition: background 0.18s, border-color 0.18s, transform 0.12s !important;
  text-align: left !important; color: inherit !important;
  font-family: inherit !important; box-sizing: border-box !important;
}
.igm-item:hover { background: rgba(255,255,255,0.07) !important; border-color: rgba(255,255,255,0.14) !important; transform: translateX(3px) !important; }
#igm-hub-btn:hover    { background: rgba(0,229,255,0.08)   !important; border-color: rgba(0,229,255,0.3)   !important; }
#igm-setup-btn:hover  { background: rgba(170,0,255,0.08)   !important; border-color: rgba(170,0,255,0.3)   !important; }
#igm-volume-btn:hover { background: rgba(0,230,118,0.08)   !important; border-color: rgba(0,230,118,0.3)   !important; }
#igm-hub-btn:hover    .igm-item-icon { background: rgba(0,229,255,0.15)   !important; color: #00e5ff  !important; }
#igm-setup-btn:hover  .igm-item-icon { background: rgba(170,0,255,0.15)   !important; color: #aa00ff  !important; }
#igm-volume-btn:hover .igm-item-icon { background: rgba(0,230,118,0.15)   !important; color: #00e676  !important; }
.igm-item-icon {
  width: 36px !important; height: 36px !important; border-radius: 8px !important;
  background: rgba(255,255,255,0.06) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  color: rgba(255,255,255,0.6) !important; flex-shrink: 0 !important;
  transition: background 0.18s, color 0.18s !important;
}
.igm-item-icon svg { width: 17px !important; height: 17px !important; }
.igm-item-label {
  flex: 1 !important; font-family: 'Rajdhani', sans-serif !important;
  font-size: 1rem !important; font-weight: 600 !important;
  color: rgba(255,255,255,0.85) !important; letter-spacing: 0.03em !important;
}
.igm-item-arrow { color: rgba(255,255,255,0.22) !important; font-size: 1.1rem !important; flex-shrink: 0 !important; }
.igm-vol-toggle {
  font-family: 'Orbitron', sans-serif !important;
  font-size: 0.6rem !important; font-weight: 700 !important; letter-spacing: 0.08em !important;
  color: #00e676 !important; background: rgba(0,230,118,0.1) !important;
  border: 1px solid rgba(0,230,118,0.28) !important;
  border-radius: 5px !important; padding: 3px 8px !important; flex-shrink: 0 !important;
  transition: all 0.2s !important;
}
.igm-vol-toggle.off {
  color: rgba(255,255,255,0.3) !important; background: rgba(255,255,255,0.04) !important;
  border-color: rgba(255,255,255,0.1) !important;
}
.igm-footer {
  padding: 14px !important; font-family: 'Rajdhani', sans-serif !important;
  font-size: 0.67rem !important; color: rgba(255,255,255,0.18) !important;
  letter-spacing: 0.08em !important;
  border-top: 1px solid rgba(255,255,255,0.05) !important;
  flex-shrink: 0 !important; text-align: center !important;
}
#dz-ig-menu-backdrop {
  position: fixed !important; inset: 0 !important; z-index: 10490 !important;
  background: rgba(0,0,0,0.6) !important;
  backdrop-filter: blur(3px) !important; -webkit-backdrop-filter: blur(3px) !important;
  opacity: 0 !important; pointer-events: none !important; transition: opacity 0.28s !important;
}
#dz-ig-menu-backdrop.active { opacity: 1 !important; pointer-events: auto !important; }

/* ─── 5. Z-index stack ────────────────────────────────────────── */
#dz-portrait-warn                    { z-index: 100000 !important; }
#dz-ad-overlay, #dz-ad-interstitial  { z-index: 99999  !important; }
#dz-loading-overlay, #launch-overlay { z-index: 50000  !important; }
.lm-modal                            { z-index: 11000  !important; }
#dz-legal-backdrop                   { z-index: 10900  !important; }
.dz-side-panel                       { z-index: 1095   !important; }
#dz-splash                           { z-index: 99990  !important; }

/* ─── 6. Hide ALL in-game nav buttons — menu handles navigation ─ */
/* The buttons remain in DOM for JS to call .click() programmatically */

.ghp-back-hub,
.ghp-back-v2,
.ghp-back-game,
.dz-topbar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  position: absolute !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Standalone hub/setup buttons in result & control areas */
#pb-back-hub, #mfd-hub-btn,
#chess-result-hub, #chess-setup-btn,
#bs-hub-btn, #bs-hub-btn2, #bs-setup-btn,
#ck-hub-btn, #ck-hub-btn2, #ck-setup-btn,
#darts-result-hub,
#pp-hub-btn, #pp-hub-top-btn,
#tetris-result-hub,
#rd-result-hub,
#ludo-result-hub,
#carrom-result-hub,
#sdk-result-hub,
#cricket-hub-btn,
.card-setup-btn,
.ah-back-btn {
  display: none !important;
  pointer-events: none !important;
}

/* ─── 7. Game home panels: top padding so content clears menu btn  */
.game-home-panel {
  padding-top: 70px !important;
  box-sizing: border-box !important;
}
.ghp-wrap {
  padding-top: 0 !important;
}

/* ─── 8. Fix Ping Pong layout ─────────────────────────────────── */
#pp-header {
  min-height: 0 !important;
  padding: 0 !important;
}
#pp-wrap {
  padding-top: 0 !important;
}

/* ─── 9. Fix AH scorebar so back btn gap is gone ──────────────── */
.ah-scorebar {
  padding-left: 14px !important;
}

/* ─── 10. Fix Battleship/Checkers outer screens ──────────────── */
#screen-battleship,
#screen-checkers {
  padding-top: 0 !important;
}

/* ── Cricket, Battleship, Checkers — scroll from top ── */
/* FIX: use :not(.hidden) so .hidden {display:none} is never overridden */
#cricket-app,
#cricket-setup:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 100dvh !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  padding-top: 62px !important;
  padding-bottom: 32px !important;
}

#bs-app,
#ck-app {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 100dvh !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

/* ── Game home panel: always from top, scrollable ── */
.game-home-panel {
  justify-content: flex-start !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100dvh !important;
  scroll-behavior: smooth !important;
}

/* ── ghp-wrap: centered column content starting at top ── */
.ghp-wrap {
  width: 100% !important;
  max-width: 520px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding-bottom: 32px !important;
}

/* ─── 11. Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  #dz-hamburger, .hamburger-btn, #dz-ig-menu-btn {
    top: 10px !important;
    left: 10px !important;
    width: 40px !important;
    height: 40px !important;
  }
  #dz-dropdown, .dz-dropdown, #dz-ig-menu {
    width: 84vw !important;
    max-width: 300px !important;
  }
  .game-home-panel {
    padding-top: 60px !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   DUELZONE — COMPREHENSIVE UI FIX PATCH
   Applied: scrollbar removal + all broken layout fixes
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Force-hide ALL scrollbars (belt & suspenders) ──── */
html, body,
.game-home-panel, .ghp-wrap, .lm-content, .lm-sidebar,
.dz-dropdown, #dz-dropdown, .dz-side-panel,
.panel-list, #chess-move-list, #screen-hub,
.pb-history, #cdd-grid-wrap, .lm-shell,
#cricket-app, #cricket-setup, #bs-app, #ck-app,
.mfd-play-wrap, .cdd-play-wrap, .chess-play-wrap,
#ludo-app, #sdk-play, #carrom-play, #tetris-play, #rd-play {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.game-home-panel::-webkit-scrollbar,
.ghp-wrap::-webkit-scrollbar,
.lm-content::-webkit-scrollbar,
.lm-sidebar::-webkit-scrollbar,
.dz-dropdown::-webkit-scrollbar,
#dz-dropdown::-webkit-scrollbar,
.dz-side-panel::-webkit-scrollbar,
.panel-list::-webkit-scrollbar,
#chess-move-list::-webkit-scrollbar,
#screen-hub::-webkit-scrollbar,
.pb-history::-webkit-scrollbar,
#cdd-grid-wrap::-webkit-scrollbar,
.lm-shell::-webkit-scrollbar,
#cricket-app::-webkit-scrollbar,
#bs-app::-webkit-scrollbar,
#ck-app::-webkit-scrollbar,
#ludo-app::-webkit-scrollbar,
#sdk-play::-webkit-scrollbar,
#carrom-play::-webkit-scrollbar,
#tetris-play::-webkit-scrollbar,
#rd-play::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* ── 2. Portrait warning overlay — base styles ─────────── */
#dz-portrait-warn {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(4,6,18,0.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 24px;
  text-align: center;
}

.pw-icon {
  font-size: 3.5rem;
  animation: pwBounce 1.4s ease-in-out infinite;
}
@keyframes pwBounce {
  0%,100% { transform: rotate(-15deg); }
  50%      { transform: rotate(15deg); }
}
.pw-accent-line {
  width: 56px; height: 3px;
  background: linear-gradient(90deg, #00e5ff, #aa00ff);
  border-radius: 2px;
}
.pw-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
  color: #fff;
  letter-spacing: 0.1em;
}
.pw-sub {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.55);
  max-width: 280px;
  line-height: 1.5;
}
.pw-skip {
  margin-top: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.pw-skip:hover {
  background: rgba(0,229,255,0.1);
  border-color: rgba(0,229,255,0.35);
  color: #00e5ff;
}

/* ── 3. In-game floating menu button ───────────────────── */
.dz-ig-menu-btn {
  position: fixed !important;
  top: 12px !important;
  left: 12px !important;
  right: auto !important;
  z-index: 9000 !important;
  width: 44px !important;
  height: 44px !important;
  background: rgba(7,8,15,0.85) !important;
  border: 1.5px solid rgba(0,229,255,0.2) !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45) !important;
  transition: border-color 0.22s, background 0.22s, box-shadow 0.22s !important;
  padding: 0 !important;
  overflow: visible !important;
}
.dz-ig-menu-btn.open {
  border-color: rgba(0,229,255,0.6) !important;
  background: rgba(0,229,255,0.1) !important;
  box-shadow: 0 0 24px rgba(0,229,255,0.25), 0 4px 20px rgba(0,0,0,0.45) !important;
}
.igm-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}
.igm-line {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
  transition: all 0.32s cubic-bezier(0.23,1,0.32,1);
  transform-origin: center;
}

/* ── 4. In-game side menu panel ────────────────────────── */
/* dz-ig-menu: defined above via #dz-ig-menu ID rule */
.igm-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.igm-header-logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg,#00e5ff,#aa00ff);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem; font-weight: 900;
  color: #fff; letter-spacing: 0.05em;
  flex-shrink: 0;
}
.igm-header-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.65);
  flex: 1;
}
.igm-close-x {
  background: none; border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer; padding: 6px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.igm-close-x:hover { color: #fff; background: rgba(255,255,255,0.1); }
.igm-close-x svg { width: 14px; height: 14px; }
.igm-body {
  flex: 1; padding: 10px 10px;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
}
.igm-item {
  width: 100%;
  display: flex; align-items: center;
  gap: 12px; padding: 12px 12px;
  background: none;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s;
  text-align: left;
}
.igm-item:hover { background: rgba(255,255,255,0.05); }
.igm-item-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.igm-item-icon svg { width: 16px; height: 16px; }
.igm-icon--hub   { background: rgba(0,229,255,0.12); color: #00e5ff; }
.igm-icon--setup { background: rgba(170,0,255,0.12); color: #aa00ff; }
.igm-icon--vol   { background: rgba(0,230,118,0.12); color: #00e676; }
.igm-item-label {
  flex: 1;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.92rem; font-weight: 600;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.03em;
}
.igm-item-arrow {
  color: rgba(255,255,255,0.2);
  font-size: 1rem;
}
.igm-vol-toggle {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem; font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0,230,118,0.15);
  color: #00e676;
  letter-spacing: 0.08em;
  border: 1px solid rgba(0,230,118,0.2);
}
.igm-vol-toggle.off {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.1);
}
.igm-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

/* ── 5. Ad overlay text styles ─────────────────────────── */
#dz-ad-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}
#dz-ad-timer-badge {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  flex: 1;
  text-align: center;
}
#dz-ad-skip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.5);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}
#dz-ad-skip:not(:disabled):hover {
  background: rgba(0,229,255,0.1);
  border-color: rgba(0,229,255,0.35);
  color: #00e5ff;
}
#dz-ad-skip:disabled { opacity: 0.35; cursor: not-allowed; }
#dz-ad-content {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255,255,255,0.02);
}
#dz-ad-footer {
  padding: 10px 16px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.2);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ── 6. Loading overlay ────────────────────────────────── */
.dz-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50000;
  background: rgba(4,6,18,0.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.dz-loading-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.dz-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 40px 32px;
}
.dz-loading-spinner {
  position: relative;
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
}
.dz-spin-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.dz-spin-ring--1 {
  border-top-color: #00e5ff;
  animation: dzSpin 1.1s linear infinite;
}
.dz-spin-ring--2 {
  inset: 8px;
  border-right-color: #aa00ff;
  animation: dzSpin 0.8s linear infinite reverse;
}
.dz-spin-ring--3 {
  inset: 16px;
  border-bottom-color: #f50057;
  animation: dzSpin 1.4s linear infinite;
}
@keyframes dzSpin { to { transform: rotate(360deg); } }
.dz-spin-icon {
  font-size: 1.4rem;
  z-index: 1;
  animation: dzIconPulse 1s ease-in-out infinite alternate;
}
@keyframes dzIconPulse { from { transform: scale(0.9); } to { transform: scale(1.1); } }
.dz-loading-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.9);
  text-transform: uppercase;
}
.dz-loading-bar-wrap {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.dz-loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e5ff, #aa00ff);
  border-radius: 2px;
  transition: width 0.12s linear;
}
.dz-loading-sub {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── 7. Splash screen ──────────────────────────────────── */
.dz-splash {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: #07080f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.dz-splash--exit {
  animation: dzSplashExit 0.6s cubic-bezier(0.23,1,0.32,1) forwards;
}
@keyframes dzSplashExit {
  to { opacity: 0; transform: scale(1.04); }
}
.dz-splash--gone { display: none !important; }
.dz-splash-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.dz-splash-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.dz-splash-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,229,255,0.1);
  animation: dzRingPulse 3s ease-in-out infinite;
}
.dz-splash-ring--1 { width: 300px; height: 300px; animation-delay: 0s; }
.dz-splash-ring--2 { width: 480px; height: 480px; animation-delay: 0.5s; border-color: rgba(170,0,255,0.08); }
.dz-splash-ring--3 { width: 660px; height: 660px; animation-delay: 1s; border-color: rgba(245,0,87,0.06); }
@keyframes dzRingPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.05); opacity: 0.3; }
}
.dz-splash-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
}
.dz-splash-logo-wrap { position: relative; display: flex; align-items: center; justify-content: center; }
.dz-splash-logo { height: 80px; width: auto; object-fit: contain; filter: drop-shadow(0 0 32px rgba(0,229,255,0.5)); animation: dzLogoPulse 2s ease-in-out infinite alternate; }
@keyframes dzLogoPulse { from { filter: drop-shadow(0 0 24px rgba(0,229,255,0.4)); } to { filter: drop-shadow(0 0 48px rgba(0,229,255,0.7)); } }
.dz-splash-logo-glow { position: absolute; inset: -20px; background: radial-gradient(circle, rgba(0,229,255,0.15), transparent 70%); pointer-events: none; }
.dz-splash-wordmark {
  display: flex; gap: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 8vw, 3.6rem);
  letter-spacing: 0.14em;
  background: linear-gradient(90deg, #00e5ff 0%, #b06aff 50%, #f50057 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.dz-splash-char {
  opacity: 0;
  transform: translateY(20px);
  animation: dzCharIn 0.45s cubic-bezier(0.23,1,0.32,1) calc(0.5s + var(--i) * 0.06s) forwards;
}
.dz-splash-char--gap { margin-left: 0.22em; }
@keyframes dzCharIn { to { opacity: 1; transform: translateY(0); } }
.dz-splash-tagline {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(0.65rem, 1.5vw, 0.82rem);
  letter-spacing: 0.45em;
  color: rgba(255,255,255,0.38);
  text-transform: uppercase;
  opacity: 0;
  animation: dzFadeIn 0.5s ease 1.2s forwards;
}
.dz-splash-bar-wrap {
  width: 160px; height: 2px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: dzFadeIn 0.5s ease 1.3s forwards;
}
.dz-splash-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #00e5ff, #aa00ff, #f50057);
  border-radius: 2px;
}
.dz-splash-loading-txt {
  font-family: 'DM Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.22);
  text-transform: uppercase;
  opacity: 0;
  animation: dzFadeIn 0.5s ease 1.4s forwards;
}
@keyframes dzFadeIn { to { opacity: 1; } }

/* ── 8. Card save button ───────────────────────────────── */
/* ── 9. Result screen buttons ──────────────────────────── */
.ghp-result-btn-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--rb-color, #00e5ff) 20%, transparent), color-mix(in srgb, var(--rb-color, #00e5ff) 10%, transparent));
  border: 1.5px solid color-mix(in srgb, var(--rb-color, #00e5ff) 50%, transparent);
  color: var(--rb-color, #00e5ff);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.22s;
}
.ghp-result-btn-primary:hover {
  background: color-mix(in srgb, var(--rb-color, #00e5ff) 20%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--rb-color, #00e5ff) 35%, transparent);
  transform: translateY(-1px);
}
.ghp-result-btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.ghp-result-btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
}

/* ── 10. Ludo result animation ─────────────────────────── */
@keyframes ldResIn {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── 11. Prevent any scrollbar on all overflow:auto containers */
[style*="overflow-y: auto"],
[style*="overflow-y:auto"],
[style*="overflow: auto"],
[style*="overflow:auto"] {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
[style*="overflow-y: auto"]::-webkit-scrollbar,
[style*="overflow-y:auto"]::-webkit-scrollbar,
[style*="overflow: auto"]::-webkit-scrollbar,
[style*="overflow:auto"]::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}

/* ── 12. Hub screen — ensure no extra scrollbar on grid ── */
#arena-grid {
  scrollbar-width: none !important;
}
#arena-grid::-webkit-scrollbar { display: none !important; }

/* ── 13. Mobile: hamburger always top-right ────────────── */
@media (max-width: 600px) {
  #dz-hamburger, .hamburger-btn {
    top: 10px !important;
    right: 10px !important;
  }
  .dz-ig-menu-btn {
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   DUELZONE — MISSING CLASS DEFINITIONS PATCH
   ═══════════════════════════════════════════════════════════ */

/* ── pb-rule-text (span inside pb-rule-card) ───────────── */
.pb-rule-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255,255,255,0.72);
  line-height: 1.45;
  flex: 1;
}
.pb-rule-text strong {
  font-weight: 700;
  color: rgba(255,255,255,0.92);
}

/* ── panel-game-play / panel-save-remove (JS-generated) ── */
.panel-game-play {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid rgba(0,229,255,0.3);
  background: rgba(0,229,255,0.07);
  color: #00e5ff;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.panel-game-play:hover {
  background: rgba(0,229,255,0.16);
  border-color: rgba(0,229,255,0.55);
  box-shadow: 0 0 12px rgba(0,229,255,0.2);
}

.panel-save-remove {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,50,50,0.2);
  background: rgba(255,50,50,0.06);
  color: rgba(255,100,100,0.6);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.panel-save-remove:hover {
  background: rgba(255,50,50,0.14);
  color: rgba(255,100,100,0.95);
  border-color: rgba(255,50,50,0.4);
}

/* ── lm-vgwa-body (legal modal VGWA section) ───────────── */
.lm-vgwa-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── ghp-mode-pvp / ghp-mode-bot modifier colors ──────── */
.ghp-mode-pvp.active,
.ghp-mode-pvp:hover:not(.active) {
  border-color: rgba(0,229,255,0.4) !important;
}
.ghp-mode-pvp.active {
  background: rgba(0,229,255,0.08) !important;
  box-shadow: 0 0 0 1px rgba(0,229,255,0.2) inset, 0 0 20px rgba(0,229,255,0.12) !important;
}
.ghp-mode-bot.active,
.ghp-mode-bot:hover:not(.active) {
  border-color: rgba(170,0,255,0.4) !important;
}
.ghp-mode-bot.active {
  background: rgba(170,0,255,0.08) !important;
  box-shadow: 0 0 0 1px rgba(170,0,255,0.2) inset, 0 0 20px rgba(170,0,255,0.12) !important;
}

/* ── darts option buttons (mode/diff/dout/time) ─────────── */
.darts-mode-btn,
.darts-diff-btn,
.darts-dout-btn,
.darts-time-btn {
  /* inherits .diff-btn base styles — just ensure active state */
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.darts-mode-btn:hover,
.darts-diff-btn:hover,
.darts-dout-btn:hover,
.darts-time-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,23,68,0.35);
  color: rgba(255,255,255,0.85);
}
.darts-mode-btn.active,
.darts-diff-btn.active,
.darts-dout-btn.active,
.darts-time-btn.active {
  background: rgba(255,23,68,0.15);
  border-color: rgba(255,23,68,0.5);
  color: #ff1744;
  box-shadow: 0 0 12px rgba(255,23,68,0.18);
}

/* ── sdk-diff (sudoku difficulty pills) ─────────────────── */
.sdk-diff {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(108,99,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.sdk-diff:hover {
  background: rgba(108,99,255,0.1);
  border-color: rgba(108,99,255,0.4);
  color: rgba(255,255,255,0.85);
}
.sdk-diff.active {
  background: rgba(108,99,255,0.18);
  border-color: rgba(108,99,255,0.6);
  color: #6c63ff;
  box-shadow: 0 0 14px rgba(108,99,255,0.2);
}

/* ── tetris-diff (tetris difficulty pills) ─────────────── */
.tetris-diff {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(0,229,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.tetris-diff:hover {
  background: rgba(0,229,255,0.1);
  border-color: rgba(0,229,255,0.4);
  color: rgba(255,255,255,0.85);
}
.tetris-diff.active {
  background: rgba(0,229,255,0.15);
  border-color: rgba(0,229,255,0.55);
  color: #00e5ff;
  box-shadow: 0 0 14px rgba(0,229,255,0.2);
}

/* ── rd-diff (reaction duel difficulty pills) ──────────── */
.rd-diff {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(170,0,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.rd-diff:hover {
  background: rgba(170,0,255,0.1);
  border-color: rgba(170,0,255,0.4);
  color: rgba(255,255,255,0.85);
}
.rd-diff.active {
  background: rgba(170,0,255,0.15);
  border-color: rgba(170,0,255,0.55);
  color: #aa00ff;
  box-shadow: 0 0 14px rgba(170,0,255,0.2);
}

/* ── carrom-diff / carrom-mode pills ────────────────────── */
.carrom-diff,
.carrom-mode {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,145,0,0.2);
  color: rgba(255,255,255,0.6);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.carrom-diff:hover,
.carrom-mode:hover {
  background: rgba(255,145,0,0.1);
  border-color: rgba(255,145,0,0.4);
  color: rgba(255,255,255,0.85);
}
.carrom-diff.active,
.carrom-mode.active {
  background: rgba(255,145,0,0.15);
  border-color: rgba(255,145,0,0.55);
  color: #ff9100;
  box-shadow: 0 0 14px rgba(255,145,0,0.2);
}

/* ── Cricket toss/play buttons (cric-*-btn) ─────────────── */
.cric-bot-toss-btn,
.cric-pvp-toss-p1-btn,
.cric-pvp-toss-p2-btn,
.cric-pvp-p1-btn,
.cric-pvp-p2-btn {
  /* Inherit cricket-num-btn — just ensure pointer works */
  pointer-events: auto !important;
}

/* ── right utility class (used on some elements) ────────── */
.right { text-align: right; }

/* ── Ensure lm-vgwa-card layout ─────────────────────────── */
.lm-vgwa-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
  margin-top: 6px;
}
.lm-vgwa-logo-box {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
}
.lm-vgwa-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.lm-vgwa-desc {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.55;
}

/* ── ghp-start-btns (chess dual start buttons) ──────────── */
.ghp-start-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-top: 4px;
}

/* ── Ensure dz-topbar (hidden nav bar) is truly hidden ──── */
.dz-topbar {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  position: absolute !important;
}

/* ── Fix any overflow on fixed game play panels ─────────── */
#tetris-play,
#rd-play,
#carrom-play,
#sdk-play,
#ludo-play {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
#tetris-play::-webkit-scrollbar,
#rd-play::-webkit-scrollbar,
#carrom-play::-webkit-scrollbar,
#sdk-play::-webkit-scrollbar,
#ludo-play::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}

/* ── Footer link active/focus states ────────────────────── */
.footer-link {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.footer-link:hover {
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.06);
}

/* ── Ensure all game screens scroll without visible bar ─── */
[id^="screen-"] {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
[id^="screen-"]::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
}


/* ══════════════════════════════════════════════════════════════════
   CRITICAL FIX: Re-hide game screens in landscape that were forced
   visible by the group selector in the landscape @media block above
   (lines ~12041-12069). That block adds display:flex !important to
   #screen-tetris, #screen-tanks etc. via a group selector ending in
   #tetris-play. We must override with an even more specific rule.

   Rule: ANY [id^="screen-"].hidden in landscape = display:none.
   This uses :is() for higher specificity to beat display:flex !important.
   ══════════════════════════════════════════════════════════════════ */

@media (orientation: landscape) {
  /* Re-enforce .hidden on ALL game screens in landscape.
     Uses html prefix for maximum specificity to beat !important chains. */
  html #screen-ttt.hidden,
  html #screen-rps.hidden,
  html #screen-tapbattle.hidden,
  html #screen-duel2048.hidden,
  html #screen-c4.hidden,
  html #screen-cricket.hidden,
  html #screen-airhockey.hidden,
  html #screen-passbreach.hidden,
  html #screen-chess.hidden,
  html #screen-battleship.hidden,
  html #screen-checkers.hidden,
  html #screen-darts.hidden,
  html #screen-tanks.hidden,
  html #screen-starcatcher.hidden,
  html #screen-spacedodge.hidden,
  html #screen-pingpong.hidden,
  html #screen-minesweeper.hidden,
  html #screen-tetris.hidden,
  html #screen-bomberman.hidden,
  html #screen-drawguess.hidden,
  html #screen-reaction.hidden,
  html #screen-territory.hidden,
  html #screen-memoryflip.hidden,
  html #screen-connectdots.hidden,
  html #screen-snake.hidden,
  html #screen-typing.hidden,
  html #screen-blackjack.hidden,
  html #screen-pixelracer.hidden,
  html #screen-ludo.hidden,
  html #screen-sudoku.hidden,
  html #screen-carrom.hidden {
    display: none !important;
    visibility: hidden !important;
  }

  /* Hide fixed play panels ONLY when their parent screen is hidden.
     Previously this was unconditional (hiding them always in landscape = blank screen bug). */
  html #screen-tetris.hidden  #tetris-play,
  html #screen-reaction.hidden #rd-play,
  html #screen-carrom.hidden  #carrom-play,
  html #screen-sudoku.hidden  #sdk-play {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════
   DZ SHARE MODAL STYLES — bulletproof version
   ═══════════════════════════════════════════════════════════════ */

/* Share button on result screens */
.ghp-result-btn-share,.dz-result-btn-share {
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:11px 18px;border-radius:12px;
  font-family:'Rajdhani',sans-serif;font-weight:700;font-size:0.92rem;
  letter-spacing:0.05em;cursor:pointer;
  border:1.5px solid rgba(0,229,255,0.5);
  background:rgba(0,229,255,0.10);color:#00e5ff;
  transition:background 0.18s,border-color 0.18s,transform 0.12s;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
  pointer-events:auto !important;
  position:relative;z-index:1;
}
.ghp-result-btn-share:hover,.dz-result-btn-share:hover {
  background:rgba(0,229,255,0.20);border-color:#00e5ff;transform:translateY(-1px);
}
.pb-btn-share {
  background:rgba(0,255,136,0.08)!important;border-color:rgba(0,255,136,0.5)!important;color:#00ff88!important;
}
.pp-ov-sharebtn {
  display:block;width:100%;max-width:220px;margin:6px auto 0;
  padding:10px 0;border-radius:8px;
  font-family:'Orbitron',sans-serif;font-size:0.8rem;font-weight:700;letter-spacing:0.08em;
  cursor:pointer;border:1.5px solid rgba(0,229,255,0.5);
  background:rgba(0,229,255,0.08);color:#00e5ff;
  touch-action:manipulation;pointer-events:auto !important;
}

/* Backdrop */
.dz-share-backdrop {
  position:fixed;inset:0;
  background:rgba(0,0,0,0.82);
  backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
  z-index:100000;
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity 0.22s ease,visibility 0.22s;
}
.dz-share-backdrop.active {opacity:1;visibility:visible;pointer-events:auto;}

/* Modal */
.dz-share-modal {
  position:fixed;left:50%;top:50%;
  transform:translate(-50%,-46%) scale(0.93);
  width:min(460px,94vw);
  max-height:88vh;
  background:#0d0f1c;
  border:1px solid rgba(255,255,255,0.14);
  border-radius:18px;
  box-shadow:0 24px 80px rgba(0,0,0,0.9);
  z-index:100001;
  display:flex;flex-direction:column;
  overflow:hidden;
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity 0.22s ease,transform 0.26s cubic-bezier(0.34,1.4,0.64,1),visibility 0.22s;
}
.dz-share-modal.active {
  opacity:1;visibility:visible;pointer-events:auto;
  transform:translate(-50%,-50%) scale(1);
}
.dz-share-modal.active * {pointer-events:auto;}

/* Header */
.dz-share-header {
  display:flex;align-items:center;justify-content:space-between;
  padding:13px 16px 11px;
  border-bottom:1px solid rgba(255,255,255,0.07);
  background:rgba(255,255,255,0.03);flex-shrink:0;
}
.dz-share-title {
  font-family:'Orbitron',sans-serif;font-size:0.82rem;font-weight:700;
  letter-spacing:0.06em;color:#fff;
}
.dz-share-close {
  width:30px;height:30px;border-radius:50%;
  border:1px solid rgba(255,255,255,0.12);background:rgba(255,255,255,0.05);
  color:rgba(255,255,255,0.6);cursor:pointer;font-size:0.85rem;
  display:flex;align-items:center;justify-content:center;
  touch-action:manipulation;
  transition:background 0.15s,color 0.15s;
}
.dz-share-close:hover{background:rgba(255,255,255,0.14);color:#fff;}

/* Scroll area */
.dz-share-modal-scroll {
  overflow-y:auto;flex:1;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}

/* Name input */
.dz-share-name-wrap {padding:10px 14px 4px;}
.dz-share-name-label {
  display:block;
  font-family:'Rajdhani',sans-serif;font-size:0.72rem;
  color:rgba(255,255,255,0.40);letter-spacing:0.06em;text-transform:uppercase;
  margin-bottom:5px;
}
.dz-share-name-input {
  width:100%;padding:9px 12px;box-sizing:border-box;
  background:rgba(255,255,255,0.06);
  border:1.5px solid rgba(255,255,255,0.12);
  border-radius:10px;color:#fff;
  font-family:'Rajdhani',sans-serif;font-size:0.95rem;font-weight:600;
  outline:none;-webkit-appearance:none;
  transition:border-color 0.2s,background 0.2s;
}
.dz-share-name-input:focus{border-color:rgba(0,229,255,0.6);background:rgba(0,229,255,0.07);}
.dz-share-name-input::placeholder{color:rgba(255,255,255,0.22);}

/* Card preview */
.dz-share-preview-wrap{padding:10px 14px 4px;}
.dz-share-preview {
  width:100%;min-height:90px;border-radius:10px;overflow:hidden;
  background:#07080f;border:1px solid rgba(255,255,255,0.07);
  display:flex;align-items:center;justify-content:center;
}
.dz-share-preview img{width:100%;border-radius:8px;display:block;}

/* Status text */
.dz-share-status {
  margin:5px 0 0;text-align:center;
  font-family:'Rajdhani',sans-serif;font-size:0.78rem;
  color:rgba(0,229,255,0.70);letter-spacing:0.04em;
  animation:dzStatPulse 1.4s ease-in-out infinite;
}
@keyframes dzStatPulse{0%,100%{opacity:0.55}50%{opacity:1}}
.dz-share-hint {
  margin:5px 0 0;text-align:center;
  font-family:'Rajdhani',sans-serif;font-size:0.70rem;
  color:rgba(255,255,255,0.24);letter-spacing:0.03em;
}

/* Spinner */
.dz-share-spinner {
  width:32px;height:32px;
  border:3px solid rgba(0,229,255,0.14);border-top-color:#00e5ff;
  border-radius:50%;animation:dzSpin 0.7s linear infinite;
}
@keyframes dzSpin{to{transform:rotate(360deg)}}

/* Action buttons */
.dz-share-actions {
  display:grid;grid-template-columns:1fr 1fr;
  gap:8px;padding:8px 14px 10px;
}
.dz-share-btn {
  display:flex;align-items:center;justify-content:center;
  gap:5px;padding:13px 6px;
  border-radius:10px;
  font-family:'Rajdhani',sans-serif;font-weight:700;font-size:0.88rem;
  letter-spacing:0.03em;cursor:pointer;
  border:1.5px solid transparent;
  min-height:48px;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  pointer-events:auto !important;
  position:relative;z-index:1;
  white-space:nowrap;
  transition:transform 0.1s,background 0.15s,border-color 0.15s;
  -webkit-appearance:none;
}
.dz-share-btn:active{transform:scale(0.95);}
.dz-share-btn--save{background:rgba(170,0,255,0.12);border-color:rgba(170,0,255,0.38);color:#cc44ff;}
.dz-share-btn--save:hover{background:rgba(170,0,255,0.22);border-color:#aa00ff;}
.dz-share-btn--wa{background:rgba(37,211,102,0.12);border-color:rgba(37,211,102,0.38);color:#25d366;}
.dz-share-btn--wa:hover{background:rgba(37,211,102,0.22);border-color:#25d366;}
.dz-share-btn--ig{background:rgba(225,48,108,0.12);border-color:rgba(225,48,108,0.38);color:#e1306c;}
.dz-share-btn--ig:hover{background:rgba(225,48,108,0.22);border-color:#e1306c;}
.dz-share-btn--copy{background:rgba(0,229,255,0.07);border-color:rgba(0,229,255,0.24);color:#00e5ff;}
.dz-share-btn--copy:hover{background:rgba(0,229,255,0.17);border-color:#00e5ff;}

/* Instagram caption box */
.dz-share-ig-wrap {
  margin:0 14px 14px;
  background:rgba(255,255,255,0.04);
  border:1px solid rgba(225,48,108,0.25);
  border-radius:10px;padding:10px 12px;
}
.dz-share-ig-label {
  font-family:'Rajdhani',sans-serif;font-size:0.72rem;
  color:rgba(255,255,255,0.40);letter-spacing:0.05em;
  text-transform:uppercase;margin-bottom:6px;
}
.dz-share-ig-caption {
  font-family:'Rajdhani',sans-serif;font-size:0.85rem;
  color:rgba(255,255,255,0.80);line-height:1.5;
  white-space:pre-wrap;word-break:break-all;margin-bottom:8px;
}
.dz-share-ig-copy-btn {
  display:block;width:100%;padding:8px 0;border-radius:8px;cursor:pointer;
  border:1px solid rgba(225,48,108,0.38);background:rgba(225,48,108,0.10);color:#e1306c;
  font-family:'Rajdhani',sans-serif;font-weight:700;font-size:0.82rem;
  touch-action:manipulation;pointer-events:auto !important;
  transition:background 0.15s;
}
.dz-share-ig-copy-btn:hover{background:rgba(225,48,108,0.22);}

/* Beat popup */
#dz-beat-popup {
  position:fixed;inset:0;z-index:200000;
  display:flex;align-items:center;justify-content:center;
  background:rgba(0,0,0,0.85);backdrop-filter:blur(8px);
  opacity:0;visibility:hidden;pointer-events:none;
  transition:opacity 0.3s ease,visibility 0.3s;
}
#dz-beat-popup.active{opacity:1;visibility:visible;pointer-events:auto;}
.dz-beat-inner {
  background:linear-gradient(160deg,#0e1022,#18080f);
  border-radius:20px;padding:32px 28px;
  text-align:center;max-width:320px;width:90%;
  border:2px solid rgba(0,229,255,0.3);
  box-shadow:0 0 60px rgba(0,229,255,0.15);
  animation:dzBeatIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes dzBeatIn{from{transform:scale(0.8);opacity:0}to{transform:scale(1);opacity:1}}
.dz-beat-emoji{font-size:3rem;margin-bottom:10px;}
.dz-beat-title{font-family:'Orbitron',sans-serif;font-size:1.1rem;font-weight:900;color:#fff;letter-spacing:0.04em;margin-bottom:6px;line-height:1.3;}
.dz-beat-detail{font-family:'Rajdhani',sans-serif;font-size:0.88rem;color:rgba(200,210,255,0.60);margin-bottom:22px;line-height:1.4;}
.dz-beat-btns{display:flex;flex-direction:column;gap:10px;}
.dz-beat-share-btn{padding:13px 0;border:none;border-radius:28px;background:linear-gradient(135deg,#00e5ff,#0070ff);color:#000;font-family:'Orbitron',sans-serif;font-size:0.72rem;font-weight:700;letter-spacing:0.1em;cursor:pointer;touch-action:manipulation;transition:transform 0.12s;box-shadow:0 4px 20px rgba(0,229,255,0.35);}
.dz-beat-share-btn:hover{transform:translateY(-2px);}
.dz-beat-close-btn{padding:10px 0;border-radius:28px;border:1px solid rgba(255,255,255,0.15);background:transparent;color:rgba(255,255,255,0.40);font-family:'Rajdhani',sans-serif;font-size:0.85rem;cursor:pointer;touch-action:manipulation;transition:color 0.15s,border-color 0.15s;}
.dz-beat-close-btn:hover{color:rgba(255,255,255,0.70);border-color:rgba(255,255,255,0.30);}

/* Challenge banner */
#dz-challenge-banner {
  position:fixed;top:0;left:0;right:0;z-index:99999;
  display:flex;align-items:center;gap:10px;padding:10px 16px;
  background:linear-gradient(135deg,#0d1117,#1a0a00);
  border-bottom:2px solid #ff9100;
  box-shadow:0 4px 24px rgba(255,145,0,0.25);
  transform:translateY(-100%);
  transition:transform 0.4s cubic-bezier(0.34,1.2,0.64,1);
}
#dz-challenge-banner.active{transform:translateY(0);}
.dz-cb-icon{font-size:1.4rem;flex-shrink:0;}
.dz-cb-text{flex:1;font-family:'Rajdhani',sans-serif;font-size:0.9rem;color:rgba(255,255,255,0.85);line-height:1.3;}
.dz-cb-text strong{color:#ff9100;}
.dz-cb-close{width:26px;height:26px;border-radius:50%;flex-shrink:0;border:1px solid rgba(255,255,255,0.15);background:rgba(255,255,255,0.05);color:rgba(255,255,255,0.5);cursor:pointer;font-size:0.75rem;display:flex;align-items:center;justify-content:center;touch-action:manipulation;}
.dz-cb-close:hover{background:rgba(255,255,255,0.14);color:#fff;}

@media(max-width:360px){.dz-share-actions{grid-template-columns:1fr 1fr;}}

/* ═══════════════════════════════════════════════════════════════════
   LAPTOP / WIDE-SCREEN OPTIMIZATIONS  (min-width: 900px)
   All overrides are purely additive — no mobile layouts touched.
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {

  /* ── Hub header ── */
  #header {
    padding: 40px 0 24px;
  }
  #title {
    font-size: clamp(3rem, 5vw, 5.5rem);
  }
  #subtitle {
    font-size: 0.95rem;
    letter-spacing: 0.35em;
  }

  /* ── Arena grid: 3 columns on laptops ── */
  #arena-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1100px;
    padding: 0 32px;
  }

  /* ── Card inner: bigger padding & icon ── */
  .card-inner {
    padding: 28px 28px 22px;
    gap: 14px;
  }
  .card-icon {
    width: 56px;
    height: 56px;
  }
  .card-title {
    font-size: 1rem;
  }
  .card-desc {
    font-size: 0.82rem;
  }
  .card-btn {
    padding: 8px 18px;
    font-size: 0.68rem;
  }

  /* ── Footer ── */
  #footer {
    padding: 28px 40px;
  }
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  /* ── Hamburger: push right so it doesn't fight header ── */
  #dz-hamburger {
    top: 20px;
    left: 20px;
  }

  /* ── Game home panels: wider wrap, side-by-side rules + settings ── */
  .game-home-panel {
    padding: 60px 32px 48px;
    justify-content: center;
  }
  .ghp-wrap {
    max-width: 720px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hero   hero"
      "rules  settings"
      "start  start";
    column-gap: 32px;
    row-gap: 20px;
    align-items: start;
  }
  .ghp-hero     { grid-area: hero; }
  .ghp-rules    { grid-area: rules; }
  .ghp-settings { grid-area: settings; }
  .ghp-start-btn,
  .ghp-start-btns { grid-area: start; }

  /* Games with a single-col layout (chess has two start buttons) */
  .ghp-start-btns {
    display: flex;
    gap: 14px;
  }
  .ghp-start-btns .ghp-start-btn {
    flex: 1;
  }

  /* ── Tap Battle: landscape arena ── */
  #tap-arena {
    min-height: 480px;
    max-width: 900px;
  }
  .tap-count {
    font-size: clamp(5rem, 10vw, 9rem);
  }
  .tap-divider {
    width: 72px;
  }
  .tap-player-label {
    font-size: 0.9rem;
  }
  .tap-key-badge {
    font-size: 0.82rem;
    padding: 6px 18px;
  }

  /* ── Progress bars: wider on laptop ── */
  .tap-progress-wrap {
    width: 75%;
  }

  /* ── Reaction Duel: bigger signal circle ── */
  #rd-signal-bg {
    width: 320px;
    height: 320px;
  }
  #rd-signal-emoji {
    font-size: 5rem;
  }
  #rd-tap-p1, #rd-tap-p2 {
    width: 150px;
    height: 72px;
    font-size: 1.1rem;
  }

  /* ── 2048 Duel: side-by-side boards ── */
  #d2048-arena {
    flex-direction: row;
    gap: 28px;
    align-items: flex-start;
    justify-content: center;
  }

  /* ── Chess: wider sidebar ── */
  #chess-sidebar {
    min-width: 200px;
    max-width: 240px;
  }

  /* ── Result cards: tighter max-width on wide screens ── */
  .ghp-result-btn-primary,
  .ghp-result-btn-secondary {
    max-width: 220px;
  }

  /* ── Hub footer ad: limit width ── */
  #hub-footer-ad {
    max-width: 1100px;
    margin: 0 auto;
  }

  /* ── Darts: wider canvas ── */
  #darts-canvas-wrap {
    max-width: 560px;
    margin: 0 auto;
  }

  /* ── Battleship: side-by-side boards ── */
  #bs-boards {
    flex-direction: row;
    gap: 32px;
    justify-content: center;
  }

  /* ── Ping Pong: wider canvas container ── */
  #pp-canvas-wrap {
    max-width: 900px;
    margin: 0 auto;
  }

  /* ── Ludo: wider board ── */
  #ludo-app {
    max-width: 580px;
  }

  /* ── Carrom: slightly larger canvas ── */
  #carrom-canvas-wrap {
    max-width: 560px;
  }

  /* ── Sudoku: wider grid ── */
  #sdk-app {
    max-width: 560px;
  }
}

/* ── 4-column grid on very wide screens (1400px+) ── */
@media (min-width: 1400px) {
  #arena-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1400px;
    gap: 26px;
  }
  .card-inner {
    padding: 24px 24px 20px;
  }
}

/* ── Tap Battle: key badge always visible on pointer:fine devices (laptop/desktop) ── */
@media (hover: hover) and (pointer: fine) {
  .tap-key-badge {
    display: inline-flex !important;
  }
}

