/* ===== Makong Network — cartoony Angkor Wat / jungle Minecraft theme ===== */
@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Press+Start+2P&family=Noto+Sans:wght@400;600;700&family=Kantumruy+Pro:wght@400;600;700&family=Noto+Sans+SC:wght@400;600;700&display=swap");
/* Kantumruy Pro carries the Khmer glyphs and Noto Sans SC the Chinese ones -
   both sit in every font stack after the Latin faces so the site reads
   properly with the language set to ខ្មែរ or 中文. Vietnamese needs no extra
   font: Baloo 2 and Noto Sans already cover its Latin Extended diacritics. */

/* The genuine in-game Minecraft font, for English/Latin text - it has no
   Khmer glyphs, so it sits first in the stack and just falls through to
   Baloo 2 / Kantumruy Pro for anything it can't render (Khmer included). */
@font-face {
  font-family: "Minecraft";
  src: url("/fonts/minecraft.ttf") format("truetype");
  font-weight: 400 900;
  font-display: swap;
}

/* ---------------------------------------------------------------
   Theming. DARK is the default (plain :root); light is opt-in via
   <html data-theme="light">, set by the ☀️/🌙 toggle in the nav.
   Brand accents (gold, moss, terracotta) stay the same in both.
   --------------------------------------------------------------- */
:root {
  /* shared brand accents - a white/lime-green "sunlight" family, standing
     in for the old gold/amber accent everywhere it showed up (buttons,
     borders, highlighted text). */
  --gold: #d7ffa0;
  --gold-light: #ffffff;
  --gold-deep: #8fd94f;
  --jungle: #34b358;
  --jungle-dark: #1d6b34;
  --moss: #7fd858;
  --moss-dark: #4f9c34;
  --moss-light: #b6f08a;
  --flower-pink: #ff8fc2;
  --flower-white: #f4fff0;
  --flower-red: #ff6b5e;
  --flower-purple: #c58bff;
  --water-blue: #57d0e8;
  --firefly-glow: #ddff7e;
  --firefly-glow-2: #8ce8ff;
  --click-blink: #9dff57;
  /* Vivid leaf-green button surface — replaces the old wood-plank look on
     the hero action buttons and other primary "pill" controls. */
  --leaf-surface:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.3), transparent 45%),
    linear-gradient(155deg, var(--moss-light) 0%, var(--jungle) 55%, var(--jungle-dark) 100%);
  --leaf-bevel: inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.32);
  /* nav + footer stay dark forest in both themes, so these never flip */
  --link-accent: #a6ff8a;
  --on-dark: #eef7ea;
  --on-dark-soft: #bcd9b8;
  --bar-bg: linear-gradient(180deg, #12281c, #06120c);
  --radius: 18px;
  --nav-h: 72px;

  /* --- DARK theme (default): magical night forest --- */
  --cream: #0a1712;
  --cream-dark: #13291d;
  --ink: #eef7ea;
  --ink-soft: #a2c69c;
  --brown: #7c5a34;
  --brown-dark: #ffffff;
  --brown-darkest: #050d08;
  --terracotta: #9dff57;
  --success: #7ad06a;
  --sky-top: #173a2b;
  --sky-bottom: #0b2118;
  --sky-deep: #050f0a;
  --input-bg: #17301f;

  --stone-light: #3f6b46;
  --stone: #2c4f34;
  --stone-mid: #1f3826;
  --stone-dark: #578a5c;
  --stone-darkest: #0a1810;

  --stone-surface:
    radial-gradient(circle at 16% 20%, rgba(200, 255, 200, 0.14) 0%, transparent 5%),
    radial-gradient(circle at 74% 62%, rgba(0, 0, 0, 0.22) 0%, transparent 6%),
    radial-gradient(circle at 42% 82%, rgba(200, 255, 200, 0.09) 0%, transparent 4%),
    radial-gradient(circle at 86% 22%, rgba(0, 0, 0, 0.2) 0%, transparent 5%),
    radial-gradient(circle at 30% 48%, rgba(0, 0, 0, 0.16) 0%, transparent 4%),
    linear-gradient(155deg, var(--stone-light) 0%, var(--stone) 55%, var(--stone-mid) 100%);
  --stone-bevel: inset 0 2px 0 rgba(210, 255, 200, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.4);

  --shadow-hard: 4px 4px 0 rgba(0, 0, 0, 0.45), 5px 8px 14px rgba(0, 0, 0, 0.35);
  --press-shadow: 0 5px 0 var(--stone-darkest), 0 7px 12px rgba(0, 0, 0, 0.4);
  --press-shadow-active: 0 1px 0 var(--stone-darkest);
}

/* --- LIGHT theme: vibrant sunlit forest day --- */
:root[data-theme="light"] {
  --link-accent: #1f7d33;
  --cream: #eef8e0;
  --cream-dark: #dcf0c4;
  --ink: #163a1c;
  --ink-soft: #3f6b3a;
  --brown: #8a6030;
  --brown-dark: #1c4a22;
  --brown-darkest: #0f2812;
  --terracotta: #4c9a2a;
  --success: #2f8a4a;
  --sky-top: #bdeaff;
  --sky-bottom: #cdf0a0;
  --sky-deep: #9fdd7a;
  --input-bg: #ffffff;

  --stone-light: #f5fbe8;
  --stone: #e2f2c8;
  --stone-mid: #c3e39a;
  --stone-dark: #7fae5a;
  --stone-darkest: #345c2a;

  --stone-surface:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, 0.4) 0%, transparent 5%),
    radial-gradient(circle at 74% 62%, rgba(0, 0, 0, 0.08) 0%, transparent 6%),
    radial-gradient(circle at 42% 82%, rgba(255, 255, 255, 0.22) 0%, transparent 4%),
    radial-gradient(circle at 86% 22%, rgba(0, 0, 0, 0.07) 0%, transparent 5%),
    radial-gradient(circle at 30% 48%, rgba(0, 0, 0, 0.05) 0%, transparent 4%),
    linear-gradient(155deg, var(--stone-light) 0%, var(--stone) 55%, var(--stone-mid) 100%);
  --stone-bevel: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.16);

  --shadow-hard: 4px 4px 0 rgba(53, 74, 38, 0.24), 5px 8px 14px rgba(53, 74, 38, 0.14);
  --press-shadow: 0 5px 0 var(--stone-darkest), 0 7px 12px rgba(53, 74, 38, 0.2);
  --press-shadow-active: 0 1px 0 var(--stone-darkest);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Minecraft", "Noto Sans", "Kantumruy Pro", "Noto Sans SC", system-ui, sans-serif;
  /* dappled forest light: soft color pools over the base tone, not a flat fill */
  background:
    radial-gradient(720px 420px at 8% 0%, rgba(127, 216, 88, 0.16), transparent 60%),
    radial-gradient(640px 380px at 95% 15%, rgba(255, 202, 77, 0.12), transparent 55%),
    radial-gradient(760px 460px at 50% 100%, rgba(87, 208, 232, 0.08), transparent 60%),
    var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

h1, h2, h3, .brand {
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", "Noto Sans", sans-serif;
  color: var(--brown-dark);
  letter-spacing: 0.01em;
  font-weight: 800;
}

.pixel-text {
  font-family: "Press Start 2P", monospace;
  letter-spacing: 0.02em;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Scoped to .hero (rather than bare .flower-accent) so this reliably beats
   the later, equal-specificity ".hero > *" rule that flips absolutely
   positioned hero decorations to position:relative for z-index stacking -
   without this, each flower-accent <img> (display:block globally) would
   fall back into normal flow and stack up real page height above the logo. */
.hero .flower-accent {
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
  animation: flower-sway 5s ease-in-out infinite;
}
@keyframes flower-sway {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}

/* ---------- Nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.16) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 58px),
    var(--bar-bg);
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.site-nav .container { display: flex; align-items: center; justify-content: space-between; width: 100%; position: relative; }

/* ☀️/🌙 theme switch + EN/ខ្មែរ language switch, just left of the nav links. */
.nav-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 0.6rem;
}
.theme-toggle {
  height: 42px;
  width: 42px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  line-height: 1;
  color: var(--on-dark);
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.theme-toggle:hover { transform: translateY(-2px) scale(1.06); }
.theme-icon { width: 24px; height: 24px; object-fit: contain; }
.theme-toggle:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--stone-darkest); }

/* Language switch - a custom dropdown card styled the same as the mobile
   nav menu, instead of a native <select> that pops the OS picker. */
.lang-dropdown { position: relative; display: inline-flex; flex-shrink: 0; }
.lang-toggle {
  height: 42px;
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--on-dark);
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.lang-toggle:hover { transform: translateY(-2px) scale(1.06); }
.lang-toggle:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--stone-darkest); }
.lang-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.lang-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 150px;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: 16px;
  box-shadow: var(--stone-bevel), 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.34,1.4,.64,1);
  z-index: 120;
}
.lang-menu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.lang-option {
  display: flex;
  width: 100%;
  height: 42px;
  justify-content: center;
  align-items: center;
  color: var(--on-dark);
  font-weight: 700;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-size: 0.95rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.lang-option:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stone-darkest); }
