:root {
  color-scheme: dark;
  --chess-bg: #070d13;
  --chess-bg-elevated: #091119;
  --chess-card: #0c141c;
  --chess-card-secondary: #101922;
  --chess-control: #141e28;
  --chess-hover: #18232e;
  --chess-border: #26313c;
  --chess-border-subtle: rgba(255, 255, 255, 0.08);
  --chess-border-strong: rgba(255, 255, 255, 0.14);
  --chess-text: #f4f7fa;
  --chess-text-secondary: #a7b0ba;
  --chess-text-muted: #75818d;
  --chess-text-faint: #596572;
  --chess-purple: #7068f4;
  --chess-purple-hover: #817af8;
  --chess-purple-active: #6158de;
  --chess-green: #18b981;
  --chess-amber: #e8ad3a;
  --chess-orange: #dc8145;
  --chess-red: #e45c67;
  --chess-blue: #5799e6;
  --chess-focus: #9c96ff;
  --chess-card-shadow: 0 10px 28px rgba(0, 0, 0, 0.17);
  --chess-modal-shadow: 0 28px 90px rgba(0, 0, 0, 0.66);
  --header-height: 56px;
  --radius-control: 8px;
  --radius-card: 10px;
  --radius-panel: 12px;
  --radius-modal: 14px;
  --board-light: #aeb2b5;
  --board-dark: #656a6f;
  --board-last: rgba(53, 130, 82, 0.58);
  --board-selected: rgba(45, 145, 82, 0.74);
  --board-check: rgba(187, 52, 65, 0.62);
  --board-arrow: rgba(224, 166, 53, 0.76);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

html[data-chess-board-theme="midnight"] {
  --board-light: #89959e;
  --board-dark: #46525c;
  --board-last: rgba(45, 129, 80, 0.66);
}

html[data-chess-board-theme="high-contrast"] {
  --board-light: #d8dde1;
  --board-dark: #3e4850;
  --board-last: rgba(22, 157, 89, 0.8);
  --board-selected: rgba(25, 190, 101, 0.88);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--chess-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 76% 10%, rgba(79, 73, 169, 0.055), transparent 34rem),
    linear-gradient(180deg, #070d13 0%, #070d13 68%, #060b10 100%);
  color: var(--chess-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
summary,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--chess-focus);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: rgba(112, 104, 244, 0.55);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #34404c;
  background-clip: padding-box;
}

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 8px;
  left: 8px;
  padding: 9px 13px;
  transform: translateY(-160%);
  border-radius: var(--radius-control);
  background: var(--chess-purple);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.chess-app {
  min-height: 100vh;
  min-height: 100dvh;
}

.chess-header {
  position: sticky;
  z-index: 300;
  top: 0;
  height: var(--header-height);
  border-bottom: 1px solid var(--chess-border-subtle);
  background: rgba(7, 13, 19, 0.95);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(14px);
}

.chess-header-inner {
  width: min(100%, 1600px);
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.chess-brand {
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--chess-text);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--chess-text);
  font-size: 28px;
}

.brand-mark .chess-piece {
  width: 33px;
  height: 33px;
}

.brand-copy {
  display: grid;
  line-height: 1.05;
}

.brand-copy strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--chess-text-muted);
  font-size: 11px;
  font-weight: 600;
}

.chess-primary-nav {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}

.chess-nav-link,
.nav-more > summary {
  min-height: 36px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--chess-text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    transform 100ms ease;
}

button.chess-nav-link {
  width: 100%;
}

.chess-nav-link:hover,
.chess-nav-link:focus-visible,
.nav-more > summary:hover,
.nav-more > summary:focus-visible,
.chess-nav-link.is-current {
  color: var(--chess-text);
  background: rgba(255, 255, 255, 0.045);
}

.chess-nav-link.is-current {
  color: #a9a4ff;
  background: rgba(112, 104, 244, 0.1);
}

.chess-nav-link:active,
.nav-more > summary:active {
  transform: translateY(1px);
}

.chess-nav-link.is-disabled {
  color: var(--chess-text-faint);
  cursor: default;
}

.nav-more,
.user-menu {
  position: relative;
}

.nav-more > summary,
.user-menu > summary {
  list-style: none;
}

.nav-more > summary::-webkit-details-marker,
.user-menu > summary::-webkit-details-marker {
  display: none;
}

.nav-popover,
.user-popover {
  position: absolute;
  z-index: 400;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  padding: 6px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--chess-border);
  border-radius: var(--radius-card);
  background: #0d161f;
  box-shadow: var(--chess-modal-shadow);
}

.nav-popover .chess-nav-link,
.user-popover .chess-nav-link {
  width: 100%;
  justify-content: flex-start;
}

.chess-header-tools {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.connection-pill {
  min-height: 27px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 999px;
  color: var(--chess-text-muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
  font-weight: 600;
}

.connection-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chess-amber);
}

.connection-pill--connected {
  color: #8edfc0;
}

.connection-pill--connected i {
  background: var(--chess-green);
}

.connection-pill--disconnected,
.connection-pill--unavailable {
  color: #f09aa3;
}

.connection-pill--disconnected i,
.connection-pill--unavailable i {
  background: var(--chess-red);
}

.user-menu > summary {
  min-height: 40px;
  padding: 3px 6px 3px 3px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--chess-text-secondary);
}

.user-menu > summary:hover,
.user-menu > summary:focus-visible {
  border-color: var(--chess-border-subtle);
  background: rgba(255, 255, 255, 0.04);
}

.user-menu-name {
  max-width: 13ch;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover {
  width: 238px;
}

.user-popover-heading {
  margin: -1px -1px 5px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.user-popover-heading > div {
  min-width: 0;
  display: grid;
}

.user-popover-heading strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
}

.user-popover-heading small {
  margin-top: 2px;
  color: var(--chess-text-muted);
  font-size: 11px;
}

.online-dot {
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 3px;
  border-radius: 50%;
  background: var(--chess-green);
}

.user-menu-logout {
  border: 0;
  cursor: pointer;
}

.header-icon-button {
  position: relative;
}

.notification-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid var(--chess-bg);
  border-radius: 999px;
  background: var(--chess-red);
  color: #fff;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.chess-main {
  width: min(100%, 1576px);
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
  margin: 0 auto;
  padding: 18px 16px 48px;
  outline: 0;
}

.page-heading {
  min-height: 46px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-heading h1,
.page-heading p {
  margin: 0;
}

.page-heading h1 {
  font-size: clamp(22px, 2.3vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.page-heading p {
  max-width: 70ch;
  margin-top: 5px;
  color: var(--chess-text-secondary);
  font-size: 13px;
}

.page-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 17px;
}

.section-heading p {
  margin-top: 3px;
  color: var(--chess-text-muted);
  font-size: 12px;
}

.section-heading a,
.card-header a {
  color: #9e99ff;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.section-heading a:hover,
.card-header a:hover {
  text-decoration: underline;
}

.section-kicker,
.card-eyebrow {
  margin: 0;
  color: #9892ff;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.chess-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--chess-border-subtle);
  border-radius: var(--radius-card);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.012), transparent 38%), var(--chess-card);
  box-shadow: var(--chess-card-shadow);
}

.card-header {
  min-height: 47px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.card-header h2,
.card-header p {
  margin: 0;
}

.card-header h2 {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.2;
}

.card-body {
  min-width: 0;
  padding: 12px;
}

.chess-button {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--chess-border);
  border-radius: var(--radius-control);
  background: var(--chess-control);
  color: var(--chess-text);
  font-size: 12px;
  font-weight: 680;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 100ms ease,
    border-color 140ms ease,
    background 140ms ease,
    color 140ms ease,
    filter 140ms ease;
}

.chess-button:hover:not(:disabled),
.chess-button:focus-visible:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.22);
  background: var(--chess-hover);
}

