/* ═══════════════════════════════════════════════════════════════════
   2048.now - Main Stylesheet
   Warm beige theme
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
  --bg-base:       #f0ebe3;
  --bg-surface:    #ece7de;
  --bg-card:       #e8e2d8;
  --bg-card-hover: #e2dbd2;
  --bg-hover:      #e2dbd2;
  --bg-sidebar:    #ece7de;
  --bg-topbar:     #ede8df;
  --border:        #ccc6bc;
  --border-light:  #c2bcb2;

  /* Dark enough for WCAG AA text contrast on the warm page/card surfaces. */
  --accent:        #765c3e;
  --accent-hover:  #5f4b36;
  --accent-light:  #765c3e;
  --accent-glow:   rgba(139, 115, 85, 0.25);

  --cyan:          #2a8a9a;
  --cyan-hover:    #1e7a8a;
  --green:         #2d7a4f;
  --red:           #c0392b;
  --orange:        #d4580a;
  --yellow:        #c8920a;
  --gold:          #c4900a;

  --text-primary:   #111111;
  --text-secondary: #333333;
  --text-muted:     #5f5f5f;

  --sidebar-w:     240px;
  --sidebar-w-col: 64px;
  --topbar-h:      60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card:   0 2px 12px rgba(60,40,20,0.10);
  --shadow-popup:  0 6px 32px rgba(60,40,20,0.18);

  --transition: 150ms ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* Keyboard navigation and reduced-motion support. */
.skip-link {
  position: fixed; left: 12px; top: 8px; z-index: 10000;
  transform: translateY(-160%); padding: 10px 14px;
  border-radius: 8px; background: var(--text-primary); color: var(--bg-base);
  font-weight: 800; box-shadow: var(--shadow-popup);
}
.skip-link:focus { transform: translateY(0); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Dotted underline for inline text links (paragraphs, list items, descriptive text).
   Excludes links that are styled as buttons, chips, cards, nav items, etc. */
p a, li a, .text-link, .help-content p a, .help-content li a,
.auth-subtitle a, .prog-cta a, .faq-body a, .nudge-sub a,
.footer-tagline a, #guest-notice a {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  color: var(--accent);
}
p a:hover, li a:hover, .text-link:hover, .help-content p a:hover,
.help-content li a:hover, .auth-subtitle a:hover, .prog-cta a:hover,
.faq-body a:hover, .nudge-sub a:hover, .footer-tagline a:hover,
#guest-notice a:hover {
  text-decoration: underline solid;
}
/* Opt-out for links that look like pills/buttons inside p/li */
p a.btn, p a.filter-btn, p a.nudge-btn, p a.dash-link,
li a.btn, li a.filter-btn, li a.nudge-btn, li a.dash-link {
  text-decoration: none;
}