.lang-option.active {
  background: var(--stone-surface);
  color: var(--ink);
  border-color: var(--gold);
  box-shadow: var(--stone-bevel), 0 3px 0 var(--gold-deep);
}
@media (max-width: 760px) {
  .nav-tools { margin-left: auto; margin-right: 0.5rem; gap: 0.3rem; }
  .lang-toggle { font-size: 0.8rem; }
}

.site-nav .brand {
  color: var(--gold-light);
  font-weight: 800;
  font-size: 1.3rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.35);
}
.site-nav .brand img { height: 42px; width: 42px; object-fit: contain; }
.nav-links { display: flex; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: var(--on-dark);
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.nav-links a:hover { transform: translateY(-2px) scale(1.04); }
.nav-links a.active { background: var(--stone-surface); color: var(--ink); border-color: var(--gold); box-shadow: var(--stone-bevel), 0 3px 0 var(--gold-deep); }
.nav-icon { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 1.8rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; order: 3; }

  /* Clean dropdown card anchored under the hamburger on the right.
     Every entry is the same height/width with its label centred. */
  .nav-links {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    left: auto;
    width: 190px;
    background: var(--stone-surface);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    gap: 0.4rem;
    border: 3px solid var(--stone-darkest);
    border-radius: 16px;
    box-shadow: var(--stone-bevel), 0 10px 24px rgba(0, 0, 0, 0.45);
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.34,1.4,.64,1);
    z-index: 120;
  }
  .nav-links.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
  .nav-links li { display: block; width: 100%; }
  .nav-links a {
    display: flex;
    width: 100%;
    height: 46px;
    justify-content: center;   /* label centred in every button */
    align-items: center;
    gap: 0.45rem;
    padding: 0;
    border-radius: 11px;
    font-size: 0.98rem;
    white-space: nowrap;
  }
  .nav-links a:hover { transform: none; }
  .nav-links a:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stone-darkest); }

}

/* ---------- Hero (home) ---------- */
/* A real jungle photo instead of a flat sky gradient - night by default
   (moonlit, matches the firefly theme), a sunlit day shot in light theme.
   The gradient on top darkens toward the bottom so it blends into the
   section below and keeps the logo/buttons readable over a busy photo. */
.hero {
  position: relative;
  background:
    linear-gradient(180deg, rgba(3, 8, 6, 0.25) 0%, rgba(3, 8, 6, 0.15) 40%, var(--sky-deep) 100%),
    url("/images/site/hero-bg-night.jpg") center / cover no-repeat;
  padding: 1.25rem 1.25rem 0;
  text-align: center;
  overflow: hidden;
}
:root[data-theme="light"] .hero {
  background:
    linear-gradient(180deg, rgba(3, 8, 6, 0.1) 0%, rgba(3, 8, 6, 0.05) 40%, var(--sky-deep) 100%),
    url("/images/site/hero-bg-day.jpg") center / cover no-repeat;
}
.hero > * { position: relative; z-index: 1; }

/* Fireflies: night-forest magic. Visible by default (dark is the default
   theme); hidden in daylight, where glowing bugs would look out of place. */
.firefly {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--firefly-glow);
  box-shadow: 0 0 6px 2px var(--firefly-glow), 0 0 14px 6px rgba(221, 255, 126, 0.5);
  opacity: 0;
  animation: firefly-float 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
.firefly.blue {
  background: var(--firefly-glow-2);
  box-shadow: 0 0 6px 2px var(--firefly-glow-2), 0 0 14px 6px rgba(140, 232, 255, 0.5);
}
:root[data-theme="light"] .firefly { display: none; }
@keyframes firefly-float {
  0% { opacity: 0; transform: translate(0, 0) scale(0.7); }
  12% { opacity: 1; }
  30% { transform: translate(16px, -18px) scale(1.15); }
  50% { opacity: 0.4; transform: translate(-10px, -34px) scale(0.9); }
  70% { opacity: 1; transform: translate(12px, -50px) scale(1.1); }
  88% { opacity: 0.8; }
  100% { opacity: 0; transform: translate(-16px, -68px) scale(0.7); }
}

/* Floating leaves + petals drifting down through the hero — the "lively,
   colorful forest" ambience, on in both themes. */
.leaf-particle {
  position: absolute;
  top: -8%;
  font-size: 1.1rem;
  opacity: 0;
  animation: leaf-drift linear infinite;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}
@keyframes leaf-drift {
  0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
  8% { opacity: 0.95; }
  50% { transform: translate(38px, 46vh) rotate(170deg); }
  92% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(-24px, 96vh) rotate(340deg); }
}

/* Hangs like jungle vines/fronds draping in from the top corners. */
.leaf-corner {
  position: absolute;
  top: -1.5rem;
  width: 150px;
  height: 150px;
  opacity: 0.92;
  pointer-events: none;
  z-index: 2;
}
.leaf-corner.left { left: -1.5rem; transform: scaleY(-1); }
.leaf-corner.right { right: -1.5rem; transform: scale(-1, -1); }
@media (max-width: 600px) { .leaf-corner { width: 95px; height: 95px; } }

.hero-logo-full {
  max-width: 504px;
  width: 96%;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(4px 6px 0 rgba(42, 22, 8, 0.25));
}

.hero-actions {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
/* Leafy pill button with a colored icon "chip" - vivid leaf-green, not wood. */
.action-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.85rem;
  min-width: 230px;
  padding: 0.7rem 1.3rem 0.7rem 0.7rem;
  border-radius: 14px;
  border: 3px solid var(--stone-darkest);
  cursor: pointer;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  text-decoration: none;
  color: #fff3e0;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
  text-align: left;
  background: var(--leaf-surface);
  box-shadow: var(--leaf-bevel), var(--press-shadow);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.action-btn:hover { transform: scale(1.05) rotate(-1deg); }
.action-btn:active { transform: translateY(4px); box-shadow: var(--leaf-bevel), var(--press-shadow-active); }
.action-btn::after {
  content: "";
  position: absolute;
  left: -8px;
  top: -10px;
  width: 38px;
  height: 38px;
  background: url("/images/site/moss-sprig.svg") no-repeat center / contain;
  transform: scaleY(-1);
  pointer-events: none;
}

/* Discord/Store as bare glowing badge art instead of a pill button - the
   artwork already carries its own icon, label, and leaf sprigs, so the
   pill background/border/shadow and the moss-sprig corner are dropped. */
.action-btn.action-btn-badge {
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}
.action-btn.action-btn-badge::after { content: none; }
.action-btn.action-btn-badge:active { box-shadow: none; }
.action-badge {
  height: 130px;
  width: auto;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}
.action-btn .btn-text { display: flex; flex-direction: column; gap: 0.1rem; }
.action-btn small { font-weight: 600; opacity: 0.85; font-size: 0.72rem; color: #ffe8c2; }
.action-btn .ip-text { font-size: 1.05rem; }

/* The IP button + player-count pill, stacked as one column that stretches
   to match the Discord/Store badges' height (.hero-actions has
   align-items:stretch, and this is a direct flex child of it). */
.ip-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  min-width: 210px;
}

/* Same jungle-green pill look as the nav's Home/Store links, just with a
   two-line label instead of an icon + word. */
.action-btn.server-ip {
  justify-content: center;
  text-align: center;
  padding: 0.5rem 1rem;
  min-width: 0;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--stone-darkest);
}
.action-btn.server-ip:hover { transform: translateY(-2px) scale(1.04); }
.action-btn.server-ip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stone-darkest); }
.action-btn.server-ip::after { content: none; }
.action-btn.server-ip .btn-text { align-items: center; }
.action-btn.server-ip .ip-text { font-size: 1.2rem; }
.action-btn.server-ip small { font-size: 0.62rem; }
.action-btn.server-ip .btn-title,
.action-btn.server-ip small {
  color: var(--on-dark);
  opacity: 1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  gap: 0.5rem;
  background: var(--brown-darkest);
  border: 3px solid var(--gold);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  margin: 0;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--on-dark);
  box-shadow: var(--shadow-hard);
}
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #888; border: 2px solid rgba(0,0,0,0.3); }
.status-dot.online { background: #57d97a; box-shadow: 0 0 8px #57d97a; }
.status-dot.offline { background: #e2513a; }

/* Keep Discord/IP/Store side by side even on narrow phones instead of
   stacking, shrinking each item to fit. */
@media (max-width: 560px) {
  .hero-actions { flex-wrap: nowrap; gap: 0.5rem; }
  .action-badge { height: 78px; }
  .action-btn { min-width: 0; }
  .ip-stack { min-width: 0; flex: 1; gap: 0.35rem; }
  .action-btn.server-ip { padding: 0.4rem 0.5rem; }
  .action-btn.server-ip .ip-text { font-size: 0.86rem; }
  .action-btn.server-ip small { font-size: 0.5rem; }
  .status-pill { padding: 0.3rem 0.55rem; font-size: 0.62rem; gap: 0.35rem; }
  .status-dot { width: 8px; height: 8px; }
}


.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brown-darkest);
  color: var(--gold-light);
  border: 3px solid var(--gold);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  box-shadow: var(--shadow-hard);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  font-weight: 700;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Tap feedback - a tiny lime-green firework of sparks bursting out from
   wherever you tap a button, link, or card, spawned by main.js on every
   click (each spark's --angle/--dist is set inline, per spark). */
.click-sparkle {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 9999;
}
.click-sparkle .spark {
  position: absolute;
  top: -1.5px;
  left: -1.5px;
  width: 3px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, #f4ffd6 0%, var(--click-blink) 55%, rgba(157, 255, 87, 0) 100%);
  box-shadow: 0 0 5px 1px rgba(157, 255, 87, 0.75);
  transform-origin: center top;
  transform: rotate(var(--angle)) translateY(0) scaleY(0.5);
  opacity: 1;
  animation: spark-burst 0.5s cubic-bezier(.2, .8, .3, 1) forwards;
}
.click-sparkle .spark.center {
  top: -3px;
  left: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--click-blink) 60%, rgba(157, 255, 87, 0) 80%);
  animation: spark-flash 0.25s ease-out forwards;
}
@keyframes spark-burst {
  0% { transform: rotate(var(--angle)) translateY(0) scaleY(0.5); opacity: 1; }
  100% { transform: rotate(var(--angle)) translateY(var(--dist)) scaleY(1); opacity: 0; }
}
@keyframes spark-flash {
  0% { opacity: 1; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(2.2); }
}
@media (prefers-reduced-motion: reduce) {
  .click-sparkle { display: none; }
}

