:root {
  --ink: #10261f;
  --ink-2: #3d5c52;
  --muted: #6b8a7e;
  --paper: #d7eee6;
  --paper-2: #c3e4d8;
  --card: #f6fbf8;
  --line: #b7d8cc;
  --navy: #0f7a63;
  --navy-2: #0b5c4b;
  --coral: #e85d4c;
  --amber: #e9b44c;
  --teal: #0f7a63;
  --leaf: #0b9b6b;
  --gold: #e9c46a;
  --violet: #2a6f5f;
  --rose: #c44569;
  --sky: #2a9d8f;
  --shadow: 0 14px 40px rgba(15, 122, 99, 0.14);
  --radius: 20px;
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --display: "Sora", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --blue: #1a73e8;
  --ub-sky: #eaf2ff;
  --ub-mint: #e7f7f4;
  --ub-nav-bg: rgba(255, 255, 255, 0.94);
  --ub-cta-bg: #0b2244;
  --ub-footer-bg: #0b2244;
  --ub-footer-text: rgba(255, 255, 255, 0.88);
  --ub-footer-heading: #ffffff;
  --ub-footer-link: rgba(255, 255, 255, 0.86);
  --ub-card-border: #eef2f8;
  --ub-hover-border: #d7e6ff;

}

html[data-ub-theme="night"] {
  color-scheme: dark;
  --ink: #f4f7fc;
  --ink-2: #dce6f5;
  --muted: #9aabc2;
  --paper: #0b1220;
  --paper-2: #102038;
  --card: #121c2e;
  --line: #2c3f5c;
  --navy: #eaf0fa;
  --navy-2: #d5e4ff;
  --blue: #7db3ff;
  --coral: #ff8a62;
  --amber: #f5b942;
  --teal: #4ad4c0;
  --leaf: #4ad4c0;
  --gold: #f5b942;
  --violet: #8b7cff;
  --rose: #ff8a62;
  --sky: #7db3ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  --ub-sky: #1a2d4a;
  --ub-mint: #12332e;
  --ub-nav-bg: rgba(11, 18, 32, 0.94);
  --ub-cta-bg: #1a73e8;
  --ub-footer-bg: #07101c;
  --ub-footer-text: #e8eef8;
  --ub-footer-heading: #ffffff;
  --ub-footer-link: #d5e4ff;
  --ub-card-border: #24364f;
  --ub-hover-border: #3a5a88;
}


* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  overflow-x: clip;
  -webkit-tap-highlight-color: rgba(15, 122, 99, 0.12);
}
body.nav-open { overflow: hidden; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
img, svg { max-width: 100%; height: auto; }

.paper-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(820px 460px at 0% -10%, rgba(42, 157, 143, 0.45), transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(15, 122, 99, 0.22), transparent 50%),
    radial-gradient(640px 380px at 50% 110%, rgba(233, 196, 106, 0.22), transparent 55%),
    #d7eee6;
}

html[data-ub-theme="night"] .paper-grain {
  background:
    radial-gradient(circle at 12% 18%, rgba(26, 115, 232, 0.18), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(15, 157, 138, 0.14), transparent 28%),
    linear-gradient(180deg, #0e1829 0%, #102038 48%, #0b1220 100%);
}

.ub-nav, .ub-footer, #app { position: relative; z-index: 1; }

.ub-skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  z-index: 100;
}
.ub-skip:focus { left: 12px; top: 12px; }

.ub-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100%;
  background: var(--ub-nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.ub-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 64px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0 20px;
  flex-wrap: nowrap;
}
.ub-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--navy);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.ub-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--card);
}
.ub-nav-links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.ub-nav-links li { flex-shrink: 0; }
.ub-nav-links a {
  display: block;
  padding: 6px 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.ub-nav-links a:hover,
.ub-nav-links a.is-active {
  background: var(--ub-sky);
  color: var(--blue);
}
.ub-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ub-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--navy);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.ub-theme-toggle:hover {
  border-color: var(--blue);
  background: var(--ub-sky);
}
.ub-theme-ico::before {
  content: "☾";
  font-size: 1rem;
  line-height: 1;
}
html[data-ub-theme="night"] .ub-theme-ico::before { content: "☀"; }
.ub-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ub-cta-bg);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ub-nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--card);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--navy);
}
.ub-burger,
.ub-burger::before,
.ub-burger::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.ub-burger { position: relative; background: currentColor; }
.ub-burger::before,
.ub-burger::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.18s ease, top 0.18s ease;
}
.ub-burger::before { top: -6px; }
.ub-burger::after { top: 6px; }
.ub-nav.is-open .ub-burger { background: transparent; }
.ub-nav.is-open .ub-burger::before { top: 0; transform: rotate(45deg); }
.ub-nav.is-open .ub-burger::after { top: 0; transform: rotate(-45deg); }

body.hide-topbar .ub-nav,
body:has(.game-shell) .ub-nav,
body.hide-topbar .ub-footer,
body:has(.game-shell) .ub-footer { display: none; }

.ub-page-hero { margin: 8px 0 28px; }
.ub-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.ub-kicker span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 157, 138, 0.16);
}
.ub-page-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.4vw, 2.75rem);
  line-height: 1.18;
  letter-spacing: -0.04em;
  color: var(--navy);
  font-weight: 800;
  margin: 0 0 16px;
}
.ub-page-hero .ub-lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}

.ub-footer {
  background: var(--ub-footer-bg);
  color: var(--ub-footer-text);
  padding-top: 0;
  margin-top: 48px;
}
.ub-footer-social {
  background: #1a73e8;
  color: #fff;
  padding: 16px 0;
}
.ub-footer-social-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}
.ub-footer-social a {
  color: #fff;
  margin-right: 16px;
  font-size: 1.15rem;
}
.ub-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 28px;
  align-items: start;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding-top: 48px;
}
.ub-footer p,
.ub-footer li {
  margin: 0 0 8px;
  font-size: 0.92rem;
}
.ub-footer ul { list-style: none; padding: 0; margin: 0; }
.ub-footer h6 {
  color: var(--ub-footer-heading);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin-bottom: 14px;
}
.ub-footer a { color: var(--ub-footer-link); }
.ub-footer a:hover { color: var(--ub-footer-heading); }
.ub-footer-copy {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding: 16px 0;
  font-size: 0.88rem;
}
.ub-footer-copy a { color: #fff; font-weight: 700; }

@media (max-width: 991px) {
  .ub-nav {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  .ub-nav-inner {
    padding: 0 8px;
    min-height: 56px;
    gap: 4px;
  }
  .ub-brand {
    min-width: 0;
    flex: 1 1 0;
    max-width: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .ub-theme-label { display: none; }
  .ub-nav-cta { display: none; }
  .ub-nav-actions {
    gap: 4px;
    flex-shrink: 0;
  }
  .ub-brand img { flex-shrink: 0; }
  .ub-nav-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
  .ub-nav-links { display: none; }
  .ub-nav.is-open .ub-nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--card);
    padding: 10px 12px max(16px, env(safe-area-inset-bottom));
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 60;
  }
  .ub-nav.is-open .ub-nav-links a {
    padding: 12px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    border-radius: 12px;
  }
  .ub-theme-toggle {
    min-height: 40px;
    min-width: 40px;
    width: 40px;
    padding: 0;
    justify-content: center;
  }
  .ub-nav-actions .hud-login {
    min-height: 40px;
    padding: 8px 10px;
  }
  .ub-nav-actions .hud-user {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
  .ub-footer-grid { grid-template-columns: 1fr 1fr; padding: 32px 0 0; }
}

/* Login HUD inside UPBoardBook nav */
.ub-nav-actions .ub-hud-auth,
.ub-nav-actions .topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
}
.ub-nav-actions .hud-login {
  padding: 7px 12px;
  font-size: 13px;
}
@media (max-width: 720px) {
  .ub-theme-label { display: none; }
  .ub-nav-cta { display: none; }
}


.ub-nav, .ub-footer, .topbar, #app { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(183, 216, 204, 0.85);
}
body.hide-topbar .topbar,
body:has(.game-shell:not(.auth-shell)) .topbar { display: none; }
.top-nav {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}
.top-nav a {
  font-weight: 750;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--ink-2);
}
.top-nav a:hover { background: #e4f5ee; color: var(--navy); }
.top-nav a.on { background: var(--navy); color: #fff; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.hud-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 122, 99, 0.2);
}
.hud-login:hover { filter: brightness(1.06); color: #fff; }
.hud-login[hidden] { display: none !important; }
.hud-auth-loading {
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  padding: 7px 10px;
}
.hud-auth-loading[hidden] { display: none !important; }
#hud-auth.is-authed .hud-login { display: none !important; }
.hud-account[hidden] { display: none !important; }

.hud-account {
  position: relative;
  flex-shrink: 0;
}
.hud-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 2px solid var(--line);
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.hud-user:hover,
.hud-account.is-open .hud-user {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15, 122, 99, 0.18);
}
.hud-user img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.hud-user-fallback {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}
.hud-user-fallback[hidden] { display: none !important; }
.hud-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 16px));
  padding: 16px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.hud-menu[hidden] { display: none !important; }
.hud-menu-name {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}
.hud-menu-email {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-align: center;
  word-break: break-word;
}
.hud-menu-email[hidden] { display: none !important; }
.hud-menu .hud-out {
  display: block;
  width: 100%;
  margin-top: 12px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
}
.hud-menu .hud-out:hover { color: var(--navy); border-color: var(--navy); background: #fff; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #2a9d8f, #0f7a63);
  color: #fff;
  font-size: 16px;
  box-shadow: 0 8px 18px rgba(15, 122, 99, 0.28);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-text strong {
  font-family: var(--display);
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text em { font-style: normal; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.hud { display: flex; gap: 8px; flex-wrap: wrap; }
.hud-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 122, 99, 0.06);
}
.hud-chip i { font-style: normal; }

.auth-shell { max-width: 480px; margin: 0 auto; }
.auth-shell .game-nav { display: none; }
.auth-google-wrap {
  display: flex;
  justify-content: center;
  margin: 20px 0 8px;
  min-height: 44px;
}
.auth-central-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  background: var(--navy, #0f7a63);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px rgb(15 122 99 / 0.22);
}
.auth-central-login:hover { filter: brightness(1.05); color: #fff; }
.google-btn-host { display: flex; justify-content: center; }
.auth-setup {
  font-size: 14px;
  color: var(--ink-2);
  text-align: center;
  line-height: 1.5;
  padding: 12px;
  background: #f4faf7;
  border-radius: 12px;
  border: 1px dashed var(--line);
}

.auth-stage h1 {
  font-family: var(--display);
  font-size: 28px;
  margin-bottom: 8px;
}
.auth-lead {
  color: var(--ink-2);
  margin-bottom: 18px;
}
.auth-form {
  display: grid;
  gap: 12px;
}
.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 750;
  font-size: 13px;
  color: var(--ink);
}
.auth-form input {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--navy);
}
.auth-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

#app { max-width: 1180px; margin: 0 auto; padding: 10px 20px 80px; width: 100%; min-width: 0; }
body.hide-classes #app > .section-head { margin-top: 4px; }
body:has(.game-shell:not(.auth-shell)) #app {
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
body:has(.game-shell:not(.auth-shell)) .game-shell .lb {
  margin-bottom: 0;
}
body:has(.game-shell:not(.auth-shell)) .lb-you {
  margin-bottom: 8px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 36px;
}
.kicker {
  display: inline-flex; gap: 8px; align-items: center;
  background: #e4f5ee;
  border: 1px solid #b7d8cc;
  color: #0f7a63;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.hero p.lede { color: var(--ink-2); font-size: 17px; max-width: 52ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 122, 99, 0.05);
}

.hero-board {
  background: linear-gradient(160deg, #2a9d8f 0%, #0f7a63 55%, #1fa88a 130%);
  color: #f6fbf8;
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(15, 122, 99, 0.28);
  min-height: 240px;
}
.hero-board h3 { font-family: var(--display); margin-bottom: 12px; }
.mini-games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
}
.mini b { display: block; font-size: 15px; margin-bottom: 2px; }

.section-head {
  display: flex; justify-content: space-between; align-items: end;
  margin: 28px 0 14px;
}
.section-head h2 { font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 8px; }
.section-head span { color: var(--muted); font-size: 14px; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  color: var(--ink-2);
  box-shadow: 0 4px 10px rgba(15, 122, 99, 0.04);
}
.filter-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.game-card {
  background: #fff;
  border: 1px solid rgba(15, 122, 99, 0.06);
  border-radius: 24px;
  padding: 14px 16px 14px 14px;
  box-shadow: 0 10px 28px rgba(15, 122, 99, 0.07);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  position: relative;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(15, 122, 99, 0.12); }
.rank {
  font-weight: 800;
  font-size: 22px;
  min-width: 22px;
  color: var(--coral);
  font-family: var(--display);
}
.rank.r2 { color: var(--violet); }
.rank.r3 { color: var(--amber); }
.card-art {
  width: 82px;
  min-width: 82px;
  height: 82px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f3f6ff;
}
.card-art .ico, .ico {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
}