.chess-button:active:not(:disabled) {
  transform: translateY(1px);
}

.chess-button:disabled,
.chess-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button {
  border-color: rgba(142, 135, 255, 0.55);
  background: linear-gradient(180deg, #7770f6, var(--chess-purple));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled) {
  border-color: rgba(174, 169, 255, 0.7);
  background: linear-gradient(180deg, #857ef9, var(--chess-purple-hover));
}

.primary-button:active:not(:disabled) {
  background: var(--chess-purple-active);
}

.secondary-button {
  background: var(--chess-control);
}

.quiet-button {
  border-color: transparent;
  background: transparent;
  color: var(--chess-text-secondary);
}

.quiet-button:hover:not(:disabled) {
  border-color: var(--chess-border-subtle);
  background: rgba(255, 255, 255, 0.045);
  color: var(--chess-text);
}

.danger-button {
  border-color: rgba(228, 92, 103, 0.45);
  background: rgba(228, 92, 103, 0.13);
  color: #ffadb5;
}

.danger-button:hover:not(:disabled) {
  border-color: rgba(228, 92, 103, 0.68);
  background: rgba(228, 92, 103, 0.2);
}

.small-button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 11px;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.ui-icon {
  flex: 0 0 auto;
}

.loading-spinner {
  width: 17px;
  height: 17px;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: chess-spin 700ms linear infinite;
}

.is-loading > span:not(.loading-spinner) {
  opacity: 0.7;
}

@keyframes chess-spin {
  to {
    transform: rotate(360deg);
  }
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--chess-border);
  border-radius: var(--radius-control);
  background: #0a1219;
  color: var(--chess-text);
  font-size: 12px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--chess-text-faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #354352;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--chess-purple);
  box-shadow: 0 0 0 3px rgba(112, 104, 244, 0.12);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  color: var(--chess-text-secondary);
}

.form-field {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
}

.field-label {
  color: var(--chess-text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.field-help,
.form-field > small {
  color: var(--chess-text-muted);
  font-size: 10px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.form-error {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid rgba(228, 92, 103, 0.3);
  border-radius: 7px;
  background: rgba(228, 92, 103, 0.08);
  color: #f79aa3;
  font-size: 11px;
}

.checkbox-field {
  min-height: 42px;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.018);
}

.checkbox-field:hover {
  border-color: var(--chess-border);
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-field input {
  width: 17px;
  min-height: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--chess-purple);
}

.checkbox-field > span {
  display: grid;
  gap: 2px;
}

.checkbox-field strong {
  color: var(--chess-text);
  font-size: 11px;
}

.checkbox-field small {
  color: var(--chess-text-muted);
  font-size: 10px;
}

.segmented-tabs {
  min-height: 36px;
  padding: 3px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: #091119;
  scrollbar-width: none;
}

.segmented-tabs::-webkit-scrollbar {
  display: none;
}

.segmented-tabs button {
  min-height: 28px;
  padding: 0 9px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--chess-text-muted);
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.segmented-tabs button:hover,
.segmented-tabs button:focus-visible {
  color: var(--chess-text);
}

.segmented-tabs button.is-selected {
  border-color: rgba(112, 104, 244, 0.22);
  background: rgba(112, 104, 244, 0.14);
  color: #b9b5ff;
}

.empty-state {
  min-height: 176px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--chess-text-secondary);
}

.empty-state--compact {
  min-height: 116px;
  padding: 14px;
  gap: 7px;
}

.empty-state--danger .empty-state__icon {
  color: var(--chess-red);
  background: rgba(228, 92, 103, 0.1);
}

.empty-state__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chess-control);
  color: var(--chess-text-secondary);
}

.empty-state--compact .empty-state__icon {
  width: 32px;
  height: 32px;
}

.empty-state__copy {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.empty-state h2,
.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h2 {
  color: var(--chess-text);
  font-size: 16px;
}

.empty-state h3 {
  color: var(--chess-text);
  font-size: 12px;
}

.empty-state p {
  max-width: 54ch;
  color: var(--chess-text-muted);
  font-size: 11px;
}

.route-loading {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--chess-text-muted);
}

.skeleton-list {
  display: grid;
  gap: 8px;
}

.skeleton-row,
.skeleton-card {
  position: relative;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: #0d161f;
}

.skeleton-row::after,
.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  animation: chess-shimmer 1.35s infinite;
  animation-delay: var(--skeleton-delay, 0ms);
}

.skeleton-card {
  min-height: 190px;
}

@keyframes chess-shimmer {
  to {
    transform: translateX(100%);
  }
}

.inline-notice {
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chess-border);
  border-radius: var(--radius-control);
  color: var(--chess-text-secondary);
  background: var(--chess-card-secondary);
  font-size: 11px;
}

.inline-notice > span {
  flex: 1;
}

.inline-notice--warning {
  border-color: rgba(232, 173, 58, 0.23);
  color: #d8bc83;
}

.muted-copy {
  color: var(--chess-text-muted) !important;
}

.delta-positive,
.result-positive {
  color: #4ed3a2 !important;
}

.delta-negative,
.result-danger {
  color: #ed7d87 !important;
}

.result-neutral {
  color: var(--chess-text-secondary) !important;
}

.dashboard-page > .page-heading {
  display: none;
}

.dashboard-content {
  display: grid;
  gap: 12px;
}

.hero-card > .card-body {
  min-height: 198px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: center;
}

.hero-copy {
  max-width: 650px;
}

.hero-copy h1 {
  margin: 6px 0 2px;
  font-size: 25px;
  letter-spacing: -0.025em;
}

.hero-copy > p:not(.section-kicker) {
  margin: 0;
  color: var(--chess-text-secondary);
  font-size: 12px;
}