/* ---------- Sections ---------- */
.section { padding: 1.5rem 0 3rem; }
.section h2 { text-align: center; font-size: 1.9rem; margin-bottom: 1.75rem; }
.heading-leaf { display: inline-block; width: 1.4em; height: 1.4em; object-fit: contain; vertical-align: middle; margin: 0 0.15em; }

/* Heading with extra bottom margin trimmed (used when a subtitle follows). */
.section h2.no-rule { margin-bottom: 0.2rem; }
.section-subtitle {
  text-align: center;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: var(--terracotta);
  margin: 0 0 1.4rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 340px));
  gap: 1.1rem;
  justify-content: center;
  max-width: 760px;
  margin: 0 auto;
}
.info-card {
  position: relative;
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--stone-bevel), var(--shadow-hard);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.info-card:hover { transform: translateY(-4px) rotate(-0.6deg); }
.info-card::after {
  content: "";
  position: absolute;
  top: -10px;
  left: -8px;
  width: 36px;
  height: 36px;
  background: url("/images/site/moss-sprig.svg") no-repeat center / contain;
  transform: scaleY(-1);
  pointer-events: none;
}
.info-card .value { font-family: "Minecraft", "Baloo 2", serif; font-weight: 800; font-size: 1.6rem; color: var(--terracotta); }
.info-card .label { color: var(--ink-soft); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.info-card.stacked .stat-divider { height: 2px; background: rgba(0, 0, 0, 0.22); border-radius: 2px; margin: 0.9rem 0; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.info-card.stacked .sub-value { font-family: "Minecraft", "Baloo 2", serif; font-weight: 700; font-size: 1.2rem; color: var(--moss-dark); }
.info-card.stacked .sub-label { color: var(--ink-soft); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }

.welcome-box {
  max-width: 720px;
  margin: 0 auto 2.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.1rem;
  font-weight: 600;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto 2.5rem;
}
.feature-card {
  position: relative;
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-align: center;
  box-shadow: var(--stone-bevel), var(--shadow-hard);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
  text-decoration: none;
  display: block;
}
.feature-card:hover { transform: translateY(-4px) rotate(0.6deg); }
.feature-card::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -8px;
  width: 34px;
  height: 34px;
  background: url("/images/site/moss-sprig.svg") no-repeat center / contain;
  transform: scale(-1, -1);
  pointer-events: none;
}
.feature-card .feature-icon {
  font-size: 1.7rem;
  margin: 0 auto 0.5rem;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.3), rgba(0, 0, 0, 0.14) 70%);
  border: 2px solid var(--stone-darkest);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.15), 0 2px 0 var(--stone-dark);
}
.feature-card .feature-icon img { width: 68%; height: 68%; object-fit: contain; }
.feature-card .feature-title { font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; color: var(--brown-dark); font-size: 1.02rem; margin-bottom: 0.2rem; }
.feature-card .feature-desc { color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }
a.feature-card.linked { border-color: var(--moss); }
a.feature-card.linked .feature-title { color: var(--link-accent); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bar-bg);
  color: var(--on-dark-soft);
  text-align: center;
  padding: 2rem 1.25rem;
  font-size: 0.85rem;
  border-top: 4px solid var(--gold);
}
.site-footer a { color: var(--gold-light); text-decoration: none; font-weight: 700; }

/* ---------- Store ---------- */
.store-tabs {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.store-tabs button {
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  cursor: pointer;
  color: var(--ink-soft);
  box-shadow: var(--stone-bevel), 0 4px 0 var(--stone-darkest), 0 7px 12px rgba(42, 22, 8, 0.22);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.store-tabs button:hover { transform: scale(1.06); }
.store-tabs button:active { transform: translateY(3px); box-shadow: var(--stone-bevel), 0 1px 0 var(--stone-darkest); }
.store-tabs button.active { background: linear-gradient(180deg, var(--moss-light), var(--moss)); border-color: var(--moss-dark); color: #fff; box-shadow: var(--stone-bevel), 0 4px 0 var(--moss-dark); }

/* Gamemode picker + category tabs, boxed together like the player-bar
   panel above them. Side by side on desktop (gamemode left, tabs right),
   stacked on narrow screens (gamemode on its own row, tabs below it). */
.store-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.store-controls .gamemode-dropdown { margin-bottom: 0; }
.store-controls .store-tabs { justify-content: flex-end; margin-bottom: 0; }
@media (max-width: 620px) {
  .store-controls { flex-direction: column; align-items: stretch; }
  .store-controls .gamemode-dropdown { justify-content: center; align-self: center; }
  .store-controls .store-tabs { justify-content: center; }
}

/* Cart toggle - floats bottom-right over the page (fixed to the viewport,
   not the store-controls bar it used to sit in). Solid yellow rather than
   the site's --gold (which actually reads as pale lime, see Buy Now) -
   picked specifically so this button doesn't blend in as another piece
   of chrome. Gently pulses with a glowing ring while the cart actually
   has something in it. Store icon + "Cart" label + item-count badge. */
.cart-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(180deg, #ffe066, #ffc107);
  border: 3px solid var(--stone-darkest);
  border-radius: 999px;
  padding: 0.75rem 1.4rem 0.75rem 0.8rem;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 5px 0 #b8860b, 0 10px 20px rgba(42, 22, 8, 0.4);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.cart-toggle[hidden] { display: none; }
.cart-toggle:hover { transform: scale(1.08); }
.cart-toggle:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 1px 0 #b8860b; }
.cart-toggle:has(.cart-badge:not([hidden])) { animation: cart-toggle-pulse 2s ease-in-out infinite; }
@keyframes cart-toggle-pulse {
  0%, 100% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 5px 0 #b8860b, 0 10px 20px rgba(42, 22, 8, 0.4), 0 0 0 0 rgba(255, 193, 7, 0.6); }
  50% { box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 5px 0 #b8860b, 0 10px 20px rgba(42, 22, 8, 0.4), 0 0 0 10px rgba(255, 193, 7, 0); }
}
.cart-icon { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
.cart-label {
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  color: #4a3300;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.cart-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--terracotta);
  color: #fff;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--stone-darkest);
  box-shadow: 0 2px 6px rgba(42, 22, 8, 0.4);
}
.cart-badge[hidden] { display: none; }
@media (max-width: 620px) {
  .cart-toggle { right: 1rem; bottom: 1rem; padding: 0.65rem 1.15rem 0.65rem 0.7rem; }
}

/* Cart modal rows - same "receipt" feel as the checkout summary. */
.cart-rows { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1rem; max-height: 50vh; overflow-y: auto; }
.cart-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed var(--stone-dark);
}
.cart-row:last-child { border-bottom: none; padding-bottom: 0; }
.cart-row-img {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--stone-darkest);
  background: var(--cream-dark);
}
.cart-row-body { flex: 1; min-width: 0; }
.cart-row-name { font-weight: 800; color: var(--ink); font-size: 0.92rem; }
.cart-row-tags { color: var(--ink-soft); font-size: 0.78rem; font-weight: 600; }
.cart-row-price { color: var(--terracotta); font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; white-space: nowrap; }
.cart-row-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}
.cart-row-remove:hover { color: var(--terracotta); }
.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.8rem;
  border-top: 2px dashed var(--stone-dark);
  margin-bottom: 1rem;
  font-weight: 800;
  color: var(--ink);
}
.cart-total-row strong { color: var(--terracotta); font-family: "Minecraft", "Baloo 2", sans-serif; font-size: 1.2rem; }

/* Gamemode picker - a custom dropdown (same pattern as the language
   switcher) instead of a native <select>, so the closed button can read
   "Gamemode: BoxPvP" while the open list just shows "BoxPvP", "SMP", etc. */
.gamemode-dropdown { position: relative; display: inline-flex; margin-bottom: 1.4rem; }
.gamemode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 0.65rem 1.4rem;
  border: 3px solid var(--moss-dark);
  border-radius: 999px;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: var(--brown-darkest);
  cursor: pointer;
  background: linear-gradient(180deg, var(--moss-light), var(--moss));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 4px 0 var(--moss-dark), 0 7px 12px rgba(42, 22, 8, 0.22);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.gamemode-toggle:hover { transform: scale(1.05); }
.gamemode-toggle:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 0 1px 0 var(--moss-dark); }
.gamemode-toggle:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.gamemode-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  min-width: 220px;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: 16px;
  box-shadow: var(--stone-bevel), 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%) translateY(-6px) scale(0.97);
  transform-origin: top center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.34,1.4,.64,1);
  z-index: 80;
}
.gamemode-dropdown.open .gamemode-menu { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); pointer-events: auto; }
.gamemode-option {
  display: flex;
  width: 100%;
  height: 42px;
  justify-content: center;
  align-items: center;
  color: var(--on-dark);
  font-weight: 700;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-size: 0.95rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.gamemode-option:hover { transform: scale(1.04); }
.gamemode-option:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stone-darkest); }
.gamemode-option.active {
  background: linear-gradient(180deg, var(--moss-light), var(--moss));
  color: var(--brown-darkest);
  border-color: var(--gold);
  box-shadow: var(--stone-bevel), 0 3px 0 var(--gold-deep);
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.4rem;
}
.item-card {
  position: relative;
  background: var(--stone-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--stone-bevel), var(--shadow-hard);
  display: flex;
  flex-direction: column;
  border: 3px solid var(--stone-darkest);
  cursor: pointer;
  /* The whole card is a tap target (opens the info popup), so mobile
     Chrome's default blue tap-highlight would otherwise flash across it -
     and everything inside, buttons included, since a tap anywhere in the
     card bubbles up through this same highlighted box. */
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.item-card:hover { transform: translateY(-5px) rotate(-0.5deg); }
/* A transformed ancestor becomes the containing block for its fixed-position
   descendants, which would break .uprank-menu's viewport-relative
   positioning while the card underneath it is being hovered. */
.item-card:has(.uprank-dropdown.open) { transform: none; }
.item-image-wrap { position: relative; }
.item-card img { width: 100%; height: 170px; object-fit: contain; padding: 0.5rem; background: var(--cream-dark); border-bottom: 3px solid var(--stone-darkest); }
/* ✨ Twinkling stars around the item art. Drawn in CSS (no image file) so
   they glow the same gold in both themes and never show a dark edge. */
.item-card .sparkle {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(circle at 50% 50%, #fffdf3 0%, var(--gold-light) 42%, var(--gold) 100%);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  filter: drop-shadow(0 0 5px rgba(255, 205, 90, 0.95));
  animation: sparkle-twinkle 2.2s ease-in-out infinite;
}
.item-card .sparkle-1 { top: 12px;  left: 13%;  animation-delay: 0s; }
.item-card .sparkle-2 { top: 34px;  right: 12%; width: 14px; height: 14px; animation-delay: 0.55s; }
.item-card .sparkle-3 { bottom: 18px; left: 22%; width: 13px; height: 13px; animation-delay: 1.1s; }
.item-card .sparkle-4 { top: 50%;   right: 6%;  width: 11px; height: 11px; animation-delay: 1.65s; }
@keyframes sparkle-twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.45) rotate(0deg); }
  45%      { opacity: 1;    transform: scale(1.2) rotate(35deg); }
  70%      { opacity: 0.55; transform: scale(0.85) rotate(60deg); }
}
@media (prefers-reduced-motion: reduce) {
  .item-card .sparkle { animation: none; opacity: 0.85; }
}
.item-card .item-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.item-card h3 { margin: 0; font-size: 1.1rem; color: var(--brown-dark); }
.item-card p { margin: 0; color: var(--ink-soft); font-size: 0.88rem; flex: 1; }
.item-card .price { font-family: "Minecraft", "Baloo 2", sans-serif; color: var(--terracotta); font-size: 1.25rem; font-weight: 800; }
.item-card .item-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Price display once an Up Rank trade-in is armed: "$20.00 → $5.00" plus a
   small caption naming the from/to ranks. */