/* ── Sticky guest signup bar ── */
.guest-signup-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 400;
  background: linear-gradient(180deg, rgba(250,248,242,.98), #faf8f2);
  border-top: 1px solid rgba(139,115,85,.3);
  box-shadow: 0 -6px 24px rgba(60,40,20,.12);
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.guest-signup-bar .gsb-text {
  font-size: 13px;
  font-weight: 800;
  color: #333;
  min-width: 0;
  line-height: 1.25;
  text-align: left;
  justify-self: start;
}
.guest-signup-bar .gsb-text span { display: block; font-size: 11px; color: #666; font-weight: 500; margin-top: 2px; }
.guest-signup-bar .gsb-center {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-self: end;
  grid-column: 2;
}
/* Right-side spacer column keeps the center truly centered */
.guest-signup-bar::after {
  content: '';
  grid-column: 3;
}
.guest-signup-bar .gsb-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 36px;
  min-width: 220px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform .12s, box-shadow .12s;
  cursor: pointer;
}
.guest-signup-bar .gsb-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.15); text-decoration: none; }
.guest-signup-bar .gsb-google { background: #fff; color: #333; border: 1px solid #dadce0; }
.guest-signup-bar .gsb-google:hover { background: #f8f9fa; color: #333; }
.guest-signup-bar .gsb-email  { background: #765c3e; color: #fff; border: 1px solid #765c3e; }
.guest-signup-bar .gsb-email:hover { background: #7a6a58; color: #fff; }
/* Push page content up so the bar doesn't cover anything */
body.has-guest-signup-bar { padding-bottom: 96px; }
body.has-guest-signup-bar .site-footer { margin-bottom: 96px; }
@media (max-width: 900px) {
  .guest-signup-bar .gsb-btn { min-width: 0; padding: 12px 22px; }
}
@media (max-width: 640px) {
  .guest-signup-bar {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 8px 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .guest-signup-bar::after { display: none; }
  .guest-signup-bar .gsb-text { font-size: 12px; grid-column: 1; grid-row: 1; text-align: center; justify-self: center; }
  .guest-signup-bar .gsb-text span { font-size: 10px; }
  .guest-signup-bar .gsb-center { grid-column: 1; grid-row: 2; justify-self: stretch; gap: 8px; }
  .guest-signup-bar .gsb-btn { flex: 1; padding: 11px 10px; font-size: 12px; min-width: 0; gap: 6px; }
  body.has-guest-signup-bar { padding-bottom: 124px; }
  body.has-guest-signup-bar .site-footer { margin-bottom: 124px; }
}

/* ── Signup modal ── */
.signup-modal {
  display: none;
  position: fixed; inset: 0;
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 16px;
}
.signup-modal.open { display: flex; }
.signup-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(40, 30, 20, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.signup-modal-card {
  position: relative;
  background: #faf8f2;
  border-radius: 16px;
  max-width: 440px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 32px 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: signupModalIn .22s ease-out;
}
@keyframes signupModalIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.signup-modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: transparent; border: none; color: #666;
  border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.signup-modal-close:hover { background: rgba(0,0,0,.06); color: #222; }
.signup-modal-title {
  font-size: 22px; font-weight: 900; color: #222;
  margin: 0 0 6px; text-align: center;
}
.signup-modal-sub {
  font-size: 13px; color: #666; text-align: center;
  margin: 0 0 20px;
}
.signup-modal-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  background: #fff; color: #333; border: 1px solid #dadce0;
  border-radius: 10px; padding: 12px 16px;
  font-size: 14px; font-weight: 700;
  text-decoration: none;
  transition: background .12s, box-shadow .12s;
}
.signup-modal-google:hover { background: #f8f9fa; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,.08); text-decoration: none; }
.signup-modal-divider {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: #999; font-weight: 600; text-transform: uppercase;
  margin: 18px 0 14px;
}
.signup-modal-divider::before, .signup-modal-divider::after {
  content: ''; flex: 1; height: 1px; background: rgba(139,115,85,.25);
}
.signup-modal-card .form-group { margin-bottom: 12px; }
.signup-modal-card .form-label {
  display: block; font-size: 12px; font-weight: 700;
  color: #555; margin-bottom: 4px;
}
.signup-modal-card .form-control {
  width: 100%; padding: 10px 12px;
  background: #fff; border: 1px solid rgba(139,115,85,.3);
  border-radius: 8px; font-size: 14px; color: #222;
  font-family: inherit;
}
.signup-modal-card .form-control:focus {
  outline: none; border-color: #8f7a66;
  box-shadow: 0 0 0 3px rgba(139,115,85,.15);
}
.signup-modal-card .form-check {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px; color: #555; line-height: 1.4;
}
.signup-modal-card .form-check input { margin-top: 2px; }
.signup-modal-card .form-check a { color: #8f7a66; font-weight: 600; text-decoration: underline dotted; text-underline-offset: 2px; }
.signup-modal-field-error { font-size: 11px; color: #dc2626; margin-top: 3px; min-height: 0; }
.signup-modal-field-error:empty { display: none; }
.signup-modal-form-error {
  font-size: 12px; color: #dc2626; text-align: center;
  padding: 6px 0; min-height: 0;
}
.signup-modal-form-error:empty { display: none; }
.signup-modal-submit {
  width: 100%;
  background: #8f7a66; color: #fff;
  border: none; border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px; font-weight: 800;
  cursor: pointer; margin-top: 8px;
  transition: background .12s;
}
.signup-modal-submit:hover { background: #7a6a58; }
.signup-modal-submit:disabled { opacity: .6; cursor: wait; }
.signup-modal-footer {
  text-align: center; margin-top: 16px;
  font-size: 13px; color: #666;
}
.signup-modal-footer a { color: #8f7a66; font-weight: 700; text-decoration: underline dotted; text-underline-offset: 3px; }
@media (max-width: 480px) {
  .signup-modal-card { padding: 28px 20px 20px; }
  .signup-modal-title { font-size: 20px; }
}
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════════════════════
   LAYOUT SHELL
   ══════════════════════════════════════ */

.app-shell { display: flex; min-height: 100vh; }

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: var(--sidebar-w-col);
}

.topbar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: white;
  letter-spacing: -1px;
}

.topbar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.topbar-menu-toggle {
  display: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition);
}
.topbar-menu-toggle:hover { background: var(--bg-card); color: var(--text-primary); }

.topbar-search {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px 9px 42px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.topbar-search input::placeholder { color: var(--text-muted); }
.topbar-search input:focus { border-color: var(--accent); }
.topbar-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: background var(--transition), color var(--transition);
}
.topbar-icon-btn:hover { background: var(--bg-card); color: var(--text-primary); }

.topbar-dropdown-trigger {
  min-height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
}
.topbar-dropdown-trigger:hover,
.topbar-dropdown-trigger[aria-expanded="true"] {
  background: linear-gradient(145deg, color-mix(in srgb, var(--bg-card) 86%, white), var(--bg-card));
  border-color: color-mix(in srgb, var(--border) 72%, var(--accent));
  color: var(--text-primary);
  box-shadow: 0 5px 16px rgba(60,40,20,.1), inset 0 1px rgba(255,255,255,.38);
}
.topbar-dropdown-trigger[aria-expanded="true"] { transform: translateY(1px); }

.topbar-games-btn {
  width: auto;
  padding: 0 7px 0 6px;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.topbar-games-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #fff9ed;
  background: linear-gradient(145deg, #9c805d, #765c3e);
  box-shadow: inset 0 1px rgba(255,255,255,.24), inset 0 -2px rgba(48,31,16,.18);
  transition: transform var(--transition), box-shadow var(--transition);
}
.topbar-games-btn:hover .topbar-games-icon,
.topbar-games-btn[aria-expanded="true"] .topbar-games-icon {
  transform: translateY(-1px);
  box-shadow: inset 0 1px rgba(255,255,255,.3), inset 0 -2px rgba(48,31,16,.16), 0 4px 10px rgba(80,54,28,.2);
}
.topbar-games-label { display: inline; }
.topbar-dropdown-caret {
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 21px;
  border: 1px solid color-mix(in srgb, var(--border) 82%, var(--accent));
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg-base) 72%, var(--bg-card));
  color: var(--text-muted);
  box-shadow: inset 0 1px rgba(255,255,255,.32);
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform .2s ease;
}
.topbar-dropdown-trigger[aria-expanded="true"] .topbar-dropdown-caret {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: rotate(180deg);
}
.topbar-language-btn {
  width: auto;
  gap: 5px;
  padding: 0 5px 0 7px;
  border-radius: 11px;
}
.topbar-language-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.topbar-language-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.topbar-notif-btn {
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
}
.topbar-notif-btn:hover,
.topbar-notif-btn[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--border) 72%, var(--accent));
  background: linear-gradient(145deg, color-mix(in srgb, var(--bg-card) 86%, white), var(--bg-card));
  box-shadow: 0 5px 16px rgba(60,40,20,.1);
}
.topbar-notif-icon {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--accent);
  transition: transform var(--transition);
}
.topbar-notif-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.topbar-notif-btn:hover .topbar-notif-icon { transform: rotate(-5deg); }
.topbar-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 66px;
  padding: 2px 5px 2px 3px;
  border-radius: 23px;
}
@media (max-width: 680px) {
  .topbar-games-label,
  .topbar-games-btn .topbar-dropdown-caret,
  .topbar-language-btn .topbar-dropdown-caret,
  .topbar-user-btn .topbar-dropdown-caret { display: none; }
  .topbar-games-btn { width: 44px; padding: 0; border-color: transparent; }
  .topbar-language-btn { width: 42px; padding: 0; }
  .topbar-user-btn { min-width: 42px; padding: 2px; }
}

.topbar-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--red);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: white;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-topbar);
}

