@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Sora:wght@400;500;600;700;800&display=swap");

:root {
  --page-bg: #07111f;
  --page-bg-strong: #040a13;
  --surface: rgba(10, 20, 36, 0.78);
  --surface-border: rgba(148, 163, 184, 0.18);
  --text-main: #ecf3ff;
  --text-soft: #c0cee3;
  --text-muted: #89a0bd;
  --text-dim: #67809e;
  --brand: #4fd1a6;
  --brand-bot: #f0a24d;
  --info: #4ba9ff;
  --danger: #ff7474;
  --warning: #f6c867;
  --shadow-xl: 0 32px 90px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.32);
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --hint-color: #14551e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(
      circle at top left,
      rgba(79, 209, 166, 0.18),
      transparent 26%
    ),
    radial-gradient(
      circle at top right,
      rgba(75, 169, 255, 0.17),
      transparent 28%
    ),
    radial-gradient(
      circle at bottom center,
      rgba(240, 162, 77, 0.12),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      var(--page-bg) 0%,
      #07101c 46%,
      var(--page-bg-strong) 100%
    );
  scrollbar-width: thin;
  scrollbar-color: inherit;
}

.page-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 38%, transparent 84%);
}

.page-shell {
  position: relative;
  min-height: 100vh;
}

.page-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    transparent 55%,
    rgba(0, 0, 0, 0.42)
  );
}

.container {
  width: max(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.panel-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 26%),
    var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}

.headline {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #9ef0d2);
  box-shadow: 0 0 18px rgba(79, 209, 166, 0.65);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease,
    background 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: #06231b;
  background: linear-gradient(135deg, #6ef0c6, var(--brand));
  box-shadow: 0 14px 32px rgba(79, 209, 166, 0.26);
}

.btn-secondary {
  color: #2f1a04;
  background: linear-gradient(135deg, #ffd08d, var(--brand-bot));
  box-shadow: 0 14px 32px rgba(240, 162, 77, 0.22);
}

.btn-ghost {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-info {
  color: white;
  background: linear-gradient(135deg, #60bcff, #348fe7);
  box-shadow: 0 12px 26px rgba(52, 143, 231, 0.24);
}

.btn-danger {
  color: white;
  background: linear-gradient(135deg, #ff8d8d, #dc6161);
  box-shadow: 0 12px 26px rgba(220, 97, 97, 0.22);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 0.86rem;
}

.status-pill strong {
  color: var(--text-main);
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-soft);
}

.field-input,
.field-select,
.field-text {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text-main);
  background: rgba(6, 13, 24, 0.88);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.field-input:focus,
.field-select:focus,
.field-text:focus {
  border-color: rgba(79, 209, 166, 0.75);
  box-shadow: 0 0 0 4px rgba(79, 209, 166, 0.14);
}

.field-help {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 0.94rem;
}

.flash-error {
  color: #ffd8d8;
  background: rgba(175, 43, 43, 0.18);
  border-color: rgba(255, 116, 116, 0.34);
}

.flash-success {
  color: #d8ffed;
  background: rgba(20, 126, 82, 0.2);
  border-color: rgba(66, 211, 146, 0.34);
}

.split-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 460px);
  gap: 34px;
  align-items: center;
  min-height: 100vh;
  padding: 40px 0;
}

.auth-hero {
  padding: 40px;
}

.auth-hero .headline {
  font-size: clamp(3rem, 6vw, 5.6rem);
  line-height: 0.94;
  max-width: 760px;
}

.auth-hero p {
  max-width: 640px;
  color: var(--text-soft);
  font-size: 1.08rem;
  line-height: 1.8;
  margin: 18px 0 0;
}

.auth-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.metric-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.7rem;
  font-family: "Sora", "Segoe UI", sans-serif;
}

.metric-card span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.auth-card {
  position: relative;
  z-index: 1;
  padding: 32px;
}

.auth-card h2,
.section-heading h2,
.profile-header h1,
.board-header h3,
.move-history-heading h3,
.panel-heading h3,
.brand-lockup h2,
.state-panel h2 {
  margin: 0;
  font-family: "Sora", "Segoe UI", sans-serif;
}

.auth-card p,
.panel-heading p,
.board-header p,
.move-history-heading p,
.profile-header p,
.section-heading p,
.state-panel p {
  color: var(--text-muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.auth-divider {
  position: relative;
  text-align: center;
  color: var(--text-dim);
  margin: 22px 0;
}

.auth-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-divider span {
  position: relative;
  z-index: 1;
  padding: 0 12px;
  background: rgba(8, 16, 31, 0.92);
}

.auth-footer {
  margin-top: 24px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.94rem;
}

.auth-footer a {
  color: #8ce9c6;
  font-weight: 700;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 18px 0;
  backdrop-filter: blur(16px);
  background: rgba(4, 10, 19, 0.68);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 5px 20px;
  margin: 0 10px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%),
    rgba(8, 18, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
  overflow: hidden;
}

.topbar-glow {
  position: absolute;
  inset: -40% auto auto -12%;
  width: 260px;
  height: 180px;
  background: radial-gradient(
    circle,
    rgba(79, 209, 166, 0.22),
    transparent 68%
  );
  filter: blur(10px);
  pointer-events: none;
  animation: navbar-float 7s ease-in-out infinite;
}

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

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    rgba(79, 209, 166, 0.18),
    rgba(75, 169, 255, 0.18)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.7rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 12px 28px rgba(0, 0, 0, 0.24);
  animation: navbar-mark-float 4.8s ease-in-out infinite;
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.brand-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8ff5d4, var(--brand));
  box-shadow: 0 0 16px rgba(79, 209, 166, 0.65);
  animation: navbar-pulse 1.8s ease-in-out infinite;
}

.brand-lockup p {
  margin: 4px 0 0;
  font-size: 0.92rem;
}

.topbar-meta,
.player-summary,
.profile-actions,
.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.topbar-meta {
  justify-content: flex-end;
}

.player-summary {
  gap: 10px;
}

.guest-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(75, 169, 255, 0.16);
  color: #bfe2ff;
  border: 1px solid rgba(75, 169, 255, 0.26);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pill-strong {
  background:
    linear-gradient(135deg, rgba(79, 209, 166, 0.16), rgba(75, 169, 255, 0.1)),
    rgba(255, 255, 255, 0.05);
  border-color: rgba(79, 209, 166, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-btn {
  position: relative;
  min-width: 108px;
  padding-inline: 18px;
  overflow: hidden;
}

.nav-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.16) 50%,
    transparent 100%
  );
  transform: translateX(-135%);
  transition: transform 0.6s ease;
}

