/* Layout and UI styling for the backgammon canvas demo. */

:root {
  --bg: #111318;
  --panel: #1b1f28;
  --panel2: #232938;
  --line: #394155;
  --text: #eceef4;
  --muted: #b9c0d1;
  --accent: #7fd3ff;
  --gold: #e6c87a;
  --font-h1: 28px;
  --font-h2: 16px;
  --font-h3: 13px;
  --font-body: 11px;
  --font-small: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #0e1015, #171b24) no-repeat;
  background-color: #171b24;
  color: var(--text);
  font-size: var(--font-body);
}
.page { margin: 0 auto; padding: 0; }
.page.page-play { max-width: none; padding: 0; }

/* Responsive site container */
.site-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px;
}
@media (min-width: 768px)  { .site-container { padding: 24px 24px; } }
@media (min-width: 1024px) { .site-container { max-width: 1024px; } }
@media (min-width: 1200px) { .site-container { max-width: 1200px; } }

/* ---- Site navigation bar ---- */
.site-nav {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  height: 48px;
}
.site-nav-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  padding-right: 24px;
  margin-right: 4px;
  border-right: 1px solid rgba(255,255,255,.08);
}
.site-nav-brand:hover { color: #f0d890; }
/* Logo image variant */
.site-nav-brand-logo { display: flex; align-items: center; }
.site-nav-logo-img   { max-height: 32px; width: auto; display: block; }
.site-nav-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}
.site-nav-tab {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.site-nav-tab:hover { color: var(--text); }
.site-nav-tab.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Dropdown nav items (v90) */
.site-nav-dropdown {
  position: relative;
}
.site-nav-tab-dropdown {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.site-nav-caret {
  font-size: 9px;
  margin-left: 3px;
  opacity: .6;
}
.site-nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--card-bg, #1a1d2e);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  padding: 6px 0;
  z-index: 1000;
}
.site-nav-dropdown:hover .site-nav-dropdown-menu,
.site-nav-dropdown:focus-within .site-nav-dropdown-menu {
  display: block;
}
.site-nav-dropdown-item {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.site-nav-dropdown-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--text);
}

/* Custom page content (v90) */
.custom-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.custom-page-content {
  line-height: 1.6;
  font-size: 15px;
  color: var(--text);
}
.custom-page-content h1 { font-size: 28px; margin: 0 0 12px; }
.custom-page-content h2 { font-size: 22px; margin: 24px 0 10px; border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 6px; }
.custom-page-content h3 { font-size: 18px; margin: 18px 0 8px; }
.custom-page-content p { margin: 0 0 12px; }
.custom-page-content table { width: 100%; border-collapse: collapse; margin: 14px 0 20px; font-size: 14px; }
.custom-page-content th,
.custom-page-content td { border: 1px solid rgba(255,255,255,.12); padding: 8px 10px; text-align: left; }
.custom-page-content th { background: rgba(255,255,255,.04); }
.custom-page-content ul,
.custom-page-content ol { padding-left: 24px; margin: 0 0 12px; }
.custom-page-content li { margin-bottom: 4px; }
.custom-page-content img { max-width: 100%; height: auto; border-radius: 4px; }
.custom-page-content code { background: rgba(255,255,255,.06); padding: 2px 5px; border-radius: 3px; font-size: 13px; }
.custom-page-content blockquote { border-left: 3px solid var(--gold); margin: 12px 0; padding: 8px 14px; opacity: .85; }
.site-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding-left: 16px;
  white-space: nowrap;
}
.site-nav-user {
  font-size: 12px;
  color: var(--muted);
}
.site-nav-link {
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
}
.site-nav-link:hover { text-decoration: underline; }
.site-nav-link-cta {
  padding: 6px 14px;
  background: rgba(230,200,122,.1);
  border: 1px solid rgba(230,200,122,.25);
  border-radius: 4px;
}
.site-nav-link-cta:hover {
  background: rgba(230,200,122,.18);
  text-decoration: none;
}

