:root {
  --bg: #070506;
  --bg-alt: #100708;
  --panel: rgba(22, 9, 11, 0.82);
  --panel-strong: rgba(31, 13, 16, 0.96);
  --panel-soft: rgba(25, 11, 13, 0.72);
  --text: #f5eaea;
  --muted: #a58e8e;
  --primary: #e52b3a;
  --primary-bright: #ff3948;
  --primary-soft: #7d151d;
  --border: rgba(83, 21, 29, 0.9);
  --shadow: rgba(10, 4, 5, 0.7);
  --success: #38d39f;
  --danger: #ff5d5d;
  --line: rgba(130, 60, 67, 0.4);
  --square-light: #b9a89b;
  --square-dark: #4a3033;
}

/* Authenticated dashboard presentation */
body:has(.dashboard-shell) {
  background:
    radial-gradient(circle at 72% 8%, rgba(229, 43, 58, 0.12), transparent 28%),
    linear-gradient(135deg, #080506 0%, #120709 52%, #080506 100%);
}

body:has(.dashboard-shell) .topbar {
  display: flex;
  align-items: center;
  width: calc(100% - 240px);
  margin-left: 240px;
  min-height: 72px;
  padding: 12px 28px;
  background: rgba(8, 4, 5, 0.82);
  border-bottom: 1px solid rgba(124, 31, 43, 0.52);
}

body:has(.dashboard-shell) .topbar .brand-wrap,
body:has(.dashboard-shell) .topbar .main-nav {
  display: none;
}

body:has(.dashboard-shell) .topbar .search-box {
  flex: 0 0 420px;
  max-width: 420px;
}

body:has(.dashboard-shell) .topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 8px 22px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 57, 72, 0.35);
  background: rgba(255, 57, 72, 0.12);
}

.sidebar-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand strong {
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}

.sidebar-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: none;
}

.sidebar-divider {
  display: block;
  height: 1px;
  margin: 12px 8px;
  background: var(--line);
}

body:has(.dashboard-shell) .search-box {
  display: flex;
  max-width: 320px;
}

.dashboard-shell {
  grid-template-columns: 214px minmax(0, 1fr) 286px;
  gap: 20px;
}

.dashboard-shell .sidebar {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(25, 9, 12, 0.96), rgba(11, 5, 7, 0.96));
}

.dashboard-shell .sidebar-nav a {
  min-height: 44px;
  font-size: 0.88rem;
}

.dashboard-shell .sidebar-nav a.active {
  box-shadow: inset 3px 0 0 var(--primary-bright);
}

.hero-panel {
  min-height: 322px;
  border-color: rgba(148, 34, 45, 0.8);
  box-shadow: 0 25px 55px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 128, 128, 0.06);
}

.hero-copy h1 {
  letter-spacing: -0.04em;
}

.quickplay-panel,
.feature-card,
.profile-rail,
.leaderboard-panel,
.recent-panel,
.online-panel {
  border-radius: 18px;
  background: rgba(19, 8, 10, 0.9);
}

.quickplay-card {
  min-height: 108px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.quickplay-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 57, 72, 0.58);
  background: rgba(229, 43, 58, 0.1);
}

.online-count {
  min-width: 25px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 211, 159, 0.12);
  color: var(--success);
  font-size: 0.72rem;
  text-align: center;
}

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

.online-player {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.online-player:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--border);
}

.online-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b1e2a, #3c1118);
  color: #ffdce0;
  font-size: 0.78rem;
  font-weight: 800;
}

.online-player-name {
  min-width: 0;
  flex: 1;
}

.online-player-name strong,
.online-player-name small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-player-name strong {
  font-size: 0.82rem;
}

.online-player-name small {
  color: var(--muted);
  font-size: 0.68rem;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(56, 211, 159, 0.75);
}

body:has(.dashboard-shell) {
  background: #050304;
}

body:has(.dashboard-shell) .container {
  width: calc(100% - 240px);
  max-width: none;
  margin-left: 240px;
  padding: 18px 28px 28px;
}

body:has(.dashboard-shell) .dashboard-shell {
  display: grid;
  grid-template-columns: minmax(620px, 2fr) minmax(300px, 1fr) minmax(300px, 1fr);
  align-items: start;
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 18px;
}

body:has(.dashboard-shell) .sidebar {
  position: sticky;
  top: 90px;
  min-height: calc(100vh - 118px);
  padding: 18px 12px;
}

body:has(.dashboard-shell) .dashboard-main,
body:has(.dashboard-shell) .right-panel {
  min-width: 0;
}

body:has(.dashboard-shell) .right-panel {
  display: contents;
}

body:has(.dashboard-shell) .profile-rail,
body:has(.dashboard-shell) .recent-panel {
  grid-column: 3;
}

body:has(.dashboard-shell) .leaderboard-panel,
body:has(.dashboard-shell) .online-panel {
  grid-column: 4;
}

body:has(.dashboard-shell) .hero-panel {
  min-height: 290px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 3, 5, 0.96) 0%, rgba(18, 5, 8, 0.86) 48%, rgba(25, 6, 9, 0.45) 100%),
    url('/images/dashboard-slide-board.svg') center / cover no-repeat;
}

body:has(.dashboard-shell) .hero-slider {
  display: none;
}

body:has(.dashboard-shell) .quickplay-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

body:has(.dashboard-shell) .feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body:has(.dashboard-shell) .profile-rail {
  border-color: rgba(229, 43, 58, 0.55);
}

@media (max-width: 1180px) {
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  body:has(.dashboard-shell) .right-panel {
    display: grid;
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:has(.dashboard-shell) .profile-rail,
  body:has(.dashboard-shell) .recent-panel,
  body:has(.dashboard-shell) .leaderboard-panel,
  body:has(.dashboard-shell) .online-panel {
    grid-column: auto;
  }
}

@media (max-width: 1180px) {
  body:has(.dashboard-shell) .topbar {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 560px) {
  body:has(.dashboard-shell) .topbar {
    padding: 10px 12px;
  }

  body:has(.dashboard-shell) .topbar-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  body:has(.dashboard-shell) .topbar-actions .language-selector,
  body:has(.dashboard-shell) .topbar-actions .logout-form {
    display: none;
  }

  .sidebar-brand {
    padding-bottom: 14px;
  }
}

/* Keep the dashboard's three-column shell and premium treatment above shared page rules. */
body:has(.dashboard-shell) .dashboard-shell {
  grid-template-columns: 214px minmax(0, 1fr) 286px;
  gap: 20px;
}

body:has(.dashboard-shell) .hero-panel {
  min-height: 322px;
  border-color: rgba(148, 34, 45, 0.8);
  box-shadow: 0 25px 55px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 128, 128, 0.06);
}

body:has(.dashboard-shell) .quickplay-card {
  min-height: 108px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

body:has(.dashboard-shell) .quickplay-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 57, 72, 0.58);
  background: rgba(229, 43, 58, 0.1);
}

@media (max-width: 1180px) {
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 1fr;
  }
}

/* Dashboard reference layout: compact global navigation, three focused content rails. */
body:has(.dashboard-shell) {
  background:
    radial-gradient(circle at 67% 0%, rgba(111, 17, 31, 0.18), transparent 34%),
    #050304;
}

body:has(.dashboard-shell) .topbar {
  grid-template-columns: auto minmax(180px, 260px) minmax(320px, 1fr) auto;
  min-height: 68px;
  padding: 10px clamp(16px, 3vw, 42px);
  gap: clamp(12px, 2vw, 28px);
  background: rgba(7, 4, 5, 0.94);
  border-bottom-color: rgba(124, 39, 48, 0.42);
}

body:has(.dashboard-shell) .topbar .brand-wrap,
body:has(.dashboard-shell) .topbar .main-nav {
  display: flex;
}

body:has(.dashboard-shell) .brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 10px;
}

body:has(.dashboard-shell) .brand-name {
  font-size: 1.05rem;
}

body:has(.dashboard-shell) .brand-credit {
  font-size: 0.5rem;
}

body:has(.dashboard-shell) .search-box {
  max-width: none;
  min-height: 38px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

body:has(.dashboard-shell) .main-nav {
  justify-content: flex-start;
  gap: 2px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

body:has(.dashboard-shell) .main-nav a {
  padding: 7px 9px;
  font-size: 0.78rem;
}

body:has(.dashboard-shell) .main-nav a.active {
  color: #fff;
  background: rgba(229, 43, 58, 0.14);
  border-radius: 7px;
}

body:has(.dashboard-shell) .topbar-actions {
  grid-column: 4;
  gap: 7px;
}

body:has(.dashboard-shell) .language-selector {
  padding: 6px 8px;
  border-radius: 9px;
}

body:has(.dashboard-shell) .language-selector select {
  max-width: 72px;
  font-size: 0.75rem;
}

body:has(.dashboard-shell) .icon-button {
  width: 36px;
  height: 36px;
  border-radius: 9px;
}

body:has(.dashboard-shell) .profile-pill {
  padding: 5px 8px 5px 5px;
  border-radius: 10px;
}

body:has(.dashboard-shell) .profile-pill > span:nth-child(2) {
  font-size: 0.78rem;
}

body:has(.dashboard-shell) .container {
  width: min(100%, 1500px);
  max-width: 1500px;
  padding: 20px clamp(16px, 3vw, 42px) 34px;
}

body:has(.dashboard-shell) .dashboard-shell {
  grid-template-columns: 188px minmax(0, 1fr) 292px;
  gap: 18px;
  max-width: 1416px;
  margin: 0 auto;
}

body:has(.dashboard-shell) .sidebar {
  top: 88px;
  min-height: calc(100vh - 112px);
  padding: 14px 10px 12px;
  border: 1px solid rgba(113, 31, 42, 0.55);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 8, 12, 0.98), rgba(10, 5, 7, 0.98));
}

body:has(.dashboard-shell) .sidebar-nav {
  gap: 3px;
}

body:has(.dashboard-shell) .sidebar-nav a {
  min-height: 39px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

body:has(.dashboard-shell) .sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(176, 30, 45, 0.45), rgba(74, 13, 22, 0.25));
  border-color: rgba(229, 43, 58, 0.4);
  box-shadow: inset 2px 0 0 var(--primary-bright);
}

body:has(.dashboard-shell) .sidebar-footer {
  margin-top: auto;
}

body:has(.dashboard-shell) .dashboard-main {
  gap: 14px;
}

body:has(.dashboard-shell) .hero-panel {
  min-height: 288px;
  padding: 28px 30px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(10, 4, 6, 0.98) 0%, rgba(31, 7, 12, 0.88) 54%, rgba(49, 10, 17, 0.55) 100%),
    url('/images/dashboard-slide-board.svg') center / cover no-repeat;
}

body:has(.dashboard-shell) .hero-copy h1 {
  max-width: 470px;
  font-size: clamp(2.2rem, 3.4vw, 3.55rem);
}

body:has(.dashboard-shell) .hero-visual {
  min-height: 190px;
}

body:has(.dashboard-shell) .hero-slider {
  display: none;
}

body:has(.dashboard-shell) .quickplay-panel,
body:has(.dashboard-shell) .feature-card,
body:has(.dashboard-shell) .profile-rail,
body:has(.dashboard-shell) .leaderboard-panel,
body:has(.dashboard-shell) .recent-panel {
  border-radius: 12px;
  border-color: rgba(113, 31, 42, 0.6);
  background: rgba(17, 7, 10, 0.92);
}

body:has(.dashboard-shell) .quickplay-panel {
  padding: 16px;
}

body:has(.dashboard-shell) .quickplay-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

body:has(.dashboard-shell) .quickplay-card {
  min-height: 94px;
  padding: 11px 9px;
  border-radius: 9px;
}

body:has(.dashboard-shell) .quickplay-card strong {
  font-size: 0.82rem;
}

body:has(.dashboard-shell) .quick-actions {
  margin-top: 12px;
}

body:has(.dashboard-shell) .feature-grid {
  gap: 10px;
}

body:has(.dashboard-shell) .feature-card {
  min-height: 92px;
  padding: 14px;
}

body:has(.dashboard-shell) .feature-card h4 {
  font-size: 0.9rem;
}

body:has(.dashboard-shell) .feature-card p {
  font-size: 0.72rem;
}

body:has(.dashboard-shell) .right-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

body:has(.dashboard-shell) .profile-rail,
body:has(.dashboard-shell) .leaderboard-panel,
body:has(.dashboard-shell) .recent-panel {
  grid-column: auto;
}

body:has(.dashboard-shell) .profile-rail {
  border-color: rgba(229, 43, 58, 0.62);
}

@media (max-width: 1220px) {
  body:has(.dashboard-shell) .topbar {
    grid-template-columns: auto minmax(160px, 220px) 1fr auto;
  }
  body:has(.dashboard-shell) .main-nav a {
    padding-inline: 5px;
    font-size: 0.7rem;
  }
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 172px minmax(0, 1fr) 260px;
  }
}

@media (max-width: 980px) {
  body:has(.dashboard-shell) .topbar {
    grid-template-columns: auto 1fr auto;
  }
  body:has(.dashboard-shell) .topbar .main-nav {
    display: none;
  }
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 172px minmax(0, 1fr);
  }
  body:has(.dashboard-shell) .right-panel {
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body:has(.dashboard-shell) .topbar {
    grid-template-columns: 1fr auto;
  }
  body:has(.dashboard-shell) .topbar .search-box {
    display: none;
  }
  body:has(.dashboard-shell) .brand-text,
  body:has(.dashboard-shell) .topbar-actions .language-selector {
    display: none;
  }
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 1fr;
  }
  body:has(.dashboard-shell) .sidebar {
    position: static;
    min-height: 0;
  }
  body:has(.dashboard-shell) .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body:has(.dashboard-shell) .right-panel {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
  body:has(.dashboard-shell) .quickplay-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body:has(.dashboard-shell) .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Shared Şah Mat theme for every non-dashboard page */
body:not(:has(.dashboard-shell)) {
  background:
    radial-gradient(circle at 78% 0%, rgba(122, 17, 34, .2), transparent 34%),
    linear-gradient(135deg, #080506 0%, #120709 54%, #080506 100%);
}

body:not(:has(.dashboard-shell)) .topbar {
  background: rgba(7, 4, 5, .94);
  border-bottom-color: rgba(124, 39, 48, .55);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .3);
}

body:not(:has(.dashboard-shell)) .container {
  padding-top: 28px;
}

body:not(:has(.dashboard-shell)) .glass-panel,

body:not(:has(.dashboard-shell)) .admin-sidebar,

body:not(:has(.dashboard-shell)) .admin-stat {
  border-color: rgba(114, 23, 36, .78);
  background: linear-gradient(145deg, rgba(27, 8, 12, .94), rgba(12, 4, 7, .97));
  box-shadow: 0 16px 36px rgba(0, 0, 0, .24);
}

body:not(:has(.dashboard-shell)) .page-head,

body:not(:has(.dashboard-shell)) .profile-header{
  border-color: rgba(114, 23, 36, .55);
}

body:not(:has(.dashboard-shell)) .page-head h1,

body:not(:has(.dashboard-shell)) .profile-header h1,

body:not(:has(.dashboard-shell)) .auth-panel h2,

body:not(:has(.dashboard-shell)) .landing-copy h1 {
  color: #f8e8e9;
}

body:not(:has(.dashboard-shell)) .page-head p,

body:not(:has(.dashboard-shell)) .profile-header p,

body:not(:has(.dashboard-shell)) .empty-state {
  color: #b99da1;
}

body:not(:has(.dashboard-shell)) input,
body:not(:has(.dashboard-shell)) textarea,
body:not(:has(.dashboard-shell)) select,
body:not(:has(.dashboard-shell)) .search-box {
  border-color: rgba(130, 60, 67, .72);
  background: rgba(255, 255, 255, .035);
  color: var(--text);
}

body:not(:has(.dashboard-shell)) input:focus,
body:not(:has(.dashboard-shell)) textarea:focus,
body:not(:has(.dashboard-shell)) select:focus {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 3px rgba(255, 57, 72, .12);
}

body:not(:has(.dashboard-shell)) .secondary-button,

body:not(:has(.dashboard-shell)) .time-button,

body:not(:has(.dashboard-shell)) .back-button{
  border-color: rgba(130, 60, 67, .72);
  background: rgba(39, 10, 15, .68);
  color: #ecdfe0;
}

body:not(:has(.dashboard-shell)) .secondary-button:hover,

body:not(:has(.dashboard-shell)) .time-button:hover,

body:not(:has(.dashboard-shell)) .back-button:hover{
  border-color: var(--primary-bright);
  background: rgba(229, 43, 58, .16);
}

body:not(:has(.dashboard-shell)) .leaderboard-table th,
body:not(:has(.dashboard-shell)) .data-table th {
  color: #f0cdd0;
  background: rgba(92, 13, 25, .58);
  border-bottom-color: rgba(229, 43, 58, .42);
}

body:not(:has(.dashboard-shell)) .leaderboard-table td,
body:not(:has(.dashboard-shell)) .data-table td {
  border-bottom-color: rgba(114, 23, 36, .4);
}

body:not(:has(.dashboard-shell)) .leaderboard-table tr:hover td,
body:not(:has(.dashboard-shell)) .data-table tr:hover td {
  background: rgba(229, 43, 58, .07);
}

body:not(:has(.dashboard-shell)) .footer {
  background: rgba(7, 4, 5, .92);
  border-top-color: rgba(124, 39, 48, .5);
}

body:not(:has(.dashboard-shell)) .topbar .brand-mark {
  width: 174px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body:not(:has(.dashboard-shell)) .topbar .brand-text {
  display: none;
}

@media (max-width: 640px) {
  body:not(:has(.dashboard-shell)) .topbar {
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  body:not(:has(.dashboard-shell)) .topbar .brand-mark {
    width: 92px;
    height: 38px;
  }

  body:not(:has(.dashboard-shell)) .topbar .brand-wrap {
    width: 92px;
    overflow: hidden;
  }

  body:not(:has(.dashboard-shell)) .topbar .main-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  body:not(:has(.dashboard-shell)) .topbar .main-nav::-webkit-scrollbar {
    display: none;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: radial-gradient(circle at top, rgba(229, 43, 58, 0.08), transparent 30%), linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select {
  font: inherit;
}
img {
  max-width: 100%;
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(220px, 320px) 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 18px 28px;
  background: rgba(10, 5, 6, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.2);
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 57, 72, 0.18), rgba(125, 21, 29, 0.32));
  border: 1px solid rgba(255, 57, 72, 0.25);
  color: var(--primary-bright);
  font-size: 1.8rem;
  box-shadow: 0 0 28px rgba(229, 43, 58, 0.15);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.brand-name {
  font-size: clamp(1.2rem, 1.8vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-credit {
  display: block;
  margin-top: 1px;
  color: #c28f95;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.brand-credit a {
  color: inherit;
  text-decoration: underline;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
}

.search-box input::placeholder {
  color: var(--muted);
}

.main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  transition: 0.2s ease;
}

.main-nav a:hover {
  background: rgba(255, 57, 72, 0.08);
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.language-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.topbar > .language-selector {
  grid-column: 4;
  justify-self: end;
}

.language-selector select {
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.language-selector select option {
  background: #fff;
  color: #241116;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 7px;
  border-radius: 999px;
  background: rgba(255, 57, 72, 0.08);
  border: 1px solid rgba(255, 57, 72, 0.16);
  color: var(--text);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-soft));
  font-size: 0.9rem;
}

.profile-avatar img,
.large-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.profile-level {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.profile-chevron {
  color: var(--muted);
  font-size: 1rem;
}

body:has(.dashboard-shell) .logout-form {
  display: none;
}

.avatar-choice-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.avatar-choice {
  display: block;
  width: 64px;
  height: 64px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
}

.avatar-choice.selected,
.avatar-choice:focus-within {
  border-color: var(--primary-bright);
  box-shadow: 0 0 0 2px rgba(255, 57, 72, 0.18);
}

.avatar-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice img,
.avatar-upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.avatar-upload-preview {
  width: 96px;
  height: 96px;
  margin: 12px 0;
}

.profile-photo-panel {
  display: grid;
  gap: 18px;
  max-width: 1120px;
  margin-bottom: 22px;
  overflow: hidden;
}
.profile-rail,
.avatar-choice-group,
.avatar-choice,
.avatar-choice-grid {
  min-width: 0;
  box-sizing: border-box;
}
.avatar-choice-group,
.avatar-choice,
.profile-rail {
  overflow: hidden;
}
.avatar-choice img,
.large-avatar img,
.profile-avatar img {
  display: block;
}

.profile-photo-panel > h3 {
  margin: 0;
}

.avatar-form {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.avatar-upload-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 4, 6, 0.46);
}

.avatar-upload-label {
  display: grid;
  gap: 8px;
  min-width: min(100%, 260px);
  color: var(--text);
  font-weight: 650;
}

.avatar-upload-label input[type="file"] {
  width: min(100%, 440px);
  max-width: 100%;
  color: var(--muted);
}

.avatar-upload-preview {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  margin: 0;
  border: 2px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 57, 72, 0.18);
}

.avatar-groups {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.avatar-choice-group {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 13, 16, 0.72), rgba(8, 5, 7, 0.72));
}

.avatar-choice-group legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.avatar-choice-group legend span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--primary-soft);
  font-size: 0.72rem;
}

.avatar-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 10px;
  margin: 6px 0 0;
}