.price-block { min-width: 0; }
.upgrade-price {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
}
.upgrade-price .price-was {
  color: var(--ink-soft);
  text-decoration: line-through;
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.75;
}
.upgrade-price .price-arrow { color: var(--ink-soft); font-size: 0.95rem; }
.upgrade-price .price-now { color: var(--terracotta); font-size: 1.25rem; }
.upgrade-caption {
  margin-top: 0.1rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
}
.rank-lime { color: var(--moss-light); font-weight: 800; }
.buy-btn {
  flex: 1;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--brown-darkest);
  border: 3px solid var(--stone-darkest);
  padding: 0.6rem;
  border-radius: 10px;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 4px 0 var(--stone-darkest), 0 7px 12px rgba(42, 22, 8, 0.22);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.buy-btn:hover { transform: scale(1.05); }
.buy-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 1px 0 var(--stone-darkest); }
.empty-note { text-align: center; color: var(--ink-soft); padding: 2rem; font-weight: 600; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 13, 8, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--stone-surface);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
  box-shadow: var(--stone-bevel), 8px 8px 0 rgba(42, 22, 8, 0.4), 10px 16px 20px rgba(42, 22, 8, 0.25);
  border: 4px solid var(--stone-darkest);
}
.modal-box.wide { max-width: 640px; }
.modal-box::before {
  content: "";
  position: absolute;
  top: -14px;
  left: -12px;
  width: 44px;
  height: 44px;
  background: url("/images/site/moss-sprig.svg") no-repeat center / contain;
  transform: scaleY(-1);
  pointer-events: none;
}
.modal-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--on-dark);
  font-weight: 800;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.modal-close:hover { transform: translateY(-2px) scale(1.06); }
.modal-close:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--stone-darkest); }
.modal-box h3 { margin-top: 0; }
.modal-box video, .modal-box iframe.video-embed {
  width: 100%;
  aspect-ratio: 16/9;
  border: 3px solid var(--brown-dark);
  border-radius: 10px;
  margin-bottom: 1rem;
  background: #000;
}
.modal-box .info-text { white-space: pre-line; color: var(--ink-soft); font-weight: 600; }

/* Region picker (Cambodia / Global) */
.region-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-top: 1.2rem; }
.region-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  background: var(--leaf-surface); border: 3px solid var(--brown-dark); border-radius: 12px;
  padding: 1.1rem 0.8rem; cursor: pointer; box-shadow: var(--leaf-bevel);
  color: var(--on-dark); transition: transform 0.15s ease;
}
.region-btn:hover { transform: translateY(-2px) scale(1.02); }
.region-flag { width: 44px; height: 44px; object-fit: contain; }
.region-name { font-weight: 800; font-size: 1.05rem; }
.region-desc { font-size: 0.8rem; opacity: 0.85; }

/* Buy flow */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field[hidden] { display: none; }
.field label { font-weight: 800; font-size: 0.9rem; color: var(--brown-dark); }
.field input[type="text"] {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 3px solid var(--stone-darkest);
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--ink);
}
.edition-toggle { display: flex; border-radius: 999px; overflow: hidden; border: 3px solid var(--brown-dark); }
.edition-toggle button {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: var(--input-bg);
  cursor: pointer;
  font-weight: 800;
  color: var(--brown-dark);
}
.edition-toggle button.active { background: linear-gradient(180deg, var(--moss-light), var(--moss)); color: #fff; }
.preview-name { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }
.continue-btn, .primary-btn {
  width: 100%;
  padding: 0.85rem;
  border: 3px solid var(--stone-darkest);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--brown-darkest);
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  cursor: pointer;
  font-size: 1.05rem;
  box-shadow: var(--press-shadow);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
a.continue-btn { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
.continue-btn:hover, .primary-btn:hover { transform: scale(1.03); }
.continue-btn:active, .primary-btn:active { transform: translateY(4px); box-shadow: var(--press-shadow-active); }
.continue-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.back-link { background: none; border: none; color: var(--brown-dark); cursor: pointer; font-weight: 700; padding: 0.3rem 0; }
.change-name-btn {
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--stone-light), var(--stone-mid));
  color: var(--ink);
  border: 2px solid var(--stone-darkest);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.change-name-btn:hover { transform: translateY(-2px); }
.change-name-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--stone-darkest); }

.qr-box { text-align: center; }
.qr-box img { width: 220px; height: 220px; margin: 0 auto 1rem; border: 4px solid var(--brown-darkest); box-shadow: var(--shadow-hard); border-radius: 10px; background: #fff; padding: 6px; }
.qr-meta { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--ink-soft); margin: 0.5rem 0; font-weight: 600; }
.qr-status { margin-top: 0.75rem; font-weight: 800; color: var(--terracotta); }

.success-box { text-align: center; }
.success-icon { font-size: 3rem; }
.success-box .receipt {
  text-align: left;
  background: var(--input-bg);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
  border: 3px solid var(--brown-dark);
}
.success-box .receipt div { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px dashed var(--brown-dark); font-size: 0.9rem; }
.success-box .receipt div:last-child { border-bottom: none; }
.tg-support-btn { display: inline-block; margin-top: 0.5rem; background: #229ed9; color: #fff; padding: 0.65rem 1.2rem; border-radius: 10px; text-decoration: none; font-weight: 800; border: 3px solid var(--stone-darkest); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3), 0 4px 0 var(--stone-darkest), 0 7px 12px rgba(42, 22, 8, 0.22); }

/* ---------- Map page ---------- */
.map-wrap { padding: 0.6rem 1.25rem 1.25rem; }
/* The map page has no .section wrapper, so it centres its own heading. */
.map-wrap h2 { text-align: center; font-size: 1.9rem; margin: 0 0 0.2rem; }
.map-wrap .section-subtitle { margin-bottom: 0.9rem; }
.map-age {
  text-align: center;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  color: var(--terracotta);
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}
.map-frame-holder {
  position: relative;
  width: 100%;
  height: 75vh;
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hard);
  background: var(--brown-darkest);
  border: 4px solid var(--stone-darkest);
}
.map-frame-holder iframe { width: 100%; height: 100%; border: none; }
.map-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--on-dark);
  text-align: center;
  padding: 1.5rem;
}
.map-fallback.show { display: flex; }
.map-fallback a { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--brown-darkest); padding: 0.7rem 1.4rem; border-radius: 10px; font-weight: 800; text-decoration: none; border: 3px solid var(--stone-darkest); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 4px 0 var(--stone-darkest); }

