:root {
  color-scheme: light;
  --page-bg: #ede7dc;
  --surface: #ffffff;
  --surface-strong: #f7f3eb;
  --text: #24211c;
  --muted: #6f6a60;
  --accent: #5d8b3f;
  --accent-strong: #466d2e;
  --board-light: #eeeed2;
  --board-dark: #769656;
  --border: rgba(36, 33, 28, 0.14);
  --shadow: 0 18px 45px rgba(35, 29, 18, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.theme-standard,
.theme-classic {
  --page-bg: #ede7dc;
  --surface: #fffaf0;
  --surface-strong: #f4ecd9;
  --accent: #5d8b3f;
  --accent-strong: #466d2e;
  --board-light: #eeeed2;
  --board-dark: #769656;
}

.theme-brown {
  --page-bg: #d8c8ae;
  --surface: #fff8ec;
  --surface-strong: #eadcc4;
  --accent: #6f8f3f;
  --accent-strong: #4f682d;
  --border: rgba(79, 55, 32, 0.2);
  --shadow: 0 18px 45px rgba(74, 50, 24, 0.14);
}

.theme-blue {
  --page-bg: #d7e6ef;
  --surface: #f7fbff;
  --surface-strong: #d8e6f3;
  --text: #172838;
  --muted: #597085;
  --accent: #3f6f8f;
  --accent-strong: #274c77;
  --border: rgba(39, 76, 119, 0.18);
  --shadow: 0 18px 45px rgba(29, 55, 82, 0.14);
}

.theme-contrast {
  --page-bg: #141414;
  --surface: #fbfbfb;
  --surface-strong: #eeeeee;
  --text: #050505;
  --muted: #3b3b3b;
  --accent: #006edb;
  --accent-strong: #004f9e;
  --border: rgba(5, 5, 5, 0.3);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
}

.theme-forest {
  --page-bg: #26351f;
  --surface: #fff7df;
  --surface-strong: #eadfbf;
  --text: #2a2114;
  --muted: #6b5d44;
  --accent: #806d2d;
  --accent-strong: #5b4d1f;
  --border: rgba(73, 55, 22, 0.24);
  --shadow: 0 18px 45px rgba(22, 35, 17, 0.22);
}

.theme-ocean {
  --page-bg: #101820;
  --surface: #f4fbff;
  --surface-strong: #dcecf2;
  --text: #10212b;
  --muted: #4a6170;
  --accent: #168aad;
  --accent-strong: #0b617a;
  --border: rgba(13, 50, 63, 0.2);
  --shadow: 0 18px 45px rgba(4, 15, 22, 0.24);
}

.theme-rose {
  --page-bg: #19152a;
  --surface: #fff9f2;
  --surface-strong: #f1e9ff;
  --text: #231c35;
  --muted: #655a78;
  --accent: #d94f88;
  --accent-strong: #9c2f62;
  --border: rgba(50, 31, 71, 0.2);
  --shadow: 0 18px 45px rgba(19, 11, 34, 0.25);
}

.theme-slate {
  --page-bg: #0f1419;
  --surface: #f7f4ee;
  --surface-strong: #e2ded6;
  --text: #17202a;
  --muted: #59616b;
  --accent: #b88935;
  --accent-strong: #7c5a21;
  --border: rgba(23, 32, 42, 0.22);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.theme-mint {
  --page-bg: #dfeee5;
  --surface: #fbfff9;
  --surface-strong: #e4f4eb;
  --text: #173226;
  --muted: #587164;
  --accent: #3f7f66;
  --accent-strong: #285b48;
  --border: rgba(40, 91, 72, 0.2);
  --shadow: 0 18px 45px rgba(25, 69, 49, 0.14);
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  padding: 0 1rem;
  background: #312e2b;
  color: #fff;
}

.brand {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 750;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links a,
.nav-links button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font: inherit;
  padding: 0.45rem 0.65rem;
  text-decoration: none;
}

.nav-links a.active,
.nav-links button.active,
.nav-links a:hover,
.nav-links button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-links form {
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.dashboard-header {
  display: grid;
  grid-column: 1 / -1;
  gap: 1rem;
}

.dashboard-header h1 {
  margin-bottom: 0.25rem;
}

.dashboard-alerts {
  display: grid;
  grid-column: 1 / -1;
  gap: 0.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.player-panel {
  display: grid;
  grid-column: span 4;
  gap: 0.85rem;
  align-content: space-between;
  color: var(--text);
  text-decoration: none;
}

.profile-link-panel:hover {
  border-color: rgba(93, 139, 63, 0.45);
  background: var(--surface-strong);
  color: var(--text);
  text-decoration: none;
}

.profile-link-panel h1 {
  margin-bottom: 0.2rem;
}

.profile-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.profile-summary-row > span:not(.rating-pill) {
  color: var(--muted);
  font-weight: 800;
}

.profile-edit-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-strong);
  font-weight: 900;
}

.dashboard-section-heading {
  margin-bottom: 0.85rem;
}

.dashboard-pill-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.4rem;
}

.action-panel {
  display: flex;
  grid-column: span 8;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.challenge-panel {
  grid-column: span 8;
}

.board-panel {
  grid-column: span 5;
}

.list-panel {
  grid-column: span 7;
}

.dashboard-half-card {
  grid-column: span 6;
}

.list-panel h2,
.challenge-panel h2,
.board-panel h2 {
  margin-bottom: 0;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.35rem;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
}

.rating-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 800;
  padding: 0 0.9rem;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 1rem;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action:hover {
  color: #fff;
  text-decoration: none;
}

.full-width {
  width: 100%;
}

.auth-screen {
  --page-bg: #312e2b;
}

.auth-screen .app-nav {
  background: rgba(20, 18, 16, 0.92);
}

.auth-screen .app-shell {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
}

.auth-layout {
  width: min(100%, 420px);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.auth-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--board-dark);
  padding: 0.35rem;
}

.auth-brand h1 {
  margin-bottom: 0;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.stack-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--text);
  font-weight: 750;
}

.stack-form input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 0.8rem;
}

.challenge-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.favorite-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}

.favorite-card {
  display: grid;
  gap: 0.2rem;
  min-height: 96px;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0.75rem;
  text-decoration: none;
}

.favorite-card:hover {
  border-color: rgba(93, 139, 63, 0.45);
}

.favorite-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.compact-empty {
  min-height: 96px;
}

.compact-empty a {
  color: var(--accent-strong);
  font-weight: 800;
}

.challenge-form label {
  display: grid;
  gap: 0.35rem;
  font-weight: 750;
}

.challenge-form select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 0.8rem;
}

.challenge-form .check-row,
.challenge-form .primary-action {
  align-self: end;
}

.stack-list {
  display: grid;
  gap: 0.65rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.58rem 0.65rem;
  text-decoration: none;
}

.list-row-main {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}