.ico-2048 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 10px; background: #e8f6f1; }
.ico-2048 i { display: grid; place-items: center; border-radius: 6px; font-size: 11px; color: #fff; font-style: normal; font-family: var(--display); }
.ico-2048 i:nth-child(1) { background: #d4efe6; color: #1a4a40; }
.ico-2048 i:nth-child(2) { background: #2a9d8f; }
.ico-2048 i:nth-child(3) { background: #e9c46a; font-size: 10px; color: #10261f; }
.ico-2048 i:nth-child(4) { background: #e85d4c; }

.ico-24 { background: #e8fbf4; color: #0ca678; gap: 2px; }
.ico-24 b { font-size: 28px; font-family: var(--display); line-height: 1; }
.ico-24 em { font-style: normal; font-size: 9px; letter-spacing: 1px; color: #2a9d8f; }

.ico-clash { background: #eef4ff; gap: 6px; }
.ico-clash b { color: #e03131; font-size: 18px; letter-spacing: 1px; }
.ico-clash span { display: flex; gap: 4px; }
.ico-clash i { width: 10px; height: 10px; border-radius: 3px; }
.ico-clash i:nth-child(1) { background: #e03131; }
.ico-clash i:nth-child(2) { background: #2f9e44; }
.ico-clash i:nth-child(3) { background: #1c7ed6; }
.ico-clash i:nth-child(4) { background: #f59f00; }

.ico-conn {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  padding: 14px;
  background: #f3e8ff;
  place-items: stretch;
}
.ico-conn i {
  display: block;
  border-radius: 8px;
  min-height: 22px;
}
.ico-conn i:nth-child(1) { background: #f7c948; }
.ico-conn i:nth-child(2) { background: #94d82d; }
.ico-conn i:nth-child(3) { background: #74c0fc; }
.ico-conn i:nth-child(4) { background: #e599f7; }

.ico-rebus { background: #fff0f0; font-size: 26px; letter-spacing: 2px; }
.ico-flag { background: #eafaf1; font-size: 36px; }
.ico-flags {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  padding: 7px;
  background: #eafaf1;
}
.ico-flags img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
  background: #fff;
}
.ico-geo {
  background: radial-gradient(circle at 32% 28%, #8ed4f5, #1c86c4 58%, #0e5f8c);
  position: relative;
  overflow: hidden;
}
.ico-geo i {
  position: absolute;
  background: #2a9d8f;
  border-radius: 40% 60% 55% 45%;
  opacity: 0.92;
}
.ico-geo i:nth-child(1) { width: 22px; height: 16px; left: 10px; top: 18px; }
.ico-geo i:nth-child(2) { width: 18px; height: 14px; right: 12px; top: 22px; background: #0f7a63; }
.ico-geo i:nth-child(3) { width: 14px; height: 11px; left: 22px; bottom: 14px; }
.ico-gk { background: #eef2ff; position: relative; }
.ico-gk b { width: 36px; height: 44px; border-radius: 8px; background: #fff; color: #0f7a63; display: grid; place-items: center; font-size: 22px; box-shadow: 0 4px 10px rgba(15,122,99,.12); }
.ico-gk span { position: absolute; right: 14px; bottom: 14px; width: 18px; height: 18px; border-radius: 50%; background: #12b886; color: #fff; font-size: 11px; display: grid; place-items: center; }

.ico-hl { background: #f3e8ff; grid-template-columns: 1fr auto 1fr; gap: 2px; color: #7048e8; font-size: 16px; }
.ico-hl em { font-style: normal; font-size: 9px; color: #9775fa; }
.ico-hl b:last-child { color: #12b886; }

.ico-key { display: flex; gap: 3px; background: #fff8db; }
.ico-key i { width: 18px; height: 22px; background: #fff; border-radius: 4px; display: grid; place-items: center; font-style: normal; font-size: 11px; box-shadow: 0 2px 0 #e9d8a6; }

.ico-math { background: #fff4e6; color: #f76707; gap: 0; }
.ico-math b { font-size: 16px; font-family: var(--display); }
.ico-math em { font-style: normal; font-size: 13px; }

.ico-mirror { background: #e6fcf5; grid-template-columns: 1fr 8px 1fr; color: #0ca678; font-size: 26px; font-family: var(--display); }
.ico-mirror i { width: 2px; height: 42px; background: repeating-linear-gradient(#0ca678 0 4px, transparent 4px 8px); justify-self: center; }

.ico-seq { display: flex; gap: 3px; background: #e6fcf5; }
.ico-seq b { font-size: 11px; background: #fff; padding: 4px 5px; border-radius: 6px; color: #0ca678; }

.ico-mem { display: flex; gap: 6px; background: #e6fcf5; }
.ico-mem i { width: 26px; height: 32px; border-radius: 6px; background: #0ca678; color: #fff; display: grid; place-items: center; font-style: normal; font-size: 13px; }

.ico-queen { background: #fff8db; color: #f59f00; font-size: 16px; letter-spacing: 1px; }
.ico-bee { background: #fff8db; position: relative; }
.ico-bee i { width: 28px; height: 24px; background: #ffd43b; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.ico-bee b { position: absolute; font-size: 12px; color: #5c4800; }

.ico-sdk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 14px; background: #eef2ff; }
.ico-sdk span { background: #fff; border-radius: 3px; font-size: 9px; display: grid; place-items: center; color: #0f7a63; }

.ico-syn { background: #f3e8ff; gap: 3px; }
.ico-syn i { font-style: normal; font-size: 8px; background: #fff; padding: 3px 6px; border-radius: 999px; color: #7048e8; }
.ico-syn em { font-style: normal; font-size: 10px; color: #845ef7; }

.ico-tf { display: flex; gap: 6px; background: #fff0f0; }
.ico-tf b { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; }
.ico-tf b:first-child { background: #12b886; color: #fff; }
.ico-tf b:last-child { background: #ff5a6a; color: #fff; }

.ico-wg { display: flex; gap: 3px; background: #e6fcf5; }
.ico-wg i { width: 14px; height: 18px; background: #0ca678; color: #fff; font-size: 9px; border-radius: 3px; display: grid; place-items: center; font-style: normal; }

.ico-ws { background: #f6f0e4; color: #3a3226; font-size: 11px; letter-spacing: 1px; font-family: var(--display); }
.ico-zip { display: flex; align-items: center; gap: 3px; background: #e6fcf5; color: #0ca678; }
.ico-zip b { width: 16px; height: 16px; border-radius: 50%; background: #12b886; color: #fff; font-size: 9px; display: grid; place-items: center; }
.ico-zip i { width: 8px; height: 2px; background: #12b886; }
.ico-jug {
  background: #e6f7f2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  padding: 8px 8px 7px;
}
.ico-jug .j {
  display: block;
  border: 3px solid #0f7a63;
  border-radius: 3px 3px 7px 7px;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
}
.ico-jug .j8 { width: 16px; height: 38px; }
.ico-jug .j5 { width: 14px; height: 30px; }
.ico-jug .j3 { width: 11px; height: 20px; }
.ico-jug .j i {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #6ed7ee, #1a8fb5);
}
.ico-jug .j8 i { height: 88%; }
.ico-jug .j5 i { height: 0; }
.ico-jug .j3 i { height: 0; }
.card-body { padding: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.card-body h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.2; }
.card-body p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tag {
  font-size: 12px;
  font-weight: 650;
  color: #2f9e6b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.tag::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3dbe7a;
}
.tag.study { color: #8a4b12; }
.tag.study::before { background: #e4b84a; }
.new-pill {
  display: inline-block;
  background: #d9f6e6;
  color: #178a4e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
}
.chev {
  color: #c8c2d4;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  padding-left: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 40px;
  max-width: 640px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}
.panel h2 { font-family: var(--display); margin-bottom: 10px; }
.panel li { margin: 8px 0 8px 18px; color: var(--ink-2); }

.faq details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { color: var(--ink-2); margin-top: 6px; }

/* Game chrome */
.game-shell { max-width: 720px; margin: 0 auto; width: 100%; }
.game-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 16px;
}
.game-shell:not(:has(.auth-stage)) .game-nav { display: none; }
.game-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 auto 12px;
  max-width: 720px;
  width: 100%;
}
.game-tools-left {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}
.game-tools-center {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}
.game-levels-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: #fff;
  border: 2px solid var(--navy, #0f7a63);
  color: var(--navy, #0f7a63);
  cursor: pointer;
  line-height: 1.1;
  box-shadow: 0 2px 0 rgba(15, 122, 99, 0.12);
}
.game-levels-btn:hover {
  background: #e8f6f1;
  transform: translateY(-1px);
}
.game-levels-btn:active {
  transform: translateY(0);
}
.game-shell:has(.auth-stage) .game-tools { display: none; }
.game-tools-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
.game-tools-right {
  flex-shrink: 0;
  justify-self: end;
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.game-total-score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #e6ecea;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted, #5a6b66);
  white-space: nowrap;
}
.game-total-score b {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #1a2e28);
  min-width: 1.5ch;
  text-align: right;
}
.game-hint-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: #fff8e6;
  border: 2px solid #e0a800;
  color: #8a6400;
  cursor: pointer;
  line-height: 1.1;
  box-shadow: 0 2px 0 rgba(224, 168, 0, 0.18);
}
.game-hint-btn:hover {
  background: #fff3cc;
  transform: translateY(-1px);
}
.game-hint-btn:active {
  transform: translateY(0);
}
.hint-pop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  background: rgba(16, 38, 31, 0.42);
  backdrop-filter: blur(5px);
}
.hint-pop-card {
  width: min(420px, 100%);
  background: #f4faf7;
  border-radius: 24px;
  padding: 28px 22px 20px;
  text-align: left;
  box-shadow: 0 22px 50px rgba(15, 122, 99, 0.22);
}
.hint-pop-card h2 {
  font-family: var(--display);
  font-size: clamp(22px, 5vw, 28px);
  color: var(--navy);
  margin: 0 0 14px;
  text-align: center;
  letter-spacing: -0.03em;
}
.hint-pop-list {
  margin: 0 0 18px;
  padding-left: 1.25em;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.45;
}
.hint-pop-list li {
  margin: 0 0 8px;
}
.hint-pop-empty {
  text-align: center;
  color: var(--ink-2);
  margin: 0 0 18px;
  font-weight: 650;
}
.hint-pop-answer {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eaf7f2;
  border: 1px solid #b7d8cc;
}
.hint-pop-answer span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.hint-pop-answer b {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  word-break: break-word;
  line-height: 1.3;
}
.hint-pop-how-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.board-game-tools {
  display: grid;
}
.board-game-tools .game-tools-center:empty {
  display: none;
}
.board-game-tools .game-tools-right {
  margin-left: 0;
}
.game-tools .ghost {
  padding: 8px 14px;
  font-weight: 650;
  border-radius: 999px;
}
.game-how-btn {
  flex-shrink: 0;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .game-tools {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "back score"
      "level level";
    gap: 8px;
  }
  .game-tools-left { grid-area: back; gap: 6px; }
  .game-tools-center { grid-area: level; justify-self: stretch; }
  .game-tools-right {
    grid-area: score;
    width: 100%;
    justify-content: flex-end;
  }
  .game-tools .back { padding: 8px 10px; font-size: 13px; }
  .game-tools .ghost { padding: 8px 10px; font-size: 13px; }
  .game-tools .game-how-btn { padding-inline: 8px; font-size: 12px; }
  .game-levels-btn {
    min-width: 0;
    width: 100%;
    max-width: none;
    padding: 10px 12px;
    font-size: 13px;
  }
  .game-total-score { padding: 7px 8px; font-size: 11px; gap: 4px; }
  .game-total-score b { font-size: 13px; }
  .game-total-score span:first-child { display: none; }
  .game-total-score::before { content: "Score"; font-weight: 650; }
  .level-pop-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }
  .level-pop-list .wj-level b,
  .level-pop-list .level-pop-item b {
    font-size: 10px;
  }
}
@media (max-width: 520px) {
  .level-pop-card {
    border-radius: 22px;
    padding: 16px 12px 14px;
    max-height: min(88vh, 720px);
  }
}
.game-shell:has(.k48) .game-tools {
  max-width: 460px;
}
.game-shell:has(.k48) .game-tools .back,
.game-shell:has(.k48) .game-tools .ghost {
  background: #fff;
  border-color: #e6ecea;
}
.game-shell.wide-map .game-tools { max-width: 720px; }
.back {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 650;
}
.rank-opt.on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.game-panel-ranking {
  margin-top: 16px;
}
.game-panel[hidden] { display: none !important; }
.ranking-panel {
  padding: 4px 0 8px;
}
.rank-options {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.rank-opt {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
}
.rank-hint {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f4faf7;
  border-radius: 12px;
  border: 1px dashed var(--line);
}
.rank-hint a { color: var(--navy); font-weight: 700; }
.lb-mini--guest { color: var(--muted); font-weight: 650; }
.board-rank-btn {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
}
.board-rank-btn.on {
  background: #e4f5ee;
  border-color: var(--navy);
  color: var(--navy);
}
.board-rank-panel {
  margin-top: 12px;
}
.complete-pop-btns {
  flex-wrap: wrap;
}
.mode-toggle { display: flex; background: var(--paper-2); border-radius: 999px; padding: 3px; }
.mode-toggle button {
  border: 0; background: transparent; border-radius: 999px;
  padding: 7px 12px; font-weight: 650; color: var(--ink-2);
}
.mode-toggle button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.game-head { margin-bottom: 18px; display: flex; align-items: center; gap: 14px; }
.game-shell .game-head { display: none; }
.game-head-icon { width: 64px; min-width: 64px; height: 64px; }
.game-head-icon .ico { width: 64px; height: 64px; border-radius: 16px; }
.game-head h1 { font-family: var(--display); font-size: 30px; }
.game-head p { color: var(--ink-2); }

.stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
  overflow-x: hidden;
  overflow-y: visible;
  max-width: 100%;
}
.how-to {
  max-width: 720px;
  margin: 16px auto 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}
.game-shell .how-to {
  max-width: none;
  box-shadow: none;
}
.how-to h2 {
  font-family: var(--display);
  font-size: 16px;
  margin-bottom: 10px;
}
.how-to ol {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 14px;
  display: grid;
  gap: 8px;
}
.how-to li { line-height: 1.45; }
.how-to-kicker {
  font-weight: 800;
  color: var(--navy);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.how-to-meta {
  text-align: center;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 13px;
  margin: 4px 0 12px;
}
.how-to-stage .how-to {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  max-width: none;
}
.how-to-stage .how-to h2 { font-size: 22px; margin-bottom: 12px; }
.how-to-stage .how-to ol { font-size: 15px; gap: 10px; }
.how-to-more {
  margin-top: 16px;
}
.how-to-more summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  list-style: none;
}
.how-to-more summary::-webkit-details-marker { display: none; }
.how-to-more summary::after {
  content: " ▾";
  color: var(--navy);
}
.how-to-more[open] summary::after { content: " ▴"; }
.how-to-more ol { margin-top: 10px; }

.bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.bar .meta { color: var(--muted); font-size: 13px; font-weight: 650; }
.primary, .ghost, .danger {
  border-radius: 12px; padding: 10px 14px; font-weight: 700; border: 0;
}
.primary { background: var(--navy); color: #fff; }
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.ghost { background: var(--paper); border: 1px solid var(--line); }
.danger { background: #fde8e4; color: #9b2c1c; }
.wide { width: 100%; margin-top: 12px; }

.choices { display: grid; gap: 8px; }
.choice, .opt {
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 650;
}
.choice:hover, .opt:hover { border-color: var(--navy); }
.choice.good, .opt.good, button.good {
  background: #2a9d8f !important;
  border-color: #2a9d8f !important;
  color: #fff !important;
}
.guess-row input.good {
  background: #e6f4ee;
  border-color: #2a9d8f;
  color: #146b45;
}
.guess-row input.bad {
  background: #fde8e4;
  border-color: var(--coral);
}
.prompt.good { color: #178a4e; }
.conn-grid button.good { background: #2a9d8f; color: #fff; }
.found-list span.fresh { background: #d9f6e6; color: #178a4e; font-weight: 800; }
.choice.bad, .opt.bad { background: #fde8e4; border-color: var(--coral); }

.prompt {
  font-family: var(--display);
  font-size: clamp(20px, 5vw, 28px);
  text-align: center;
  margin: 8px 0 16px;
  overflow-wrap: anywhere;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--coral); }

.result {
  text-align: center; padding: 12px 8px;
}
.result h2 { font-family: var(--display); font-size: 32px; margin-bottom: 6px; }
.result p { color: var(--ink-2); font-weight: 650; }
.result .primary { min-width: 220px; margin-top: 18px; }

.complete-pop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  background: rgba(16, 38, 31, 0.14);
  backdrop-filter: blur(1.5px);
}
.complete-pop-card {
  width: min(400px, 100%);
  background: rgba(244, 250, 247, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(1px);
  border-radius: 28px;
  padding: 36px 22px 22px;
  text-align: center;
  box-shadow: 0 22px 50px rgba(15, 122, 99, 0.22);
}
.complete-pop-card h2 {
  font-family: var(--display);
  font-size: clamp(26px, 6vw, 34px);
  color: var(--navy);
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}
.complete-pop-card h2.complete-pop-fail {
  color: #c62828;
}
html[data-ub-theme="night"] .complete-pop-card h2.complete-pop-fail {
  color: #ff6b6b;
}
.complete-pop-card p {
  color: var(--ink-2);
  font-weight: 650;
  margin: 0 0 8px;
}
.complete-pop-card .complete-pop-score {
  color: var(--teal, #0f7a63);
  font-size: clamp(20px, 4.5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 24px;
}
.complete-pop-card p:last-of-type {
  margin-bottom: 24px;
}
.complete-pop-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.complete-pop-btns .ghost,
.complete-pop-btns .primary {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 11px 10px;
  font-size: 14px;
  white-space: nowrap;
}
.lb-you {
  margin: 8px auto 16px;
  max-width: 420px;
  padding: 12px 16px;
  background: #e4f5ee;
  border: 2px solid var(--navy);
  border-radius: 14px;
  font-weight: 750;
  color: var(--ink);
  font-size: 15px;
}
.lb-you b {
  font-family: var(--display);
  font-size: 22px;
  color: var(--navy);
}
.lb {
  max-width: 720px;
  margin: 16px auto 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 14px;
}
.game-shell .lb { max-width: none; }
.lb h2 {
  font-family: var(--display);
  font-size: 16px;
  margin-bottom: 6px;
}
.lb-mini {
  color: var(--navy);
  font-weight: 750;
  font-size: 13px;
  margin-bottom: 10px;
}
.lb-source {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy, #0f7a63);
  margin: -6px 0 10px;
}
.lb ol {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.lb li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 650;
}
.lb li b {
  font-family: var(--display);
  color: var(--muted);
}
.lb li.gold b { color: #c9a227; }
.lb li.silver b { color: #7a8a99; }
.lb li.bronze b { color: #c46b3a; }
.lb li.on {
  outline: 2px solid var(--navy);
  background: #e4f5ee;
}
.lb li em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--navy);
}
.lb li.lb-empty {
  display: block;
  background: transparent;
  color: var(--muted);
  padding: 8px 4px;
}

.toast {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 999px; z-index: 50; font-weight: 650;
  max-width: calc(100vw - 24px);
  text-align: center;
}

.coach { position: fixed; inset: 0; z-index: 80; }
.coach-spot {
  position: fixed;
  border-radius: 18px;
  box-shadow: 0 0 0 4px #fff, 0 0 0 9999px rgba(16, 38, 31, 0.58);
  pointer-events: none;
  z-index: 1;
  transition: top 0.22s ease, left 0.22s ease, width 0.22s ease, height 0.22s ease;
}
.coach-arrow {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  animation: coach-bounce 0.85s ease-in-out infinite;
}
.coach-arrow.up { animation-name: coach-bounce-up; }
@keyframes coach-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}
@keyframes coach-bounce-up {
  0%, 100% { transform: rotate(180deg) translateY(0); }
  50% { transform: rotate(180deg) translateY(-8px); }
}
.coach-cloud {
  position: fixed;
  z-index: 3;
  background: #fffefb;
  border: 3px solid #1e4d42;
  border-radius: 32px;
  padding: 20px 16px 12px;
  box-shadow: 0 12px 28px rgba(16, 38, 31, 0.22);
}
.coach-cloud::before,
.coach-cloud::after {
  content: "";
  position: absolute;
  background: #fffefb;
  border: 3px solid #1e4d42;
  border-radius: 50%;
  pointer-events: none;
}
.coach-cloud::before {
  width: 28px;
  height: 28px;
  top: -12px;
  left: 22px;
}
.coach-cloud::after {
  width: 18px;
  height: 18px;
  top: -6px;
  left: 44px;
}
.coach-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 6px;
}
.coach-text {
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 12px;
}
.coach-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* 2048 — colorful puzzle UI */
@property --k48x {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --k48y {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
body:has(.k48) .paper-grain {
  background: #fff;
}
body:has(.k48) {
  background: #fff;
}
body.hide-topbar:has(.k48) #app {
  padding-top: max(16px, env(safe-area-inset-top));
}
body:has(.k48.is-dark) .paper-grain {
  background: #12181c;
}
body:has(.k48.is-dark) {
  background: #12181c;
}
.game-shell:has(.k48) {
  max-width: 460px;
}
.game-shell:has(.k48) .lb {
  background: #fff;
  border-color: #e6ecea;
  box-shadow: 0 8px 24px rgba(47, 62, 70, 0.06);
}
.game-shell:has(.k48.is-dark) .lb {
  background: #1a2228;
  border-color: #2a353c;
  color: #eef2f6;
}
.game-shell:has(.k48.is-dark) .lb h2,
.game-shell:has(.k48.is-dark) .lb-mini { color: #eef2f6; }
.game-shell:has(.k48.is-dark) .lb li {
  background: #243038;
  color: #eef2f6;
}
.stage:has(.k48) {
  background: #fff;
  border: 0;
  padding: 6px 4px 10px;
  border-radius: 0;
  box-shadow: none;
}
.stage:has(.k48.is-dark) {
  background: #12181c;
  border: 0;
  box-shadow: none;
}
.k48 {
  --k48-ink: #2c3340;
  --k48-muted: #8a93a0;
  --k48-board: #93d0c6;
  --k48-empty: #7cbbb1;
  --k48-orange: #ffa33a;
  --k48-indigo: #5f6bb8;
  --k48-mint: #d4ede8;
  --k48-btn: #ffa33a;
  --k48-btn-shadow: #e08a28;
  --k48-overlay: rgba(255, 255, 255, 0.9);
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  font-family: var(--display);
  color: var(--k48-ink);
}
.k48.is-dark {
  --k48-ink: #eef2f6;
  --k48-muted: #9aa3b0;
  --k48-board: #2f5f58;
  --k48-empty: rgba(255, 255, 255, 0.1);
  --k48-mint: #2a4a46;
  --k48-overlay: rgba(12, 22, 28, 0.9);
}
.k48-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.k48-logo {
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--k48-orange);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.k48-brand {
  flex: 1;
  min-width: 0;
}
.k48-brand strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: var(--k48-ink);
  line-height: 1.2;
}
.k48-brand span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--k48-muted);
  margin-top: 2px;
}
.k48-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.k48-box {
  color: #fff;
  border-radius: 20px;
  padding: 12px 16px 14px;
  text-align: center;
}
.k48-box-score { background: var(--k48-orange); }
.k48-box-best { background: var(--k48-indigo); }
.k48-box span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.92);
}
.k48-box b {
  display: block;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.k48-box.bump b { animation: k48-score 0.28s ease; }
@keyframes k48-score {
  0% { transform: scale(1); }
  35% { transform: scale(1.32); }
  100% { transform: scale(1); }
}
.k48-hint {
  font-size: 14px;
  font-weight: 600;
  color: var(--k48-ink);
  margin: 0 0 14px;
  line-height: 1.35;
  text-align: center;
}
.k48-hint b { color: var(--k48-orange); font-weight: 800; }
.k48-btns { display: flex; gap: 8px; flex-shrink: 0; }
.k48-new {
  background: var(--k48-btn);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  font-size: 14px;
}
.k48-new:active { transform: translateY(1px); }
.k48-iconbtn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--k48-mint);
  color: #5a6570;
  display: grid;
  place-items: center;
}
.k48-iconbtn:active { transform: scale(0.96); }
.k48-iconbtn svg {
  width: 20px;
  height: 20px;
  display: block;
}
.k48-mute .k48-ico-off { display: none; }
.k48-mute.is-muted .k48-ico-on { display: none; }
.k48-mute.is-muted .k48-ico-off { display: block; }
.k48-theme .k48-ico-sun { display: none; }
.k48.is-dark .k48-theme .k48-ico-moon { display: none; }
.k48.is-dark .k48-theme .k48-ico-sun { display: block; }
.k48.is-dark .k48-iconbtn { color: #d5dde4; }
.k48-board {
  position: relative;
  background: var(--k48-board);
  border-radius: 32px;
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  touch-action: none;
  user-select: none;
  overflow: hidden;
  overscroll-behavior: contain;
  margin-left: auto;
  margin-right: auto;
}
.k48-board.thump { animation: k48-thump 0.18s ease; }
@keyframes k48-thump {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.025); }
}
.k48-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 12px;
  padding: 12px;
  height: 100%;
  box-sizing: border-box;
}
.k48-slots i {
  display: block;
  background: var(--k48-empty);
  border-radius: 18px;
}
.k48-tiles { position: absolute; inset: 0; pointer-events: none; }
.k48-tile {
  --k48x: 0px;
  --k48y: 0px;
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #3d3d3d;
  background: #f2ebe0;
  transform: translate(var(--k48x), var(--k48y));
  transition: transform 0.12s ease-in-out;
  will-change: transform;
}
.k48-tile.dead { opacity: 1; }
.k48-tile.born,
.k48-tile.merge { transition: none; }
.k48-tile.born { animation: k48-pop 0.18s ease; }
.k48-tile.merge { animation: k48-merge 0.2s ease; }
@keyframes k48-pop {
  0% { transform: translate(var(--k48x), var(--k48y)) scale(0); }
  80% { transform: translate(var(--k48x), var(--k48y)) scale(1.08); }
  100% { transform: translate(var(--k48x), var(--k48y)) scale(1); }
}
@keyframes k48-merge {
  0% { transform: translate(var(--k48x), var(--k48y)) scale(1); }
  50% { transform: translate(var(--k48x), var(--k48y)) scale(1.2); }
  100% { transform: translate(var(--k48x), var(--k48y)) scale(1); }
}
.k48-tile.t2 { background: #f2ebe0; color: #3d3d3d; }
.k48-tile.t4 { background: #6ec6f4; color: #fff; }
.k48-tile.t8 { background: #f5a03a; color: #fff; }
.k48-tile.t16 { background: #e85a5a; color: #fff; }
.k48-tile.t32 { background: #e24b8c; color: #fff; }
.k48-tile.t64 { background: #a85ad0; color: #fff; }
.k48-tile.t128 { background: #6e74d8; color: #fff; }
.k48-tile.t256 { background: #4a90e8; color: #fff; }
.k48-tile.t512 { background: #3cc4b0; color: #fff; }
.k48-tile.t1024 { background: #f0c040; color: #fff; }
.k48-tile.t2048 {
  background: #ff8c28;
  color: #fff;
  box-shadow: 0 0 22px rgba(255, 140, 40, 0.45);
}
.k48-tile.t4096, .k48-tile.t8192 { background: #3d3a6b; color: #fff; }
.k48-float {
  position: absolute;
  transform: translate(-50%, 0);
  color: var(--k48-orange);
  font-weight: 800;
  font-size: 18px;
  pointer-events: none;
  animation: k48-float 0.7s ease forwards;
  z-index: 5;
}
@keyframes k48-float {
  0% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -28px); }
}
.k48-overlay {
  position: absolute;
  inset: 0;
  background: var(--k48-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 32px;
  z-index: 6;
  backdrop-filter: blur(8px);
  padding: 16px;
  text-align: center;
}
.k48-overlay[hidden] { display: none; }
.k48-overlay h3 {
  font-size: clamp(32px, 8vw, 44px);
  margin: 0;
  color: var(--k48-ink);
  letter-spacing: -0.03em;
}
.k48-overlay.win h3 { color: var(--k48-orange); }
.k48-ov-sub {
  margin: 0 0 10px;
  color: var(--k48-muted);
  font-weight: 700;
  font-size: 15px;
}
.k48-ov-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.k48-help {
  text-align: center;
  color: var(--k48-muted);
  font-size: 14px;
  font-weight: 600;
  margin-top: 16px;
  letter-spacing: 0.01em;
}
@media (max-width: 380px) {
  .k48-logo { width: 50px; height: 50px; border-radius: 16px; font-size: 14px; }
  .k48-brand strong { font-size: 17px; }
  .k48-brand span { font-size: 12px; }
  .k48-box b { font-size: 24px; }
}

/* 24 */
.tf24 { text-align: center; padding: 6px 4px 4px; }
.tf24-goal {
  width: 92px; height: 92px; margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2a9d8f, #0f7a63);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--display);
  font-size: 38px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(15, 122, 99, 0.3);
}
.tf24-board {
  min-height: 88px;
  margin: 0 auto 8px;
  padding: 12px 14px;
  max-width: 420px;
  background: #eaf7f2;
  border: 2px solid var(--line);
  border-radius: 16px;
  text-align: left;
}
.tf24-step {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 0 0 4px;
}
.tf24-eq {
  min-height: 28px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  color: var(--muted);
  margin: 0;
}
.tf24-eq.on { color: var(--navy); }
.tf24-tiles button.made {
  background: linear-gradient(#fff8db, #f6e7b0);
  border-color: #e9b44c;
}
.tf24-hint { color: var(--muted); font-size: 13px; font-weight: 650; margin-bottom: 16px; min-height: 18px; }
.tf24-tiles {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  min-height: 96px; margin-bottom: 18px;
}
.tf24-tiles button {
  min-width: 78px; height: 90px; padding: 0 12px;
  border-radius: 20px; border: 2px solid var(--line);
  background: linear-gradient(#fff, #eaf7f2);
  color: var(--ink);
  font-family: var(--display); font-size: 32px; font-weight: 800;
  box-shadow: 0 8px 0 #d4deee;
}
.tf24-tiles button:hover { border-color: var(--navy); transform: translateY(-2px); }
.tf24-tiles button.on {
  background: linear-gradient(145deg, #2a9d8f, #0f7a63); color: #fff; border-color: var(--navy);
  box-shadow: 0 8px 0 #0b5c4b;
}
.tf24-ops button:hover { transform: translateY(-1px); }
.tf24-ops { display: flex; gap: 12px; justify-content: center; }
.tf24-ops button {
  width: 58px; height: 58px; border: 0; border-radius: 50%;
  background: #e4f5ee; color: var(--navy);
  font-size: 24px; font-weight: 800;
  box-shadow: 0 4px 0 #b7d8cc;
}
.tf24-ops button.on { background: var(--coral); color: #fff; box-shadow: 0 4px 0 #9b2c1c; }
.tf24-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.ops { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ops button, .keys button {
  min-width: 48px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper); font-weight: 800; font-size: 18px;
}
/* True/False: keep label contrast (ops paper bg must not wash out .primary white text) */
.ops button.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.ops button.danger {
  background: #fde8e4;
  color: #9b2c1c;
  border-color: #e8b4aa;
}
.ops button.primary:disabled,
.ops button.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Stroop / Colour Clash — plain text options (no colour fills) */
.stroop-word { font-size: clamp(32px, 12vw, 56px); font-weight: 800; text-align: center; margin: 18px 0; letter-spacing: 0.04em; }
.color-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-btns button,
.color-btns .clash-opt,
.color-btns .choice {
  height: 56px;
  min-height: 48px;
  border: 2px solid var(--line) !important;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center !important;
  background: var(--paper) !important;
  background-color: var(--paper) !important;
  color: var(--ink) !important;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none !important;
}
.color-btns button:hover,
.color-btns .clash-opt:hover,
.color-btns .choice:hover {
  border-color: var(--navy) !important;
}

/* Connections */
.conn-prompt {
  font-family: var(--display);
  font-size: clamp(22px, 5.5vw, 32px);
  font-weight: 800;
  text-align: center;
  margin: 10px 0 4px;
}
.conn-hint {
  text-align: center;
  color: var(--ink-2);
  font-weight: 650;
  font-size: 14px;
  margin: 0 0 14px;
}
.conn-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.conn-grid button {
  min-height: 58px; border-radius: 12px; border: 0; background: #e4f5ee;
  font-weight: 750; text-transform: uppercase; font-size: 13px; letter-spacing: 0.02em;
}
.conn-grid button.on { background: var(--navy); color: #fff; }
.conn-grid button.good { background: #2a9d8f; color: #fff; }
.conn-grid button.bad { background: #fde8e4; color: var(--coral); }
.solved { border-radius: 12px; padding: 12px; margin-bottom: 8px; color: #1a1a1a; font-weight: 800; text-align: center; }
.solved .sub { display: block; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }

/* Rebus / keyword */
.emoji { font-size: 52px; text-align: center; letter-spacing: 8px; margin: 8px 0 16px; }
.guess-row { display: flex; gap: 8px; }
.guess-row input {
  flex: 1; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px;
}

/* Wordle */
.wordle { display: grid; gap: 6px; justify-content: center; margin-bottom: 14px; width: 100%; }
.wordle-row { display: grid; grid-template-columns: repeat(5, minmax(0, 52px)); gap: 6px; justify-content: center; }
.tile {
  width: 100%; height: auto; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: clamp(16px, 5vw, 22px); text-transform: uppercase;
}
.tile.filled { border-color: var(--ink-2); }
.tile.correct { background: #2a9d8f; color: #fff; border-color: #2a9d8f; }
.tile.present { background: #e9c46a; color: #1a1a1a; border-color: #e9c46a; }
.tile.absent { background: #6b6358; color: #fff; border-color: #6b6358; }
.kb { display: grid; gap: 6px; }
.kb-row { display: flex; gap: 4px; justify-content: center; width: 100%; }
.kb button {
  min-width: 0; flex: 1; height: 46px; padding: 0 4px; border: 0; border-radius: 8px;
  background: #e4f5ee; font-weight: 750; text-transform: uppercase; font-size: 13px;
}
.kb button.widek { flex: 1.55; min-width: 0; }
.kb button.correct { background: #2a9d8f; color: #fff; }
.kb button.present { background: #e9c46a; }
.kb button.absent { background: #6b6358; color: #fff; }

/* Sudoku / grids */
.sudoku-play {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}
.sudoku {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
  border: 3px solid var(--navy); max-width: 420px; width: 100%; margin: 0 auto;
}
.sudoku input, .sudoku .s {
  aspect-ratio: 1; border: 1px solid #d4deee; text-align: center;
  font-size: 20px; font-weight: 800; background: #fff; color: var(--ink);
  cursor: pointer; transition: background 0.12s ease, color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sudoku .s:hover { background: #e4f5ee; }
.sudoku .s.peer { background: #eaf7f2; }
.sudoku .s.sel, .sudoku .s.sel:hover {
  background: #0f7a63; color: #fff; box-shadow: inset 0 0 0 2px #0b5c4b;
}
.sudoku .s.same { color: var(--navy); }
.sudoku .s.fixed { background: #eaf7f2; cursor: pointer; }
.sudoku .s.fixed:hover { background: #e0e8ff; }
.sudoku .s.fixed.peer { background: #e4ebfa; }
.sudoku .s.fixed.sel, .sudoku .s.fixed.sel:hover { background: #0b5c4b; color: #fff; }
.sudoku input:nth-child(3n) { border-right: 3px solid var(--navy); }
.sudoku .r2, .sudoku .r4 { border-bottom: 3px solid var(--navy); }
.numpad {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.numpad button {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 800;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sudoku-numpad {
  margin-top: 4px;
}

/* Queens / zip */
.q-cell, .z-cell {
  width: 36px; height: 36px; border: 1px solid #d4deee; background: #fff;
  display: grid; place-items: center; font-weight: 800;
  transition: background 0.12s ease, transform 0.12s ease;
}
.ng {
  display: grid; gap: 2px; justify-content: center;
  width: min(100%, 252px);
  /* Column count set in JS from puzzle n (5/6/7/…) — default 5 avoids stray leftover cell */
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.ng .q-cell { width: auto; height: auto; aspect-ratio: 1; }
.q-cell:hover, .z-cell:hover {
  filter: brightness(0.94);
  outline: 2px solid var(--navy);
  outline-offset: -2px;
  z-index: 1;
}
.q-cell { font-size: 20px; }
.q-cell.bad { outline: 2px solid var(--coral); }
.z-cell.on { background: var(--teal); color: #fff; }
.z-cell.num { font-family: var(--mono); }

.zip-board {
  position: relative;
  user-select: none;
  touch-action: none;
  max-width: 100%;
}
.zip-cell {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border: 1.5px solid #c5ddd4;
  background: #fff;
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
  z-index: 1;
}
.zip-grid {
  display: grid;
  position: relative;
}
.zip-svg {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.zip-cell.has-num { z-index: 3; }
.zip-cell.trail { background: #dff3ec; }
.zip-num {
  width: 68%;
  height: 68%;
  max-width: 34px;
  max-height: 34px;
  border-radius: 50%;
  border: 2px solid #0f7a63;
  color: #0f7a63;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  font-family: var(--display);
  position: relative;
  z-index: 3;
}
.zip-num.end {
  background: #0b9b6b;
  border-color: #0b9b6b;
  color: #fff;
}
.zip-board.solved .zip-cell.trail { background: #c6f0e3; }
.zip-board.solved .zip-svg path { stroke: #0b9b6b; }
.zip-board.zip-win-jump {
  z-index: 2;
  transform-origin: center bottom;
  animation: zip-win-jump 0.8s cubic-bezier(.2, .8, .25, 1) both;
}
.zip-win-text {
  width: 100%;
  color: #0b7656;
  font-size: 20px;
  text-align: center;
  animation: zip-win-text 0.55s ease-out both;
}
@keyframes zip-win-jump {
  0% { transform: translateY(0) scale(1); }
  55% { transform: translateY(-22px) scale(1.06); }
  78% { transform: translateY(-8px) scale(1.025); }
  100% { transform: translateY(-12px) scale(1.035); }
}
@keyframes zip-win-text {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .zip-board.zip-win-jump,
  .zip-win-text {
    animation: none;
  }
}

.board-wrap {
  display: flex;
  justify-content: center;
  overflow: auto;
  padding: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* Memory */
.mem {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 70px));
  gap: 8px;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}
.mem button {
  aspect-ratio: 1;
  width: 100%;
  max-width: 70px;
  min-height: 0;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: #f6ead7;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.15;
  transform-style: preserve-3d;
  overflow: hidden;
  word-break: break-word;
}
.mem button small {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
}
.mem button.open { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.mem button.matched {
  background: #e7f6f2;
  color: var(--navy);
  border: 2px solid #2a9d8f;
  cursor: default;
  opacity: 1;
}
.mem button.matched:disabled {
  opacity: 1;
  color: var(--navy);
}

/* Spelling bee */
.hive { width: 260px; height: 250px; margin: 10px auto 16px; position: relative; }
.hex {
  position: absolute; width: 78px; height: 68px;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
  border: 0; background: #e4f5ee; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.hex.center { background: var(--gold); }

.found-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.found-list span { background: var(--paper); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

/* Word search — newspaper puzzle */
.ws-game { max-width: 460px; margin: 0 auto; }
.ws-paper {
  background: #f6f0e4;
  border: 1px solid #e0d4c0;
  border-radius: 12px;
  padding: 16px 14px 18px;
  box-shadow: 0 12px 28px rgba(90, 70, 40, 0.12);
}
.ws-kicker {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9a8b72;
  margin: 0;
}
.ws-title {
  font-family: var(--display);
  text-align: center;
  font-size: 26px;
  margin: 2px 0 4px;
  color: #3a3226;
  letter-spacing: -0.03em;
}
.ws-hint {
  text-align: center;
  color: #8a7b64;
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 12px;
}
.ws-grid-wrap {
  position: relative;
  background: #fffaf2;
  border: 2px solid #c9b99a;
  border-radius: 4px;
  overflow: hidden;
}
.ws-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.ws-mark {
  position: absolute;
  border-radius: 999px;
  transform: translate(-50%, -50%) rotate(var(--ang, 0rad));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.ws-mark.just { animation: ws-mark-in 0.32s ease; }
.ws-mark.live { opacity: 0.92; }
@keyframes ws-mark-in {
  from { transform: translate(-50%, -50%) rotate(var(--ang, 0rad)) scale(0.45); opacity: 0; }
  to { transform: translate(-50%, -50%) rotate(var(--ang, 0rad)) scale(1); opacity: 1; }
}
.ws {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0;
  width: 100%;
  margin: 0 auto;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
}
.ws span {
  aspect-ratio: 1;
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(14px, 4vw, 18px);
  letter-spacing: 0.04em;
  color: #2c261c;
  background: transparent;
  border-radius: 0;
  border-right: 1px solid #efe4d0;
  border-bottom: 1px solid #efe4d0;
}
.ws span:nth-child(10n) { border-right: 0; }
.ws-bank { margin-top: 14px; }
.ws-bank-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a8b72;
  margin-bottom: 8px;
}
.words-col {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 18px;
  margin-top: 0;
}
.ws-word {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 5px 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #3a3226;
}
.ws-word i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-word.done {
  background: none;
  border: 0;
  color: #8a7b64;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.ws-word.done::before { content: none; }

/* Higher or lower */
.hl-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.hl-card {
  background: var(--paper); border-radius: 16px; padding: 16px; text-align: center;
  min-height: 140px; display: flex; flex-direction: column; justify-content: center;
}
.hl-card .val { font-family: var(--display); font-size: 28px; }
.vs { align-self: center; font-weight: 800; color: var(--muted); }

.flag {
  display: grid;
  place-items: center;
  margin: 8px 0 6px;
}
.flag img {
  width: 120px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(15, 80, 60, 0.12);
  background: #fff;
}
.flag-big img {
  width: 150px;
}

.flag-quiz {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.flag-quiz .choices {
  margin: 0;
}
.flag-quiz-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--line);
}
.flag-quiz-label {
  margin: 0;
  font-size: 20px;
  text-align: center;
  line-height: 1.35;
}
.flag-quiz-head .flag {
  margin: 0;
}
.flag-quiz-head .flag-big img {
  width: min(110px, 38vw);
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(15, 80, 60, 0.12);
}

/* Mirror */
.mirror-fig { display: grid; place-items: center; margin: 8px 0 16px; }
.mopts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.progress {
  height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 8px 0 14px;
}
.progress > i { display: block; height: 100%; background: var(--teal); width: 0; }
.progress.gk-drain > i {
  width: 100%;
  background: var(--teal);
  transition: width 10s linear, background 0.4s ease;
}
body:has(#up-coach) .progress.gk-drain > i {
  transition: none !important;
}

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.game-shell.wide-map { max-width: 720px; }
.game-shell.wide-map .game-tools { max-width: 720px; }
.stage:has(.geo-map),
.stage:has(.geo-map-frame) { padding: 12px 10px 14px; }
.geo-lead {
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  margin: 0 0 16px;
}
.geo-lead code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 6px;
}
.geo-regions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.geo-regions .ghost {
  min-height: 48px;
  font-weight: 700;
}
.geo-change-map {
  flex-shrink: 0;
  padding: 6px 12px !important;
  font-size: 12px !important;
  min-height: 0 !important;
}
.geo-hard {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 8px;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
}
.geo-credit {
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.geo-prompt {
  font-family: var(--display);
  font-size: 26px;
  text-align: center;
  margin: 0 0 8px;
}
.geo-prompt.good { color: #178a4e; }
.geo-prompt b { color: var(--navy); }
.geo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.geo-tools .ghost, .geo-tools .primary { flex: 1; min-width: 110px; }
.geo-map-frame {
  position: relative;
  width: 100%;
}
.geo-map-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: flex;
  gap: 4px;
}
.geo-map-zoom .ghost {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(26, 46, 40, 0.12);
}
.geo-map {
  background: #9fd4ee;
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  height: 340px;
  min-height: 180px;
  max-height: min(70vh, 560px);
  resize: vertical;
  cursor: grab;
  touch-action: none;
  position: relative;
}
.geo-map:focus { outline: none; }
.geo-map:active { cursor: grabbing; }
.geo-status {
  text-align: center;
  font-weight: 650;
  color: var(--ink-2);
  min-height: 22px;
  margin: 10px 0 0;
}
.geo-status.ok { color: #178a4e; }
.geo-status.bad { color: #c44536; }

.level-try-row {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff5f3;
  border: 1px solid #f0c9c3;
  text-align: center;
}
.level-try-msg {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #9a3b32;
}
.level-try-row .primary {
  min-width: 140px;
}
.geo-map svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
}
.geo-map path {
  fill: #e7f6ef !important;
  stroke: #3d7a68 !important;
  stroke-width: 0.45;
  pointer-events: auto;
  cursor: pointer;
}
.geo-map [id]:not(.dim) { cursor: pointer; }
.geo-map .dim,
.geo-map .dim path {
  fill: #c8dcd3 !important;
  stroke: #92b3a6 !important;
  pointer-events: none;
  opacity: 0.55;
  cursor: default;
}
.geo-map .pick,
.geo-map .pick path,
.geo-map g.pick path,
.geo-map path.pick {
  fill: #f5a03a !important;
  stroke: #c46a12 !important;
  stroke-width: 0.85 !important;
}
.geo-map .hit,
.geo-map .hit path { fill: #2a9d8f !important; stroke: #0b5c4b !important; }
.geo-map .miss,
.geo-map .miss path { fill: #e85d4c !important; stroke: #9b2c1c !important; }
.geo-map .hint,
.geo-map .hint path {
  fill: #e9b44c !important;
  stroke: #b8860b !important;
  animation: geoPulse 0.7s ease 4;
}
@keyframes geoPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* UP Board classes — hidden while UP.SHOW_CLASSES is false */
body.hide-classes .board-copy { display: none !important; }

/* UP Board classes */
.board-hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}
.board-hero h1 {
  font-family: var(--display);
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.board-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.board-crumb a { color: var(--navy); }
.board-crumb i { font-style: normal; opacity: 0.5; }
.board-more {
  color: var(--navy);
  font-weight: 750;
  font-size: 14px;
}
.class-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  margin-bottom: 28px;
}
.class-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(15, 122, 99, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.class-chip:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(15, 122, 99, 0.12); }
.class-chip b {
  font-family: var(--display);
  font-size: 22px;
  color: var(--navy);
  line-height: 1;
}
.class-chip span { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.class-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.class-grid-sm { grid-template-columns: repeat(3, 1fr); }
.class-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 14px 16px 20px;
  box-shadow: 0 10px 24px rgba(15, 122, 99, 0.07);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 132px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.class-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #2a9d8f, #0f7a63);
}
.class-card:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(15, 122, 99, 0.12); }
.class-card b { font-family: var(--display); font-size: 22px; }
.class-card em { font-style: normal; color: var(--ink-2); font-weight: 650; font-size: 14px; }
.class-card span { color: var(--muted); font-size: 12px; font-weight: 650; margin-top: 6px; }
.class-card small { color: var(--navy); font-weight: 750; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; margin-top: auto; }
.board-head { margin-top: 4px; }
.class-badge {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2a9d8f, #0f7a63);
  color: #fff;
  font-family: var(--display);
  font-size: 26px;
  box-shadow: 0 10px 20px rgba(15, 122, 99, 0.25);
}
.subject-grid, .chapter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.subject-card, .chapter-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 20px rgba(15, 122, 99, 0.06);
  min-height: 88px;
}
.subject-card:hover, .chapter-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(15, 122, 99, 0.11); }
.subject-card h3 { font-family: var(--display); font-size: 18px; }
.subject-card p, .chapter-card span { color: var(--ink-2); font-size: 13px; }
.subject-card { position: relative; }
.subject-ico {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  font-family: var(--display);
}
.subject-ico.lg { width: 64px; height: 64px; min-width: 64px; font-size: 26px; border-radius: 18px; }
.chapter-card {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.chapter-card i {
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
}
.chapter-card b { font-family: var(--display); font-size: 17px; }
.chapter-card.mix {
  background: linear-gradient(160deg, #e4f5ee, #fff);
  border-color: #9fd4c4;
}
.all-chapters-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(160deg, #2a9d8f, #0f7a63);
  color: #fff;
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 8px;
  box-shadow: 0 12px 28px rgba(15, 122, 99, 0.22);
}
.all-chapters-btn b { font-family: var(--display); font-size: 20px; }
.all-chapters-btn span { font-size: 13px; opacity: 0.92; font-weight: 650; }
.all-chapters-btn:hover { transform: translateY(-2px); }
.board-stage { max-width: 720px; margin: 0 auto; }
.board-q {
  font-family: var(--display);
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.35;
  margin: 8px 0 16px;
}
.board-choices .choice {
  display: flex;
  align-items: center;
  gap: 12px;
}
.board-choices .choice i {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-style: normal;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid var(--line);
}
.board-choices .choice.good i,
.board-choices .choice.bad i {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: transparent;
}
.board-review {
  margin-top: 18px;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--ink-2);
  font-size: 14px;
}
.board-review li.good { color: #178a4e; }
.board-review li.bad { color: #9b2c1c; }
.board-review em { font-style: normal; color: var(--muted); font-size: 12px; }
.board-review span { display: inline-block; margin-top: 2px; font-weight: 650; }

.wj-rules {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
}
.wj-target {
  text-align: center;
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}
.wj-target b {
  display: block;
  font-family: var(--display);
  font-size: 30px;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: 2px;
}
.wj-scene {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px 28px;
  padding: 36px 12px 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, #e7fbf4 0%, transparent 55%),
    linear-gradient(180deg, #c5ebe0 0%, #eaf8f2 58%, #b7d4a8 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  position: relative;
  min-height: 240px;
  overflow: hidden;
}
.wj-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 8px 6px 4px;
  border-radius: 16px;
  color: inherit;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.wj-col::after {
  content: "";
  width: 72%;
  height: 10px;
  margin-top: -4px;
  background: radial-gradient(ellipse, rgba(16, 38, 31, 0.28), transparent 70%);
  border-radius: 50%;
}
.wj-col.empty { cursor: default; }
.wj-col:hover .wj-glass { border-color: #0f7a63; }
.wj-col.on {
  background: rgba(255, 255, 255, 0.55);
  transform: translateY(-10px);
}
.wj-col.on .wj-glass {
  border-color: var(--navy);
  box-shadow: 0 8px 16px rgba(15, 122, 99, 0.22);
}
.wj-col.ghost {
  opacity: 0;
  pointer-events: none;
}
.wj-col.pour-target .wj-glass,
.wj-col.filling .wj-glass {
  border-color: #1aa37a;
  box-shadow: 0 0 0 4px rgba(26, 163, 122, 0.28), 0 10px 18px rgba(15, 122, 99, 0.18);
  transform: translateY(-6px);
}
.wj-held {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  margin: 0;
  filter: drop-shadow(0 18px 16px rgba(16, 38, 31, 0.34));
  cursor: grabbing;
  transform-origin: 50% 30%;
  transition: transform 0.16s ease;
}
.wj-held::after { display: none; }
.wj-held.tilt-right { transform: rotate(34deg); }
.wj-held.tilt-left { transform: rotate(-34deg); }
.wj-held.pouring.tilt-right { transform: rotate(62deg) translate(18px, -8px); }
.wj-held.pouring.tilt-left { transform: rotate(-62deg) translate(-18px, -8px); }
.wj-held.pour-done.tilt-right { transform: rotate(22deg) translate(8px, -4px); }
.wj-held.pour-done.tilt-left { transform: rotate(-22deg) translate(-8px, -4px); }
.wj-held.pouring.tilt-right .wj-water {
  transform-origin: bottom right;
  transform: skewX(-14deg);
}
.wj-held.pouring.tilt-left .wj-water {
  transform-origin: bottom left;
  transform: skewX(14deg);
}
.wj-lip, .wj-mouth {
  position: absolute;
  width: 8px;
  height: 8px;
  opacity: 0;
  pointer-events: none;
}
.wj-lip-l { left: 6px; top: 4px; }
.wj-lip-r { right: 6px; top: 4px; }
.wj-mouth { left: 50%; top: 2px; transform: translateX(-50%); }
.wj-stream-svg {
  position: fixed;
  z-index: 72;
  pointer-events: none;
  overflow: visible;
  transition: opacity 0.32s ease;
}
.wj-stream-svg.is-ending,
.wj-fall.is-ending,
.wj-splash.is-ending,
.wj-ripple.is-ending { opacity: 0; }
.wj-ribbon {
  opacity: 0.96;
}
.wj-ribbon-glow {
  fill: #9aebf5;
  opacity: 0.35;
  filter: blur(3px);
}
.wj-flow-core {
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}
.wj-bead {
  filter: drop-shadow(0 0 3px #9aebf5);
}
.wj-fall {
  position: fixed;
  z-index: 74;
  width: 7px;
  height: 10px;
  margin-left: -3px;
  border-radius: 50%;
  background: linear-gradient(#f4feff, #5fd4ea);
  box-shadow: 0 0 6px #7adff0;
  pointer-events: none;
  animation: wj-fall 0.46s cubic-bezier(.35,.05,.75,.4) forwards;
  opacity: 0;
}
@keyframes wj-fall {
  0% { transform: translate(0, 0) scale(0.45); opacity: 0; }
  14% { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.25); opacity: 0; }
}
.wj-splash {
  position: fixed;
  z-index: 73;
  width: 44px;
  height: 36px;
  pointer-events: none;
}
.wj-splash i {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 6px;
  height: 8px;
  margin-left: -3px;
  background: linear-gradient(#e8fdff, #5fd4ea);
  border-radius: 50% 50% 45% 45%;
  box-shadow: 0 0 6px #7adff0;
  animation: wj-splash-drop 0.48s cubic-bezier(.2,.6,.2,1) infinite;
}
.wj-splash i:nth-child(1) { animation-delay: 0s; --dx: -12px; --dy: 14px; }
.wj-splash i:nth-child(2) { animation-delay: 0.05s; --dx: 12px; --dy: 13px; }
.wj-splash i:nth-child(3) { animation-delay: 0.08s; --dx: -5px; --dy: 18px; }
.wj-splash i:nth-child(4) { animation-delay: 0.12s; --dx: 7px; --dy: 16px; width: 4px; height: 5px; }
.wj-splash i:nth-child(5) { animation-delay: 0.02s; --dx: 0px; --dy: 11px; width: 8px; height: 10px; }
.wj-splash i:nth-child(6) { animation-delay: 0.16s; --dx: -16px; --dy: 8px; width: 4px; height: 5px; }
.wj-splash i:nth-child(7) { animation-delay: 0.1s; --dx: 15px; --dy: 7px; width: 4px; height: 5px; }
.wj-splash i:nth-child(8) { animation-delay: 0.14s; --dx: 3px; --dy: 20px; width: 5px; height: 7px; }
@keyframes wj-splash-drop {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  70% { opacity: 0.7; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.15); opacity: 0; }
}
.wj-ripple {
  position: fixed;
  z-index: 73;
  width: 22px;
  height: 10px;
  margin-left: -11px;
  margin-top: -5px;
  border: 2px solid rgba(180, 245, 255, 0.9);
  border-radius: 50%;
  pointer-events: none;
  animation: wj-ripple 0.55s ease-out infinite;
}
@keyframes wj-ripple {
  0% { transform: scale(0.35); opacity: 0.95; }
  100% { transform: scale(2.4); opacity: 0; }
}
.wj-glass {
  width: 92px;
  height: 168px;
  position: relative;
  border: 3px solid rgba(28, 72, 62, 0.88);
  border-top-width: 5px;
  border-radius: 9px 9px 28px 28px / 8px 8px 34px 34px;
  background:
    linear-gradient(90deg,
      rgba(255,255,255,0.55) 0%,
      rgba(255,255,255,0.08) 16%,
      rgba(210, 235, 228, 0.12) 48%,
      rgba(255,255,255,0.14) 82%,
      rgba(180, 210, 200, 0.28) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.45),
    inset 10px 0 16px rgba(255,255,255,0.18),
    inset -8px 0 12px rgba(16, 50, 42, 0.12),
    0 12px 18px rgba(16, 38, 31, 0.16);
  overflow: visible;
}
.wj-glass.small { width: 70px; height: 118px; border-radius: 8px 8px 22px 22px / 7px 7px 26px 26px; }
.wj-glass.hit {
  border-color: #0b9b6b;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.45),
    0 0 0 3px rgba(11, 155, 107, 0.28);
}
.wj-inner {
  position: absolute;
  inset: 11px 8px 9px;
  border-radius: 4px 4px 22px 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(20, 70, 60, 0.06));
}
.wj-col.filling .wj-glass {
  animation: wj-receive 0.45s ease;
}
@keyframes wj-receive {
  0%, 100% { transform: translateY(-6px); }
  40% { transform: translateY(0) scale(1.04); }
}
.wj-water {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(180deg, rgba(180, 245, 255, 0.95) 0%, #4ec8de 22%, #2aa4c7 62%, #167a9c 100%);
  transition: height 1.05s cubic-bezier(.2,.7,.2,1), transform 0.32s ease;
  box-shadow: inset 0 8px 12px rgba(255,255,255,0.18);
}
.wj-water i {
  position: absolute;
  top: -7px;
  left: -12%;
  width: 124%;
  height: 16px;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.8) 0%, #9aebf5 55%, #5fd4ea 100%);
  border-radius: 50%;
  opacity: 0.95;
  animation: wj-wave 1.1s ease-in-out infinite;
}
.wj-col.filling .wj-water i,
.wj-held.pouring .wj-water i {
  animation-duration: 0.35s;
}
@keyframes wj-wave {
  0%, 100% { transform: scaleX(1) translateY(0); }
  50% { transform: scaleX(1.08) translateY(2px); }
}
.wj-amt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  color: #0b3d4a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
  pointer-events: none;
  z-index: 1;
}
.wj-glass.empty .wj-amt { color: var(--muted); font-size: 13px; font-weight: 700; }
.wj-cap {
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}
.wj-status {
  min-height: 22px;
  margin: 12px 0 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-2);
  text-align: center;
}
.wj-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.wj-actions button {
  text-align: center;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px 10px;
  font-weight: 700;
  font-size: 13px;
}
.wj-actions button:hover:not(:disabled) { border-color: var(--navy); }
.wj-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

.level-gate {
  text-align: center;
  padding: 28px 12px 12px;
  max-width: 420px;
  margin: 0 auto;
}
.level-gate .wj-rules {
  margin-bottom: 22px;
}
.level-gate .primary {
  min-width: 180px;
  font-size: 16px;
  padding: 14px 28px;
}

.level-pop {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(16, 38, 31, 0.42);
  backdrop-filter: blur(5px);
}
.level-pop-card {
  width: min(520px, 100%);
  max-height: min(82vh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #f4faf7;
  border-radius: 28px;
  padding: 22px 18px 18px;
  box-shadow: 0 22px 50px rgba(15, 122, 99, 0.22);
}
.level-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.level-pop-card h2 {
  font-family: var(--display);
  font-size: clamp(22px, 5vw, 28px);
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.03em;
  text-align: left;
}
.level-pop-close {
  flex-shrink: 0;
  min-width: 40px;
  padding: 8px 10px;
  line-height: 1;
}
.level-pop-lead {
  display: none;
}
.level-pop-list {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.level-pop-list .wj-level,
.level-pop-list .level-pop-item {
  text-align: center;
  padding: 8px 4px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
}
.level-pop-list .wj-level b,
.level-pop-list .level-pop-item b {
  display: block;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
}
.level-pop-list .wj-level i,
.level-pop-list .wj-level span {
  display: none;
}
.level-pop-list .wj-level.is-current {
  border-color: var(--navy);
  background: #e8f6f1;
}
.level-pop-list .wj-level.is-current b {
  color: var(--navy);
}
.level-pop-list .wj-level.is-done b {
  color: var(--navy);
}
.level-pop-list .wj-level.is-locked {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.level-pop-list .wj-level:hover:not(:disabled) {
  border-color: var(--navy);
  transform: translateY(-1px);
}

.wj-levels { display: grid; gap: 10px; margin-top: 8px; }
.wj-level {
  text-align: left;
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}
.wj-level:hover { border-color: var(--navy); transform: translateY(-1px); }
.wj-level i {
  display: inline-block;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 4px;
}
.wj-level b {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  line-height: 1.1;
}
.wj-level span {
  display: block;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  margin-top: 6px;
  line-height: 1.4;
}
.wj-level i {
  display: block;
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 4px;
}
.wj-level b { color: var(--ink); }
.wj-level.is-locked {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.wj-level.is-locked:hover {
  transform: none;
  border-color: var(--line);
}
.wj-level.is-done b { color: var(--navy); }

@media (hover: none) {
  .game-card:hover,
  .class-card:hover,
  .class-chip:hover,
  .subject-card:hover,
  .chapter-card:hover,
  .all-chapters-btn:hover {
    transform: none;
  }
  .game-card:hover { box-shadow: 0 10px 28px rgba(15, 122, 99, 0.07); }
  .choice:hover, .opt:hover, .conn-grid button:hover, .tf24-tiles button:hover {
    transform: none;
  }
}

/* —— Tablet —— */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .class-strip { grid-template-columns: repeat(6, 1fr); }
  .class-grid, .class-grid-sm { grid-template-columns: repeat(2, 1fr); }
  .subject-grid, .chapter-grid { grid-template-columns: 1fr; }
  .board-hero { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .conn-grid { grid-template-columns: 1fr 1fr; }
  .game-shell.wide-map { max-width: 100%; }
  .words-col { gap: 4px 12px; }
}

/* —— Phone / small tablet —— */
@media (max-width: 720px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left));
  }
  .brand { min-width: 0; max-width: calc(100% - 120px); }
  .top-nav {
    display: flex;
    order: 3;
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .top-nav::-webkit-scrollbar { display: none; }
  body.hide-classes .top-nav { display: none; }
  .top-nav a {
    flex-shrink: 0;
    font-size: 13px;
    padding: 6px 10px;
  }
  .topbar-actions { margin-left: auto; }
  .hud-login { padding: 7px 12px; font-size: 13px; min-height: 36px; }
  .brand-text strong { font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; font-size: 14px; border-radius: 10px; }

  #app { padding: 6px 12px max(24px, env(safe-area-inset-bottom)); }
  body:has(.game-shell:not(.auth-shell)) #app {
    padding: max(4px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)) 8px;
  }
  body:has(.game-shell:not(.auth-shell)) .game-tools {
    margin-bottom: 8px;
  }
  body:has(.game-shell:not(.auth-shell)) .game-shell .lb {
    margin: 8px 0 0;
    padding: 10px 12px 8px;
  }
  body:has(.game-shell:not(.auth-shell)) .lb-you {
    margin: 8px auto;
  }
  body.hide-classes #app > .section-head { margin-top: 2px; }

  .hero { margin-bottom: 18px; gap: 16px; }
  .hero h1 { font-size: clamp(28px, 9vw, 40px); margin-bottom: 0; }
  .hero p.lede { font-size: 15px; }
  .hero-board { padding: 16px; border-radius: 20px; min-height: 0; }
  .pills { margin-top: 12px; }
  .pill { font-size: 12px; padding: 6px 10px; }

  .section-head { margin: 18px 0 10px; align-items: center; gap: 8px; flex-wrap: wrap; }
  .section-head h2 { font-size: 18px; }
  .section-head span { font-size: 12px; }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
    margin-bottom: 12px;
  }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; min-height: 44px; padding: 10px 14px; }

  .game-card { min-height: 92px; padding: 10px 12px; gap: 10px; border-radius: 18px; }
  .card-art, .card-art .ico, .ico { width: 64px; min-width: 64px; height: 64px; border-radius: 14px; }
  .card-body h3 { font-size: 15px; }
  .card-body p { font-size: 12px; }

  .panel { padding: 16px; border-radius: 18px; }
  .stats-row { margin-top: 24px; }

  .auth-shell { max-width: 100%; }
  .auth-stage h1 { font-size: 24px; }
  .auth-central-login { width: 100%; min-height: 48px; }
  .auth-google-wrap { min-height: 48px; }

  .back,
  a.back {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
  }
  .rank-opt,
  .board-rank-btn,
  .mode-toggle button {
    min-height: 44px;
    padding: 10px 14px;
  }
  .game-hint-btn {
    min-height: 44px;
    min-width: 64px;
    padding: 10px 12px;
  }
  .geo-map-zoom .ghost {
    min-width: 44px;
    min-height: 44px;
    font-size: 18px;
  }
  .geo-change-map {
    min-height: 40px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }
  .geo-map {
    resize: none;
    height: min(52dvh, 420px);
    min-height: 200px;
    max-height: min(58dvh, 480px);
  }
  .numpad button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
  /* Sudoku: keep grid compact and number pad always on screen */
  .sudoku-play {
    gap: 10px;
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .sudoku-play .bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .sudoku-play .bar .primary {
    min-height: 44px;
    padding: 10px 16px;
  }
  .sudoku {
    max-width: min(100%, 92vw);
    border-width: 2px;
  }
  .sudoku .s {
    font-size: clamp(15px, 4.8vw, 18px);
  }
  .sudoku-numpad {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px max(10px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    background: var(--card);
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 28px rgba(15, 80, 60, 0.12);
  }
  .sudoku-numpad button {
    width: 100%;
    min-width: 0;
    height: 52px;
    min-height: 52px;
    font-size: 18px;
    border-radius: 12px;
  }
  .wordle-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    width: min(100%, 320px);
    margin: 0 auto;
  }
  .kb { gap: 8px; width: 100%; }
  .kb-row { gap: 5px; }
  .kb button {
    height: 52px;
    min-height: 52px;
    font-size: 14px;
    border-radius: 10px;
  }
  .conn-grid button,
  .ws-word,
  .board-choices .choice span {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .ub-footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .ub-footer-social-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .level-pop-list .wj-level,
  .level-pop-list .level-pop-item {
    min-height: 44px;
  }
  .level-pop-close {
    min-width: 44px;
    min-height: 44px;
  }
  .coach-nav button { min-height: 44px; }
  .q-cell, .z-cell {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .ng .q-cell {
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
  }
  .k48-iconbtn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .k48-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .game-shell { max-width: 100%; }
  .stage { padding: 12px; border-radius: 16px; }
  .how-to-stage .how-to h2 { font-size: 20px; }
  .how-to-stage .how-to ol { font-size: 14px; }

  .bar { gap: 6px; }
  .bar .meta { font-size: 12px; max-width: 100%; }
  .choice, .opt {
    min-height: 48px;
    padding: 12px 12px;
    font-size: 15px;
  }
  .prompt { font-size: clamp(18px, 5.5vw, 24px); margin: 6px 0 12px; }
  .result { padding: 10px 4px; }
  .result h2 { font-size: 26px; }
  .result .primary {
    min-width: 0;
    width: 100%;
    max-width: 320px;
    margin-top: 14px;
    min-height: 48px;
  }
  .complete-pop { padding: 12px; }
  .complete-pop-card { padding: 28px 16px 18px; border-radius: 22px; }
  .complete-pop-btns { flex-direction: column; }
  .complete-pop-btns .ghost,
  .complete-pop-btns .primary { width: 100%; min-height: 46px; white-space: normal; }

  .lb { padding: 12px 12px 10px; border-radius: 14px; margin: 12px 0 6px; }
  .lb-mini { font-size: 12px; line-height: 1.35; }
  .lb li { grid-template-columns: 24px 1fr auto; font-size: 13px; padding: 8px 10px; gap: 8px; }
  .lb-you { font-size: 14px; padding: 10px 12px; }

  .rank-options { flex-wrap: wrap; }
  .rank-opt { min-height: 36px; }

  .ops button, .keys button {
    min-height: 44px;
    flex: 1 1 auto;
    max-width: 140px;
    font-size: 16px;
  }
  .prompt[style*="font-size"] {
    font-size: clamp(17px, 5vw, 22px) !important;
  }

  .hl-pair { grid-template-columns: 1fr; }
  .vs { display: none; }
  .guess-row { flex-wrap: wrap; }
  .guess-row input { min-width: 0; width: 100%; font-size: 16px; min-height: 48px; }
  .guess-row .primary { width: 100%; margin-top: 0; min-height: 48px; }

  .tf24-goal { width: 76px; height: 76px; font-size: 32px; }
  .tf24-tiles button { min-width: 64px; height: 72px; font-size: 26px; box-shadow: 0 6px 0 #d4deee; }
  .tf24-ops button { width: 48px; height: 48px; font-size: 20px; }
  .tf24-board { padding: 10px 12px; }
  .tf24-eq { font-size: 18px; }

  .k48 { max-width: 100%; }
  .game-shell:has(.k48) { max-width: 100%; }
  .k48-head { gap: 8px; margin-bottom: 8px; }
  .k48-logo { width: 48px; height: 48px; font-size: 14px; border-radius: 16px; }
  .k48-brand strong { font-size: 18px; }
  .k48-scores { margin-bottom: 8px; gap: 8px; }
  .k48-box { padding: 8px 12px 10px; }
  .k48-box b { font-size: 24px; }
  .k48-hint { font-size: 13px; margin-bottom: 8px; }
  .k48-help { margin-top: 8px; }
  .k48-new { flex: 1; min-height: 44px; }
  .k48-board {
    width: min(100%, calc(100dvh - 280px));
    max-width: 100%;
  }
  .stage:has(.k48) { padding: 2px 0 4px; border-radius: 0; box-shadow: none; }

  .geo-prompt { font-size: clamp(16px, 4.5vw, 20px); }
  .geo-lead { font-size: 13px; }
  .geo-tools { flex-wrap: wrap; gap: 8px; }
  .geo-tools .ghost, .geo-tools .primary { min-width: 0; flex: 1 1 calc(50% - 8px); min-height: 44px; }
  .geo-map {
    height: min(52dvh, 420px);
    min-height: 200px;
    max-height: min(58dvh, 480px);
    border-radius: 12px;
    resize: none;
  }
  .geo-map-zoom .ghost {
    min-width: 44px;
    min-height: 44px;
    font-size: 17px;
  }
  .geo-regions { gap: 6px; }
  .geo-hard { font-size: 12px; }

  .wj-scene { gap: 14px 16px; padding: 16px 8px 12px; }
  .wj-actions { grid-template-columns: 1fr 1fr; }
  .wj-actions button { min-height: 48px; font-size: 12px; padding: 10px 8px; }

  .coach-cloud { left: 12px !important; right: 12px; width: auto !important; max-width: none; }
  .coach-nav { flex-wrap: wrap; }
  .coach-nav button { min-height: 44px; }

  .board-hero h1 { font-size: clamp(26px, 8vw, 36px); }
  .board-crumb { font-size: 12px; }
  .class-strip { gap: 6px; }
  .class-chip { min-height: 64px; border-radius: 12px; }
  .class-card { min-height: 112px; padding: 14px 12px 14px 18px; }
  .subject-card, .chapter-card { min-height: 76px; padding: 12px 14px; }
  .subject-card h3 { font-size: 16px; }
  .all-chapters-btn { padding: 14px 16px; border-radius: 16px; }
  .all-chapters-btn b { font-size: 18px; }
  .board-q { font-size: clamp(17px, 4.5vw, 22px); }
  .board-choices .choice { min-height: 52px; }
  .board-game-tools { gap: 8px; }
  .board-game-tools .back {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .board-rank-btn { min-height: 44px; }

  .board-wrap { padding: 2px; width: 100%; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; }
  .zip-cell { border-radius: 8px; }
  .zip-num { font-size: 14px; max-width: 28px; max-height: 28px; }
  .q-cell, .z-cell { font-size: 16px; }

  .ws-game { max-width: 100%; }
  .ws-paper { padding: 12px 10px 14px; border-radius: 10px; }
  .ws-title { font-size: 22px; }
  .ws span { font-size: clamp(12px, 3.6vw, 16px); }
  .words-col { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 8px; }
  .ws-word { font-size: 12px; letter-spacing: 0.08em; padding: 4px 0; }

  .hive {
    width: min(260px, 88vw);
    height: 250px;
    margin-left: auto;
    margin-right: auto;
    transform: scale(0.92);
    transform-origin: top center;
    margin-bottom: -16px;
  }
  .hex { font-size: 20px; }

  .color-btns button { min-height: 48px; }
  .numpad button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
  .level-try-row { flex-wrap: wrap; }
  .level-try-row .primary,
  .level-try-row .ghost { flex: 1 1 100%; min-height: 46px; }

  .toast {
    left: 12px;
    right: 12px;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: none;
  }
}

/* —— Narrow phone —— */
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .mini-games { grid-template-columns: 1fr; }
  .class-strip { grid-template-columns: repeat(4, 1fr); }
  .class-grid, .class-grid-sm { grid-template-columns: 1fr 1fr; }
  .conn-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .conn-grid button {
    min-height: 52px;
    font-size: 12px;
    padding: 8px 6px;
    border-radius: 10px;
  }

  .mem {
    grid-template-columns: repeat(4, minmax(0, 58px));
    gap: 6px;
  }
  .mem button {
    max-width: 58px;
    font-size: 11px;
    border-radius: 8px;
    padding: 3px;
  }
  .mem button small { font-size: 9px; }
  .numpad button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }
  .sudoku {
    max-width: min(100%, 92vw);
  }
  .sudoku .s {
    font-size: clamp(14px, 4.2vw, 17px);
  }
  .sudoku-play {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  .sudoku-numpad {
    gap: 5px;
    padding: 8px max(8px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  }
  .sudoku-numpad button {
    height: 48px;
    min-height: 48px;
    font-size: 17px;
    border-radius: 10px;
  }
  .color-btns { grid-template-columns: 1fr 1fr; }
  .color-btns button { height: 48px; font-size: 14px; }

  .hive {
    width: min(260px, 92vw);
    height: 250px;
    transform: scale(0.88);
    transform-origin: top center;
    margin-bottom: -28px;
  }
  .hex { width: 78px; height: 68px; font-size: 20px; }

  .flag img { width: min(110px, 48vw); }
  .flag-big img { width: min(140px, 52vw); }
  .flag-quiz { gap: 12px; }
  .flag-quiz-head { padding-bottom: 8px; }
  .flag-quiz-label { font-size: 17px; }
  .flag-quiz-head .flag-big img { width: min(96px, 34vw); }
  .auth-form input { font-size: 16px; }

  .q-cell, .z-cell { font-size: 15px; }
  .ng { width: min(100%, 420px); max-width: 100%; }
  .wj-glass { width: 72px; height: 136px; }
  .wj-glass.small { width: 56px; height: 96px; }

  .k48-logo { width: 48px; height: 48px; font-size: 14px; }
  .k48-box { min-width: 56px; padding: 5px 8px 7px; }
  .k48-box b { font-size: 18px; }
  .k48-btns { flex-wrap: wrap; }

  .game-tools {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "back score"
      "level level";
    gap: 8px;
  }
  .game-tools-left { grid-area: back; }
  .game-tools-center { grid-area: level; justify-self: stretch; }
  .game-tools-right {
    grid-area: score;
    flex-wrap: nowrap;
    width: 100%;
  }
  .game-levels-btn { max-width: none; width: 100%; padding: 11px 14px; font-size: 14px; }
  .game-hint-btn { flex-shrink: 0; }
  .game-total-score { flex: 1; min-width: 0; justify-content: center; }
  .board-game-tools {
    grid-template-columns: 1fr auto;
    grid-template-areas: "back score";
  }
  .board-game-tools .game-tools-center { display: none; }

  .level-pop-list { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .level-pop-list .wj-level,
  .level-pop-list .level-pop-item { min-height: 44px; padding: 6px 2px; border-radius: 8px; }

  .tf24-tiles { gap: 8px; }
  .tf24-tiles button { min-width: 56px; height: 64px; font-size: 24px; border-radius: 16px; }
  .tf24-ops { gap: 8px; }

  .geo-map { max-height: min(58dvh, 480px); min-height: 200px; resize: none; }
  .geo-tools .ghost, .geo-tools .primary { flex: 1 1 100%; }

  .ws-word { letter-spacing: 0.04em; font-size: 12px; }
  .words-col { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .board-choices .choice i { width: 26px; height: 26px; font-size: 12px; }

  .game-tools-right { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .game-hint-btn { flex: 0 0 auto; }
  .game-total-score { flex: 1 1 auto; min-width: 0; }

  .primary, .ghost, .danger { min-height: 44px; }
  .wide { min-height: 48px; }
}

/* —— Very small phones —— */
@media (max-width: 380px) {
  .brand-text strong { font-size: 14px; }
  .ub-brand { font-size: 0.88rem; }
  .class-strip { grid-template-columns: repeat(3, 1fr); }
  .conn-grid button { font-size: 11px; min-height: 48px; }
  .level-pop-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .k48-logo { width: 44px; height: 44px; border-radius: 14px; font-size: 12px; }
  .k48-brand strong { font-size: 16px; }
  .k48-brand span { font-size: 11px; }
  .k48-box b { font-size: 16px; }
  .wj-glass { width: 64px; height: 120px; }
  .wj-glass.small { width: 50px; height: 88px; }
  .hex { width: 78px; height: 68px; font-size: 18px; }
  .hive {
    transform: scale(0.8);
    transform-origin: top center;
    margin-bottom: -48px;
  }
  .kb button { height: 48px; min-height: 48px; font-size: 13px; }
  .wordle-row { width: min(100%, 280px); gap: 4px; }
  input, select, textarea { font-size: 16px !important; }
}

/* —— Short landscape phones —— */
@media (max-height: 480px) and (orientation: landscape) {
  .geo-map { max-height: 42vh; min-height: 140px; height: 200px; }
  .level-pop-card { max-height: 90vh; }
  .complete-pop-card { max-height: 90vh; overflow: auto; }
  .hero-board { display: none; }
  .k48-help { display: none; }
}

/* Night mode — light text on hardcoded white surfaces, dark text on cream coach bubble */
html[data-ub-theme="night"] .primary,
html[data-ub-theme="night"] .filter-btn.active,
html[data-ub-theme="night"] .ub-nav-cta,
html[data-ub-theme="night"] .all-chapters-btn {
  background: #1560c4;
  color: #ffffff;
  border-color: #1560c4;
}
html[data-ub-theme="night"] .primary:disabled {
  opacity: 0.72;
  color: #ffffff;
}
html[data-ub-theme="night"] button.ghost,
html[data-ub-theme="night"] a.ghost,
html[data-ub-theme="night"] a.back,
html[data-ub-theme="night"] .back,
html[data-ub-theme="night"] .filter-btn,
html[data-ub-theme="night"] .ub-theme-toggle,
html[data-ub-theme="night"] .ub-nav-toggle,
html[data-ub-theme="night"] .hud-out,
html[data-ub-theme="night"] .tf24-ops button,
html[data-ub-theme="night"] .ops button,
html[data-ub-theme="night"] .keys button,
html[data-ub-theme="night"] .numpad button,
html[data-ub-theme="night"] .kb button,
html[data-ub-theme="night"] .conn-grid button,
html[data-ub-theme="night"] .wj-actions button,
html[data-ub-theme="night"] .wj-level,
html[data-ub-theme="night"] .choice,
html[data-ub-theme="night"] .opt,
html[data-ub-theme="night"] .geo-tools .ghost,
html[data-ub-theme="night"] .geo-regions button,
html[data-ub-theme="night"] .mopts button {
  background: #243656;
  color: #ffffff;
  border: 1px solid #7db3ff;
}
html[data-ub-theme="night"] .ops button.primary {
  background: #1560c4;
  color: #ffffff;
  border-color: #7db3ff;
}
html[data-ub-theme="night"] .ops button.danger {
  background: #5a2430;
  color: #ffb4a8;
  border-color: #e85d4c;
}
html[data-ub-theme="night"] .color-btns button,
html[data-ub-theme="night"] .color-btns .clash-opt,
html[data-ub-theme="night"] .color-btns .choice {
  background: #243656 !important;
  background-color: #243656 !important;
  color: #ffffff !important;
  border: 1px solid #7db3ff !important;
}
html[data-ub-theme="night"] .choice.bad,
html[data-ub-theme="night"] .opt.bad {
  background: #5a1f1a;
  color: #ffd4cc;
  border-color: #ff8a62;
}
html[data-ub-theme="night"] .conn-grid button.on {
  background: #1560c4;
  color: #ffffff;
}
html[data-ub-theme="night"] .kb button.present,
html[data-ub-theme="night"] .tile.present {
  color: #1a1a1a;
}
html[data-ub-theme="night"] .kb button.correct,
html[data-ub-theme="night"] .tile.correct,
html[data-ub-theme="night"] .kb button.absent,
html[data-ub-theme="night"] .tile.absent {
  color: #ffffff;
}
html[data-ub-theme="night"] .mode-toggle {
  background: #1a2d4a;
}
html[data-ub-theme="night"] .mode-toggle button {
  color: #dce6f5;
}
html[data-ub-theme="night"] .mode-toggle button.on {
  background: #1560c4;
  color: #ffffff;
}
html[data-ub-theme="night"] .ub-nav-links a {
  color: #dce6f5;
}
html[data-ub-theme="night"] .ub-nav-links a:hover,
html[data-ub-theme="night"] .ub-nav-links a.is-active {
  background: #1a2d4a;
  color: #9ec5ff;
}
html[data-ub-theme="night"] .ub-brand {
  color: #f4f7fc;
}
html[data-ub-theme="night"] .ub-kicker,
html[data-ub-theme="night"] .kicker {
  background: #121c2e;
  color: #4ad4c0;
  border-color: #2c3f5c;
}
html[data-ub-theme="night"] .guess-row input,
html[data-ub-theme="night"] .auth-form input,
html[data-ub-theme="night"] .sudoku input {
  background: #1a2d4a;
  color: #ffffff;
  border-color: #3a5a88;
}
html[data-ub-theme="night"] .danger {
  background: #5a1f1a;
  color: #ffd4cc;
}
html[data-ub-theme="night"] .complete-pop-card,
html[data-ub-theme="night"] .game-card,
html[data-ub-theme="night"] .panel,
html[data-ub-theme="night"] .stage,
html[data-ub-theme="night"] .how-to,
html[data-ub-theme="night"] .lb,
html[data-ub-theme="night"] .stat,
html[data-ub-theme="night"] .hud-chip,
html[data-ub-theme="night"] .pill,
html[data-ub-theme="night"] .class-chip,
html[data-ub-theme="night"] .class-card,
html[data-ub-theme="night"] .subject-card,
html[data-ub-theme="night"] .chapter-card,
html[data-ub-theme="night"] .hl-card,
html[data-ub-theme="night"] .faq details,
html[data-ub-theme="night"] .faq summary {
  background: #121c2e;
  border-color: #24364f;
  color: #dce6f5;
}
html[data-ub-theme="night"] .complete-pop-card h2,
html[data-ub-theme="night"] .complete-pop-card p,
html[data-ub-theme="night"] .card-body h3,
html[data-ub-theme="night"] .card-body p,
html[data-ub-theme="night"] .section-head h2,
html[data-ub-theme="night"] .panel h2,
html[data-ub-theme="night"] .panel li,
html[data-ub-theme="night"] .how-to h2,
html[data-ub-theme="night"] .how-to ol,
html[data-ub-theme="night"] .how-to-meta,
html[data-ub-theme="night"] .how-to-more summary,
html[data-ub-theme="night"] .prompt,
html[data-ub-theme="night"] .geo-prompt,
html[data-ub-theme="night"] .geo-lead,
html[data-ub-theme="night"] .geo-status,
html[data-ub-theme="night"] .geo-hard,
html[data-ub-theme="night"] .bar .meta,
html[data-ub-theme="night"] .result h2,
html[data-ub-theme="night"] .result p,
html[data-ub-theme="night"] .game-hint-btn {
  background: #3a3420;
  border-color: #e0a800;
  color: #ffd666;
}
html[data-ub-theme="night"] .hint-pop-card {
  background: #1a2740;
  color: #e8eef8;
}
html[data-ub-theme="night"] .hint-pop-card h2 {
  color: #7db3ff;
}
html[data-ub-theme="night"] .hint-pop-list {
  color: #e8eef8;
}
html[data-ub-theme="night"] .hint-pop-answer {
  background: #1e3d36;
  border-color: #2a6f5f;
}
html[data-ub-theme="night"] .hint-pop-answer b {
  color: #7ddec8;
}
html[data-ub-theme="night"] .hint-pop-how-label {
  color: #e8eef8;
}
html[data-ub-theme="night"] .auth-stage h1,
html[data-ub-theme="night"] .auth-lead,
html[data-ub-theme="night"] .auth-form label,
html[data-ub-theme="night"] .board-q,
html[data-ub-theme="night"] .board-review,
html[data-ub-theme="night"] .wj-rules,
html[data-ub-theme="night"] .wj-target,
html[data-ub-theme="night"] .wj-target b,
html[data-ub-theme="night"] .class-chip b,
html[data-ub-theme="night"] .class-card b,
html[data-ub-theme="night"] .class-card em,
html[data-ub-theme="night"] .class-card small,
html[data-ub-theme="night"] .subject-card h3,
html[data-ub-theme="night"] .subject-card p,
html[data-ub-theme="night"] .chapter-card span,
html[data-ub-theme="night"] .ub-page-hero h1,
html[data-ub-theme="night"] .ub-page-hero .ub-lead,
html[data-ub-theme="night"] .hero h1,
html[data-ub-theme="night"] .hero p.lede,
html[data-ub-theme="night"] .faq summary {
  color: #f4f7fc;
}
html[data-ub-theme="night"] .how-to-kicker,
html[data-ub-theme="night"] .how-to-more summary::after,
html[data-ub-theme="night"] .geo-prompt b,
html[data-ub-theme="night"] .tag {
  color: #7db3ff;
}
html[data-ub-theme="night"] .hex {
  background: #1a2d4a;
  color: #f4f7fc;
}
html[data-ub-theme="night"] .hex.center {
  background: var(--gold);
  color: #12233f;
}
html[data-ub-theme="night"] .mem button {
  background: #1560c4;
  color: #ffffff;
}
html[data-ub-theme="night"] .mem button.open {
  background: #1a2d4a;
  color: #ffffff;
  border-color: #7db3ff;
}
html[data-ub-theme="night"] .mem button.matched,
html[data-ub-theme="night"] .mem button.matched:disabled {
  background: #1a3d36;
  color: #b8f0e0;
  border-color: #2a9d8f;
}
html[data-ub-theme="night"] .sudoku .s,
html[data-ub-theme="night"] .sudoku input {
  background: #1a2d4a;
  color: #ffffff;
  border-color: #3a5a88;
}
html[data-ub-theme="night"] .sudoku {
  border-color: #7db3ff;
}
html[data-ub-theme="night"] .sudoku input:nth-child(3n),
html[data-ub-theme="night"] .sudoku .r2,
html[data-ub-theme="night"] .sudoku .r4 {
  border-color: #7db3ff;
}
html[data-ub-theme="night"] .sudoku .s.same {
  color: #9ec5ff;
}
html[data-ub-theme="night"] .sudoku .s.peer,
html[data-ub-theme="night"] .sudoku .s.fixed {
  background: #243656;
  color: #ffffff;
}
html[data-ub-theme="night"] .sudoku .s.sel,
html[data-ub-theme="night"] .sudoku .s.sel:hover,
html[data-ub-theme="night"] .sudoku .s.fixed.sel,
html[data-ub-theme="night"] .sudoku .s.fixed.sel:hover {
  background: #0f7a63;
  color: #ffffff;
}
html[data-ub-theme="night"] .tile {
  background: #1a2d4a;
  color: #ffffff;
  border-color: #3a5a88;
}
html[data-ub-theme="night"] .q-cell,
html[data-ub-theme="night"] .z-cell,
html[data-ub-theme="night"] .zip-cell {
  background: #1a2d4a;
  color: #ffffff;
  border-color: #3a5a88;
}
html[data-ub-theme="night"] .zip-cell.trail {
  background: #1e4a3c;
}
html[data-ub-theme="night"] .zip-num {
  background: #121c2e;
  color: #4ad4c0;
  border-color: #4ad4c0;
}
html[data-ub-theme="night"] .tf24-board {
  background: #1a2d4a;
  border-color: #3a5a88;
}
html[data-ub-theme="night"] .tf24-step,
html[data-ub-theme="night"] .tf24-eq,
html[data-ub-theme="night"] .tf24-eq.on,
html[data-ub-theme="night"] .tf24-hint {
  color: #f4f7fc;
}
html[data-ub-theme="night"] .tf24-tiles button {
  background: linear-gradient(#243656, #1a2d4a);
  color: #ffffff;
  border-color: #7db3ff;
  box-shadow: 0 8px 0 #102038;
}
html[data-ub-theme="night"] .tf24-tiles button.on {
  background: linear-gradient(145deg, #2a9d8f, #0f7a63);
  color: #ffffff;
}
html[data-ub-theme="night"] .tf24-ops button {
  background: #243656;
  color: #ffffff;
  box-shadow: 0 4px 0 #102038;
}
html[data-ub-theme="night"] .board-choices .choice i {
  background: #0b2244;
  color: #ffffff;
  border-color: #7db3ff;
}
html[data-ub-theme="night"] .board-choices .choice.good i,
html[data-ub-theme="night"] .board-choices .choice.bad i {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}
html[data-ub-theme="night"] .coach-kicker,
html[data-ub-theme="night"] .coach-text {
  color: #12233f !important;
}
html[data-ub-theme="night"] .coach-cloud .ghost {
  background: #eef3fb;
  color: #0b2244;
  border-color: #c5d4e8;
}
html[data-ub-theme="night"] .coach-cloud .primary {
  background: #1560c4;
  color: #ffffff;
}

/* 2048 keeps its own light/dark board — do not invert its chrome */
html[data-ub-theme="night"] body:has(.k48):not(:has(.k48.is-dark)),
html[data-ub-theme="night"] body:has(.k48):not(:has(.k48.is-dark)) .paper-grain {
  background: #fff;
  color: #2c3340;
}
html[data-ub-theme="night"] .stage:has(.k48):not(:has(.k48.is-dark)),
html[data-ub-theme="night"] .game-shell:has(.k48):not(:has(.k48.is-dark)) .lb {
  background: #fff;
  color: #2c3340;
  border-color: #e6ecea;
}
html[data-ub-theme="night"] .game-shell:has(.k48):not(:has(.k48.is-dark)) .game-tools .back,
html[data-ub-theme="night"] .game-shell:has(.k48):not(:has(.k48.is-dark)) .game-tools .ghost {
  background: #fff;
  color: #2c3340;
  border-color: #c5d4d0;
}
html[data-ub-theme="night"] .game-shell:has(.k48.is-dark) .game-tools .back,
html[data-ub-theme="night"] .game-shell:has(.k48.is-dark) .game-tools .ghost {
  background: #1a2228;
  color: #eef2f6;
  border-color: #3a4a52;
}

html[data-ub-theme="night"] .sudoku-numpad {
  background: #152238;
  border-top-color: #7db3ff;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.35);
}

html[data-ub-theme="night"] .hud-user {
  background: #1560c4;
  border-color: #7db3ff;
  color: #ffffff;
}
html[data-ub-theme="night"] .hud-account.is-open .hud-user {
  box-shadow: 0 0 0 3px rgba(125, 179, 255, 0.28);
}
html[data-ub-theme="night"] .hud-menu {
  background: #121c2e;
  border-color: #24364f;
}
html[data-ub-theme="night"] .hud-menu-name {
  color: #f4f7fc;
}
html[data-ub-theme="night"] .hud-menu-email {
  color: #9aabc2;
}
html[data-ub-theme="night"] .hud-menu .hud-out:hover {
  background: #243656;
  color: #ffffff;
}

/* —— Site-wide mobile polish —— */
@media (max-width: 720px) {
  input, select, textarea {
    font-size: 16px !important;
  }
  .ub-page-hero { margin: 4px 0 18px; }
  .ub-page-hero h1 {
    font-size: clamp(1.4rem, 7.2vw, 2rem);
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .ub-page-hero .ub-lead {
    font-size: 0.95rem;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .ub-page-hero,
  .section-head,
  .grid,
  .game-card,
  .ub-footer,
  .ub-footer-grid {
    max-width: 100%;
    min-width: 0;
  }
  .card-body h3 {
    overflow-wrap: break-word;
  }
  .card-body p {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    overflow-wrap: break-word;
  }
  .filter-row {
    padding-right: 4px;
  }
  .game-shell {
    max-width: 100%;
    min-width: 0;
  }
  .stage {
    padding: 12px 10px 14px;
    border-radius: 16px;
    min-width: 0;
  }
  body:has(.sudoku-play) .stage {
    padding-bottom: 0;
  }
  .bar {
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .bar .meta {
    font-size: 13px;
    line-height: 1.3;
    min-width: 0;
    flex: 1 1 auto;
  }
  .bar .timer {
    flex-shrink: 0;
  }
  .choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .choice,
  .opt {
    min-height: 48px;
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    touch-action: manipulation;
    overflow-wrap: anywhere;
  }
  .prompt {
    font-size: clamp(16px, 4.5vw, 20px);
    line-height: 1.35;
    word-break: break-word;
  }
  .tf24-tiles {
    justify-content: center;
  }
  .ops button,
  .keys button {
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
  }
  .level-pop-card {
    width: min(calc(100% - 8px), 520px);
    max-height: min(88dvh, 640px);
    padding: 14px 12px 16px;
  }
  .hint-pop,
  .complete-pop,
  .level-pop {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .hint-pop-card,
  .complete-pop-card {
    width: min(calc(100% - 8px), 420px);
    max-width: 100%;
  }
  .game-shell .lb {
    margin-top: 12px;
  }
  .wj-scene {
    flex-wrap: wrap;
    justify-content: center;
  }
  .zip-board,
  .zip-grid,
  .board-wrap {
    max-width: 100%;
  }
  .ng {
    width: min(100%, 420px) !important;
    max-width: 100% !important;
    min-width: 0;
  }
  .mopts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .ub-footer {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .flag-quiz .choices {
    grid-template-columns: 1fr 1fr;
  }
  .flag-quiz .choice {
    min-height: 52px;
    font-size: 14px;
    padding: 10px 8px;
  }
  .sudoku-play .bar .meta {
    font-size: 12px;
  }
  .grid { gap: 10px; }
  .conn-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .ub-brand {
    font-size: 0;
    gap: 0;
    flex: 0 0 auto;
  }
  .ub-theme-toggle {
    padding: 8px;
  }
  .ops button,
  .keys button {
    max-width: none;
    flex: 1 1 calc(50% - 6px);
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .ub-nav-inner { min-height: 48px; }
  .geo-map { max-height: 42vh; min-height: 140px; height: 200px; }
}