/* ---------- Checkout & success pages ---------- */
.checkout-wrap { max-width: 720px; }
.checkout-panel {
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: var(--radius);
  box-shadow: var(--stone-bevel), var(--shadow-hard);
  padding: 1.5rem;
  position: relative;
}
.checkout-panel::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -8px;
  width: 36px;
  height: 36px;
  background: url("/images/site/moss-sprig.svg") no-repeat center / contain;
  transform: scale(-1, -1);
  pointer-events: none;
}

.checkout-summary {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding-bottom: 1.1rem;
  border-bottom: 2px dashed var(--stone-dark);
}
.checkout-item-img {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--stone-darkest);
  background: var(--cream-dark);
}
.checkout-summary-text { flex: 1; min-width: 0; }
.checkout-summary-text h3 { margin: 0 0 0.25rem; }
.checkout-summary-text p { margin: 0 0 0.6rem; color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; }
.checkout-rows div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  padding: 0.22rem 0;
  color: var(--ink-soft);
  font-weight: 600;
}
.checkout-rows strong { color: var(--ink); }
.checkout-rows .price { color: var(--terracotta); font-family: "Minecraft", "Baloo 2", sans-serif; font-size: 1.1rem; }

/* Cart order summary - one row per item above the same .checkout-rows total. */
.checkout-summary-multi { flex-direction: column; align-items: stretch; }
.checkout-summary-multi h3 { margin: 0 0 0.6rem; }
.checkout-cart-rows { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.9rem; }
.checkout-cart-row { display: flex; align-items: center; gap: 0.7rem; }
.checkout-item-img.small { width: 48px; height: 48px; border-radius: 8px; }
.checkout-cart-row-body { flex: 1; min-width: 0; }
.checkout-cart-row-name { font-weight: 800; color: var(--ink); font-size: 0.9rem; }
.checkout-item-tags { color: var(--ink-soft); font-size: 0.78rem; font-weight: 600; }
.checkout-cart-row-price { color: var(--terracotta); font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; white-space: nowrap; }

/* Coupon step + discount row in the order summary */
.coupon-step { padding-top: 0.9rem; }
.coupon-input-row { display: flex; gap: 0.6rem; }
.coupon-input-row input {
  flex: 1;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 3px solid var(--stone-darkest);
  font-size: 0.95rem;
  background: var(--input-bg);
  color: var(--ink);
  text-transform: uppercase;
}
.coupon-input-row .change-name-btn { width: auto; padding: 0.7rem 1rem; white-space: nowrap; }
.coupon-applied-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--moss);
  margin: 0 0 0.3rem;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--terracotta);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.checkout-step { padding: 1.25rem 0 0; }
.checkout-step h3 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.checkout-hint { color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; margin: 0 0 0.8rem; }
.checkout-hint.centered { text-align: center; margin-top: 0.7rem; }
.checkout-hint a { color: var(--terracotta); font-weight: 800; }

.checkout-khqr {
  width: min(280px, 80%);
  margin: 0 auto;
  border-radius: 12px;
  border: 4px solid var(--stone-darkest);
  background: #fff;
  padding: 8px;
  box-shadow: var(--shadow-hard);
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border: 3px dashed var(--stone-dark);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.file-drop:hover, .file-drop.dragging {
  border-color: var(--moss);
  background: rgba(107, 181, 68, 0.12);
  transform: translateY(-2px);
}
.file-drop-icon { font-size: 2rem; }
.file-drop-text { font-weight: 700; color: var(--ink-soft); font-size: 0.9rem; word-break: break-all; }
.file-preview {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  border: 3px solid var(--stone-darkest);
  margin-top: 0.4rem;
}

#submit-btn { margin-top: 1.4rem; letter-spacing: 0.06em; }
#submit-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.success-panel { text-align: center; }
.success-title { margin: 0.3rem 0 0.6rem; }
.success-panel .receipt {
  text-align: left;
  background: var(--input-bg);
  border-radius: 10px;
  padding: 1rem;
  margin: 1.2rem 0;
  border: 3px solid var(--stone-dark);
}
.success-panel .receipt div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--stone-dark);
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.success-panel .receipt div:last-child { border-bottom: none; }
.success-panel .receipt strong { color: var(--ink); }
.success-actions { margin-top: 1.2rem; }
.success-actions .continue-btn { display: inline-block; width: auto; padding: 0.85rem 2.2rem; text-decoration: none; }

/* Price + Buy/Up Rank controls row inside the item info popup - same
   markup (priceMarkup + actionsMarkup) as the card, so the two never show
   conflicting states or prices. */
.info-buy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 2px dashed var(--stone-dark);
}
.info-buy-row .price { font-family: "Minecraft", "Baloo 2", sans-serif; font-size: 1.4rem; font-weight: 800; color: var(--terracotta); }
.info-buy-row .item-actions { flex: 1; min-width: 180px; display: flex; justify-content: flex-end; }
.info-buy-row .buy-btn { flex: 0 1 260px; padding: 0.9rem; font-size: 1.05rem; }
.info-buy-row .rank-split { flex: 0 1 260px; }

@media (max-width: 560px) {
  .checkout-summary { flex-direction: column; align-items: center; text-align: center; }
  .checkout-rows div { justify-content: space-between; }
  .info-buy-row { flex-direction: column; align-items: stretch; }
  .info-buy-row .price { text-align: center; }
  .info-buy-row .item-actions { justify-content: stretch; }
  .info-buy-row .buy-btn, .info-buy-row .rank-split { flex: 1 1 auto; }
}

/* Coming-soon placeholder items in the Other category */
.item-card.coming-soon { opacity: 0.82; }
.item-card.coming-soon:hover { transform: none; }
.item-card.coming-soon .price { color: var(--ink-soft); }
.buy-btn:disabled {
  background: linear-gradient(180deg, var(--stone-light), var(--stone-mid));
  color: var(--ink-soft);
  cursor: not-allowed;
  opacity: 0.75;
}
.buy-btn:disabled:hover { transform: none; }

/* ---------- Save-KHQR button ---------- */
.khqr-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
}
.save-khqr-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  color: var(--ink);
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  box-shadow: var(--stone-bevel), 0 4px 0 var(--stone-darkest), 0 7px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.save-khqr-btn:hover { transform: scale(1.05); }
.save-khqr-btn:active { transform: translateY(3px); box-shadow: var(--stone-bevel), 0 1px 0 var(--stone-darkest); }
.khqr-save-hint { margin: 0; font-size: 0.8rem; text-align: center; }

/* ---------- Games page ---------- */
.games-wrap { max-width: 860px; }

.games-gate { max-width: 460px; margin: 0 auto; text-align: center; }
.games-gate h3 { margin: 0.4rem 0 0.4rem; font-size: 1.35rem; }
.games-gate-icon { font-size: 2.8rem; line-height: 1; }
.games-gate .field { text-align: left; margin-top: 1.1rem; }
.games-gate .preview-name { display: block; margin-top: 0.35rem; }
.games-disclaimer { margin-top: 0.9rem; font-size: 0.8rem; opacity: 0.85; }

.verify-panel { max-width: 460px; margin: 0 auto; text-align: center; }
.verify-panel h3 { margin: 0.2rem 0 0.4rem; font-size: 1.35rem; }

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  margin-bottom: 1.1rem;
}
.player-id { display: flex; align-items: center; gap: 0.8rem; }
.player-avatar {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.3), rgba(0,0,0,0.14) 70%);
  border: 2px solid var(--stone-darkest);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.4), inset 0 -2px 0 rgba(0,0,0,0.15);
}
.player-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--ink-soft); }
.player-name { font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; font-size: 1.25rem; color: var(--brown-dark); }

.games-stats { margin-bottom: 1.1rem; max-width: none; }
.games-stats .info-card .value { color: var(--gold); }
.games-stats .info-card .sub-label { color: var(--terracotta); opacity: 0.9; }



.games-list-heading { text-align: center; margin: 0 0 1.2rem; font-size: 1.3rem; }
.game-card .game-icon {
  font-size: 3rem;
  text-align: center;
  padding: 1.6rem 0;
  background: var(--cream-dark);
  border-bottom: 3px solid var(--stone-darkest);
}

.profile-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
@media (max-width: 620px) {
  .player-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .player-id { justify-content: center; }
  .profile-actions { flex-direction: column; width: 100%; }
}

/* =========================================================
   Mini-game panel + the three games
   ========================================================= */
body.game-open { overflow: hidden; }

