:root {
  --accent: #4457ff;
  --ink: #1c1e4a;
  --muted: #4c5278;
  --spacing: 0;
  font-family: 'Space Grotesk', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: rgba(236, 239, 255, 0.92);
  background: #080c1c;
}
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.2rem, 3vh, 2rem) clamp(1rem, 4vw, 1.6rem);
  color: rgba(236, 239, 255, 0.92);
  background:
    radial-gradient(circle at 18% -10%, rgba(24, 30, 54, 0.85), rgba(16, 22, 44, 0.92) 45%, rgba(10, 14, 28, 0.98)),
    linear-gradient(190deg, rgba(10, 14, 30, 0.95), rgba(6, 9, 20, 0.98));
}
body > main {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 900px;
}
.is-dragging-piece,
.is-dragging-piece * {
  cursor: grabbing !important;
}
main {
  display: flex;
  justify-content: center;
  width: 100%;
}
.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(20, 26, 60, 0.6), rgba(10, 12, 36, 0.6)),
    url('/static/public/banner_knight.webp') center/cover no-repeat;
  box-shadow: 0 18px 42px rgba(24, 34, 88, 0.26);
  display: flex;
  flex-direction: column;

  max-width: 100%;
  padding: clamp(1.8rem, 3vh, 2.6rem);
  margin: 0;
  isolation: isolate;
}
.lobby-hero {
  width: 100%;
  margin-inline: auto;
  padding: clamp(1.6rem, 3vw, 2.4rem);
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(8, 12, 28, 0.75), rgba(8, 10, 24, 0.45));
  pointer-events: none;
  border-radius: inherit;
  z-index: -1;
}
.hero-lede {
    color: rgba(189, 195, 234, 0.8);
    font-size: 0.95rem;
    line-height: 1.45;
    margin: 0;
    text-align: center;
}
ul.hero-lede li {
    list-style:none;
}
.atomic-tooltip {
  position: relative;
  display: inline-block;
  margin: 0 0.25rem;
  white-space: nowrap;
}
.atomic-word {
  border-bottom: 1px dashed rgba(236, 239, 255, 0.6);
}
.atomic-trigger {
  display: inline-flex;
  align-items: baseline;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: inherit;
  transition: border 0.2s ease, background 0.2s ease;
}
.atomic-trigger:focus-visible {
  outline: 2px solid rgba(127, 84, 255, 0.75);
  outline-offset: 2px;
}
.atomic-trigger:hover .atomic-word,
.atomic-trigger:focus-visible .atomic-word {
  border-bottom-color: rgba(236, 239, 255, 0.9);
}
.atomic-popup {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 50%;
  transform: translate(-50%, -10px);
  background: rgba(8, 12, 28, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  width: min(240px, 70vw);
  box-shadow: 0 12px 28px rgba(15, 19, 40, 0.45);
  font-size: 0.85rem;
  line-height: 1.3;
  color: rgba(236, 239, 255, 0.92);
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 10;
}
.atomic-popup::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid rgba(99, 102, 241, 0.45);
  border-top: 1px solid rgba(99, 102, 241, 0.45);
  transform: translateX(-50%) rotate(45deg);
}
.atomic-tooltip:focus-within .atomic-popup,
.atomic-tooltip:hover .atomic-popup {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
@media (max-width: 640px) {
  .hero-lede li {
    position: relative;
  }
  .atomic-tooltip {
    position: static;
    display: inline-block;
  }
  .atomic-popup {
    left: 50%;
    right: auto;
    width: min(280px, calc(100vw - 32px));
    transform: translate(-50%, -10px);
  }
  .atomic-popup::after {
    display: none;
  }
  .atomic-tooltip:focus-within .atomic-popup,
  .atomic-tooltip:hover .atomic-popup {
    transform: translate(-50%, 0);
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(68, 87, 255, 0.25);
  color: rgba(236, 239, 255, 0.96);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
  width: fit-content;
  height: 36px;
}
.brand-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.accent-text {
  color: rgba(140, 162, 255, 0.95);
}
.social-links {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.social-links a {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: rgba(18, 22, 52, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(236, 239, 255, 0.86);
  text-decoration: none;
  transition: background 0.2s ease;
}
.social-links a:hover {
  background: rgba(88, 104, 255, 0.75);
}
.social-links img {
  width: 1.05rem;
  height: 1.05rem;
  object-fit: contain;
  filter: brightness(0) invert(0.9);
}
.social-links svg {
    width: 1.2rem;
    height: 1.2rem;
}
.board-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0;
}
.status-banner {
  display: none;
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: rgba(15, 19, 48, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: rgba(248, 250, 252, 0.9);
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(10, 12, 32, 0.35);
}
.status-banner.is-visible {
  display: block;
}
.status-banner.is-error {
  border-color: rgba(248, 113, 113, 0.6);
  background: rgba(127, 29, 29, 0.6);
  color: #fee2e2;
}
.board-region {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  justify-content: center;
}
.board-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  flex: 1 1 0;
  max-width: 100%;
  min-width: 0;
}
.board-stack .player-chip[data-player="black"] {
  order: 0;
}
.board-stack .board-wrapper {
  order: 1;
}
.board-stack .player-chip[data-player="white"] {
  order: 2;
}
.board-stack.is-flipped .player-chip[data-player="white"] {
  order: 0;
}
.board-stack.is-flipped .board-wrapper {
  order: 1;
}
.board-stack.is-flipped .player-chip[data-player="black"] {
  order: 2;
}
.move-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 260px;
  flex: 0 0 260px;
  gap: 1rem;
}
.move-column .move-list {
  flex: 1;
}
.card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.6rem;
}
.card-actions .pill-button {
  margin-left: 0.5rem;
}
.lobby-content {
  padding: 0;
  color: rgba(226, 232, 240, 0.92);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: left;
  max-width: 34rem;
  position: relative;
}
.lobby-content h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  align-self: center;
}
.lobby-topline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  position: absolute;
  top: 1em;
  right: 1em;
  justify-content: flex-end;
  text-align: right;
}
.lobby-eyebrow {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: rgba(248, 250, 252, 0.7);
}
.pill-burst {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.6);
  background: linear-gradient(120deg, rgba(68, 87, 255, 0.45), rgba(127, 84, 255, 0.45));
  color: #f8f9ff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.lobby-highlights {
  margin: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: rgba(226, 232, 240, 0.8);
}
.lobby-highlights li {
  list-style: none;
  position: relative;
  padding-left: 1.4rem;
  line-height: 1.35;
}
.lobby-highlights li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: #fbbf24;
  font-size: 0.75rem;
  top: 0.1rem;
}
.lobby-highlights.icon-list li {
  padding-left: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.lobby-highlights.icon-list li::before {
  display: none;
}
.feature-icon {
  font-size: 1.3rem;
  line-height: 1;
  width: 1.8rem;
  display: inline-flex;
  justify-content: center;
}
.feature-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.feature-title {
  font-weight: 600;
  letter-spacing: 0.03em;
}
.feature-text {
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.92rem;
}
.lobby-highlights.accent-list li {
  padding-left: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}
.lobby-highlights.accent-list li::before {
  color: rgba(99, 102, 241, 0.75);
  font-size: 0.7rem;
}
.lobby-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 0.5rem;
}
.lobby-grid .lobby-cta {
  margin-top: 0;
}
.lobby-grid p {
  margin-top: 0.35rem;
}
.lobby-grid p:last-child {
  margin-bottom: 0;
}
.lobby-grid ul {
  margin-bottom: 0;
}
.lobby-grid,
.lobby-grid > * {
  width: 100%;
}
.lobby-grid .lobby-cta {
  align-self: start;
}
.lobby-grid .lobby-cta p {
  margin-bottom: 0.2rem;
}
.lobby-grid .lobby-cta p:last-child {
  margin-bottom: 0;
}
.lobby-grid .lobby-cta-title {
  margin-bottom: 0.25rem;
}
@media (min-width: 640px) {
  .lobby-grid {
    display: grid;
    gap: 1.4rem;
    align-items: start;
  }
}
.lobby-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
}
.lobby-cta-title {
  margin: 0;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.04em;
  color: rgba(248, 250, 252, 0.85);
}
.lobby-cta .social-links {
  margin-top: auto;
  align-self: center;
  justify-content: center;
  padding-top: 1em;
}
.lobby-cta p:last-child {
  margin-bottom: 0;
}
.pill-primary {
  background: linear-gradient(134deg, #5567ff, #7f54ff);
  border: none;
  color: #f8f9ff;
}
.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.5);
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.76rem;
  text-transform: none;
  letter-spacing: 0.04em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.player-chip.is-active {
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3);
}
.player-chip .player-handles {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.player-chip .player-handle {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.player-chip .player-handle-left {
  justify-content: flex-start;
}
.player-chip .player-handle-right {
  justify-content: flex-end;
}
.player-chip.has-teammate .player-handle {
  font-size: 0.72rem;
}
.player-chip .player-handle .player-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-chip .player-handle.is-active {
  border-color: rgba(74, 222, 128, 0.85);
  background: rgba(74, 222, 128, 0.18);
  color: #ecfccb;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}
.player-chip .player-handle.is-empty {
  display: none;
}
.player-clock {
  font-family: 'Space Grotesk', 'Segoe UI', monospace;
  font-weight: 600;
  letter-spacing: 0.08em;
  min-width: 68px;
  text-align: right;
  color: rgba(241, 245, 249, 0.9);
}
.player-clock.is-critical {
  color: #fecaca;
}
.player-chip.is-active .player-clock {
  color: #bef264;
}
.watch-hero {
  padding: clamp(1.6rem, 3vh, 2.4rem);
}
.watch-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.watch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.watch-header h1 {
  margin: 0;
  font-size: 1.4rem;
}
.watch-eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.6);
}
.watch-subtitle {
  margin: 0;
  color: rgba(226, 232, 240, 0.8);
}
.watch-empty {
  margin: 0.5rem 0 0;
  color: rgba(226, 232, 240, 0.7);
}
.profile-hero {
  padding: clamp(1.6rem, 3vh, 2.4rem);
}
.profile-panel {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.profile-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.profile-header h1 {
  margin: 0;
  font-size: 1.8rem;
}
.profile-header p {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
}
.stat-card {
  border-radius: 16px;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
}
.stat-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.6);
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 600;
  color: #f8fafc;
}
.profile-message {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.games-table-wrapper {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
}
.games-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.games-table td {
  padding: 0.85rem 1rem;
  text-align: left;
}
@media (max-width: 600px) {
  .games-table td {
    padding: 0.65rem 0 0.65rem 0.3rem;
  }
}
.games-table tbody tr {
  transition: background 0.2s ease;
}
.games-table tbody tr:not(:last-child) {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.games-table tbody tr:hover {
  background: rgba(251, 191, 36, 0.05);
}
.game-cell {
  vertical-align: middle;
}
.names-cell {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
  flex-direction: column;
  gap: 0.15rem;
}
.names-cell.is-active {
  color: #bef264;
}
.names-cell .player-line {
  line-height: 1.2;
}
.clock-cell {
  font-family: 'Space Grotesk', 'Segoe UI', monospace;
  color: rgba(226, 232, 240, 0.9);
}
.clock-pair {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.clock-value {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.85);
}
.clock-value.is-active {
  color: #bef264;
}
.move-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.3);
  flex: 1;
  min-height: 220px;
}
.move-list-header,
.move-row {
  display: grid;
  grid-template-columns: 1fr 3fr 3fr;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
}
.move-list-header {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.85);
}
.move-rows {
  overflow-y: auto;
  max-height: min(500px, 60vh);
  padding-right: 0.3rem;
  margin-right: -0.3rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
  scrollbar-gutter: stable both-edges;
}
.move-rows::-webkit-scrollbar {
  width: 4px;
}
.move-rows::-webkit-scrollbar-track {
  background: transparent;
}
.move-rows::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.45), rgba(99, 102, 241, 0.7));
  border-radius: 999px;
}
.move-rows::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.7), rgba(99, 102, 241, 0.9));
}
.move-row {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  color: rgba(226, 232, 240, 0.9);
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.move-row:last-child {
  border-bottom: none;
}
.score-line {
  text-align: center;
  padding: 0.6rem 0 0.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.9);
}
.pill-button {
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.5);
  color: rgba(226, 232, 240, 0.95);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.pill-button.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}