.nav-btn:hover::before {
  transform: translateX(135%);
}

.nav-btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

.nav-btn-disabled::before {
  display: none;
}

.nav-btn-active {
  border-color: rgba(79, 209, 166, 0.24);
  background:
    linear-gradient(135deg, rgba(79, 209, 166, 0.14), rgba(75, 169, 255, 0.08)),
    rgba(255, 255, 255, 0.05);
}

.nav-btn-active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #9feeda);
  box-shadow: 0 0 16px rgba(79, 209, 166, 0.45);
}

.topbar-reveal {
  opacity: 0;
  transform: translateY(-10px);
  animation: navbar-reveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.topbar-reveal-delay-1 {
  animation-delay: 0.08s;
}

.topbar-reveal-delay-2 {
  animation-delay: 0.16s;
}

.landing-wrap,
.state-wrap,
.game-wrap,
.profile-wrap {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
}

.landing-wrap {
  /* min-height: calc(100vh - 112px); */
  display: flex;
  align-items: center;
  /* padding: 48px 0 64px; */
  min-height: 80vh;
}

.landing-grid,
.profile-grid {
  display: grid;
  gap: 26px;
  scale: 0.9;
}
.game-layout {
  display: grid;
  gap: 26px;
}
.landing-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 430px);
  width: 100%;
}

.hero-panel,
.sidebar-panel,
.state-panel,
.profile-panel,
.player-card,
.board-panel,
.game-controls-card,
.move-history-container {
  position: relative;
  overflow: hidden;
}