.game-overlay { padding: 0.75rem; }
.game-panel {
  background: var(--stone-surface);
  border: 4px solid var(--stone-darkest);
  border-radius: var(--radius);
  box-shadow: var(--stone-bevel), 8px 8px 0 rgba(0,0,0,0.4);
  width: 100%;
  max-width: 720px;
  max-height: 94vh;
  /* dvh tracks the browser's actually-visible viewport, not 100vh's
     largest-possible one - on mobile that's the difference between fitting
     and being cut off behind the address bar. Falls back to the vh value
     above on browsers that don't support dvh. */
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.game-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 3px solid var(--stone-darkest);
  background: rgba(0,0,0,0.14);
  flex-shrink: 0;
}
.game-panel-head h3 { margin: 0; font-size: 1.15rem; }
.game-panel-head .modal-close { position: static; }
.game-panel-body { padding: 1rem; overflow-y: auto; position: relative; }

/* intro + result screens */
.game-screen { text-align: center; padding: 0.5rem 0 0.25rem; }
.game-screen-icon { font-size: 3.2rem; line-height: 1; }
.game-screen h3 { margin: 0.4rem 0 0.5rem; font-size: 1.4rem; }
.game-reward-note { color: var(--ink-soft); font-weight: 700; font-size: 0.9rem; margin: 0.9rem 0 1.2rem; }
.game-go-btn { max-width: 260px; margin: 0 auto; }
.result-score { display: flex; flex-direction: column; gap: 0.1rem; margin: 0.6rem 0 0.3rem; }
.result-score-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--ink-soft); }
.result-score-value { font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; font-size: 2.2rem; color: var(--brown-dark); }
.coins-won {
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
  margin: 0.4rem 0 0.2rem;
}
.coins-won span { font-size: 1rem; color: var(--ink-soft); text-shadow: none; }
.result-detail { text-align: left; margin: 1rem 0; background: var(--input-bg); border: 3px solid var(--stone-dark); border-radius: 10px; padding: 0.9rem; }
.result-detail div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.28rem 0; border-bottom: 1px dashed var(--stone-dark); font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }
.result-detail div:last-child { border-bottom: none; }
.result-detail strong { color: var(--ink); text-align: right; }
.result-actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.result-actions .continue-btn { max-width: 260px; }

/* shared HUD strip */
.game-hud {
  display: flex;
  justify-content: space-around;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  margin-bottom: 0.75rem;
  background: rgba(0,0,0,0.16);
  border: 3px solid var(--stone-darkest);
  border-radius: 12px;
}
.hud-cell { display: flex; flex-direction: column; align-items: center; min-width: 60px; }
.hud-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--ink-soft); }
.hud-value { font-family: "Minecraft", "Baloo 2", sans-serif; font-weight: 800; font-size: 1.15rem; color: var(--brown-dark); }
.game-hint { text-align: center; font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; margin: 0.6rem 0 0; }

.game-stage {
  position: relative;
  width: 100%;
  height: min(58vh, 400px);
  border: 3px solid var(--stone-darkest);
  border-radius: 12px;
  overflow: hidden;
  background: #2f5a2a;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.game-canvas { display: block; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent; outline: none; }

/* --- Lava Run --- */
.lava-stage {
  background:
    linear-gradient(180deg, #1a1220 0%, #2a1a26 45%, #3a1e1c 100%);
  cursor: none;
  touch-action: none;
}

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  pointer-events: none;
  animation: float-up 0.7s ease-out forwards;
  text-shadow: 0 2px 3px rgba(0,0,0,0.6);
}
.float-text.good { color: #b6ff7a; }
.float-text.bad { color: #ff7a6b; }
@keyframes float-up { to { transform: translate(-50%, -180%); opacity: 0; } }

/* --- Block Breaker --- */
.bb-target {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.7rem;
  margin-bottom: 0.75rem;
  border: 3px solid var(--stone-darkest);
  border-radius: 12px;
  background: rgba(0,0,0,0.16);
}
.bb-target-label { font-size: 0.72rem; letter-spacing: 0.14em; font-weight: 800; color: var(--ink-soft); }
.bb-target-block {
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--bb, var(--gold));
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.bb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; justify-content: center; }
.bb-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  aspect-ratio: 1;
  padding: 0.25rem;
  cursor: pointer;
  border: 3px solid var(--stone-darkest);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bb) 28%, transparent);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.2), 0 3px 0 var(--stone-darkest);
  transition: transform 0.12s, opacity 0.15s;
  touch-action: manipulation;
}
.bb-cell:hover:not(:disabled) { transform: translateY(-2px) scale(1.03); }
.bb-cell:disabled { cursor: default; }
.bb-cell.hit { opacity: 0.25; transform: scale(0.86); }
.bb-cell.miss { animation: bb-shake 0.26s; border-color: #ff4d3d; }
@keyframes bb-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.bb-emoji { font-size: 1.5rem; line-height: 1; }
.bb-name { font-size: 0.6rem; font-weight: 700; color: var(--ink); text-align: center; line-height: 1.1; }

@media (max-width: 560px) {
  .game-panel-body { padding: 0.7rem; }
  .game-stage { height: min(52vh, 340px); }
  .hud-value { font-size: 1rem; }
  .bb-name { font-size: 0.55rem; }
  .result-score-value { font-size: 1.8rem; }
}

/* ---------- Daily coin progress (hub cards, intro + result screens) ---------- */
.daily-progress { margin: 0.6rem 0 0.9rem; text-align: center; }
.daily-progress-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.daily-progress.complete .daily-progress-label { color: var(--gold-deep); }
.daily-bar {
  height: 12px;
  border: 3px solid var(--stone-darkest);
  border-radius: 999px;
  background: var(--input-bg);
  overflow: hidden;
}
.daily-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--moss), var(--gold));
  transition: width 0.4s ease;
}
.daily-progress.complete .daily-bar i { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.daily-progress-note {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}

/* ---------- Wind Charge Dodge ---------- */
.dodge-stage {
  background:
    radial-gradient(circle at 50% 120%, rgba(255,255,255,0.10) 0%, transparent 60%),
    linear-gradient(180deg, #23405e 0%, #1a2f47 60%, #14243a 100%);
  cursor: none;
}

/* ---------- Diamond Rush ---------- */
.mine-grid {
  position: relative;
  display: grid;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem;
  border: 3px solid var(--stone-darkest);
  border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.10) 0 3px, transparent 3px 22px),
    linear-gradient(180deg, #4a4038, #322a24);
  transition: transform 0.12s;
}
.mine-grid.mine-boom { animation: mine-boom 0.3s; }
@keyframes mine-boom {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,80,40,0); }
  40% { box-shadow: inset 0 0 50px 12px rgba(255,90,40,0.7); transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}
.mine-grid.mine-shift .mine-cell:not(.mined) { animation: mine-shift 0.26s; }
@keyframes mine-shift { from { transform: translateY(-8px) scale(0.9); opacity: 0.4; } }
.mine-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  border: 3px solid #241d18;
  border-radius: 8px;
  background: linear-gradient(180deg, #6f6157, #55483f);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.16), 0 3px 0 #241d18;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
  touch-action: manipulation;
}
.mine-cell:hover:not(.mined) { transform: translateY(-2px) scale(1.04); }
.mine-cell:active:not(.mined) { transform: translateY(2px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.16), 0 1px 0 #241d18; }
.mine-cell.mined {
  cursor: default;
  background: linear-gradient(180deg, #1d1713, #120e0b);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.8);
}
.mine-cell.tnt { background: linear-gradient(180deg, #8a4030, #5f2a1e); border-color: #3d160f; }
.mine-emoji { font-size: 1.7rem; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.55)); }

/* ---------- Build It! ---------- */
.build-banner {
  text-align: center;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  min-height: 1.6em;
}
.build-banner.memorise { color: var(--gold-light); }
.build-banner.building { color: var(--moss-light); }
.build-banner.review { color: var(--ink-soft); }
.build-banner.perfect { color: var(--gold); animation: build-pop 0.4s; }
@keyframes build-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } }
.build-grid {
  display: grid;
  gap: 0.35rem;
  max-width: 340px;
  margin: 0 auto;
  padding: 0.45rem;
  border: 3px solid var(--stone-darkest);
  border-radius: 14px;
  background: rgba(0,0,0,0.22);
}
.build-grid.showing { box-shadow: 0 0 18px 4px rgba(255, 205, 90, 0.45); }
.build-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 3px solid var(--stone-darkest);
  border-radius: 7px;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  transition: transform 0.1s, background 0.12s;
  touch-action: manipulation;
}
.build-cell.filled { background: var(--stone-surface); box-shadow: inset 0 2px 0 rgba(255,255,255,0.2); }
.build-cell:hover:not(:disabled) { transform: scale(1.06); }
.build-cell:disabled { cursor: default; }
.build-cell.mark-right { border-color: var(--moss); box-shadow: 0 0 10px rgba(107,181,68,0.8); }
.build-cell.mark-wrong { border-color: #ff4d3d; box-shadow: 0 0 10px rgba(255,77,61,0.8); }
.build-cell.mark-missed { border-style: dashed; border-color: var(--gold); }
.build-emoji { font-size: 1.5rem; line-height: 1; }

.build-palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.8rem 0 0.6rem;
}
.build-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 62px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border: 3px solid var(--stone-darkest);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  box-shadow: 0 3px 0 var(--stone-darkest);
  transition: transform 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
}
.build-swatch:hover:not(:disabled) { transform: translateY(-2px); }
.build-swatch:disabled { opacity: 0.5; cursor: default; }
.build-swatch.active { border-color: var(--gold); box-shadow: 0 3px 0 var(--gold-deep), 0 0 12px rgba(255,205,90,0.6); }
.build-swatch-name { font-size: 0.58rem; font-weight: 700; color: var(--on-dark); line-height: 1.1; }
.build-done { max-width: 240px; margin: 0 auto; }
.build-done:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 560px) {
  .mine-grid { gap: 0.34rem; padding: 0.4rem; }
  .mine-cell { border-width: 2px; }
  .mine-emoji { font-size: 1.35rem; }
  .build-grid { gap: 0.28rem; max-width: 300px; }
  .build-cell { border-width: 2px; }
  .build-emoji { font-size: 1.2rem; }
  .build-swatch { min-width: 54px; padding: 0.32rem 0.4rem; }
  .build-banner { font-size: 0.95rem; }
  .daily-progress-label { font-size: 0.72rem; }
}