.pill-button.cta-highlight {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  border-color: rgba(251, 191, 36, 0.85);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(251, 191, 36, 0.35);
}
.pill-button.pill-icon {
  width: 2rem;
  height: 2rem;
  padding: 0.45rem;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pill-button .icon-eye {
  width: 1.25rem;
  height: 1.25rem;
}
.pill-button.pill-ghost {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.3);
}
.pill-button.pill-ghost:hover {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}
@media (hover: hover) and (pointer: fine) {
  .pill-button:hover {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    transform: translateY(-1px);
  }
}
.pill-button:active {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.18);
  transform: translateY(0);
  transition: background 0.05s ease, border-color 0.05s ease;
}
.pill-button:focus {
  outline: none;
}
.pill-button:focus-visible {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.25);
}
.board-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}
.promotion-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 20, 0.75);
  backdrop-filter: blur(3px);
  z-index: 10;
}
.promotion-body {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 220px;
  box-shadow: 0 18px 38px rgba(8, 12, 28, 0.4);
}
.promotion-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(40px, 1fr));
  gap: 0.4rem;
}
.promotion-option {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 12px;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.promotion-option:hover {
  border-color: #fbbf24;
  transform: translateY(-2px);
}
.promotion-option img {
  width: 36px;
  height: 36px;
  pointer-events: none;
}
.promotion-cancel {
  width: 100%;
  margin-top: 0.2rem;
}
.board {
  width: min(100%, 88vw, 432px);
  aspect-ratio: 1 / 1;
  --square-size: calc(100% / 8);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 0;
  border: 3px solid rgba(248, 249, 255, 0.9);
  border-radius: 12px;
  overflow: hidden;
  align-self: center;
  user-select: none;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.board.is-player-turn {
  border-color: rgba(74, 222, 128, 0.95);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.45);
}
.board.is-locked {
  opacity: 0.92;
}
.board.is-locked .square {
  cursor: not-allowed;
}
.board.is-finished {
  opacity: 0.45;
  filter: grayscale(0.25);
  box-shadow: none;
}
.board.is-finished .square {
  cursor: not-allowed;
}
.board-stack.is-finished .player-chip,
.player-chip.is-finished {
  opacity: 0.55;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: none;
}
.square {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--symbol-size);
  cursor: default;
  transition: background-color 120ms ease, transform 120ms ease;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  touch-action: none;
  padding: 0;
  line-height: 1;
  opacity: 1;
  position: relative;
}
.square.has-piece {
  cursor: grab;
}
.square.has-piece:active {
  cursor: grabbing;
  transform: none;
}
.square:focus,
.square:focus-visible {
  outline: none;
  box-shadow: none;
}
.square:active {
  transform: none;
  box-shadow: none;
}
.square:disabled {
  cursor: default;
}
.square.legal-target::after {
  content: "";
  position: absolute;
  width: 38%;
  height: 38%;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
  pointer-events: none;
}
.square.has-piece.legal-target::after {
  width: 78%;
  height: 78%;
  background: transparent;
  border: 3px solid rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}