.hero-actions {
  width: min(100%, 480px);
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.live-stat-list {
  display: grid;
  gap: 7px;
}

.live-stat {
  min-height: 50px;
  padding: 7px 9px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: #101821;
}

.live-stat-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.live-stat--green .live-stat-icon {
  color: var(--chess-green);
  background: rgba(24, 185, 129, 0.09);
}

.live-stat--amber .live-stat-icon {
  color: var(--chess-amber);
  background: rgba(232, 173, 58, 0.09);
}

.live-stat--orange .live-stat-icon {
  color: var(--chess-orange);
  background: rgba(220, 129, 69, 0.09);
}

.live-stat > span:last-child {
  display: grid;
}

.live-stat small {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.live-stat strong {
  margin-top: 1px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dashboard-three-up {
  display: grid;
  grid-template-columns: 1.2fr 0.95fr 1.05fr;
  gap: 12px;
}

.dashboard-three-up > .chess-card {
  min-height: 282px;
}

.featured-game-card .card-eyebrow {
  color: var(--chess-red);
}

.featured-game-body {
  display: grid;
  gap: 6px;
}

.featured-player-row,
.featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compact-player {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.compact-player > span:last-child {
  min-width: 0;
  display: grid;
}

.compact-player a,
.compact-player span {
  overflow: hidden;
  color: var(--chess-text);
  font-size: 10px;
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-player small {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.mini-clock {
  color: var(--chess-text-secondary);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mini-board-slot {
  width: min(100%, 150px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--chess-border);
  border-radius: 5px;
  background: #0a1016;
}

.mini-board {
  width: 100%;
  height: 100%;
  border-radius: 0 !important;
}

.mini-board .board-square {
  min-width: 0;
  min-height: 0;
}

.mini-board .chess-piece {
  width: 86%;
  height: 86%;
}

.featured-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.rank-list,
.recent-list,
.leaderboard-preview-list,
.history-preview-list {
  display: grid;
}

.rank-row,
.recent-row,
.preview-table-row,
.history-preview-row {
  min-height: 34px;
  padding: 5px 3px;
  display: grid;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--chess-text-secondary);
  font-size: 10px;
  text-decoration: none;
}

.rank-row:last-child,
.recent-row:last-child,
.preview-table-row:last-child,
.history-preview-row:last-child {
  border-bottom: 0;
}

.rank-row {
  grid-template-columns: 28px 24px minmax(0, 1fr) auto;
}

.rank-number {
  color: var(--chess-text-muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.rank-name,
.rank-row a {
  overflow: hidden;
  color: var(--chess-text);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-rating {
  color: var(--chess-text);
  font-variant-numeric: tabular-nums;
}

.recent-row {
  grid-template-columns: minmax(0, 1fr) 32px 56px;
}

.recent-row:hover,
.history-preview-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.recent-pairing {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 4px;
}

.recent-pairing span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-pairing small,
.recent-row time {
  color: var(--chess-text-muted);
  font-size: 8px;
}

.ratings-section {
  display: grid;
  gap: 9px;
}

.rating-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.rating-card {
  min-height: 105px;
  padding: 10px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 3px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: var(--chess-card-secondary);
}

.rating-card header,
.rating-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rating-card header > span {
  color: var(--chess-text-secondary);
  font-size: 10px;
  font-weight: 650;
}

.rating-card header small,
.rating-card footer {
  color: var(--chess-text-muted);
  font-size: 8px;
}

.rating-value {
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sparkline {
  min-height: 28px;
  display: grid;
  align-items: center;
}

.sparkline svg {
  width: 100%;
  height: 27px;
  overflow: visible;
}

.sparkline-line {
  fill: none;
  stroke: #817af8;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.sparkline-fill {
  fill: rgba(112, 104, 244, 0.06);
  stroke: none;
}

.sparkline-empty {
  color: var(--chess-text-faint);
  font-size: 8px;
}

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-table-card .card-body {
  display: grid;
  gap: 8px;
}

.preview-table-row {
  grid-template-columns: 26px 24px minmax(0, 1fr) auto;
}

.preview-table-row a {
  overflow: hidden;
  color: var(--chess-text);
  text-decoration: none;
  text-overflow: ellipsis;
}

.history-preview-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px 58px 64px;
}

.history-preview-row > span,
.history-preview-row > time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-preview-row time {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.reliability-strip {
  min-height: 130px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2.15fr);
  align-items: center;
  gap: 18px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: var(--radius-card);
  background: var(--chess-bg-elevated);
}

.reliability-heading h2 {
  margin: 4px 0 0;
  font-size: 16px;
}

.reliability-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.reliability-item {
  min-height: 62px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: var(--chess-card);
}

.reliability-item > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--chess-text-muted);
  background: var(--chess-control);
}

.reliability-item--ready > span {
  color: var(--chess-green);
  background: rgba(24, 185, 129, 0.09);
}

.reliability-item--off > span {
  color: var(--chess-red);
}

.reliability-item > div {
  min-width: 0;
  display: grid;
}

.reliability-item strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reliability-item small {
  color: var(--chess-text-muted);
  font-size: 8px;
}

.player-avatar {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(112, 104, 244, 0.24), rgba(24, 185, 129, 0.1)),
    #17212b;
  color: #d8d5ff;
  font-size: 10px;
  font-weight: 750;
}

.player-avatar > img,
.player-avatar > span:not(.presence-dot) {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  object-fit: cover;
}

.player-avatar--tiny {
  width: 24px;
  height: 24px;
  font-size: 7px;
}

.player-avatar--small {
  width: 34px;
  height: 34px;
  font-size: 9px;
}

.player-avatar--medium {
  width: 42px;
  height: 42px;
}

.player-avatar--large {
  width: 72px;
  height: 72px;
  font-size: 17px;
}

.presence-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 8px;
  height: 8px;
  border: 2px solid var(--chess-card);
  border-radius: 50%;
  background: var(--chess-green);
}

.modal {
  width: min(560px, calc(100vw - 24px));
  max-width: none;
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: var(--radius-modal);
  background: transparent;
  color: var(--chess-text);
  box-shadow: var(--chess-modal-shadow);
}

.modal::backdrop {
  background: rgba(2, 6, 10, 0.82);
  backdrop-filter: blur(4px);
}

.modal-panel {
  max-height: min(88vh, 820px);
  overflow: auto;
  border: 1px solid var(--chess-border);
  border-radius: inherit;
  background: #0c151e;
}

.modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 66px;
  padding: 13px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--chess-border-subtle);
  background: rgba(12, 21, 30, 0.97);
  backdrop-filter: blur(10px);
}

.modal-header h2,
.modal-header p {
  margin: 0;
}

.modal-header h2 {
  font-size: 17px;
}

.modal-header p {
  margin-top: 3px;
  color: var(--chess-text-muted);
  font-size: 11px;
}

.modal-close {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
}

.modal-body {
  padding: 14px;
}

.modal-actions {
  position: sticky;
  z-index: 2;
  bottom: 0;
  min-height: 62px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--chess-border-subtle);
  background: rgba(12, 21, 30, 0.97);
  backdrop-filter: blur(10px);
}

.game-config-modal {
  width: min(650px, calc(100vw - 24px));
}

.game-config-form {
  display: grid;
  gap: 13px;
}

.custom-time-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.private-game-options,
.matchmaking-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-output {
  min-height: 35px;
  padding: 8px 10px;
  border: 1px solid rgba(112, 104, 244, 0.2);
  border-radius: 7px;
  color: #b3afff;
  background: rgba(112, 104, 244, 0.07);
  font-size: 11px;
  font-weight: 650;
}

.compact-fieldset {
  margin: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 9px;
}

.compact-fieldset legend {
  padding: 0 5px;
  color: var(--chess-text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.queue-state {
  padding: 18px 4px;
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.queue-state > strong {
  font-size: 17px;
}

.queue-state > p {
  max-width: 44ch;
  margin: 0;
  color: var(--chess-text-muted);
  font-size: 11px;
}

.queue-animation {
  width: 66px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.queue-animation i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chess-purple);
  animation: queue-dot 900ms ease-in-out infinite alternate;
}

.queue-animation i:nth-child(2) {
  animation-delay: 180ms;
}

.queue-animation i:nth-child(3) {
  animation-delay: 360ms;
}

@keyframes queue-dot {
  to {
    transform: translateY(-7px);
    opacity: 0.45;
  }
}

.queue-details,
.invite-details,
.inline-definition-list {
  width: 100%;
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.queue-details > div,
.invite-details > div,
.inline-definition-list > div {
  padding: 8px;
  display: grid;
  gap: 2px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: var(--chess-card-secondary);
}

.queue-details dt,
.invite-details dt,
.inline-definition-list dt {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.queue-details dd,
.invite-details dd,
.inline-definition-list dd {
  margin: 0;
  color: var(--chess-text);
  font-size: 11px;
  font-weight: 650;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.copy-field {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.join-code {
  margin-top: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px dashed var(--chess-border);
  border-radius: 8px;
}

.join-code span {
  color: var(--chess-text-muted);
  font-size: 10px;
}

.join-code strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  letter-spacing: 0.12em;
}

.notification-list {
  display: grid;
  gap: 6px;
}

.notification-item {
  position: relative;
  min-height: 64px;
  padding: 9px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 9px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.notification-item.is-unread {
  border-color: rgba(112, 104, 244, 0.25);
  background: rgba(112, 104, 244, 0.055);
}

.notification-item-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chess-control);
  color: #a9a4ff;
}

.notification-item strong {
  font-size: 11px;
}

.notification-item p {
  margin: 2px 0;
  color: var(--chess-text-secondary);
  font-size: 10px;
}

.notification-item time {
  color: var(--chess-text-faint);
  font-size: 9px;
}

.notification-actions {
  position: relative;
  z-index: 2;
  grid-column: 2;
  display: flex;
  gap: 6px;
}

.stretched-link {
  position: absolute;
  inset: 0;
}

.toast-region {
  position: fixed;
  z-index: 2000;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 7px;
  pointer-events: none;
}

.toast {
  min-height: 48px;
  padding: 7px 7px 7px 10px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  transform: translateY(12px);
  border: 1px solid var(--chess-border);
  border-radius: 9px;
  background: rgba(16, 25, 34, 0.97);
  box-shadow: var(--chess-modal-shadow);
  opacity: 0;
  pointer-events: auto;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--chess-blue);
  background: rgba(87, 153, 230, 0.1);
}

.toast--success .toast-icon {
  color: var(--chess-green);
  background: rgba(24, 185, 129, 0.1);
}

.toast--danger .toast-icon {
  color: var(--chess-red);
  background: rgba(228, 92, 103, 0.1);
}

.toast-message {
  font-size: 11px;
}

.toast-close {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
}

.mobile-nav {
  display: none;
}

/* Chessboard and live game */
.live-game-page {
  padding-top: 10px;
  padding-bottom: 10px;
}

.play-layout {
  --play-height: calc(100dvh - var(--header-height) - 20px);
  height: var(--play-height);
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(292px, 340px);
  justify-content: center;
  gap: 10px;
}

.game-rail {
  min-height: 0;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 9px;
  background: var(--chess-card);
}

.game-rail a,
.game-rail button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--chess-text-muted);
}

.game-rail a:hover,
.game-rail button:hover,
.game-rail a:focus-visible,
.game-rail button:focus-visible {
  border-color: var(--chess-border-subtle);
  background: var(--chess-control);
  color: var(--chess-text);
}

.game-rail a:last-child {
  margin-top: auto;
}

.game-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) 46px;
  justify-items: center;
  align-items: center;
}

.player-bar {
  width: min(100%, calc(var(--play-height) - 92px));
  min-height: 42px;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 140ms ease, background 140ms ease;
}

.player-bar.is-active {
  border-color: rgba(112, 104, 244, 0.18);
  background: rgba(112, 104, 244, 0.045);
}

.player-bar-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-bar-identity > div {
  min-width: 0;
  display: grid;
}

.player-bar-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-bar-name a,
.player-bar-name > span {
  max-width: 34ch;
  overflow: hidden;
  color: var(--chess-text);
  font-size: 11px;
  font-weight: 680;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-bar-name em {
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(112, 104, 244, 0.16);
  color: #b8b4ff;
  font-size: 8px;
  font-style: normal;
  font-weight: 750;
}

.player-bar-meta {
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.colour-chip {
  width: 9px;
  height: 9px;
  display: inline-block;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 2px;
}

.colour-chip--white {
  background: #e9ecee;
}

.colour-chip--black {
  background: #171c21;
}

.disconnect-label {
  color: var(--chess-red);
}

.game-clock {
  min-width: 80px;
  height: 36px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: #0e161e;
  color: var(--chess-text-secondary);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.game-clock.is-running {
  border-color: rgba(112, 104, 244, 0.28);
  background: rgba(112, 104, 244, 0.12);
  color: #fff;
}

.game-clock.is-low {
  border-color: rgba(232, 173, 58, 0.4);
  color: #f5cb79;
}

.game-clock.is-critical {
  border-color: rgba(228, 92, 103, 0.5);
  background: rgba(228, 92, 103, 0.1);
  color: #ff9ea7;
}

.board-area {
  position: relative;
  width: min(100%, calc(var(--play-height) - 92px));
  max-height: 100%;
  aspect-ratio: 1;
}

.board-mount,
.analysis-board-mount {
  width: 100%;
  height: 100%;
}

.chess-board {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: var(--board-dark);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  user-select: none;
  -webkit-user-select: none;
}

.board-square {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  outline-offset: -3px;
}

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

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

.board-square::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}

.board-square.is-last-move::before {
  background: var(--board-last);
}

.board-square.is-selected::before {
  background: var(--board-selected);
}

.board-square.is-check::before {
  background:
    radial-gradient(circle, var(--board-check) 0, rgba(187, 52, 65, 0.38) 44%, transparent 72%);
}

.board-square.is-pending::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 2px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.piece-holder {
  position: relative;
  z-index: 3;
  width: 91%;
  height: 91%;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.piece-holder:active {
  cursor: grabbing;
}

.chess-piece {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: currentColor;
  stroke: var(--piece-stroke);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  paint-order: stroke fill;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.38));
  pointer-events: none;
  transition: transform 100ms ease;
}

.board-square:hover .chess-piece {
  transform: translateY(-1px);
}

.piece--white {
  --piece-stroke: #30373c;
  color: #eef0f1;
}

.piece--black {
  --piece-stroke: #05080a;
  color: #171b1f;
}

.piece-detail-fill {
  fill: var(--piece-stroke);
  stroke: none;
}

html[data-chess-piece-set="outline"] .chess-piece {
  fill-opacity: 0.88;
  stroke-width: 3.2;
  filter: none;
}

.legal-dot {
  position: absolute;
  z-index: 4;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(19, 33, 25, 0.48);
  pointer-events: none;
}

.capture-ring {
  position: absolute;
  z-index: 4;
  inset: 7%;
  border: clamp(2px, 0.35vw, 5px) solid rgba(19, 33, 25, 0.42);
  border-radius: 50%;
  pointer-events: none;
}

.rank-coordinate,
.file-coordinate {
  position: absolute;
  z-index: 5;
  color: rgba(11, 17, 21, 0.62);
  font-size: clamp(7px, 0.8vw, 11px);
  font-weight: 780;
  line-height: 1;
  pointer-events: none;
}

.rank-coordinate {
  top: 4px;
  left: 4px;
}

.file-coordinate {
  right: 4px;
  bottom: 3px;
}

.board-square--dark .rank-coordinate,
.board-square--dark .file-coordinate {
  color: rgba(230, 234, 236, 0.58);
}

.board-arrows {
  position: absolute;
  z-index: 8;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board-arrow-line {
  stroke: var(--board-arrow);
  stroke-width: 0.16;
  stroke-linecap: round;
}

.board-arrow-head {
  fill: var(--board-arrow);
}

.board-error {
  position: absolute;
  z-index: 9;
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 8px;
  border: 1px solid rgba(228, 92, 103, 0.5);
  border-radius: 7px;
  background: rgba(20, 8, 10, 0.92);
  color: #f09aa3;
  font-size: 10px;
  text-align: center;
}

.chess-board.high-contrast {
  border: 2px solid #fff;
}

.chess-board.high-contrast .legal-dot {
  background: #101810;
  box-shadow: 0 0 0 2px #fff;
}

.game-status-banner {
  position: absolute;
  z-index: 20;
  top: 8px;
  left: 50%;
  max-width: calc(100% - 20px);
  min-height: 28px;
  padding: 6px 10px;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(8, 14, 19, 0.8);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  color: #e8ecef;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(9px);
}

.game-sidebar {
  min-height: 0;
  display: grid;
  grid-template-rows: 43px minmax(0, 1fr) auto;
}

.game-sidebar-tabs {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.game-sidebar-tabs button,
.analysis-tabs button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--chess-text-muted);
  font-size: 10px;
  font-weight: 650;
}

.game-sidebar-tabs button:hover,
.game-sidebar-tabs button:focus-visible,
.analysis-tabs button:hover,
.analysis-tabs button:focus-visible {
  color: var(--chess-text);
}

.game-sidebar-tabs button.is-selected,
.analysis-tabs button.is-selected {
  border-color: rgba(112, 104, 244, 0.2);
  background: rgba(112, 104, 244, 0.13);
  color: #bbb7ff;
}

.game-sidebar-content {
  min-height: 0;
  overflow: auto;
}

.move-list {
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 1px;
}

.move-pair {
  min-height: 30px;
  display: grid;
  grid-template-columns: 30px repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
}

.move-number {
  padding-left: 5px;
  color: var(--chess-text-faint);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.move-cell {
  min-height: 27px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--chess-text-secondary);
  font-size: 10px;
  font-weight: 620;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-cell:not(:disabled):hover,
.move-cell:not(:disabled):focus-visible,
.move-cell.is-current {
  border-color: var(--chess-border-subtle);
  background: var(--chess-control);
  color: var(--chess-text);
}

.move-cell:disabled {
  cursor: default;
  opacity: 1;
}

.move-inaccuracy {
  color: #e6bd64;
}

.move-mistake {
  color: #eb9b5e;
}

.move-blunder {
  color: #ee7781;
}

.game-actions {
  min-height: 46px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  border-top: 1px solid var(--chess-border-subtle);
}

.game-actions .chess-button {
  min-width: 0;
  min-height: 34px;
  padding: 0 5px;
  gap: 4px;
  font-size: 9px;
}

.game-chat {
  min-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-messages {
  min-height: 0;
  max-height: 100%;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: auto;
}

.chat-message {
  padding: 7px 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
}

.chat-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-message strong {
  font-size: 9px;
}

.chat-message time {
  color: var(--chess-text-faint);
  font-size: 8px;
}

.chat-message p {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--chess-text-secondary);
  font-size: 10px;
}

.chat-composer {
  padding: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 5px;
  border-top: 1px solid var(--chess-border-subtle);
}

.chat-composer input {
  min-height: 36px;
}

.chat-composer .chess-button {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
}

.game-info {
  padding: 10px;
}

.game-info-list {
  margin: 0;
  display: grid;
}

.game-info-list > div {
  min-height: 34px;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.game-info-list dt {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.game-info-list dd {
  margin: 0;
  overflow: hidden;
  color: var(--chess-text-secondary);
  font-size: 10px;
  text-overflow: ellipsis;
}

.privacy-note {
  margin: 12px 0 0;
  color: var(--chess-text-faint);
  font-size: 9px;
}

.mobile-game-actions {
  display: none;
}

.game-more-menu {
  display: grid;
  gap: 8px;
}

.game-more-menu > .chess-button {
  width: 100%;
  justify-content: flex-start;
}

.coordinate-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.promotion-modal {
  width: min(480px, calc(100vw - 24px));
}

.promotion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.promotion-choice {
  min-height: 126px;
  padding: 8px;
  display: grid;
  justify-items: center;
  gap: 4px;
  border: 1px solid var(--chess-border);
  border-radius: 9px;
  background: var(--chess-card-secondary);
  color: var(--chess-text);
}

.promotion-choice:hover,
.promotion-choice:focus-visible {
  border-color: var(--chess-purple);
  background: rgba(112, 104, 244, 0.1);
}

.promotion-choice .chess-piece {
  width: 76px;
  height: 76px;
}

.promotion-choice span {
  font-size: 10px;
  font-weight: 650;
}

.invite-page {
  display: grid;
  place-items: center;
}

.invite-route-card {
  width: min(540px, 100%);
  min-height: 440px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.invite-route-card h1,
.invite-route-card p,
.invite-route-card blockquote {
  margin: 0;
}

.invite-route-card > p:not(.section-kicker):not(.privacy-note) {
  max-width: 48ch;
  color: var(--chess-text-secondary);
}

.invite-lock {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(112, 104, 244, 0.2);
  border-radius: 50%;
  background: rgba(112, 104, 244, 0.09);
  color: #aaa5ff;
}

.invite-challenger {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.invite-details {
  width: min(100%, 420px);
}

.invite-route-card .form-field {
  width: min(100%, 420px);
  text-align: left;
}

.invite-route-card blockquote {
  max-width: 420px;
  padding: 10px 12px;
  border-left: 3px solid var(--chess-purple);
  color: var(--chess-text-secondary);
  background: rgba(112, 104, 244, 0.05);
  font-size: 11px;
}

.invite-actions {
  display: flex;
  gap: 8px;
}

/* Tables, leaderboards, history */
.pool-disclaimer {
  margin: -4px 0 12px;
  color: var(--chess-text-muted);
  font-size: 10px;
}

.leaderboard-main-card > .card-body {
  display: grid;
  gap: 9px;
}

.leaderboard-table-root,
.history-results {
  min-width: 0;
}

.table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--chess-text-secondary);
  font-size: 11px;
}

.data-table th,
.data-table td {
  min-height: 44px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--chess-border-subtle);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--chess-text-muted);
  background: rgba(255, 255, 255, 0.018);
  font-size: 9px;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.data-table tbody tr.is-current-user {
  background: rgba(112, 104, 244, 0.08);
  box-shadow: inset 3px 0 0 var(--chess-purple);
}

.data-table a:not(.chess-button) {
  color: var(--chess-text);
  font-weight: 650;
  text-decoration: none;
}

.data-table small {
  display: block;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.player-cell {
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-cell > span:last-child {
  min-width: 0;
  display: grid;
}

.rank-cell,
.rating-cell {
  color: var(--chess-text);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.status-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chess-text-faint);
}

.status-label--online {
  color: #84dcb9;
}

.status-label--online i {
  background: var(--chess-green);
}

.load-more-row {
  padding: 12px;
  display: flex;
  justify-content: center;
}

.history-filter-card {
  margin-bottom: 12px;
}

.history-filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 9px;
  align-items: end;
}

.history-filter-actions {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-results {
  overflow: hidden;
  border: 1px solid var(--chess-border-subtle);
  border-radius: var(--radius-card);
  background: var(--chess-card);
}

.history-players-cell {
  min-width: 170px;
}

.history-players-cell > span {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
}

.history-players-cell > span + span {
  margin-top: 4px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Profile */
.profile-content {
  display: grid;
  gap: 10px;
}

.profile-hero {
  min-height: 126px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-identity > div {
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-name-row h1 {
  margin: 0;
  font-size: 22px;
}

.online-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #7edab5;
  font-size: 9px;
}

.online-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chess-green);
}

.profile-badge {
  padding: 3px 6px;
  border: 1px solid rgba(87, 153, 230, 0.24);
  border-radius: 999px;
  background: rgba(87, 153, 230, 0.09);
  color: #8dbbe9;
  font-size: 8px;
  font-weight: 700;
}

.profile-badge--admin {
  border-color: rgba(112, 104, 244, 0.25);
  background: rgba(112, 104, 244, 0.1);
  color: #b5b1ff;
}

.profile-status {
  margin: 4px 0 0;
  color: var(--chess-text-secondary);
  font-size: 11px;
}

.profile-joined {
  margin: 2px 0 0;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.profile-actions {
  display: flex;
  gap: 7px;
}

.profile-rating-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.profile-rating-card {
  min-height: 104px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 2px;
}

.profile-rating-card > span {
  color: var(--chess-text-secondary);
  font-size: 10px;
}

.profile-rating-card > strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.profile-rating-card small {
  font-size: 9px;
}

.profile-stats,
.profile-extra-stats {
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}

.profile-stat {
  min-height: 62px;
  padding: 7px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border-right: 1px solid var(--chess-border-subtle);
  text-align: center;
}

.profile-stat:last-child {
  border-right: 0;
}

.profile-stat span {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.profile-stat strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.profile-stat--positive strong {
  color: #5dd5a8;
}

.profile-stat--danger strong {
  color: #ec7a84;
}

.profile-chart-card > .card-body {
  display: grid;
  gap: 9px;
}

.card-header select {
  width: auto;
  min-width: 142px;
  min-height: 32px;
  padding-block: 4px;
}

.rating-chart {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.rating-chart svg {
  width: 100%;
  height: 220px;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.055);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-axis-label {
  fill: var(--chess-text-faint);
  font-size: 9px;
}

.rating-chart-area {
  fill: rgba(112, 104, 244, 0.075);
  stroke: none;
}

.rating-chart-line {
  fill: none;
  stroke: #817af8;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.rating-chart-dot {
  fill: #9e99ff;
  stroke: var(--chess-card);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chart-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--chess-text-muted);
  font-size: 11px;
  text-align: center;
}

.profile-games-table td:first-child {
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Analysis */
.analysis-page {
  max-width: 1440px;
}

.analysis-layout {
  min-height: calc(100dvh - 140px);
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(520px, 1.1fr);
  align-items: start;
  gap: 10px;
}

.analysis-panel {
  min-height: min(760px, calc(100dvh - 140px));
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
}

.analysis-tabs {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.analysis-panel-content {
  min-height: 0;
  padding: 12px;
  overflow: auto;
}

.analysis-board-panel {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.analysis-board-row {
  width: min(100%, calc(100dvh - 215px));
  max-width: 760px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
}

.evaluation-bar {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--chess-border);
  border-radius: 5px;
  background: #11161b;
}

.evaluation-bar__black {
  position: absolute;
  inset: 0;
  background: #171b1f;
}

.evaluation-bar__white {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 50%;
  background: #e8ebed;
  transition: height 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.evaluation-bar__label {
  position: absolute;
  z-index: 2;
  right: 50%;
  bottom: 4px;
  transform: rotate(-90deg) translateY(50%);
  transform-origin: right bottom;
  color: #f3f4f5;
  font-size: 8px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  mix-blend-mode: difference;
}

.analysis-navigation {
  width: min(100%, calc(100dvh - 215px));
  max-width: 760px;
  min-height: 42px;
  margin: 0 auto;
  padding-left: 33px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.analysis-navigation .chess-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
}

.navigation-spacer {
  flex: 1;
}

.analysis-position-meta {
  width: min(100%, calc(100dvh - 215px));
  max-width: 760px;
  margin: 0 auto;
  padding-left: 33px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--chess-text-muted);
  font-size: 10px;
}

.analysis-position-meta strong {
  color: var(--chess-text-secondary);
}

.review-content {
  display: grid;
  gap: 12px;
}

.analysis-toolbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.evaluation-readout {
  display: grid;
}

.evaluation-readout strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.evaluation-readout span {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.engine-meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.engine-meta > div {
  min-width: 70px;
  padding: 5px 7px;
  display: grid;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 6px;
}

.engine-meta dt {
  color: var(--chess-text-faint);
  font-size: 8px;
}

.engine-meta dd {
  margin: 0;
  color: var(--chess-text-secondary);
  font-size: 9px;
}

.evaluation-graph {
  position: relative;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: #0a1118;
}

.evaluation-graph svg {
  width: 100%;
  height: 190px;
  cursor: crosshair;
}

.evaluation-graph__white-zone {
  fill: rgba(231, 235, 238, 0.045);
}

.evaluation-graph__black-zone {
  fill: rgba(0, 0, 0, 0.13);
}

.evaluation-graph__zero {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.evaluation-graph__line {
  fill: none;
  stroke: #c8cbd0;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.evaluation-graph__selected {
  stroke: var(--chess-green);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.evaluation-graph__selected-dot {
  fill: var(--chess-green);
  stroke: #0b1218;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.evaluation-graph__marker {
  stroke: #0b1218;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.evaluation-graph__marker.is-inaccuracy {
  fill: var(--chess-amber);
}

.evaluation-graph__marker.is-mistake,
.evaluation-graph__marker.is-missed-win {
  fill: var(--chess-orange);
}

.evaluation-graph__marker.is-blunder {
  fill: var(--chess-red);
}

.evaluation-graph__tooltip {
  position: absolute;
  right: 7px;
  bottom: 5px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(6, 11, 16, 0.76);
  color: var(--chess-text-secondary);
  font-size: 8px;
  pointer-events: none;
}

.analysis-text-summary {
  padding: 7px 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 6px;
  color: var(--chess-text-muted);
  background: rgba(255, 255, 255, 0.015);
  font-size: 9px;
}

.analysis-text-summary p {
  margin: 0;
}

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

.accuracy-card {
  min-height: 70px;
  padding: 8px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: var(--chess-card-secondary);
}

.accuracy-card span:first-child {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.accuracy-card strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.accuracy-meter {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.accuracy-meter i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--chess-purple);
}

.accuracy-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--chess-text-faint);
  font-size: 8px;
}

.move-summary {
  overflow: hidden;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
}

.move-summary-heading,
.quality-row {
  min-height: 30px;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 55px 55px;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid var(--chess-border-subtle);
  font-size: 9px;
}

.move-summary-heading {
  color: var(--chess-text-muted);
  background: rgba(255, 255, 255, 0.025);
}

.quality-row:last-child {
  border-bottom: 0;
}

.quality-row strong {
  text-align: center;
}

.quality-row--inaccuracy strong {
  color: var(--chess-amber);
}

.quality-row--mistake strong,
.quality-row--missed-win strong {
  color: var(--chess-orange);
}

.quality-row--blunder strong {
  color: var(--chess-red);
}

.current-move-comment {
  min-height: 64px;
  padding: 9px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.018);
}

.current-move-comment strong {
  font-size: 10px;
}

.current-move-comment p {
  margin: 3px 0 0;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.quality-inaccuracy {
  color: var(--chess-amber);
}

.quality-mistake,
.quality-missed-win {
  color: var(--chess-orange);
}

.quality-blunder {
  color: var(--chess-red);
}

.analysis-state {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
}

.analysis-state h2,
.analysis-state p {
  margin: 0;
}

.analysis-state h2 {
  font-size: 15px;
}

.analysis-state p {
  color: var(--chess-text-muted);
  font-size: 10px;
}

.analysis-state progress {
  width: min(100%, 320px);
  height: 6px;
  accent-color: var(--chess-purple);
}

.analysis-detail-content {
  display: grid;
  gap: 10px;
}

.analysis-detail-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.analysis-detail-grid > div {
  min-height: 50px;
  padding: 7px;
  display: grid;
  align-content: center;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: var(--chess-card-secondary);
}

.analysis-detail-grid dt {
  color: var(--chess-text-muted);
  font-size: 8px;
}

.analysis-detail-grid dd {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.principal-variation,
.position-data {
  padding: 9px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.018);
}

.principal-variation h3,
.principal-variation p,
.position-data h3 {
  margin: 0;
}

.principal-variation h3,
.position-data h3 {
  color: var(--chess-text-secondary);
  font-size: 10px;
}

.principal-variation p {
  margin-top: 4px;
  color: var(--chess-text-muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  line-height: 1.65;
}

.position-data code {
  margin: 6px 0;
  padding: 7px;
  display: block;
  overflow: auto;
  border-radius: 5px;
  color: var(--chess-text-secondary);
  background: #070d13;
  font-size: 8px;
  white-space: nowrap;
}

.opening-review {
  min-height: 320px;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 7px;
}

.opening-eco {
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(112, 104, 244, 0.13);
  color: #b2aeff;
  font-size: 9px;
  font-weight: 700;
}

.opening-review h2,
.opening-review p {
  margin: 0;
}

.opening-review h2 {
  font-size: 17px;
}

.opening-review p {
  color: var(--chess-text-secondary);
  font-size: 10px;
}

/* Settings and content */
.settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-group {
  margin: 0;
  padding: 0;
}

.settings-group legend {
  width: 100%;
  padding: 12px;
  display: grid;
  border-bottom: 1px solid var(--chess-border-subtle);
}

.settings-group legend strong {
  font-size: 13px;
}

.settings-group legend small {
  margin-top: 2px;
  color: var(--chess-text-muted);
  font-size: 9px;
}

.settings-grid {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.settings-footer {
  grid-column: 1 / -1;
  min-height: 74px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: var(--radius-card);
  background: var(--chess-card);
}

.settings-footer > div {
  display: grid;
}

.settings-footer strong {
  font-size: 11px;
}

.settings-footer small {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.settings-save-status {
  margin: 0 0 0 auto;
  color: var(--chess-text-muted);
  font-size: 10px;
}

.content-page {
  max-width: 1140px;
}

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

.content-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-prose-card {
  padding: 18px;
}

.content-prose-card h2,
.content-prose-card h3,
.content-prose-card p {
  margin-top: 0;
}

.content-prose-card h2 {
  font-size: 16px;
}

.content-prose-card p {
  color: var(--chess-text-secondary);
  font-size: 11px;
  line-height: 1.65;
}

.content-prose-card a {
  color: #a8a3ff;
}

.check-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px;
  color: var(--chess-text-secondary);
  font-size: 11px;
}

.check-list .ui-icon {
  margin-top: 1px;
  color: var(--chess-green);
}

.fair-play-page .content-prose-card:first-child {
  grid-row: span 2;
}

.about-hero {
  min-height: 160px;
  margin-bottom: 10px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.about-hero .brand-mark {
  width: 90px;
  height: 90px;
}

.about-hero .brand-mark .chess-piece {
  width: 90px;
  height: 90px;
}

.about-hero h2,
.about-hero p {
  margin: 0;
}

.about-hero h2 {
  font-size: 22px;
}

.about-hero p {
  max-width: 70ch;
  margin-top: 5px;
  color: var(--chess-text-secondary);
  font-size: 12px;
}

.about-feature {
  min-height: 145px;
  padding: 16px;
}

.about-feature > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #aaa5ff;
  background: rgba(112, 104, 244, 0.09);
}

.about-feature h3 {
  margin: 11px 0 4px;
  font-size: 13px;
}

.about-feature p {
  margin: 0;
  color: var(--chess-text-muted);
  font-size: 10px;
}

.about-page > .content-prose-card {
  margin-top: 10px;
}

.licence-details {
  min-height: 54px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 8px;
  background: var(--chess-card-secondary);
}

.inline-definition-list {
  margin: 0;
}

/* Admin */
.admin-content {
  display: grid;
  gap: 10px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.admin-stat {
  min-height: 82px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.admin-stat > span,
.admin-result-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--chess-control);
  color: #aaa5ff;
}

.admin-stat > div {
  min-width: 0;
  display: grid;
}

.admin-stat small {
  color: var(--chess-text-muted);
  font-size: 8px;
}

.admin-stat strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.admin-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.admin-search-results {
  margin-top: 9px;
  display: grid;
  gap: 5px;
}

.admin-result-row {
  min-height: 58px;
  padding: 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--chess-border-subtle);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.018);
}

.admin-result-row > div {
  min-width: 0;
  display: grid;
}

.admin-result-row strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
}

.admin-result-row small,
.admin-result-row time {
  color: var(--chess-text-muted);
  font-size: 9px;
}

.admin-job-list {
  display: grid;
  gap: 5px;
}

.admin-action-form {
  display: grid;
  gap: 10px;
}

.noscript-state {
  width: min(540px, calc(100% - 32px));
  margin: 80px auto;
  padding: 24px;
  border: 1px solid var(--chess-border);
  border-radius: var(--radius-card);
  background: var(--chess-card);
}

/* Responsive layout */
@media (max-width: 1220px) {
  .reliability-strip {
    grid-template-columns: 1fr;
  }

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

  .play-layout {
    grid-template-columns: 42px minmax(0, 1fr) minmax(270px, 310px);
  }

  .analysis-layout {
    grid-template-columns: minmax(320px, 0.85fr) minmax(470px, 1.15fr);
  }
}

@media (max-width: 1040px) {
  .chess-primary-nav > .chess-nav-link:nth-of-type(3),
  .chess-primary-nav > .chess-nav-link:nth-of-type(5) {
    display: none;
  }

  .hero-card > .card-body {
    grid-template-columns: minmax(0, 1fr) 240px;
  }

  .dashboard-three-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-game-card {
    grid-row: span 2;
  }

  .dashboard-three-up > .chess-card {
    min-height: 230px;
  }

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

  .history-filter-form {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .analysis-layout {
    grid-template-columns: 1fr;
  }

  .analysis-panel {
    min-height: 540px;
    order: 2;
  }

  .analysis-board-panel {
    order: 1;
  }

  .analysis-board-row,
  .analysis-navigation,
  .analysis-position-meta {
    width: min(100%, 680px);
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 52px;
  }

  body {
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }

  .chess-header-inner {
    padding-inline: 10px;
  }

  .brand-copy strong {
    font-size: 13px;
  }

  .brand-copy small {
    display: none;
  }

  .chess-primary-nav {
    display: none;
  }

  .user-menu-name {
    display: none;
  }

  .chess-main {
    padding: 12px 10px 32px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 500;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 8px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    border-top: 1px solid var(--chess-border);
    background: rgba(9, 17, 25, 0.97);
    backdrop-filter: blur(14px);
  }

  .mobile-nav .chess-nav-link {
    min-height: 50px;
    padding: 4px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 9px;
  }

  .mobile-nav .chess-nav-link.is-current {
    color: #b9b5ff;
    background: rgba(112, 104, 244, 0.09);
  }

  .hero-card > .card-body {
    grid-template-columns: 1fr;
  }

  .live-stat-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .live-stat {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .live-stat-icon {
    width: 27px;
    height: 27px;
  }

  .rating-card-grid,
  .profile-rating-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .play-layout {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .game-rail {
    display: none;
  }

  .game-stage {
    width: 100%;
    grid-template-rows: 45px auto 45px auto;
  }

  .player-bar,
  .board-area {
    width: min(100%, calc(100dvh - 218px));
    max-width: calc(100vw - 20px);
  }

  .game-sidebar {
    min-height: 310px;
    max-height: 56vh;
  }

  .game-actions {
    display: none;
  }

  .mobile-game-actions {
    width: min(100%, calc(100dvh - 218px));
    max-width: calc(100vw - 20px);
    padding: 5px 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .mobile-game-actions .chess-button {
    min-height: 44px;
    padding: 3px;
    flex-direction: column;
    gap: 2px;
    border-color: var(--chess-border-subtle);
    background: var(--chess-card);
    color: var(--chess-text-muted);
    font-size: 9px;
  }

  .mobile-game-actions .chess-button.is-selected {
    color: #b8b4ff;
    background: rgba(112, 104, 244, 0.1);
  }

  .live-game-page {
    padding-top: 4px;
  }

  .toast-region {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .profile-stats,
  .profile-extra-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-stat:nth-child(3) {
    border-right: 0;
  }

  .content-grid,
  .content-grid--three {
    grid-template-columns: 1fr;
  }

  .fair-play-page .content-prose-card:first-child {
    grid-row: auto;
  }

  .admin-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading-actions {
    width: 100%;
  }

  .page-heading-actions .chess-button {
    flex: 1;
  }

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

  .featured-game-card {
    grid-row: auto;
  }

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

  .hero-card > .card-body {
    min-height: 0;
    padding: 15px;
  }

  .hero-actions {
    grid-template-columns: 1fr;
  }

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

  .reliability-items {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-actions {
    width: 100%;
  }

  .profile-actions .chess-button {
    flex: 1;
  }

  .profile-stats,
  .profile-extra-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-stat:nth-child(odd) {
    border-right: 1px solid var(--chess-border-subtle);
  }

  .profile-stat:nth-child(even),
  .profile-stat:last-child {
    border-right: 0;
  }

  .history-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .settings-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-save-status {
    margin: 0;
  }

  .analysis-panel {
    min-height: 600px;
  }

  .analysis-board-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .analysis-navigation,
  .analysis-position-meta {
    padding-left: 27px;
  }

  .analysis-navigation .chess-button {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
  }

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

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

@media (max-width: 520px) {
  .chess-header-tools .connection-pill span:last-child {
    display: none;
  }

  .chess-header-tools .login-button {
    min-width: auto;
    padding-inline: 9px;
  }

  .chess-main {
    padding-inline: 8px;
  }

  .hero-copy h1 {
    font-size: 22px;
  }

  .history-preview-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px;
  }

  .history-preview-row > span:nth-child(4),
  .history-preview-row > time {
    display: none;
  }

  .reliability-strip {
    padding: 12px;
  }

  .form-grid--two,
  .custom-time-fields,
  .private-game-options,
  .matchmaking-options,
  .compact-fieldset {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .modal-panel {
    max-height: calc(100dvh - 12px);
  }

  .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-actions > .chess-button {
    width: 100%;
  }

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

  .promotion-choice {
    min-height: 104px;
  }

  .promotion-choice .chess-piece {
    width: 60px;
    height: 60px;
  }

  .player-bar,
  .board-area,
  .mobile-game-actions {
    width: calc(100vw - 16px);
    max-width: none;
  }

  .player-bar {
    padding-inline: 3px;
  }

  .player-bar-name a,
  .player-bar-name > span {
    max-width: 19ch;
  }

  .game-clock {
    min-width: 74px;
    font-size: 17px;
  }

  .game-status-banner {
    top: 5px;
    font-size: 8px;
  }

  .game-sidebar {
    border-radius: 8px;
  }

  .profile-identity {
    align-items: flex-start;
  }

  .profile-name-row h1 {
    font-size: 19px;
  }

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

  .profile-rating-card {
    min-height: 92px;
  }

  .rating-chart,
  .rating-chart svg {
    min-height: 180px;
    height: 180px;
  }

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

  .history-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .data-table {
    font-size: 10px;
  }

  .data-table th,
  .data-table td {
    padding: 8px;
  }

  .analysis-page > .page-heading {
    margin-bottom: 8px;
  }

  .analysis-page > .page-heading p {
    display: none;
  }

  .analysis-layout {
    gap: 7px;
  }

  .analysis-panel {
    min-height: 560px;
  }

  .analysis-panel-content {
    padding: 8px;
  }

  .analysis-board-row {
    width: 100%;
  }

  .analysis-navigation,
  .analysis-position-meta {
    width: 100%;
  }

  .analysis-navigation {
    gap: 2px;
  }

  .analysis-navigation .navigation-spacer {
    display: none;
  }

  .analysis-position-meta {
    font-size: 9px;
  }

  .analysis-toolbar {
    align-items: flex-start;
  }

  .engine-meta {
    gap: 3px;
  }

  .engine-meta > div {
    min-width: 58px;
  }

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

  .accuracy-note {
    grid-column: auto;
  }

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

  .about-hero {
    padding: 18px;
    align-items: flex-start;
  }

  .about-hero .brand-mark,
  .about-hero .brand-mark .chess-piece {
    width: 56px;
    height: 56px;
  }

  .queue-details,
  .invite-details,
  .inline-definition-list {
    grid-template-columns: 1fr;
  }

  .invite-route-card {
    min-height: 0;
    padding: 20px 14px;
  }

  .admin-stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 980px) {
  :root {
    --header-height: 44px;
  }

  body {
    padding-bottom: 0;
  }

  .chess-header {
    height: var(--header-height);
  }

  .mobile-nav {
    display: none;
  }

  .live-game-page {
    padding: 3px 6px;
  }

  .play-layout {
    height: calc(100dvh - var(--header-height) - 6px);
    grid-template-columns: minmax(0, 1fr) minmax(240px, 310px);
    align-items: stretch;
  }

  .game-stage {
    grid-template-rows: 34px minmax(0, 1fr) 34px;
  }

  .player-bar,
  .board-area {
    width: min(100%, calc(100dvh - var(--header-height) - 74px));
    max-width: none;
  }

  .player-bar {
    min-height: 32px;
  }

  .player-bar .player-avatar {
    width: 26px;
    height: 26px;
  }

  .game-clock {
    height: 29px;
    min-width: 68px;
    font-size: 15px;
  }

  .mobile-game-actions {
    display: none;
  }

  .game-sidebar {
    min-height: 0;
    max-height: none;
  }

  .game-actions {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html.chess-reduced-motion *,
html.chess-reduced-motion *::before,
html.chess-reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media print {
  .chess-header,
  .mobile-nav,
  .game-rail,
  .game-actions,
  .mobile-game-actions,
  .analysis-navigation,
  .toast-region {
    display: none !important;
  }

  body,
  .chess-main {
    background: #fff !important;
    color: #111 !important;
  }
}