/* ---------- Khmer & Chinese typography ----------
   The small-caps look (uppercase + letter-spacing) is an English design
   device. Khmer is a cluster script: letter-spacing pulls its vowels and
   diacritics away from the consonants they belong to. Chinese has no case
   at all, so "uppercase" is a no-op and the extra letter-spacing just looks
   odd between characters. Both are switched off for ខ្មែរ and 中文 - Vietnamese
   stays on the English treatment since it's Latin script like French/German. */
html[lang="km"] .info-card .label,
html[lang="km"] .info-card.stacked .sub-label,
html[lang="km"] .player-label,
html[lang="km"] .result-score-label,
html[lang="km"] .hud-label,
html[lang="km"] .bb-target-label,
html[lang="km"] .section-subtitle,
html[lang="km"] #submit-btn,
html[lang="zh"] .info-card .label,
html[lang="zh"] .info-card.stacked .sub-label,
html[lang="zh"] .player-label,
html[lang="zh"] .result-score-label,
html[lang="zh"] .hud-label,
html[lang="zh"] .bb-target-label,
html[lang="zh"] .section-subtitle,
html[lang="zh"] #submit-btn {
  text-transform: none;
  letter-spacing: 0;
}
html[lang="km"] .section-subtitle { letter-spacing: 0.06em; }
/* Khmer needs a little more room between lines than Latin does. */
html[lang="km"] body { line-height: 1.75; }
html[lang="km"] .daily-progress-label,
html[lang="km"] .game-hint,
html[lang="km"] .checkout-hint { line-height: 1.7; }

/* ---------- Ranking page: Top Player (left/top) + Top Team (right/bottom) ---------- */
.ranking-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 760px) {
  .ranking-boards { grid-template-columns: 1fr; }
}
.ranking-source {
  margin: -0.4rem 0 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Points leaderboard ---------- */
.board-panel { padding: 1rem 1.1rem 1.2rem; }
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.board-head h3 { margin: 0; font-size: 1.1rem; }
.board-search {
  display: block;
  width: 100%;
  margin-bottom: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 3px solid var(--stone-darkest);
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.88rem;
}
.board-search::placeholder { color: var(--ink-soft); }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.board-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border: 3px solid var(--stone-darkest);
  border-radius: 10px;
  background: var(--input-bg);
  font-weight: 700;
  font-size: 0.9rem;
}
.board-row.is-you { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 205, 90, 0.45); }
.board-rank { font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif; font-size: 1.05rem; text-align: center; color: var(--ink-soft); }
.board-name { color: var(--ink); overflow-wrap: anywhere; }
.board-points { font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif; font-weight: 800; color: var(--gold-deep); white-space: nowrap; }
/* A player's rank tier (M1-M9) - reported live by the plugin, or derived
   from Star via tierFor() for admin-curated fallback data (both in
   public/js/ranking.js). Teams don't get one, only their Star total. */
/* Background color is set inline per-row (public/js/ranking.js's
   TIER_COLORS - M9's dull stone gray through M1's pure Minecraft green,
   same palette as the plugin's MaTierService.TIER_HEX). The dark
   text-shadow keeps the tier code readable against every color in that
   range, including the lighter ones (M1's bright green). */
.board-tier {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1.5px solid rgba(0, 0, 0, 0.35);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  vertical-align: middle;
}
.board-you {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--gold);
  color: #3a2a12;
  font-size: 0.66rem;
  font-weight: 800;
  vertical-align: middle;
}
.board-empty { color: var(--ink-soft); font-size: 0.88rem; text-align: center; padding: 0.6rem; }
.board-pager { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin-top: 0.7rem; }
.pager-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 2px solid var(--stone-darkest);
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--stone-darkest);
}
.pager-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--stone-darkest); }
.pager-btn:disabled { opacity: 0.35; cursor: default; }
.pager-label { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }

/* Ranking page reuses this leaderboard row for both Top Team and Top Player,
   just with a stat other than points in .board-points and the top 3 rows
   picked out with a medal-colored left border. */
.board-row.rank-1 { border-color: var(--gold-deep); box-shadow: 0 0 10px rgba(215, 255, 160, 0.35); }
.board-row.rank-2 { border-color: #c9c9c9; }
.board-row.rank-3 { border-color: #cd8a4c; }
.board-row.rank-1 .board-rank { color: var(--gold-deep); }
.board-row.rank-2 .board-rank { color: #c9c9c9; }
.board-row.rank-3 .board-rank { color: #cd8a4c; }

/* full table inside the modal */
.board-table-wrap { max-height: 55vh; overflow-y: auto; overflow-x: auto; margin: 0.6rem 0; border: 3px solid var(--stone-darkest); border-radius: 12px; }
.board-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.board-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-dark-soft);
  background: var(--bar-bg);
  border-bottom: 3px solid var(--stone-darkest);
}
.board-table td { padding: 0.45rem 0.6rem; border-bottom: 1px dashed var(--stone-dark); font-weight: 700; color: var(--ink); }
.board-table tr:last-child td { border-bottom: none; }
.board-table tr.is-you td { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.board-table td.board-rank { width: 48px; text-align: center; }
.board-table td.board-points { text-align: right; white-space: nowrap; }
html[lang="km"] .board-table th,
html[lang="zh"] .board-table th { text-transform: none; letter-spacing: 0; }

/* the name-change button while the 24h lock is on */
.back-link.locked { opacity: 0.65; cursor: not-allowed; }

@media (max-width: 560px) {
  .board-head { flex-direction: column; align-items: stretch; text-align: center; }
  .board-row { grid-template-columns: 36px 1fr auto; font-size: 0.84rem; padding: 0.4rem 0.5rem; }
  .board-table { font-size: 0.82rem; }
}

/* =========================================================
   Games hub — Points / Coins cards, plays left, countdown
   ========================================================= */
.board-mini-title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
html[lang="km"] .board-mini-title,
html[lang="zh"] .board-mini-title { text-transform: none; letter-spacing: 0; }
.board-list.mini { gap: 0.28rem; text-align: left; }
.board-list.mini .board-row { padding: 0.3rem 0.5rem; font-size: 0.82rem; grid-template-columns: 30px 1fr auto; }
.board-view-full {
  margin-top: 0.55rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--on-dark);
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  border-radius: 999px;
  box-shadow: 0 2px 0 var(--stone-darkest);
  cursor: pointer;
  transition: transform 0.15s;
}
.board-view-full:hover { transform: translateY(-1px); }
.games-stats .info-card.stacked { padding-bottom: 1rem; }

.sub-value.cap-reached { color: var(--gold); }

/* plays-left pips on each game card */
.plays-left { margin: 0.55rem 0 0.7rem; text-align: center; }
.plays-pips { display: flex; justify-content: center; gap: 4px; margin-bottom: 0.3rem; }
.plays-pips i {
  width: 15px;
  height: 9px;
  border-radius: 3px;
  border: 2px solid var(--stone-darkest);
  background: var(--moss);
}
.plays-pips i.spent { background: var(--input-bg); opacity: 0.7; }
.plays-label { font-size: 0.74rem; font-weight: 700; color: var(--ink-soft); }
.plays-left.none .plays-label { color: var(--terracotta); }
.game-card.spent { opacity: 0.72; }
.game-card .buy-btn:disabled { cursor: not-allowed; opacity: 0.7; }

/* 3… 2… 1… GO! - overlaid on the already-mounted, frozen game (see
   Arcade.setFrozen) rather than replacing it with a blank screen. */
.game-countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--radius);
  pointer-events: none;
}
.countdown-screen { padding: 2rem 0 1rem; }
.countdown-number {
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-weight: 800;
  font-size: 4.5rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 4px 0 var(--gold-deep), 0 8px 18px rgba(0,0,0,0.5);
  margin: 0.5rem 0 1rem;
}
.countdown-number.pop { animation: countdown-pop 0.75s ease-out; }
.countdown-number.go { color: var(--moss-light); font-size: 3.4rem; animation: countdown-go 0.4s ease-out; }
@keyframes countdown-pop {
  0% { transform: scale(1.6); opacity: 0; }
  25% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.75; }
}
@keyframes countdown-go {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* =========================================================
   Store — profile bar, rank button states, confirmation
   ========================================================= */
.store-profile { margin-bottom: 1.4rem; }
.store-profile .player-avatar img { width: 100%; height: 100%; object-fit: contain; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  border: 2px solid var(--stone-darkest);
  background: var(--input-bg);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink);
}
.profile-chip.coins { color: var(--gold-deep); }
.profile-chip[hidden] { display: none; }
.coin-icon { width: 1.1em; height: 1.1em; object-fit: contain; flex-shrink: 0; }
/* #store-rank-chip holds one .profile-chip per held rank - display:contents
   makes it invisible as a box, so each pill is a direct flex item of
   .profile-meta and wraps/gaps exactly like the coins chip beside it. */