/* Mobile nav */
@media (max-width: 640px) {
  .site-nav { padding: 0 8px; }
  .site-nav-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 4px; }
  .site-nav-brand { padding-right: 10px; margin-right: 0; border-right: none; font-size: 14px; }
  .site-nav-tabs { order: 3; width: 100%; flex-wrap: wrap; }
  .site-nav-tab { height: 36px; padding: 0 5px; font-size: 11px; }
  .site-nav-right { padding-left: 0; gap: 6px; }
  .site-nav-user { display: none; }
  .site-nav-link { font-size: 11px; }
  .site-nav-link-cta { padding: 4px 8px; font-size: 11px; }
  .site-nav-dropdown-menu { position: fixed; left: 8px; right: 8px; min-width: auto; }
}
.topbar {
  display: flex; justify-content: space-between; gap: 18px; align-items: flex-start;
  margin-bottom: 18px; flex-wrap: wrap;
}
h1 { margin: 0 0 8px; font-size: var(--font-h1); }
h2 { font-size: var(--font-h2); }
h3 { font-size: var(--font-h3); }
p { margin: 0; color: var(--muted); line-height: 1.45; }
.controls-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.controls { display: flex; gap: 10px; }
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
  user-select: none;
}
.toggle-row input { width: 18px; height: 18px; }
button {
  appearance: none; border: 1px solid #4f5b77; background: linear-gradient(180deg, #2f3a52, #20283a);
  color: var(--text); padding: 6px 10px; border-radius: 4px; cursor: pointer; font-weight: 700; font-size: var(--font-body);
}
button.secondary { background: linear-gradient(180deg, #403030, #2e2323); border-color: #755757; }
button:disabled { opacity: .55; cursor: not-allowed; }
.layout { display: grid; grid-template-columns: minmax(760px, 1fr) 150px 240px; gap: 18px; align-items: stretch; }
.board-panel, .panel {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 32px rgba(0,0,0,.28);
}
.board-panel { padding: 14px; }
canvas { display: block; margin: 0 auto; background: #22170d; border-radius: 12px; }

.sidebar { display: flex; flex-direction: column; gap: 8px; }

.menu-panel-links { display: grid; gap: 4px; }
.menu-link {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid rgba(230,200,122,.28);
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
}
.menu-link:hover {
  text-decoration: none;
  border-color: rgba(230,200,122,.55);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
.play-header-sub { justify-content: flex-start; }
.panel { padding: 8px 8px; }
.panel h2 { margin: 0 0 6px; font-size: 13px; }
.panel h3 { margin: 0 0 4px; font-size: 11px; color: var(--muted); }
#statusText, #selectedText { color: var(--muted); min-height: 26px; }
#historyList { margin: 0; color: var(--muted); font-size: 11px; }

/* Move log - grouped by player with checker-coloured backgrounds */
.move-log { display: flex; flex-direction: column; gap: 3px; max-height: 420px; overflow-y: auto; }
.move-group {
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  line-height: 1.35;
}
.move-group-label {
  font-weight: 700;
  margin-bottom: 1px;
}
.move-group-line {
  padding-left: 0;
}
.move-group.player-group {
  background: var(--checker-player-bottom, #d8d0c2);
  color: var(--checker-player-text, #3c2d1c);
  border: 1px solid var(--checker-player-edge, #9b8763);
}
.move-group.computer-group {
  background: var(--checker-computer-bottom, #141927);
  color: var(--checker-computer-text, #eef2ff);
  border: 1px solid var(--checker-computer-edge, #8990a6);
}
.move-log-empty {
  font-size: 11px;
  color: var(--muted);
}
.note p { font-size: 14px; }
@media (max-width: 1400px) {
  .layout { grid-template-columns: 1fr; }
  .controls-wrap { align-items: flex-start; }
}

.topbar-full { margin-bottom: 24px; }
.account-box { margin-left: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.account-user { display: flex; align-items: center; gap: 10px; }
.account-links { display: flex; gap: 12px; flex-wrap: wrap; }
.account-links a, .small-link { color: var(--gold); text-decoration: none; }
.account-links a:hover, .small-link:hover { text-decoration: underline; }
.avatar-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 50%; border: 2px solid var(--line); }
.avatar-large { width: 120px; height: 120px; object-fit: cover; border-radius: 16px; border: 2px solid var(--line); }
.muted { color: var(--muted); }
.form-card { max-width: 720px; background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 32px rgba(0,0,0,.28); padding: 16px; }
.form-card.wide { max-width: 1200px; }
.stack-form { display: grid; gap: 14px; }
.stack-form label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
.stack-form input, .stack-form textarea { width: 100%; padding: 8px 10px; border-radius: 4px; border: 1px solid var(--line); background: #131722; color: var(--text); font-size: 11px; }
.stack-form select, select { padding: 5px 8px; border-radius: 4px; border: 1px solid var(--line); background: #131722; color: var(--text); font-size: 11px; }
.admin-page .games-table td { font-size: 11px; vertical-align: middle; }
.admin-page .games-table th { font-size: 11px; }
.admin-page input[type="number"] { padding: 4px 6px; border-radius: 4px; border: 1px solid var(--line); background: #131722; color: var(--text); font-size: 11px; }
.flash { padding: 8px 10px; border-radius: 4px; background: #1d2f24; border: 1px solid #365442; margin-bottom: 10px; font-size: 11px; }
.flash.error { background: #321d20; border-color: #6f4048; }
.games-table { width: 100%; border-collapse: collapse; }
.games-table th, .games-table td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; }
.pref-panel a { color: var(--gold, #e6c87a); }
.pref-panel a:visited { color: var(--gold, #e6c87a); }
.games-table a { color: var(--gold, #e6c87a); text-decoration: none; }
.games-table a:visited { color: var(--gold, #e6c87a); }
.games-table a:hover { text-decoration: underline; }
.actions-cell { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.small-btn { padding: 5px 10px; border-radius: 4px; }
.danger { background: linear-gradient(180deg, #5b2d34, #3b1c21); border-color: #82414c; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 12px; }
.replay-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.replay-side { display: grid; gap: 14px; }
#replayCanvas { width: 100%; height: auto; display: block; background: #22170d; border-radius: 12px; }
#replayList { margin: 0; padding-left: 18px; color: var(--muted); max-height: 420px; overflow: auto; }

.compact-header { margin-bottom: 10px; }
.header-row { display:flex; justify-content:space-between; align-items:center; gap:16px; }
.header-row-main { margin-bottom: 4px; }
.header-brand { display:flex; align-items:baseline; gap:14px; flex-wrap:wrap; }
.header-brand h1 { margin:0; font-size: var(--font-h1); line-height:1.05; }
.header-tag, .header-sub-copy, .header-state { color: var(--muted); }
.header-state { text-align:right; font-weight:700; color: var(--gold); }
.slim-controls { display:flex; justify-content:flex-end; align-items:center; gap:16px; margin-bottom: 8px; }
@media (max-width: 1100px) {
  .header-row, .slim-controls { flex-direction:column; align-items:flex-start; }
  .header-state { text-align:left; }
}


.app-version {
  display: inline-block;
  margin-left: 10px;
  font-size: var(--font-h2);
  font-weight: 700;
  color: var(--gold);
  vertical-align: middle;
}


.preferences-page { padding-bottom: 28px; }
.pref-head { margin-bottom: 12px; }
.pref-tabs { display:flex; gap:10px; margin: 10px 0 18px; flex-wrap: wrap; }
.pref-tab {
  background: linear-gradient(180deg, #2b3244, #1e2432);
  border: 1px solid #4b5670;
}
.pref-tab.is-active {
  background: linear-gradient(180deg, #8b5a1a, #663f12);
  border-color: #d8a257;
}
.pref-panel { display:none; }
.pref-panel.is-active { display:block; }

/* Admin category tabs (v108) */
.admin-cat-tabs {
  display: flex; gap: 6px; margin: 0 0 4px; flex-wrap: wrap;
}
.admin-cat {
  padding: 9px 22px;
  border: 1px solid #4b5670;
  border-top: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #232838, #1a1f2e);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.admin-cat:hover {
  color: var(--text);
  background: linear-gradient(180deg, #2b3244, #1e2432);
}
.admin-cat.is-active {
  color: var(--gold);
  background: linear-gradient(180deg, #2b3244, #1e2432);
  border-top-color: var(--gold);
  border-left-color: #5a6580;
  border-right-color: #5a6580;
  border-bottom-color: transparent;
}
.admin-cat-group { display: none; }
.admin-cat-group.is-active { display: block; }
.admin-cat-group .pref-tabs { margin-top: 0; }
.pref-panel-copy { margin-bottom: 14px; }
.theme-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.theme-card {
  position: relative;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.theme-card:hover { transform: translateY(-1px); border-color: rgba(230,200,122,.5); }
.theme-card.is-selected { border-color: #e6c87a; box-shadow: 0 0 0 2px rgba(230,200,122,.18) inset; }
.theme-card input { position:absolute; opacity:0; pointer-events:none; }
.theme-title { font-weight: 700; color: var(--text); }
.theme-preview { display:flex; align-items:center; justify-content:center; }
.board-preview { min-height: 130px; }
.mini-board-outer {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1.8 / 1;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, var(--outer-top), var(--outer-bottom));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.mini-board-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--inner-top), var(--inner-bottom));
}
.mini-side { position:absolute; top:0; bottom:0; width: 12%; background: var(--side-rail); }
.mini-side.left { left:0; }
.mini-side.right { right:0; }
.mini-bar { position:absolute; top:0; bottom:0; left:50%; width: 7%; transform: translateX(-50%); background: var(--bar); }
.mini-main {
  position:absolute; left: 12%; right: 12%;
  background-size: 40px 100%;
}
.mini-main.top {
  top:0; bottom:50%;
  background-image: linear-gradient(120deg, transparent 0 22%, var(--point-light) 22% 50%, transparent 50%), linear-gradient(240deg, transparent 0 22%, var(--point-dark) 22% 50%, transparent 50%);
  background-position: 0 0, 20px 0;
}
.mini-main.bottom {
  top:50%; bottom:0;
  background-image: linear-gradient(60deg, transparent 0 22%, var(--point-light) 22% 50%, transparent 50%), linear-gradient(300deg, transparent 0 22%, var(--point-dark) 22% 50%, transparent 50%);
  background-position: 0 0, 20px 0;
}
.checker-preview { min-height: 92px; gap: 16px; }
.mini-checker {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(180deg, var(--checker-top), var(--checker-bottom));
  border: 3px solid var(--checker-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 18px rgba(0,0,0,.25);
}
.mini-vs { font-size: 20px; font-weight: 700; color: var(--muted); }
.difficulty-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.difficulty-card { text-align: center; }
.difficulty-preview { min-height: 64px; }
.difficulty-icon { font-size: 32px; line-height: 1; }
.difficulty-desc { display: block; font-size: 10px; line-height: 1.4; margin-top: 2px; }
.pref-actions { display:flex; align-items:center; gap:14px; margin-top: 20px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .theme-grid { grid-template-columns: 1fr; }
}


/* Build v31 play-page layout: two-column with full canvas on the left
   and collapsible menu + move log on the right. Player cards, home
   columns, action buttons, and site title are drawn inside the canvas. */
.page.page-play {
  max-width: none;
  padding: 8px 10px 10px;
}
.page.page-play .app-header {
  display: none;
}
/* v75: sidebar removed from game page - layout is pure flex now (defined below in button bar section) */
.play-board-panel {
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -----------------------------------------------------------------------
   Mobile game - colours and resign modals (mobile bar)
   ----------------------------------------------------------------------- */

@media (max-width: 960px) {
  /* Maximise canvas space - strip padding on game page */
  .page.page-play {
    padding: 0;
  }

  /* Strip all decorative styling from board panel on mobile */
  .play-board-panel {
    padding: 0;
    align-items: flex-end;
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  /* Remove canvas border-radius on mobile so it sits flush */
  .play-board-panel canvas {
    border-radius: 0;
  }

  /* Tighter layout height on mobile */
  .play-layout {
    height: 100vh;
    height: 100dvh;
  }

  /* More comfortable touch targets on theme swatches in modal */
  .swatch-board,
  .swatch-checker {
    min-height: 30px;
  }
}

/* -----------------------------------------------------------------------
   Portrait orientation overlay - forces landscape on mobile/tablet
   ----------------------------------------------------------------------- */

.portrait-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: linear-gradient(180deg, #0e1118 0%, #1a1f2e 100%);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.portrait-message {
  padding: 40px 30px;
  max-width: 320px;
}
.portrait-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: portrait-rotate 2s ease-in-out infinite;
}
.portrait-message h2 {
  color: var(--gold, #c8a84b);
  font-size: 22px;
  margin: 0 0 12px;
}
.portrait-message p {
  color: rgba(255,255,255,0.65);
  font-size: 15px;
  margin: 0;
  line-height: 1.5;
}
@keyframes portrait-rotate {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(90deg); }
  50%, 75% { transform: rotate(90deg); }
}
/* Show overlay when in portrait on devices 1000px wide or less */
@media (max-width: 1000px) and (orientation: portrait) {
  .portrait-overlay {
    display: flex;
  }
}

/* -----------------------------------------------------------------------
   Fullscreen toggle button - floating top-right on game page
   ----------------------------------------------------------------------- */

.fullscreen-btn {
  position: fixed;
  top: 6px;
  right: 6px;
  z-index: 500;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(14, 17, 24, 0.75);
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
  line-height: 1;
}
.fullscreen-btn:hover {
  background: rgba(14, 17, 24, 0.9);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.35);
}
/* Expanded tip state for iOS fallback message */
.fullscreen-btn.fullscreen-tip {
  width: auto;
  padding: 0 12px;
  font-size: 11px;
  white-space: nowrap;
  border-color: var(--gold, #c8a84b);
  color: var(--gold, #c8a84b);
}
/* Hide on desktop (not needed) */
@media (min-width: 1001px) {
  .fullscreen-btn {
    display: none;
  }
}

/* -----------------------------------------------------------------------
   Action button bar - sits below the canvas on all screen sizes
   ----------------------------------------------------------------------- */

/* Bar itself */
.mobile-action-bar {
  display: flex;
  gap: 4px;
  padding: 3px 4px;
  background: #141820;
  border-top: 1px solid rgba(255,255,255,0.08);
  align-items: stretch;
  flex-shrink: 0;
  /* On desktop, constrain width to match the canvas and centre it */
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* All buttons share these base styles */
.mob-btn {
  flex: 1;
  padding: 0 8px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.12s, border-color 0.12s;
  text-decoration: none;
}
/* Lobby - left anchor */
.mob-btn-lobby {
  background: linear-gradient(180deg, #2f3a52, #20283a);
  border-color: rgba(230,200,122,0.3);
  color: var(--gold, #c8a84b);
  flex: 0 0 auto;
  padding: 0 14px;
}
.mob-btn-lobby:hover { border-color: rgba(230,200,122,0.6); text-decoration: none; color: var(--gold, #c8a84b); }
/* Roll Dice - orange */
.mob-btn-roll {
  background: linear-gradient(180deg, #d4852a, #b06820);
  border-color: #e8a24a;
  color: #fff;
}
.mob-btn-roll:hover { border-color: #f0b860; }
/* Make your Move - blue */
.mob-btn-move {
  background: linear-gradient(180deg, #2a5db0, #1e4a8a);
  border-color: #5a8fd4;
  color: #fff;
  cursor: default;
  font-size: 11px;
  pointer-events: none; /* visible but not clickable - do NOT disable so opacity stays full */
}
/* New Game */
.mob-btn-new {
  background: linear-gradient(180deg, #e67e22, #c0641a);
  border-color: #f09030;
  color: #fff;
}
/* Auto Roll */
.mob-btn-autoroll {
  background: linear-gradient(180deg, #2f3a52, #20283a);
  border-color: rgba(255,255,255,0.2);
  color: #eceef4;
  flex: 1.1;
}
.mob-btn-autoroll.is-active {
  border-color: #7fd3ff;
  color: #7fd3ff;
}
/* Resign - bright white when enabled, dimmed when disabled */
.mob-btn-resign {
  background: linear-gradient(180deg, #4a1a1a, #341212);
  border-color: rgba(180,60,60,0.5);
  color: #ffffff;
  flex: 0.85;
}
.mob-btn-resign:hover { border-color: rgba(220,80,80,0.7); }
/* Rewind (undo) - gold accent */
.mob-btn-rewind {
  background: linear-gradient(180deg, #3a3520, #2a2818);
  border-color: rgba(240,216,146,0.4);
  color: #f0d892;
  flex: 0.8;
}
.mob-btn-rewind:hover { border-color: rgba(240,216,146,0.7); }
/* Submit (confirm) - bright green accent, used as third state of roll button */
.mob-btn-confirm {
  background: linear-gradient(180deg, #28a745, #1e8838);
  border-color: #5cd87a;
  color: #fff;
}
.mob-btn-confirm:hover { border-color: #8af0a0; }
/* Hints - amber accent */
.mob-btn-hints {
  background: linear-gradient(180deg, #3a3018, #2a2210);
  border-color: rgba(200,160,60,0.4);
  color: #e8c860;
  flex: 0.7;
}
/* Colours button - right anchor */
.mob-btn-colours {
  background: linear-gradient(180deg, #2f3a52, #20283a);
  border-color: rgba(255,255,255,0.2);
  color: #eceef4;
  flex: 0 0 auto;
  padding: 0 12px;
  font-size: 16px;
}
.mob-btn-colours:hover { border-color: rgba(255,255,255,0.45); }
/* Chat button (v102) */
.mob-btn-chat {
  background: linear-gradient(180deg, #2a4a3a, #1e3a2c);
  border-color: rgba(120,200,150,0.3);
  color: #c0e8d0;
  flex: 0 0 auto;
  font-size: 12px;
}
.mob-btn-chat:hover { border-color: rgba(120,200,150,0.6); }

/* Game chat panel (v102) */
.game-chat-panel {
  position: fixed;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  width: 220px;
  max-height: 340px;
  background: rgba(22,26,38,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  overflow: hidden;
}
.game-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  font-weight: 600;
  color: #eceef4;
}
.game-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.game-chat-close:hover { color: rgba(255,255,255,0.8); }
.game-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  max-height: 160px;
  min-height: 60px;
}
.game-chat-msg {
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.4;
}
.game-chat-msg-name {
  font-weight: 600;
  margin-right: 5px;
  color: #90b0d0;
}
.game-chat-msg.is-me .game-chat-msg-name {
  color: var(--gold, #e6c87a);
}
.game-chat-msg-text {
  color: #d0d4de;
}
.game-chat-msg.is-emote .game-chat-msg-text {
  font-style: italic;
}
.game-chat-emotes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  box-sizing: border-box;
}
.game-chat-emote {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s;
}
.game-chat-emote:hover {
  background: rgba(255,255,255,0.14);
}
.game-chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  box-sizing: border-box;
}
.game-chat-input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 5px;
  padding: 5px 8px;
  color: #eceef4;
  font-size: 12px;
  outline: none;
}
.game-chat-input:focus {
  border-color: rgba(255,255,255,0.3);
}
.game-chat-send {
  background: rgba(120,200,150,0.2);
  border: 1px solid rgba(120,200,150,0.3);
  border-radius: 5px;
  color: #c0e8d0;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.game-chat-send:hover {
  background: rgba(120,200,150,0.35);
}

/* Chat toast bubbles (v102) */
.game-chat-toasts {
  position: fixed;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  z-index: 850;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  max-width: 220px;
}
.game-chat-toast {
  background: rgba(22,26,38,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #d0d4de;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: chatToastIn 0.3s ease;
}
.game-chat-toast.is-system {
  border-color: rgba(248,113,113,0.3);
  color: #fca5a5;
}
.game-chat-toast.fade-out {
  opacity: 0;
  transition: opacity 0.5s ease;
}
@keyframes chatToastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .game-chat-panel {
    width: 190px;
    left: 6px;
    max-height: 280px;
  }
  .game-chat-messages { max-height: 110px; }
}
/* Disabled */
.mob-btn-disabled,
.mob-btn:disabled {
  opacity: 0.38;
  cursor: default;
}
/* Auto Roll checkbox */
.mob-autoroll-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 2px;
  flex-shrink: 0;
  position: relative;
}
.mob-autoroll-box.is-checked {
  background: #7fd3ff;
  border-color: #7fd3ff;
}
.mob-autoroll-box.is-checked::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 4px;
  width: 4px;
  height: 2px;
  border-left: 2px solid #1b1f28;
  border-bottom: 2px solid #1b1f28;
  transform: rotate(-45deg);
  transform-origin: left bottom;
}

/* Layout: canvas fills remaining height, bar sits below */
.play-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10px);
  height: calc(100dvh - 10px); /* dynamic viewport height - accounts for mobile browser chrome */
}
.play-board-panel {
  flex: 1 1 auto;
  min-height: 0;
}

/* v76: pip count bar removed - counts shown on canvas between home panels */

/* On narrow screens, tighten button text slightly */
@media (max-width: 480px) {
  .mob-btn { font-size: 10px; padding: 0 4px; }
  .mob-btn-move { font-size: 9px; }
  .mob-btn-confirm { font-size: 9px; }
  .mob-btn-lobby { padding: 0 8px; }
  .mob-btn-colours { padding: 0 8px; }
  .mob-btn-rewind { font-size: 10px; padding: 0 4px; }
  .mob-btn-hints { font-size: 10px; padding: 0 4px; }
}

/* Colours modal - two-column swatch layout */
.modal-card.mob-colours-card {
  width: 340px;
}
.mob-colours-body {
  display: flex;
  gap: 16px;
  padding: 0 16px 16px;
}
.mob-colours-col {
  flex: 1;
  min-width: 0;
}
.mob-colours-col h4 {
  margin: 0 0 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* Wide screen: expand modal so both swatch columns sit comfortably */
@media (min-width: 1024px) {
  .modal-card.mob-colours-card {
    width: 720px;
    max-width: 720px;
    overflow: visible;
  }
  .mob-colours-body {
    gap: 32px;
    padding: 0 28px 28px;
  }
  .mob-colours-col h4 {
    font-size: 14px;
    margin-bottom: 12px;
  }
  .mob-colours-col .swatch-board,
  .mob-colours-col .swatch-checker {
    min-height: 56px;
  }
  .mob-colours-col .swatch-grid-5 {
    gap: 8px;
  }
  .mob-colours-col .swatch-checker-dot {
    width: 14px;
    height: 14px;
  }
}

/* -----------------------------------------------------------------------
   New Game Modal
   ----------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.65);
  align-items: center;
  justify-content: center;
}
.modal-overlay.is-open { display: flex; }
.modal-card {
  background: linear-gradient(180deg, #1e2230, #141820);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  width: 380px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e67e22;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.modal-header h3 {
  flex: 1;
  margin: 0;
  font-size: 16px;
  color: #eceef4;
}
.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 14px 18px; }
.modal-section { margin-bottom: 16px; }
.modal-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #eceef4;
  margin-bottom: 8px;
}
.modal-hint {
  margin: 6px 0 0;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  line-height: 1.3;
}
.toggle-group {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
}
.toggle-btn {
  flex: 1;
  padding: 8px 4px;
  background: rgba(255,255,255,0.04);
  border: none;
  border-right: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.toggle-btn:last-child { border-right: none; }
.toggle-btn:hover:not(.is-disabled) { background: rgba(255,255,255,0.08); color: #eceef4; }
.toggle-btn.is-active {
  background: rgba(200,130,40,0.85);
  color: #fff;
}
.toggle-btn.is-disabled {
  color: rgba(255,255,255,0.2);
  cursor: not-allowed;
}
.match-length-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.match-length-row input[type="range"] {
  flex: 1;
  accent-color: #e67e22;
  height: 6px;
}
.match-len-btns { display: flex; gap: 4px; }
.match-len-btn {
  width: 30px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: #eceef4;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.match-len-btn:hover { background: rgba(255,255,255,0.12); }
.modal-footer {
  display: flex;
  gap: 12px;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.modal-submit {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: #e67e22;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-submit:hover { background: #d35f0f; }
.modal-cancel {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
}
.modal-cancel:hover { color: #fff; border-color: rgba(255,255,255,0.25); }

/* -----------------------------------------------------------------------
   Game hub overlay - central menu for navigation and game modes
   ----------------------------------------------------------------------- */
.hub-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
}
.hub-overlay.is-open { display: flex; }
.hub-card {
  background: linear-gradient(180deg, #1e2230, #141820);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  width: 480px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  padding: 0;
}
.hub-header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hub-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--gold);
  font-weight: 700;
}
.hub-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.hub-close:hover { color: #fff; }
.hub-body { padding: 16px 22px 20px; }
.hub-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.35);
  margin: 0 0 8px;
}
.hub-section-label:not(:first-child) { margin-top: 18px; }
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.hub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hub-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.2);
  text-decoration: none;
}
.hub-item.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.hub-item-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}
.hub-item-text { display: flex; flex-direction: column; gap: 1px; }
.hub-item-label { font-size: 12px; color: var(--text); }
.hub-item-hint { font-size: 9px; color: rgba(255,255,255,0.4); font-weight: 400; }
.hub-item.hub-primary {
  border-color: rgba(230,126,34,0.4);
  background: rgba(230,126,34,0.08);
}
.hub-item.hub-primary:hover {
  border-color: rgba(230,126,34,0.6);
  background: rgba(230,126,34,0.14);
}
.hub-guest-note {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(127,211,255,0.06);
  border: 1px solid rgba(127,211,255,0.15);
  font-size: 11px;
  color: var(--accent);
  text-align: centre;
}
.hub-guest-note a { color: var(--gold); font-weight: 700; }

/* -----------------------------------------------------------------------
   Sidebar button strip - compact top row above collapsible content
   ----------------------------------------------------------------------- */
.sidebar-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.sidebar-btn {
  flex: 1;
  padding: 7px 6px;
  border-radius: 6px;
  border: 1px solid rgba(230,200,122,0.28);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-btn:hover {
  border-color: rgba(230,200,122,0.55);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  text-decoration: none;
}
.sidebar-btn-icon { font-size: 14px; line-height: 1; }

/* -----------------------------------------------------------------------
   Combined account page - side-by-side login and register
   ----------------------------------------------------------------------- */
.account-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
}
.account-slim-header { margin-bottom: 14px; }
.account-slim-header .header-row-sub { display: none; }
.account-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: 720px;
}
.account-half {
  padding: 20px;
}
.account-half:first-child {
  border-right: 1px solid var(--line);
}
.account-half h2 {
  margin: 0 0 14px;
  font-size: 15px;
}
@media (max-width: 600px) {
  .account-split {
    grid-template-columns: 1fr;
  }
  .account-half:first-child {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

/* -----------------------------------------------------------------------
   Dashboard - unified tabbed backend replacing separate pages
   ----------------------------------------------------------------------- */
.dash-tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 18px;
  border-bottom: 2px solid var(--line);
}
.dash-tab {
  padding: 10px 20px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  margin-bottom: -2px;
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.dash-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}
.dash-tab.is-active {
  color: var(--gold);
  background: linear-gradient(180deg, rgba(139,90,26,0.15), rgba(139,90,26,0.05));
  border-color: var(--line);
  border-bottom-color: var(--bg);
}
.dash-panel { display: none; }
.dash-panel.is-active { display: block; }
.msg-badge {
  display: inline-block; min-width: 16px; padding: 1px 5px; border-radius: 8px;
  background: #d4a843; color: #1a1a2e; font-size: 10px; font-weight: 700;
  text-align: center; line-height: 14px; vertical-align: middle;
}

/* Dashboard uses full width - no sidebar */
.dash-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.dash-content .form-card { max-width: none; }

/* Return to game link in header */
.header-back-link {
  color: var(--gold);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}
.header-back-link:first-of-type { margin-left: auto; }
.header-back-link:hover { text-decoration: underline; }

/* Pagination controls */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.page-link {
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #2f3a52, #20283a);
  color: var(--gold);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
}
.page-link:hover {
  border-color: rgba(230,200,122,0.55);
  text-decoration: none;
}
.page-info {
  font-size: 11px;
  color: var(--muted);
}

/* -----------------------------------------------------------------------
   Profile page - page-level grid with sidebar, stats, heatmap, results
   ----------------------------------------------------------------------- */

/* Slim header */
.profile-slim-header { margin-bottom: 10px; }
.profile-slim-header .header-row-sub { display: none; }
.header-title-link { color: inherit; text-decoration: none; }
.header-title-link:hover { text-decoration: none; opacity: 0.85; }

/* Page-level grid: content + sidebar */
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 14px;
  align-items: start;
  transition: grid-template-columns 0.25s ease;
}
.profile-layout.profile-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr) auto;
}

/* Content area stacks vertically */
.profile-content { display: grid; gap: 14px; min-width: 0; }

/* Top row: profile card + stat cards */
.profile-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Override .form-card max-width inside profile layout */
.profile-content .form-card { max-width: none; }

/* Profile header card */
.profile-header-card { padding: 16px; }
.profile-header { display: flex; gap: 14px; align-items: flex-start; }
.profile-avatar-area { flex-shrink: 0; }
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--line);
}
.profile-avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #8b5a1a, #663f12);
  color: #fff; font-size: 26px; font-weight: 700;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { margin: 0 0 4px; font-size: 20px; }
.profile-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.profile-meta-item { color: var(--muted); font-size: 11px; }
.streak-badge {
  font-weight: 700; border-radius: 4px; padding: 1px 6px; font-size: 11px;
}
.streak-win { background: rgba(46, 160, 67, 0.2); color: #56d364; border: 1px solid rgba(46, 160, 67, 0.3); }
.streak-loss { background: rgba(201, 42, 42, 0.2); color: #f47067; border: 1px solid rgba(201, 42, 42, 0.3); }
.profile-bio { color: var(--muted); font-size: 11px; margin: 4px 0 0; line-height: 1.4; }
.profile-actions { display: flex; gap: 12px; margin-top: 8px; }
.profile-actions a { color: var(--gold); text-decoration: none; font-size: 11px; font-weight: 700; }
.profile-actions a:hover { text-decoration: underline; }

/* Stat cards in shared panel */
.profile-stats-card { padding: 14px 10px; display: flex; flex-direction: column; align-items: stretch; }

/* Profile achievements showcase (v111) */
.profile-ach-showcase { display: flex; flex-direction: column; align-items: flex-start; }
.profile-ach-grid {
  display: flex; flex-wrap: wrap; gap: 6px; width: 100%;
}
.profile-ach-icon {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border-radius: 6px; cursor: default;
  transition: background 0.15s, transform 0.15s;
}
.profile-ach-icon:hover { background: rgba(255,255,255,0.12); transform: scale(1.15); }
.profile-ach-img { width: 24px; height: 24px; object-fit: contain; }
.profile-ach-emoji { font-size: 20px; line-height: 1; }
.profile-ach-count { font-size: 11px; color: var(--muted); margin-top: 8px; }
.profile-ach-empty { font-size: 12px; color: var(--muted); padding: 12px 0; }

/* Chart hover tooltips (v112) */
.chart-tooltip {
  position: absolute;
  background: rgba(24, 24, 28, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #e0e0e0;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

.profile-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  width: 100%; text-align: center;
}
.profile-stat { padding: 6px 4px; }
.profile-stat-accent .stat-value { color: var(--gold); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: var(--font-small); color: var(--muted); margin-top: 2px; }
.stat-detail { font-size: var(--font-small); color: rgba(255,255,255,0.35); margin-top: 2px; }

/* Sidebar */
.profile-sidebar-area {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.profile-sidebar-area .sidebar-toggle {
  align-self: flex-end;
}

/* Content sub-grids */
.profile-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.profile-section h3 { margin: 0 0 12px; font-size: var(--font-h3); color: var(--text); }

/* Activity heatmap */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: inline-block; min-width: 100%; }
.heatmap-container { display: flex; gap: 4px; }
.heatmap-day-labels { display: grid; grid-template-rows: repeat(7, 12px); gap: 2px; padding-top: 16px; }
.heatmap-day-label { font-size: 9px; color: var(--muted); line-height: 12px; text-align: right; padding-right: 4px; }
.heatmap-grid-area { display: grid; gap: 2px; }
.heatmap-months-row { display: flex; gap: 2px; height: 14px; }
.heatmap-month-label { width: 12px; font-size: 9px; color: var(--muted); line-height: 14px; text-align: left; flex-shrink: 0; }
.heatmap-cells-row { display: flex; gap: 2px; }

.hm-cell {
  width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0;
}
.hm-empty { background: transparent; }
.hm-lv-0 { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.hm-lv-1 { background: rgba(46, 160, 67, 0.25); border: 1px solid rgba(46, 160, 67, 0.35); }
.hm-lv-2 { background: rgba(46, 160, 67, 0.45); border: 1px solid rgba(46, 160, 67, 0.55); }
.hm-lv-3 { background: rgba(46, 160, 67, 0.65); border: 1px solid rgba(46, 160, 67, 0.7); }
.hm-lv-4 { background: rgba(46, 160, 67, 0.9); border: 1px solid rgba(46, 160, 67, 0.95); }

.heatmap-legend { display: flex; align-items: center; gap: 3px; margin-top: 8px; }
.hm-legend-text { font-size: 9px; color: var(--muted); padding: 0 3px; }

/* Difficulty breakdown bars */
.difficulty-stats { display: grid; gap: 10px; }
.diff-stat-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; }
.diff-stat-label { display: flex; align-items: center; gap: 6px; }
.diff-stat-icon { font-size: 12px; }
.diff-stat-name { font-size: 12px; font-weight: 700; color: var(--text); }
.diff-stat-bar-wrap {
  height: 8px; border-radius: 4px; background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.diff-stat-bar {
  height: 100%; border-radius: 4px; min-width: 2px;
  background: linear-gradient(90deg, var(--gold), #e67e22);
  transition: width 0.3s ease;
}
.diff-stat-nums { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Recent results list */
.recent-results { display: grid; gap: 4px; }
.recent-result-row {
  display: grid; grid-template-columns: 120px 80px 70px 60px 1fr auto;
  gap: 8px; align-items: center; padding: 6px 10px; border-radius: 6px;
  font-size: 11px; color: var(--muted);
}
.result-win { background: rgba(46, 160, 67, 0.06); border-left: 3px solid rgba(46, 160, 67, 0.5); }
.result-loss { background: rgba(201, 42, 42, 0.06); border-left: 3px solid rgba(201, 42, 42, 0.4); }
.rr-result { font-weight: 700; }
.result-win .rr-result { color: #56d364; }
.result-loss .rr-result { color: #f47067; }
.rr-diff { white-space: nowrap; }
.rr-moves, .rr-duration { color: rgba(255,255,255,0.4); }
.rr-date { color: rgba(255,255,255,0.35); }
.rr-replay { white-space: nowrap; }

@media (max-width: 1100px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-sidebar-area { order: -1; }
}
@media (max-width: 900px) {
  .profile-top-row { grid-template-columns: 1fr; }
  .profile-columns { grid-template-columns: 1fr; }
  .profile-stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-meta { justify-content: center; }
  .profile-actions { justify-content: center; }
  .recent-result-row {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }
  .diff-stat-row { grid-template-columns: 80px 1fr; }
  .diff-stat-nums { grid-column: 1 / -1; }
}

/* -----------------------------------------------------------------------
   Admin page layout - shared by games, preferences, and future admin pages
   ----------------------------------------------------------------------- */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 14px;
  align-items: start;
  transition: grid-template-columns 0.25s ease;
}
.admin-layout.admin-sidebar-collapsed {
  grid-template-columns: minmax(0, 1fr) auto;
}
.admin-content { display: grid; gap: 14px; min-width: 0; }
.admin-full-card { max-width: none; }

.admin-sidebar-area {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.admin-sidebar-area .sidebar-toggle {
  align-self: flex-end;
}

/* Two-column settings form for admin Site Settings tab */
.admin-settings-form { display: grid; gap: 10px; }
.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
}
.admin-settings-grid label {
  display: grid; gap: 6px; color: var(--muted); font-weight: 700; font-size: 11px;
}
.admin-settings-grid input,
.admin-settings-grid select {
  width: 100%; padding: 6px 8px; border-radius: 4px;
  border: 1px solid var(--line); background: #131722;
  color: var(--text); font-size: 11px;
}

@media (max-width: 800px) {
  .admin-settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar-area { order: -1; }
}

/* -----------------------------------------------------------------------
   Compact theme swatches - 5 columns for board and checker grids
   ----------------------------------------------------------------------- */
.board-grid-compact {
  grid-template-columns: repeat(5, 1fr);
}
.checker-grid-compact {
  grid-template-columns: repeat(5, 1fr);
}
.theme-card-compact {
  padding: 8px;
  gap: 6px;
  border-radius: 10px;
}
.board-preview-compact {
  min-height: 80px;
}
.board-preview-compact .mini-board-outer {
  max-width: 180px;
  padding: 8px;
  border-radius: 10px;
}
.board-preview-compact .mini-board-inner {
  border-radius: 6px;
}
.checker-preview-compact {
  min-height: 54px;
  gap: 8px;
}
.mini-checker-compact {
  width: 40px; height: 40px;
  border-width: 2px;
}
.mini-vs-compact {
  font-size: 14px;
}
.theme-title-compact {
  font-size: 10px;
}

@media (max-width: 1000px) {
  .board-grid-compact { grid-template-columns: repeat(3, 1fr); }
  .checker-grid-compact { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .board-grid-compact { grid-template-columns: repeat(2, 1fr); }
  .checker-grid-compact { grid-template-columns: repeat(2, 1fr); }
}

/* Sidebar theme picker swatches */
.swatch-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}
.swatch-board {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  box-sizing: border-box;
  transition: border-color .15s;
}
.swatch-board:hover { border-color: rgba(255,255,255,.5); }
.swatch-board.is-active { border-color: #f0d878; }
.swatch-checker {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: pointer;
  border: 2px solid transparent;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: rgba(0,0,0,.3);
  transition: border-color .15s;
}
.swatch-checker:hover { border-color: rgba(255,255,255,.5); }
.swatch-checker.is-active { border-color: #f0d878; }
.swatch-checker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
}

/* ==========================================================================
   PvP - Post a Game / Waiting state / Join page  (v40)
   ========================================================================== */

/* Hub: Post a Game button - slightly different accent to distinguish from PvC */
.hub-item.hub-pvp:not(.is-disabled) {
  border-color: rgba(100, 180, 255, 0.35);
}
.hub-item.hub-pvp:not(.is-disabled):hover {
  border-color: rgba(100, 180, 255, 0.7);
  background: rgba(100, 180, 255, 0.08);
}

/* Hub: waiting-for-opponent panel */
.hub-waiting-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4db8ff;
  animation: waitPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes waitPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}
}
.hub-cancel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Dashboard: PvP status badges */
.pvp-status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pvp-status-open     { background: rgba(80, 200, 120, 0.2); color: #6de09a; border: 1px solid rgba(80,200,120,0.3); }
.pvp-status-matched  { background: rgba(100,180,255,0.2);   color: #80c8ff; border: 1px solid rgba(100,180,255,0.3); }
.pvp-status-cancelled,
.pvp-status-closed   { background: rgba(255,255,255,0.06);  color: var(--muted); border: 1px solid rgba(255,255,255,0.1); }

.pvp-code-cell code {
  font-family: monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #f0d878;
}

/* Join page: detail table */
.join-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 8px;
}
.join-detail-table th,
.join-detail-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: left;
}
.join-detail-table th {
  color: var(--muted);
  font-weight: normal;
  width: 40%;
}

/* Wider variant for the lobby modal */
.modal-card-wide {
  width: 540px;
}



/* Lobby list rows */
.lobby-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}
.lobby-row:last-child { border-bottom: none; }
.lobby-row-own {
  background: rgba(212,175,55,0.06);
  border-left: 3px solid var(--gold, #d4af37);
}
.lobby-name {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-details {
  flex: 1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lobby-join-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--gold, #d4af37);
  color: var(--gold, #d4af37);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.lobby-join-btn:hover {
  background: rgba(212,175,55,0.15);
}
.lobby-cancel-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid rgba(220,80,80,0.6);
  color: rgba(220,80,80,0.9);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.lobby-cancel-btn:hover {
  background: rgba(220,80,80,0.12);
}
.lobby-waiting-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: rgba(100,180,255,0.1);
  border: 1px solid rgba(100,180,255,0.4);
  color: rgba(100,180,255,0.9);
  border-radius: 4px;
  cursor: default;
}
.lobby-rejected-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: rgba(220,80,80,0.1);
  border: 1px solid rgba(220,80,80,0.5);
  color: rgba(220,80,80,0.9);
  border-radius: 4px;
  cursor: default;
}
.lobby-accept-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid rgba(80,200,120,0.6);
  color: rgba(80,200,120,0.9);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.lobby-accept-btn:hover {
  background: rgba(80,200,120,0.12);
}
.lobby-reject-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12px;
  background: transparent;
  border: 1px solid rgba(220,80,80,0.6);
  color: rgba(220,80,80,0.9);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.lobby-reject-btn:hover {
  background: rgba(220,80,80,0.12);
}
.lobby-request-name {
  flex: 0 0 auto;
  font-size: 11px;
  color: rgba(100,180,255,0.9);
  font-weight: 600;
  white-space: nowrap;
}

/* Join request notification modal */
.join-req-message {
  font-size: 15px;
  margin-bottom: 10px;
}
.join-req-details {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.join-req-reject-btn {
  border-color: rgba(220,80,80,0.5) !important;
  color: rgba(220,80,80,0.85) !important;
}
.join-req-reject-btn:hover {
  background: rgba(220,80,80,0.15) !important;
}
.lobby-own-code {
  flex: 0 0 auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold, #d4af37);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(212,175,55,0.08);
}
.lobby-own-code:hover {
  background: rgba(212,175,55,0.18);
}
.lobby-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lobby-show-mine-label {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lobby-show-mine-label input {
  margin: 0;
}

/* Hub posted games summary */
.hub-posted-summary {
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hub-posted-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.hub-posted-lobby-btn {
  padding: 5px 14px;
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--gold, #d4af37);
  color: var(--gold, #d4af37);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.hub-posted-lobby-btn:hover {
  background: rgba(212,175,55,0.15);
}

/* Hub Join a Game button accent (matches Post a Game) */
.hub-item.hub-pvp:hover {
  border-color: rgba(212,175,55,0.5);
}

/* Active PvP game resume panel in hub */
.hub-resume-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.4);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.hub-resume-icon {
  color: var(--gold, #d4af37);
  font-size: 16px;
  flex: 0 0 auto;
}
.hub-resume-text {
  flex: 1;
  color: var(--text);
}
.hub-resume-btn {
  flex: 0 0 auto;
  padding: 5px 14px;
  background: var(--gold, #d4af37);
  color: #1a1f2e;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}
.hub-resume-btn:hover {
  background: #e8c84a;
}

.hub-abandon-btn {
  flex: 0 0 auto;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid rgba(180,60,60,0.6);
  color: #e07070;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.hub-abandon-btn:hover {
  background: rgba(180,60,60,0.15);
}

/* Debug log admin panel (v45) */
.btn { display:inline-block; padding:6px 14px; background:linear-gradient(180deg,#2d3348,#232838); border:1px solid var(--line); border-radius:4px; color:var(--text); font-size:11px; cursor:pointer; text-decoration:none; white-space:nowrap; line-height:1.4; }
.btn:hover { background:linear-gradient(180deg,#363d56,#2a3148); }
.btn-sm { padding:4px 10px; font-size:10px; }
.btn-danger { border-color:#6f4048; color:#f47067; }
.btn-danger:hover { background:rgba(180,60,60,.12); }

.debug-log-table { font-size:10px; }
.debug-log-table th { font-size:10px; white-space:nowrap; }
.debug-log-table td { font-size:10px; vertical-align:middle; padding:5px 6px; }
.dl-badge { font-weight:700; font-size:9px; letter-spacing:.5px; }
.dl-payload { display:none; }
.dl-payload.dl-open { display:table-row; }
.dl-payload td { background:rgba(0,0,0,.15); border-bottom:1px solid rgba(255,255,255,.06); }

.debug-filter-bar input,
.debug-filter-bar select { background:var(--panel); border:1px solid var(--line); color:var(--text); border-radius:3px; padding:3px 5px; }

/* Resign modals (v48) */
.resign-level-btns { display:flex; flex-direction:column; gap:8px; }
.resign-level-btn {
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 14px; background:linear-gradient(180deg,#2d3348,#232838);
  border:1px solid rgba(255,255,255,.15); border-radius:6px;
  color:#ddd; font-size:14px; cursor:pointer; transition:background .15s, border-color .15s;
}
.resign-level-btn:hover {
  background:linear-gradient(180deg,#3a4260,#2d3550);
  border-color:rgba(255,200,100,.35);
}
.resign-pts { font-size:12px; color:#e8a040; font-weight:600; }
.resign-response-btns { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.resign-demand-btn {
  display:inline-block; padding:7px 14px;
  background:linear-gradient(180deg,#504020,#3a3018);
  border:1px solid rgba(220,160,60,.35); border-radius:4px;
  color:#e8c060; font-size:13px; cursor:pointer;
}
.resign-demand-btn:hover { background:linear-gradient(180deg,#605030,#4a4028); }

/* ============================================================
   LOBBY PAGE (v50)
   ============================================================ */
.lobby-page {
  padding-top: 24px;
}

/* Action bar */
.lobby-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  margin-bottom: 18px;
  padding-top: 0;
}
.lobby-actions-left { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-actions-right { display: flex; gap: 8px; align-items: center; }

.lobby-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.lobby-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); }
.lobby-btn-icon { font-size: 16px; }
.lobby-btn-primary {
  background: linear-gradient(180deg, #e67e22, #d35f0f);
  border-color: rgba(230,126,34,.6);
  color: #fff;
  font-weight: 600;
}
.lobby-btn-primary:hover { background: linear-gradient(180deg, #f09030, #e06818); }
.lobby-btn-pvp {
  background: rgba(52,152,219,.15);
  border-color: rgba(52,152,219,.35);
}
.lobby-btn-pvp:hover { background: rgba(52,152,219,.25); }
.lobby-btn-muted {
  color: var(--muted, #8899aa);
  font-size: 13px;
}
.lobby-btn-small {
  padding: 6px 12px;
  font-size: 12px;
}
.lobby-btn-resume {
  background: linear-gradient(180deg, #27ae60, #1e8449);
  border-color: rgba(39,174,96,.5);
  color: #fff;
  font-weight: 600;
}
.lobby-btn-resume:hover { background: linear-gradient(180deg, #2ecc71, #27ae60); }
.lobby-btn-abandon {
  background: rgba(192,57,43,.15);
  border-color: rgba(192,57,43,.35);
  color: #e74c3c;
  font-size: 13px;
}

/* Resume banner */
.lobby-resume-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 18px;
  background: rgba(39,174,96,.1);
  border: 1px solid rgba(39,174,96,.3);
  border-radius: 8px;
  font-size: 14px;
}
.lobby-resume-icon { font-size: 18px; color: #2ecc71; }

/* Section titles */
.lobby-section-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 10px;
}

/* My waiting games */
.lobby-my-games { margin-bottom: 20px; }
.lobby-my-game-card {
  padding: 12px 16px;
  margin-bottom: 8px;
  background: rgba(52,152,219,.08);
  border: 1px solid rgba(52,152,219,.2);
  border-radius: 8px;
}
.lobby-my-game-info { margin-bottom: 6px; }
.lobby-my-game-details { font-size: 13px; color: rgba(255,255,255,.7); }
.lobby-invite-share {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.lobby-invite-code {
  font-size: 13px; font-family: monospace; letter-spacing: 1.5px; font-weight: 600;
  color: rgba(255,255,255,.85); padding: 4px 10px;
  background: rgba(255,255,255,.08); border-radius: 4px;
}
.lobby-copy-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px; color: rgba(255,255,255,.7); cursor: pointer;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.lobby-copy-btn:hover { background: rgba(255,255,255,.14); color: rgba(255,255,255,.9); }
.lobby-invite-hint {
  font-size: 11px; color: var(--muted, #8899aa); margin-top: 6px;
}
.lobby-my-game-code {
  font-size: 12px; font-family: monospace; letter-spacing: 1px;
  color: var(--muted, #8899aa); cursor: pointer; padding: 2px 6px;
  background: rgba(255,255,255,.05); border-radius: 3px;
}
.lobby-my-game-code:hover { background: rgba(255,255,255,.1); }
.lobby-my-game-request {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08);
}
.lobby-my-game-waiting {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted, #8899aa);
  padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08);
}
.lobby-waiting-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #f39c12;
  animation: lobby-pulse 1.5s ease-in-out infinite;
}
@keyframes lobby-pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }

/* Lobby grid layout */
.lobby-table-wrap { margin-bottom: 16px; }
.lobby-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.lobby-section-head .lobby-section-title { margin-bottom: 0; }
.lobby-rows-per-page {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted, #8899aa);
}
.lobby-rpp-btn {
  padding: 3px 8px; border-radius: 3px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--muted, #8899aa); cursor: pointer; font-size: 11px;
}
.lobby-rpp-btn:hover { background: rgba(255,255,255,.1); }
.lobby-rpp-btn.is-active {
  background: rgba(230,126,34,.15); border-color: rgba(230,126,34,.4);
  color: #e67e22; font-weight: 600;
}

/* Lobby filters */
.lobby-filters {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 10px; flex-wrap: wrap;
}
.lobby-filter-select {
  padding: 5px 8px; border-radius: 4px;
  background: var(--field-bg, #1e2130); border: 1px solid rgba(255,255,255,.15);
  color: inherit; font-size: 12px; cursor: pointer;
  min-width: 110px;
}
.lobby-filter-select:focus { border-color: rgba(230,126,34,.5); outline: none; }
.lobby-filter-clear {
  padding: 5px 10px; border-radius: 4px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--muted, #8899aa); cursor: pointer; font-size: 12px;
}
.lobby-filter-clear:hover { background: rgba(255,255,255,.1); }

.lobby-table-container { }
.lobby-grid { width: 100%; font-size: 13px; }
.lobby-grid-header, .lobby-grid-row {
  display: grid;
  grid-template-columns: 2fr 70px 1fr 90px 70px 110px 100px;
  gap: 0;
  align-items: center;
}
.lobby-grid-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,.45);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.lobby-grid-row {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  transition: background .12s;
}
.lobby-grid-row:hover { background: rgba(255,255,255,.04); }
.lobby-grid-row.lobby-empty {
  display: block;
  text-align: center;
  padding: 32px 16px;
  color: var(--muted, #8899aa);
  font-size: 14px;
}
.lobby-row-own { background: rgba(52,152,219,.06); }
.lobby-col-length { text-align: center; }
.lobby-col-cube { text-align: center; }
.lobby-col-posted { text-align: center; font-size: 11px; color: var(--muted, #8899aa); }
.lobby-col-action { text-align: right; }
.lobby-player-name { display: block; font-weight: 600; font-size: 14px; }
.lobby-player-meta { display: block; font-size: 11px; color: var(--muted, #8899aa); }
.lobby-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  font-size: 12px; font-weight: 600;
}
.lobby-hint-badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  color: #daa520;
  background: rgba(218,165,32,.12);
  border: 1px solid rgba(218,165,32,.25);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 16px;
}

.lobby-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted, #8899aa);
  font-size: 14px;
}

/* Lobby buttons in table */
.lobby-join-btn, .lobby-cancel-btn, .lobby-accept-btn, .lobby-reject-btn,
.lobby-waiting-btn, .lobby-rejected-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.lobby-join-btn {
  background: linear-gradient(180deg, #e67e22, #d35f0f);
  color: #fff;
  border-color: rgba(230,126,34,.5);
}
.lobby-join-btn:hover { background: linear-gradient(180deg, #f09030, #e06818); }
.lobby-join-btn[disabled] { opacity: .5; cursor: default; }
.lobby-cancel-btn {
  background: rgba(255,255,255,.06);
  color: #e74c3c;
  border-color: rgba(231,76,60,.25);
}
.lobby-cancel-btn:hover { background: rgba(231,76,60,.12); }
.lobby-accept-btn {
  background: linear-gradient(180deg, #27ae60, #1e8449);
  color: #fff;
  border-color: rgba(39,174,96,.5);
}
.lobby-accept-btn:hover { background: linear-gradient(180deg, #2ecc71, #27ae60); }
.lobby-reject-btn {
  background: rgba(255,255,255,.06);
  color: var(--muted, #8899aa);
  border-color: rgba(255,255,255,.12);
}
.lobby-reject-btn:hover { background: rgba(255,255,255,.1); }
.lobby-waiting-btn {
  background: rgba(243,156,18,.1);
  color: #f39c12;
  border-color: rgba(243,156,18,.25);
  cursor: default;
}
.lobby-accepted-btn {
  background: linear-gradient(180deg, #27ae60, #1e8449);
  color: #fff;
  border-color: rgba(39,174,96,.5);
  cursor: default;
}
.lobby-rejected-btn {
  background: rgba(231,76,60,.08);
  color: rgba(231,76,60,.6);
  cursor: default;
}

/* Lobby pagination */
.lobby-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}
.lobby-page-btn {
  padding: 5px 12px; border-radius: 4px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: inherit; cursor: pointer; font-size: 12px;
}
.lobby-page-btn:hover { background: rgba(255,255,255,.1); }
.lobby-page-btn[disabled] { opacity: .4; cursor: default; }

/* Lobby footer stats */
.lobby-footer-stats {
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--muted, #8899aa);
}
.lobby-stat-sep { margin: 0 6px; }

/* Lobby mobile */
@media (max-width: 640px) {
  .lobby-grid-header { display: none; }
  .lobby-grid-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
  }
  .lobby-col-player { width: 100%; margin-bottom: 4px; }
  .lobby-col-posted { font-size: 10px; }
  .lobby-col-action { margin-left: auto; margin-top: 4px; }
  .lobby-filters { gap: 6px; }
  .lobby-filter-select { min-width: 90px; font-size: 11px; }
  .lobby-section-head { flex-wrap: wrap; gap: 8px; }
}

/* ============================================================
   LOBBY SIDEBAR AND FOOTER BLOCKS (v62)
   ============================================================ */

/* Lobby page width - matches the standard site container (1024px) */
.lobby-page.site-container {
  max-width: 1024px;
}

/* Two-column grid: sidebar + main */
.lobby-layout {
  display: block;
}
@media (min-width: 900px) {
  .lobby-layout.has-sidebar {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
  }
}

/* Sidebar */
.lobby-sidebar {
  display: none;
}
@media (min-width: 900px) {
  .lobby-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 70px;
  }
}

.sidebar-block {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  overflow: hidden;
}
.sidebar-block-img {
  padding: 12px 16px 0;
}
.sidebar-block-img img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}
.sidebar-block-header {
  padding: 12px 16px 0;
}
.sidebar-block-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #eceef4;
  line-height: 1.3;
}
.sidebar-block-content {
  padding: 10px 16px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted, #c0c8d4);
}
/* When there is no header above, restore full top padding */
.sidebar-block > .sidebar-block-content:first-child {
  padding-top: 14px;
}
.sidebar-block-content h1,
.sidebar-block-content h2,
.sidebar-block-content h3,
.sidebar-block-content h4 {
  color: #eceef4;
  margin: 0 0 8px;
}
.sidebar-block-content h3 { font-size: 15px; }
.sidebar-block-content h4 { font-size: 13px; }
.sidebar-block-content p { margin: 0 0 10px; }
.sidebar-block-content p:last-child { margin-bottom: 0; }
.sidebar-block-content a { color: #6ea8fe; }
.sidebar-block-content a:hover { color: #93c5fd; }
.sidebar-block-content img { max-width: 100%; height: auto; border-radius: 4px; }

/* Footer blocks */
.lobby-footer-blocks {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-block-title {
  margin: 8px 12px 4px;
  font-size: 13px;
  font-weight: 600;
  color: #eceef4;
}
.footer-row {
  display: grid;
  gap: 16px;
}
@media (max-width: 768px) {
  .footer-row {
    grid-template-columns: 1fr !important;
  }
}
.footer-col {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  overflow: hidden;
  min-height: 60px;
}
.footer-block-img img {
  width: 100%;
  height: auto;
  display: block;
}
.footer-block-content {
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted, #c0c8d4);
}
.footer-block-content h1,
.footer-block-content h2,
.footer-block-content h3,
.footer-block-content h4 {
  color: #eceef4;
  margin: 0 0 8px;
}
.footer-block-content a { color: #6ea8fe; }
.footer-block-content a:hover { color: #93c5fd; }
.footer-block-content img { max-width: 100%; height: auto; border-radius: 4px; }

/* Admin blocks panel */
.admin-block-form { margin-bottom: 8px; }
.admin-block-fields { display: flex; flex-direction: column; gap: 10px; }
.admin-block-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-block-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted, #8899aa);
  flex: 1;
  min-width: 140px;
}
.admin-blocks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-block-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  font-size: 13px;
  gap: 8px;
}
.admin-block-item.is-inactive {
  opacity: .5;
}
.admin-block-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.admin-block-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.admin-block-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: .5px;
}
.admin-block-badge-sidebar {
  background: #2563eb;
  color: #fff;
}
.admin-block-badge-footer {
  background: #7c3aed;
  color: #fff;
}
.admin-block-action-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #c0c8d4;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.admin-block-action-btn:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.admin-block-delete:hover {
  background: rgba(239,68,68,.3);
  color: #fca5a5;
}
.admin-block-drag-handle {
  cursor: grab;
  opacity: .35;
  font-size: 14px;
  padding: 0 2px;
  user-select: none;
}
.admin-block-drag-handle:hover {
  opacity: .7;
}
.admin-block-item.is-dragging {
  opacity: .3;
  border-style: dashed;
}
.admin-block-item.drag-over {
  border-color: var(--gold, #e6c87a);
  box-shadow: 0 0 8px rgba(230,200,122,.2);
}

/* ============================================================
   RESULT PAGE (v50)
   ============================================================ */
.result-page {
  max-width: 960px;
  margin: 0 auto;
}
.result-card {
  background: var(--panel-bg, #1e2a3a);
  border-radius: 12px;
  overflow: hidden;
}
.result-header {
  padding: 28px 24px 20px;
  text-align: center;
}

/* Two-column layout (v55) */
.result-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.result-col-left {
  padding: 20px 24px;
  border-right: 1px solid rgba(255,255,255,.06);
}
.result-col-right {
  padding: 4px 0 8px;
}
.result-win { background: linear-gradient(180deg, rgba(39,174,96,.15), rgba(39,174,96,.05)); }
.result-loss { background: linear-gradient(180deg, rgba(231,76,60,.12), rgba(231,76,60,.04)); }
.result-neutral { background: rgba(255,255,255,.04); }
.result-title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
}
.result-win .result-title { color: #2ecc71; }
.result-loss .result-title { color: #e74c3c; }
.result-subtitle {
  margin: 0;
  font-size: 15px;
  color: rgba(255,255,255,.65);
}
.result-hint-bonus {
  display: inline-block;
  font-size: 12px;
  color: #7fd37f;
  margin-left: 4px;
}
.result-hint-penalty {
  display: inline-block;
  font-size: 12px;
  color: #e0a050;
  margin-left: 4px;
}
.result-diff-multi {
  display: inline-block;
  font-size: 12px;
  color: #90b0d0;
  margin-left: 4px;
}
.result-rating-change {
  display: inline-block;
  font-size: 13px;
  margin-top: 2px;
}
.result-rating-up {
  color: #7fd37f;
}
.result-rating-down {
  color: #e07050;
}

.result-players {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}
.result-player { text-align: center; }
.result-player-name { display: block; font-size: 16px; font-weight: 600; }
.result-player-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted, #8899aa); margin-top: 2px;
}
.result-player-winner .result-player-name { color: #f6e5a8; }
.result-vs {
  font-size: 13px; color: rgba(255,255,255,.35);
  font-weight: 600; text-transform: uppercase;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.result-stat {
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
}
.result-stat-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted, #8899aa);
  margin-bottom: 3px;
}
.result-stat-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 20px 24px 24px;
}
.result-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}
.result-btn-primary {
  background: linear-gradient(180deg, #e67e22, #d35f0f);
  border-color: rgba(230,126,34,.5);
  color: #fff;
}
.result-btn-primary:hover { background: linear-gradient(180deg, #f09030, #e06818); }
.result-btn-secondary {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.15);
  color: inherit;
}
.result-btn-secondary:hover { background: rgba(255,255,255,.12); }

/* --- Game Analysis grid (v53, updated v55, tabbed v58) --- */
.result-analysis {
  padding: 0 20px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 4px;
}
.result-col-right > .result-analysis:first-child {
  border-top: none;
  margin-top: 0;
}

/* Analysis tab bar (v58) */
.analysis-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding: 0;
  margin: 0;
}
.analysis-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,.45);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  text-align: center;
}
.analysis-tab:hover {
  color: rgba(255,255,255,.7);
}
.analysis-tab.is-active {
  color: #f6e5a8;
  border-bottom-color: #f6e5a8;
}
.analysis-tab-panel {
  display: none;
  padding: 12px 20px 16px;
}
.analysis-tab-panel.is-active {
  display: block;
}
.analysis-tab-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
}
.analysis-heading {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 10px;
  color: #f6e5a8;
}
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}
.analysis-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted, #8899aa);
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.analysis-label {
  font-size: 13px;
  color: var(--muted, #8899aa);
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.analysis-value {
  font-size: 13px;
  font-weight: 500;
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.analysis-col-you { color: #e8d8a0; }
.analysis-col-opp { color: rgba(255,255,255,.6); }

/* Phase 2: Move quality styles (v54) */
.result-move-quality {
  border-top: 1px solid rgba(255,255,255,.08);
}
.rating-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
}
.rating-world-class { background: #2d7a3a; color: #c8f7d0; }
.rating-expert       { background: #1a6b5a; color: #b0eed8; }
.rating-advanced     { background: #3b6b8c; color: #c0ddf0; }
.rating-intermediate { background: #7a6b2d; color: #f0e4a8; }
.rating-casual       { background: #8c5a2b; color: #f0d0a0; }
.rating-beginner     { background: #7a3030; color: #f0b0b0; }
.blunder-count {
  color: #f08080;
  font-weight: 600;
}
.worst-moves {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.worst-moves-heading {
  font-size: 13px;
  font-weight: 600;
  color: #f6e5a8;
  margin: 0 0 8px;
}
.worst-move-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 3px;
}
.worst-move-blunder {
  background: rgba(240, 80, 80, .08);
  border-left: 3px solid #e05050;
}
.worst-move-inaccuracy {
  background: rgba(220, 180, 60, .06);
  border-left: 3px solid #c0a030;
}
.worst-move-turn {
  color: var(--muted, #8899aa);
  min-width: 50px;
}
.worst-move-dice {
  color: rgba(255,255,255,.5);
  min-width: 30px;
}
.worst-move-desc {
  flex: 1;
  color: rgba(255,255,255,.7);
}
.worst-move-error {
  font-weight: 600;
  white-space: nowrap;
}
.worst-move-blunder .worst-move-error { color: #f08080; }
.worst-move-inaccuracy .worst-move-error { color: #d0b050; }

/* Analyse Game button */
.result-analyse-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.result-btn-analyse {
  background: #3b6b8c;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.result-btn-analyse:hover { background: #4a7fa0; }
.result-btn-analyse:disabled {
  opacity: .6;
  cursor: default;
}
.analyse-hint {
  font-size: 12px;
  color: var(--muted, #8899aa);
}

/* Luck & Skill section (v55) */
.result-luck-skill {
  border-top: 1px solid rgba(255,255,255,.06);
}
.luck-value {
  font-weight: 600;
  font-size: 14px;
}
.luck-positive {
  color: #60c070;
}
.luck-negative {
  color: #e07070;
}
.luck-verdict {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,.8);
  line-height: 1.4;
}

/* Profile analysis averages (v53) */
.profile-analysis-card {
  margin-top: 0;
}
.profile-analysis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.profile-analysis-stat {
  padding: 8px 10px;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  text-align: center;
}
.profile-analysis-stat .stat-value {
  font-size: 16px;
  font-weight: 600;
}
.profile-analysis-stat .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted, #8899aa);
  margin-top: 2px;
}

@media (max-width: 768px) {
  .result-body {
    grid-template-columns: 1fr;
  }
  .result-col-left {
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .result-col-right > .result-analysis:first-child {
    border-top: none;
  }
  .analysis-tab {
    font-size: 12px;
    padding: 10px 6px;
  }
}

@media (max-width: 480px) {
  .result-col-left {
    padding: 16px 16px;
  }
  .result-analysis {
    padding: 0 16px 8px;
  }
  .analysis-grid {
    font-size: 12px;
  }
  .analysis-label, .analysis-value {
    padding: 4px 4px;
    font-size: 12px;
  }
  .worst-move-row {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
  }
  .worst-move-desc {
    flex-basis: 100%;
  }
  .result-analyse-prompt {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 16px;
  }
  .analysis-tab-prompt {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .analysis-tab-panel {
    padding: 10px 12px 14px;
  }
  .luck-verdict {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* === Match score and Next Game (v56) === */
.result-match-score {
  text-align: center;
  padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.match-complete-banner {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent, #f0c040);
  margin-bottom: 10px;
  letter-spacing: .3px;
}
.match-score-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  font-size: 20px;
}
.match-score-player {
  color: var(--muted, #8899aa);
}
.match-score-player strong {
  font-size: 28px;
  margin-left: 6px;
  color: #ccc;
}
.match-score-leading {
  color: #e8e8e8;
}
.match-score-leading strong {
  color: var(--accent, #f0c040);
}
.match-score-divider {
  font-size: 24px;
  color: var(--muted, #8899aa);
  font-weight: 300;
}
.match-score-target {
  font-size: 12px;
  color: var(--muted, #8899aa);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.result-btn-next-game {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 32px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  background: var(--accent, #f0c040);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.result-btn-next-game:hover {
  background: #e0b030;
  transform: translateY(-1px);
}
.result-btn-next-game:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 480px) {
  .match-score-display { font-size: 16px; gap: 8px; }
  .match-score-player strong { font-size: 22px; }
  .result-btn-next-game { padding: 8px 24px; font-size: 14px; }
}

/* --- Guest account upgrade prompt (v61) --- */
.guest-upgrade-box {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 20px auto;
  max-width: 480px;
}
.guest-upgrade-header {
  font-size: 17px;
  color: #e8c547;
  margin-bottom: 8px;
}
.guest-upgrade-text {
  font-size: 14px;
  color: #bbb;
  margin: 0 0 16px;
  line-height: 1.5;
}
.guest-upgrade-row {
  margin-bottom: 10px;
}
.guest-upgrade-row label {
  display: block;
  font-size: 13px;
  color: #999;
  margin-bottom: 3px;
}
.guest-upgrade-row input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 5px;
  color: #eee;
  font-size: 14px;
  box-sizing: border-box;
}
.guest-upgrade-row input:focus {
  outline: none;
  border-color: #e8c547;
}
.guest-upgrade-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.result-btn-upgrade {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.result-btn-upgrade:hover {
  background: #43a047;
}
.result-btn-upgrade:disabled {
  opacity: .6;
  cursor: not-allowed;
}
.guest-upgrade-error {
  color: #ff6b6b;
  font-size: 13px;
}
.guest-upgrade-success p {
  color: #4caf50;
  font-size: 15px;
  font-weight: bold;
  margin: 0;
}
@media (max-width: 640px) {
  .guest-upgrade-box { padding: 16px; }
  .guest-upgrade-actions { flex-direction: column; align-items: flex-start; }
}

/* --- Guest convert button in nav (v61) --- */
.site-nav-convert {
  background: #4caf50;
  color: #fff !important;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: bold;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.site-nav-convert:hover {
  background: #43a047;
}

/* ============================================================
   SOCIAL ICONS IN NAV BAR (v64)
   ============================================================ */
.site-nav-socials {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 6px;
  border-left: 1px solid rgba(255,255,255,.08);
}
.site-nav-social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  color: var(--muted);
  transition: color .15s, background .15s;
  text-decoration: none;
}
.site-nav-social-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.site-nav-social-icon:hover { color: var(--text); background: rgba(255,255,255,.07); }
.site-nav-social-facebook:hover  { color: #1877f2; }
.site-nav-social-instagram:hover { color: #e1306c; }
.site-nav-social-x:hover         { color: #e7e9ea; }
.site-nav-social-youtube:hover   { color: #ff0000; }

/* ============================================================
   HELP PAGE (v64)
   ============================================================ */
.help-page {
  padding-top: 0;
}
.help-layout {
  display: flex;
  gap: 0;
  flex-direction: column;
}
/* Tab nav strip */
.help-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 18px 0 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.help-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  border-radius: 4px 4px 0 0;
}
.help-tab:hover { color: var(--text); }
.help-tab.is-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(230,200,122,.04);
}
/* Panels */
.help-panels {
  padding: 28px 0;
}
.help-panel {
  display: none;
  max-width: 740px;
}
.help-panel.is-active {
  display: block;
}
.help-panel-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.help-panel h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 22px 0 7px;
}
.help-panel h3:first-of-type {
  margin-top: 0;
}
.help-panel p {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  margin: 0 0 12px;
}
.help-panel ul {
  margin: 0 0 14px 0;
  padding-left: 20px;
}
.help-panel li {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 6px;
}
.help-panel strong {
  color: var(--text);
  font-weight: 600;
}
@media (max-width: 640px) {
  .help-tab { padding: 7px 10px; font-size: 12px; }
  .help-panel-title { font-size: 18px; }
}

/* ============================================================
   ACHIEVEMENTS (v66)
   ============================================================ */

/* Summary bar */
.ach-summary {
  display: flex;
  gap: 24px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.ach-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ach-summary-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.ach-summary-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ach-summary-hidden .ach-summary-num { color: var(--muted); }

/* Filter bar */
.ach-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.ach-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ach-filter-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.ach-filter-btn:hover { color: var(--text); border-color: rgba(255,255,255,.25); }
.ach-filter-btn.is-active {
  background: rgba(230,200,122,.15);
  border-color: var(--gold);
  color: var(--gold);
}

/* Achievement grid - brick wall layout */
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

/* Individual achievement card */
.ach-card {
  position: relative;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.ach-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  border-color: rgba(255,255,255,.18);
}

/* Earned state */
.ach-card.is-earned {
  border-color: rgba(230,200,122,.4);
  background: rgba(230,200,122,.06);
}
.ach-card.is-earned:hover { border-color: rgba(230,200,122,.65); }

/* Locked state - greyed out */
.ach-card.is-locked {
  opacity: .5;
  filter: grayscale(.6);
}
.ach-card.is-locked:hover {
  opacity: .75;
  filter: grayscale(.3);
}

/* Earned tick badge */
.ach-card-earned-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: #111;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Icon */
.ach-card-icon {
  font-size: 36px;
  line-height: 1;
  text-align: center;
  padding: 18px 16px 10px;
}
.ach-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
}

/* Card body */
.ach-card-body {
  flex: 1;
  padding: 0 14px 10px;
}
.ach-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.ach-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.55;
}

/* Card footer */
.ach-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 10px;
  gap: 6px;
}
.ach-progress-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.ach-earned-label { color: rgba(230,200,122,.7); }

/* Progress bar */
.ach-progress-bar-wrap {
  height: 3px;
  background: rgba(255,255,255,.08);
}
.ach-progress-bar {
  height: 100%;
  background: var(--gold);
  transition: width .4s;
}

/* Rarity badges */
.ach-rarity-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: .04em;
  white-space: nowrap;
  text-transform: uppercase;
}
.ach-rarity-common    { background: rgba(160,170,190,.15); color: #a0aabe; }
.ach-rarity-uncommon  { background: rgba(80,200,120,.15);  color: #50c878; }
.ach-rarity-rare      { background: rgba(80,140,240,.15);  color: #6496f5; }
.ach-rarity-very-rare { background: rgba(180,80,240,.15);  color: #c460f5; }
.ach-rarity-legendary { background: rgba(230,200,122,.18); color: var(--gold); }

.ach-empty-msg {
  text-align: center;
  padding: 32px;
  opacity: .5;
  font-size: 13px;
}

/* Mobile */
@media (max-width: 640px) {
  .ach-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .ach-card-icon { font-size: 28px; padding: 14px 10px 8px; }
  .ach-summary { gap: 14px; }
  .ach-summary-num { font-size: 20px; }
}

/* ------------------------------------------------------------------ */
/*  Rewards page (v102)                                                */
/* ------------------------------------------------------------------ */

.rewards-page h1 {
  font-size: 22px;
  margin: 0 0 8px;
  color: #eceef4;
}
.rewards-page > p {
  font-size: 13px;
  line-height: 1.6;
  opacity: .65;
  margin: 0 0 18px;
  max-width: 680px;
}
.rewards-page .ach-grid {
  margin-top: 14px;
}
.rewards-page .ach-card {
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.rewards-page .ach-card:hover {
  border-color: rgba(230,200,122,.5);
  box-shadow: 0 0 12px rgba(230,200,122,.12);
}
.rewards-rarity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px;
}
.rewards-footer-links {
  margin: 32px 0 0;
  font-size: 12px;
  opacity: .55;
  line-height: 1.7;
}
.rewards-footer-links a {
  color: var(--gold, #e6c87a);
}

/* Rewards popup overlay */
.rewards-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rewards-popup {
  background: var(--card-bg, #1e2130);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  position: relative;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.rewards-popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.rewards-popup-close:hover { color: rgba(255,255,255,.8); }
.rewards-popup-icon {
  font-size: 42px;
  margin: 0 0 10px;
}
.rewards-popup-icon .ach-icon-img {
  width: 48px;
  height: 48px;
}
.rewards-popup-title {
  font-size: 18px;
  margin: 0 0 10px;
  color: #eceef4;
}
.rewards-popup-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 14px;
}
.rewards-popup-cat {
  font-size: 11px;
  opacity: .5;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.rewards-popup-desc {
  font-size: 13px;
  line-height: 1.6;
  opacity: .75;
  margin: 0 0 12px;
}
.rewards-popup-target {
  font-size: 12px;
  opacity: .5;
  margin: 0;
}

@media (max-width: 640px) {
  .rewards-popup {
    padding: 22px 16px 18px;
    max-width: 340px;
  }
}

/* ------------------------------------------------------------------ */
/*  Scoring page (v96)                                                 */
/* ------------------------------------------------------------------ */

.scoring-page h1 {
  font-size: 22px;
  margin: 0 0 12px;
  color: #eceef4;
}
.scoring-page h2 {
  font-size: 17px;
  margin: 24px 0 8px;
  color: var(--gold, #d4af37);
}
.scoring-page h3 {
  font-size: 14px;
  margin: 18px 0 6px;
  color: #b9c0d1;
}
.scoring-page h4 {
  font-size: 13px;
  margin: 0 0 4px;
  color: #eceef4;
}
.scoring-page p {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,.72);
  margin: 0 0 10px;
}
.scoring-table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
  margin: 10px 0 16px;
  font-size: 13px;
}
.scoring-table th {
  text-align: left;
  padding: 6px 12px;
  background: rgba(255,255,255,.06);
  color: #b9c0d1;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.scoring-table td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.72);
}
.scoring-example {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 8px 0 12px;
}
.scoring-example p {
  margin: 0;
}
.scoring-example strong {
  color: #7fd37f;
}

/* Leaderboard page (v99) */
.leaderboard-page h1 {
  font-size: 22px;
  margin: 0 0 6px;
  color: #eceef4;
}
.leaderboard-page > p {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,.72);
  margin: 0 0 16px;
}
.leaderboard-page a,
.scoring-page a,
.rewards-page a {
  color: var(--gold, #d4af37);
}
.leaderboard-page a:visited,
.scoring-page a:visited,
.rewards-page a:visited {
  color: var(--gold, #d4af37);
}
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.leaderboard-table th {
  text-align: left;
  padding: 8px 12px;
  background: rgba(255,255,255,.06);
  color: #b9c0d1;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.leaderboard-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: rgba(255,255,255,.80);
}
.leaderboard-table .lb-rank {
  width: 50px;
  font-weight: 600;
}
.leaderboard-table .lb-rating {
  font-weight: 600;
  color: #eceef4;
}
.leaderboard-table .lb-winrate {
  text-align: right;
}
.leaderboard-table th.lb-winrate {
  text-align: right;
}
tr.lb-me td {
  background: rgba(212,175,55,.10);
  border-left: 3px solid var(--gold, #d4af37);
}
tr.lb-separator td {
  padding: 0;
  height: 8px;
  border-bottom: 1px dashed rgba(255,255,255,.15);
}
.lb-medal {
  margin-right: 4px;
  font-size: 11px;
}
.lb-gold { color: #ffd700; }
.lb-silver { color: #c0c0c0; }
.lb-bronze { color: #cd7f32; }

/* -----------------------------------------------------------------------
   Tournament bracket and cards (v104)
   ----------------------------------------------------------------------- */
.tournament-card {
  display:block; text-decoration:none; color:inherit;
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);
  border-radius:6px; padding:14px 16px; transition: border-color .2s;
}
.tournament-card:hover { border-color: var(--gold); text-decoration:none; }
.tournament-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.tournament-card-name { font-size:15px; font-weight:600; color:var(--gold); }
.tournament-card-status { font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px; text-transform:uppercase; letter-spacing:.04em; }
.tournament-card-meta { display:flex; flex-wrap:wrap; gap:12px; font-size:12px; opacity:.5; }
.tournament-status-draft { color:#90b0d0; }
.tournament-status-registration { color:#7fd37f; }
.tournament-status-active { color:#f0c040; }
.tournament-status-completed { color:var(--gold); }
.tournament-status-cancelled { color:#f87171; }

.bracket-round { min-width:160px; }
.bracket-round-label {
  font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  opacity:.5; margin-bottom:10px; text-align:center; font-weight:600;
}
.bracket-match {
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.10);
  border-radius:5px; overflow:hidden;
}
.bracket-match-active { border-color: rgba(127,211,127,.4); }
.bracket-match-done { opacity:.7; }
.bracket-player {
  padding:6px 10px; font-size:12px; white-space:nowrap;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.bracket-player:last-child { border-bottom:none; }
.bracket-winner { color:var(--gold); font-weight:600; }
.bracket-vs {
  padding:2px 10px; font-size:9px; text-align:center;
  opacity:.4; text-transform:uppercase; letter-spacing:.06em;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.bracket-match-active .bracket-vs { color:#7fd37f; opacity:.8; }
@media (max-width:600px) {
  .bracket-round { min-width:130px; }
  .bracket-player { font-size:11px; padding:5px 8px; }
}

/* Contact form (v106) */
.contact-form { max-width: 560px; margin-top: 16px; }
.contact-field { margin-bottom: 14px; }
.contact-field label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.contact-field input[type="text"],
.contact-field input[type="email"],
.contact-field select,
.contact-field textarea {
  width: 100%; padding: 9px 12px; font-size: 14px;
  background: rgba(255,255,255,.06); color: #e8e8e8;
  border: 1px solid rgba(255,255,255,.15); border-radius: 4px;
  font-family: inherit;
}
.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(218,165,32,.15);
}
.contact-field select { cursor: pointer; }
.contact-field select option { background: #1e2230; color: #e8e8e8; }
.contact-alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.contact-alert-ok { background: rgba(127,211,127,.12); border: 1px solid rgba(127,211,127,.3); color: #7fd37f; }
.contact-alert-err { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3); color: #f87171; }

/* -----------------------------------------------------------------------
   Mobile responsiveness - non-game pages (v108b)
   ----------------------------------------------------------------------- */

/* Dashboard top-level tabs: wrap instead of overflow */
.dash-tabs { flex-wrap: wrap; }

/* Leaderboard table scroll wrapper */
.leaderboard-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- 768px: tablets and small laptops --- */
@media (max-width: 768px) {
  /* Tighten site container */
  .site-container { padding: 14px 12px; }

  /* Dashboard tabs: smaller on tablet */
  .dash-tab { padding: 8px 14px; font-size: 12px; }

  /* Admin category tabs */
  .admin-cat { padding: 7px 16px; font-size: 12px; }

  /* Form card less padding */
  .form-card { padding: 12px; }

  /* Result actions wrap */
  .result-actions { flex-wrap: wrap; }
  .result-btn { padding: 10px 18px; font-size: 13px; }

  /* Leaderboard: hide tier column, tighten padding */
  .leaderboard-table .lb-tier { display: none; }
  .leaderboard-table th,
  .leaderboard-table td { padding: 7px 8px; font-size: 12px; }
}

/* --- 640px: large phones --- */
@media (max-width: 640px) {
  /* Site container even tighter */
  .site-container { padding: 10px 8px; }

  /* Dashboard tabs: compact */
  .dash-tab { padding: 7px 10px; font-size: 11px; }

  /* Admin category tabs compact */
  .admin-cat { padding: 6px 12px; font-size: 11px; }
  .admin-cat-tabs { gap: 4px; }

  /* Sub-tabs compact */
  .pref-tab { font-size: 11px; padding: 6px 8px; }
  .pref-tabs { gap: 6px; margin: 6px 0 12px; }

  /* Result header tighten */
  .result-title { font-size: 22px; }
  .result-subtitle { font-size: 13px; }
  .result-header { padding: 20px 16px 14px; }
  .result-actions { padding: 14px 16px 18px; gap: 8px; }
  .result-btn { flex: 1; min-width: 0; text-align: center; padding: 10px 12px; font-size: 13px; }

  /* Leaderboard: also hide games detail, show just count */
  .leaderboard-table .lb-games .muted { display: none; }

  /* Tournament cards tighten */
  .tournament-card { padding: 10px 12px; }
  .tournament-card-name { font-size: 14px; }
  .tournament-card-meta { gap: 8px; font-size: 11px; }

  /* Admin tables: smaller font */
  .admin-page .games-table td,
  .admin-page .games-table th { font-size: 10px; padding: 6px 4px; }

  /* Scoring table */
  .scoring-table { font-size: 12px; }
  .scoring-table th,
  .scoring-table td { padding: 5px 8px; }

  /* Profile adjustments */
  .profile-name { font-size: 17px; }

  /* Custom page content */
  .custom-page-content { padding: 0 4px; }
  .custom-page-content h1 { font-size: 20px; }

  /* Contact form full width */
  .contact-form { max-width: none; }
}

/* --- 480px: small phones --- */
@media (max-width: 480px) {
  /* Nav tabs very compact */
  .site-nav-tab { padding: 0 5px; font-size: 11px; height: 32px; }
  .site-nav-brand { font-size: 13px; padding-right: 8px; }
  .site-nav-caret { font-size: 8px; }
  /* Dashboard tabs: even more compact */
  .dash-tab { padding: 6px 8px; font-size: 10px; }
  .dash-tabs { gap: 1px; }

  /* Admin category tabs */
  .admin-cat { padding: 6px 10px; font-size: 10px; border-top-width: 2px; }

  /* Result stats grid single column */
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stat { padding: 8px 10px; }
  .result-stat-value { font-size: 13px; }
  .result-stat-label { font-size: 10px; }

  /* Leaderboard: hide win rate column too */
  .leaderboard-table .lb-winrate { display: none; }
  .leaderboard-table th.lb-winrate { display: none; }

  /* Profile stats cards stack to 1 column */
  .profile-stats-row { grid-template-columns: 1fr; }

  /* Lobby button text */
  .lobby-btn { font-size: 12px; padding: 8px 12px; }
  .lobby-btn-icon { font-size: 14px; }

  /* Lobby grid compact */
  .lobby-col-cube,
  .lobby-col-clock { display: none; }

  /* Modal compact */
  .modal-card { border-radius: 12px; }
  .modal-header { padding: 12px 14px 10px; }
  .modal-body { padding: 10px 14px; }
  .modal-label { font-size: 12px; }
  .toggle-btn { font-size: 11px; padding: 6px 6px; }

  /* Help page tighter */
  .help-panels { padding: 16px 0; }
  .help-panel p,
  .help-panel li { font-size: 12px; }

  /* Rewards grid compact */
  .ach-filter-btn { font-size: 10px; padding: 4px 8px; }
}