.list-row strong,
.list-row span {
  display: block;
}

.list-row span {
  color: var(--muted);
}

.link-row:hover {
  border-color: rgba(93, 139, 63, 0.45);
  background: var(--surface-strong);
}

.dashboard-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-width: 0;
}

.dashboard-row-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  padding: 0 0.5rem;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.4rem;
}

.row-actions form,
.list-row form {
  margin: 0;
}

.small-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  padding: 0 0.75rem;
  text-align: center;
  text-decoration: none;
}

.small-action:hover {
  color: var(--text);
  text-decoration: none;
}

.accept-pill {
  border-color: rgba(93, 139, 63, 0.46);
  background: #eef7e8;
  color: var(--accent-strong);
}

.small-action.accept {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.small-action.danger {
  border-color: transparent;
  background: #b42318;
  color: #fff;
}

.stack-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(93, 139, 63, 0.18);
  outline: none;
}

.form-alert {
  border-radius: 6px;
  background: #f8d7da;
  color: #842029;
  margin-bottom: 0.85rem;
  padding: 0.75rem;
}

.dashboard-alerts .form-alert {
  margin-bottom: 0;
}

.success-alert {
  background: #eef7e8;
  color: var(--accent-strong);
}

.game-result-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  border: 1px solid rgba(93, 139, 63, 0.34);
  border-radius: 6px;
  background: #eef7e8;
  color: var(--accent-strong);
  font-weight: 900;
  padding: 0.75rem;
}

.rating-change-panel {
  grid-column: 1 / -1;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-actions form {
  margin: 0;
}

.rating-change-list {
  display: grid;
  gap: 0.45rem;
}

.playback-rating-changes {
  margin-top: 0.35rem;
}

.playback-rating-heading {
  margin-top: 0.8rem;
}

.rating-change-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  padding: 0.5rem 0.6rem;
}

.rating-change-row strong,
.rating-change-row span {
  min-width: 0;
}

.rating-delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 30px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.rating-delta.positive {
  background: #eef7e8;
  color: var(--accent-strong);
}

.rating-delta.negative {
  background: rgba(180, 35, 24, 0.1);
  color: #8a1f17;
}

.auth-switch {
  color: var(--muted);
  margin: 1rem 0 0;
  text-align: center;
}

.auth-switch a {
  color: var(--accent-strong);
  font-weight: 800;
}

.theme-board-preview {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(100%, 420px);
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 4px solid var(--board-border, #312e2b);
  background: var(--board-dark);
}

.theme-board-preview.small {
  width: 104px;
  border-width: 2px;
}

.theme-board-preview span {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
}

.theme-board-preview img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.24));
}

.board-theme-standard {
  --board-light: #fff;
  --board-dark: #aaa;
  --board-border: #666;
}

.board-theme-brown {
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --board-border: #6f4e37;
}

.board-theme-blue {
  --board-light: #dbeafe;
  --board-dark: #4f7cac;
  --board-border: #274c77;
}

.board-theme-contrast {
  --board-light: #f8f8f8;
  --board-dark: #1b1b1b;
  --board-border: #000;
}

.board-theme-forest {
  --board-light: #d7e7c7;
  --board-dark: #4f7d46;
  --board-border: #2e4a2a;
}

.board-theme-ocean {
  --board-light: #c9e7ea;
  --board-dark: #2f6f8f;
  --board-border: #1c465d;
}

.board-theme-rose {
  --board-light: #f1d3d5;
  --board-dark: #9f5d63;
  --board-border: #6f3d43;
}

.board-theme-slate {
  --board-light: #d7dde2;
  --board-dark: #63717d;
  --board-border: #34414c;
}

.board-theme-mint {
  --board-light: #e4f1de;
  --board-dark: #62a07b;
  --board-border: #2f5f48;
}

.square-light {
  background: var(--board-light);
}

.square-dark {
  background: var(--board-dark);
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
}

.notification-switch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-width: min(100%, 260px);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  cursor: pointer;
  padding: 0.45rem 0.55rem 0.45rem 0.9rem;
}

.notification-switch-copy {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.notification-switch-copy strong {
  line-height: 1.05;
}

.notification-switch-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.notification-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notification-switch-track {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: #b9b3a8;
  transition: background 160ms ease;
}

.notification-switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease;
}

.notification-switch input:checked + .notification-switch-track {
  background: var(--accent);
}

.notification-switch input:checked + .notification-switch-track::after {
  transform: translateX(22px);
}

.notification-switch.disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.profile-layout {
  display: grid;
  gap: 1rem;
}

.profile-header h1 {
  margin-bottom: 0.25rem;
}

.profile-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.admin-layout {
  display: grid;
  gap: 1rem;
}

.admin-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.admin-hero h1 {
  margin-bottom: 0.25rem;
}

.admin-settings-card {
  align-self: start;
}

.admin-users-panel {
  display: grid;
  gap: 0.85rem;
}

.status-metric-list {
  display: grid;
  gap: 0.5rem;
}

.status-metric-list span,
.status-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 0.55rem 0.65rem;
}

.status-metric-list strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status-files-panel {
  grid-column: 1 / -1;
}

.status-file-list {
  display: grid;
  gap: 0.6rem;
}