.avatar-choice {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 94px;
  justify-items: center;
  align-content: center;
  gap: 5px;
  padding: 8px 5px;
  border: 1px solid rgba(130, 60, 67, 0.46);
  border-radius: 13px;
  background: rgba(7, 5, 7, 0.78);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.avatar-choice:hover {
  border-color: rgba(255, 57, 72, 0.72);
  transform: translateY(-2px);
}

.avatar-choice.selected,
.avatar-choice:focus-within {
  border-color: var(--primary-bright);
  background: rgba(125, 21, 29, 0.32);
  box-shadow: 0 0 0 2px rgba(255, 57, 72, 0.2), 0 8px 20px rgba(10, 4, 5, 0.34);
}

.avatar-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.avatar-choice img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: #10090b;
}

.avatar-choice > span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1;
}

.avatar-choice.selected > span {
  color: #fff;
}

.avatar-form > .primary-button {
  justify-self: start;
  min-width: 140px;
}

@media (max-width: 600px) {
  .profile-photo-panel {
    padding: 16px;
  }

  .avatar-choice-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 7px;
  }

  .avatar-choice {
    min-height: 84px;
    padding: 6px 3px;
  }

  .avatar-choice img {
    width: 50px;
    height: 50px;
  }
}

.logout-form button,
.primary-button,
.secondary-button,
.danger-button,
.time-button,
.quickplay-card,
.helper-link,
button {
  transition: transform 0.18s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.logout-form button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary-bright), var(--primary));
  color: var(--text);
  box-shadow: 0 14px 30px rgba(229, 43, 58, 0.25);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
}

.danger-button {
  background: rgba(255, 93, 93, 0.12);
  color: #ffd4d4;
  border: 1px solid rgba(255, 93, 93, 0.28);
}

.logout-form button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover,
.quickplay-card:hover,
.helper-link:hover {
  transform: translateY(-1px);
}

.container {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
  min-width: 0;
  flex: 1;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.back-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.11);
}

.landing-shell {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 190px);
  align-content: center;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  align-items: center;
  gap: 28px;
  min-height: 500px;
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 50%, rgba(229, 43, 58, 0.3), transparent 30%),
    linear-gradient(135deg, rgba(21, 7, 9, 0.98), rgba(58, 12, 17, 0.9));
}

.landing-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.landing-copy h1 {
  margin: 18px 0 16px;
  max-width: 650px;
  font-size: clamp(2.8rem, 6vw, 5.9rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.landing-copy p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.landing-board-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
}

.landing-slides {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 640 / 420;
}

.landing-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.95) rotate(2deg);
  transition: opacity 0.45s ease, transform 0.45s ease;
  border-radius: 20px;
  filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.42));
}

.landing-slide.active {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.landing-slide strong {
  bottom: 10%;
}

.landing-board {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  width: min(82%, 360px);
  height: auto;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%) rotate(-4deg);
  border: 10px solid rgba(245, 234, 234, 0.08);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5), 0 0 70px rgba(229, 43, 58, 0.24);
}

.landing-board.active {
  transform: translate(-50%, -50%) rotate(-4deg);
}

.landing-slider {
  position: absolute;
  right: 4%;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 92%;
}

.landing-slider .hero-slider-arrow {
  flex: 0 0 26px;
}

.landing-slider .hero-slider-track {
  min-width: 70px;
}

.landing-slider-fill {
  display: block;
  width: 33.333%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-bright), #ff9c8b);
  transition: width 0.25s ease;
}

.landing-board span {
  display: block;
}

.light-square { background: #d7aaa0; }
.dark-square { background: #5c202a; }

.board-king,
.board-pawn {
  position: absolute;
  color: #fff4ed;
  text-shadow: 0 5px 12px rgba(0, 0, 0, 0.65);
  font-size: clamp(4rem, 10vw, 7rem);
  line-height: 1;
}

.board-king { top: 18%; left: 19%; }
.board-pawn { right: 18%; bottom: 17%; color: #271015; }

.landing-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.landing-feature {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border-radius: 18px;
}

.landing-feature .feature-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
}

.landing-feature strong,
.landing-feature small {
  display: block;
}

.landing-feature small {
  margin-top: 4px;
  color: var(--muted);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.72fr);
  align-items: center;
  gap: clamp(28px, 7vw, 110px);
  width: min(100%, 980px);
  min-height: calc(100vh - 220px);
  margin: 0 auto;
}

.auth-intro {
  position: relative;
  padding: 20px 0;
}

.auth-intro h1 {
  margin: 18px 0 14px;
  max-width: 470px;
  font-size: clamp(2.7rem, 6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.auth-intro p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
}

.auth-emblem {
  margin-top: 34px;
  color: rgba(255, 57, 72, 0.22);
  font-size: 10rem;
  line-height: 0.8;
  text-shadow: 0 0 35px rgba(229, 43, 58, 0.25);
}

.auth-panel {
  width: 100%;
  padding: clamp(24px, 4vw, 38px);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(31, 11, 14, 0.98), rgba(16, 6, 8, 0.96));
}

.auth-panel-heading {
  margin-bottom: 24px;
}

.auth-kicker {
  color: #ff9fa7;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.auth-panel h2 {
  margin: 8px 0 0;
  font-size: 1.8rem;
}

.auth-panel form {
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: #e8cbcd;
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(130, 60, 67, 0.72);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-field input:focus {
  border-color: var(--primary-bright);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(255, 57, 72, 0.12);
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
}

.muted-link {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.muted-link a {
  color: #ffb1b7;
  font-weight: 700;
}

.error-box {
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 93, 93, 0.35);
  border-radius: 10px;
  background: rgba(255, 93, 93, 0.1);
  color: #ffd4d4;
}

.footer {
  border-top: 1px solid var(--line);
  background: rgba(10, 5, 6, 0.82);
  color: var(--muted);
  text-align: center;
  padding: 18px 20px;
}

.footer p {
  margin: 0;
}

.footer-brand {
  color: var(--text);
  font-weight: 700;
}

.footer-credit {
  margin-top: 3px !important;
  color: #d7a1a6;
  font-size: 0.86rem;
}

.glass-panel {
  background: rgba(22, 9, 11, 0.82);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 22px 44px var(--shadow);
}

.padded-panel {
  padding: 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 57, 72, 0.12);
  border: 1px solid rgba(255, 57, 72, 0.22);
  color: #ffd8dc;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow-soft {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.section-head h3,
.section-head h2,
.hero-copy h1,
.page-head h1,
.sidebar h3 {
  margin: 0;
}

.section-head a {
  color: #ffd7db;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 110px;
  padding: 18px 12px 12px;
  min-height: 660px;
  background: rgba(12, 5, 6, 0.88);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid transparent;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  background: rgba(229, 43, 58, 0.12);
  border-color: rgba(229, 43, 58, 0.24);
  color: var(--text);
}

.nav-icon {
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.discord-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  color: var(--text);
}

.dashboard-main {
  display: grid;
  gap: 18px;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 18px;
  min-height: 300px;
  padding: 26px 28px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(27, 10, 12, 0.98), rgba(67, 13, 18, 0.88));
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 70% 25%, rgba(255, 67, 78, 0.30), transparent 28%);
}

.hero-copy,
.hero-visual {
  position: relative;
  z-index: 1;
}

.hero-brand {
  color: #ffb2b8;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 12px 0 14px;
  font-size: clamp(2.6rem, 4vw, 4.1rem);
  line-height: 1.05;
  max-width: 520px;
}

.hero-copy p {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
}

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.hero-visual {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.hero-slides {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 640 / 420;
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.45s ease, transform 0.45s ease;
  filter: drop-shadow(0 22px 25px rgba(0, 0, 0, 0.35));
}

.hero-slide img,
.landing-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-slide strong,
.landing-slide strong {
  position: absolute;
  left: 10%;
  bottom: 8%;
  transform: none;
  max-width: 80%;
  color: #ffc1c6;
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  line-height: 1.25;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

@media (max-width: 640px) {
  .hero-slide strong,
  .landing-slide strong {
    left: 7%;
    max-width: 86%;
    font-size: clamp(0.62rem, 2.5vw, 0.82rem);
    letter-spacing: 0.1em;
  }
}

.hero-slide.active {
  opacity: 1;
  transform: scale(1);
}

.hero-slides.slide-left .hero-slide.active,
.landing-slides.slide-left .landing-slide.active {
  animation: slide-in-left 0.4s ease both;
}

.hero-slides.slide-right .hero-slide.active,
.landing-slides.slide-right .landing-slide.active {
  animation: slide-in-right 0.4s ease both;
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(34px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(-34px) scale(0.96); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.hero-slider {
  position: absolute;
  right: 28px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(330px, calc(100% - 56px));
}

.hero-slider-arrow {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 57, 72, 0.26);
  border-radius: 50%;
  background: rgba(10, 4, 5, 0.46);
  color: #ffd8dc;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.hero-slider-track {
  position: relative;
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.hero-slider-fill {
  display: block;
  width: 33.333%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-bright), #ff9c8b);
  transition: width 0.25s ease;
}

.hero-slider-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hero-slider-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.hero-slider-dot.active {
  background: var(--primary-bright);
  box-shadow: 0 0 8px rgba(255, 57, 72, 0.7);
}

.quickplay-panel {
  padding: 20px 22px 18px;
}

.quickplay-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.quickplay-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  min-height: 120px;
}

.quickplay-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mode-info {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 193, 198, 0.5);
  border-radius: 50%;
  color: #ffc1c6;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.mode-info:hover,
.mode-info:focus {
  background: var(--primary);
  color: #fff;
  outline: none;
}

.quickplay-card strong {
  font-size: 1rem;
}

.mode-popover {
  position: absolute;
  z-index: 3;
  top: 45px;
  right: 10px;
  width: min(220px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 193, 198, 0.35);
  border-radius: 10px;
  background: #241015;
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  line-height: 1.4;
}

.custom-room-card {
  position: relative;
  width: min(92vw, 440px);
  text-align: left;
}

.room-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}

.room-code-row strong {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary-bright);
  letter-spacing: 0.18em;
  text-align: center;
}

.room-code-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(8, 4, 6, 0.7);
  color: var(--text);
  text-transform: uppercase;
}

.room-code-row input:focus {
  border-color: var(--primary);
  outline: none;
}

.room-code-row button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.custom-room-card > p {
  color: var(--muted);
}

.custom-room-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.custom-room-divider::before,
.custom-room-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.room-join-form {
  display: grid;
  gap: 7px;
}

.room-join-form label {
  color: var(--muted);
  font-size: 0.78rem;
}

.room-join-form .room-code-row {
  margin: 0;
}

.time-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 54px;
  padding: 5px 8px;
  background: rgba(229, 43, 58, 0.1);
  border: 1px solid rgba(229, 43, 58, 0.2);
  border-radius: 999px;
  color: #ffc1c6;
  font-weight: 700;
}

.quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  min-height: 130px;
}

.feature-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(229, 43, 58, 0.12);
  font-size: 1.7rem;
}

.feature-card h4,
.feature-card p {
  margin: 0;
}

.feature-card p {
  color: var(--muted);
  margin-top: 6px;
}

.right-panel {
  display: grid;
  gap: 16px;
}