.btn-signup {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.btn-signup:hover { border-color: var(--accent-light); color: var(--accent-light); }
.btn-login {
  background: var(--accent);
  color: white;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn-login:hover { background: var(--accent-hover); box-shadow: 0 0 16px var(--accent-glow); }

.user-avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #a68b68, #6f5538);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  border: 2px solid color-mix(in srgb, var(--bg-topbar) 65%, white);
  box-shadow: 0 2px 8px rgba(60,40,20,.2), inset 0 1px rgba(255,255,255,.22);
  transition: border-color var(--transition), transform var(--transition);
}
.topbar-user-btn:hover .user-avatar-btn,
.topbar-user-btn[aria-expanded="true"] .user-avatar-btn { border-color: var(--accent-light); transform: scale(.96); }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
  z-index: 90;
  transition: width var(--transition);
  padding-bottom: 16px;
}
.sidebar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.mobile-menu-header,
.mobile-menu-profile,
.mobile-menu-quick { display: none; }

.sidebar.collapsed { width: var(--sidebar-w-col); }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: 9px 0; margin: 1px 8px; }
.sidebar.collapsed .sidebar-link .sidebar-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.sidebar.collapsed .sidebar-link.active .sidebar-icon { background: rgba(139, 115, 85, 0.15); }
.sidebar.collapsed .sidebar-link.active { background: none; }

.sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  padding: 12px 16px 6px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
}
.sidebar.collapsed .sidebar-label { opacity: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.sidebar-link:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(139, 115, 85, 0.14);
  color: #684f33;
}

.sidebar-link.active .sidebar-icon { color: #684f33; }
.sidebar-link.active .sidebar-link-text { color: #684f33; }

.sidebar-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-link-text {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition);
}
.sidebar.collapsed .sidebar-link-text { opacity: 0; width: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-badge { display: none; }

/* Circular edge control adapted from FACE-SWAPPERORG. It stays fixed while
   the navigation scrolls and straddles the panel border in both states. */
.sidebar-edge-toggle {
  position: fixed;
  top: calc(var(--topbar-h) + 18px);
  left: calc(var(--sidebar-w) - 13px);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(145deg, #f8f4ed, #e5ddd1);
  border: 1px solid color-mix(in srgb, var(--border) 70%, var(--accent));
  border-radius: 50%;
  color: var(--accent);
  cursor: pointer;
  z-index: 110;
  box-shadow: 0 4px 12px rgba(60, 40, 20, .18), inset 0 1px rgba(255, 255, 255, .72);
  transition: left var(--transition), color .18s ease, background .18s ease,
              border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.sidebar-edge-toggle:hover,
.sidebar-edge-toggle:focus-visible {
  color: #fff;
  background: linear-gradient(145deg, #927656, #684f33);
  border-color: #684f33;
  box-shadow: 0 6px 16px rgba(60, 40, 20, .26), 0 0 0 3px rgba(139, 115, 85, .14);
  outline: none;
  transform: scale(1.06);
}
.sidebar-edge-chevron {
  transition: transform var(--transition);
}
.sidebar.collapsed .sidebar-edge-toggle {
  left: calc(var(--sidebar-w-col) - 13px);
}
.sidebar.collapsed .sidebar-edge-chevron {
  transform: rotate(180deg);
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  padding: 24px;
  transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-col); }

/* ── Breadcrumb bar (SHAREITONL pattern) ── */
.breadcrumb-bar {
  margin: -24px -24px 20px;
  padding: 0 24px;
  background: var(--bg-topbar);
  border: 0;
  box-shadow: none;
}
.breadcrumb-container { width: 100%; }
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0.7rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.35;
}
.breadcrumb a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.breadcrumb a:hover,
.breadcrumb a:focus-visible { color: var(--accent-light); }
.breadcrumb .sep { color: var(--text-muted); opacity: 0.65; }
.breadcrumb [aria-current="page"] { color: var(--text-secondary); }

/* ══════════════════════════════════════
   CARDS
   ══════════════════════════════════════ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 20px; }

/* Card links: only the card's title is the <a>; its ::after stretches the
   click target over the whole card (the card must be position: relative). */
.stretched-link { color: inherit; text-decoration: none; }
.stretched-link:hover, .stretched-link:focus { color: inherit; text-decoration: none; }
.stretched-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }

/* ── Game Mode Cards ── */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(139, 115, 85, 0.18);
}

.mode-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card-hover) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.mode-card-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 60%);
}