.hero-panel,
.sidebar-panel {
  padding: 34px;
}

.hero-panel::before,
.sidebar-panel::before,
.state-panel::before,
.profile-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    transparent 28%
  );
}

.hero-panel .headline {
  font-size: clamp(3.3rem, 7vw, 6rem);
  line-height: 0.92;
  max-width: 760px;
}

.hero-copy {
  max-width: 620px;
  margin-top: 20px;
  color: var(--text-soft);
  font-size: 1.08rem;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
}

.hero-button {
  position: relative;
  overflow: hidden;
  min-width: 220px;
  min-height: 72px;
  border-width: 1px;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 20px;
  font-size: 1.08rem;
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(0);
}

.hero-button::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 19px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.2),
    transparent 42%
  );
  pointer-events: none;
}

.hero-button:hover {
  transform: translateY(-4px) scale(1.01);
}

.hero-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.12),
    0 0 0 8px rgba(79, 209, 166, 0.2),
    0 18px 38px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

#play-online-button {
  border-color: rgba(110, 240, 198, 0.85);
  box-shadow:
    0 20px 42px rgba(79, 209, 166, 0.28),
    0 8px 18px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#play-online-button:hover {
  box-shadow:
    0 24px 52px rgba(79, 209, 166, 0.34),
    0 10px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

#play-bot-button {
  border-color: rgba(255, 208, 141, 0.88);
  box-shadow:
    0 20px 42px rgba(240, 162, 77, 0.26),
    0 8px 18px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

#play-bot-button:hover {
  box-shadow:
    0 24px 52px rgba(240, 162, 77, 0.32),
    0 10px 20px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.hero-button span {
  display: block;
  text-align: left;
  position: relative;
  z-index: 1;
}

.hero-button small {
  display: block;
  opacity: 0.92;
  font-size: 0.82rem;
  font-weight: 600;
}

.hero-stats,
.auth-metrics,
.settings-grid,
.identity-grid,
.color-grid {
  display: grid;
  gap: 16px;
}

.hero-stats,
.auth-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-stats {
  margin-top: 28px;
}

.hero-stat,
.feature-row,
.color-field,
.metric-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-stat strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.7rem;
  font-family: "Sora", "Segoe UI", sans-serif;
}

.hero-stat span,
.feature-row span {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.mini-board {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(4, 22px);
  gap: 5px;
  opacity: 0.65;
}

.mini-board span {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.mini-board span:nth-child(odd) {
  background: rgba(240, 217, 181, 0.72);
}

.mini-board span:nth-child(even) {
  background: rgba(181, 136, 99, 0.82);
}

.sidebar-panel {
  display: grid;
  gap: 22px;
}

.feature-list,
.profile-section,
.preview-panel,
.history-panel,
.player-card,
.game-column,
.move-history-container,
.captured-wrap,
.timer-container {
  display: grid;
  gap: 18px;
}

.feature-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(79, 209, 166, 0.14);
}

.state-wrap {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  padding: 48px 0;
  justify-content: center;
  align-items: center;
}

.state-panel {
  width: min(720px, 100%);
  padding: 42px;
  text-align: center;
}

.loading-spinner {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  margin: 30px auto 18px;
  border: 7px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--info);
  box-shadow: 0 0 30px rgba(75, 169, 255, 0.25);
  animation: spin 1s linear infinite;
}

#countdown-number {
  margin-top: 28px;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: clamp(5rem, 14vw, 8rem);
  line-height: 1;
  color: #7ef0ca;
  text-shadow: 0 0 30px rgba(79, 209, 166, 0.32);
  animation: countdown-pulse 1s ease-in-out infinite;
}

.game-shell {
  padding: 22px 0 44px;
  /* height:90vh; */
}

.game-layout {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(
      260px,
      320px
    );
  align-items: start;
}

.turn-display {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(79, 209, 166, 0.24);
  background: linear-gradient(
    135deg,
    rgba(79, 209, 166, 0.12),
    rgba(75, 169, 255, 0.1)
  );
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 1.35rem;
  text-align: center;
}