#store-rank-chip { display: contents; }

.coin-unavailable-banner {
  margin: 0 0 1rem;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--terracotta);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--terracotta);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}
.coin-unavailable-banner[hidden] { display: none; }

/* rank buttons: upgrade / the one you hold / one you're past */
.buy-btn.rank-upgrade {
  background: linear-gradient(180deg, var(--moss-light), var(--moss));
  color: #1d3a12;
}
.buy-btn.rank-current {
  background: linear-gradient(180deg, var(--stone-light), var(--stone-mid));
  color: var(--ink-soft);
  border-color: var(--stone-dark);
  box-shadow: 0 3px 0 var(--stone-dark);
}
.buy-btn.rank-lower {
  background: linear-gradient(180deg, #e2584a, #b32f22);
  color: #fff1ee;
  border-color: #6d1a12;
  box-shadow: 0 3px 0 #6d1a12;
}
.buy-btn.rank-current:hover, .buy-btn.rank-lower:hover { transform: none; }

/* Confirm (80%) + Up Rank (20%) split, for a rank the player could trade a
   lower one in for. */
.rank-split { flex: 1; display: flex; gap: 0.35rem; align-items: stretch; }
.rank-split .confirm-part { flex: 4; }

/* Up Rank: a custom dropdown card styled the same as the language switcher
   (.lang-dropdown/.lang-toggle/.lang-menu/.lang-option), instead of a
   native <select> that pops the OS picker. */
.uprank-dropdown { position: relative; flex: 1; min-width: 44px; }
.uprank-toggle {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--brown-darkest);
  border: 3px solid var(--stone-darkest);
  border-radius: 10px;
  padding: 0.2rem 0.15rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 4px 0 var(--stone-darkest);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.uprank-toggle:hover { transform: scale(1.05); }
.uprank-toggle:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 1px 0 var(--stone-darkest); }
.up-rank-icon { font-size: 0.95rem; line-height: 1; }
.up-rank-label {
  font-size: 0.56rem;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.uprank-toggle.armed {
  background: linear-gradient(180deg, var(--moss-light), var(--moss));
  color: #1d3a12;
  border-color: #1d3a12;
}
/* position: fixed (not absolute) because .item-card clips overflow for its
   rounded corners and sparkles - an absolutely-positioned menu would be cut
   off by that. Coordinates are set inline by positionUprankMenu() in
   store.js right before the .open class is added. */
.uprank-menu {
  position: fixed;
  width: 170px;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--stone-surface);
  border: 3px solid var(--stone-darkest);
  border-radius: 16px;
  box-shadow: var(--stone-bevel), 0 10px 24px rgba(0, 0, 0, 0.45);
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.34,1.4,.64,1);
  z-index: 120;
}
.uprank-dropdown.open .uprank-menu { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.uprank-option {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  color: var(--on-dark);
  font-weight: 700;
  font-family: "Minecraft", "Baloo 2", "Kantumruy Pro", "Noto Sans SC", sans-serif;
  font-size: 0.85rem;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--jungle), var(--jungle-dark));
  border: 2px solid var(--stone-darkest);
  box-shadow: 0 3px 0 var(--stone-darkest);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s;
}
.uprank-option:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stone-darkest); }
.uprank-option.active {
  background: var(--stone-surface);
  color: var(--ink);
  border-color: var(--gold);
  box-shadow: var(--stone-bevel), 0 3px 0 var(--gold-deep);
}

.confirm-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  margin-bottom: 0.9rem;
}
.confirm-icon {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}
.confirm-head-text { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.confirm-head h3 { margin: 0; font-size: 1.3rem; }
.confirm-tag {
  display: inline-block;
  align-self: flex-start;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  background: var(--moss);
  color: #10290a;
  font-size: 0.72rem;
  font-weight: 800;
}
.confirm-rows { margin: 0 0 1rem; }
.confirm-rows div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.28rem 0; border-bottom: 1px dashed var(--stone-dark); font-size: 0.88rem; color: var(--ink-soft); font-weight: 600; }
.confirm-rows div:last-child { border-bottom: none; }
.confirm-rows strong { color: var(--ink); text-align: right; }
.duration-toggle { margin-bottom: 1rem; }

.confirm-qty-label {
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.qty-stepper {
  display: flex;
  align-items: stretch;
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid var(--brown-dark);
  margin-bottom: 1rem;
}
.qty-stepper .qty-btn {
  flex: 0 0 auto;
  width: 46px;
  border: none;
  background: var(--input-bg);
  color: var(--brown-dark);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.qty-stepper .qty-btn:hover { background: var(--stone-dark); }
.qty-stepper .qty-btn:active { background: var(--moss-dark); color: #fff; }
.qty-stepper .qty-input {
  flex: 1;
  min-width: 0;
  border: none;
  border-left: 3px solid var(--brown-dark);
  border-right: 3px solid var(--brown-dark);
  background: var(--input-bg);
  color: var(--ink);
  text-align: center;
  font-weight: 800;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-size: 1rem;
  -moz-appearance: textfield;
}
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper .qty-input:focus { outline: none; background: var(--cream-dark); }
.confirm-price {
  text-align: center;
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--terracotta);
  margin-bottom: 0.9rem;
}
/* All three actions (Confirm / Add to Cart / Cancel) sized identically so
   they read as one uniform button stack, not a primary button with two
   afterthoughts hanging off it. Only size/shape is unified here - each
   keeps its own color treatment (gold confirm, stone add-to-cart,
   outlined cancel) so Confirm still reads as the primary action. */
.confirm-actions { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.confirm-actions .continue-btn,
.confirm-actions .change-name-btn,
.confirm-actions .back-link {
  width: 100%;
  max-width: 260px;
  box-sizing: border-box;
  padding: 0.85rem;
  font-size: 1.05rem;
  border-radius: 12px;
  text-align: center;
}
.confirm-actions .change-name-btn { border-width: 3px; }
.confirm-actions .back-link {
  border: 3px solid var(--stone-darkest);
  background: transparent;
  color: var(--brown-dark);
  font-family: "Minecraft", "Baloo 2", sans-serif;
  font-weight: 800;
}

/* =========================================================
   Block Breaker + Diamond Rush textures
   ========================================================= */
.bb-target-tex {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  border: 2px solid var(--stone-darkest);
  border-radius: 5px;
}
.bb-tex {
  width: 100%;
  max-width: 46px;
  aspect-ratio: 1;
  image-rendering: pixelated;
  border: 2px solid var(--stone-darkest);
  border-radius: 5px;
  pointer-events: none;
}
.bb-cell { gap: 0.25rem; background: rgba(0,0,0,0.14); }
.bb-grid.bb-levelup { animation: bb-levelup 0.35s ease-out; }
@keyframes bb-levelup {
  0% { transform: scale(1); filter: brightness(1); }
  45% { transform: scale(1.04); filter: brightness(1.5); }
  100% { transform: scale(1); filter: brightness(1); }
}
.mine-tex {
  width: 100%;
  max-width: 44px;
  aspect-ratio: 1;
  image-rendering: pixelated;
  pointer-events: none;
}
.mine-cell { background: linear-gradient(180deg, #55483f, #3d332c); }

/* =========================================================
   TNT Escape + Block Parkour stages
   ========================================================= */
.tnt-stage { background: linear-gradient(180deg, #2a2018 0%, #1c1510 100%); cursor: none; touch-action: none; }
.parkour-stage {
  background: linear-gradient(180deg, #6fa8dc 0%, #a8cf7e 62%, #4e8a3c 100%);
  cursor: pointer;
  touch-action: none;
}
.parkour-stage.stage-hurt { animation: stage-hurt 0.22s; }
@keyframes stage-hurt {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,60,40,0); }
  50% { box-shadow: inset 0 0 60px 10px rgba(255,60,40,0.55); }
}

@media (max-width: 560px) {
  .countdown-number { font-size: 3.4rem; }
  .confirm-icon { width: 84px; height: 84px; }
  .board-list.mini .board-row { font-size: 0.76rem; grid-template-columns: 26px 1fr auto; }
}

/* Change-name modal: the live cooldown note that replaces a silent block */
.cooldown-note {
  padding: 0.55rem 0.8rem;
  margin: -0.2rem 0 0.9rem;
  border-radius: 10px;
  border: 2px solid var(--gold-deep);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: var(--gold-deep);
  font-weight: 700;
  text-align: center;
}
#change-name-save:disabled {
  background: linear-gradient(180deg, var(--stone-light), var(--stone-mid));
  color: var(--ink-soft);
  cursor: not-allowed;
  opacity: 0.85;
}
#change-name-save:disabled:hover { transform: none; }