.profile-rail,
.leaderboard-panel,
.recent-panel {
  padding: 18px 16px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-top h3,
.profile-top p {
  margin: 0;
}

.profile-top p {
  color: var(--muted);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.mini-stat {
  padding: 12px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.mission-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.mission-row small {
  color: var(--muted);
}

.leaderboard-list.compact {
  gap: 10px;
}

.leaderboard-list.compact li {
  padding: 10px 12px;
}

.game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.game-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.replay-page {
  display: grid;
  gap: 18px;
}

.replay-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(640px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 4px solid #271317;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.replay-square {
  display: grid;
  place-items: center;
  color: #171014;
  font-size: clamp(1.5rem, 7vw, 3.8rem);
}

.square.light,
.replay-square.light { background: #d8c5ad; }
.square.dark,
.replay-square.dark { background: #69464d; }

.square.white-piece,
.replay-square.white-piece {
  color: #fff7ed;
  text-shadow: 0 2px 2px rgba(40, 15, 18, 0.72), 0 0 4px rgba(255, 255, 255, 0.3);
}

.square.black-piece,
.replay-square.black-piece {
  color: #171014;
  text-shadow: 0 1px 1px rgba(255, 236, 218, 0.28);
}

.replay-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.replay-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.replay-moves {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 170px;
  overflow-y: auto;
  padding: 0;
  list-style: none;
}

.replay-moves button {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.replay-moves button.active {
  border-color: var(--primary-bright);
  background: rgba(229, 43, 58, 0.18);
}

.recent-game-list li a {
  display: block;
  color: inherit;
}

.recent-game-list li a:hover,
.recent-game-list li a:focus-visible {
  color: #ffd9dd;
  outline: none;
}

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

.admin-sidebar {
  display: grid;
  gap: 8px;
  padding: 18px;
  position: sticky;
  top: 110px;
}

.admin-sidebar h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.admin-sidebar a {
  display: block;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.admin-sidebar a:hover,
.admin-sidebar a:focus-visible {
  color: var(--text);
  background: rgba(229, 43, 58, 0.12);
  border-color: var(--border);
  outline: none;
}

.admin-content {
  min-width: 0;
}

.admin-content > h1 {
  margin-top: 0;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.admin-stat {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  color: inherit;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.admin-stat:hover,
.admin-stat:focus-visible {
  border-color: rgba(255, 57, 72, 0.72);
  background: rgba(229, 43, 58, 0.1);
  box-shadow: 0 12px 28px rgba(10, 4, 5, 0.28);
  transform: translateY(-2px);
  outline: none;
}

.admin-stat span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-stat span b {
  color: var(--primary-bright);
  font-size: 1.1rem;
  opacity: 0.75;
}

.admin-stat strong {
  font-size: 1.55rem;
}

.admin-game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-game-actions form {
  margin: 0;
}

.anti-cheat-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.anti-cheat-actions {
  width: 230px;
  min-width: 230px;
  vertical-align: top;
}
.anti-cheat-actions > .secondary-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.anti-cheat-actions form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 7px;
  align-items: stretch;
}
.anti-cheat-actions select {
  min-width: 0;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.status-pill {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(229, 43, 58, 0.14);
  color: #ffabb2;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.stop-game-reason {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-game-actions .hidden {
  display: none !important;
}

.admin-game-actions select {
  max-width: 170px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.admin-game-actions select option {
  color: #1b0b0e;
}

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

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .admin-sidebar h2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  .padded-panel {
    padding: 14px;
    border-radius: 16px;
  }
}

@media (max-width: 1180px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .right-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .quickplay-grid,
  .feature-grid,
  .right-panel {
    grid-template-columns: 1fr 1fr;
  }

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

  .hero-slider {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    margin-top: -4px;
  }
}

@media (max-width: 560px) {
  .quickplay-grid,
  .feature-grid,
  .right-panel,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .container {
    width: min(100% - 18px, 1400px);
  }
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  flex-wrap: wrap;
}

.pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stat-item {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
}

.stat-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-item strong {
  font-size: 1.55rem;
}

.two-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

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

.leaderboard-table th,
.leaderboard-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 12px 10px;
}

.leaderboard-table th {
  color: var(--muted);
  font-weight: 600;
}

.user-actions-cell {
  min-width: 360px;
}

.user-actions-cell form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 3px 6px 3px 0;
  vertical-align: middle;
}

.user-actions-cell select,
.user-actions-cell input {
  min-width: 135px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  background: rgba(8, 4, 6, 0.9);
}

.user-actions-cell input {
  min-width: 150px;
}

.user-actions-cell .primary-button,
.user-actions-cell .secondary-button,
.user-actions-cell .danger-button {
  padding: 9px 12px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .user-actions-cell {
    min-width: 280px;
  }

  @media (min-width: 1181px) {
    body:has(.dashboard-shell) .dashboard-shell {
      grid-template-columns: 214px minmax(520px, 1.55fr) minmax(220px, 0.72fr) minmax(250px, 0.82fr);
    }

    body:has(.dashboard-shell) .right-panel {
      display: contents;
    }

    body:has(.dashboard-shell) .profile-rail,
    body:has(.dashboard-shell) .recent-panel {
      grid-column: 3;
    }

    body:has(.dashboard-shell) .leaderboard-panel,
    body:has(.dashboard-shell) .online-panel {
      grid-column: 4;
    }
  }

  /* Final dashboard sizing overrides the shared responsive page rules above. */
  @media (min-width: 1181px) {
    body:has(.dashboard-shell) .dashboard-shell {
      grid-template-columns: 188px minmax(0, 1fr) 292px;
      max-width: 1416px;
      gap: 18px;
    }

    body:has(.dashboard-shell) .right-panel {
      display: grid;
      grid-column: auto;
      gap: 14px;
      align-content: start;
    }

    body:has(.dashboard-shell) .profile-rail,
    body:has(.dashboard-shell) .leaderboard-panel,
    body:has(.dashboard-shell) .recent-panel {
      grid-column: auto;
    }
  }

  .user-actions-cell form.moderation-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .user-actions-cell form.moderation-form select,
  .user-actions-cell form.moderation-form input,
  .user-actions-cell form.moderation-form button {
    min-width: 0;
    width: 100%;
  }
}

.recent-game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.recent-game-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.help-page {
  max-width: 1100px;
  margin: 0 auto;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.help-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
}

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

.help-card p {
  color: var(--muted);
  flex: 1;
}

.help-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(229, 43, 58, 0.14);
  color: #ffd2d6;
  font-size: 1.25rem;
}

/* Modern play arena */
.play-layout {
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) 280px;
  gap: 18px;
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}

.lobby-panel,
.chat-panel,
.board-panel {
  min-width: 0;
  border-color: rgba(126, 35, 45, 0.72);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.lobby-panel,
.chat-panel {
  padding: 20px;
}

.play-panel-heading,
.board-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.play-panel-heading h2,
.board-panel-heading h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.live-dot,
.chat-status {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(56, 211, 159, 0.1), 0 0 14px rgba(56, 211, 159, 0.8);
}

.time-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.time-button {
  min-height: 42px;
  padding: 8px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}

.time-button:hover,
.time-button.active {
  border-color: var(--primary);
  background: rgba(229, 43, 58, 0.16);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(229, 43, 58, 0.14);
}

.lobby-panel > .primary-button,
.lobby-panel > .secondary-button {
  width: 100%;
  margin-bottom: 9px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid rgba(56, 211, 159, 0.2);
  border-radius: 10px;
  background: rgba(56, 211, 159, 0.06);
  color: #bcebdc;
  font-size: 0.82rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.private-room-box {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.ai-box {
  display: grid;
  gap: 9px;
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

.ai-box label {
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-box select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #241015;
  color: var(--text);
}

.ai-box .secondary-button {
  width: 100%;
}

.panel-caption {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-panel {
  padding: 22px;
  background: radial-gradient(circle at 50% 25%, rgba(229, 43, 58, 0.1), transparent 42%), var(--panel);
}

.board-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(56, 211, 159, 0.22);
  border-radius: 999px;
  color: #bcebdc;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.session-info {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.session-info > div:not(.vs-badge) {
  display: grid;
  gap: 2px;
}

.session-info > div:last-child {
  text-align: right;
}

.session-info span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.session-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(229, 43, 58, 0.35);
  border-radius: 50%;
  background: rgba(229, 43, 58, 0.12);
  color: #ff9ca5;
  font-size: 0.7rem;
  font-weight: 800;
}

.clock-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.clock-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.clock-card.active-clock {
  border-color: rgba(255, 210, 122, 0.9);
  background: rgba(255, 210, 122, 0.1);
  box-shadow: 0 0 0 2px rgba(255, 210, 122, 0.12), 0 0 22px rgba(255, 210, 122, 0.16);
}

.clock-card.low-clock .clock {
  color: #ff8d97;
}

.clock-card > span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.clock {
  color: #fff;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(100%, 680px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 8px solid #35131a;
  border-radius: 12px;
  background: #35131a;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 94, 105, 0.18);
}

.chess-board-stage {
  position: relative;
  width: min(100%, 680px);
  margin: 0 auto;
}

.chess-board-stage .chess-board {
  width: 100%;
}

.square {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 0;
  color: #381b1c;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 6vw, 4rem);
  line-height: 1;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.28);
}

.square.light { background: var(--square-light); }
.square.dark { background: var(--square-dark); color: #f8eee2; }
.square.white-piece {
  color: #fff8ef;
  -webkit-text-stroke: 1.1px rgba(17, 9, 12, 0.82);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7), 0 0 12px rgba(255, 255, 255, 0.8), 0 0 18px rgba(255, 255, 255, 0.35);
}
.square.black-piece {
  color: #1b1014;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.45);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.42), 0 0 10px rgba(0, 0, 0, 0.5);
}
.square.dark.black-piece {
  color: #1b1014;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.38);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.34), 0 0 11px rgba(0, 0, 0, 0.65);
}
.square:hover {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.game-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.game-message {
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
}

.result-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 1, 3, 0.78);
  backdrop-filter: blur(8px);
}

.hidden {
  display: none !important;
}

.result-overlay.hidden { display: none; }

.result-card {
  position: relative;
  width: min(100%, 420px);
  padding: 34px 28px;
  border: 1px solid rgba(229, 43, 58, 0.58);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(52, 15, 22, 0.98), rgba(18, 7, 10, 0.98));
  box-shadow: 0 0 70px rgba(229, 43, 58, 0.24);
  text-align: center;
}

.result-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #ffdfe2;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.result-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.result-crown {
  color: #ff7d87;
  font-size: 3rem;
}

.result-card h2 {
  margin: 8px 0;
  color: #fff4f4;
  font-size: clamp(2rem, 7vw, 3.4rem);
  letter-spacing: 0.08em;
}

.result-title.result-win {
  color: #63f5a5;
  text-shadow: 0 0 10px rgba(55, 230, 133, 0.9), 0 0 28px rgba(55, 230, 133, 0.55);
}

.result-title.result-loss {
  color: #ff6672;
  text-shadow: 0 0 10px rgba(255, 58, 76, 0.9), 0 0 28px rgba(255, 58, 76, 0.55);
}

.result-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.report-card {
  width: min(100%, 460px);
  text-align: left;
}

.report-card h2 {
  margin: 0 0 24px;
  font-size: clamp(1.55rem, 6vw, 2.2rem);
  letter-spacing: 0;
  text-align: center;
}

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

.report-card label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.report-card select,
.report-card textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 11px 12px;
}

.report-card select option {
  color: #1b0b0e;
}

.report-card textarea {
  min-height: 110px;
  resize: vertical;
}

.report-card .game-actions {
  justify-content: center;
  margin-top: 4px;
}

.chat-panel {
  display: flex;
  min-height: 520px;
  flex-direction: column;
}

.chat-panel .play-panel-heading { margin-bottom: 12px; }
.chat-messages {
  display: flex;
  flex: 1;
  min-height: 250px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.16);
}

.chat-entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.chat-entry-content { display: grid; min-width: 0; gap: 3px; }
.chat-author { color: var(--primary-bright); overflow-wrap: anywhere; }
.chat-text { color: var(--text); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-report-button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.chat-report-button:hover,
.chat-report-button:focus-visible { color: var(--primary-bright); border-color: var(--primary); }
.chat-input-row input:disabled,
.chat-input-row button:disabled { opacity: .55; cursor: not-allowed; }
.reported-chat-quote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  overflow-wrap: anywhere;
}
.report-message-cell { min-width: 150px; max-width: 280px; overflow-wrap: anywhere; white-space: pre-wrap; }

.report-review-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.report-review-tabs a {
  min-width: 110px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
}
.report-review-tabs a.active,
.report-review-tabs a:hover,
.report-review-tabs a:focus-visible {
  border-color: var(--primary);
  background: rgba(229, 43, 58, .13);
  color: var(--text);
}

@media (max-width: 600px) {
  .report-review-tabs a { flex: 1; min-width: 0; }
}

.chat-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-input-row input {
  min-width: 0;
  flex: 1;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

@media (max-width: 1100px) {
  .play-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .chat-panel {
    grid-column: 1 / -1;
    min-height: 250px;
  }

  .chat-messages {
    min-height: 120px;
    max-height: 220px;
  }
}

@media (max-width: 900px) {
  .play-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-shell,
  .dashboard-main,
  .hero-panel,
  .hero-copy,
  .hero-visual {
    min-width: 0;
    width: 100%;
  }

  .dashboard-shell .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-shell .sidebar-nav a {
    min-width: 0;
    padding: 10px;
    white-space: nowrap;
  }

  .dashboard-shell .sidebar-nav a,
  .dashboard-shell .sidebar-nav .nav-icon {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-visual {
    min-height: 170px;
  }

  .hero-slides {
    width: min(100%, 360px);
  }

  .hero-slider {
    position: relative;
    right: auto;
    bottom: auto;
    width: calc(100% - 32px);
    margin: 0 16px 16px;
  }

  .board-panel {
    order: -1;
  }

  .lobby-panel,
  .board-panel,
  .chat-panel {
    min-width: 0;
  }

  .chess-board {
    width: min(100%, 620px);
    margin-inline: auto;
  }
}

@media (max-width: 720px) {
  .play-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hero-panel {
    padding: 20px 16px 0;
  }

  .hero-copy h1 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .lobby-panel,
  .board-panel,
  .chat-panel {
    padding: 15px;
  }

  .board-panel {
    order: -1;
  }

  .board-panel-heading {
    margin-bottom: 12px;
  }

  .session-info {
    gap: 7px;
    padding: 10px;
  }

  .clock-row {
    gap: 7px;
    margin: 9px 0;
  }

  .clock-card {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
  }

  .clock {
    font-size: 1.1rem;
  }

  .chess-board {
    border-width: 5px;
    border-radius: 8px;
  }

  .chat-panel {
    min-height: 300px;
  }

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

  .game-actions .primary-button,
  .game-actions .danger-button,
  .game-actions .secondary-button {
    width: 100%;
    min-width: 0;
  }

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

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-items: stretch;
    gap: 12px;
    padding: 14px 20px;
  }

  .brand-wrap {
    grid-column: 1;
  }

  .topbar-actions,
  .topbar > .language-selector {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .search-box {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 2px;
  }

  .main-nav a {
    flex: 0 0 auto;
  }

  .dashboard-shell {
    gap: 14px;
  }

  .sidebar {
    min-height: auto;
    padding: 12px;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: thin;
  }

  .sidebar-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    margin-top: 12px;
    padding-top: 12px;
  }

  .main-nav {
    justify-content: center;
  }

  .dashboard-shell,
  .content-grid,
  .stats-grid,
  .two-column-layout,
  .hero-panel,
  .landing-hero,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .auth-layout {
    min-height: auto;
    width: min(100%, 620px);
    padding: 28px 0;
  }

  .auth-intro {
    text-align: center;
  }

  .auth-intro p {
    margin: 0 auto;
  }

  .auth-emblem {
    display: none;
  }

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

@media (max-width: 640px) {
  .container {
    width: min(100% - 20px, 1400px);
    padding-top: 16px;
    padding-bottom: 36px;
  }

  .topbar {
    padding: 12px 10px;
    gap: 10px;
  }

  .brand-text {
    display: none;
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
    padding-bottom: 4px;
  }

  .main-nav a {
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  .search-box {
    min-height: 40px;
    padding: 0 11px;
  }

  .glass-panel {
    border-radius: 16px;
  }

  .section-head h1,
  .page-head h1 {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .admin-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .admin-sidebar a {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-sidebar h2 {
    font-size: 0.95rem;
  }

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

  .anti-cheat-panel {
    padding: 14px 10px;
  }

  .anti-cheat-panel h1 {
    font-size: 1.35rem;
  }

  .anti-cheat-actions {
    width: 210px;
    min-width: 210px;
  }

  table {
    min-width: 620px;
  }

  .form-grid,
  .inline-row,
  .game-actions,
  .cta-row {
    flex-wrap: wrap;
  }

  .inline-row > *,
  .game-actions > *,
  .cta-row > * {
    min-width: 0;
    flex: 1 1 140px;
  }

  .modal,
  .result-card,
  .report-card {
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .profile-pill span:last-child,
  .logout-form button {
    font-size: 0;
  }

  .topbar-actions .profile-pill span:last-child {
    display: none;
  }

  .logout-form button::before {
    content: "↪";
    font-size: 1.1rem;
  }

  .language-selector {
    max-width: 150px;
  }

  .language-selector select {
    max-width: 105px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-head,

  .profile-header,

  .section-head,

  .landing-features {
    align-items: flex-start;
    flex-direction: column;
  }

  .landing-features {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .auth-layout {
    width: 100%;
    padding: 16px 0;
  }

  .auth-panel {
    padding: 22px 18px;
  }

  .pill-row {
    margin-left: 0;
  }
}

@media (max-width: 380px) {
  .container {
    width: calc(100% - 14px);
  }

  .topbar {
    padding-inline: 7px;
  }

  .topbar-actions {
    gap: 3px;
  }

  .language-selector {
    max-width: 116px;
  }

  .language-selector select {
    max-width: 78px;
    font-size: 0.72rem;
  }

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

@media (min-width: 1181px) {
  body:has(.dashboard-shell) .dashboard-shell {
    grid-template-columns: 214px minmax(520px, 1.55fr) minmax(220px, 0.72fr) minmax(250px, 0.82fr);
  }

  body:has(.dashboard-shell) .right-panel {
    display: contents;
  }

  body:has(.dashboard-shell) .profile-rail,
  body:has(.dashboard-shell) .recent-panel {
    grid-column: 3;
  }

  body:has(.dashboard-shell) .leaderboard-panel,
  body:has(.dashboard-shell) .online-panel {
    grid-column: 4;
  }
}

/* Shared black and red system used on dashboard and every other page. */
body:not(:has(.dashboard-shell)) .topbar {
  min-height: 66px;
  padding: 9px clamp(14px, 2.5vw, 34px);
  gap: clamp(10px, 1.5vw, 22px);
  background: rgba(7, 4, 5, .96);
  border-bottom-color: rgba(145, 30, 44, .55);
}
body:not(:has(.dashboard-shell)) .brand-wrap { gap: 10px; }
body:not(:has(.dashboard-shell)) .brand-mark {
  width: 174px;
  height: 46px;
  flex: 0 0 174px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body:not(:has(.dashboard-shell)) .brand-mark img { object-fit: contain; }
body:not(:has(.dashboard-shell)) .brand-name { display: none; }
body:not(:has(.dashboard-shell)) .brand-credit { margin: 0; color: #c4a5a9; font-size: .75rem; letter-spacing: .04em; }
body:not(:has(.dashboard-shell)) .main-nav { gap: 4px; }
body:not(:has(.dashboard-shell)) .main-nav a { min-height: 40px; display: inline-flex; align-items: center; padding: 8px 10px; border-radius: 9px; font-size: .9rem; }
body:not(:has(.dashboard-shell)) .main-nav a.active,
body:not(:has(.dashboard-shell)) .main-nav a:hover { color:#fff; background:rgba(205,27,48,.16); box-shadow:inset 0 -2px #f12e43; }
body:not(:has(.dashboard-shell)) .glass-panel,

body:not(:has(.dashboard-shell)) .auth-panel,

body:not(:has(.dashboard-shell)) .landing-hero,

body:not(:has(.dashboard-shell)) .result-card {
  border-color: rgba(128, 31, 44, .62);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(24,8,12,.96), rgba(10,5,7,.97));
  box-shadow: 0 18px 40px rgba(0,0,0,.32);
}
body:not(:has(.dashboard-shell)) .page-head h1,
body:not(:has(.dashboard-shell)) .profile-header h1,
body:not(:has(.dashboard-shell)) .admin-content > h1 { overflow-wrap: anywhere; }
body:not(:has(.dashboard-shell)) .primary-button { background: linear-gradient(100deg,#ff293e,#c70b25); box-shadow: 0 8px 22px rgba(221,16,38,.25); }
body:not(:has(.dashboard-shell)) .secondary-button,
body:not(:has(.dashboard-shell)) .back-button { border-color:rgba(183,47,62,.65); background:rgba(38,10,16,.56); }
body:not(:has(.dashboard-shell)) .auth-field input,
body:not(:has(.dashboard-shell)) input:not([type="checkbox"]):not([type="radio"]),
body:not(:has(.dashboard-shell)) textarea,
body:not(:has(.dashboard-shell)) select {
  border-color:rgba(125,47,58,.7);
  border-radius:10px;
  background-color:rgba(11,5,7,.88);
}
body:not(:has(.dashboard-shell)) input:focus,
body:not(:has(.dashboard-shell)) textarea:focus,
body:not(:has(.dashboard-shell)) select:focus { outline:2px solid rgba(255,57,72,.58); outline-offset:1px; }
body:not(:has(.dashboard-shell)) .footer { border-top-color:rgba(124,39,48,.48); background:rgba(7,4,5,.96); }

.language-selector { position:relative; overflow:visible; padding:0; border:0; background:transparent; }
.language-dropdown { position:relative; }
.language-dropdown > summary {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:42px;
  padding:7px 11px;
  border:1px solid rgba(133,42,54,.68);
  border-radius:10px;
  background:rgba(15,7,9,.94);
  color:var(--text);
  cursor:pointer;
  list-style:none;
  white-space:nowrap;
}
.language-dropdown > summary::-webkit-details-marker { display:none; }
.language-dropdown > summary::marker { content:""; }
.country-flag { display:inline-flex; width:24px; height:18px; flex:0 0 24px; overflow:hidden; border:1px solid rgba(255,255,255,.16); border-radius:3px; box-shadow:0 1px 4px rgba(0,0,0,.4); }
.country-flag svg { display:block; width:100%; height:100%; }
.language-current { font-size:.9rem; }
.language-caret { color:#cfafb2; font-size:1rem; }
.language-options { position:absolute; top:calc(100% + 8px); right:0; z-index:120; display:grid; min-width:190px; max-height:min(67vh, 460px); overflow-y:auto; overscroll-behavior:contain; padding:6px; border:1px solid rgba(133,42,54,.72); border-radius:12px; background:#10070a; box-shadow:0 16px 36px rgba(0,0,0,.55); }
.language-dropdown:not([open]) .language-options { display:none; }
.language-options a { display:flex; align-items:center; gap:10px; min-height:42px; padding:7px 9px; border-radius:8px; color:#e8dfe0; }
.language-options a:hover,
.language-options a.active { background:rgba(226,33,54,.18); color:#fff; }
.notification-button { position:relative; display:grid; place-items:center; }
.notification-button svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.notification-dot { position:absolute; top:7px; right:7px; width:8px; height:8px; border:2px solid #090506; border-radius:50%; background:#ff3048; box-shadow:0 0 8px rgba(255,48,72,.65); }

@media (max-width: 900px) {
  body:not(:has(.dashboard-shell)) .topbar { display:flex; flex-wrap:wrap; justify-content:space-between; }
  body:not(:has(.dashboard-shell)) .brand-mark { width:145px; height:40px; flex-basis:145px; }
  body:not(:has(.dashboard-shell)) .main-nav { order:5; width:100%; justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:thin; }
  body:not(:has(.dashboard-shell)) .main-nav a { flex:0 0 auto; }
  body:not(:has(.dashboard-shell)) .topbar .search-box { flex:1 1 220px; }
  body:not(:has(.dashboard-shell)) .topbar-actions { margin-left:auto; }
}
@media (max-width: 560px) {
  body:not(:has(.dashboard-shell)) .topbar { gap:8px; padding:9px 10px; }
  body:not(:has(.dashboard-shell)) .brand-mark { width:120px; height:34px; flex-basis:120px; }
  body:not(:has(.dashboard-shell)) .brand-credit { display:none; }
  body:not(:has(.dashboard-shell)) .topbar .search-box { order:4; flex:1 1 100%; width:100%; }
  body:not(:has(.dashboard-shell)) .topbar-actions { gap:5px; }
  .language-dropdown > summary { gap:5px; min-height:40px; padding:6px 8px; }
  .language-current { font-size:.82rem; }
}


/* Final fixes: keep room creation identical across dashboard and play. */
@media (min-width: 901px) {
  body:has(.dashboard-shell) .topbar .brand-wrap {
    display: flex !important;
    position: fixed;
    z-index: 110;
    top: 15px;
    left: 22px;
    width: 238px;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
  body:has(.dashboard-shell) .topbar .brand-mark { width: 220px; height: 50px; flex: 0 0 220px; }
  .dashboard-sidebar .sidebar-brand { display: none !important; }
}
.dashboard-sidebar .sidebar-nav { margin-top: 22px; }
.quickplay-grid {
  display: flex !important;
  gap: 12px !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #9f2738 #19090d;
}
.quickplay-grid::-webkit-scrollbar,
.game-history-list::-webkit-scrollbar,
.recent-panel .game-list::-webkit-scrollbar { height: 8px; width: 8px; }
.quickplay-grid::-webkit-scrollbar-track,
.game-history-list::-webkit-scrollbar-track,
.recent-panel .game-list::-webkit-scrollbar-track { border-radius: 99px; background: #19090d; }
.quickplay-grid::-webkit-scrollbar-thumb,
.game-history-list::-webkit-scrollbar-thumb,
.recent-panel .game-list::-webkit-scrollbar-thumb { border-radius: 99px; background: #9f2738; }
body:has(.dashboard-shell) .quickplay-card {
  position: relative;
  display: flex;
  flex: 0 0 104px;
  min-width: 104px;
  min-height: 112px;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 12px 10px 10px;
  scroll-snap-align: start;
  text-align: center;
}
.quickplay-launch { display: flex; min-width: 0; height: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: inherit; text-decoration: none; }
.quickplay-launch strong { margin: 0 !important; font-size: 1.1rem !important; line-height: 1.1; }
.quickplay-launch .quickplay-clock { position: static; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: #ff5263; background: rgba(235,34,56,.12); font-size: 1.15rem; }
.quickplay-launch .quickplay-category { display: block; max-width: 100%; margin: 0; overflow: hidden; color: #cdb8bb; font-size: .76rem !important; text-overflow: ellipsis; white-space: nowrap; }
body:has(.dashboard-shell) .mode-info {
  position: absolute;
  z-index: 2;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  padding: 0;
  border: 1px solid rgba(255,119,132,.68);
  border-radius: 50%;
  color: #ffdce0;
  background: #351018;
  font-size: .72rem;
  line-height: 1;
  cursor: pointer;
}
body:has(.dashboard-shell) .mode-popover[hidden] { display: none !important; }
body:has(.dashboard-shell) .mode-popover:not([hidden]) {
  z-index: 500;
  width: min(236px, calc(100vw - 24px));
  max-height: min(150px, calc(100vh - 24px));
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: normal;
}
.room-creator-card { width: min(92vw, 470px); max-height: min(90vh, 760px); overflow-y: auto; }
.room-creator-card h2 { margin: 4px 0 8px; }
.room-creator-card > p { max-width: 52ch; line-height: 1.55; }
.room-creator-form { display: grid; gap: 10px; margin: 18px 0 12px; }
.room-creator-form label,
.room-join-form label { color: #eadadd; font-size: .88rem; font-weight: 700; }
.room-creator-form select { width: 100%; min-height: 46px; }
.room-created-info { padding: 14px; border: 1px solid rgba(225,44,62,.48); border-radius: 12px; background: rgba(40,8,14,.62); }
.room-created-info h3 { margin: 0 0 10px; font-size: 1rem; }
.room-info-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; border-bottom: 1px solid rgba(255,255,255,.08); }
.room-info-row strong { overflow-wrap: anywhere; }
.room-created-info .room-code-row { flex-wrap: wrap; margin-bottom: 0; }
.room-created-info .room-code-row > * { flex: 1 1 120px; text-align: center; }
.room-created-info .primary-button[aria-disabled="true"] { pointer-events: none; opacity: .55; }
.room-join-form { margin-top: 10px; }
.room-join-form > label { display: block; margin-bottom: 7px; }
.room-join-form .room-code-row { flex-wrap: wrap; }
.room-join-form .room-code-row input { min-width: 0; flex: 1 1 160px; }
.custom-room-divider { margin-top: 14px; }
.room-creator-card .status-badge { margin-top: 10px; overflow-wrap: anywhere; }

/* Make game history and the dashboard's recent-games list scroll independently. */
.game-history-list {
  max-height: min(66vh, 720px);
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9f2738 #19090d;
  padding-right: 5px;
}
.recent-panel .game-list {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #9f2738 #19090d;
}
@media (max-width: 900px) {
  body:has(.dashboard-shell) .topbar .brand-wrap { position: static; width: auto; min-height: 0; padding: 0; }
  .quickplay-grid { margin-right: -2px; }
  body:has(.dashboard-shell) .quickplay-card { flex-basis: 100px; min-width: 100px; }
  body:has(.dashboard-shell) .quick-actions { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  body:has(.dashboard-shell) .topbar .brand-wrap { position: static; }
  .room-creator-card { padding: 28px 18px 20px; }
}


/* Notification dropdown and dismiss controls. */
.notification-wrap { position:relative; display:grid; place-items:center; }
.notification-button { z-index:1; }
.notification-dot { display:grid; place-items:center; min-width:10px; width:auto; height:10px; padding:0 2px; border:1px solid #090506; border-radius:999px; color:#fff; font-size:.55rem; font-weight:800; line-height:1; }
.notification-dot[hidden] { display:none !important; }
.notification-panel { position:absolute; z-index:300; top:calc(100% + 10px); right:0; width:min(360px,calc(100vw - 24px)); max-height:min(440px,calc(100vh - 90px)); overflow:hidden; border:1px solid rgba(155,43,57,.72); border-radius:14px; background:linear-gradient(155deg,#18090d,#090507 88%); box-shadow:0 22px 54px rgba(0,0,0,.58),0 0 24px rgba(225,32,53,.13); }
.notification-panel[hidden] { display:none !important; }
.notification-panel-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 15px; border-bottom:1px solid rgba(255,255,255,.08); }
.notification-panel-heading h2 { margin:0; color:#fff0f2; font-size:.98rem; }
.notification-clear { padding:6px 9px; border:1px solid rgba(255,70,91,.3); border-radius:8px; color:#ff9ca7; background:rgba(255,50,73,.08); font-size:.74rem; cursor:pointer; }
.notification-clear:disabled { opacity:.42; cursor:default; }
.notification-list { max-height:min(350px,calc(100vh - 180px)); overflow-y:auto; scrollbar-width:thin; scrollbar-color:#9f2738 #19090d; }
.notification-item { display:grid; grid-template-columns:34px minmax(0,1fr) 28px; align-items:start; gap:10px; padding:13px 12px; border-bottom:1px solid rgba(255,255,255,.06); }
.notification-item:last-child { border-bottom:0; }
.notification-item-icon { display:grid; place-items:center; width:32px; height:32px; border:1px solid rgba(235,45,65,.4); border-radius:10px; color:#ff6d7d; background:rgba(229,43,58,.12); }
.notification-item-copy { min-width:0; }
.notification-item-copy strong { display:block; color:#f6e8ea; font-size:.83rem; }
.notification-item-copy p { margin:4px 0; color:#cbb7ba; font-size:.77rem; line-height:1.4; overflow-wrap:anywhere; }
.notification-item-copy time { color:#907d81; font-size:.68rem; }
.notification-dismiss { display:grid; place-items:center; width:27px; height:27px; padding:0; border:1px solid rgba(255,255,255,.1); border-radius:8px; color:#c9aeb2; background:rgba(255,255,255,.04); font-size:1.15rem; line-height:1; cursor:pointer; }
.notification-dismiss:hover,.notification-dismiss:focus-visible { border-color:rgba(255,76,94,.6); color:#fff; background:rgba(255,50,73,.2); }
.notification-empty { margin:0; padding:26px 18px; color:#bda7aa; text-align:center; font-size:.84rem; }
.notification-empty[hidden] { display:none !important; }
@media (max-width:560px) {
  .notification-panel { position:fixed; top:62px; right:10px; width:min(360px,calc(100vw - 20px)); max-height:calc(100vh - 78px); }
  .notification-list { max-height:calc(100vh - 162px); }
}
@media (prefers-reduced-motion:no-preference) {
  .notification-panel:not([hidden]) { animation:notification-pop .16s ease-out both; transform-origin:top right; }
  @keyframes notification-pop { from { opacity:0; transform:translateY(-5px) scale(.985); } to { opacity:1; transform:translateY(0) scale(1); } }
}

/* Keep the shared header wordmark the same size across dashboard and interior pages. */
body .topbar .brand-mark {
  position: relative;
  width: 160px !important;
  height: 47px !important;
  flex: 0 0 160px !important;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body .topbar .brand-mark img {
  position: absolute;
  left: -18.7%;
  top: -16.6%;
  width: 125.6%;
  height: 116.6%;
  max-width: none;
  object-fit: fill;
}
@media (max-width: 560px) {
  body .topbar .brand-mark { width: 120px !important; height: 35px !important; flex-basis: 120px !important; }
}

/* Keep the authenticated header grid identical on the dashboard and game pages. */
@media (min-width: 901px) {
  body:has(.topbar .profile-pill) .topbar {
    display: grid;
    grid-template-columns: 160px minmax(180px, 420px) minmax(0, 1fr) auto;
    min-height: 72px;
    padding: 10px clamp(18px, 2.2vw, 36px);
    gap: clamp(12px, 1.8vw, 26px);
  }
  body:has(.topbar .profile-pill) .topbar .brand-wrap {
    grid-column: 1;
    grid-row: 1;
    width: 160px;
    min-width: 160px;
    flex: 0 0 160px;
    padding: 0;
  }
  body:has(.topbar .profile-pill) .topbar .brand-text { display: none; }
  body:has(.topbar .profile-pill) .topbar .brand-mark { width: 160px !important; height: 47px !important; flex-basis: 160px !important; }
  body:has(.topbar .profile-pill) .topbar .search-box { grid-column: 2; grid-row: 1; display: flex; width: 100%; max-width: 420px; min-width: 0; }
  body:has(.topbar .profile-pill) .topbar .main-nav { grid-column: 3; grid-row: 1; min-width: 0; }
  body:has(.topbar .profile-pill) .topbar .topbar-actions { grid-column: 4; grid-row: 1; }
}
@media (max-width: 900px) {
  body:has(.topbar .profile-pill) .topbar {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    min-height: 64px;
    padding: 8px 14px;
    gap: 10px;
  }
  body:has(.topbar .profile-pill) .topbar .brand-wrap { grid-column: 1; grid-row: 1; width: 120px; min-width: 120px; flex: 0 0 120px; }
  body:has(.topbar .profile-pill) .topbar .brand-text { display: none; }
  body:has(.topbar .profile-pill) .topbar .brand-mark { width: 120px !important; height: 35px !important; flex-basis: 120px !important; }
  body:has(.topbar .profile-pill) .topbar .search-box { grid-column: 2; grid-row: 1; display: flex; width: 100%; max-width: none; min-width: 0; }
  body:has(.topbar .profile-pill) .topbar .main-nav { display: none; }
  body:has(.topbar .profile-pill) .topbar .topbar-actions { grid-column: 3; grid-row: 1; gap: 6px; }
}
@media (max-width: 560px) {
  body:has(.topbar .profile-pill) .topbar {
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-rows: 36px 38px;
    min-height: 0;
    padding: 8px 12px;
    gap: 7px 9px;
  }
  body:has(.topbar .profile-pill) .topbar .brand-wrap { grid-column: 1; grid-row: 1; }
  body:has(.topbar .profile-pill) .topbar .brand-mark { width: 120px !important; height: 35px !important; flex-basis: 120px !important; }
  body:has(.topbar .profile-pill) .topbar .topbar-actions { grid-column: 2; grid-row: 1; gap: 5px; }
  body:has(.topbar .profile-pill) .topbar .search-box { grid-column: 1 / -1; grid-row: 2; min-height: 38px; }
}
@media (max-width: 420px) {
  body:has(.topbar .profile-pill) .topbar { grid-template-columns: minmax(0, 1fr); grid-template-rows: 36px auto 38px; }
  body:has(.topbar .profile-pill) .topbar .brand-wrap { grid-column: 1; grid-row: 1; }
  body:has(.topbar .profile-pill) .topbar .topbar-actions { grid-column: 1; grid-row: 2; justify-self: end; width: 100%; justify-content: flex-end; }
  body:has(.topbar .profile-pill) .topbar .search-box { grid-column: 1; grid-row: 3; }
}
.sidebar-nav .nav-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #bec7cf;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-nav .nav-icon-home { fill: currentColor; stroke: none; }
.sidebar-nav a.active .nav-icon { color: #fff; }

/* Align the dashboard's mobile wordmark with the shared play-page header. */
@media (max-width: 900px) {
  body:has(.dashboard-shell) .topbar .brand-wrap { align-self: center; transform: translateY(-8px); }
}

/* ===========================================================
 * Şah Mat – modular board edge FX + confirmed move FX (v1)
 * The board itself is never translated, rotated or scaled.
 * =========================================================== */
.chess-board-stage {
  isolation: isolate;
  --fx-main: #5bdfff;
  --fx-soft: rgba(55, 202, 255, .52);
  --fx-glow: rgba(33, 163, 255, .29);
}
.chess-board-stage[data-fx-theme="osmanli"] {
  --fx-main: #ffc16c;
  --fx-soft: rgba(238, 92, 110, .55);
  --fx-glow: rgba(211, 72, 73, .28);
}
.chess-board-stage[data-fx-theme="selcuklu"] {
  --fx-main: #54f0db;
  --fx-soft: rgba(42, 209, 187, .5);
  --fx-glow: rgba(36, 196, 177, .3);
}
.chess-board-stage[data-fx-theme="gokturk"] {
  --fx-main: #8ceff8;
  --fx-soft: rgba(53, 210, 248, .55);
  --fx-glow: rgba(25, 165, 239, .32);
}
.chess-board-stage[data-fx-theme="gece"] {
  --fx-main: #92b1ff;
  --fx-soft: rgba(83, 136, 253, .5);
  --fx-glow: rgba(64, 90, 233, .33);
}
.chess-board-stage[data-fx-theme="kilim"] {
  --fx-main: #ffd48b;
  --fx-soft: rgba(228, 91, 122, .48);
  --fx-glow: rgba(228, 148, 49, .3);
}
.chess-board-stage > .chess-board {
  position: relative;
  z-index: 2;
}
.board-fx-aura,
.board-fx-edge,
.board-fx-corner,
.move-fx-layer { pointer-events: none; }
.board-fx-aura {
  position: absolute;
  inset: -9px;
  z-index: 1;
  border: 2px solid var(--fx-soft);
  border-radius: 16px;
  box-shadow: 0 0 10px var(--fx-main), 0 0 24px var(--fx-glow);
  animation: sahmat-aura-breathe 4s ease-in-out infinite;
}
.board-fx-edge {
  position: absolute;
  z-index: 4;
  overflow: hidden;
  filter: drop-shadow(0 0 7px var(--fx-main));
}
.board-fx-top, .board-fx-bottom {
  left: 1%; width: 98%; height: 9px;
}
.board-fx-top { top: -9px; }
.board-fx-bottom { bottom: -9px; }
.board-fx-left, .board-fx-right {
  top: 1%; height: 98%; width: 9px;
}
.board-fx-left { left: -9px; }
.board-fx-right { right: -9px; }
.board-fx-edge::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent, var(--fx-soft), var(--fx-main), var(--fx-soft), transparent);
  animation: sahmat-flow-x 4.5s linear infinite;
}
.board-fx-right::after, .board-fx-left::after {
  background: linear-gradient(180deg, transparent, var(--fx-soft), var(--fx-main), var(--fx-soft), transparent);
  animation-name: sahmat-flow-y;
}
.board-fx-bottom::after { animation-direction: reverse; }
.board-fx-left::after { animation-direction: reverse; }
.board-fx-corner {
  position: absolute;
  z-index: 5;
  width: 13px;
  height: 13px;
  border: 1px solid var(--fx-main);
  background: radial-gradient(circle, #fff 1px, var(--fx-main) 30%, transparent 78%);
  box-shadow: 0 0 9px var(--fx-main), 0 0 15px var(--fx-soft);
  transform: rotate(45deg);
  animation: sahmat-crystal-pulse 3s ease-in-out infinite;
}
.board-fx-corner-tl { top: -13px; left: -13px; }
.board-fx-corner-tr { top: -13px; right: -13px; animation-delay: -.75s; }
.board-fx-corner-br { bottom: -13px; right: -13px; animation-delay: -1.5s; }
.board-fx-corner-bl { bottom: -13px; left: -13px; animation-delay: -2.25s; }
.move-fx-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: visible;
}
.fx-selection, .fx-burst, .fx-check, .fx-checkmate {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--fx-main);
  box-shadow: 0 0 12px var(--fx-main), inset 0 0 12px var(--fx-soft);
}
.fx-selection {
  opacity: .8;
  animation: sahmat-selection 1.2s ease-in-out infinite;
}
.fx-selection::after {
  content: ''; position: absolute; inset: 9%;
  border: 1px dashed var(--fx-main);
  border-radius: 50%;
}
.fx-burst { animation: sahmat-burst .68s ease-out forwards; }
.fx-burst-capture { border-color: #ffb877; box-shadow: 0 0 18px #ff7c49; }
.fx-landing-wave {
  position: absolute;
  z-index: 13;
  pointer-events: none;
  border-radius: 50%;
  border: 2px solid rgba(122, 228, 255, 0.68);
  box-shadow: 0 0 18px rgba(49, 204, 255, 0.35);
  transform: translate(-50%, -50%) scale(.5);
  animation: fx-landing-wave .76s cubic-bezier(.15,.7,.18,1) forwards;
}
.fx-landing-wave-capture {
  border-color: rgba(255, 168, 95, 0.82);
  box-shadow: 0 0 20px rgba(255, 124, 73, 0.48);
}
.fx-check { border-color: #ff675e; box-shadow: 0 0 18px #ff675e; animation: sahmat-burst 1.05s ease-out forwards; }
.fx-checkmate { border-color: #ff6b55; box-shadow: 0 0 22px #ff544a; animation: sahmat-mate-ring 2.3s ease-out forwards; }
.fx-spark {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--fx-main);
  box-shadow: 0 0 8px var(--fx-main);
  transform: translate(-50%, -50%);
  animation: sahmat-spark .68s ease-out forwards;
}
.fx-trail {
  position: absolute;
  height: 4px;
  z-index: 2;
  transform-origin: 0 50%;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--fx-soft), var(--fx-main));
  box-shadow: 0 0 10px var(--fx-main);
  opacity: 0;
  animation: sahmat-trail .38s ease-out forwards;
}
.fx-flying-piece {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 6vw, 4rem);
  line-height: 1;
  filter: drop-shadow(0 0 7px var(--fx-main));
}
.fx-white-piece {
  color: #fff8ef;
  -webkit-text-stroke: 1.1px rgba(17, 9, 12, .82);
}
.fx-black-piece {
  color: #1b1014;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .45);
}
.square.fx-arrival-hidden {
  color: transparent !important;
  -webkit-text-stroke: 0 transparent !important;
  text-shadow: none !important;
}
.chess-board-stage.fx-final-flash .board-fx-aura {
  animation: sahmat-mate-edge .42s ease-in-out 5 alternate;
}
.chess-board-stage[data-fx-enabled="false"] .board-fx-aura,
.chess-board-stage[data-fx-enabled="false"] .board-fx-edge,
.chess-board-stage[data-fx-enabled="false"] .board-fx-corner {
  display: none !important;
}
.board-fx-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: min(100%, 680px);
  margin: 20px auto 0;
  font-size: .78rem;
  color: var(--muted);
}
.board-fx-toggle, .board-fx-preview {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.board-fx-toggle input { width: 16px; height: 16px; accent-color: #48cbe3; }
.board-fx-preview select {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #241015;
  color: var(--text);
  font: inherit;
}
@keyframes sahmat-flow-x {
  0% { transform: translateX(-110%); opacity: .2; }
  15%, 85% { opacity: 1; }
  100% { transform: translateX(110%); opacity: .2; }
}
@keyframes sahmat-flow-y {
  0% { transform: translateY(-110%); opacity: .2; }
  15%, 85% { opacity: 1; }
  100% { transform: translateY(110%); opacity: .2; }
}
@keyframes sahmat-aura-breathe {
  0%, 100% { opacity: .35; }
  50% { opacity: .85; }
}
@keyframes sahmat-crystal-pulse {
  0%, 100% { opacity: .4; filter: brightness(.8); }
  50% { opacity: 1; filter: brightness(1.8); }
}
@keyframes sahmat-selection {
  0%,100% { opacity: .3; scale: .92; }
  50% { opacity: 1; scale: 1.07; }
}
@keyframes sahmat-burst {
  0% { opacity: 1; scale: .42; }
  100% { opacity: 0; scale: 1.65; }
}
@keyframes sahmat-mate-ring {
  0% { opacity: 1; scale: .6; }
  65% { opacity: 1; scale: 1.6; }
  100% { opacity: 0; scale: 2; }
}
@keyframes sahmat-spark {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))); }
}
@keyframes sahmat-trail {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes sahmat-mate-edge {
  0% { opacity: .4; filter: brightness(1); }
  100% { opacity: 1; filter: brightness(2); }
}
@media (prefers-reduced-motion: reduce) {
  .board-fx-aura, .board-fx-edge::after, .board-fx-corner,
  .fx-selection, .fx-burst, .fx-check, .fx-checkmate, .fx-spark, .fx-trail {
    animation: none !important;
  }
}

/* Board FX v2: animated procedural canvas replaces the plain blue outline. */
.chess-board-stage .board-fx-aura,
.chess-board-stage .board-fx-edge,
.chess-board-stage .board-fx-corner { display: none !important; }
.board-fx-canvas {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: none;
  overflow: visible;
}
.chess-board-stage[data-fx-enabled="false"] .board-fx-canvas { display: none !important; }
.chess-board-stage[data-fx-theme="classic"] {
  --fx-main: #f4d18a;
  --fx-soft: rgba(243, 191, 104, .5);
  --fx-glow: rgba(243, 191, 104, .28);
}
.fx-selection { 
  border: 2px solid var(--fx-main);
  box-shadow: 0 0 7px 2px var(--fx-main), 0 0 25px 5px var(--fx-glow);
}
.fx-selection::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px dotted var(--fx-main);
  box-shadow: 0 0 7px var(--fx-soft);
  animation: fx-orbit 1.65s linear infinite;
}
.fx-selection::after {
  inset: -4px;
  border: 2px dashed var(--fx-main);
  opacity: .85;
  animation: fx-orbit 2.8s linear infinite reverse;
}
.fx-trail {height: 6px; filter: drop-shadow(0 0 6px var(--fx-main));}
.fx-trail::after {
  content: ''; position: absolute; top: -4px; left: 0;
  width: 17px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 12px 5px var(--fx-main);
  animation: fx-trail-comet .38s ease-in-out forwards;
}
.fx-burst::before {
  content: '✦'; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(20px, 5vw, 40px);
  color: var(--fx-main); text-shadow: 0 0 15px var(--fx-main);
  animation: fx-burst-star .68s ease-out forwards;
}
@keyframes fx-orbit { to {transform:rotate(360deg)} }
@keyframes fx-trail-comet { from {left:0; opacity:1;} to {left:calc(100% - 12px); opacity:0;} }
@keyframes fx-burst-star {from {opacity:1; scale:.45;} to {opacity:0; scale:2;} }
@keyframes fx-landing-wave {
  0% { opacity: .8; transform: translate(-50%, -50%) scale(.48); }
  70% { opacity: .34; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
}
@media (prefers-reduced-motion: reduce) {
  .fx-selection::before, .fx-selection::after, .fx-trail::after, .fx-burst::before { animation:none!important; }
}


/* Board FX v3 — obsidian reference base board + theme-specific frame flames */
.chess-board-stage {
  width: min(100%, 760px);
  aspect-ratio: 1;
  margin: 0 auto;
  background: url('/images/board-frame-only-v14.png') center/contain no-repeat;
}

.chess-board-stage .chess-board {
  position: absolute;
  left: 12.85%;
  top: 12.85%;
  width: 74.3%;
  height: 74.3%;
  margin: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(8, 15, 22, 0.12);
  box-shadow: none;
}

.chess-board-stage .square {
  position: relative;
  overflow: hidden;
  font-size: clamp(1.55rem, 4.8vw, 3.45rem);
}

.chess-board-stage .square.light {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 45%),
    radial-gradient(circle at 35% 28%, rgba(255,255,255,0.24), transparent 50%),
    linear-gradient(135deg, #e9edf0 0%, #d2dce2 45%, #f3f6f8 100%);
}

.chess-board-stage .square.dark {
  color: #eefbff;
  background:
    linear-gradient(145deg, rgba(82,185,255,0.12), rgba(0,0,0,0) 44%),
    repeating-linear-gradient(122deg, rgba(52,196,255,0.22) 0 2px, rgba(0,0,0,0) 2px 26px),
    linear-gradient(135deg, #0f1820 0%, #1b2b38 48%, #0c141b 100%);
}

.chess-board-stage .square::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.08));
  pointer-events: none;
}

.chess-board-stage .square.white-piece {
  color: #fdfaf2;
  -webkit-text-stroke: 1.2px rgba(29, 17, 8, 0.72);
  text-shadow: 0 2px 0 rgba(0,0,0,0.58), 0 0 10px rgba(255,255,255,0.55), 0 0 20px rgba(111,214,255,0.2);
}

.chess-board-stage .square.black-piece {
  color: #111920;
  -webkit-text-stroke: 1px rgba(240, 252, 255, 0.52);
  text-shadow: 0 2px 0 rgba(255,255,255,0.2), 0 0 10px rgba(17,44,61,0.55);
}

.chess-board-stage[data-fx-theme="classic"] {
  --fx-main: #ffd286;
  --fx-soft: rgba(255, 194, 101, 0.55);
  --fx-glow: rgba(255, 194, 101, 0.26);
}
.chess-board-stage[data-fx-theme="obsidian"] {
  --fx-main: #56ddff;
  --fx-soft: rgba(79, 214, 255, 0.55);
  --fx-glow: rgba(79, 214, 255, 0.28);
}
.chess-board-stage[data-fx-theme="osmanli"] {
  --fx-main: #ffbc75;
  --fx-soft: rgba(255, 117, 96, 0.55);
  --fx-glow: rgba(255, 117, 96, 0.28);
}
.chess-board-stage[data-fx-theme="selcuklu"] {
  --fx-main: #3ae6d2;
  --fx-soft: rgba(242, 201, 118, 0.55);
  --fx-glow: rgba(58, 230, 210, 0.28);
}
.chess-board-stage[data-fx-theme="gokturk"] {
  --fx-main: #69e3ff;
  --fx-soft: rgba(241, 199, 121, 0.48);
  --fx-glow: rgba(104, 227, 255, 0.28);
}
.chess-board-stage[data-fx-theme="gece"] {
  --fx-main: #9db0ff;
  --fx-soft: rgba(124, 166, 255, 0.52);
  --fx-glow: rgba(124, 166, 255, 0.28);
}
.chess-board-stage[data-fx-theme="kilim"] {
  --fx-main: #ffcb86;
  --fx-soft: rgba(255, 109, 103, 0.55);
  --fx-glow: rgba(255, 109, 103, 0.28);
}

.board-fx-canvas {
  z-index: 4;
}
.move-fx-layer { z-index: 6; }

@media (max-width: 720px) {
  .chess-board-stage {
    width: min(100%, 680px);
  }
}


/* v4 layout fixes: board overlay covers the baked-in reference board correctly */
.chess-board-stage#boardStage,
.chess-board-stage.store-preview-stage {
  background: url('/images/board-frame-only-v14.png') center/contain no-repeat;
}

.chess-board-stage#boardStage .chess-board {
  left: 9.35%;
  top: 9.15%;
  width: 81.3%;
  height: 81.3%;
  border-radius: 6px;
}

.store-preview-stage {
  width: min(100%, 320px);
  max-width: 320px;
  margin: 0 auto;
}
.store-preview-stage .chess-board {
  left: 9.35%;
  top: 9.15%;
  width: 81.3%;
  height: 81.3%;
  border-radius: 4px;
}

.chess-board-preview-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
.store-preview-stage .square {
  border: none;
}
.board-store-link {
  white-space: nowrap;
}

.store-page {
  display: grid;
  gap: 1.25rem;
}
.store-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.store-card {
  display: grid;
  gap: .9rem;
  padding: 1rem;
}
.store-preview-wrap {
  display: flex;
  justify-content: center;
}
.store-card-head {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: flex-start;
}
.store-price {
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-weight: 700;
}
.store-description {
  color: var(--text-soft, rgba(255,255,255,.72));
  line-height: 1.5;
  min-height: 3.8em;
}
.store-card-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.store-status {
  min-height: 1.2rem;
  font-size: .92rem;
}
.store-status.error { color: #ff9e9e; }
.store-status.success { color: #89e1b7; }

@media (max-width: 880px) {
  .store-hero { flex-direction: column; align-items: stretch; }
}

/* v5: no fake TL wallet, preview-only catalogue pending Google Play Billing */
.store-future-payment-status {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 290px;
  padding: 1rem 1.1rem;
  background: rgba(50, 68, 88, 0.18);
  border: 1px solid rgba(146, 190, 218, 0.22);
  border-radius: 14px;
}
.store-future-payment-status strong { color: #c6eaff; }
.store-future-payment-status span { color: var(--muted); font-size: .86rem; line-height: 1.4; }
.store-pricing-note { color: var(--muted); font-size: .84rem; margin: .1rem 0 2rem; }
.store-coming-soon[disabled] { cursor: not-allowed; opacity: 0.66; }
@media (max-width: 880px) { .store-future-payment-status { max-width: none; width: 100%; } }


/* v6 piece design layer */
.chess-board-stage .square.white-piece .piece-glyph,
.chess-board-stage .square.black-piece .piece-glyph {
  transition: text-shadow .25s ease, filter .25s ease, transform .2s ease;
}

.chess-board-stage .square.white-piece .piece-glyph,
.chess-board-stage .square.black-piece .piece-glyph {
  -webkit-background-clip: text;
  background-clip: text;
}

.chess-board-stage[data-fx-theme="classic"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #fff4cf 0%, #f7d37d 44%, #b87a28 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(90, 48, 7, 0.74);
  text-shadow: 0 2px 0 rgba(58, 32, 8, 0.6), 0 0 14px rgba(255, 211, 125, 0.52);
}
.chess-board-stage[data-fx-theme="classic"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #85561e 0%, #4d2d0f 55%, #100804 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 238, 194, 0.44);
  text-shadow: 0 1px 0 rgba(255,236,177,.12), 0 0 10px rgba(180,122,40,.26);
}

.chess-board-stage[data-fx-theme="obsidian"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #eefbff 0%, #99e6ff 42%, #2aa8d9 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(13, 40, 56, .86);
  text-shadow: 0 0 14px rgba(86,221,255,.6), 0 0 24px rgba(30,196,255,.28);
}
.chess-board-stage[data-fx-theme="obsidian"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #32495e 0%, #112130 58%, #041018 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(165, 240, 255, .42);
  text-shadow: 0 0 10px rgba(38,164,224,.28);
}

.chess-board-stage[data-fx-theme="osmanli"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #fff1df 0%, #ffb86c 46%, #c7503b 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(95, 24, 32, .82);
  text-shadow: 0 0 12px rgba(255,107,83,.46), 0 0 22px rgba(255,197,109,.28);
}
.chess-board-stage[data-fx-theme="osmanli"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #7a1d2f 0%, #471018 52%, #140508 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 220, 165, .45);
  text-shadow: 0 0 10px rgba(255,107,83,.24);
}

.chess-board-stage[data-fx-theme="selcuklu"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #fdf8d9 0%, #66f0db 42%, #16989e 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(14, 79, 96, .84);
  text-shadow: 0 0 12px rgba(52,240,216,.46), 0 0 24px rgba(242,201,118,.22);
}
.chess-board-stage[data-fx-theme="selcuklu"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #24515f 0%, #123039 58%, #050e12 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(242,201,118,.42);
  text-shadow: 0 0 10px rgba(52,240,216,.24);
}

.chess-board-stage[data-fx-theme="gokturk"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #fff4cb 0%, #6ce8ff 44%, #1b78bf 100%);
  color: transparent;
  -webkit-text-stroke: 1.1px rgba(16, 42, 66, .88);
  text-shadow: 0 0 15px rgba(108,232,255,.58), 0 0 24px rgba(247,215,155,.18);
}
.chess-board-stage[data-fx-theme="gokturk"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #355165 0%, #132739 58%, #050d14 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(247, 215, 155, .46);
  text-shadow: 0 0 10px rgba(108,232,255,.28);
}

.chess-board-stage[data-fx-theme="gece"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #ffffff 0%, #dfe8ff 38%, #90a4ff 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(20, 31, 70, .84);
  text-shadow: 0 0 12px rgba(157,180,255,.54), 0 0 24px rgba(93,120,255,.22);
}
.chess-board-stage[data-fx-theme="gece"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #33406f 0%, #1d274f 52%, #090d1e 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(230,238,255,.35);
  text-shadow: 0 0 10px rgba(157,180,255,.24);
}

.chess-board-stage[data-fx-theme="kilim"] .square.white-piece .piece-glyph {
  background-image: linear-gradient(180deg, #fff0d8 0%, #ffca7a 44%, #d8643a 100%);
  color: transparent;
  -webkit-text-stroke: 1.05px rgba(105, 57, 42, .84);
  text-shadow: 0 0 12px rgba(255,125,86,.42), 0 0 24px rgba(247,197,108,.24);
}
.chess-board-stage[data-fx-theme="kilim"] .square.black-piece .piece-glyph {
  background-image: linear-gradient(180deg, #83462f 0%, #4f2617 56%, #180a06 100%);
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,227,184,.38);
  text-shadow: 0 0 10px rgba(255,125,86,.22);
}

.chess-board-stage .square.piece-k .piece-glyph,
.chess-board-stage .square.piece-q .piece-glyph {
  filter: drop-shadow(0 0 4px rgba(255,255,255,.1));
}
.chess-board-stage .square.piece-n .piece-glyph,
.chess-board-stage .square.piece-b .piece-glyph {
  transform: translateY(-1px);
}


/* v6.1 — Critical board/layer geometry repair.
   Original premium illustration includes painted pieces. The application must ONLY display
   the untouched decorative border; the interactive 64-square DOM grid supplies all pieces. */
.chess-board-stage#boardStage,
.chess-board-stage.store-preview-stage {
  background-image: none !important;
  background-color: #0e1821;
  --board-art-inset: 7.256%;
  --board-art-size: 85.488%;
}
.chess-board-stage#boardStage::after,
.chess-board-stage.store-preview-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: url('/images/board-frame-only-v14.png') center/100% 100% no-repeat;
}
.chess-board-stage#boardStage > .chess-board,
.chess-board-stage.store-preview-stage > .chess-board {
  position: absolute;
  left: var(--board-art-inset);
  top: var(--board-art-inset);
  width: var(--board-art-size);
  height: var(--board-art-size);
  aspect-ratio: 1;
  border: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  background: #09151c;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}
.chess-board-stage .square.light {
  background: #edf2f5 url('/images/board-square-marble-light.jpg') center/cover no-repeat;
}
.chess-board-stage .square.dark {
  background: #10242f url('/images/board-square-marble-dark.jpg') center/cover no-repeat;
}
.chess-board-stage#boardStage .square,
.chess-board-stage.store-preview-stage .square {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-width: 0;
  min-height: 0;
}
/* Piece gradients are applied to glyphs, NEVER the square buttons: button backgrounds
   must stay opaque or the old painted pieces on a legacy board can shine through. */
.chess-board-stage .square.white-piece .piece-glyph,
.chess-board-stage .square.black-piece .piece-glyph {
  display: inline-block;
  line-height: 1;
  max-width: 100%;
  background-clip: text;
  -webkit-background-clip: text;
  pointer-events: none;
  transition: filter .25s, text-shadow .25s;
}
.chess-board-stage .square.fx-arrival-hidden .piece-glyph { visibility: hidden !important; }


/* v7: Filled, board-matched chess pieces and legal move shadows */
.chess-board-stage .square { position:relative; overflow:hidden; isolation:isolate; }
.chess-board-stage .square .piece-skin-image {
  display:block !important; position:absolute; top:3%;left:4%;width:92%;height:94%;
  object-fit:contain;z-index:2;pointer-events:none;
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.47));
  transition: filter .2s ease,transform .2s ease;
}
.chess-board-stage .square .piece-skin-image.fx-arrival-hidden,
.chess-board-stage .square.fx-arrival-hidden .piece-skin-image { visibility:hidden!important; }
.chess-board-stage .square.legal-square::before,
.chess-board-stage .square.legal-capture::before {
 content:'';position:absolute;inset:0;pointer-events:none;z-index:1;
 background:radial-gradient(ellipse at center,rgba(37,42,51,.47) 0 17%,rgba(24,37,45,.3) 21%,transparent 70%);
 box-shadow:inset 0 0 12px rgba(8,22,34,.29);
}
.chess-board-stage .square.legal-capture::before {
 background:radial-gradient(circle,transparent 0 32%,rgba(20,38,44,.44) 35%,rgba(20,38,44,.54) 68%,transparent 70%);
 box-shadow:inset 0 0 0 3px rgba(21,30,38,.42);
}
.chess-board-stage .square.legal-square:not(.white-piece):not(.black-piece)::after{
 content:'';position:absolute;inset:35%;z-index:3;pointer-events:none;border-radius:50%;
 background:rgba(16,31,41,.58);box-shadow:0 0 10px rgba(7,17,24,.55);
}
.chess-board-stage .square.legal-capture .piece-skin-image {filter:drop-shadow(0 0 5px rgba(242,194,104,.64))}
.board-piece-toolbar {display:flex;align-items:center;justify-content:flex-end;gap:12px;margin:10px 0 16px;flex-wrap:wrap}
.board-piece-toolbar select {max-width:220px;border:1px solid rgba(223,182,122,.29);background:#171115;color:#fff;padding:9px;border-radius:10px}
.fx-piece-skin {padding:0!important;margin:0!important;object-fit:contain!important;overflow:visible!important;pointer-events:none!important;z-index:18!important;}
.fx-skin-trail {z-index:14;opacity:.6;filter:drop-shadow(0 0 5px var(--fx-main))}
.fx-trail-obsidian {background:linear-gradient(90deg,#0de6ff,#206df5,transparent)!important;height:3px!important}
.fx-trail-osmanli {background:linear-gradient(90deg,#f8d377,#c84c6e,transparent)!important;height:4px!important}
.fx-trail-selcuklu {background:linear-gradient(90deg,#54eddb,#ffdb82,transparent)!important;height:3px!important}
.fx-trail-gokturk {background:linear-gradient(90deg,#8bcdf4,#4a80b3,transparent)!important;height:4px!important}
.fx-trail-gece {background:linear-gradient(90deg,#c7d6ff,#5c69ff,transparent)!important;height:8px!important;filter:blur(4px)}
.fx-trail-kilim {background:linear-gradient(90deg,#ffbf79,#ec6153,transparent)!important;height:4px!important}
.fx-piece-particle {position:absolute;z-index:16;font-size:16px;color:#ffe4a5;animation:sahmat-piece-particle .86s ease-out var(--particle-delay) both;pointer-events:none;transform:translate(-50%,-50%);text-shadow:0 0 10px currentColor;filter:drop-shadow(0 0 6px currentColor)}
.fx-particle-obsidian {color:#2bdfff}.fx-particle-osmanli {color:#ffad6c}.fx-particle-selcuklu {color:#52ffdb}.fx-particle-gokturk{color:#a8d6fb}.fx-particle-gece{color:#a5b6ff}.fx-particle-kilim{color:#ffab76}
@keyframes sahmat-piece-particle {0%{opacity:0;transform:translate(-50%,4px) scale(.38)}18%{opacity:1}55%{opacity:1;transform:translate(-50%,-10px) scale(1)}100%{opacity:0;transform:translate(-50%,-34px) scale(1.5)}}
@media(prefers-reduced-motion:reduce){.fx-piece-particle{animation:none;display:none}}

/* Store tabs + preview: board and piece purchases remain Google Play locked */
.store-tabs {display:flex;gap:12px;margin:4px 0 14px;flex-wrap:wrap}
.store-tab{border:1px solid rgba(223,179,117,.3);color:#dbcac0;background:rgba(25,15,16,.8);padding:13px 27px;border-radius:12px;cursor:pointer;font:inherit;font-weight:750}
.store-tab.active{color:#fff5da;border-color:#c8a56a;background:linear-gradient(135deg,rgba(135,66,33,.38),rgba(60,25,31,.92));box-shadow:0 0 0 1px rgba(239,183,104,.18)}
.store-grid[hidden] {display:none!important}
.piece-store-preview {background:radial-gradient(ellipse at 50% 30%,#233b49,#0c1118 76%);padding:14px;border:1px solid rgba(229,190,103,.3);border-radius:13px;overflow:hidden}
.piece-store-row {display:grid;grid-template-columns:repeat(6,1fr);gap:4px;align-items:end}
.piece-store-row img {width:100%;height:90px;object-fit:contain;filter:drop-shadow(0 3px 4px #070b0e)}
.piece-store-row + .piece-store-row {border-top:1px solid rgba(193,166,120,.24);padding-top:7px;margin-top:7px}
.piece-store-preview.is-previewing .piece-store-row img {animation: piece-store-demo 1.2s cubic-bezier(.19,.6,.23,1.2) 2 alternate}
.piece-store-preview[data-piece-theme="obsidian"].is-previewing img {animation-timing-function:steps(6,end);filter:drop-shadow(0 0 6px #25dfff)}
.piece-store-preview[data-piece-theme="gokturk"].is-previewing img {animation-name:piece-store-rune}
.piece-store-preview[data-piece-theme="gece"].is-previewing img {animation-name:piece-store-ghost}
.piece-store-preview[data-piece-theme="kilim"].is-previewing img {animation-name:piece-store-bounce}
.piece-store-preview[data-piece-theme="selcuklu"].is-previewing img {animation-name:piece-store-star}
@keyframes piece-store-demo{0%{transform:translate(0,0) scale(1)}35%{transform:translate(10px,-15px) scale(1.03)}70%{transform:translate(4px,-6px) scale(1.01)}100%{transform:translate(0,0) scale(1)}}
@keyframes piece-store-rune{0%{transform:translateY(0)}35%{transform:translate(11px,-8px) rotate(-9deg)}68%{transform:translate(4px,-2px) rotate(-3deg)}100%{transform:translateY(0)}}
@keyframes piece-store-ghost{0%{opacity:1;transform:translate(0,0) scale(1)}50%{opacity:.35;transform:translate(14px,-10px) scale(1.06)}100%{opacity:1;transform:translate(0,0) scale(1)}}
@keyframes piece-store-bounce{0%{transform:translate(0,0) scale(1)}45%{transform:translate(9px,-21px) scale(1.08)}75%{transform:translate(4px,-5px) scale(1.03)}100%{transform:translate(0,0) scale(1)}}
@keyframes piece-store-star{0%{transform:translate(0,0) rotate(0deg)}36%{transform:translate(10px,-13px) rotate(10deg) scale(1.04)}72%{transform:translate(3px,-4px) rotate(3deg)}100%{transform:translate(0,0) rotate(0deg)}}

/* Friends, social actions and spectator UI */
.social-page{max-width:1220px;margin:0 auto;padding:10px 0 35px;display:grid;gap:20px}
.social-title{display:flex;align-items:center;justify-content:space-between;gap:20px}.social-title h1{font-size:clamp(28px,4vw,43px);margin:5px 0}.social-title p{color:#beaeb3}.social-count{padding:10px 18px;border-radius:99px;border:1px solid rgba(207,170,108,.24)}
.social-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:20px}
.social-panel{padding:22px;min-width:0}.social-panel h2{font-size:18px;margin:12px 0 16px}.social-muted{font-size:13px;color:#b9aaa7}
.social-search{display:flex;gap:9px;margin-bottom:25px}.social-search input,.friend-chat-form input{flex:1;min-width:0;background:#1e151a;border:1px solid #654046;border-radius:9px;color:white;padding:12px}
.social-list{display:grid;gap:8px}.social-row{display:flex;align-items:center;gap:13px;background:rgba(16,10,14,.8);border:1px solid rgba(150,92,97,.2);border-radius:12px;padding:12px;min-width:0}
.social-row img{width:43px;height:43px;object-fit:cover;border-radius:50%}.social-row strong{min-width:0;overflow-wrap:anywhere}
.social-row-actions{display:flex;gap:6px;align-items:center;margin-left:auto;flex-wrap:wrap}.social-row-actions button{font-size:12px}
.social-empty,.social-waiting{color:#ada0a4;padding:12px}.social-waiting{display:flex;justify-content:space-between}
.friend-meta{display:grid;gap:4px;flex:1}.friend-meta small{font-size:12px}.friend-online{color:#73e1af}.friend-offline{color:#ac9b9b}
.friend-menu-container{position:relative}.friend-more{background:#372026;border:1px solid #72505b;color:#fff;min-width:39px;height:36px;border-radius:10px;cursor:pointer;font-size:20px;font-weight:800;letter-spacing:1px}
.friend-action-menu{position:absolute;right:0;top:calc(100% + 8px);z-index:40;width:190px;background:#26171d;border:1px solid #7b4e57;border-radius:12px;box-shadow:0 15px 32px #0009;padding:6px}
.friend-action-menu[hidden]{display:none!important}.friend-action-menu a,.friend-action-menu button{display:block;width:100%;padding:12px 10px;background:transparent;border:0;color:#f0e4e4;cursor:pointer;text-align:left;font:inherit;text-decoration:none;border-radius:8px;font-size:14px}
.friend-action-menu a:hover,.friend-action-menu button:hover{background:rgba(199,90,91,.22)}.friend-action-menu .friend-remove{color:#ffacb0}
.social-feedback{min-height:24px;color:#f5d5ac}.social-back{color:#d8b78a;text-decoration:none}
.friend-chat-messages{height:min(60vh,580px);overflow-y:auto;display:flex;flex-direction:column;gap:10px;padding:15px;background:#100e14;border-radius:12px}
.friend-message{max-width:78%;padding:11px 13px;background:#30212a;color:#faf1e9;border-radius:14px;display:grid;gap:5px;overflow-wrap:anywhere}.friend-message.mine{margin-left:auto;background:#673039}.friend-message small{font-size:10px;opacity:.66}.friend-chat-form{display:flex;gap:10px;margin-top:12px}
.watch-panel{max-width:740px;margin:0 auto;width:100%}.watch-players{text-align:center;padding:14px;font-size:21px;font-weight:700}.watch-board{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;max-width:650px;margin:auto;border:12px solid #364b57;box-shadow:0 16px 35px #0009}
.watch-square{position:relative;display:grid;place-items:center;min-width:0;min-height:0}.watch-square.light{background:#e9eff0}.watch-square.dark{background:#163343}.watch-square img{width:97%;height:97%;object-fit:contain}
@media(max-width:900px){.social-grid{grid-template-columns:1fr}.social-row{flex-wrap:wrap}.friend-meta{min-width:0}.social-row-actions{margin-left:0}.piece-store-row img{height:70px}}
@media(prefers-reduced-motion:reduce){.piece-store-preview.is-previewing img{animation:none}}

/* v8 replay: same premium frame, exact 64-square layout and solid piece sprites as play */
.chess-board-stage.replay-stage { width:min(640px,100%); max-width:640px; margin:0 auto; background-image:none!important; background-color:#0e1821; --board-art-inset:7.256%; --board-art-size:85.488%; }
.chess-board-stage.replay-stage::after {content:'';position:absolute;inset:0;z-index:3;pointer-events:none;background:url('/images/board-frame-only-v14.png') center/100% 100% no-repeat;}
.chess-board-stage.replay-stage > .chess-board {position:absolute;left:var(--board-art-inset);top:var(--board-art-inset);width:var(--board-art-size);height:var(--board-art-size);aspect-ratio:1;border:0;margin:0;padding:0;border-radius:0;overflow:hidden;box-shadow:none;background:#09151c;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:repeat(8,minmax(0,1fr));}
.chess-board-stage.replay-stage .square {box-sizing:border-box;width:100%;height:100%;aspect-ratio:auto;min-width:0;min-height:0;cursor:default;}
.replay-view-settings {display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:9px;margin:2px auto 8px;text-align:center;}
.replay-view-settings select {padding:8px 12px;border-radius:10px;border:1px solid rgba(255,220,161,.3);background:#1a151a;color:#f8e8d6;}
.replay-view-settings small {flex-basis:100%;color:#b5a8ac;}
/* No legal shadows are rendered on real online boards; only in practice. */
.chess-board-stage:not(.practice-stage) .square.legal-square::before,
.chess-board-stage:not(.practice-stage) .square.legal-capture::before,
.chess-board-stage:not(.practice-stage) .square.legal-square::after {display:none!important}
.onboarding-shell {max-width:900px;margin:0 auto;display:grid;gap:18px;padding:28px;}
.onboarding-head h1 {font-size:clamp(28px,4vw,40px);margin:6px 0 10px;}
.onboarding-head p,.onboarding-step p {color:#c9bcc0;line-height:1.6;}
.onboarding-progress {height:5px;border-radius:12px;background:#453035;overflow:hidden;margin:4px 0 16px;}
.onboarding-progress span {height:100%;background:#dd6b72;display:block;width:20%;transition:width .25s;}
.onboarding-step {display:none;min-height:190px;}
.onboarding-step.active {display:block;}
.onboarding-cards {display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin-top:20px;}
.onboarding-cards a,.onboarding-cards .tour-location {display:grid;gap:5px;padding:15px;border:1px solid #68454c;border-radius:12px;background:rgba(25,13,19,.7);color:#fff;text-decoration:none;}
.onboarding-cards small {color:#bfabb0;}
.onboarding-actions {display:flex;gap:12px;flex-wrap:wrap;align-items:center;justify-content:flex-end;}
.onboarding-choice {border:1px solid rgba(255,255,255,.2);border-radius:12px;padding:12px 18px;color:#fceef2;background:#21161b;cursor:pointer;margin:10px 8px 0 0;}
.onboarding-choice.selected {background:#81343e;border-color:#ffc7c9;}
.practice-layout {display:grid;grid-template-columns:minmax(280px,650px) minmax(250px,340px);gap:22px;align-items:start;max-width:1100px;margin:0 auto;}
.practice-layout .chess-board-stage {width:100%;}
.practice-panel {padding:24px;display:grid;gap:14px;}
.practice-panel p {color:#cfc0c4;line-height:1.5;}
.practice-stage .square.legal-square::before,.practice-stage .square.legal-capture::before {opacity:1!important;}
@media(max-width:920px){.practice-layout {grid-template-columns:1fr}.onboarding-shell{padding:18px;}}

/* v13 — Ability Arena and real elemental travel effects */
.power-home{max-width:1120px;margin:15px auto 40px;display:grid;gap:22px;min-width:0}
.power-hero{padding:clamp(18px,3vw,32px);display:flex;gap:20px;flex-wrap:wrap;justify-content:space-between;align-items:center;border:1px solid rgba(227,170,86,.36);border-radius:18px;background:radial-gradient(circle at 80% 50%,rgba(186,100,45,.16),transparent 44%),#140e17}
.power-hero h1{font-size:clamp(29px,4.2vw,48px);margin:8px 0}.power-hero p{max-width:650px;color:#decacc;line-height:1.55}.power-hero .power-rule{color:#aebdc7;font-size:.9rem}
.power-wallet{border:1px solid #81633c;border-radius:17px;padding:19px 23px;background:rgba(55,37,23,.66);display:grid;gap:8px;min-width:170px}.power-wallet small{color:#d6ba8e}.power-wallet strong{font-size:25px;color:#ffe6a1}
.power-main-actions{display:flex;flex-wrap:wrap;gap:12px}.power-main-actions a{text-decoration:none;padding:13px 18px;min-width:160px;text-align:center}
.power-section-heading{margin:4px 0 0}.power-skill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.power-skill{padding:21px;display:flex;flex-direction:column;gap:12px;min-width:0;border:1px solid rgba(186,128,84,.43);border-radius:16px;background:linear-gradient(155deg,rgba(51,28,31,.94),rgba(15,17,25,.92))}
.power-skill-icon{font-size:41px;line-height:1.2}.power-skill h3{font-size:20px;margin:0;color:#ffe9cc}.power-skill p{font-size:.91rem;color:#c8bdc6;line-height:1.5;min-height:66px;margin:0}
.power-level{display:flex;justify-content:space-between;color:#f8d6a7;align-items:center;gap:10px;flex-wrap:wrap}.power-level strong{font-size:21px}
.power-skill-actions{display:grid;gap:10px;margin-top:auto}.power-skill-actions .primary-button,.power-skill-actions .secondary-button{width:100%}.power-skill-actions small{color:#c8aa84}
.power-info{border:1px solid rgba(183,136,74,.26);border-radius:12px;padding:18px;color:#d0c6ca;font-size:.88rem}.power-info p{margin:4px 0 10px}.power-status{min-height:24px;color:#f5dd9d}
.power-match-marker,.power-lobby-info{border:1px solid rgba(218,173,98,.37);border-radius:12px;background:rgba(67,41,23,.34);padding:12px;color:#fce2ae}.power-lobby-info{display:grid;gap:6px;margin:12px 0;font-size:13px}.power-lobby-info p{margin:0;color:#b2c0c9}.power-lobby-info a{color:#aaddff;text-decoration:none}
.game-power-panel{margin:13px auto 10px;padding:13px;border:1px solid rgba(253,178,93,.45);border-radius:14px;background:linear-gradient(140deg,rgba(60,31,19,.7),rgba(8,25,37,.85));display:grid;gap:10px;width:100%;max-width:680px;box-sizing:border-box}
.power-game-title{color:#ffdea6;font-weight:800;display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}.power-game-title a{color:#80deef;font-weight:500;font-size:.85rem}
.game-power-buttons{display:flex;gap:9px;flex-wrap:wrap;align-items:center}.game-power-buttons button{min-height:44px;white-space:normal;flex:1 1 170px}.game-power-buttons button[data-used="true"]{opacity:.42}.game-power-passive{padding:10px;border:1px dashed rgba(245,176,102,.3);border-radius:9px;font-size:13px;color:#ffc484}.game-power-panel small{color:#a9dfde;min-height:15px}
.fx-elemental{position:absolute;z-index:15;pointer-events:none;line-height:1;font-size:19px;opacity:0;transform-origin:50% 100%;animation:fx-elemental-rise .9s ease-out var(--fx-delay) forwards}
.fx-elemental-lightning{color:#d8fcff;text-shadow:0 0 5px #fff,0 0 10px #09cbfa,0 0 17px #279eff;filter:drop-shadow(0 0 3px #50dfff);font-size:22px;animation-name:fx-elemental-zap}
.fx-elemental-flame{width:13px;height:24px;background:radial-gradient(ellipse at 50% 84%,#fffbd8 0 12%,#ffd367 14% 27%,#fd631c 38% 62%,rgba(231,30,0,0) 72%);border-radius:65% 50% 65% 55%;filter:drop-shadow(0 0 7px #fa7936);clip-path:polygon(48% 0,64% 26%,85% 10%,90% 61%,69% 100%,28% 100%,8% 55%,31% 24%);animation-name:fx-elemental-burn}
.fx-elemental-star{color:#51ffee;font-size:23px;text-shadow:0 0 13px #20c1c9;animation-name:fx-elemental-star}
.fx-elemental-mist{color:#e4dfff;text-shadow:0 0 10px #789be4;font-size:29px;animation-name:fx-elemental-mist}
@keyframes fx-elemental-rise{0%{opacity:0;transform:translate(-50%,0) scale(.35)}20%{opacity:1}70%{opacity:.8}100%{opacity:0;transform:translate(-50%,calc(-1*var(--fx-rise))) scale(1.28)}}
@keyframes fx-elemental-zap{0%,100%{opacity:0;transform:translate(-50%,2px) scale(.3) rotate(25deg)}15%{opacity:1}28%{opacity:.25}37%{opacity:1;transform:translate(-50%,-9px) scale(1.3) rotate(-13deg)}48%{opacity:.25}65%{opacity:1}85%{opacity:.1;transform:translate(-50%,calc(-1*var(--fx-rise))) scale(.8) rotate(15deg)}}
@keyframes fx-elemental-burn{0%{opacity:0;transform:translate(-50%,5px) scale(.55)}20%{opacity:1}55%{opacity:.95;transform:translate(-50%,-8px) scale(1.2) rotate(var(--fx-turn))}100%{opacity:0;transform:translate(-50%,calc(-1*var(--fx-rise))) scale(.25)}}
@keyframes fx-elemental-star{0%{opacity:0;transform:translate(-50%,2px) scale(.4) rotate(0)}35%{opacity:1}100%{opacity:0;transform:translate(-50%,-24px) scale(1.3) rotate(220deg)}}
@keyframes fx-elemental-mist{0%{opacity:0;transform:translate(-50%,6px) scale(.7)}35%{opacity:.6}100%{opacity:0;transform:translate(-50%,-19px) scale(2.4)}}
/* Top-tier piece/board match-ending scene: board underneath remains visible but defocused. */
.chess-board-stage#boardStage{isolation:isolate}
.premium-mate-overlay{position:absolute;inset:0;z-index:45;display:grid;place-items:center;border-radius:12px;overflow:hidden;backdrop-filter:blur(9px) saturate(.78);-webkit-backdrop-filter:blur(9px) saturate(.78);background:rgba(7,10,18,.49);pointer-events:auto}
.premium-mate-overlay.hidden{display:none!important}.premium-mate-panel{display:grid;place-items:center;gap:4px;text-align:center;width:min(86%,420px);max-height:90%;padding:12px;box-sizing:border-box}
.premium-mate-kicker{color:#f9cfa0;letter-spacing:.13em;text-transform:uppercase;font-size:clamp(10px,1.7vw,15px)}
.premium-falling-king{width:min(23%,105px);height:auto;max-height:110px;object-fit:contain;transform-origin:50% 88%;filter:drop-shadow(0 10px 5px rgba(0,0,0,.6));will-change:transform}
.premium-replay .premium-falling-king{animation:premium-king-fall 2s cubic-bezier(.2,.5,.32,1) both}
.premium-mate-title{font-size:clamp(24px,5.2vw,48px);font-weight:900;letter-spacing:.04em;text-shadow:0 2px 18px #000;color:#fff;margin:4px 0 12px}
.premium-victory{color:#6cffac;text-shadow:0 0 18px rgba(17,219,108,.6),0 4px 15px #000}.premium-defeat{color:#ff6568;text-shadow:0 0 18px rgba(251,36,55,.6),0 4px 15px #000}
.premium-replay .premium-mate-title{animation:premium-title 2.1s ease-out both}.premium-mate-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}.premium-mate-actions a{text-decoration:none}.premium-mate-actions .primary-button,.premium-mate-actions .secondary-button{min-width:116px;padding:9px 12px;font-size:13px}
@keyframes premium-king-fall{0%{transform:translate(0,-15px) rotate(0deg) scale(1.08)}15%{transform:translate(0,-12px) rotate(0deg) scale(1.1)}37%{transform:translate(3px,-6px) rotate(10deg)}55%{transform:translate(14px,9px) rotate(60deg)}66%{transform:translate(26px,22px) rotate(97deg) scale(.89)}78%{transform:translate(22px,15px) rotate(91deg) scale(.9)}100%{transform:translate(26px,22px) rotate(96deg) scale(.89)}}
@keyframes premium-title{0%,55%{opacity:0;transform:translateY(14px) scale(.88)}75%{opacity:1;transform:translateY(0) scale(1.09)}100%{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:820px){.power-skill-grid{grid-template-columns:1fr}.power-skill p{min-height:auto}.power-hero{align-items:stretch}.power-wallet{width:100%}.premium-mate-panel{gap:3px}.premium-mate-actions .primary-button,.premium-mate-actions .secondary-button{min-width:auto}}
@media(prefers-reduced-motion:reduce){.fx-elemental,.premium-replay .premium-falling-king,.premium-replay .premium-mate-title{animation:none!important;opacity:1}.premium-falling-king{transform:rotate(92deg) translateX(12px)}}

/* v14: one opaque, centered 8x8 DOM board; frame is decoration only. */
.chess-board-stage#boardStage,.chess-board-stage.store-preview-stage,.chess-board-stage.replay-stage,.chess-board-stage.practice-stage{
 background-image:none!important;background-color:#09151b!important;--board-art-inset:7.256%;--board-art-size:85.488%;isolation:isolate;
}
.chess-board-stage#boardStage::after,.chess-board-stage.store-preview-stage::after,.chess-board-stage.replay-stage::after,.chess-board-stage.practice-stage::after{
 content:'';position:absolute;inset:0;z-index:9!important;pointer-events:none;
 background:url('/images/board-frame-only-v14.png') center/100% 100% no-repeat!important;
}
.chess-board-stage#boardStage>.chess-board,.chess-board-stage.store-preview-stage>.chess-board,.chess-board-stage.replay-stage>.chess-board,.chess-board-stage.practice-stage>.chess-board {
 position:absolute!important;left:7.256%!important;top:7.256%!important;width:85.488%!important;height:85.488%!important;
 margin:0!important;padding:0!important;display:grid!important;grid-template-columns:repeat(8,minmax(0,1fr))!important;
 grid-template-rows:repeat(8,minmax(0,1fr))!important;overflow:hidden!important;background:#142c39!important;border:0!important;box-shadow:none!important;z-index:2!important;
}
.chess-board-stage#boardStage .square,.chess-board-stage.store-preview-stage .square,.chess-board-stage.replay-stage .square,.chess-board-stage.practice-stage .square{
 width:100%!important;height:100%!important;margin:0!important;min-width:0!important;min-height:0!important;
 padding:0!important;box-sizing:border-box!important;aspect-ratio:auto!important;border:0!important;
}
.chess-board-stage .square.light{background:#e6edf1 url('/images/board-square-marble-light.jpg') center/cover no-repeat!important}
.chess-board-stage .square.dark{background:#102b3a url('/images/board-square-marble-dark.jpg') center/cover no-repeat!important}
.chess-board-stage .square .piece-skin-image{position:absolute;left:4%;top:3%;width:92%;height:94%;object-fit:contain;z-index:3}
.chess-board-stage#boardStage .move-fx-layer {z-index:15!important;pointer-events:none}
.chess-board-stage#boardStage .premium-mate-overlay{z-index:50!important}
.chess-board-stage#boardStage .board-fx-canvas {z-index:10!important}
.fx-flying-piece {z-index:40!important;filter:drop-shadow(0 0 11px var(--fx-main))!important}
.fx-elemental {z-index:37!important;filter:drop-shadow(0 0 5px currentColor)}
.fx-elemental-flame {box-shadow:0 0 14px #ff7521}
.fx-elemental-lightning {text-shadow:0 0 11px #efffff,0 0 24px #00aaff}
.fx-arc-strike{position:absolute;z-index:38;pointer-events:none;border-radius:99px;background:linear-gradient(90deg,transparent,#8ce9ff,#fff,transparent);height:3px;transform-origin:0 50%;animation:fx-strike-v14 .5s ease-out both;box-shadow:0 0 15px #4ed9ff}
.fx-tier-ring{position:absolute;z-index:34;pointer-events:none;border:2px solid var(--fx-main);border-radius:50%;transform:translate(-50%,-50%);animation:fx-tier-ring-v14 .85s ease-out both;box-shadow:0 0 20px var(--fx-main)}
@keyframes fx-strike-v14{0%{opacity:0;filter:brightness(2)}25%{opacity:1}50%{opacity:.2}72%{opacity:1}100%{opacity:0}}
@keyframes fx-tier-ring-v14{0%{opacity:1;scale:.35}100%{opacity:0;scale:1.9}}
.game-history-list .game-item{cursor:default;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.game-history-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
.game-history-watch{text-decoration:none;font-size:13px;padding:7px 13px!important;white-space:nowrap}
.power-skill-type{font-size:11px;letter-spacing:.05em;color:#96cbd2;text-transform:uppercase}
.power-skill-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,245px),1fr))}
.power-skill-actions button{min-height:43px}
@media(prefers-reduced-motion:reduce){.fx-arc-strike,.fx-tier-ring{animation:none!important;display:none}}

.piece-store-preview{position:relative;isolation:isolate}.piece-store-preview .fx-elemental{z-index:3;pointer-events:none}

/* v15 — restrained, genuinely synchronized canvas FX (game == store preview).
   Previous emoji particles and CSS-only demo are intentionally unused. */
.chess-board-stage .move-fx-layer { z-index: 24 !important; pointer-events:none !important; }
.piece-motion-canvas {
  position:absolute;
  inset:0;
  width:100%;height:100%;
  pointer-events:none;
  z-index:28;
}
.fx-natural-moving-piece {
  position:absolute;
  z-index:32;
  object-fit:contain;
  pointer-events:none;
  max-width:none;
  transform-origin:50% 50%;
  filter:drop-shadow(0 3px 4px rgba(0,0,0,.4));
  will-change:transform,left,top;
}
.piece-store-preview .piece-demo-stage {
  width:min(78%,248px) !important;
  max-width:248px;
  margin:12px auto 0;
  aspect-ratio:1;
  position:relative;
  border:0;
  box-shadow:0 4px 18px rgba(0,0,0,.2);
}
.piece-store-preview .piece-store-row img {height:clamp(48px,6vw,66px);}
.piece-store-preview .piece-store-row + .piece-store-row {margin-top:3px;padding-top:3px;}
/* The preview must be the REAL move animation, not independent icon bobbing. */
.piece-store-preview.is-previewing .piece-store-row img,
.piece-store-preview[data-piece-theme].is-previewing img {
  animation:none !important;
}
@media (prefers-reduced-motion:reduce){
  .fx-natural-moving-piece{will-change:auto;}
}

/* v17: full 32-piece catalogue previews, same effect layer as live play. */
.store-preview-stage:not(.piece-demo-stage) {
  width: min(100%, 350px) !important;
  max-width: 350px !important;
  flex-shrink: 1;
}
.piece-store-preview .piece-demo-stage {
  width: min(100%, 320px) !important;
  max-width: 320px !important;
}
.store-preview-stage .move-fx-layer {
  z-index: 36 !important;
  overflow: visible;
  isolation: isolate;
}
.store-preview-stage .piece-motion-canvas {z-index:40!important}
.store-preview-stage .fx-natural-moving-piece {z-index:45!important}
.store-preview-stage .square .piece-skin-image {
  width:95%;height:95%;left:2.5%;top:2.5%;
}
.store-hero {min-height:unset}
/* Removed teaser banners and footnotes: actual purchasing is still disabled until verification exists. */
@media (prefers-reduced-motion:reduce) {
  .store-preview-stage .fx-natural-moving-piece{animation:none}
}

/* v18 — crisp per-move aura: remains visible on pale and dark squares alike. */
.chess-board-stage .move-fx-layer { z-index: 50 !important; }
.chess-board-stage .fx-travel-aura {
  position: absolute;
  z-index: 52;
  display: block;
  pointer-events: none;
  border-radius: 50%;
  box-sizing: border-box;
  transform: translate(-50%,-50%);
  border: 2px solid var(--travel-light, #dcecff);
  background: radial-gradient(circle, transparent 28%, var(--travel-color, #67dbff) 88%, transparent 100%);
  box-shadow:
    inset 0 0 9px 2px var(--travel-light, #dcecff),
    0 0 8px 2px var(--travel-light, #dcecff),
    0 0 24px 7px var(--travel-color, #67dbff);
  filter: saturate(1.35);
  will-change: left, top, opacity, transform;
  opacity: .9;
}
.chess-board-stage .piece-motion-canvas { z-index: 54 !important; }
.chess-board-stage .fx-natural-moving-piece {
  z-index: 57 !important;
  filter: drop-shadow(0 2px 2px #000c) drop-shadow(0 0 9px var(--travel-color, #71dcff));
}
/* White squares must not erase the distinction between the piece and its wake. */
.chess-board-stage .fx-travel-aura::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px solid rgba(12, 25, 40, .45);
}

/* v19: individual piece-skin signatures. The chosen piece set, not the board
   price, determines the movement halo. Canvas and halo use the same kind. */
.chess-board-stage .fx-travel-aura[data-motion-kind="dust"] {
  border: 1px solid rgba(255,242,202,.65);
  background: radial-gradient(ellipse,rgba(255,242,207,.08),rgba(209,159,91,.24) 69%,transparent 84%);
  box-shadow: 0 0 11px rgba(223,178,111,.27);
}
.chess-board-stage .fx-travel-aura[data-motion-kind="electric"] {
  border: 2px solid rgba(153,242,255,.92);
  background: radial-gradient(circle,transparent 43%,rgba(22,166,233,.31) 70%,transparent 90%);
  box-shadow:0 0 9px #51cfff,0 0 23px rgba(19,150,229,.56),inset 0 0 12px #a5f2ff;
}
.chess-board-stage .fx-travel-aura[data-motion-kind="ember"] {
  border: 0;
  border-radius: 45% 60% 30% 68%;
  background: radial-gradient(ellipse at 50% 72%,rgba(255,242,190,.67) 3%,rgba(255,128,36,.38) 38%,rgba(140,25,17,.08) 70%,transparent 90%);
  box-shadow:0 0 15px rgba(242,101,34,.44);
}
.chess-board-stage .fx-travel-aura[data-motion-kind="crystal"] {
  border: 2px solid rgba(161,255,238,.84);
  border-radius: 18%;
  transform:translate(-50%,-50%) rotate(45deg);
  background:radial-gradient(circle,rgba(49,246,209,.15),transparent 72%);
  box-shadow:0 0 16px rgba(39,210,191,.52);
}
.chess-board-stage .fx-travel-aura[data-motion-kind="wind"] {
  border: 1px solid rgba(198,239,255,.74);
  border-radius: 65% 22% 68% 26%;
  background:radial-gradient(ellipse at 60% 50%,rgba(154,225,252,.25),transparent 75%);
  box-shadow:0 0 12px rgba(139,216,253,.36);
}
.chess-board-stage .fx-travel-aura[data-motion-kind="mist"] {
  border: 0;
  border-radius: 50%;
  background:radial-gradient(circle,rgba(217,223,255,.27) 5%,rgba(119,135,218,.25) 51%,transparent 78%);
  filter:blur(5px);
  box-shadow:0 0 22px rgba(172,181,255,.26);
}
.chess-board-stage .fx-travel-aura[data-motion-kind="aurora"] {
  border: 1px solid rgba(255,216,155,.87);
  border-radius: 40% 60% 38% 64%;
  background:conic-gradient(from 45deg,rgba(255,203,129,.30),rgba(185,74,82,.34),rgba(245,234,191,.31),rgba(255,203,129,.30));
  box-shadow:0 0 18px rgba(231,132,83,.54),inset 0 0 12px rgba(255,234,176,.45);
}
/* Avoid one generic circular pseudo-ring disguising all seven effects. */
.chess-board-stage .fx-travel-aura[data-motion-kind]::after {display:none;}


/* v20 — restore board theme FX above the decorative frame on ALL board stages.
   Previous styles set the store/replay canvas to z-index:4 but their frame to 9. */
.chess-board-stage#boardStage .board-fx-canvas,
.chess-board-stage.store-preview-stage .board-fx-canvas,
.chess-board-stage.replay-stage .board-fx-canvas,
.chess-board-stage.practice-stage .board-fx-canvas {
  z-index: 12 !important;
  display: block;
  visibility: visible;
  opacity: 1;
  pointer-events: none;
  mix-blend-mode: screen;
}
.chess-board-stage[data-fx-enabled="false"] .board-fx-canvas {
  display: none !important;
}
/* A soft ambient frame reflection persists if animation is throttled. It sits
   between the opaque chess squares and the original transparent decorative art. */
.chess-board-stage#boardStage::before,
.chess-board-stage.store-preview-stage::before,
.chess-board-stage.practice-stage::before,
.chess-board-stage.replay-stage::before {
  content: '';
  position: absolute;
  inset: 1.8%;
  z-index: 8;
  pointer-events: none;
  border-radius: 3%;
  border: 1px solid var(--fx-main, #e9c184);
  box-shadow: 0 0 12px var(--fx-main, #e9c184), inset 0 0 17px var(--fx-glow, rgba(100,190,250,.3));
  opacity: .32;
  animation: sahmat-board-ambient-v20 3.8s ease-in-out infinite alternate;
}
.chess-board-stage[data-fx-enabled="false"]::before {display:none !important;}
@keyframes sahmat-board-ambient-v20 { from {opacity:.19;} to {opacity:.53;} }
@media(prefers-reduced-motion:reduce){
  .chess-board-stage::before {animation:none !important; opacity:.37 !important;}
}


/* v21 — make board-frame effects unmistakably visible and restore DOM fallback
   across play, store preview, replay and practice boards. */
.chess-board-stage:not([data-fx-enabled="false"]) .board-fx-aura,
.chess-board-stage:not([data-fx-enabled="false"]) .board-fx-edge,
.chess-board-stage:not([data-fx-enabled="false"]) .board-fx-corner {
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
}
.chess-board-stage .board-fx-aura {
  z-index: 11 !important;
  inset: -10px;
  border-width: 1.5px;
  border-color: var(--fx-main);
  box-shadow: 0 0 16px var(--fx-main), 0 0 34px var(--fx-glow), inset 0 0 18px rgba(255,255,255,.08);
  opacity: .7;
}
.chess-board-stage .board-fx-edge { z-index: 13 !important; filter: drop-shadow(0 0 10px var(--fx-main)); }
.chess-board-stage .board-fx-edge::after {
  opacity: .95;
  border-radius: 999px;
  transform: scale(1.02);
}
.chess-board-stage .board-fx-corner {
  z-index: 14 !important;
  width: 16px; height:16px;
  box-shadow: 0 0 14px var(--fx-main), 0 0 28px var(--fx-glow);
}
.chess-board-stage[data-fx-theme="classic"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255,214,131,.15) 8%, rgba(255,240,197,.85) 28%, rgba(255,160,77,.86) 56%, rgba(255,237,194,.82) 74%, rgba(255,214,131,.15) 92%, transparent 100%);
  animation: sahmat-v21-fireflow 2.2s linear infinite;
}
.chess-board-stage[data-fx-theme="obsidian"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(71,226,255,.2), rgba(205,250,255,.95), rgba(40,155,255,.95), rgba(205,250,255,.95), rgba(71,226,255,.2), transparent);
  animation: sahmat-v21-electric 1.2s linear infinite;
}
.chess-board-stage[data-fx-theme="osmanli"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(255,160,95,.2), rgba(255,225,169,.95), rgba(207,67,43,.92), rgba(255,225,169,.95), rgba(255,160,95,.2), transparent);
  animation: sahmat-v21-ember 2.7s ease-in-out infinite;
}
.chess-board-stage[data-fx-theme="selcuklu"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(59,230,213,.2), rgba(204,255,244,.95), rgba(32,185,176,.92), rgba(204,255,244,.95), rgba(59,230,213,.2), transparent);
  animation: sahmat-v21-crystal 2s linear infinite;
}
.chess-board-stage[data-fx-theme="gokturk"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(155,230,255,.2), rgba(238,249,255,.96), rgba(110,162,255,.9), rgba(238,249,255,.96), rgba(155,230,255,.2), transparent);
  animation: sahmat-v21-rune 1.9s ease-in-out infinite;
}
.chess-board-stage[data-fx-theme="gece"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(178,192,255,.18), rgba(245,248,255,.88), rgba(120,130,255,.88), rgba(245,248,255,.88), rgba(178,192,255,.18), transparent);
  animation: sahmat-v21-moon 3.1s ease-in-out infinite;
}
.chess-board-stage[data-fx-theme="kilim"] .board-fx-edge::after {
  background: linear-gradient(90deg, transparent, rgba(255,209,140,.15), rgba(255,248,204,.92), rgba(235,117,88,.88), rgba(255,248,204,.92), rgba(255,209,140,.15), transparent);
  animation: sahmat-v21-aurora 2.8s linear infinite;
}
.chess-board-stage .board-fx-canvas { z-index: 12 !important; opacity: 1 !important; }
@keyframes sahmat-v21-fireflow { 0% {transform:translateX(-58%) scaleX(.84); filter:hue-rotate(0deg);} 50% {transform:translateX(10%) scaleX(1.07); filter:hue-rotate(-12deg);} 100% {transform:translateX(58%) scaleX(.84); filter:hue-rotate(0deg);} }
@keyframes sahmat-v21-electric { 0% {transform:translateX(-60%) scaleY(.92);} 50% {transform:translateX(0%) scaleY(1.25);} 100% {transform:translateX(60%) scaleY(.92);} }
@keyframes sahmat-v21-ember { 0%,100% {transform:translateX(-44%) scaleY(.8); opacity:.78;} 50% {transform:translateX(42%) scaleY(1.22); opacity:1;} }
@keyframes sahmat-v21-crystal { 0% {transform:translateX(-55%) skewX(-8deg);} 50% {transform:translateX(15%) skewX(8deg);} 100% {transform:translateX(55%) skewX(-8deg);} }
@keyframes sahmat-v21-rune { 0%,100% {transform:translateX(-52%) scaleY(.86); opacity:.76;} 40% {transform:translateX(4%) scaleY(1.35); opacity:1;} 75% {transform:translateX(48%) scaleY(1.04); opacity:.9;} }
@keyframes sahmat-v21-moon { 0%,100% {transform:translateX(-46%) scale(1); opacity:.68;} 50% {transform:translateX(44%) scale(1.18); opacity:1;} }
@keyframes sahmat-v21-aurora { 0% {transform:translateX(-50%) skewX(-12deg);} 50% {transform:translateX(0%) skewX(12deg) scaleY(1.16);} 100% {transform:translateX(50%) skewX(-12deg);} }

/* v21 — obvious, skin-specific move accents so each piece set reads differently. */
.fx-motion-accent {
  position:absolute;
  pointer-events:none;
  z-index:56;
  transform:translate(-50%,-50%);
  will-change:left,top,transform,opacity;
  mix-blend-mode:screen;
}
.fx-motion-accent-a{opacity:.92}
.fx-motion-accent-b{opacity:.72}
.fx-natural-moving-piece[data-motion-kind="dust"] { filter:drop-shadow(0 0 10px rgba(255,227,180,.65)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="electric"] { filter:drop-shadow(0 0 12px rgba(132,235,255,.92)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="ember"] { filter:drop-shadow(0 0 12px rgba(255,180,108,.85)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="crystal"] { filter:drop-shadow(0 0 12px rgba(171,255,246,.92)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="wind"] { filter:drop-shadow(0 0 12px rgba(214,245,255,.85)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="mist"] { filter:drop-shadow(0 0 12px rgba(203,210,255,.88)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.fx-natural-moving-piece[data-motion-kind="aurora"] { filter:drop-shadow(0 0 14px rgba(255,217,153,.88)) drop-shadow(0 3px 4px rgba(0,0,0,.45)); }

.fx-motion-accent[data-motion-kind="dust"] { border-radius:50%; border:1px solid rgba(255,237,202,.84); box-shadow:0 0 12px rgba(222,185,123,.42), inset 0 0 7px rgba(255,255,255,.24); animation:sahmat-v21-dust 1s ease-out infinite; }
.fx-motion-accent[data-motion-kind="electric"] { clip-path:polygon(37% 0,55% 0,48% 34%,73% 34%,28% 100%,42% 58%,20% 58%); background:linear-gradient(180deg,#efffff,#5fdbff 55%,#248dff); box-shadow:0 0 14px #7ce9ff; animation:sahmat-v21-electric-accent .34s steps(2) infinite; }
.fx-motion-accent[data-motion-kind="ember"] { border-radius:50% 50% 34% 66%; background:radial-gradient(circle at 50% 72%, rgba(255,244,193,.92) 0 12%, rgba(255,137,53,.72) 34%, rgba(178,47,21,.15) 68%, transparent 88%); box-shadow:0 0 18px rgba(255,119,47,.45); animation:sahmat-v21-ember-accent .72s ease-in-out infinite; }
.fx-motion-accent[data-motion-kind="crystal"] { border-radius:18%; transform:translate(-50%,-50%) rotate(45deg); border:1px solid rgba(180,255,248,.92); background:linear-gradient(135deg,rgba(255,255,255,.65),rgba(56,233,209,.18)); box-shadow:0 0 18px rgba(87,255,232,.5); animation:sahmat-v21-crystal-accent .82s ease-in-out infinite; }
.fx-motion-accent[data-motion-kind="wind"] { border-radius:60% 20% 60% 30%; border:1px solid rgba(223,247,255,.84); background:linear-gradient(135deg, rgba(232,250,255,.4), rgba(130,210,255,.1)); box-shadow:0 0 12px rgba(173,230,255,.38); animation:sahmat-v21-wind-accent .85s linear infinite; }
.fx-motion-accent[data-motion-kind="mist"] { border-radius:50%; background:radial-gradient(circle, rgba(245,246,255,.52) 0, rgba(163,171,247,.22) 46%, transparent 76%); filter:blur(4px); box-shadow:0 0 18px rgba(164,172,252,.2); animation:sahmat-v21-mist-accent 1.1s ease-in-out infinite; }
.fx-motion-accent[data-motion-kind="aurora"] { border-radius:44% 56% 40% 60%; background:conic-gradient(from 35deg, rgba(255,220,157,.34), rgba(224,94,109,.38), rgba(255,241,177,.36), rgba(255,220,157,.34)); box-shadow:0 0 18px rgba(248,142,97,.42); animation:sahmat-v21-aurora-accent 1.3s linear infinite; }

@keyframes sahmat-v21-dust { 0%{scale:.62;opacity:.85} 100%{scale:1.2;opacity:.18} }
@keyframes sahmat-v21-electric-accent { 0%{transform:translate(-50%,-50%) rotate(-8deg) scale(.85)} 50%{transform:translate(-50%,-50%) rotate(7deg) scale(1.1)} 100%{transform:translate(-50%,-50%) rotate(-8deg) scale(.85)} }
@keyframes sahmat-v21-ember-accent { 0%,100%{transform:translate(-50%,-50%) scale(.78,.95)} 50%{transform:translate(-50%,-50%) scale(1.08,1.24)} }
@keyframes sahmat-v21-crystal-accent { 0%,100%{transform:translate(-50%,-50%) rotate(45deg) scale(.78)} 50%{transform:translate(-50%,-50%) rotate(57deg) scale(1.08)} }
@keyframes sahmat-v21-wind-accent { 0%{transform:translate(-50%,-50%) rotate(0deg) scale(.82)} 100%{transform:translate(-50%,-50%) rotate(360deg) scale(1.06)} }
@keyframes sahmat-v21-mist-accent { 0%,100%{transform:translate(-50%,-50%) scale(.76);opacity:.44} 50%{transform:translate(-50%,-50%) scale(1.24);opacity:.9} }
@keyframes sahmat-v21-aurora-accent { 0%{transform:translate(-50%,-50%) rotate(0deg) scale(.82)} 100%{transform:translate(-50%,-50%) rotate(360deg) scale(1.12)} }

/* v22 — visibly acknowledge Efsun Tahtası abilities. */
.game-power-panel #powerGameStatus {display:block;min-height:22px;color:#ffeac0;font-size:14px;line-height:1.5;}
.power-effect-history {display:flex;gap:6px;flex-wrap:wrap;max-height:100px;overflow:hidden;}
.power-effect-entry {font-size:12px;line-height:1.4;border:1px solid rgba(228,185,103,.35);background:rgba(19,30,38,.86);padding:7px 9px;border-radius:7px;color:#f4dec0;}
.power-status-flash {animation:sahmat-power-note-v22 .75s ease-out;}
.clock-card.power-clock-flash {outline:2px solid #ffe19c;box-shadow:0 0 24px rgba(226,181,75,.55),inset 0 0 12px rgba(226,181,75,.25);}
@keyframes sahmat-power-note-v22 {0%{background:rgba(241,182,72,.4);transform:scale(1.01)}100%{background:transparent;transform:none}}
@media(prefers-reduced-motion:reduce){.power-status-flash{animation:none;}}


/* v23: actively traveling edge glints placed INSIDE the decorative frame.
   Older .board-fx-edge was positioned at -9px and could be clipped by the
   stage container; moving the entire thin element also looked motionless.
   We now animate gradient position over the full frame track instead. */
.chess-board-stage[data-fx-enabled="true"] .board-fx-edge,
.chess-board-stage[data-fx-enabled="true"] .board-fx-aura,
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner { display:block!important; }
.chess-board-stage[data-fx-enabled="true"] .board-fx-edge {
  position:absolute!important;
  z-index: 16!important;
  border-radius:999px;
  pointer-events:none;
  opacity:.99!important;
  filter:drop-shadow(0 0 7px var(--fx-main))!important;
  overflow:hidden;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-top,
.chess-board-stage[data-fx-enabled="true"] .board-fx-bottom {
  left:6%!important;width:88%!important;height:5px!important;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-top {top:3.8%!important;bottom:auto!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-bottom {bottom:3.8%!important;top:auto!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-left,
.chess-board-stage[data-fx-enabled="true"] .board-fx-right {
  top:6%!important;height:88%!important;width:5px!important;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-left {left:3.8%!important;right:auto!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-right {right:3.8%!important;left:auto!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-edge::after {
  content:'';
  position:absolute;inset:0;
  border-radius:999px;
  background:linear-gradient(90deg, transparent 20%, var(--fx-soft) 42%, #fff 49%, var(--fx-main) 52%, transparent 78%)!important;
  background-size:260% 100%!important;
  background-position:160% 0;
  transform:none!important;
  filter:none!important;
  animation:sahmat-v23-frame-flow-x 3.2s linear infinite!important;
  box-shadow:0 0 10px var(--fx-main);
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-left::after,
.chess-board-stage[data-fx-enabled="true"] .board-fx-right::after {
  background:linear-gradient(180deg, transparent 20%, var(--fx-soft) 42%, #fff 49%, var(--fx-main) 52%, transparent 78%)!important;
  background-size:100% 260%!important;
  background-position:0 160%;
  animation:sahmat-v23-frame-flow-y 3.2s linear infinite!important;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-bottom::after,
.chess-board-stage[data-fx-enabled="true"] .board-fx-left::after {animation-direction:reverse!important;}
.chess-board-stage[data-fx-theme="obsidian"] .board-fx-edge::after {animation-duration:1.55s!important;}
.chess-board-stage[data-fx-theme="osmanli"] .board-fx-edge::after {animation-duration:3.5s!important;}
.chess-board-stage[data-fx-theme="selcuklu"] .board-fx-edge::after {animation-duration:2.65s!important;}
.chess-board-stage[data-fx-theme="gokturk"] .board-fx-edge::after {animation-duration:1.95s!important;}
.chess-board-stage[data-fx-theme="gece"] .board-fx-edge::after {animation-duration:5.2s!important;}
.chess-board-stage[data-fx-theme="kilim"] .board-fx-edge::after {animation-duration:2.8s!important;}
@keyframes sahmat-v23-frame-flow-x {
  from {background-position:160% 0;}
  to {background-position:-160% 0;}
}
@keyframes sahmat-v23-frame-flow-y {
  from {background-position:0 160%;}
  to {background-position:0 -160%;}
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-aura {
  inset:2.5%!important;
  z-index:11!important;
  opacity:.7!important;
  border:1px solid var(--fx-soft)!important;
  border-radius:2%!important;
  animation:sahmat-v23-aura-breath 3.8s ease-in-out infinite alternate!important;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner {
  z-index:17!important;
  width:14px!important;height:14px!important;
  animation:sahmat-v23-corner-glow 2.2s ease-in-out infinite alternate!important;
  opacity:1!important;
}
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner-tl {top:3%!important;left:3%!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner-tr {top:3%!important;right:3%!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner-bl {bottom:3%!important;left:3%!important;}
.chess-board-stage[data-fx-enabled="true"] .board-fx-corner-br {bottom:3%!important;right:3%!important;}
@keyframes sahmat-v23-corner-glow {from {filter:brightness(.65);transform:rotate(45deg) scale(.9)} to {filter:brightness(1.5);transform:rotate(45deg) scale(1.15)}}
@keyframes sahmat-v23-aura-breath {from {box-shadow:0 0 3px var(--fx-main);opacity:.4} to {box-shadow:0 0 18px var(--fx-main),inset 0 0 8px var(--fx-glow);opacity:.85}}
@media (prefers-reduced-motion:reduce) {
 .chess-board-stage[data-fx-enabled="true"] .board-fx-edge::after,
 .chess-board-stage[data-fx-enabled="true"] .board-fx-corner,
 .chess-board-stage[data-fx-enabled="true"] .board-fx-aura {animation:none!important;}
}

/* v23 tactical powers: applied directly on the source square, not on a hint layer. */
.chess-board-stage .square.power-piece-sealed::after {
 content:''!important;position:absolute;inset:3px;z-index:5;pointer-events:none;
 border:2px solid rgba(93,226,255,.96);border-radius:7px;
 background:repeating-linear-gradient(135deg,transparent 0 9px,rgba(33,142,202,.11) 9px 12px);
 box-shadow:inset 0 0 13px rgba(45,173,243,.45),0 0 9px rgba(40,182,239,.55);
 animation:sahmat-v23-seal-pulse 1.6s ease-in-out infinite;
}
.chess-board-stage .square.power-piece-warded::after {
 content:''!important;position:absolute;inset:3px;z-index:5;pointer-events:none;
 border:2px solid rgba(255,214,118,.95);border-radius:45%;
 box-shadow:inset 0 0 10px rgba(255,206,105,.32),0 0 10px rgba(255,206,105,.58);
 animation:sahmat-v23-ward-pulse 2s ease-in-out infinite;
}
.chess-board-stage .square.power-eligible-target:not(.power-piece-sealed):not(.power-piece-warded) {
 box-shadow:inset 0 0 0 3px rgba(121,232,235,.56)!important;
 cursor:crosshair!important;
}
@keyframes sahmat-v23-seal-pulse {0%,100%{opacity:.58}50%{opacity:1}}
@keyframes sahmat-v23-ward-pulse {0%,100%{opacity:.55;filter:brightness(.9)}50%{opacity:1;filter:brightness(1.22)}}
@media(prefers-reduced-motion:reduce){.chess-board-stage .square.power-piece-sealed::after,.chess-board-stage .square.power-piece-warded::after{animation:none!important}}


/* v24: moving frame lights ABOVE the frame graphic but BELOW active pieces.
   This independent canvas makes the motion visible even when the legacy
   CSS border animation or decorative PNG hides the old light strokes. */
.chess-board-stage { isolation:isolate; }
.chess-board-stage .frame-motion-canvas,
.chess-board-stage#boardStage .frame-motion-canvas,
.chess-board-stage.store-preview-stage .frame-motion-canvas,
.chess-board-stage.practice-stage .frame-motion-canvas,
.chess-board-stage.replay-stage .frame-motion-canvas {
  display:block !important;
  visibility:visible !important;
  opacity:1 !important;
  position:absolute !important;
  top:0 !important;left:0 !important;
  width:100% !important;height:100% !important;
  z-index:35 !important;
  mix-blend-mode:screen;
  pointer-events:none !important;
  overflow:visible;
}
.chess-board-stage[data-fx-enabled="false"] .frame-motion-canvas {display:none !important;}
/* Legacy CSS-only effects remain underneath for low-compositing browsers. */

/* v25: hide layered static fallback when a real moving canvas is active.
   Without this, four CSS rails and the legacy canvas wash out the moving glints. */
.chess-board-stage[data-frame-motion="running"] .board-fx-edge,
.chess-board-stage[data-frame-motion="running"] .board-fx-aura,
.chess-board-stage[data-frame-motion="running"] .board-fx-corner {
  display:none !important;
}
.chess-board-stage[data-frame-motion="running"] .board-fx-canvas {opacity:.22!important;}
.chess-board-stage[data-frame-motion="running"] .frame-motion-canvas {
  display:block!important; opacity:1!important; visibility:visible!important;
  z-index:37!important; mix-blend-mode:screen!important; pointer-events:none!important;
}
/* Do not disable this gentler light path in prefers-reduced-motion: the
   renderer slows it down to preserve legibility. The in-app toggle stops it. */