.player-card,
.game-controls-card,
.move-history-container,
.board-panel {
  padding: 22px;
}

#game-area .move-history-container {
  grid-template-rows: auto auto auto;
  align-content: start;
}

.player-card-header,
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.player-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

.player-score {
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 1.45rem;
}

.check-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 116, 116, 0.16);
  border: 1px solid rgba(255, 116, 116, 0.32);
  color: #ffd4d4;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  animation: badge-pulse 1s ease-in-out infinite;
}

.timer-label,
.captured-title {
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.timer {
  border-radius: 16px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 2rem;
  text-align: center;
}

.timer.active {
  background: rgba(66, 211, 146, 0.16) !important;
  border-color: rgba(66, 211, 146, 0.34);
  box-shadow: 0 0 0 4px rgba(66, 211, 146, 0.14);
  animation: pulse 1.1s infinite;
}

.timer.warning {
  background: rgba(255, 116, 116, 0.16) !important;
  border-color: rgba(255, 116, 116, 0.34);
  color: #ffe2e2;
  animation: pulse 0.6s infinite;
}

.captured-pieces {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.captured-piece {
  font-size: 1.55rem;
  opacity: 0.85;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  animation: fadeIn 0.25s ease;
}

.captured-piece:hover {
  opacity: 1;
  transform: scale(1.08);
}

.captured-piece.white {
  color: white;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.captured-piece.black {
  color: black;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.6));
}

.board-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.board-status {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 0.84rem;
}

.board-frame {
  border-radius: 26px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.board-rank-file {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
}

.rank-labels {
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 700;
}

.file-labels {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.chessboard {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(100%, 680px);
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  transform: rotate(0deg);
}

.flipped {
  transform: rotate(180deg);
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.square.selected {
  background: color-mix(in srgb, var(--warning) 38%, white 6%) !important;
}

.square.check {
  background: rgba(220, 38, 38, 0.68) !important;
  animation: check-pulse 1s ease-in-out infinite;
}

.square.castling,
.square.en-passant,
.square.promotion {
  animation: specialMove 0.6s ease;
}

.piece {
  font-size: clamp(2rem, 4.3vw, 3.6rem);
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.piece:hover {
  transform: scale(1.04);
}

.piece.white {
  color: white;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.95));
}

.piece.black {
  color: black;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.32));
}

.piece.draggable {
  cursor: grab;
}

.piece.dragging {
  opacity: 0.5;
}

.flipped .piece {
  transform: rotate(180deg);
}

.hint {
  position: absolute;
  width: 20%;
  height: 20%;
  border-radius: 999px;
  background: var(--hint-color);
  opacity: 0.55;
  pointer-events: none;
  z-index: 10;
}

.hint.capture {
  width: 78%;
  height: 78%;
  background: transparent;
  border: 4px solid var(--hint-color);
  opacity: 0.95;
}

.control-button {
  flex: 1 1 180px;
}

.cancel-matchmaking-button {
  margin-top: 18px;
  min-width: 150px;
  justify-content: center;
}

.message {
  display: none;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  font-weight: 700;
  min-height: 58px;
}

.move-history {
  max-height: 250px;
  /* min-height: 140px; */
  height: auto;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 6px;
}

.move-history::-webkit-scrollbar {
  width: 8px;
}

.move-history::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.move-history::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.chat-panel {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-messages {
  min-height: 180px;
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-empty {
  margin: 0;
  color: var(--text-dim);
  text-align: center;
  font-size: 0.9rem;
}

.chat-row {
  display: grid;
  gap: 4px;
}

.chat-row.ours {
  justify-items: end;
}

.chat-row.theirs {
  justify-items: start;
}

.chat-sender {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-row.ours .chat-bubble {
  background: rgba(79, 209, 166, 0.18);
  border: 1px solid rgba(79, 209, 166, 0.32);
}

.chat-row.theirs .chat-bubble {
  background: rgba(75, 169, 255, 0.14);
  border: 1px solid rgba(75, 169, 255, 0.28);
}

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

.chat-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(6, 13, 24, 0.88);
  color: var(--text-main);
  padding: 11px 12px;
  outline: none;
}

.chat-input:focus {
  border-color: rgba(75, 169, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(75, 169, 255, 0.15);
}

.chat-send-button {
  min-width: 92px;
  padding-inline: 14px;
}

.move-pair {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.move-pair:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.07);
}

.move-pair:last-child {
  background: rgba(79, 209, 166, 0.1);
  border-color: rgba(79, 209, 166, 0.18);
}

.move-number {
  color: var(--text-dim);
  font-weight: 700;
}

.game-notification {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  max-width: 360px;
  padding: 16px 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(360px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.game-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.game-notification.info {
  background: linear-gradient(135deg, #48a6ff, #2e7fe0);
}

.game-notification.success {
  background: linear-gradient(135deg, #4bd49b, #21926c);
}

.game-notification.warning,
.game-notification.disconnect {
  background: linear-gradient(135deg, #f0b14d, #c57d16);
}

.game-notification.error {
  background: linear-gradient(135deg, #ff8d8d, #d95b5b);
}

.notification-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
}

.profile-wrap {
  padding: 30px 0;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-panel {
  padding: 30px;
}

.history-panel {
  margin-top: 24px;
  padding: 30px;
}

.profile-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}

.history-list {
  display: grid;
  gap: 14px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.history-main {
  display: grid;
  gap: 8px;
}

.history-main h3,
.history-main p {
  margin: 0;
}

.history-main p {
  color: var(--text-soft);
}

.history-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.history-result,
.history-mode,
.history-color {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-result-win {
  background: rgba(79, 209, 166, 0.16);
  color: #8cf0c9;
}

.history-result-loss {
  background: rgba(255, 116, 116, 0.14);
  color: #ffb0b0;
}

.history-result-draw {
  background: rgba(75, 169, 255, 0.14);
  color: #9dcfff;
}

.history-mode,
.history-color {
  color: var(--text-soft);
}

.history-meta {
  min-width: 240px;
  display: grid;
  gap: 10px;
}

.history-stat {
  display: grid;
  gap: 4px;
  justify-items: end;
}

.history-stat strong {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.history-empty {
  display: grid;
  gap: 6px;
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  color: var(--text-soft);
}

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

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

.color-input-row {
  display: flex;
  gap: 10px;
}

.color-picker {
  width: 54px;
  min-width: 54px;
  height: 52px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 13, 24, 0.88);
}

.board-preview-shell {
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 30%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 260px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.preview-square {
  width: 100%;
  height: 100%;
}

#small-device-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  padding: 24px;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(
      circle at top left,
      rgba(79, 209, 166, 0.18),
      transparent 28%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(75, 169, 255, 0.16),
      transparent 30%
    ),
    linear-gradient(160deg, rgba(4, 10, 19, 0.96), rgba(7, 17, 31, 0.98));
}

.small-device-content {
  width: min(100%, 440px);
  padding: 28px;
  border-radius: 24px;
  text-align: center;
  background: rgba(10, 20, 36, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-xl);
}

.small-device-content h1 {
  margin: 0 0 10px;
  font-family: "Sora", "Segoe UI", sans-serif;
  font-size: 2rem;
}

.small-device-content p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.small-device-content p + p {
  margin-top: 8px;
}

@media (max-width: 1250px) {
  #desktop-app {
    display: none !important;
  }

  #small-device-screen {
    display: flex !important;
  }

  .page-grid {
    display: none;
  }
}

@keyframes check-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    box-shadow: inset 0 0 0 100px rgba(220, 38, 38, 0.16);
  }
}

@keyframes badge-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

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

@keyframes navbar-reveal {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes navbar-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(18px, 12px, 0);
  }
}

@keyframes navbar-mark-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes navbar-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.82;
    transform: scale(1.18);
  }
}

@keyframes countdown-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes specialMove {
  0% {
    box-shadow: inset 0 0 0 0 rgba(79, 209, 166, 0.7);
  }
  100% {
    box-shadow: inset 0 0 0 28px rgba(79, 209, 166, 0);
  }
}