.status-file-row > div:first-child {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.status-file-row span {
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 0.6rem !important;
}

.check-row input {
  width: 22px;
  min-height: 22px;
}

.user-list {
  display: grid;
  gap: 0.65rem;
}

.user-row {
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0.75rem;
}

.user-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.user-identity {
  min-width: 0;
}

.user-row strong,
.user-row span {
  display: block;
}

.user-row span {
  color: var(--muted);
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.35rem;
}

.user-meta span {
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.community-layout {
  display: grid;
  gap: 1rem;
}

.community-header {
  display: grid;
  gap: 1rem;
}

.community-landing {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
}

.community-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.community-kpis span {
  display: grid;
  min-height: 76px;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0.7rem;
}

.community-kpis strong {
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1;
}

.community-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.community-hub-link {
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}

.community-hub-link:hover {
  border-color: rgba(93, 139, 63, 0.45);
  transform: translateY(-1px);
}

.community-hub-link strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.community-hub-link span {
  color: var(--muted);
  line-height: 1.45;
}

.community-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.community-subnav a {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 850;
  padding: 0.55rem 0.85rem;
  text-decoration: none;
}

.community-subnav a:hover {
  border-color: rgba(93, 139, 63, 0.45);
  background: var(--surface-strong);
}

.community-subnav a.active {
  border-color: rgba(93, 139, 63, 0.55);
  background: #eef7e8;
  color: var(--accent-strong);
}

.community-section {
  display: grid;
  gap: 1rem;
}

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.section-heading-row h2 {
  margin: 0;
}

.community-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
}

.community-search input,
.community-search select,
.community-challenge select {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 0.75rem;
}

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

.community-game-search {
  grid-template-columns: minmax(180px, 1fr) minmax(140px, auto) auto;
}

.community-game-list {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.community-card {
  display: grid;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.community-card.favorite {
  border-color: rgba(93, 139, 63, 0.55);
}

.community-card-main {
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

.community-card-main h2 {
  margin-bottom: 0.1rem;
}

.community-card-main h2 a {
  color: inherit;
  text-decoration: none;
}

.community-card-main h2 a:hover {
  text-decoration: underline;
}

.rating-policy span {
  min-width: 96px;
}

.leaderboard-panel {
  padding: 0;
  overflow: hidden;
}

.leaderboard-table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.leaderboard-table th,
.leaderboard-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0.95rem;
  text-align: left;
  vertical-align: middle;
}

.leaderboard-table th {
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.leaderboard-table tr:last-child td {
  border-bottom: 0;
}

.leaderboard-table tr.current-user {
  background: rgba(93, 139, 63, 0.09);
}

.rank-cell {
  width: 72px;
  color: var(--muted);
  font-weight: 900;
}

.rating-cell {
  width: 110px;
  color: var(--accent-strong);
  font-size: 1.05rem;
  font-weight: 950;
  text-align: right;
}

.leaderboard-player {
  display: grid;
  gap: 0.12rem;
  color: inherit;
  text-decoration: none;
}

.leaderboard-player:hover strong {
  text-decoration: underline;
}

.leaderboard-player span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.game-result-line {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.25;
  margin: 0.2rem 0 0;
}

.community-game-players {
  display: grid;
  gap: 0.45rem;
}

.community-game-players span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 0.55rem 0.65rem;
}

.community-game-players strong {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.tournament-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tournament-card {
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.tournament-feature-card,
.tournament-wide-card {
  grid-column: 1 / -1;
}

.tournament-card h2 {
  margin: 0;
}

.tournament-steps {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.25rem;
}

.tournament-steps li {
  line-height: 1.4;
}

.tournament-standings {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tournament-game-list,
.tournament-results {
  display: grid;
  gap: 0.55rem;
}

.tournament-game-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  color: inherit;
  padding: 0.7rem 0.8rem;
  text-decoration: none;
}

.tournament-game-row:hover {
  border-color: rgba(93, 139, 63, 0.45);
  background: var(--surface);
}

.tournament-game-row span {
  min-width: 0;
  color: var(--muted);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tournament-pairing-list {
  gap: 0.65rem;
}

.tournament-round-group {
  display: grid;
  gap: 0.45rem;
}

.tournament-round-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 82%, var(--accent) 18%);
  color: var(--text);
  padding: 0.55rem 0.75rem;
}

.tournament-round-heading strong {
  color: var(--accent-strong);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tournament-round-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.tournament-pairing-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.tournament-pairing-row form {
  margin: 0;
}

.tournament-pairing-row .dashboard-pill-actions {
  justify-content: flex-end;
  margin: 0;
}

.tournament-pairing-row .game-pill {
  white-space: nowrap;
}

.guide-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.45rem;
}

.guide-toc strong {
  margin-bottom: 0.35rem;
}

.guide-toc a {
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.guide-toc a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.guide-content {
  display: grid;
  gap: 1rem;
}

.guide-section {
  scroll-margin-top: 1rem;
}

.guide-section h2 {
  margin-bottom: 0.65rem;
}

.guide-section h3 {
  margin-top: 1rem;
}

.guide-section p,
.guide-section li,
.guide-terms dd {
  line-height: 1.55;
}

.guide-piece-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.guide-piece-list article {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 0.8rem;
}

.guide-piece-list h3 {
  margin-top: 0;
}

.guide-terms {
  display: grid;
  grid-template-columns: minmax(110px, 180px) minmax(0, 1fr);
  gap: 0.55rem 1rem;
}

.guide-terms dt {
  font-weight: 900;
}

.guide-terms dd {
  margin: 0;
}

.star-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.star-button.active {
  color: #946200;
}

.community-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.community-stats span {
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
}

.community-challenge {
  display: grid;
  gap: 0.55rem;
}

.compact-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  font-weight: 750;
}

.compact-check input {
  width: 20px;
  height: 20px;
}

.admin-search {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  min-width: min(100%, 420px);
}

.admin-user-actions {
  justify-self: end;
  min-width: min(100%, 180px);
}

.admin-user-actions summary {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
  padding: 0 0.8rem;
}

.admin-user-actions summary::-webkit-details-marker {
  display: none;
}

.admin-user-actions[open] {
  justify-self: stretch;
}

.admin-user-actions[open] summary {
  justify-self: end;
  min-width: 180px;
}

.admin-user-action-panel {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.65rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.admin-reset-form {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: center;
}

.admin-delete-form {
  justify-items: end;
}

.mini-form {
  display: grid;
  gap: 0.45rem;
}

.mini-form input {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  padding: 0 0.65rem;
}

.detail-challenge {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tournament-participant-picker {
  display: grid;
  gap: 0.5rem;
  max-height: 460px;
  overflow: auto;
  padding-right: 0.15rem;
}

.tournament-participant-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 0.65rem;
}

.tournament-participant-option span {
  display: grid;
  min-width: 0;
}

.tournament-participant-option small {
  color: var(--muted);
  font-weight: 750;
}

.stack-form textarea,
.stack-form select {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0.65rem 0.75rem;
}

.game-screen .app-nav {
  display: none;
}

.game-screen {
  height: 100svh;
  overflow: hidden;
}

.game-screen .app-shell {
  width: 100%;
  height: 100svh;
  overflow: hidden;
  padding: max(0.5rem, env(safe-area-inset-top)) max(clamp(0.45rem, 1.2vw, 0.85rem), env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(clamp(0.45rem, 1.2vw, 0.85rem), env(safe-area-inset-left));
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "board side";
  gap: clamp(0.55rem, 1.2vw, 0.85rem);
  align-items: stretch;
  width: min(100%, 1300px);
  height: calc(100svh - 1rem);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
}

.playback-layout {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.5rem;
  width: min(100%, 1180px);
  height: calc(100svh - 6rem);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
}

.playback-layout .game-topbar,
.playback-layout .playback-summary {
  grid-column: 1 / -1;
}

.playback-stage {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "controls controls"
    "board history";
  gap: 0.5rem;
  min-height: 0;
  overflow: hidden;
}

.playback-bar {
  grid-area: controls;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
}

.playback-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.playback-play {
  min-width: 96px;
}

.playback-speed {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 850;
  padding: 0 0.45rem 0 0.75rem;
}

.playback-speed span {
  color: var(--muted);
  font-size: 0.78rem;
}

.playback-speed select {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  font-weight: 900;
  padding: 0 0.5rem;
}

.playback-emotes {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 0.75rem;
}

.playback-clock-note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.playback-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
}

.playback-summary h1 {
  font-size: clamp(1.85rem, 3.3vw, 2.8rem);
  line-height: 1.05;
  margin: 0;
}

.playback-summary .eyebrow {
  margin-bottom: 0.25rem;
}

.playback-outcome {
  display: grid;
  gap: 0.18rem;
  justify-items: end;
  min-width: min(360px, 42vw);
  text-align: right;
}

.playback-outcome strong {
  color: var(--text);
  font-weight: 950;
}

.playback-outcome span {
  color: var(--muted);
  font-weight: 650;
}

.playback-summary .playback-rating-heading,
.playback-summary .playback-rating-changes {
  grid-column: 1 / -1;
}

.playback-board-shell {
  grid-area: board;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.playback-stage .playback-side {
  grid-area: history;
}

.playback-board-shell .player-clock {
  width: min(100%, 720px);
}

.playback-board-shell .board-stage {
  width: 100%;
  height: 100%;
}

.playback-review-head,
.playback-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.playback-review-head {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  padding: 0 0.65rem;
}

.playback-review-head .eyebrow,
.playback-section-title .eyebrow {
  margin: 0;
}

.playback-review-head span,
.playback-section-title span {
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-width: 1.65rem;
  padding: 0.12rem 0.45rem;
  text-align: center;
}

.playback-position-card {
  margin-top: 0.55rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.playback-position-card h2 {
  margin: 0.1rem 0 0.2rem;
  font-size: 1.35rem;
  line-height: 1.1;
}

.playback-moves-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  margin-top: 0.65rem;
  min-height: 0;
}

.game-layout > .game-topbar {
  grid-area: topbar;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  min-height: 42px;
  overflow: hidden;
}

.game-topbar-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.4rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.game-topbar-meta {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 0.4rem;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.game-topbar-left::-webkit-scrollbar,
.game-topbar-meta::-webkit-scrollbar {
  display: none;
}

.game-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 800;
  line-height: 1;
  padding: 0 0.84rem;
  text-decoration: none;
  white-space: nowrap;
}

.game-pill-link:hover {
  border-color: rgba(93, 139, 63, 0.45);
  background: var(--surface-strong);
  color: var(--text);
}

.game-pill-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.public-copy-pill {
  cursor: pointer;
}

.public-copy-pill.copied {
  border-color: rgba(93, 139, 63, 0.55);
  background: #eef7e8;
  color: var(--accent-strong);
}

.danger-pill {
  border-color: rgba(180, 35, 24, 0.34);
  background: rgba(180, 35, 24, 0.1);
  color: #8a1f17;
}

.danger-pill:active,
.danger-pill:hover {
  background: #b42318;
  color: #fff;
}

.moves-pill.active {
  border-color: rgba(93, 139, 63, 0.55);
  background: #eef7e8;
  color: var(--accent-strong);
}

.moves-pill {
  display: none;
}

.flip-pill {
  gap: 0.35rem;
}

.flip-pill.active {
  border-color: rgba(93, 139, 63, 0.55);
  background: #eef7e8;
  color: var(--accent-strong);
}

.your-turn-pill {
  border-color: rgba(93, 139, 63, 0.55);
  background: #eef7e8;
  color: var(--accent-strong);
}

.game-board-shell {
  grid-area: board;
  position: relative;
  display: grid;
  grid-template-rows: minmax(44px, auto) minmax(0, 1fr) minmax(44px, auto);
  gap: clamp(0.45rem, 1vw, 0.65rem);
  justify-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.board-stage {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-strong) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding: clamp(0.18rem, 0.8vw, 0.55rem);
  container-type: size;
  touch-action: none;
}

.play-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(100%, calc(100svh - 190px), 720px);
  min-width: min(280px, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  border: 4px solid var(--board-border, #312e2b);
  border-radius: 6px;
  box-shadow: 0 14px 34px rgba(20, 20, 20, 0.12);
}

@supports (width: 100cqw) {
  .play-board {
    width: min(100cqw, 100cqh, 720px);
    min-width: 0;
  }
}

.play-board.readonly {
  cursor: default;
}

.game-board-shell.board-flipped .play-board {
  transform: rotate(180deg);
}

.game-board-shell.board-flipped .board-square,
.game-board-shell.board-flipped .board-square-link {
  transform: rotate(180deg);
}

.mobile-playback-player.board-flipped .play-board {
  transform: rotate(180deg);
}

.mobile-playback-player.board-flipped .board-square,
.mobile-playback-player.board-flipped .board-square-link {
  transform: rotate(180deg);
}

.board-square,
.board-square-link,
.board-square-form {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  touch-action: manipulation;
  user-select: none;
}

.board-square,
.board-square-link {
  border: 0;
  border-radius: 0;
  color: inherit;
  padding: 0;
  text-decoration: none;
}

.board-square {
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: pointer;
}

.board-square-form {
  margin: 0;
}

.board-square-link.selected,
.board-square.selected {
  box-shadow: inset 0 0 0 4px rgba(255, 214, 10, 0.8);
}

.board-square-link.last-move,
.board-square.last-move {
  box-shadow: inset 0 0 0 4px rgba(255, 214, 10, 0.46);
}

.board-square-link.in-check,
.board-square.in-check {
  background: radial-gradient(circle at center, rgba(218, 41, 28, 0.72), rgba(218, 41, 28, 0.34) 58%, transparent 72%);
  box-shadow: inset 0 0 0 4px rgba(176, 0, 0, 0.85);
}

.board-square-link.in-check img,
.board-square.in-check img {
  animation: king-check-shake 0.48s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
  transform-origin: center bottom;
}

@keyframes king-check-shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-4deg);
  }
  75% {
    transform: rotate(4deg);
  }
}

.selectable-piece {
  cursor: pointer;
}

.selectable-piece::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  pointer-events: none;
}

.selectable-piece:active::after,
.selectable-piece:hover::after {
  border-color: rgba(255, 214, 10, 0.9);
}

.board-square:focus-visible,
.board-square-link:focus-visible,
.promotion-option:focus-visible,
.emote-option:focus-visible {
  outline: 3px solid rgba(255, 214, 10, 0.95);
  outline-offset: -3px;
}

.board-square img,
.board-square-link img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
}

.move-dot {
  position: absolute;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(40, 84, 38, 0.45);
}

.legal-destination:has(img) .move-dot {
  width: 78%;
  border: 4px solid rgba(40, 84, 38, 0.45);
  background: transparent;
}

.capture-destination .move-dot {
  width: 78%;
  border: 4px solid rgba(176, 0, 0, 0.58);
  background: transparent;
}

.promotion-destination {
  z-index: 8;
}

.promotion-trigger {
  cursor: pointer;
}

.promotion-form {
  margin: 0;
  min-width: 0;
}

.promotion-modal-content {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.promotion-modal .modal-title {
  font-size: 1.05rem;
  font-weight: 900;
}

.promotion-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.promotion-option {
  display: grid;
  width: 100%;
  min-height: 112px;
  place-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
  padding: 0.6rem;
}

.promotion-option:active,
.promotion-option:hover {
  border-color: rgba(93, 139, 63, 0.72);
  background: #eef7e8;
}

.board-square-form.submitting,
.promotion-form.submitting {
  opacity: 0.72;
  pointer-events: none;
}

.board-square-form.submitting button,
.promotion-form.submitting button {
  cursor: wait;
}

.promotion-option img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  pointer-events: none;
}

.rank-label,
.file-label {
  position: absolute;
  display: grid;
  width: clamp(11px, 2.2cqw, 14px);
  height: clamp(11px, 2.2cqw, 14px);
  place-items: center;
  color: rgba(0, 0, 0, 0.62);
  font-size: clamp(0.54rem, 1.8cqw, 0.68rem);
  font-weight: 850;
  line-height: 1;
}

.rank-label {
  top: 4px;
  right: 4px;
}

.file-label {
  top: 4px;
  left: 4px;
}

.player-clock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 0.5rem;
  align-items: center;
  width: min(100%, 760px);
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(20, 20, 20, 0.06);
  padding: 0.35rem 0.45rem 0.35rem 0.65rem;
  overflow: hidden;
}

.player-clock.active {
  border-color: rgba(93, 139, 63, 0.55);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  box-shadow: 0 10px 28px rgba(93, 139, 63, 0.12);
}

.player-clock.active .player-label::after {
  content: "To move";
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  padding: 0 0.42rem;
  text-transform: uppercase;
  vertical-align: 0.08rem;
}

.player-clock.inactive {
  opacity: 0.86;
}

.player-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-label span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 850;
}