.mode-card-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}
.badge-hot    { background: var(--red);    color: white; }
.badge-new    { background: var(--accent); color: white; }
.badge-ng     { background: var(--cyan);   color: white; }
.badge-top    { background: var(--gold);   color: black; }
.badge-live   { background: var(--green);  color: white; }

.mode-card-info { padding: 12px; }
.mode-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.mode-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Featured Hero Card ── */
.hero-card {
  background: linear-gradient(135deg, #dfd8ce 0%, #e8e2d8 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  position: relative;
  margin-bottom: 32px;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}
.hero-title span { color: var(--accent-light); }

.hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  width: 100%;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-board-preview {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(9, 28px);
  grid-template-rows: repeat(9, 28px);
  gap: 2px;
  opacity: 0.7;
}

.hero-cell {
  width: 28px; height: 28px;
  border-radius: 4px;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.hero-cell.revealed { background: var(--bg-surface); }
.hero-cell.flag     { background: var(--bg-card); color: var(--red); }
.hero-cell.mine     { background: var(--red); }
.hero-cell.n1 { color: #3b82f6; }
.hero-cell.n2 { color: #22c55e; }
.hero-cell.n3 { color: var(--red); }

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ── Page Hero Header ── */
.page-hero {
  display: flex; align-items: center; gap: 18px; width: 100%; margin-bottom: 8px;
}
.page-hero-icon {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(139,115,85,.30);
  background: rgba(139,115,85,.14);
}
.page-hero-icon svg { width: 28px; height: 28px; display: block; }
.page-hero-text { flex: 1 1 auto; min-width: 0; width: 100%; }
.page-hero-text h1 { margin: 0 0 2px; font-size: 24px; font-weight: 900; }
.page-hero-text p  { margin: 0; font-size: 13px; color: var(--text-muted); }

.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-light);
  transition: color var(--transition);
}
.section-link:hover { color: var(--accent); }

/* ══════════════════════════════════════
   LEADERBOARD TABLE
   ══════════════════════════════════════ */

.lb-table {
  width: 100%;
  border-collapse: collapse;
}

.lb-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lb-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.lb-table tbody tr:hover td { background: var(--bg-card-hover); }
.lb-table tbody tr:last-child td { border-bottom: none; }

.lb-rank {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  min-width: 36px;
}
.lb-rank.gold   { color: var(--gold); }
.lb-rank.silver { color: #94a3b8; }
.lb-rank.bronze { color: #cd7c3a; }

.lb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.lb-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.lb-time {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-weight: 600;
  color: var(--green);
}

/* ══════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: rgba(139,115,85,0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-pill { border-radius: 999px; }
.btn-icon { padding: 10px; }

/* ══════════════════════════════════════
   FORMS
   ══════════════════════════════════════ */

.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control.is-invalid { border-color: var(--red); }
.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-base);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-popup);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  text-align: center;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-divider {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin: 20px 0;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* ══════════════════════════════════════
   FLASH MESSAGES
   ══════════════════════════════════════ */

.flash-container {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
  animation: slideIn 0.2s ease;
  cursor: pointer;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.flash-success { background: #d4edda; border: 1px solid #2d7a4f; color: #1a5c36; }
.flash-error   { background: #fce8e6; border: 1px solid var(--red); color: #7a2020; }
.flash-info    { background: #dbeafe; border: 1px solid #2563eb; color: #1e3a8a; }
.flash-warning { background: #fef3cd; border: 1px solid var(--orange); color: #7a3a08; }

/* ══════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════ */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.filter-select {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* ══════════════════════════════════════
   ANNOUNCEMENTS
   ══════════════════════════════════════ */

.announcement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 14px;
}
.announcement-info        { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #1e40af; }
.announcement-warning     { background: rgba(212,88,10,0.08);  border: 1px solid rgba(212,88,10,0.25);  color: #7a3a08; }
.announcement-maintenance { background: rgba(200,146,10,0.08); border: 1px solid rgba(200,146,10,0.25); color: #7a5a08; }

/* ══════════════════════════════════════
   TAGS & BADGES (inline)
   ══════════════════════════════════════ */

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tag:hover { border-color: var(--accent); color: var(--accent-light); }
.tag-accent { background: rgba(139,115,85,0.12); border-color: var(--accent); color: var(--accent); }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-active    { background: rgba(34,197,94,0.15); color: var(--green); }
.status-suspended { background: rgba(249,115,22,0.15); color: var(--orange); }
.status-banned    { background: rgba(239,68,68,0.15);  color: var(--red); }
.status-new       { background: rgba(139,115,85,0.12); color: var(--accent); }
.status-open      { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-resolved  { background: rgba(34,197,94,0.15);  color: var(--green); }
.status-closed    { background: rgba(100,116,139,0.15); color: #94a3b8; }

/* ══════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 24px;
  justify-content: center;
}

.page-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  padding: 0 10px;
}
.page-btn:hover      { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active     { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn.disabled   { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════ */

.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.admin-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 16px 0;
}
.admin-content { padding: 24px; overflow: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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

/* ══════════════════════════════════════
   PROFILE
   ══════════════════════════════════════ */

.profile-header {
  background: linear-gradient(135deg, #dfd8ce, #e8e2d8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  border: 3px solid var(--accent-light);
}

.profile-username {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-rank {
  font-size: 14px;
  color: var(--accent-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.profile-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.profile-stat { text-align: center; }
.profile-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}
.profile-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   BLOG
   ══════════════════════════════════════ */

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.blog-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.blog-card:hover, .blog-card:focus-within { transform: translateY(-3px); border-color: var(--accent); }

.blog-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card-hover));
  object-fit: cover;
}

.blog-card-body { padding: 16px; }

.blog-card-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   HELP CENTER
   ══════════════════════════════════════ */

.help-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

.help-nav {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
}

.help-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.help-nav-link:last-child { border-bottom: none; }
.help-nav-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.help-nav-link.active { background: rgba(139,115,85,0.1); color: var(--accent); }

.help-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.help-content h1 { font-size: 26px; font-weight: 900; margin-bottom: 16px; }
.help-content h2 { font-size: 18px; font-weight: 800; margin: 28px 0 12px; color: var(--accent); }
.help-content p  { font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 12px; }
.help-content ul, .help-content ol { padding-left: 24px; margin-bottom: 12px; }
.help-content li { font-size: 15px; line-height: 1.7; color: var(--text-secondary); margin-bottom: 4px; }
/* Blog article body links - Underlined, accent colour, never on headings */
.help-content p a,
.help-content li a,
.help-content td a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.help-content p a:hover,
.help-content li a:hover,
.help-content td a:hover { color: var(--text-primary); }
.help-content h1 a,
.help-content h2 a,
.help-content h3 a,
.help-content h4 a { text-decoration: none; pointer-events: none; color: inherit; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */

.site-footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  margin-top: 48px;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 32px;
  max-width: 960px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 12px;
  padding: 0;
  line-height: 1.4;
}

.footer-links { display: flex; flex-direction: column; gap: 4px; }
.footer-link {
  display: flex;
  align-items: center;
  min-height: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.footer-link:hover { color: var(--accent-light); }

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════
   LANGUAGE SWITCHER
   ══════════════════════════════════════ */

.lang-dropdown {
  position: relative;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 9500;
}
.topbar-menu-panel {
  display: block;
  min-width: 240px;
  padding: 9px;
  overflow: visible;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-7px) scale(.975);
  transform-origin: top right;
  border: 1px solid color-mix(in srgb, var(--border) 68%, var(--accent));
  border-radius: 17px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.2), transparent 38%),
    color-mix(in srgb, var(--bg-card) 97%, white);
  box-shadow: 0 24px 55px rgba(54,36,19,.22), 0 5px 14px rgba(54,36,19,.1), inset 0 1px rgba(255,255,255,.42);
  transition: opacity .17s ease, transform .17s ease, visibility .17s ease;
}
.topbar-menu-panel::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 11px;
  height: 11px;
  border-left: 1px solid color-mix(in srgb, var(--border) 68%, var(--accent));
  border-top: 1px solid color-mix(in srgb, var(--border) 68%, var(--accent));
  background: color-mix(in srgb, var(--bg-card) 97%, white);
  transform: rotate(45deg);
}
.topbar-menu-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #c7b59e 0 24%, #a68b68 24% 49%, #8b6f4e 49% 74%, #edc22e 74% 100%);
  opacity: .82;
}
.topbar-menu-panel.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background var(--transition);
  cursor: pointer;
}
.lang-option:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.lang-option.active { color: var(--accent-light); font-weight: 600; }

.topbar-menu-heading,
.games-menu-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 60px;
  padding: 10px 10px 12px;
  margin-bottom: 5px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
}
.topbar-menu-heading > span:last-child,
.games-menu-header > span:last-child { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.topbar-menu-eyebrow,
.games-menu-eyebrow {
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .13em;
  line-height: 1.2;
  text-transform: uppercase;
}
.topbar-menu-heading strong,
.games-menu-header strong { color: var(--text-primary); font-size: 14px; line-height: 1.35; }
.topbar-menu-emblem {
  width: 42px;
  height: 38px;
  flex: 0 0 42px;
  position: relative;
}
.topbar-menu-emblem span {
  position: absolute;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 8px;
  background: linear-gradient(145deg, #a88d69, #74593b);
  color: #fffaf0;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(60,40,20,.18), inset 0 -2px rgba(45,28,13,.14);
}
.topbar-menu-emblem span:first-child { top: 0; left: 0; }
.topbar-menu-emblem span:last-child { right: 0; bottom: 0; background: linear-gradient(145deg, #d7b13f, #b07a13); color: #2f271c; }
.topbar-menu-emblem--language span { font-size: 10px; }
.topbar-menu-emblem--language span:last-child { background: linear-gradient(145deg, #8eb7c2, #397e9c); color: white; }

.language-menu {
  width: min(340px, calc(100vw - 20px));
}
.language-menu-option {
  min-height: 56px;
  gap: 11px;
  margin: 2px 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.language-menu-option:hover,
.language-menu-option:focus-visible {
  border-color: var(--border);
  background: color-mix(in srgb, var(--bg-card-hover) 82%, white);
  outline: none;
  transform: translateX(2px);
}
.language-menu-option.active {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
  background: color-mix(in srgb, var(--accent) 9%, var(--bg-card));
}
.language-menu-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--border) 78%, white);
  border-radius: 11px;
  background: var(--bg-base);
  box-shadow: inset 0 1px rgba(255,255,255,.4);
  font-size: 17px;
}
.language-menu-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.language-menu-copy strong { overflow: hidden; color: var(--text-primary); font-size: 12.5px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.language-menu-copy small { color: var(--text-muted); font-size: 9.5px; font-weight: 650; letter-spacing: .03em; }
.language-current-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 2px solid var(--bg-card);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 26%, transparent);
}
.language-option-arrow,
.account-option-arrow { color: var(--accent); font-size: 15px; font-weight: 800; transition: transform var(--transition); }
.language-menu-option:hover .language-option-arrow,
.account-menu-option:hover .account-option-arrow { transform: translateX(2px); }

/* Other games dropdown */
.games-menu {
  width: 324px;
  min-width: 324px;
}
.games-menu-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.games-menu-option {
  min-height: 54px;
  gap: 11px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.games-menu-option:hover,
.games-menu-option:focus-visible {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-primary);
  outline: none;
  transform: translateX(2px);
}
.games-menu-game-icon {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 11px;
  box-shadow: inset 0 1px rgba(255,255,255,.18);
}
.games-menu-game-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.games-menu-game-icon--question { color: #a78bfa; background: rgba(139,92,246,.13); }
.games-menu-game-icon--grid { color: #60a5fa; background: rgba(59,130,246,.13); }
.games-menu-game-icon--type { color: #34d399; background: rgba(16,185,129,.13); }
.games-menu-game-icon--mine { color: #fb923c; background: rgba(249,115,22,.13); }
.games-menu-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.games-menu-copy strong {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
}
.games-menu-copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.games-menu-external {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 700;
  opacity: .65;
  transition: color var(--transition), opacity var(--transition), transform var(--transition);
}
.games-menu-option:hover .games-menu-external,
.games-menu-option:focus-visible .games-menu-external {
  color: var(--accent-light);
  opacity: 1;
  transform: translate(1px,-1px);
}

.account-menu {
  width: 318px;
  min-width: 318px;
}
.account-menu-summary { padding: 8px 8px 10px; margin-bottom: 5px; border-bottom: 1px solid var(--border); }
.account-menu-identity { display: flex; align-items: center; gap: 10px; padding: 3px 2px 11px; }
.account-menu-identity > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.account-menu-identity small { color: var(--text-muted); font-size: 9px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.account-menu-identity strong { overflow: hidden; color: var(--text-primary); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #a88d69, #74593b);
  color: white;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 -2px rgba(45,28,13,.14);
}
.account-menu-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; text-align: center; }
.account-menu-stats > * {
  min-width: 0;
  padding: 8px 4px 7px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, white);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-base) 72%, var(--bg-card));
  transition: border-color var(--transition), transform var(--transition);
}
.account-menu-stats a:hover { border-color: var(--accent); transform: translateY(-1px); }
.account-stat-value,
.account-stat-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-stat-value { color: var(--text-primary); font-size: 13px; font-weight: 900; }
.account-stat-value--coins { color: #a97708; }
.account-stat-value--xp { color: var(--accent); }
.account-stat-value--trophies { color: var(--orange); }
.account-stat-label { margin-top: 2px; color: var(--text-muted); font-size: 8px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.account-menu-links { display: flex; flex-direction: column; gap: 2px; }
.account-menu-option {
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
}
.account-menu-option:hover,
.account-menu-option:focus-visible { border-color: var(--border); background: var(--bg-card-hover); outline: none; }
.account-option-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-base));
  color: var(--accent);
}
.account-option-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.account-menu-option > span:nth-child(2) { min-width: 0; flex: 1; }
.account-menu-logout { border: 0; color: var(--red); cursor: pointer; }
.account-menu-logout .account-option-icon { color: var(--red); background: color-mix(in srgb, var(--red) 9%, var(--bg-base)); }
@media (max-width: 680px) {
  .topbar-menu-panel {
    position: fixed;
    top: 62px;
    right: 10px;
    left: 10px;
    width: auto;
    min-width: 0;
    transform-origin: top center;
  }
  .topbar-menu-panel::before { display: none; }
  .games-menu,
  .language-menu,
  .account-menu { width: auto; max-height: calc(100vh - 76px); overflow-y: auto; overscroll-behavior: contain; }
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */

/* Keep the desktop control usable on tablets; JavaScript starts the panel in
   its compact state when no preference has been saved. */
@media (max-width: 1024px) {
  .hero-board-preview { display: none; }
}

/* ── 768px: Mobile layout ── */
@media (max-width: 768px) {
  :root { --topbar-h: 56px; }

  /* Prevent any element from pushing the page wider than the viewport */
  html, body { overflow-x: hidden; }
  .main-content { min-width: 0; }

  /* Branded mobile navigation drawer */
  .sidebar {
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    width: min(88vw, 340px);
    padding: 0 0 24px;
    background:
      radial-gradient(circle at 12% 8%, rgba(237,194,46,.13), transparent 24%),
      linear-gradient(180deg, #f8f4ed 0%, #eee8df 52%, #e8e0d5 100%);
    border-right: 0;
    border-radius: 0 22px 22px 0;
    box-shadow: 20px 0 52px rgba(60,40,20,.22);
    scrollbar-width: none;
    transition: transform .28s cubic-bezier(.22,1,.36,1);
    z-index: 200;
  }
  .sidebar-edge-toggle { display: none; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: min(88vw, 340px); }
  .sidebar .sidebar-link-text,
  .sidebar .sidebar-label,
  .sidebar .sidebar-badge { opacity: 1; width: auto; }
  .sidebar.collapsed .sidebar-link-text,
  .sidebar.collapsed .sidebar-label,
  .sidebar.collapsed .sidebar-badge { display: initial; opacity: 1; width: auto; }

  .mobile-menu-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    padding: 10px 12px 9px 16px;
    background: rgba(248,244,237,.94);
    border-bottom: 1px solid rgba(118,92,62,.15);
    backdrop-filter: blur(14px);
  }
  .mobile-menu-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
  }
  .mobile-menu-brand img {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 2px solid rgba(118,92,62,.22);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(60,40,20,.1);
  }
  .mobile-menu-brand > span {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .mobile-menu-brand strong {
    color: var(--accent-light);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.15;
  }
  .mobile-menu-brand strong b { color: var(--accent); font-weight: 900; }
  .mobile-menu-brand small {
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .04em;
    line-height: 1.3;
    text-transform: uppercase;
  }
  .mobile-menu-close {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(118,92,62,.2);
    border-radius: 12px;
    background: rgba(255,255,255,.48);
    color: var(--accent);
    transition: background var(--transition), transform var(--transition);
  }
  .mobile-menu-close:hover { background: #fff; transform: rotate(3deg); }

  .mobile-menu-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 68px;
    margin: 12px;
    padding: 11px 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(118,92,62,.96), rgba(143,122,102,.92));
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 15px;
    box-shadow: 0 8px 22px rgba(60,40,20,.14);
    color: #fff;
  }
  .mobile-menu-avatar,
  .mobile-menu-tile {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.32);
    border-radius: 11px;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 17px;
    font-weight: 900;
  }
  .mobile-menu-tile { background: #edc22e; border-color: rgba(255,255,255,.48); color: #3b2d20; font-size: 11px; }
  .mobile-menu-profile-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .mobile-menu-profile-copy strong {
    overflow: hidden;
    color: #fff;
    font-size: 13px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-menu-profile-copy small { color: rgba(255,255,255,.77); font-size: 10px; line-height: 1.35; }
  .mobile-menu-profile-link,
  .mobile-menu-join {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 10px;
    background: rgba(255,255,255,.13);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
  }

  .mobile-menu-quick {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 6px;
    margin: 0 12px 12px;
  }
  .mobile-menu-quick a {
    min-width: 0;
    min-height: 57px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(255,255,255,.52);
    border: 1px solid rgba(118,92,62,.16);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 9.5px;
    font-weight: 800;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
  }
  .mobile-menu-quick a:hover,
  .mobile-menu-quick a[aria-current="page"] {
    background: #fff;
    border-color: rgba(118,92,62,.42);
    color: var(--accent);
    transform: translateY(-1px);
  }

  .sidebar .sidebar-section {
    margin: 0 12px 10px;
    padding: 7px;
    background: rgba(255,255,255,.46);
    border: 1px solid rgba(118,92,62,.14);
    border-radius: 15px;
    box-shadow: 0 3px 12px rgba(60,40,20,.05);
  }
  .sidebar .sidebar-section:last-of-type { border-bottom: 1px solid rgba(118,92,62,.14); }
  .sidebar .sidebar-label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px 6px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .13em;
  }
  .sidebar .sidebar-label::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 3px 3px 0 rgba(118,92,62,.2);
  }
  .sidebar .sidebar-link {
    min-height: 46px;
    gap: 10px;
    margin: 1px 0;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 650;
  }
  .sidebar.collapsed .sidebar-link {
    justify-content: flex-start;
    margin: 1px 0;
    padding: 6px 8px;
  }
  .sidebar .sidebar-link:hover {
    background: rgba(255,255,255,.72);
    border-color: rgba(118,92,62,.14);
  }
  .sidebar .sidebar-link .sidebar-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(118,92,62,.08);
    color: var(--accent);
  }
  .sidebar.collapsed .sidebar-link .sidebar-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: rgba(118,92,62,.08);
  }
  .sidebar .sidebar-link.active {
    background: linear-gradient(135deg, #765c3e, #8f7a66);
    border-color: rgba(255,255,255,.2);
    box-shadow: 0 6px 14px rgba(60,40,20,.14);
    color: #fff;
  }
  .sidebar .sidebar-link.active .sidebar-icon {
    background: rgba(255,255,255,.16);
    color: #fff;
  }
  .sidebar .sidebar-link.active .sidebar-link-text { color: #fff; }
  .sidebar .sidebar-badge { box-shadow: 0 0 0 2px rgba(255,255,255,.32); }

  /* Sidebar backdrop */
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 199;
    background: rgba(45,32,22,.54); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
  }
  .sidebar-backdrop.active { opacity: 1; pointer-events: auto; }

  /* Ranking filter tabs: difficulty group wraps to full-width row on mobile */
  .filter-diff-group { margin-left: 0 !important; width: 100%; }

  /* Main content */
  .main-content { margin-left: 0 !important; padding: 16px; }
  .breadcrumb-bar { margin: -16px -16px 16px; padding: 0 16px; }
  .breadcrumb {
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .sidebar.collapsed ~ .main-content { margin-left: 0 !important; }

  /* Footer */
  .site-footer {
    margin-left: 0 !important;
    padding: 24px 16px 20px !important;
    margin-top: 32px !important;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 16px 12px !important;
    max-width: none;
  }
  .footer-grid > .footer-brand {
    grid-column: 1 / -1;
    margin-bottom: 4px;
  }
  .footer-tagline { display: none; }
  .footer-logo { margin-bottom: 0; }
  .footer-logo svg { width: 28px !important; height: 28px !important; }
  .footer-title {
    font-size: 10px !important;
    margin-bottom: 6px !important;
    letter-spacing: 0.06em !important;
  }
  .footer-links { gap: 5px !important; }
  .footer-link { font-size: 12px !important; }
  .footer-bottom {
    margin-top: 18px !important;
    padding-top: 12px !important;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    font-size: 11px !important;
  }
  .footer-bottom > div { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

  /* Topbar */
  .topbar-menu-toggle { display: flex; }
  .topbar-search { max-width: 180px; }
  .topbar-logo { width: auto; }
  .topbar-logo .logo-text { display: none; }
  .topbar-actions { gap: 4px; }

  /* Bigger tap targets (44px WCAG minimum) */
  .topbar-icon-btn { width: 44px; height: 44px; }
  .user-avatar-btn { width: 44px; height: 44px; font-size: 15px; }
  .topbar-menu-toggle { width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; }
  .page-btn { min-width: 44px; height: 44px; }
  .filter-btn { padding: 9px 14px; }

  /* Prevent iOS auto-zoom on input focus */
  input, select, textarea, .form-control { font-size: 16px; }
  .topbar-search input { font-size: 15px; }

  /* Hero */
  .hero-card { padding: 24px; flex-direction: column; }

  /* Help */
  .help-layout { grid-template-columns: 1fr; }
  .help-nav {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }
  .help-nav-link {
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 10px 14px;
    font-size: 12px;
  }
  .help-nav-link:last-child { border-right: none; }
  .help-content { padding: 20px; }

  /* Championship hero */
  .champ-hero { padding: 20px 16px 18px; }

  /* Profile */
  .profile-header { padding: 20px; flex-direction: column; text-align: center; }
  .profile-header .lb-avatar { margin: 0 auto; }
  .profile-stats { justify-content: center; }

  /* Stat grid */
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Tables: horizontal scroll - Scoped to the wrapper only, not all cards */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .lb-table { min-width: 480px; }

  /* Responsive grid utility */
  .responsive-grid { grid-template-columns: 1fr !important; }

  /* Filter bar wrap */
  .filter-bar { flex-wrap: wrap; gap: 6px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Cards grid (explore more, related pages) */
  [style*="grid-template-columns:repeat(auto-fill"] { grid-template-columns: 1fr 1fr !important; }

  /* Mode cards */
  .mode-cards { grid-template-columns: 1fr 1fr; }

  /* Page hero header - Compact on small mobile */
  .page-hero { gap: 12px; margin-bottom: 12px; }
  .page-hero-text h1 { font-size: 18px; line-height: 1.2; }
  .page-hero-text p  { font-size: 11px; line-height: 1.35; margin-top: 2px; }
  .page-hero-icon { display: none; }

  /* Compact filter chips on mobile */
  .filter-bar { gap: 5px; margin-bottom: 14px; }
  .filter-btn { padding: 6px 11px; font-size: 12px; }
  .filter-diff-group { width: auto !important; margin-left: 0 !important; gap: 5px !important; }

  /* Flash messages */
  .flash-container { max-width: calc(100vw - 32px); right: 16px; }

  /* Pagination compact */
  .pagination { flex-wrap: wrap; justify-content: center; gap: 4px; }
}

/* ── 480px: Small phones ── */
@media (max-width: 480px) {
  /* Hide search and compress topbar */
  .topbar-search { display: none; }
  .topbar-actions { gap: 2px; }

  /* Hide sign-up button on small screens - Just show Log In */
  .btn-signup { display: none; }
  .btn-login { padding: 8px 14px; font-size: 13px; }

  /* Grids → single column */
  .stat-grid { grid-template-columns: 1fr; }
  .mode-cards { grid-template-columns: 1fr; }
  /* Footer stays 3-col compact on small phones too (overridden above) */
  [style*="grid-template-columns:repeat(auto-fill"] { grid-template-columns: 1fr !important; }

  /* Reduce padding */
  .main-content { padding: 12px; }
  .breadcrumb-bar { margin: -12px -12px 14px; padding: 0 12px; }
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }
  .auth-card { padding: 20px; }
  .help-content { padding: 16px; }
  .help-content h1 { font-size: 20px; }
  .profile-header { padding: 16px; }
  .profile-username { font-size: 20px; }

  /* Hero text */
  .hero-title { font-size: 22px; }
  .hero-subtitle { font-size: 14px; }
}

/* ── 375px: Smallest phones (iPhone SE, Galaxy A series) ── */
@media (max-width: 375px) {
  .main-content { padding: 10px; }
  .breadcrumb-bar { margin: -10px -10px 12px; padding: 0 10px; }
  .hero-title { font-size: 20px; }
  .auth-card { padding: 16px; }
  .card-body { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .help-content { padding: 14px; }
  .profile-header { padding: 14px; }
}

/* ══════════════════════════════════════
   UTILS
   ══════════════════════════════════════ */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-accent  { color: var(--accent-light); }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-gold    { color: var(--gold); }
.font-bold    { font-weight: 700; }
.font-black   { font-weight: 900; }
.hidden       { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ═══ Inline SVG Icons (emoji replacements) ═══════════════════════════════ */
.ico { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; flex-shrink: 0; }
.ico svg { display: block; }
.ico-sm svg { width: 14px; height: 14px; }
.ico-md svg { width: 18px; height: 18px; }
.ico-lg svg { width: 24px; height: 24px; }
.ico-xl svg { width: 36px; height: 36px; }