.square.light {
  background-color: #f4f4f5;
  color: #0f172a;
}
.square.dark {
  background-color: #475569;
  color: #f8fafc;
}
.square.selected {
  outline: 3px solid #f59e0b;
  outline-offset: -3px;
}
.square.in-check {
  box-shadow: inset 0 0 0 3px rgba(248, 113, 113, 0.9);
}
.square.dragging,
.square.piece-hidden {
  opacity: 1;
  color: transparent;
}
.square.dragging .piece-image,
.square.piece-hidden .piece-image {
  opacity: 0;
}
.square.drag-over {
  outline: 3px dashed #38bdf8;
  outline-offset: -3px;
}
.drag-overlay {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}
.drag-overlay-symbol {
  font-size: var(--symbol-size);
  line-height: 1;
  pointer-events: none;
  color: currentColor;
}
.piece-image {
  width: var(--piece-size);
  height: var(--piece-size);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.35));
}
.action-row {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.primary {
  padding: 0.9rem 1.4rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(134deg, #5567ff, #7f54ff);
  color: #f8f9ff;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: 0 18px 36px rgba(90, 70, 255, 0.38);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 42px rgba(90, 70, 255, 0.45);
}
.loading-caption {
    margin-bottom: 0;
}
.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  background: rgba(10, 12, 28, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 3;
  color: rgba(236, 239, 255, 0.9);
  flex-direction: column;
  padding: 1.5rem;
  border-radius: inherit;
}
.loading-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}
.matchmaking-cancel {
  margin-top: 0.6rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: rgba(248, 250, 252, 0.92);
  font-weight: 600;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  width: 200px;
  max-width: 100%;
  text-align: center;
}
.matchmaking-cancel:hover,
.matchmaking-cancel:focus-visible {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(248, 250, 252, 0.6);
}
.trex-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.trex-wrapper canvas {
  width: min(320px, 100%);
  aspect-ratio: 8 / 3;
  height: auto;
  border-radius: 8px;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.6);
  background: linear-gradient(180deg, rgba(2, 6, 23, 1), rgba(15, 23, 42, 0.8));
}
.trex-hint {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(226, 232, 240, 0.75);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.trex-counter {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.spinner {
  width: 2.75rem;
  height: 2.75rem;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 3px solid rgba(236, 239, 255, 0.15);
  border-top-color: rgba(236, 239, 255, 0.85);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 900px) {
  .board-region {
    flex-direction: column;
    align-items: center;
  }
  .board-stack {
    width: 100%;
    align-items: center;
  }
  .move-column {
    display: none;
  }
}
@media (max-width: 700px) {
  body {
    padding: 2.2rem 1rem;
  }
  .hero-card {
    padding: 1.4rem;
  }
  .brand-floating {
    position: static;
    margin-bottom: 1rem;
    display: none;
    justify-content: center;
  }
  .hero-wrapper {
    width: 100%;
    margin-top:1.7rem;
  }
}
.hero-wrapper {
  position: relative;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
}
.brand-floating {
  position: absolute;
  top: calc(-0.6rem - 36px);
  left: 0;
  z-index: 5;
}
.status-floating {
  position: absolute;
  top: calc(-0.6rem - 36px);
  right: 0;
  z-index: 5;
}
.brand-status {
  gap: 0.4rem;
}
.brand-status strong {
  font-weight: 600;
  font-size: 0.9rem;
}
.brand-status-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.status-divider {
  width: 1px;
  align-self: stretch;
  background: rgba(236, 239, 255, 0.25);
  box-shadow: inset 0 0 0 1px rgba(18, 22, 52, 0.2);
  margin: 0 0.2rem;
}
.brand-link {
  border: none;
  cursor: pointer;
}
.user-link {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 600;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}
.user-link:hover,
.user-link:focus-visible {
  text-decoration: underline;
}
.piece-atomic {
  position: absolute;
  top: 3%;
  right: 3%;
  width: 42%;
  height: 42%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  padding: 6%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(250, 204, 21, 0.15) 60%, transparent 80%);
  filter:
    drop-shadow(0 0 2px rgba(0, 0, 0, 0.8))
    drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}
.explosion-spark {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 184, 0.9), rgba(255, 94, 0, 0.3));
  animation: explosionFade 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes explosionFade {
  0% {
    opacity: 0.9;
    transform: scale(0.5);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