.player-clock-copy {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 0.18rem;
  min-height: 18px;
  overflow: hidden;
  max-width: 100%;
}

.captured-piece {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  flex: 0 0 auto;
}

.captured-piece img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.captured-piece span {
  position: absolute;
  right: -0.35rem;
  bottom: -0.18rem;
  display: grid;
  min-width: 0.8rem;
  height: 0.8rem;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
}

.captured-empty {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.clock-actions {
  order: 2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 0.5rem;
}

.player-bar-spacer {
  order: 2;
  width: 34px;
  height: 34px;
  justify-self: end;
}

.clock-pill {
  order: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 36px;
  border-radius: 7px;
  background: #2f3437;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1;
  padding: 0 0.65rem;
  white-space: nowrap;
}

.emote-toggle {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.queued-emote-icon {
  display: grid;
  min-width: 1.25rem;
  place-items: center;
  font-size: 1.2rem;
  line-height: 1;
}

.emote-modal-content {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.emote-modal .modal-title {
  font-size: 1.05rem;
  font-weight: 900;
}

.emote-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  border-radius: 8px;
}

.emote-grid button {
  display: grid;
  width: 100%;
  min-height: 56px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  cursor: pointer;
  font-size: 1.6rem;
  padding: 0;
}

.emote-grid button.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(93, 139, 63, 0.25);
}

.screen-emote {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  pointer-events: none;
  place-items: center;
}

.screen-emote.active {
  display: grid;
}

.screen-emote span {
  display: grid;
  width: min(32vw, 180px);
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(15, 20, 25, 0.72);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  font-size: clamp(4rem, 16vw, 7rem);
}

.screen-emote.active span {
  animation: emote-pop 2s ease forwards;
}

@keyframes emote-pop {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  12%,
  72% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.game-side {
  grid-area: side;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  align-content: stretch;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 0.6rem;
  box-shadow: 0 14px 36px rgba(20, 20, 20, 0.08);
}

.playback-side {
  align-self: stretch;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  height: 100%;
  overflow: auto;
}

.playback-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  min-width: min(360px, 100%);
}

.playback-controls .game-pill {
  padding: 0 0.45rem;
}

.playback-progress {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.playback-progress progress {
  width: 100%;
  height: 0.45rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-strong);
}

.playback-progress progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--surface-strong);
}

.playback-progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.playback-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.playback-progress span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.game-side-section {
  min-height: 0;
}

.move-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding-top: 0;
}

.move-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  cursor: pointer;
  list-style: none;
  padding: 0 0.65rem;
}

.move-drawer summary::-webkit-details-marker {
  display: none;
}

.move-drawer summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
}

.move-drawer[open] summary {
  margin-bottom: 0.5rem;
}

.move-drawer[open] summary::after {
  content: "-";
}

.move-drawer .eyebrow {
  margin: 0;
}

.move-count {
  margin-left: auto;
  margin-right: 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-width: 1.65rem;
  padding: 0.12rem 0.45rem;
  text-align: center;
}

.move-table-wrap {
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.move-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.92rem;
}

.move-table th,
.move-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.32rem 0.45rem;
  vertical-align: middle;
}

.move-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
}

.move-table th:first-child,
.move-table td:first-child {
  width: 2.2rem;
}

.move-table th:nth-child(2),
.move-table td:nth-child(2) {
  width: 3.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.move-table tbody tr:last-child th,
.move-table tbody tr:last-child td {
  border-bottom: 0;
}

.move-table tbody tr:nth-child(even) {
  background: var(--surface-strong);
}

.playback-move-list a {
  color: inherit;
  text-decoration: none;
}

.playback-move-list a:hover {
  text-decoration: underline;
}

.playback-move-list {
  display: grid;
  gap: 0.28rem;
  min-height: 0;
  margin: 0;
  overflow: auto;
  padding: 0 0.1rem 0 0;
}

.playback-move-list li {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0 0.45rem;
  align-items: baseline;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.32rem 0.42rem;
}

.current-playback-move {
  border-color: rgba(93, 139, 63, 0.55);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent-strong);
}

.move-number,
.move-uci {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.move-san {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-uci {
  grid-column: 2;
}

.mobile-playback-test {
  display: grid;
  gap: 0.65rem;
  width: min(100%, 760px);
  margin: 0 auto;
}

.mobile-playback-test-screen .app-nav {
  display: none;
}

.mobile-playback-test-screen .app-shell {
  padding-top: 0.65rem;
}

.mobile-playback-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.mobile-playback-stage {
  display: grid;
  gap: 0.65rem;
}

.mobile-playback-player {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.mobile-playback-clock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(20, 20, 20, 0.06);
  padding: 0.35rem 0.55rem;
}

.mobile-playback-clock .playback-clock-note {
  grid-column: auto;
  justify-self: end;
  margin-top: 0;
  white-space: nowrap;
}

.mobile-playback-clock strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-playback-clock strong span {
  color: var(--muted);
  font-size: 0.82rem;
}

.mobile-playback-board-frame {
  position: relative;
  display: grid;
  justify-items: center;
  min-width: 0;
  border-radius: 8px;
}

.mobile-playback-board-frame .play-board {
  width: min(100%, 92vw, 620px);
  min-width: min(280px, 100%);
}

.mobile-playback-controls {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
}

.mobile-playback-primary,
.mobile-playback-transport {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mobile-playback-transport {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-playback-primary .game-pill,
.mobile-playback-primary .playback-speed,
.mobile-playback-primary .playback-emotes,
.mobile-playback-transport .game-pill {
  width: 100%;
}

.mobile-playback-primary .playback-speed,
.mobile-playback-primary .playback-emotes {
  justify-content: center;
}

.mobile-playback-info {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
}

.mobile-playback-info h1 {
  margin: 0;
  font-size: clamp(1.6rem, 8vw, 2.25rem);
  line-height: 1.05;
}

.mobile-playback-info > strong {
  font-weight: 950;
}

.mobile-playback-info > span {
  color: var(--muted);
  font-weight: 750;
}

.mobile-current-move {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}

.mobile-current-move span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mobile-current-move strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-current-move code {
  color: var(--muted);
  font-size: 0.82rem;
}

.mobile-playback-moves {
  padding: 0.55rem;
}

.mobile-playback-moves summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.mobile-playback-moves summary::-webkit-details-marker {
  display: none;
}

.mobile-playback-moves summary span:last-child {
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  min-width: 1.65rem;
  padding: 0.12rem 0.45rem;
  text-align: center;
}

.mobile-playback-moves .playback-move-list {
  max-height: 44vh;
  margin-top: 0.55rem;
}

@media (min-width: 900px) {
  .mobile-playback-test-screen .app-shell {
    width: 100%;
    height: 100svh;
    overflow: hidden;
    padding: 0.65rem clamp(0.75rem, 1.4vw, 1rem);
  }

  .mobile-playback-test {
    width: min(100%, 1180px);
    height: calc(100svh - 1.3rem);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .mobile-playback-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "player controls"
      "player info"
      "player moves";
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-playback-player {
    grid-area: player;
    align-self: stretch;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
  }

  .mobile-playback-board-frame {
    align-content: center;
    height: 100%;
    min-height: 0;
  }

  .mobile-playback-board-frame .play-board {
    width: min(100%, 72svh, 720px);
  }

  .mobile-playback-clock {
    width: min(100%, 720px);
    justify-self: center;
  }

  .mobile-playback-controls {
    grid-area: controls;
    align-self: start;
  }

  .mobile-playback-info {
    grid-area: info;
    align-self: start;
  }

  .mobile-playback-info h1 {
    font-size: clamp(1.6rem, 2.4vw, 2.25rem);
  }

  .mobile-playback-moves {
    grid-area: moves;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  .mobile-playback-moves[open] {
    align-content: stretch;
  }

  .mobile-playback-moves .playback-move-list {
    max-height: none;
    height: 100%;
    min-height: 0;
    overflow: auto;
  }

  .mobile-playback-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-playback-transport {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.danger-action {
  min-height: 38px;
  border: 1px solid rgba(180, 35, 24, 0.34);
  border-radius: 6px;
  background: rgba(180, 35, 24, 0.1);
  color: #8a1f17;
  font-weight: 900;
  padding: 0 0.85rem;
}

.danger-action:active,
.danger-action:hover {
  background: #b42318;
  color: #fff;
}

.quiet-action {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 900;
  padding: 0 0.85rem;
}

.quiet-action:active,
.quiet-action:hover {
  background: var(--surface-strong);
}

.resign-modal {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.resign-modal .modal-title {
  font-size: 1.05rem;
  font-weight: 900;
}

.resign-modal form {
  margin: 0;
}

.action-modal-list {
  display: grid;
  gap: 0.75rem;
}

.action-modal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 0.75rem;
}

.action-modal-row strong,
.action-modal-row span {
  display: block;
}

.action-modal-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.action-modal-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.45rem;
}

.danger-row {
  border-color: rgba(180, 35, 24, 0.22);
}

.theme-settings-form {
  margin: 0;
}

.settings-theme-card {
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.settings-theme-card h2 {
  margin: 0;
}

.settings-alert,
.settings-save-row {
  grid-column: 1 / -1;
}

.settings-save-row {
  display: grid;
  gap: 0.5rem;
}

.settings-account-grid {
  margin-top: 1rem;
}

.settings-account-card {
  grid-column: span 6;
}

.settings-account-card form {
  margin: 0;
}

.settings-logout-button {
  width: min(100%, 220px);
}

.settings-save-status {
  min-height: 1.1rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.settings-theme-card .board-theme-strip,
.settings-theme-card .playfield-theme-grid,
.settings-theme-card .piece-theme-grid,
.settings-theme-card .piece-preview {
  margin-top: 0;
}

.board-theme-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  min-width: 0;
}

.board-theme-strip label {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  justify-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  padding: 0.55rem;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.board-theme-strip label:has(input:checked) {
  border-color: rgba(93, 139, 63, 0.72);
  background: #eef7e8;
  box-shadow: 0 0 0 2px rgba(93, 139, 63, 0.18);
}

.board-theme-strip label:hover {
  border-color: rgba(93, 139, 63, 0.45);
}

.board-theme-strip input {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

.board-theme-strip label:has(input:focus-visible) {
  outline: 3px solid rgba(255, 214, 10, 0.95);
  outline-offset: 2px;
}

.board-theme-strip .theme-board-preview.small {
  width: min(100%, 82px);
  max-width: 100%;
  min-width: 0;
  align-self: center;
}

.playfield-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  min-width: 0;
}

.playfield-theme-grid label {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.35rem;
  align-items: center;
  justify-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  padding: 0.55rem;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.playfield-theme-grid label:has(input:checked) {
  border-color: rgba(93, 139, 63, 0.72);
  background: #eef7e8;
  box-shadow: 0 0 0 2px rgba(93, 139, 63, 0.18);
}

.playfield-theme-grid label:hover {
  border-color: rgba(93, 139, 63, 0.45);
}

.playfield-theme-grid input {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

.playfield-theme-grid label:has(input:focus-visible) {
  outline: 3px solid rgba(255, 214, 10, 0.95);
  outline-offset: 2px;
}

.playfield-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(100%, 82px);
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.playfield-preview.standard span:nth-child(1) {
  background: #ede7dc;
}

.playfield-preview.standard span:nth-child(2) {
  background: #fffaf0;
}

.playfield-preview.standard span:nth-child(3) {
  background: #f4ecd9;
}

.playfield-preview.standard span:nth-child(4) {
  background: #5d8b3f;
}

.playfield-preview.brown span:nth-child(1) {
  background: #d8c8ae;
}

.playfield-preview.brown span:nth-child(2) {
  background: #fff8ec;
}

.playfield-preview.brown span:nth-child(3) {
  background: #eadcc4;
}

.playfield-preview.brown span:nth-child(4) {
  background: #6f8f3f;
}

.playfield-preview.blue span:nth-child(1) {
  background: #d7e6ef;
}

.playfield-preview.blue span:nth-child(2) {
  background: #f7fbff;
}

.playfield-preview.blue span:nth-child(3) {
  background: #d8e6f3;
}

.playfield-preview.blue span:nth-child(4) {
  background: #3f6f8f;
}

.playfield-preview.contrast span:nth-child(1) {
  background: #141414;
}

.playfield-preview.contrast span:nth-child(2) {
  background: #fbfbfb;
}

.playfield-preview.contrast span:nth-child(3) {
  background: #eeeeee;
}

.playfield-preview.contrast span:nth-child(4) {
  background: #006edb;
}

.playfield-preview.forest span:nth-child(1) {
  background: #26351f;
}

.playfield-preview.forest span:nth-child(2) {
  background: #fff7df;
}

.playfield-preview.forest span:nth-child(3) {
  background: #eadfbf;
}

.playfield-preview.forest span:nth-child(4) {
  background: #806d2d;
}

.playfield-preview.ocean span:nth-child(1) {
  background: #101820;
}

.playfield-preview.ocean span:nth-child(2) {
  background: #f4fbff;
}

.playfield-preview.ocean span:nth-child(3) {
  background: #dcecf2;
}

.playfield-preview.ocean span:nth-child(4) {
  background: #168aad;
}

.playfield-preview.rose span:nth-child(1) {
  background: #19152a;
}

.playfield-preview.rose span:nth-child(2) {
  background: #fff9f2;
}

.playfield-preview.rose span:nth-child(3) {
  background: #f1e9ff;
}

.playfield-preview.rose span:nth-child(4) {
  background: #d94f88;
}

.playfield-preview.slate span:nth-child(1) {
  background: #0f1419;
}

.playfield-preview.slate span:nth-child(2) {
  background: #f7f4ee;
}

.playfield-preview.slate span:nth-child(3) {
  background: #e2ded6;
}

.playfield-preview.slate span:nth-child(4) {
  background: #b88935;
}

.playfield-preview.mint span:nth-child(1) {
  background: #dfeee5;
}

.playfield-preview.mint span:nth-child(2) {
  background: #fbfff9;
}

.playfield-preview.mint span:nth-child(3) {
  background: #e4f4eb;
}

.playfield-preview.mint span:nth-child(4) {
  background: #3f7f66;
}

.piece-theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.piece-theme-grid label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
  padding: 0.65rem;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.piece-theme-grid label:has(input:checked) {
  border-color: rgba(93, 139, 63, 0.72);
  background: #eef7e8;
  box-shadow: 0 0 0 2px rgba(93, 139, 63, 0.18);
}

.piece-theme-grid label:hover {
  border-color: rgba(93, 139, 63, 0.45);
}

.piece-theme-grid input {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

.piece-theme-grid label:has(input:focus-visible) {
  outline: 3px solid rgba(255, 214, 10, 0.95);
  outline-offset: 2px;
}

.piece-theme-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.piece-theme-grid .piece-preview {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  width: 100%;
  max-width: 318px;
  min-width: 0;
  overflow: hidden;
  padding: 0.45rem;
}

.piece-theme-grid .piece-preview img {
  width: 42px;
  min-width: 0;
  height: 42px;
  flex: 0 1 42px;
}

.theme-swatch {
  display: flex;
  align-items: end;
  min-height: 110px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  padding: 0.75rem;
}

.theme-swatch.standard {
  background: linear-gradient(135deg, #fff 0 50%, #aaa 50%);
}

.theme-swatch.brown {
  background: linear-gradient(135deg, #eeeed2 0 50%, #769656 50%);
}

.theme-swatch.blue {
  background: linear-gradient(135deg, #d8e6f3 0 50%, #4f7cac 50%);
}

.theme-swatch.contrast {
  background: linear-gradient(135deg, #f8f8f8 0 50%, #1b1b1b 50%);
  color: #fff;
}

.piece-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.piece-preview img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

@media (max-width: 430px) {
  .board-theme-strip,
  .playfield-theme-grid {
    gap: 0.5rem;
  }

  .board-theme-strip label,
  .playfield-theme-grid label {
    padding: 0.4rem;
  }

  .board-theme-strip .theme-board-preview.small,
  .playfield-preview {
    width: min(100%, 64px);
  }

  .board-theme-strip strong,
  .playfield-theme-grid strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .list-row {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions form,
  .row-actions button,
  .list-row > form,
  .list-row > form button {
    width: 100%;
  }
}

@media (max-width: 340px) {
  .board-theme-strip,
  .playfield-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .board-theme-strip .theme-board-preview.small,
  .playfield-preview {
    width: min(100%, 70px);
  }
}

@media (max-width: 760px) {
  .app-nav,
  .action-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .app-nav {
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .player-panel,
  .challenge-panel,
  .action-panel,
  .board-panel,
  .list-panel,
  .secondary-list {
    grid-column: auto;
  }

  .primary-action {
    width: 100%;
  }

  .admin-settings-grid,
  .profile-settings-grid,
  .notification-settings-card,
  .settings-account-card,
  .theme-settings-form,
  .user-row-main,
  .admin-reset-form,
  .admin-search {
    grid-template-columns: 1fr;
  }

  .notification-switch {
    min-width: 0;
  }

  .admin-user-actions,
  .admin-user-actions[open] summary {
    justify-self: stretch;
    min-width: 0;
  }

  .challenge-form {
    grid-template-columns: 1fr;
  }

  .list-row {
    align-items: center;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .dashboard-row-meta {
    gap: 0.25rem;
  }

  .dashboard-row-meta span {
    min-height: 23px;
    font-size: 0.75rem;
    padding: 0 0.42rem;
  }

  .row-actions .game-pill,
  .list-row > form .game-pill {
    min-height: 34px;
    padding: 0 0.62rem;
  }

  .action-modal-row {
    grid-template-columns: 1fr;
  }

  .action-modal-buttons,
  .action-modal-row form,
  .action-modal-row button {
    width: 100%;
  }

  .user-meta {
    justify-content: start;
  }

  .community-search {
    grid-template-columns: 1fr;
  }

  .community-game-search,
  .community-hub-grid {
    grid-template-columns: 1fr;
  }

  .guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
  }

  .guide-terms {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .community-landing {
    grid-template-columns: 1fr;
  }

  .community-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading-row {
    display: grid;
  }

  .dashboard-pill-actions {
    justify-content: stretch;
  }

  .dashboard-pill-actions .game-pill {
    flex: 1 1 130px;
  }

  .community-list {
    grid-template-columns: 1fr;
  }

  .tournament-grid {
    grid-template-columns: 1fr;
  }

  .tournament-pairing-row {
    grid-template-columns: 1fr;
  }

  .tournament-pairing-row .dashboard-pill-actions {
    justify-content: stretch;
  }

  .tournament-game-row {
    grid-template-columns: 1fr;
  }

  .detail-challenge {
    grid-template-columns: 1fr;
  }

  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "topbar"
      "board";
    width: 100%;
    gap: 0.4rem;
    height: calc(100svh - max(1rem, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    min-height: 0;
  }

  .playback-layout {
    grid-template-columns: 1fr;
    width: 100%;
    gap: 0.4rem;
    height: auto;
    min-height: calc(100svh - 1rem);
    overflow: visible;
  }

  .playback-summary {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.8rem 0.9rem;
  }

  .playback-summary h1 {
    font-size: clamp(1.75rem, 9vw, 2.35rem);
  }

  .playback-outcome {
    justify-items: start;
    min-width: 0;
    text-align: left;
  }

  .playback-outcome strong {
    order: -1;
  }

  .playback-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "board"
      "controls"
      "history";
    overflow: visible;
  }

  .playback-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.65rem;
  }

  .playback-progress {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .playback-bar-actions,
  .playback-controls {
    width: 100%;
  }

  .playback-bar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .playback-bar-actions .playback-speed,
  .playback-bar-actions .playback-emotes {
    justify-content: center;
  }

  .playback-controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
  }

  .game-side {
    position: fixed;
    left: max(0.45rem, env(safe-area-inset-left));
    right: max(0.45rem, env(safe-area-inset-right));
    bottom: max(0.45rem, env(safe-area-inset-bottom));
    z-index: 20;
    height: min(46svh, 360px);
    max-height: min(46svh, 360px);
    padding: 0.45rem;
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.22);
  }

  .moves-pill {
    display: inline-flex;
  }

  .game-side .move-drawer {
    height: 100%;
    padding: 0;
  }

  .move-drawer summary {
    min-height: 34px;
    padding: 0 0.55rem;
  }

  .move-drawer[open] summary {
    margin-bottom: 0.35rem;
  }

  .move-table {
    font-size: 0.86rem;
  }

  .move-table th,
  .move-table td {
    padding: 0.24rem 0.38rem;
  }

  .playback-side {
    display: grid;
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 0.55rem;
    box-shadow: 0 8px 22px rgba(20, 20, 20, 0.06);
  }

  .game-side:has(.move-drawer[open]) {
    max-height: min(46svh, 360px);
    overflow: hidden;
  }

  .game-side:not(:has(.move-drawer[open])) {
    display: none;
  }

  .playback-stage .playback-side {
    display: grid;
    position: static;
  }

  .play-board {
    width: min(100%, calc(100svh - 184px), 96vw);
    min-width: min(280px, 100%);
  }

  @supports (width: 100cqw) {
    .play-board {
      width: min(100cqw, 100cqh, 720px);
      min-width: 0;
    }
  }

  .playback-board-shell {
    height: auto;
    gap: 0.45rem;
    padding-bottom: 0;
  }

  .playback-board-shell .board-stage {
    height: auto;
    min-height: 0;
    padding: 0.15rem 0;
  }

  .playback-board-shell .play-board {
    width: min(100%, calc(100vw - 1.75rem), 520px);
    min-width: min(280px, 100%);
  }

  @supports (width: 100cqw) {
    .playback-board-shell .play-board {
      width: min(100cqw, calc(100vw - 1.75rem), 520px);
      min-width: min(280px, 100%);
    }
  }

  .game-board-shell {
    padding-bottom: 0;
  }

  .move-table-wrap {
    max-height: none;
  }

  .playback-stage .playback-side {
    max-height: none;
  }

  .playback-move-list {
    max-height: 42vh;
  }

  .game-topbar {
    gap: 0.35rem;
    align-items: center;
    display: flex;
    justify-content: space-between;
    overflow: visible;
  }

  .game-topbar-left {
    gap: 0.3rem;
    flex: 1 1 auto;
    overflow: visible;
  }

  .game-topbar-meta {
    justify-content: end;
    flex: 1 1 auto;
    overflow: visible;
  }

  .game-pill {
    min-height: 34px;
    flex: 0 0 auto;
    padding: 0 0.55rem;
    font-size: 0.88rem;
  }

  .public-copy-pill {
    display: none;
  }

  .player-clock {
    min-height: 40px;
    padding: 0.25rem 0.35rem 0.25rem 0.55rem;
  }

  .playback-board-shell .player-clock {
    min-height: 48px;
  }

  .player-label {
    font-size: 0.92rem;
  }

  .player-label span {
    font-size: 0.8rem;
  }

  .clock-pill {
    min-width: 62px;
    min-height: 30px;
    font-size: 0.96rem;
    padding: 0 0.45rem;
  }

  .emote-toggle {
    width: 30px;
    height: 30px;
  }

  .clock-actions {
    gap: 0.35rem;
    justify-self: end;
  }

  .player-clock {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 0.35rem;
  }

  .player-clock-copy {
    min-width: 0;
  }

  .clock-pill {
    justify-self: end;
  }

  .player-bar-spacer {
    width: 30px;
    height: 30px;
    justify-self: end;
  }

  .emote-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .emote-grid button {
    min-height: 48px;
    font-size: 1.35rem;
  }

  .move-list {
    max-height: 34vh;
  }

  .auth-screen .app-shell {
    align-items: start;
    min-height: calc(100vh - 96px);
  }

  .auth-card {
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .game-topbar .public-copy-pill,
  .game-topbar .game-topbar-left > .game-pill:not(.game-pill-link) {
    display: none;
  }

  .game-topbar {
    gap: 0.3rem;
  }

  .game-topbar-left,
  .game-topbar-meta {
    gap: 0.28rem;
  }

  .game-topbar-left {
    min-width: 0;
  }

  .game-topbar-meta {
    min-width: 0;
  }

  .game-pill {
    min-height: 36px;
    padding: 0 0.58rem;
    font-size: 0.86rem;
  }

  .player-clock.active .player-label::after {
    display: none;
  }

  .captured-empty {
    font-size: 0.62rem;
  }

  .rank-label {
    top: 3px;
    right: 3px;
  }

  .file-label {
    top: 3px;
    left: 3px;
  }
}

@media (max-width: 380px) {
  .mobile-playback-clock {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mobile-playback-clock .playback-clock-note {
    display: none;
  }

  .game-pill {
    padding: 0 0.46rem;
    font-size: 0.82rem;
  }

  .flip-pill span {
    display: none;
  }

  .moves-pill {
    padding-inline: 0.52rem;
  }

  .clock-pill {
    min-width: 58px;
    font-size: 0.9rem;
  }

  .player-label span {
    display: none;
  }

  .flip-pill {
    gap: 0.25rem;
  }
}
