:root {
  /* brand vars — fixed, never overridden by themes */
  --brand-title: #e8a060; /* Obsidian warm copper — always */
  --brand-title2: #a06838; /* Chess subdued warm — always */
  --brand-accent: #c87840; /* eyebrow, tagline — always */
  --brand-dim: #9a6030; /* muted brand elements — always */
  --bg: #0d1014;
  --surface: #141820;
  --surface2: #1c2230;
  --border: #252d3a;
  --border2: #3a4858;
  --sq-light: #c8956a;
  --sq-dark: #2a3240;
  --sq-last: rgba(255, 180, 50, 0.3);
  --sq-check: rgba(220, 50, 50, 0.65);
  --sq-move-dot: rgba(0, 0, 0, 0.28);
  --copper: #c87840;
  --copper-lt: #e8a060;
  --copper-dim: #9a6030;
  --gold: #f0c040;
  --text: #ede6dc;
  --text-dim: #9aa4b2;
  --text-muted: #6a7888;
  --danger: #d04545;
  --success: #50a060;
  --white-side: #f0e8d8;
  --black-side: #2c3040;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  overflow: hidden;
}

/* ── GLOBAL SCALE: root font-size drives ALL rem-based sizing ── */
html {
  font-size: clamp(12px, 1.1vw, 16px);
}
@media (max-width: 1400px) {
  html {
    font-size: clamp(12px, 1.05vw, 15px);
  }
}
@media (max-width: 1100px) {
  html {
    font-size: clamp(11px, 1.1vw, 14px);
  }
}
@media (max-width: 800px) {
  html {
    font-size: clamp(10px, 1.4vw, 13px);
  }
}
@media (max-width: 600px) {
  html {
    font-size: clamp(10px, 2vw, 13px);
  }
}

/* ── LIGHT MODE ── */
body.light-mode {
  --bg: #f0ede8;
  --surface: #e8e2d8;
  --surface2: #ddd5c8;
  --border: #ccc4b8;
  --border2: #b8ae9f;
  --sq-light: #e8c89a;
  --sq-dark: #6b7a8d;
  --sq-last: rgba(180, 120, 40, 0.3);
  --sq-check: rgba(200, 40, 40, 0.55);
  --copper: #9a5520;
  --copper-lt: #b86828;
  --copper-dim: #7a4018;
  --gold: #c08800;
  --text: #1a1612;
  --text-dim: #4a3e30;
  --text-muted: #7a6e60;
  --danger: #b03030;
  --success: #3a8050;
  --white-side: #f5f0e8;
  --black-side: #2c3040;
}
body.light-mode .screen {
  background: #f5f0e8;
}
body.light-mode #screen-start {
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f0e6d8 !important;
}
body.light-mode #screen-start::before {
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(154, 85, 32, 0.06) 0px,
      rgba(154, 85, 32, 0.06) 1px,
      transparent 1px,
      transparent 72px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(154, 85, 32, 0.06) 0px,
      rgba(154, 85, 32, 0.06) 1px,
      transparent 1px,
      transparent 72px
    );
}
/* game screen light bg */
body.light-mode #screen-game {
  background: linear-gradient(160deg, #faf6f0, #ede4d8);
}
body.light-mode #board-3d-wrap {
  background: #e8e3dc;
}
body.light-mode #board-3d-canvas {
  background: #e8e3dc;
}
/* player panels */
body.light-mode .player-panel {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(0, 0, 0, 0.1);
}
body.light-mode .pp-section {
  border-bottom-color: rgba(0, 0, 0, 0.07);
}
body.light-mode .pp-section.turn-section {
  background: rgba(154, 85, 32, 0.07);
  border-left-color: var(--copper);
}
body.light-mode .pp-section.inactive {
  background: transparent;
}
body.light-mode .panel-heading {
  color: var(--copper);
}
body.light-mode .turn-name {
  color: var(--text);
}
body.light-mode .status-line {
  color: var(--text-dim);
}
body.light-mode .move-row .move-w,
body.light-mode .move-row .move-b {
  color: var(--text-dim);
}
body.light-mode .move-num {
  color: var(--copper-dim);
}
body.light-mode .move-latest {
  color: var(--text) !important;
}
body.light-mode .captures-row {
  color: var(--text);
}
/* topbar */
body.light-mode #game-topbar {
  background: rgba(248, 244, 240, 0.96);
  border-color: rgba(154, 85, 32, 0.22);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
body.light-mode .topbar-brand {
  color: var(--copper);
  border-right-color: rgba(154, 85, 32, 0.22);
}
body.light-mode .btn-tb {
  color: var(--text-dim);
}
body.light-mode .btn-tb:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}
body.light-mode .btn-tb.primary {
  background: rgba(154, 85, 32, 0.1);
  border-color: rgba(154, 85, 32, 0.28);
  color: var(--copper);
}
body.light-mode .btn-tb.primary:hover {
  background: rgba(154, 85, 32, 0.18);
}
body.light-mode .btn-tb.red:hover {
  color: var(--danger);
  background: rgba(180, 40, 40, 0.08);
}
body.light-mode .topbar-sep {
  background: rgba(0, 0, 0, 0.1);
}
/* modals — confirm, pause, options overlays (full-screen style) */
body.light-mode .modal-box,
body.light-mode .promo-box {
  background: linear-gradient(
    160deg,
    rgba(248, 244, 238, 0.99),
    rgba(238, 232, 222, 0.99)
  );
  border-color: rgba(154, 85, 32, 0.25);
}
body.light-mode #confirm-overlay,
body.light-mode #pause-overlay,
body.light-mode #options-overlay {
  background: rgba(240, 232, 220, 0.96);
  backdrop-filter: blur(18px);
}
body.light-mode #confirm-overlay::before,
body.light-mode #pause-overlay::before,
body.light-mode #options-overlay::before {
  background: radial-gradient(
    ellipse at center,
    rgba(154, 85, 32, 0.08) 0%,
    transparent 65%
  );
}
body.light-mode .over-crown {
  filter: drop-shadow(0 0 20px rgba(154, 85, 32, 0.5));
}
body.light-mode .over-title,
body.light-mode .pause-title,
body.light-mode .options-title {
  color: var(--text);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}
body.light-mode .over-sub,
body.light-mode .pause-sub,
body.light-mode #confirm-msg {
  color: var(--text-dim);
}
body.light-mode .btn-over.primary,
body.light-mode .btn-confirm.ok {
  background: rgba(154, 85, 32, 0.12);
  border-color: var(--copper);
  color: var(--copper-lt);
  box-shadow: 0 4px 16px rgba(154, 85, 32, 0.15);
}
body.light-mode .btn-over.primary:hover,
body.light-mode .btn-confirm.ok:hover {
  background: rgba(154, 85, 32, 0.22);
  box-shadow: 0 8px 28px rgba(154, 85, 32, 0.25);
}
body.light-mode .btn-over.secondary,
body.light-mode .btn-confirm.cancel {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-dim);
}
body.light-mode .btn-over.secondary:hover,
body.light-mode .btn-confirm.cancel:hover {
  border-color: rgba(0, 0, 0, 0.28);
  color: var(--text);
  background: rgba(0, 0, 0, 0.07);
}
body.light-mode .btn-pause-menu {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-dim);
}
body.light-mode .btn-pause-menu:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.25);
}
body.light-mode .btn-pause-menu.primary {
  background: rgba(154, 85, 32, 0.1);
  border-color: rgba(154, 85, 32, 0.35);
  color: var(--copper-lt);
}
body.light-mode .btn-pause-menu.danger {
  border-color: rgba(180, 40, 40, 0.3);
  color: var(--danger);
}
body.light-mode .opts-label {
  color: var(--text-dim);
}
body.light-mode .opts-section-lbl {
  color: var(--copper);
}
body.light-mode .options-box {
  background: rgba(248, 244, 238, 0.6);
  border-radius: 0;
}
body.light-mode .options-inner {
  scrollbar-color: rgba(154, 85, 32, 0.2) transparent;
}
/* lobby */
body.light-mode .lobby-chess-grid {
  opacity: 0.4;
}
body.light-mode .history-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

/* smooth mode transition */
body {
  transition: background 0.3s;
}
.screen,
.player-panel,
.pp-section,
#game-topbar,
.modal-box,
.options-box {
  transition:
    background 0.3s,
    border-color 0.3s,
    color 0.3s;
}

/* ── SCREENS ── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0c10;
}
.screen.hidden {
  display: none;
}

/* ── Clean page transition ── */
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes pageOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
  }
}
.screen.page-enter {
  animation: pageIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 12;
}
.screen.page-exit {
  animation: pageOut 0.2s ease-in both;
  z-index: 11;
  pointer-events: none;
}

/* ════════════════════════════════════════
       LOADER SCREEN — white/cream bg, game design accents
    ════════════════════════════════════════ */
#screen-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #f8f4ee;
  transition:
    opacity 0.7s ease,
    visibility 0.7s ease;
}
#screen-loader::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 50%,
    rgba(200, 120, 64, 0.06) 0%,
    transparent 70%
  );
}
#screen-loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-ornament {
  width: 160px;
  margin-bottom: 16px;
  opacity: 0.7;
}
.loader-ornament svg {
  width: 100%;
  height: auto;
  display: block;
}
.loader-title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
  margin-bottom: 8px;
}
.loader-t1 {
  font-family: Georgia, serif;
  font-size: clamp(2.6rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #c8853a;
  text-shadow: 0 2px 10px rgba(180, 110, 30, 0.15);
}
.loader-t2 {
  font-family: Georgia, serif;
  font-size: clamp(2.2rem, 4.2vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #8a5a1e;
}
.loader-tagline {
  font-size: 0.54rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #a07840;
  margin-bottom: 32px;
  margin-top: 6px;
}
.loader-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(300px, 60vw);
}
.loader-bar-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(200, 120, 64, 0.15);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #b8802a, #e0a84a, #c8903a);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(200, 120, 64, 0.5);
  transition: width 0.35s ease;
}
.loader-bar-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: loaderShimmer 1.6s ease-in-out infinite;
}
@keyframes loaderShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
.loader-bar-gems {
  display: flex;
  align-items: center;
  gap: 8px;
}
.loader-gem {
  font-size: 0.72rem;
  color: #b8802a;
  opacity: 0.6;
}
.loader-status-txt {
  font-size: 0.52rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #9a7030;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

/* ════════════════════════════════════════
       LOBBY BACKGROUND IMAGE
    ════════════════════════════════════════ */
#screen-start {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8 !important;
}
#screen-start::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(200, 120, 64, 0.03) 0px,
      rgba(200, 120, 64, 0.03) 1px,
      transparent 1px,
      transparent 72px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(200, 120, 64, 0.03) 0px,
      rgba(200, 120, 64, 0.03) 1px,
      transparent 1px,
      transparent 72px
    );
  background-size: 72px 72px;
  animation: gridDrift 22s linear infinite;
  z-index: 0;
}
@keyframes gridDrift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 72px 72px;
  }
}
#screen-start::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 35%,
    rgba(6, 8, 12, 0.6) 100%
  );
}
.lobby-chess-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1.6);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(620px, 80vw);
  aspect-ratio: 1;
  opacity: 0.22;
  pointer-events: none;
  z-index: 1;
}
.lcg-sq {
  aspect-ratio: 1;
}
.lcg-sq.lcg-light {
  background: rgba(200, 140, 80, 0.75);
}
.lcg-sq.lcg-dark {
  background: rgba(30, 45, 70, 0.85);
}

/* center-only layout — sidebar removed */
.lobby-layout {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 540px;
  padding: 0 20px;
  height: 100%;
}
/* center column */
.lobby-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
}

.lobby-eyebrow {
  font-size: 0.56rem;
  letter-spacing: 0.48em;
  color: var(--brand-accent);
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.lobby-eyebrow::before,
.lobby-eyebrow::after {
  content: "";
  flex: 0 0 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-accent));
}
.lobby-eyebrow::after {
  background: linear-gradient(90deg, var(--brand-accent), transparent);
}

/* TITLE — bigger, bolder */
.lobby-title {
  font-family: Georgia, serif;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: 0.03em;
  text-align: center;
  margin-bottom: 6px;
}
.lobby-title .t1 {
  display: block;
  color: var(--brand-title);
  text-shadow:
    0 0 60px rgba(200, 120, 64, 0.6),
    0 3px 6px rgba(0, 0, 0, 0.9);
}
.lobby-title .t2 {
  display: block;
  color: var(--brand-title2);
  font-weight: 700;
  letter-spacing: 0.04em;
}
/* Logo decorative frame */
.lobby-logo-frame {
  position: relative;
  display: inline-block;
  padding: 14px 28px 10px;
  border: 2px solid rgba(200, 120, 64, 0.5);
  border-radius: 4px;
  margin-bottom: 4px;
  box-shadow:
    0 0 0 1px rgba(200, 120, 64, 0.15),
    inset 0 0 18px rgba(200, 120, 64, 0.06);
}
.lobby-logo-corner {
  position: absolute;
  font-size: 0.7rem;
  color: rgba(200, 120, 64, 0.75);
  line-height: 1;
}
.lobby-logo-corner.tl {
  top: -1px;
  left: 5px;
}
.lobby-logo-corner.tr {
  top: -1px;
  right: 5px;
}
.lobby-logo-corner.bl {
  bottom: -1px;
  left: 5px;
}
.lobby-logo-corner.br {
  bottom: -1px;
  right: 5px;
}
.lobby-logo-accent {
  font-size: 0.5rem;
  letter-spacing: 0.28em;
  color: var(--brand-accent);
  text-transform: uppercase;
  margin-top: 7px;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.lobby-logo-accent span {
  letter-spacing: 0.32em;
}
.lobby-tagline {
  font-size: 0.58rem;
  letter-spacing: 0.28em;
  color: var(--brand-dim);
  text-transform: uppercase;
  margin-bottom: 16px;
}
/* stats */
.lobby-stats {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid rgba(200, 120, 64, 0.2);
  overflow: hidden;
}
.lstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 18px;
  position: relative;
}
.lstat + .lstat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 1px;
  background: rgba(200, 120, 64, 0.16);
}
.lstat-val {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  color: var(--copper-lt);
  line-height: 1;
}
.lstat-lbl {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}
/* feature badges — 2x2 grid */
.lobby-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 14px;
  width: 100%;
}
.feature-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid rgba(200, 120, 64, 0.12);
  border-left: 2px solid var(--copper);
}
.feature-badge-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--copper-lt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature-badge-title {
  font-size: 0.74rem;
  color: var(--brand-title);
  font-weight: 700;
  letter-spacing: 0.04em;
  display: block;
}
.feature-badge-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
  display: block;
  line-height: 1.6;
}
/* config */
.lobby-config {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.lbl-sm {
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--brand-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
  text-align: center;
}
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 0;
  width: 100%;
}
.mode-btn {
  padding: 11px 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
  color: var(--text);
}
.mode-btn:hover {
  border-color: rgba(200, 120, 64, 0.5);
  background: rgba(200, 120, 64, 0.06);
  transform: translateY(-1px);
}
.mode-btn.active {
  border-color: var(--copper);
  background: rgba(200, 120, 64, 0.1);
  box-shadow: 0 0 20px rgba(200, 120, 64, 0.12);
}
.mode-icon {
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.mode-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--copper-lt);
  letter-spacing: 0.04em;
}
.mode-desc {
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.diff-section {
  width: 100%;
  transition:
    opacity 0.25s,
    max-height 0.3s;
  overflow: hidden;
}
.diff-section.hidden-section {
  opacity: 0;
  max-height: 0;
  pointer-events: none;
  margin: 0;
}
.diff-section.visible-section {
  opacity: 1;
  max-height: 55px;
}
.diff-row {
  display: flex;
  gap: 5px;
}
.diff-btn {
  flex: 1;
  padding: 0.44em;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.diff-btn:hover,
.diff-btn.active {
  border-color: var(--copper);
  color: var(--copper-lt);
  background: rgba(200, 120, 64, 0.1);
}
.lobby-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 100%;
}
.btn-start-game {
  width: 100%;
  padding: 0.85em 2em;
  background: linear-gradient(
    135deg,
    rgba(200, 120, 64, 0.28) 0%,
    rgba(200, 120, 64, 0.1) 100%
  );
  border: 1.5px solid var(--brand-accent);
  border-radius: 0;
  color: var(--brand-title);
  font-family: Georgia, serif;
  font-size: clamp(0.82rem, 2vw, 0.95rem);
  letter-spacing: 0.3em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.24s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(200, 120, 64, 0.12);
}
.btn-start-game::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent);
  pointer-events: none;
}
.btn-start-game:hover {
  background: linear-gradient(
    135deg,
    rgba(200, 120, 64, 0.44),
    rgba(200, 120, 64, 0.18)
  );
  box-shadow: 0 8px 32px rgba(200, 120, 64, 0.35);
  transform: translateY(-2px);
}
.lobby-footer-links {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.lobby-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 5px 8px;
  transition: color 0.18s;
}
.lobby-link:hover {
  color: var(--copper-lt);
}

/* ── RIGHT SIDEBAR — Upgrade Banner ── */
.lobby-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-top: 2px;
}
.upgrade-banner {
  background: linear-gradient(
    160deg,
    rgba(30, 36, 46, 0.95),
    rgba(16, 20, 28, 0.95)
  );
  border: 1px solid rgba(200, 120, 64, 0.22);
  border-top: 2px solid var(--copper);
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.upgrade-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 0%,
    rgba(200, 120, 64, 0.08) 0%,
    transparent 65%
  );
}
.upgrade-glow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(200, 120, 64, 0.18) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.upgrade-crown {
  font-size: 1.8rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(200, 120, 64, 0.5));
  position: relative;
  z-index: 1;
}
.upgrade-title {
  font-family: Georgia, serif;
  font-size: 0.78rem;
  color: var(--copper-lt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.upgrade-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(200, 120, 64, 0.3),
    transparent
  );
  margin: 10px 0;
}
.upgrade-list {
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.upgrade-item {
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ui-dot {
  font-size: 0.35rem;
  color: var(--copper);
  flex-shrink: 0;
}
.upgrade-badge {
  font-size: 0.46rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

/* light mode upgrade banner */
body.light-mode .upgrade-banner {
  background: linear-gradient(
    160deg,
    rgba(235, 228, 218, 0.98),
    rgba(220, 212, 200, 0.98)
  );
  border-color: rgba(154, 85, 32, 0.25);
  border-top-color: var(--copper);
}

@media (max-width: 800px) {
  .lobby-layout {
    flex-direction: column;
    align-items: center;
    gap: 16px;
    overflow-y: auto;
    padding: 16px 20px;
  }
  .lobby-center {
    max-width: 460px;
    width: 100%;
  }
  .lobby-sidebar {
    width: 100%;
    max-width: 460px;
  }
  .upgrade-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
}

/* ════════════════════════════════════════
       GAME SCREEN — board centered, flanked by player panels
       floating topbar for controls
    ════════════════════════════════════════ */
#screen-game {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vw, 24px);
  padding-top: 62px;
  padding-left: clamp(6px, 1.5vw, 20px);
  padding-right: clamp(6px, 1.5vw, 20px);
  padding-bottom: clamp(6px, 1vw, 14px);
  overflow: hidden;
  background: #0a0c10;
  transition: background 0.3s;
}

/* ── floating topbar ── */
#game-topbar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(10, 13, 18, 0.94);
  border: 1px solid rgba(200, 120, 64, 0.25);
  border-radius: 100px;
  padding: 7px 16px 7px 12px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 6px 32px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.topbar-brand {
  font-family: Georgia, serif;
  font-size: 0.75rem;
  color: var(--copper-lt);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0 12px 0 4px;
  margin-right: 4px;
  border-right: 1px solid rgba(200, 120, 64, 0.25);
}
.topbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(200, 120, 64, 0.2);
  flex-shrink: 0;
  margin: 0 3px;
}
.topbar-mode-badge {
  font-size: 0.6rem;
  font-family: Georgia, serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper-lt);
  opacity: 0.72;
  padding: 2px 8px;
  border: 1px solid rgba(200, 120, 64, 0.22);
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}
.topbar-mode-badge:empty {
  display: none;
}
.btn-tb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.btn-tb svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.8;
}
.btn-tb:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.btn-tb:hover svg {
  opacity: 1;
}
.btn-tb.red:hover {
  color: var(--danger);
  background: rgba(200, 64, 64, 0.1);
}
.btn-tb.primary {
  color: var(--copper-lt);
  background: rgba(200, 120, 64, 0.14);
  border: 1px solid rgba(200, 120, 64, 0.32);
}
.btn-tb.primary:hover {
  background: rgba(200, 120, 64, 0.26);
}
.btn-tb.primary svg {
  opacity: 1;
}

/* Resume button is hidden by default; shown by JS when game is paused */
#btn-resume {
  display: none;
}

/* ── board wrap — no border, no shadow, clean ── */
#board-3d-wrap {
  position: relative;
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
}
#board-3d-canvas {
  display: block;
}
#board-3d-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 2;
}
#board-3d-overlay.hidden {
  display: none;
  pointer-events: none;
}

/* ── player panels — flat, no card/border/shadow ── */
.player-panel {
  width: clamp(155px, 14vw, 200px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 1;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

/* sections — flat dividers only */
.pp-section {
  padding: 14px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.pp-section:last-child {
  border-bottom: none;
}
.pp-section.turn-section {
  border-left: 3px solid var(--copper);
  background: rgba(200, 120, 64, 0.06);
  padding-left: 10px;
}
.pp-section.inactive {
  border-left: 3px solid rgba(255, 255, 255, 0.07);
  background: transparent;
}
.panel-heading {
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: var(--copper-lt);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 700;
  opacity: 1;
}
.turn-display {
  display: flex;
  align-items: center;
  gap: 11px;
}
.turn-gem {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--copper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.3s;
}
.turn-gem.white-gem {
  background: #f2ece0;
  color: #111;
  box-shadow: 0 0 16px rgba(242, 236, 224, 0.25);
}
/* dark mode black gem — lighter bg so it's visible */
.turn-gem.black-gem {
  background: #3a4258;
  color: #d8e0f0;
  border-color: var(--copper);
}
.turn-name {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.2;
  font-weight: 600;
}
.status-line {
  font-size: 0.7rem;
  margin-top: 5px;
  min-height: 1.1em;
  color: var(--text-dim);
}
.status-line.alert {
  color: var(--danger);
  font-weight: 700;
}
.status-line.thinking {
  color: var(--copper-lt);
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
.captures-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 24px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text);
}
.history-scroll {
  max-height: clamp(90px, 15vh, 180px);
  overflow-y: auto;
  font-size: 0.7rem;
  line-height: 2.1;
  color: var(--text-dim);
}
.history-scroll::-webkit-scrollbar {
  width: 2px;
}
.history-scroll::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 0;
}
.move-row {
  display: flex;
  gap: 8px;
}
.move-num {
  color: var(--copper-lt);
  min-width: 20px;
  font-size: 0.66rem;
  opacity: 0.8;
}
.move-w,
.move-b {
  flex: 1;
  color: var(--text-dim);
  font-size: 0.7rem;
}
.move-latest {
  color: var(--text) !important;
  font-weight: 700;
}

/* controls text in right panel */
.pp-controls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.pp-ctrl-item {
  display: flex;
  align-items: center;
  gap: 9px;
}
.pp-ctrl-item svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--copper-lt);
  opacity: 0.85;
}

/* light mode flat panels */
body.light-mode .pp-section {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .pp-section.turn-section {
  background: rgba(154, 85, 32, 0.06);
  border-left-color: var(--copper);
}
body.light-mode .pp-section.inactive {
  background: transparent;
  border-left-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .turn-gem.black-gem {
  background: #2c3040;
  color: #d0d8e8;
}

/* legacy hidden */
.side-panel {
  display: none;
}
.panel-card {
  display: none;
}
.btn-row {
  display: none;
}
.btn-ctrl {
  display: none;
}

/* ════════════════════════════════════════
       MODALS — pure dark glass, no brown tones
    ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 4, 8, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden {
  display: none;
}
.modal-box {
  background: linear-gradient(
    160deg,
    rgba(20, 26, 36, 0.99),
    rgba(12, 16, 24, 0.99)
  );
  border: 1px solid rgba(200, 120, 64, 0.28);
  border-radius: 0;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  position: relative;
  overflow: hidden;
}
.modal-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(200, 120, 64, 0.55),
    transparent
  );
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.06em;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.18s;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.modal-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(200, 120, 64, 0.2),
    transparent
  );
  margin: 14px 0;
}
.modal-sect {
  font-size: 0.54rem;
  letter-spacing: 0.3em;
  color: var(--copper);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Confirm — pure dark, no brownish */
#confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2, 4, 8, 0.92);
  backdrop-filter: blur(14px);
}
#confirm-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(200, 120, 64, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}
.confirm-box {
  display: contents;
}
#confirm-icon {
  font-size: 3.4rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 24px rgba(200, 120, 64, 0.6));
  position: relative;
  z-index: 1;
}
#confirm-title {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 1;
}
#confirm-msg {
  font-size: clamp(0.65rem, 2vw, 0.8rem);
  letter-spacing: 0.35em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 30px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.confirm-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.btn-confirm {
  padding: 0.8em 2.4em;
  border-radius: 0;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.22s;
  text-transform: uppercase;
}
.btn-confirm.cancel {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-confirm.cancel:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}
.btn-confirm.ok {
  background: rgba(200, 120, 64, 0.15);
  border: 1.5px solid var(--copper);
  color: var(--copper-lt);
  box-shadow: 0 4px 20px rgba(200, 120, 64, 0.12);
}
.btn-confirm.ok:hover {
  background: rgba(200, 120, 64, 0.28);
  box-shadow: 0 8px 32px rgba(200, 120, 64, 0.3);
  transform: translateY(-2px);
}

/* Promo */
#promo-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 4, 8, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#promo-overlay.hidden {
  display: none;
}
.promo-box {
  background: linear-gradient(
    160deg,
    rgba(18, 22, 32, 0.99),
    rgba(10, 14, 22, 0.99)
  );
  border: 1px solid rgba(200, 120, 64, 0.3);
  border-radius: 0;
  padding: 26px 30px;
  text-align: center;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.promo-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(200, 120, 64, 0.55),
    transparent
  );
}
.promo-title {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: 18px;
  text-transform: uppercase;
}
.promo-options {
  display: flex;
  gap: 10px;
}
.promo-sq {
  width: 62px;
  height: 62px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}
.promo-sq:hover {
  transform: scale(1.08) translateY(-3px);
  box-shadow: 0 8px 24px rgba(200, 120, 64, 0.35);
  border-color: var(--copper);
  background: rgba(200, 120, 64, 0.14);
}

/* Game Over */
#screen-over {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
#screen-over::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(200, 120, 64, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}
.over-crown {
  font-size: 3.4rem;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 24px rgba(200, 120, 64, 0.6));
}
.over-title {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
}
.over-sub {
  font-size: clamp(0.65rem, 2vw, 0.8rem);
  letter-spacing: 0.35em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 30px;
}
.over-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-over {
  padding: 0.8em 2.4em;
  border-radius: 0;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.22s;
  text-transform: uppercase;
}
.btn-over.primary {
  background: rgba(200, 120, 64, 0.15);
  border: 1.5px solid var(--copper);
  color: var(--copper-lt);
  box-shadow: 0 4px 20px rgba(200, 120, 64, 0.12);
}
.btn-over.primary:hover {
  background: rgba(200, 120, 64, 0.28);
  box-shadow: 0 8px 32px rgba(200, 120, 64, 0.3);
  transform: translateY(-2px);
}
.btn-over.secondary {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-over.secondary:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}

/* ── PAUSE OVERLAY ── */
#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 4, 8, 0.92);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
#pause-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(200, 120, 64, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}
#pause-overlay.hidden {
  display: none;
}
.pause-box {
  display: contents;
}
.pause-title {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 1;
}
.pause-sub {
  font-size: clamp(0.65rem, 2vw, 0.8rem);
  letter-spacing: 0.35em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 30px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.pause-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
  align-items: center;
}
.btn-pause-menu {
  padding: 0.8em 2.4em;
  border-radius: 0;
  font-family: Georgia, serif;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.22s;
  min-width: 200px;
  text-align: center;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-pause-menu:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.btn-pause-menu.primary {
  background: rgba(200, 120, 64, 0.15);
  border: 1.5px solid var(--copper);
  color: var(--copper-lt);
  box-shadow: 0 4px 20px rgba(200, 120, 64, 0.12);
}
.btn-pause-menu.primary:hover {
  background: rgba(200, 120, 64, 0.28);
  box-shadow: 0 8px 32px rgba(200, 120, 64, 0.3);
  transform: translateY(-2px);
}
.btn-pause-menu.danger {
  border-color: rgba(200, 64, 64, 0.35);
  color: rgba(220, 100, 100, 0.8);
}
.btn-pause-menu.danger:hover {
  background: rgba(200, 64, 64, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* ════════════════════════════════════════
       OPTIONS / SETTINGS
    ════════════════════════════════════════ */
#options-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(2, 4, 8, 0.94);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
#options-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(200, 120, 64, 0.07) 0%,
    transparent 65%
  );
  pointer-events: none;
}
#options-overlay.hidden {
  display: none;
}
#options-overlay .over-crown {
  font-size: 3.4rem;
  margin-bottom: 0;
  filter: drop-shadow(0 0 24px rgba(200, 120, 64, 0.6));
  position: relative;
  z-index: 1;
}
.options-title {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  text-align: center;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.8);
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
}
.options-box {
  background: transparent;
  border: none;
  border-radius: 0;
  width: min(500px, 96vw);
  max-height: 55vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.options-inner {
  overflow-y: auto;
  flex: 1;
  padding: 0 28px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 120, 64, 0.18) transparent;
}
.options-inner::-webkit-scrollbar {
  width: 3px;
}
.options-inner::-webkit-scrollbar-thumb {
  background: rgba(200, 120, 64, 0.2);
  border-radius: 0;
}
.options-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 1;
  margin-top: 4px;
}
.opts-section-lbl {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: var(--copper-lt);
  text-transform: uppercase;
  font-weight: 700;
  padding: 18px 0 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 2px;
}
.opts-section-lbl:first-of-type {
  border-top: none;
  padding-top: 20px;
}
.opts-divider {
  display: none;
}
.opts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.opts-label {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}
.opts-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  width: 38px;
  height: 22px;
  background: var(--border2);
  border-radius: 0;
  position: relative;
  cursor: pointer;
  transition: background 0.22s;
  flex-shrink: 0;
}
.toggle.on {
  background: var(--copper);
}
.toggle::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 0;
  top: 3px;
  left: 3px;
  transition: transform 0.22s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.toggle.on::after {
  transform: translateX(16px);
}
.vol-slider {
  -webkit-appearance: none;
  width: 90px;
  height: 3px;
  background: var(--border2);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--copper);
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(200, 120, 64, 0.45);
}
.vol-val {
  font-size: 0.6rem;
  color: var(--text-dim);
  min-width: 30px;
  text-align: right;
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.theme-swatch {
  cursor: pointer;
  border-radius: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.07);
  transition: all 0.18s;
}
.theme-swatch:hover {
  transform: translateY(-3px);
  border-color: rgba(200, 120, 64, 0.55);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.theme-swatch.selected-theme {
  border-color: var(--copper);
  box-shadow: 0 0 12px rgba(200, 120, 64, 0.35);
}
.theme-swatch.active-theme {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(240, 192, 64, 0.3);
}
.theme-swatch-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 32px;
}
.theme-swatch-name {
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 5px 2px;
  text-transform: uppercase;
  font-weight: 700;
}
#pending-theme-name {
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  display: block;
  margin-top: 6px;
  margin-bottom: 4px;
  min-height: 1.4em;
}
.custom-preview {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-radius: 0;
  overflow: hidden;
  height: 30px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.custom-theme-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
  padding: 14px 16px;
}
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-row:last-child:nth-child(odd) {
  grid-column: span 2;
}
.color-label {
  font-size: 0.72rem;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
}
.color-input {
  width: 28px;
  height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  cursor: pointer;
  background: none;
  padding: 1px;
  flex-shrink: 0;
}
.color-hex {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 0;
  color: var(--text-dim);
  font-family: "Courier New", monospace;
  font-size: 0.54rem;
  width: 58px;
  padding: 4px 6px;
  flex-shrink: 0;
}
.color-hex:focus {
  outline: none;
  border-color: rgba(200, 120, 64, 0.5);
  color: var(--text);
}
.options-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.btn-options {
  padding: 0.52em 1.2em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.btn-options:hover {
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}
.btn-options.apply {
  border-color: rgba(200, 120, 64, 0.45);
  color: var(--copper-lt);
  background: rgba(200, 120, 64, 0.12);
}
.btn-options.apply:hover {
  background: rgba(200, 120, 64, 0.22);
  box-shadow: 0 0 18px rgba(200, 120, 64, 0.18);
}

@keyframes pieceDrop {
  from {
    transform: scale(0.65);
    opacity: 0.4;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.piece-anim {
  animation: pieceDrop 0.16s ease-out;
}
@keyframes checkPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}
.in-check {
  animation: checkPulse 0.55s ease-in-out 3;
}
@keyframes confirmIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   AD OVERLAY — both skins use the same lobby chrome
   • ctx-gm  → reuses the lobby Info-page chrome (matches lobby)
   • ctx-lb → reuses the lobby Info-page chrome
═══════════════════════════════════════════════════════════ */
#rw-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8;
  backdrop-filter: none;
}
#rw-overlay::before {
  display: none;
}
body.light-mode #rw-overlay {
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8;
  backdrop-filter: none;
}
#rw-overlay.rw-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Both ctx-gm and ctx-lb share the same warm lobby background */
#rw-overlay.ctx-lb,
#rw-overlay.ctx-gm {
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8;
  backdrop-filter: none;
}
#rw-overlay.ctx-lb::before,
#rw-overlay.ctx-gm::before {
  display: none;
}

.rw-skin {
  display: none;
  width: 100%;
  height: 100%;
}
#rw-overlay.ctx-gm .rw-skin-game {
  display: flex;
}
#rw-overlay.ctx-lb .rw-skin-lobby {
  display: flex;
}

/* ── Game skin: ad "card" sits inside the reused options-box ── */
.rw-options-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
}
#rw-overlay .options-box {
  width: min(480px, 93vw);
}

/* ── Lobby skin: bold heading inside the reused info-card, ad below it ── */
.rw-card-heading {
  text-align: center;
  margin-bottom: 8px;
}
.rw-heading-img {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.rw-slogan-wrap {
  text-align: center;
  margin-top: 8px;
}
.rw-slogan-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.rw-info-card {
  align-items: center;
}

/* ── Shared ad stage (holds the iframe + placeholder) — no extra labels, just the ad ── */
.rw-stage {
  position: relative;
  width: 300px;
  height: 250px;
  background: transparent;
  overflow: hidden;
  border: none;
  margin: 0 auto;
}
#rw-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.rw-holder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  pointer-events: none;
  background: linear-gradient(160deg, #1a100a 0%, #2b1a0e 60%, #1a100a 100%);
  border: 1px solid rgba(200, 140, 50, 0.35);
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(200, 140, 50, 0.12);
}
.rw-holder::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(200, 140, 50, 0.18);
  pointer-events: none;
}
.rw-ph-label {
  font-family: "Courier New", monospace;
  font-size: 0.52rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(200, 140, 50, 0.45);
  margin-bottom: 10px;
}
.rw-ph-dim {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: rgba(210, 155, 60, 0.75);
  line-height: 1;
  margin-bottom: 8px;
}
.rw-ph-sub {
  font-family: Georgia, serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: rgba(200, 140, 50, 0.45);
  text-align: center;
  padding: 0 24px;
  line-height: 1.6;
}

/* ── Skip / Claim action button — countdown lives HERE, not in a separate top badge ── */
#rw-overlay .btn-over.rw-action-btn {
  min-width: 200px;
}
#rw-overlay .btn-over.rw-action-btn .rw-sec {
  font-weight: 800;
}
#rw-overlay .btn-over.rw-action-btn:disabled,
.rw-action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none !important;
}
.rw-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(200, 120, 64, 0.12);
  border: 1.5px solid rgba(160, 100, 40, 0.4);
  padding: 0.75em 2em;
  border-radius: 0;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a4a18;
  cursor: pointer;
  transition: all 0.22s;
}
.rw-action-btn .rw-action-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.rw-action-btn.ready {
  background: rgba(200, 120, 64, 0.22);
  border-color: #c87840;
  box-shadow: 0 4px 20px rgba(200, 120, 64, 0.2);
}
.rw-action-btn:not(:disabled):hover {
  background: rgba(200, 120, 64, 0.2);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════
   COIN BADGE (topbar)
═══════════════════════════════════════════════════════════ */
.coin-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(200, 120, 64, 0.1);
  border: 1px solid rgba(200, 120, 64, 0.22);
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--copper-lt);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
}
.coin-badge:hover {
  background: rgba(200, 120, 64, 0.2);
}
.coin-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.coin-badge.coin-low {
  border-color: rgba(200, 60, 60, 0.4);
  color: rgba(220, 120, 120, 0.9);
}
#coin-count {
  font-weight: 700;
  font-family: Georgia, serif;
  font-size: 0.72rem;
}

/* coin toast */
.coin-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(
    135deg,
    rgba(20, 24, 32, 0.97),
    rgba(12, 16, 24, 0.97)
  );
  border: 1px solid rgba(200, 120, 64, 0.3);
  padding: 10px 18px;
  z-index: 9998;
  color: var(--copper-lt);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
  border-radius: 2px;
}
.coin-toast.coin-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.coin-toast.coin-toast-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}
/* error variant — red border when not enough coins */
#coin-toast {
  border-color: rgba(200, 80, 60, 0.4);
  color: rgba(240, 160, 140, 0.95);
  background: linear-gradient(
    135deg,
    rgba(28, 14, 12, 0.97),
    rgba(18, 10, 8, 0.97)
  );
}
.ct-coin {
  font-size: 0.9rem;
  color: var(--gold);
}
.ct-amount {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
}
.ct-reason {
  font-size: 0.58rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* hint button in topbar */
.btn-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.btn-hint svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.8;
}
.btn-hint:hover {
  color: var(--gold);
  background: rgba(240, 192, 64, 0.1);
}
.btn-hint .hint-cost {
  font-size: 0.5rem;
  color: var(--copper-dim);
  border: 1px solid rgba(200, 120, 64, 0.2);
  border-radius: 100px;
  padding: 1px 5px;
  margin-left: 2px;
}

/* ── LOBBY COIN DISPLAY ── */
.lobby-coin-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  width: 100%;
}
.lobby-coin-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  background: rgba(200, 120, 64, 0.08);
  border: 1px solid rgba(200, 120, 64, 0.22);
  color: var(--brand-title);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
}
.lobby-coin-badge:hover {
  background: rgba(200, 120, 64, 0.16);
  transform: translateY(-1px);
}
.lobby-coin-badge svg {
  width: 14px;
  height: 14px;
  color: var(--gold);
  flex-shrink: 0;
}
.lobby-coin-count {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}
.lobby-coin-earn {
  font-size: 0.52rem;
  letter-spacing: 0.16em;
  color: var(--brand-dim);
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid rgba(200, 120, 64, 0.12);
  transition: color 0.18s;
}
.lobby-coin-earn:hover {
  color: var(--brand-title);
}

/* locked theme overlay on swatch */
.theme-swatch-locked {
  position: relative;
}
.theme-swatch-locked::after {
  content: "🔒";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.9rem;
  pointer-events: none;
}
.theme-swatch-price {
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 4px 2px 5px;
  text-transform: uppercase;
  background: rgba(200, 120, 64, 0.18);
  color: var(--gold);
  font-weight: 700;
}

/* coin unlock modal */
#unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 4, 8, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#unlock-overlay.hidden {
  display: none;
}
.unlock-box {
  background: linear-gradient(
    170deg,
    rgba(16, 20, 28, 0.99),
    rgba(10, 13, 20, 0.99)
  );
  border: 1px solid rgba(200, 120, 64, 0.28);
  padding: 28px 30px 22px;
  width: min(340px, 92vw);
  text-align: center;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: modalIn 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  position: relative;
  overflow: hidden;
}
.unlock-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(200, 120, 64, 0.55),
    transparent
  );
}
.unlock-preview {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0 auto 14px;
  width: 160px;
  overflow: hidden;
}
.unlock-title {
  font-family: Georgia, serif;
  font-size: 1rem;
  color: var(--brand-title);
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.unlock-sub {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.unlock-cost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 18px;
}
.unlock-balance {
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.unlock-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.btn-unlock {
  padding: 0.6em 1.4em;
  font-family: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.btn-unlock.cancel {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-dim);
}
.btn-unlock.cancel:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}
.btn-unlock.confirm {
  background: rgba(200, 120, 64, 0.16);
  border: 1.5px solid var(--brand-accent);
  color: var(--brand-title);
}
.btn-unlock.confirm:hover {
  background: rgba(200, 120, 64, 0.28);
  box-shadow: 0 0 16px rgba(200, 120, 64, 0.2);
}
.btn-unlock.confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── watch-ad unlock button ── */
.btn-unlock.watch {
  background: rgba(240, 192, 64, 0.12);
  border: 1px solid rgba(240, 192, 64, 0.3);
  color: var(--gold);
  padding: 0.58em 1em;
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.btn-unlock.watch:hover {
  background: rgba(240, 192, 64, 0.22);
  box-shadow: 0 0 14px rgba(240, 192, 64, 0.2);
}

/* ad overlay z-index — single authoritative rule above */

/* coin-toast show class */
.coin-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) !important;
}

/* ── light mode lobby improvements — lobby now uses unified image colors, kept for non-lobby elements ── */
/* ═══════════════════════════════════════════════════════════
   LOBBY — unified text colors for cream/gold background image
   Applied always (both dark and light mode) in the lobby screen
═══════════════════════════════════════════════════════════ */
#screen-start .lobby-title .t1 {
  color: #c8853a;
  text-shadow:
    0 2px 12px rgba(180, 110, 30, 0.2),
    0 1px 3px rgba(120, 70, 0, 0.15);
}
#screen-start .lobby-title .t2 {
  color: #7a4a18;
  letter-spacing: 0.04em;
}
#screen-start .lobby-logo-accent {
  color: #b07838;
}
#screen-start .lobby-logo-frame {
  border-color: rgba(160, 100, 30, 0.55);
  box-shadow:
    0 0 0 1px rgba(160, 100, 30, 0.18),
    inset 0 0 20px rgba(200, 140, 60, 0.08);
}
#screen-start .lobby-logo-corner {
  color: rgba(160, 100, 30, 0.8);
}
#screen-start .lobby-eyebrow {
  color: #b07838;
}
#screen-start .lobby-eyebrow::before,
#screen-start .lobby-eyebrow::after {
  background: linear-gradient(90deg, transparent, #b07838);
}
#screen-start .lobby-eyebrow::after {
  background: linear-gradient(90deg, #b07838, transparent);
}
#screen-start .lobby-tagline {
  color: #8a6030;
}
#screen-start .lobby-stats {
  background: rgba(255, 248, 235, 0.65);
  border-color: rgba(160, 110, 50, 0.3);
}
#screen-start .lstat + .lstat::before {
  background: rgba(160, 110, 50, 0.25);
}
#screen-start .lstat-val {
  color: #b07028;
  font-weight: 700;
}
#screen-start .lstat-lbl {
  color: #7a5c30;
}
#screen-start .feature-badge {
  background: rgba(255, 248, 235, 0.6);
  border-color: rgba(160, 110, 50, 0.22);
  border-left-color: #c87840;
}
#screen-start .feature-badge-title {
  color: #8a4a10;
  font-weight: 700;
}
#screen-start .feature-badge-desc {
  color: #7a5a30;
}
#screen-start .feature-badge-icon {
  color: #b07028;
}
#screen-start .mode-btn {
  background: rgba(255, 248, 235, 0.6);
  border-color: rgba(160, 110, 50, 0.2);
  color: #5a3818;
}
#screen-start .mode-btn:hover {
  background: rgba(200, 120, 64, 0.1);
  border-color: rgba(200, 120, 64, 0.5);
}
#screen-start .mode-btn.active {
  background: rgba(200, 120, 64, 0.18);
  border-color: #c87840;
  box-shadow: 0 0 18px rgba(200, 120, 64, 0.18);
}
#screen-start .mode-title {
  color: #8a4a10;
  font-weight: 700;
}
#screen-start .mode-desc {
  color: #7a5a30;
}
#screen-start .diff-btn {
  background: rgba(255, 248, 235, 0.5);
  border-color: rgba(160, 110, 50, 0.25);
  color: #7a5030;
}
#screen-start .diff-btn:hover,
#screen-start .diff-btn.active {
  border-color: #c87840;
  color: #8a4a10;
  background: rgba(200, 120, 64, 0.12);
}
#screen-start .lbl-sm {
  color: #9a6830;
}
#screen-start .lobby-link {
  color: #8a6840;
  font-weight: 600;
}
#screen-start .lobby-link:hover {
  color: #c87840;
}
#screen-start .lobby-coin-badge {
  background: rgba(255, 248, 235, 0.65);
  border-color: rgba(160, 110, 50, 0.3);
  color: #7a4a18;
}
#screen-start .lobby-coin-count {
  color: #b07028;
  font-weight: 700;
}
#screen-start .lobby-coin-earn {
  border-color: rgba(160, 110, 50, 0.25);
  color: #6a3818;
}
#screen-start .lobby-coin-earn:hover {
  color: #9a5520;
  border-color: #c87840;
}
#screen-start .btn-start-game {
  background: linear-gradient(
    135deg,
    rgba(200, 120, 64, 0.3),
    rgba(200, 120, 64, 0.14)
  );
  border-color: #c87840;
  color: #5a2e08;
  font-weight: 700;
}
#screen-start .btn-start-game:hover {
  background: linear-gradient(
    135deg,
    rgba(200, 120, 64, 0.48),
    rgba(200, 120, 64, 0.28)
  );
  color: #3a1e04;
}
/* hide the animated chess grid overlay — not needed over the image */
#screen-start .lobby-chess-grid {
  display: none;
}
/* suppress the grid-drift ::before overlay over the image */
#screen-start::before {
  background: none !important;
}
#screen-start::after {
  background: none !important;
}

/* light-mode screen-start — same image, same unified lobby colors */
body.light-mode #screen-start {
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8 !important;
}
/* chess grid — hidden in lobby (image covers it) */
body.light-mode .lobby-chess-grid {
  display: none;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — GAME SCREEN
═══════════════════════════════════════════════════════════ */

/* ── Topbar always single line — scale down gracefully ── */
#game-topbar {
  max-width: calc(100vw - 16px);
  overflow: hidden;
  white-space: nowrap;
  flex-wrap: nowrap;
}

/* ── Tablet (≤960px): vertical stack layout ── */
@media (max-width: 960px) {
  #screen-game {
    flex-direction: column !important;
    align-items: center;
    justify-content: flex-start;
    padding-top: 54px;
    padding-left: 10px;
    padding-right: 10px;
    padding-bottom: 12px;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .player-panel {
    width: 100% !important;
    max-width: 640px;
    flex-direction: row;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-width: 0;
  }
  .pp-section {
    flex: 1;
    min-width: 160px;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .pp-section:last-child {
    border-right: none;
  }
  .pp-section.turn-section {
    flex: 0 0 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .history-scroll {
    max-height: 55px;
  }
  /* Topbar: hide brand + separators, keep all buttons */
  #game-topbar {
    top: 8px;
    padding: 5px 14px;
  }
  .topbar-brand {
    display: none;
  }
  .topbar-sep {
    margin: 0 2px;
  }
  .btn-tb {
    padding: 5px 10px;
    font-size: 0.62rem;
  }
}

/* ── Small tablet / large mobile (≤700px): hide labels, icon+coin only ── */
@media (max-width: 700px) {
  .tb-label {
    display: none;
  }
  .hint-cost {
    display: none;
  }
  .topbar-sep {
    display: none;
  }
  .btn-tb {
    padding: 6px 8px;
    gap: 0;
  }
  .btn-hint {
    padding: 6px 8px;
    gap: 0;
  }
  .coin-badge {
    padding: 5px 8px;
    gap: 3px;
  }
  #game-topbar {
    top: 6px;
    left: 6px;
    right: 6px;
    transform: none;
    width: auto;
    border-radius: 12px;
    padding: 5px 10px;
    justify-content: space-evenly;
  }
  #screen-game {
    padding-top: 50px;
    padding-left: 6px;
    padding-right: 6px;
    gap: 6px;
  }
  .player-panel {
    max-width: 100%;
  }
  .pp-section {
    min-width: 120px;
  }
  .history-scroll {
    max-height: 44px;
  }
  .turn-gem {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
  .turn-name {
    font-size: 0.88rem;
  }
  .panel-heading {
    font-size: 0.55rem;
  }
}

/* ── Very small (≤400px): tighten further ── */
@media (max-width: 400px) {
  #game-topbar {
    padding: 4px 8px;
    gap: 0;
  }
  .btn-tb {
    padding: 5px 6px;
  }
  .btn-hint {
    padding: 5px 6px;
  }
  .coin-badge {
    padding: 4px 6px;
  }
  .pp-section {
    min-width: 100px;
  }
}

/* ── Landscape mobile (short height): side-by-side ── */
@media (max-height: 520px) and (orientation: landscape) {
  #screen-game {
    flex-direction: row !important;
    align-items: center;
    padding-top: 44px;
    padding-left: 6px;
    padding-right: 6px;
    gap: 6px;
    overflow: hidden;
  }
  .player-panel {
    width: clamp(115px, 13vw, 150px) !important;
    flex-direction: column;
    flex-shrink: 1;
  }
  .pp-section {
    flex: none;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .pp-section.turn-section {
    flex: none;
    border-right: none;
  }
  .history-scroll {
    max-height: 44px;
  }
  #game-topbar {
    top: 4px;
    padding: 4px 10px;
  }
  .topbar-brand {
    display: none;
  }
  .btn-tb {
    padding: 3px 7px;
    font-size: 0.58rem;
  }
}

/* ── TURN TIMER ── */
/* ── TURN TIMER — native panel section style ── */
#turn-timer-wrap {
  width: 100%;
  display: block;
  opacity: 1;
  transition: opacity 0.25s;
}
#turn-timer-wrap.hidden {
  display: none;
}

/* Matches .pp-section.turn-section exactly */
.ttw-inner {
  padding: 10px 12px 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--copper, #c87840);
  background: rgba(200, 120, 64, 0.06);
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Big countdown number — Georgia like .turn-name */
.ttw-num {
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--copper-lt, #e8a060);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 2ch;
  transition: color 0.3s;
}

/* Right side: label + bar */
.ttw-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ttw-lbl {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper-lt, #e8a060);
  font-weight: 700;
  opacity: 0.75;
}

/* Thin progress bar — same height as .history-scroll scrollbar */
.ttw-track-bar {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  overflow: hidden;
}
.ttw-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--copper, #c87840);
  transition:
    width 0.9s linear,
    background 0.3s;
  width: 100%;
}

/* Urgent — red, matches .status-line.alert */
#turn-timer-wrap.urgent .ttw-num {
  color: var(--danger, #e05050);
}
#turn-timer-wrap.urgent .ttw-lbl {
  color: var(--danger, #e05050);
  opacity: 0.9;
}
#turn-timer-wrap.urgent .ttw-bar-fill {
  background: var(--danger, #e05050);
}
#turn-timer-wrap.urgent .ttw-inner {
  border-left-color: var(--danger, #e05050);
}

/* Hidden svg — kept for JS compat */
.ttw-ring,
.ttw-arc {
  display: none;
}

/* ── PRE-GAME COUNTDOWN OVERLAY ── */
#pregame-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  gap: 18px;
}
#pregame-overlay.hidden {
  display: none;
}
.pregame-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
}
.pregame-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}
.pregame-count {
  font-size: 72px;
  font-weight: 900;
  color: var(--copper, #c87840);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* status-line stays at original .7rem — no override */

/* ════════════════════════════════════════════════════════════
   LOADER — BIGGER FONT SIZES
════════════════════════════════════════════════════════════ */
/* ── Logo image styles ── */
.logo-img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  /* multiply makes black pixels disappear on light parchment background */
  mix-blend-mode: multiply;
}
.loader-logo-img {
  width: clamp(280px, 42vw, 480px);
  margin: 0 auto;
}
.lobby-logo-img {
  width: clamp(300px, 52vw, 520px);
  margin: 0 auto;
}
#screen-start .lobby-logo-img {
  width: clamp(440px, 70vw, 740px);
}

/* ════════════════════════════════════════════════════════════
   NEW LOBBY LAYOUT (logo top → board+play center → bottom)
════════════════════════════════════════════════════════════ */

/* Override old lobby layout to flex-column with sections */
#screen-start .lobby-layout {
  max-width: 560px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  height: 100%;
}
#screen-start .lobby-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 72px 0 56px;
}

/* Section 1: Logo — pinned to top */
.lobby-logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  align-self: flex-start;
  width: 100%;
  gap: 8px;
}

/* Coin row inside logo section */
.lobby-logo-section .lobby-coin-row {
  margin-bottom: 0;
}

/* Section 2: Board + play — grows to fill center */
.lobby-mid-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Mini board removed */

/* Section 3: Bottom buttons — pinned to bottom */
.lobby-bottom-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  align-self: flex-end;
}
.lobby-bottom-row-icons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.lobby-play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}
.lobby-play-btn:hover {
  transform: scale(1.08);
}
.lobby-play-btn:active {
  transform: scale(0.95);
}
.lobby-play-img {
  width: clamp(260px, 36vw, 440px);
  height: auto;
  display: block;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 6px 24px rgba(60, 30, 8, 0.35));
}

/* Chess-medallion Play button — dark brown cartoonish */
.lobby-play-medallion {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 35% 28%,
    #5a3018 0%,
    #3d1e0a 55%,
    #251004 100%
  );
  border: 4px solid #1a0a02;
  box-shadow:
    0 0 0 6px #3a1e08,
    0 0 0 10px #7a4010,
    0 0 0 13px #5a2e08,
    0 12px 36px rgba(30, 15, 5, 0.6),
    inset 0 3px 8px rgba(180, 120, 60, 0.3),
    inset 0 -6px 14px rgba(10, 4, 1, 0.6);
  transition:
    box-shadow 0.22s,
    transform 0.18s;
}
/* Engraved chess-piece motifs around the rim */
.medallion-motifs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.motif-glyph {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  fill: #c8853a;
  opacity: 0.45;
}
/* Center core — cartoonish brown play button */
.lobby-play-core {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 38% 30%,
    #8a5020 0%,
    #5a2e08 55%,
    #3a1804 100%
  );
  box-shadow:
    inset 0 3px 8px rgba(200, 130, 60, 0.35),
    inset 0 -4px 10px rgba(10, 4, 1, 0.65),
    0 4px 12px rgba(20, 8, 2, 0.5),
    0 0 0 3px rgba(120, 65, 20, 0.6);
}
.lobby-play-arrow {
  flex-shrink: 0;
  position: relative;
  left: 3px;
  filter: drop-shadow(0 2px 2px rgba(255, 200, 100, 0.25))
    drop-shadow(0 -1px 1px rgba(10, 4, 1, 0.6));
}
/* Cartoonish PLAY label */
.lobby-play-label {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  color: #c8853a;
  text-transform: uppercase;
  margin-top: 4px;
  text-shadow:
    0 1px 0 rgba(80, 40, 10, 0.6),
    0 2px 4px rgba(10, 4, 1, 0.4);
}

/* lobby-bottom-section and lobby-bottom-row-icons defined above */
.lobby-icon-btn {
  width: 82px;
  height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(200, 120, 64, 0.18);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.18s;
}
.lobby-icon-btn svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.lobby-icon-label {
  font-family: Georgia, serif;
  font-size: 0.42rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: inherit;
  line-height: 1;
}
.lobby-icon-btn:hover {
  border-color: var(--copper);
  color: var(--copper-lt);
  background: rgba(200, 120, 64, 0.1);
  transform: scale(1.08);
}
#screen-start .lobby-icon-btn {
  background: rgba(255, 248, 235, 0.55);
  border-color: rgba(160, 110, 50, 0.2);
  color: #7a5030;
}
#screen-start .lobby-icon-btn:hover {
  border-color: #c87840;
  color: #5a2e08;
}

/* Hide PvP floating button in lobby */
.pvp__float {
  display: none !important;
}

/* ════════════════════════════════════════════════════════════
   SUBPAGE TEXT COLOR OVERRIDES
   All 3 subpages (info, settings, themes) share the light
   marble lobby background — force warm dark-brown palette
   regardless of whether body.light-mode is active
════════════════════════════════════════════════════════════ */
#screen-themes .settings-card-title,
#screen-themes .info-section-label,
#screen-settings .settings-card-title,
#screen-settings .settings-section-label,
#screen-themes .settings-section-label {
  color: #9a5520;
}
#screen-settings .settings-row-name,
#screen-info .settings-row-name {
  color: #2a1c10;
}
#screen-settings .settings-row-desc,
#screen-settings .settings-vol-val,
#screen-settings .settings-seg-desc,
#screen-info .settings-row-desc {
  color: #7a6048;
}
#screen-settings .settings-row {
  border-bottom-color: rgba(160, 100, 40, 0.12);
}
#screen-settings .settings-seg {
  color: #5a3e28;
  border-color: rgba(160, 100, 40, 0.25);
  background: rgba(255, 248, 235, 0.3);
}
#screen-settings .settings-seg.active {
  background: rgba(200, 120, 64, 0.18);
  color: #7a3808;
}
#screen-settings .settings-toggle {
  background: rgba(160, 100, 40, 0.12);
  border-color: rgba(160, 100, 40, 0.3);
}
#screen-settings .settings-toggle::after {
  background: #b09070;
}
#screen-settings .settings-toggle.on {
  background: rgba(160, 85, 20, 0.35);
  border-color: rgba(160, 85, 20, 0.6);
}
#screen-settings .settings-toggle.on::after {
  background: #c87840;
}
#screen-settings .settings-footer,
#screen-themes .settings-footer,
#screen-info .info-footer {
  color: rgba(100, 60, 20, 0.5);
}
#screen-themes .themes-color-label {
  color: #5a3e28;
}
#screen-themes .color-hex {
  color: #3a2010;
  border-color: rgba(160, 100, 40, 0.3);
  background: rgba(255, 248, 235, 0.4);
}
#screen-info .info-divider {
  background: rgba(160, 100, 40, 0.2);
}
#screen-info .info-step {
  color: #3a2c1a;
}
#screen-info .info-ctrl {
  color: #4a3828;
}
#screen-info .info-key {
  border-color: rgba(160, 100, 40, 0.3);
  color: #5a3e28;
  background: rgba(255, 248, 235, 0.5);
}

/* Themes subpage — opts-section-lbl and color controls on light background */
.tp-section-lbl {
  color: #9a5520 !important;
  border-top-color: rgba(160, 100, 40, 0.15) !important;
}
#screen-themes .color-label {
  color: #2a1c10 !important;
}
#screen-themes .color-hex {
  color: #3a2010 !important;
  border-color: rgba(160, 100, 40, 0.3) !important;
  background: rgba(255, 248, 235, 0.45) !important;
}
#screen-themes .color-hex:focus {
  border-color: rgba(200, 120, 64, 0.5) !important;
}
#screen-themes .color-input {
  border-color: rgba(160, 100, 40, 0.3) !important;
}
#screen-themes .custom-preview {
  border-color: rgba(160, 100, 40, 0.2) !important;
}
#screen-themes .options-btns {
  border-top-color: rgba(160, 100, 40, 0.15) !important;
  justify-content: center;
  gap: 16px;
}
.tp-img-btn {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  cursor: pointer;
}
.tp-img-btn .pvp__btn-banner-img {
  width: clamp(160px, 28vw, 260px);
  height: auto;
  display: block;
  transition:
    transform 0.15s,
    filter 0.15s;
}
.tp-img-btn:hover .pvp__btn-banner-img {
  transform: scale(1.04);
  filter: brightness(1.1);
}
.tp-img-btn:active .pvp__btn-banner-img {
  transform: scale(0.97);
}
#screen-themes .btn-options {
  background: rgba(255, 248, 235, 0.5) !important;
  border-color: rgba(160, 100, 40, 0.25) !important;
  color: #5a3e28 !important;
}
#screen-themes .btn-options:hover {
  border-color: rgba(160, 100, 40, 0.55) !important;
  color: #2a1c10 !important;
  background: rgba(255, 248, 235, 0.75) !important;
}
#screen-themes .btn-options.apply {
  border-color: rgba(200, 120, 64, 0.55) !important;
  color: #7a3808 !important;
  background: rgba(200, 120, 64, 0.14) !important;
}
#screen-themes .btn-options.apply:hover {
  background: rgba(200, 120, 64, 0.24) !important;
}
/* Theme grid on light bg — keep dark swatch names readable, just add hover lift */
#screen-themes .theme-grid {
  margin-bottom: 8px;
}
#screen-themes .theme-swatch {
  border-color: rgba(160, 100, 40, 0.2) !important;
}
#screen-themes .theme-swatch:hover {
  border-color: rgba(200, 120, 64, 0.7) !important;
}
#screen-themes .theme-swatch.active-theme {
  border-color: #c87840 !important;
  box-shadow: 0 0 14px rgba(200, 120, 64, 0.35) !important;
}
#screen-themes .theme-swatch.selected-theme {
  border-color: #a05820 !important;
}

/* ════════════════════════════════════════════════════════════
   SUB-PAGES: shared layout (info, settings, themes, modes, online)
════════════════════════════════════════════════════════════ */
.subpage-back-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-start;
  padding: 18px 24px;
  background: transparent;
  pointer-events: none;
}
.subpage-back-btn {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px 10px 16px;
  background: #3d2208;
  border: 1px solid rgba(80, 35, 5, 0.6);
  border-radius: 4px;
  color: #f5e8d0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 210, 140, 0.12) inset;
}
.subpage-back-btn svg {
  flex-shrink: 0;
  color: #c8904a;
}
.subpage-back-btn:hover {
  background: #4e2c0a;
  border-color: rgba(200, 120, 64, 0.5);
  color: #ffe8c0;
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 210, 140, 0.18) inset;
}

.subpage-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 80px 20px 32px;
  gap: 20px;
}
.subpage-logo {
  text-align: center;
  flex-shrink: 0;
}

/* Subpage logos — match lobby: no dark shadow, centered tagline */
#screen-modes .lobby-title .t1,
#screen-online .lobby-title .t1,
#screen-info .lobby-title .t1,
#screen-settings .lobby-title .t1,
#screen-themes .lobby-title .t1 {
  color: #c8853a;
  text-shadow:
    0 2px 12px rgba(180, 110, 30, 0.2),
    0 1px 3px rgba(120, 70, 0, 0.15);
}
#screen-modes .lobby-title .t2,
#screen-online .lobby-title .t2,
#screen-info .lobby-title .t2,
#screen-settings .lobby-title .t2,
#screen-themes .lobby-title .t2 {
  color: #7a4a18;
}
#screen-modes .lobby-tagline,
#screen-online .lobby-tagline,
#screen-info .lobby-tagline,
#screen-settings .lobby-tagline,
#screen-themes .lobby-tagline {
  color: #8a6030;
  text-align: center;
}

/* Sub-page screens — SAME background as lobby, no dark overlay */
#screen-modes,
#screen-online,
#screen-info,
#screen-settings,
#screen-themes {
  background:
    url("../../images/lobby-bg.jpg") center/cover no-repeat,
    #f2ead8;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
#screen-online {
  overflow: visible;
}
/* No dark scrim — same lobby look */
#screen-modes::before,
#screen-online::before,
#screen-info::before,
#screen-settings::before,
#screen-themes::before {
  display: none !important;
}
#screen-modes .subpage-layout,
#screen-online .subpage-layout,
#screen-info .subpage-layout,
#screen-settings .subpage-layout,
#screen-themes .subpage-layout {
  position: relative;
  z-index: 1;
}
#screen-modes .subpage-back-bar,
#screen-online .subpage-back-bar,
#screen-info .subpage-back-bar,
#screen-settings .subpage-back-bar,
#screen-themes .subpage-back-bar {
  position: fixed;
  z-index: 20;
}

/* Transparent card style for themes page — matches lobby background */
.themes-card-transparent {
  background: rgba(255, 248, 235, 0.18) !important;
  border-color: rgba(160, 100, 40, 0.18) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}
.themes-card-transparent .settings-card-title,
.themes-card-transparent .settings-section-label {
  color: #7a5030;
}
.themes-card-transparent .settings-footer {
  color: rgba(100, 60, 20, 0.5);
}
.themes-card-transparent .themes-color-label {
  color: #7a5030;
}
.themes-card-transparent .color-hex {
  color: #5a3010;
  border-color: rgba(160, 100, 40, 0.3);
  background: rgba(255, 248, 235, 0.4);
}

/* PAGE TRANSITION ANIMATION — slides up from below */

/* ════════════════════════════════════════════════════════════
   SUBPAGE LOBBY LAYOUT — Info, Settings, Themes
════════════════════════════════════════════════════════════ */
/* Content area scrolls between logo and bottom buttons */
.subpage-content-area {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 110, 50, 0.3) transparent;
}
.subpage-content-area::-webkit-scrollbar {
  width: 4px;
}
.subpage-content-area::-webkit-scrollbar-track {
  background: transparent;
}
.subpage-content-area::-webkit-scrollbar-thumb {
  background: rgba(160, 110, 50, 0.3);
  border-radius: 2px;
}

/* Cards inside subpage content — transparent backgrounds */
#screen-info .info-card,
#screen-settings .settings-card,
#screen-themes .settings-card,
#rw-overlay.ctx-lb .info-card,
#rw-overlay.ctx-gm .info-card {
  width: 100%;
  max-width: 520px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Active/current page button highlight */
.lobby-icon-btn.subpage-active-btn {
  background: rgba(160, 100, 30, 0.22);
  border-color: #c87840;
  color: #8a4a10;
  box-shadow: 0 0 0 2px rgba(200, 120, 64, 0.18);
}
#screen-info .lobby-icon-btn.subpage-active-btn,
#screen-settings .lobby-icon-btn.subpage-active-btn,
#screen-themes .lobby-icon-btn.subpage-active-btn {
  background: rgba(200, 120, 64, 0.22);
  border-color: #c87840;
  color: #5a2e08;
}

/* Inline back link at very bottom */
.subpage-back-inline {
  font-family: Georgia, serif;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a5030;
  background: rgba(255, 248, 235, 0.6);
  border: 1px solid rgba(160, 100, 30, 0.28);
  border-radius: 20px;
  cursor: pointer;
  padding: 7px 20px 7px 16px;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.subpage-back-inline::before {
  content: "←";
  font-size: 0.7rem;
  line-height: 1;
}
.subpage-back-inline:hover {
  color: #3a1a06;
  background: rgba(255, 240, 210, 0.9);
  border-color: #c87840;
  transform: translateX(-2px);
}

/* ── Image-based icon buttons ── */
.lobby-icon-btn.lobby-icon-btn-img {
  width: auto !important;
  height: auto !important;
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: transparent !important;
}
.lobby-icon-btn.lobby-icon-btn-img:hover {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  transform: scale(1.12);
}
.lobby-icon-btn.lobby-icon-btn-img.subpage-active-btn {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  filter: drop-shadow(0 0 8px rgba(200, 120, 64, 0.8));
}
.lobby-icon-img {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
}
#screen-start .lobby-bottom-row-icons .lobby-icon-img {
  width: 80px;
  height: 80px;
}
/* Back button image style */
.subpage-back-inline.lobby-icon-btn-img {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  font-size: 0 !important;
  letter-spacing: 0 !important;
  gap: 0 !important;
  box-shadow: none !important;
  color: transparent !important;
  display: block !important;
  cursor: pointer;
}
.subpage-back-inline.lobby-icon-btn-img::before {
  content: none !important;
  display: none !important;
}
.subpage-back-inline.lobby-icon-btn-img:hover {
  background: none !important;
  border: none !important;
  transform: scale(1.12);
}
.subpage-back-inline.lobby-icon-btn-img .lobby-icon-img {
  display: block !important;
  width: 58px !important;
  height: 58px !important;
}

/* ── Subpage side-panel button positioning ──
   Back button → vertically centered left side
   Icons (themes/info/settings) → vertically centered right side
   Hidden on #screen-start (lobby has its own bottom icons)
*/
#screen-modes .lobby-bottom-section,
#screen-online .lobby-bottom-section,
#screen-info .lobby-bottom-section,
#screen-settings .lobby-bottom-section,
#screen-themes .lobby-bottom-section {
  display: none !important;
}

/* Hide side panels by default — only shown on subpages */
.subpage-btn-left,
.subpage-btn-right {
  display: none;
}

/* Show side panels only on subpage screens */
#screen-modes .subpage-btn-left,
#screen-modes .subpage-btn-right,
#screen-online .subpage-btn-left,
#screen-online .subpage-btn-right,
#screen-info .subpage-btn-left,
#screen-info .subpage-btn-right,
#screen-settings .subpage-btn-left,
#screen-settings .subpage-btn-right,
#screen-themes .subpage-btn-left,
#screen-themes .subpage-btn-right {
  display: flex;
  z-index: 9999;
}

/* Left panel: back button — top-left corner, single column */
.subpage-btn-left {
  position: absolute;
  top: 16px;
  left: 16px;
  transform: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9999;
}

/* Right panel: themes / info / settings — stacked below back button, same column */
.subpage-btn-right {
  position: absolute;
  top: 90px;
  left: 16px;
  transform: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9999;
}

@media (max-width: 600px) {
  .subpage-btn-left {
    left: 4px;
    top: 8px;
  }
  .subpage-btn-right {
    left: 4px;
    top: 62px;
  }
  .subpage-btn-left .lobby-icon-img,
  .subpage-btn-right .lobby-icon-img {
    width: 44px !important;
    height: 44px !important;
  }
}

/* Screen overrides for modes */
#screen-modes {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#screen-modes .lobby-layout {
  max-width: 960px;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
#screen-modes .lobby-center {
  width: 100%;
  max-width: 960px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  gap: 0;
  overflow: hidden;
}
#screen-modes .subpage-content-area {
  justify-content: center;
}
#screen-modes .lobby-logo-frame {
  border-color: rgba(160, 100, 30, 0.55);
  box-shadow:
    0 0 0 1px rgba(160, 100, 30, 0.18),
    inset 0 0 20px rgba(200, 140, 60, 0.08);
}
#screen-modes .lobby-logo-corner {
  color: rgba(160, 100, 30, 0.8);
}
#screen-modes .lobby-title .t1 {
  color: #c8853a;
  text-shadow:
    0 2px 12px rgba(180, 110, 30, 0.2),
    0 1px 3px rgba(120, 70, 0, 0.15);
}
#screen-modes .lobby-title .t2 {
  color: #7a4a18;
}
#screen-modes .lobby-eyebrow {
  color: #b07838;
}
#screen-modes .lobby-eyebrow::before {
  background: linear-gradient(90deg, transparent, #b07838);
}
#screen-modes .lobby-eyebrow::after {
  background: linear-gradient(90deg, #b07838, transparent);
}
#screen-modes .lobby-logo-accent {
  color: #b07838;
}
#screen-modes .lobby-icon-btn {
  background: rgba(255, 248, 235, 0.55);
  border-color: rgba(160, 110, 50, 0.2);
  color: #7a5030;
}
#screen-modes .lobby-icon-btn:hover {
  border-color: #c87840;
  color: #5a2e08;
}

/* Subpage info-card and settings-card: fill content area cleanly */
#screen-info .info-card,
#screen-settings .settings-card,
#screen-themes .settings-card,
#rw-overlay.ctx-lb .info-card,
#rw-overlay.ctx-gm .info-card {
  width: 100%;
  max-width: 520px;
}

/* Screen-start overrides for the new subpage screens sharing lobby-layout */
#screen-info,
#screen-settings,
#screen-themes {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#screen-info .lobby-layout,
#screen-settings .lobby-layout,
#screen-themes .lobby-layout,
#rw-overlay.ctx-lb .lobby-layout,
#rw-overlay.ctx-gm .lobby-layout {
  max-width: 560px;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
#screen-info .lobby-center,
#screen-settings .lobby-center,
#screen-themes .lobby-center,
#rw-overlay.ctx-lb .lobby-center,
#rw-overlay.ctx-gm .lobby-center {
  width: 100%;
  max-width: 560px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  gap: 0;
}
#screen-info .lobby-logo-frame,
#screen-settings .lobby-logo-frame,
#screen-themes .lobby-logo-frame {
  border-color: rgba(160, 100, 30, 0.55);
  box-shadow:
    0 0 0 1px rgba(160, 100, 30, 0.18),
    inset 0 0 20px rgba(200, 140, 60, 0.08);
}
#screen-info .lobby-logo-corner,
#screen-settings .lobby-logo-corner,
#screen-themes .lobby-logo-corner {
  color: rgba(160, 100, 30, 0.8);
}
#screen-info .lobby-title .t1,
#screen-settings .lobby-title .t1,
#screen-themes .lobby-title .t1 {
  color: #c8853a;
  text-shadow:
    0 2px 12px rgba(180, 110, 30, 0.2),
    0 1px 3px rgba(120, 70, 0, 0.15);
}
#screen-info .lobby-title .t2,
#screen-settings .lobby-title .t2,
#screen-themes .lobby-title .t2 {
  color: #7a4a18;
}
#screen-info .lobby-eyebrow,
#screen-settings .lobby-eyebrow,
#screen-themes .lobby-eyebrow {
  color: #b07838;
}
#screen-info .lobby-eyebrow::before,
#screen-info .lobby-eyebrow::after,
#screen-settings .lobby-eyebrow::before,
#screen-settings .lobby-eyebrow::after,
#screen-themes .lobby-eyebrow::before,
#screen-themes .lobby-eyebrow::after {
  background: linear-gradient(90deg, transparent, #b07838);
}
#screen-info .lobby-eyebrow::after,
#screen-settings .lobby-eyebrow::after,
#screen-themes .lobby-eyebrow::after {
  background: linear-gradient(90deg, #b07838, transparent);
}
#screen-info .lobby-logo-accent,
#screen-settings .lobby-logo-accent,
#screen-themes .lobby-logo-accent {
  color: #b07838;
}
#screen-info .lobby-icon-btn,
#screen-settings .lobby-icon-btn,
#screen-themes .lobby-icon-btn {
  background: rgba(255, 248, 235, 0.55);
  border-color: rgba(160, 110, 50, 0.2);
  color: #7a5030;
}
#screen-info .lobby-icon-btn:hover,
#screen-settings .lobby-icon-btn:hover,
#screen-themes .lobby-icon-btn:hover {
  border-color: #c87840;
  color: #5a2e08;
}

/* ════════════════════════════════════════════════════════════
   MODE SELECT SCREEN  — bento-grid card layout
════════════════════════════════════════════════════════════ */
.modes-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 28px 32px;
  background: transparent;
  border: 1px solid rgba(160, 110, 50, 0.18);
  border-radius: 16px;
  box-shadow: none;
  width: 100%;
  max-width: 700px;
}
#screen-modes .lobby-logo-corner {
  color: rgba(160, 100, 30, 0.5);
}

.modes-page-label {
  font-family: Georgia, serif;
  font-size: 0.48rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: #9a6830;
  text-align: center;
  margin-bottom: 20px;
  padding: 4px 14px;
  border: 1px solid rgba(154, 104, 48, 0.28);
  border-radius: 20px;
  background: rgba(255, 253, 246, 0.7);
  display: inline-block;
}

/* Bento grid: 3 equal cards */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

/* Each card — bento card style */
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  background: rgba(255, 248, 235, 0.45);
  border: 1px solid rgba(160, 110, 50, 0.22);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: 0 2px 10px rgba(60, 35, 12, 0.08);
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s,
    border-color 0.2s;
  overflow: hidden;
}
.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(60, 35, 12, 0.16);
  border-color: #c87840;
  background: rgba(255, 248, 235, 0.65);
}
.mode-card-active {
  transform: translateY(-4px);
  box-shadow:
    0 8px 28px rgba(60, 35, 12, 0.18),
    0 0 0 2px #c87840;
  border-color: #c87840;
  background: rgba(255, 248, 235, 0.65);
}

/* Illustration / icon area at top of card */
.mode-card-medallion-wrap {
  width: 100%;
  height: 110px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 232, 212, 0.45);
  border-bottom: 1px solid rgba(160, 110, 50, 0.18);
  overflow: hidden;
}
.mode-card:hover .mode-card-medallion-wrap,
.mode-card-active .mode-card-medallion-wrap {
  background: rgba(245, 232, 200, 0.55);
}

/* Chess piece glyphs around illustration area */
.mode-card-motifs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.18;
}
.mode-card-motif-glyph {
  font-family: Georgia, serif;
  font-size: 22px;
  fill: #c8853a;
}

/* Icon circle in illustration area */
.mode-card-icon-core {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at 35% 30%,
    #5a3018 0%,
    #3d1e0a 60%,
    #251004 100%
  );
  box-shadow:
    0 0 0 4px rgba(200, 120, 64, 0.18),
    0 4px 14px rgba(20, 8, 2, 0.35);
  color: #e8a060;
}

/* Text area below illustration */
.mode-card-label {
  font-family: Georgia, serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: #3a1e08;
  letter-spacing: 0.03em;
  padding: 14px 14px 4px;
  line-height: 1.2;
}
.mode-card-desc {
  font-size: 0.55rem;
  color: #7a5030;
  line-height: 1.6;
  padding: 0 14px 10px;
}
.mode-card-tag {
  font-size: 0.41rem;
  letter-spacing: 0.18em;
  color: #9a6830;
  text-transform: uppercase;
  padding: 3px 10px 3px 14px;
  margin-bottom: 14px;
  display: inline-block;
}
.mode-card-active .mode-card-tag {
  color: #6a3a10;
}

/* ── Difficulty row — bento card style ── */
.modes-cards-view.hidden {
  display: none;
}

/* ── Image-based modes page ── */
.modes-cards-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}
.modes-strategy-banner {
  width: clamp(260px, 50vw, 520px);
  height: auto;
  display: block;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 4px 16px rgba(60, 30, 8, 0.3));
}
.modes-img-grid {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(6px, 1.5vw, 20px);
  width: 100%;
  flex-wrap: nowrap;
  overflow: hidden;
}
.mode-img-card {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.2s;
  flex: 0 0 auto;
}
.mode-img-card:hover {
  transform: translateY(-10px) scale(1.06);
  filter: drop-shadow(0 12px 28px rgba(60, 30, 8, 0.35));
}
.mode-img-card:active {
  transform: translateY(-4px) scale(1.02);
}
.mode-img {
  display: block;
  width: clamp(110px, 16vw, 220px);
  height: auto;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 6px 18px rgba(60, 30, 8, 0.28));
}
/* Responsive: on very small screens reduce card size further */
@media (max-width: 480px) {
  .mode-img {
    width: clamp(80px, 26vw, 130px);
  }
  .modes-img-grid {
    gap: clamp(4px, 2vw, 12px);
  }
  .modes-strategy-banner {
    width: clamp(200px, 70vw, 320px);
  }
}
@media (max-width: 360px) {
  .mode-img {
    width: clamp(70px, 27vw, 110px);
  }
  .modes-img-grid {
    gap: 4px;
  }
}
.modes-inline-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 700px;
  gap: 0;
}
.modes-inline-panel.hidden {
  display: none;
}

.modes-diff-row {
  display: none;
}
.modes-diff-row.hidden {
  display: none;
}

.modes-diff-content {
  padding: 10px 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

/* SELECT DIFFICULTY banner image */
.diff-banner-img {
  width: 55%;
  max-width: 320px;
  max-height: 48px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
  object-fit: contain;
}

/* ── Difficulty row cards — image-based ── */
.modes-diff-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.modes-diff-row-card {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  box-shadow: none;
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.18s;
  box-sizing: border-box;
  outline: none;
}
.modes-diff-img-card {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}
.modes-diff-row-card:hover {
  transform: translateY(-3px) scale(1.01);
  filter: brightness(1.08) drop-shadow(0 6px 14px rgba(60, 35, 12, 0.25));
}
.modes-diff-row-card.active {
  filter: brightness(1.05) drop-shadow(0 0 10px rgba(200, 140, 40, 0.6));
  transform: scale(1.01);
}
.diff-row-img {
  width: 100%;
  max-height: 72px;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: contain;
}

/* ── Begin Match CTA — image-based ── */
.modes-begin-cta {
  display: block;
  width: 100%;
  padding: 0;
  margin-top: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition:
    transform 0.15s,
    filter 0.15s;
  box-sizing: border-box;
  outline: none;
}
.modes-begin-img-btn {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.begin-match-img {
  width: 100%;
  max-height: 60px;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: contain;
}
.modes-begin-cta:hover {
  transform: translateY(-3px);
  filter: brightness(1.1) drop-shadow(0 8px 18px rgba(160, 80, 16, 0.4));
}
.modes-begin-cta:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* ════════════════════════════════════════════════════════════
   ONLINE PVP SCREEN
════════════════════════════════════════════════════════════ */
.online-pvp-host {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(200, 120, 64, 0.2);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 32px;
}

/* ════════════════════════════════════════════════════════════
   INFO SCREEN
════════════════════════════════════════════════════════════ */
.info-card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 248, 235, 0.18);
  border: 1px solid rgba(160, 100, 40, 0.18);
  padding: 32px 28px 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.info-card-logo {
  text-align: center;
  margin-bottom: 4px;
}
.info-divider {
  width: 100%;
  height: 1px;
  background: rgba(160, 100, 40, 0.2);
  margin: 18px 0;
}
.info-section-label {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: #9a5520;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.info-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.info-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: #4a3820;
  line-height: 1.6;
}
.info-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.info-step-icon-play {
  background: rgba(80, 180, 100, 0.18);
  color: #2a9048;
}
.info-step-icon-board {
  background: rgba(200, 120, 64, 0.15);
  color: #b07028;
}
.info-step-icon-star {
  background: rgba(200, 150, 20, 0.15);
  color: #a07018;
}
.info-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.info-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #5a4028;
}
.info-key {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(160, 100, 40, 0.1);
  border: 1px solid rgba(160, 100, 40, 0.3);
  border-radius: 2px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: #8a4a18;
  white-space: nowrap;
  flex-shrink: 0;
}
.info-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  color: #8a6840;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ════════════════════════════════════════════════════════════
   SETTINGS SCREEN
════════════════════════════════════════════════════════════ */
.settings-card {
  width: 100%;
  max-width: 520px;
  background: rgba(255, 248, 235, 0.18);
  border: 1px solid rgba(160, 100, 40, 0.18);
  padding: 24px 24px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-card-title {
  font-size: 0.76rem;
  letter-spacing: 0.28em;
  color: var(--copper);
  text-transform: uppercase;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(200, 120, 64, 0.14);
  margin-bottom: 14px;
}
.settings-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  color: var(--brand-dim);
  text-transform: uppercase;
  margin: 14px 0 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  gap: 16px;
}
.settings-row-info {
  flex: 1;
}
.settings-row-name {
  font-size: 0.96rem;
  color: var(--text);
  font-weight: 600;
}
.settings-row-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.settings-toggle {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.settings-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #666;
  transition:
    transform 0.2s,
    background 0.2s;
}
.settings-toggle.on {
  background: rgba(200, 120, 64, 0.4);
  border-color: rgba(200, 120, 64, 0.6);
}
.settings-toggle.on::after {
  transform: translateX(16px);
  background: var(--copper-lt);
}
.settings-vol-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.settings-vol-slider {
  width: 90px;
  accent-color: var(--copper);
  cursor: pointer;
}
.settings-vol-val {
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 3em;
  text-align: right;
}
.settings-segmented {
  display: flex;
  gap: 0;
  border: 1px solid rgba(200, 120, 64, 0.2);
  overflow: hidden;
}
.settings-seg {
  flex: 1;
  padding: 0.5em 0.4em;
  background: transparent;
  border: none;
  border-right: 1px solid rgba(200, 120, 64, 0.15);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.18s;
}
.settings-seg:last-child {
  border-right: none;
}
.settings-seg.active {
  background: rgba(200, 120, 64, 0.16);
  color: var(--copper-lt);
}
.settings-seg:hover:not(.active) {
  background: rgba(200, 120, 64, 0.06);
  color: var(--text);
}
.settings-seg-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 5px 0 0;
}
.settings-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.46rem;
  letter-spacing: 0.24em;
  color: var(--text-muted);
  text-transform: uppercase;
  opacity: 0.5;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.settings-theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.settings-theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px;
  border: 1px solid rgba(200, 120, 64, 0.12);
  transition: all 0.18s;
}
.settings-theme-swatch:hover,
.settings-theme-swatch.sts-active {
  border-color: var(--copper);
  background: rgba(200, 120, 64, 0.06);
}
.sts-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: 36px;
  height: 36px;
}
.sts-board div {
  width: 100%;
  height: 100%;
}
.sts-name {
  font-size: 0.46rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════════
   THEMES SCREEN
════════════════════════════════════════════════════════════ */
.themes-full-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}
.theme-full-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  cursor: pointer;
  border: 1px solid rgba(200, 120, 64, 0.14);
  overflow: hidden;
  transition: all 0.18s;
}
.theme-full-swatch:hover,
.tfs-active {
  border-color: var(--copper) !important;
  box-shadow: 0 0 12px rgba(200, 120, 64, 0.2);
}
.tfs-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  aspect-ratio: 1;
}
.tfs-board div {
  width: 100%;
  height: 100%;
}
.tfs-name {
  width: 100%;
  text-align: center;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 2px;
}
.themes-custom-preview {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 8/1;
  margin-bottom: 10px;
  border: 1px solid rgba(200, 120, 64, 0.12);
}
.themes-custom-preview div {
  width: 100%;
  height: 100%;
}
.themes-color-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.themes-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.themes-color-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  flex: 1;
  letter-spacing: 0.06em;
}
.themes-btns {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   ONLINE SCREEN — lobby-layout match + stacked action cards
═══════════════════════════════════════════════════════ */
#screen-online {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  overflow: visible;
}
#screen-online .subpage-btn-left,
#screen-online .subpage-btn-right {
  display: flex !important;
  z-index: 9999 !important;
  position: absolute !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: all !important;
}
#screen-online .lobby-layout {
  max-width: 560px;
  width: 100%;
  height: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
#screen-online .lobby-center {
  width: 100%;
  max-width: 560px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  gap: 0;
}
#screen-online .lobby-logo-frame {
  border-color: rgba(160, 100, 30, 0.55);
  box-shadow:
    0 0 0 1px rgba(160, 100, 30, 0.18),
    inset 0 0 20px rgba(200, 140, 60, 0.08);
}
#screen-online .lobby-logo-corner {
  color: rgba(160, 100, 30, 0.8);
}
#screen-online .lobby-title .t1 {
  color: #c8853a;
  text-shadow:
    0 2px 12px rgba(180, 110, 30, 0.2),
    0 1px 3px rgba(120, 70, 0, 0.15);
}
#screen-online .lobby-title .t2 {
  color: #7a4a18;
}
#screen-online .lobby-eyebrow {
  color: #b07838;
}
#screen-online .lobby-eyebrow::before {
  background: linear-gradient(90deg, transparent, #b07838);
}
#screen-online .lobby-eyebrow::after {
  background: linear-gradient(90deg, #b07838, transparent);
}
#screen-online .lobby-logo-accent {
  color: #b07838;
}
#screen-online .lobby-icon-btn {
  background: rgba(255, 248, 235, 0.55);
  border-color: rgba(160, 110, 50, 0.2);
  color: #7a5030;
}
#screen-online .lobby-icon-btn:hover {
  border-color: #c87840;
  color: #5a2e08;
}
#screen-online .subpage-content-area {
  justify-content: center;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* Name row — medieval parchment style */
.online-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background:
    linear-gradient(135deg, rgba(101, 67, 33, 0.18) 0%, transparent 60%),
    linear-gradient(to bottom, #e8d9b8, #d4b98a);
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, #b8902a, #8a6010, #c8a040, #7a5010) 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 100, 0.35),
    inset 0 -1px 0 rgba(80, 40, 0, 0.25),
    0 3px 12px rgba(60, 30, 0, 0.22),
    0 1px 3px rgba(60, 30, 0, 0.15);
  border-radius: 0;
  padding: 8px 14px;
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}
/* Corner ornaments via pseudo-elements */
.online-name-row::before,
.online-name-row::after {
  content: "✦";
  position: absolute;
  color: #b8902a;
  font-size: 0.6rem;
  opacity: 0.7;
}
.online-name-row::before {
  top: 4px;
  left: 6px;
}
.online-name-row::after {
  top: 4px;
  right: 6px;
}

.online-name-lbl {
  font-family: Georgia, serif;
  font-size: 0.48rem;
  letter-spacing: 0.22em;
  color: #7a5010;
  text-transform: uppercase;
  flex-shrink: 0;
  text-shadow: 0 1px 0 rgba(255, 220, 100, 0.4);
}
.online-name-val {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #3a1a06;
  flex: 1;
  text-shadow: 0 1px 0 rgba(255, 200, 80, 0.3);
}
.online-name-edit {
  background: linear-gradient(to bottom, #c8a040, #8a6010);
  border: 1px solid #6a4008;
  border-radius: 3px;
  color: #f5e8c0;
  cursor: pointer;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-family: Georgia, serif;
  letter-spacing: 0.05em;
  box-shadow:
    0 2px 5px rgba(60, 30, 0, 0.3),
    inset 0 1px 0 rgba(255, 220, 100, 0.3);
  transition: all 0.2s;
}
.online-name-edit:hover {
  background: linear-gradient(to bottom, #d8b050, #9a7020);
  box-shadow:
    0 3px 8px rgba(60, 30, 0, 0.4),
    inset 0 1px 0 rgba(255, 230, 120, 0.4);
  color: #fff8e0;
}

/* Stacked action cards list */
.online-cards-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.online-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 248, 235, 0.45);
  border: 1px solid rgba(160, 110, 50, 0.22);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  box-shadow: none;
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.18s,
    border-color 0.18s;
}
.online-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(60, 35, 12, 0.12);
  border-color: #c87840;
  background: rgba(255, 248, 235, 0.65);
}
.oac-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 244, 236, 0.9);
  flex-shrink: 0;
}
.oac-text {
  flex: 1;
  min-width: 0;
}
.oac-label {
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.oac-desc {
  font-size: 0.54rem;
  color: #7a5030;
  line-height: 1.5;
}
.oac-tag {
  font-size: 0.4rem;
  letter-spacing: 0.16em;
  color: #9a6830;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid rgba(160, 100, 30, 0.2);
  border-radius: 20px;
  background: rgba(200, 120, 64, 0.06);
  flex-shrink: 0;
  white-space: nowrap;
}
.oac-arrow {
  color: #c8a870;
  flex-shrink: 0;
}

/* Panel box — transparent, no border */
.online-panel-box {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px 0;
  box-sizing: border-box;
}

/* Image-based action card */
.online-action-card-img {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  display: block;
  width: 100%;
}
.online-action-card-img:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 8px 28px rgba(60, 35, 12, 0.18) !important;
  border: none !important;
  background: transparent !important;
}
.online-card-img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* Card icon colors — unified warm brown scheme */
.online-icon-qm {
  color: #c87840;
}
.online-icon-create {
  color: #c87840;
}
.online-icon-join {
  color: #c87840;
}
.online-lbl-qm {
  color: #3a1a06;
}
.online-lbl-create {
  color: #3a1a06;
}
.online-lbl-join {
  color: #3a1a06;
}

.online-footer {
  font-family: Georgia, serif;
  font-size: 0.52rem;
  color: rgba(107, 68, 35, 0.4);
  letter-spacing: 0.08em;
  margin-top: 12px;
  text-align: center;
}

body.light-mode .online-name-row {
  background: rgba(255, 253, 246, 0.7);
  border-color: rgba(107, 68, 35, 0.2);
}

/* ═══════════════════════════════════════════════════════
   ONLINE PVP OVERLAY — cream lobby-matching full-screen modal
   Every element inside is restyled to match the parchment theme.
═══════════════════════════════════════════════════════ */
#online-pvp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(242, 234, 216, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}
#online-pvp-overlay.online-pvp-overlay--open {
  display: flex;
}

/* ── Panel shell ── */
#online-pvp-overlay .pvp__panel {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: all !important;
  width: 400px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 22px !important;
  background: rgba(255, 253, 246, 0.98) !important;
  border: 1.5px solid rgba(107, 68, 35, 0.2) !important;
  box-shadow:
    0 8px 0 rgba(201, 162, 39, 0.18),
    0 24px 72px rgba(60, 35, 12, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  font-family: Georgia, serif;
}

/* ── Header hidden (back/close handled by overlay click) ── */
#online-pvp-overlay .pvp__hdr {
  display: none !important;
}

/* ── Section padding ── */
#online-pvp-overlay .pvp__s {
  padding: 24px 22px;
}

/* ── Tagline ── */
#online-pvp-overlay .pvp__tagline {
  color: #8a6030 !important;
  font-style: italic;
  text-align: center;
}

/* ── Footer ── */
#online-pvp-overlay .pvp__foot {
  color: rgba(107, 68, 35, 0.38) !important;
  border-top-color: rgba(107, 68, 35, 0.1) !important;
  text-align: center;
}

/* ── Name row ── */
#online-pvp-overlay .pvp__name-row {
  background: rgba(255, 253, 246, 0.6) !important;
  border: 1px solid rgba(107, 68, 35, 0.18) !important;
}
#online-pvp-overlay .pvp__name-lbl {
  color: #9a6830 !important;
}
#online-pvp-overlay .pvp__name-val {
  color: #6b4423 !important;
  font-weight: 700;
}
#online-pvp-overlay .pvp__name-edit {
  border-color: rgba(107, 68, 35, 0.22) !important;
  color: #9a6830 !important;
  background: transparent !important;
}
#online-pvp-overlay .pvp__name-edit:hover {
  color: #6b4423 !important;
  border-color: #6b4423 !important;
}
#online-pvp-overlay .pvp__name-in {
  background: rgba(255, 253, 246, 0.7) !important;
  border-color: rgba(107, 68, 35, 0.22) !important;
  color: #3a2510 !important;
}
#online-pvp-overlay .pvp__name-in:focus {
  border-color: #9a6830 !important;
  box-shadow: 0 0 0 3px rgba(154, 104, 48, 0.12) !important;
}
#online-pvp-overlay .pvp__name-hint {
  color: #9a7050 !important;
}
#online-pvp-overlay .pvp__jlbl {
  color: #7a5a30 !important;
  letter-spacing: 0.18em;
}

/* ── Buttons — Quick Match (shimmer/gold) ── */
#online-pvp-overlay .pvp__btn-q {
  background: rgba(201, 162, 39, 0.08) !important;
  border-color: rgba(201, 162, 39, 0.55) !important;
  color: #7a5010 !important;
}
#online-pvp-overlay .pvp__btn-q::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(201, 162, 39, 0.1),
    transparent
  ) !important;
}
#online-pvp-overlay .pvp__btn-q:hover {
  background: rgba(201, 162, 39, 0.16) !important;
  box-shadow: 0 0 14px rgba(201, 162, 39, 0.22) !important;
}

/* ── Buttons — Primary (amber) ── */
#online-pvp-overlay .pvp__btn-p {
  background: rgba(107, 68, 35, 0.08) !important;
  border-color: #9a6830 !important;
  color: #6b4423 !important;
}
#online-pvp-overlay .pvp__btn-p:hover {
  background: rgba(107, 68, 35, 0.15) !important;
}

/* ── Buttons — Secondary ── */
#online-pvp-overlay .pvp__btn-s {
  background: transparent !important;
  border-color: rgba(107, 68, 35, 0.28) !important;
  color: #5a3a18 !important;
}
#online-pvp-overlay .pvp__btn-s:hover {
  border-color: #9a6830 !important;
  color: #6b4423 !important;
}

/* ── Buttons — Ghost ── */
#online-pvp-overlay .pvp__btn-g {
  background: transparent !important;
  border-color: rgba(107, 68, 35, 0.15) !important;
  color: rgba(107, 68, 35, 0.45) !important;
  justify-content: center;
}
#online-pvp-overlay .pvp__btn-g:hover {
  border-color: rgba(107, 68, 35, 0.38) !important;
  color: #6b4423 !important;
}

/* ── Buttons — Danger ── */
#online-pvp-overlay .pvp__btn-d {
  background: rgba(160, 48, 48, 0.07) !important;
  border-color: rgba(160, 48, 48, 0.35) !important;
  color: #a03030 !important;
}
#online-pvp-overlay .pvp__btn-d:hover {
  border-color: #a03030 !important;
  box-shadow: 0 0 10px rgba(160, 48, 48, 0.18) !important;
}

/* ── Waiting spinner ── */
#online-pvp-overlay .pvp__spin {
  border-color: rgba(107, 68, 35, 0.14) !important;
  border-top-color: #9a6830 !important;
}
#online-pvp-overlay .pvp__spin-wrap p {
  color: #9a7050 !important;
}

/* ── Room code card ── */
#online-pvp-overlay .pvp__code-card {
  background: rgba(255, 253, 246, 0.55) !important;
  border-color: rgba(107, 68, 35, 0.16) !important;
}
#online-pvp-overlay .pvp__code-lbl {
  color: #9a7050 !important;
}
#online-pvp-overlay .pvp__code {
  color: #6b4423 !important;
  text-shadow: 0 1px 8px rgba(107, 68, 35, 0.18) !important;
}
#online-pvp-overlay .pvp__code-hint {
  color: #9a7050 !important;
}
#online-pvp-overlay .pvp__copy {
  border-color: rgba(107, 68, 35, 0.22) !important;
  color: #9a6830 !important;
  background: transparent !important;
}
#online-pvp-overlay .pvp__copy:hover {
  border-color: #6b4423 !important;
  color: #6b4423 !important;
}

/* ── Join code inputs ── */
#online-pvp-overlay .pvp__c {
  background: rgba(255, 253, 246, 0.7) !important;
  border-color: rgba(107, 68, 35, 0.22) !important;
  color: #6b4423 !important;
}
#online-pvp-overlay .pvp__c:focus {
  border-color: #9a6830 !important;
  box-shadow: 0 0 8px rgba(154, 104, 48, 0.18) !important;
}
#online-pvp-overlay .pvp__csep {
  color: rgba(107, 68, 35, 0.3) !important;
}
#online-pvp-overlay .pvp__jerr {
  color: #a03030 !important;
}

/* ── Quick match animation ── */
#online-pvp-overlay .pvp__qm-ring {
  border-color: rgba(201, 162, 39, 0.35) !important;
}
#online-pvp-overlay .pvp__qm-icon {
  background: rgba(201, 162, 39, 0.1) !important;
  border-color: rgba(201, 162, 39, 0.48) !important;
  color: #7a5010 !important;
}
#online-pvp-overlay .pvp__qm-status {
  color: #7a5010 !important;
}
#online-pvp-overlay .pvp__qm-sub {
  color: #9a7050 !important;
}
#online-pvp-overlay [data-state="found"] .pvp__qm-ring {
  border-color: rgba(60, 140, 80, 0.4) !important;
}
#online-pvp-overlay [data-state="found"] .pvp__qm-icon {
  border-color: rgba(60, 140, 80, 0.6) !important;
  color: #2e7a48 !important;
  background: rgba(60, 140, 80, 0.08) !important;
}
#online-pvp-overlay [data-state="found"] .pvp__qm-status {
  color: #2e7a48 !important;
}

/* ── Connected pill ── */
#online-pvp-overlay .pvp__conn-pill {
  background: rgba(60, 140, 80, 0.07) !important;
  border-color: rgba(60, 140, 80, 0.22) !important;
  color: #2e7a48 !important;
}
#online-pvp-overlay .pvp__gdot {
  background: #2e7a48 !important;
  box-shadow: 0 0 6px #2e7a48 !important;
}

/* ── Players lobby ── */
#online-pvp-overlay .pvp__pl {
  background: rgba(255, 253, 246, 0.55) !important;
  border-color: rgba(107, 68, 35, 0.12) !important;
}
#online-pvp-overlay .pvp__pl-y {
  border-color: rgba(107, 68, 35, 0.3) !important;
}
#online-pvp-overlay .pvp__av-y {
  background: rgba(107, 68, 35, 0.1) !important;
  border-color: #9a6830 !important;
  color: #6b4423 !important;
}
#online-pvp-overlay .pvp__av-o {
  background: rgba(107, 68, 35, 0.04) !important;
  border-color: rgba(107, 68, 35, 0.22) !important;
  color: rgba(107, 68, 35, 0.5) !important;
}
#online-pvp-overlay .pvp__pn {
  color: #5a3a18 !important;
}
#online-pvp-overlay .pvp__pr {
  color: #9a7050 !important;
}
#online-pvp-overlay .pvp__pr b {
  color: #6b4423 !important;
}
#online-pvp-overlay .pvp__vs {
  color: rgba(107, 68, 35, 0.28) !important;
}

/* ── Result screen ── */
#online-pvp-overlay .pvp__rico {
  color: #9a6830 !important;
}
#online-pvp-overlay .pvp__rtitle {
  color: #3a2510 !important;
}
#online-pvp-overlay .pvp__rsub {
  color: #9a7050 !important;
}

/* ── Disconnected screen ── */
#online-pvp-overlay .pvp__dcico {
  color: rgba(107, 68, 35, 0.28) !important;
}
#online-pvp-overlay .pvp__dctitle {
  color: #3a2510 !important;
}
#online-pvp-overlay .pvp__dcmsg {
  color: #9a7050 !important;
}

/* ── Notifications ── */
#online-pvp-overlay .pvp__notif {
  background: rgba(255, 253, 246, 0.95) !important;
  border-top-color: rgba(107, 68, 35, 0.1) !important;
  color: #7a5010 !important;
}
#online-pvp-overlay .pvp__notif--success {
  color: #2e7a48 !important;
}
#online-pvp-overlay .pvp__notif--error {
  color: #a03030 !important;
}
#online-pvp-overlay .pvp__notif--warn {
  color: #9a6800 !important;
}
#online-pvp-overlay .pvp__notif--info {
  color: #7a5010 !important;
}
#online-pvp-overlay .pvp__notif--chat {
  color: #6b4423 !important;
}

/* ═══════════════════════════════════════════════════════
   ONLINE INLINE PANEL — replaces popup overlay
═══════════════════════════════════════════════════════ */
.online-cards-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
}
.online-cards-view.hidden {
  display: none;
}
.online-inline-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 0;
}
.online-inline-panel.hidden {
  display: none;
}

.oip-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  position: relative;
}
.oip-topbar .oip-minimize-btn {
  position: absolute;
  left: 0;
}
.oip-minimize-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 248, 235, 0.7);
  border: 1px solid rgba(160, 100, 30, 0.28);
  border-radius: 20px;
  color: #7a5030;
  font-family: Georgia, serif;
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  transition: all 0.18s;
}
.oip-minimize-btn:hover {
  background: rgba(255, 240, 210, 0.9);
  border-color: #c87840;
  color: #3a1a06;
  transform: translateX(-2px);
}
/* Image-based back button */
.oip-minimize-img-btn {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  transition:
    transform 0.18s,
    filter 0.18s;
}
.oip-minimize-img-btn:hover {
  transform: translateX(-3px) scale(1.06);
  filter: brightness(1.15);
  background: none !important;
  border: none !important;
}
.oip-back-img {
  height: 36px;
  width: auto;
  display: block;
  pointer-events: none;
}
/* Back button placed at bottom of panel content */
.oip-back-bottom {
  display: block;
  margin: 14px auto 0;
}
/* Image-based title */
.oip-title-img {
  height: 40px;
  width: auto;
  max-width: 260px;
  display: block;
  pointer-events: none;
  object-fit: contain;
}
.oip-title {
  font-family: Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: #5a2e08;
  letter-spacing: 0.05em;
}
.oip-title.hidden {
  display: none !important;
}

/* SELECT MODE banner image on online pvp page */
.banner-title-img {
  display: block;
  height: auto;
  pointer-events: none;
  margin: 0 auto 10px;
}
.banner-select-mode-img {
  width: 60%;
  max-width: 340px;
  max-height: 44px;
  object-fit: contain;
}
.oip-content {
  background: transparent;
  border: none;
  border-radius: 12px;
  box-shadow: none;
  overflow: hidden;
}
.oip-content .pvp__s {
  padding: 22px 20px;
  background: transparent;
}
.oip-content .pvp__s--on {
  display: block;
}
.oip-content .pvp__dn {
  display: none !important;
}
.oip-content .pvp__name-row {
  background: rgba(248, 244, 236, 0.8);
  border: 1px solid rgba(160, 110, 50, 0.18);
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.oip-content .pvp__name-lbl {
  font-size: 0.48rem;
  letter-spacing: 0.2em;
  color: #9a6830;
  text-transform: uppercase;
}
.oip-content .pvp__name-val {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #6b4423;
  flex: 1;
}
.oip-content .pvp__name-edit {
  background: none;
  border: 1px solid rgba(107, 68, 35, 0.22);
  border-radius: 4px;
  color: #9a6830;
  cursor: pointer;
  padding: 2px 7px;
  font-size: 0.82rem;
}
.oip-content .pvp__tagline {
  color: #8a6030;
  font-style: italic;
  text-align: center;
  font-size: 0.62rem;
  margin-bottom: 14px;
}
.oip-content .pvp__jlbl {
  color: #7a5a30;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}
.oip-content .pvp__foot {
  color: rgba(107, 68, 35, 0.38);
  font-size: 0.52rem;
  text-align: center;
  border-top: 1px solid rgba(107, 68, 35, 0.1);
  margin-top: 12px;
  padding-top: 12px;
}
.oip-content .pvp__name-in {
  width: 100%;
  background: rgba(255, 253, 246, 0.7);
  border: 1px solid rgba(107, 68, 35, 0.22);
  border-radius: 8px;
  color: #3a2510;
  padding: 10px 14px;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  margin-bottom: 4px;
  box-sizing: border-box;
}
.oip-content .pvp__name-in:focus {
  outline: none;
  border-color: #9a6830;
  box-shadow: 0 0 0 3px rgba(154, 104, 48, 0.12);
}
.oip-content .pvp__name-hint {
  color: #9a7050;
  font-size: 0.5rem;
  text-align: center;
  margin-bottom: 10px;
}
.oip-content .pvp__mbns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.oip-content .pvp__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid;
  transition: all 0.18s;
  text-align: left;
  box-sizing: border-box;
}

/* Medallion spinning icon for Quick Match */
.pvp__medallion-wrap {
  width: 120px;
  height: 120px;
  margin: 8px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pvp__medallion-spin {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
  animation: medallion-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes medallion-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(200, 160, 40, 0.4));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 18px rgba(200, 160, 40, 0.8));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(200, 160, 40, 0.4));
  }
}

/* Image-based banner buttons (Cancel, Connect, Join) */
.oip-content .pvp__btn-img {
  display: block;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  cursor: pointer;
  outline: none;
  transition:
    transform 0.15s,
    filter 0.15s;
  box-sizing: border-box;
}
.oip-content .pvp__btn-img:hover {
  transform: translateY(-3px) scale(1.02);
  filter: brightness(1.12) drop-shadow(0 6px 14px rgba(60, 30, 0, 0.3));
  background: none !important;
  border: none !important;
}
.oip-content .pvp__btn-img:active {
  transform: translateY(0) scale(0.98);
  filter: brightness(0.95);
}
.pvp__btn-banner-img {
  width: 100%;
  max-height: 52px;
  height: auto;
  display: block;
  pointer-events: none;
  object-fit: contain;
}
/* Waiting card and banner images */
.pvp__waiting-banner {
  width: 70%;
  max-width: 320px;
  max-height: 44px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
  object-fit: contain;
  pointer-events: none;
}
.pvp__waiting-card {
  width: 100%;
  max-width: 420px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
  object-fit: contain;
  pointer-events: none;
}
.oip-content .pvp__btn span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.oip-content .pvp__btn small {
  font-weight: 400;
  font-size: 0.55rem;
  opacity: 0.7;
}
.oip-content .pvp__full {
  width: 100%;
  justify-content: center;
}
.oip-content .pvp__mt {
  margin-top: 10px;
}
.oip-content .pvp__mt-sm {
  margin-top: 6px;
}
.oip-content .pvp__btn-q {
  background: rgba(201, 162, 39, 0.08);
  border-color: rgba(201, 162, 39, 0.55);
  color: #7a5010;
}
.oip-content .pvp__btn-q:hover {
  background: rgba(201, 162, 39, 0.16);
}
.oip-content .pvp__btn-p {
  background: rgba(107, 68, 35, 0.08);
  border-color: #9a6830;
  color: #6b4423;
}
.oip-content .pvp__btn-p:hover {
  background: rgba(107, 68, 35, 0.15);
}
.oip-content .pvp__btn-s {
  background: transparent;
  border-color: rgba(107, 68, 35, 0.28);
  color: #5a3a18;
}
.oip-content .pvp__btn-s:hover {
  border-color: #9a6830;
}
.oip-content .pvp__btn-g {
  background: transparent;
  border-color: rgba(107, 68, 35, 0.15);
  color: rgba(107, 68, 35, 0.5);
  justify-content: center;
}
.oip-content .pvp__btn-g:hover {
  border-color: rgba(107, 68, 35, 0.38);
  color: #6b4423;
}
.oip-content .pvp__btn-d {
  background: rgba(160, 48, 48, 0.07);
  border-color: rgba(160, 48, 48, 0.35);
  color: #a03030;
}
.oip-content .pvp__btn-d:hover {
  border-color: #a03030;
}
.oip-content .pvp__qm-anim {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.oip-content .pvp__qm-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 162, 39, 0.35);
  animation: pvp-pulse 2s ease-in-out infinite;
}
.oip-content .pvp__qm-ring--1 {
  width: 80px;
  height: 80px;
  animation-delay: 0s;
}
.oip-content .pvp__qm-ring--2 {
  width: 60px;
  height: 60px;
  animation-delay: 0.4s;
}
.oip-content .pvp__qm-ring--3 {
  width: 40px;
  height: 40px;
  animation-delay: 0.8s;
}
.oip-content .pvp__qm-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.1);
  border: 1.5px solid rgba(201, 162, 39, 0.48);
  color: #7a5010;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.oip-content .pvp__qm-status {
  color: #7a5010;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}
.oip-content .pvp__qm-sub {
  color: #9a7050;
  font-size: 0.55rem;
  text-align: center;
  margin-bottom: 14px;
}
.oip-content .pvp__spin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.oip-content .pvp__spin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(107, 68, 35, 0.14);
  border-top-color: #9a6830;
  animation: pvp-spin 1s linear infinite;
}
.oip-content .pvp__spin-wrap p {
  color: #9a7050;
  font-size: 0.58rem;
}
.oip-content .pvp__code-card {
  background: rgba(248, 244, 236, 0.8);
  border: 1px solid rgba(160, 110, 50, 0.18);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  margin-bottom: 10px;
}
.oip-content .pvp__code-lbl {
  color: #9a7050;
  font-size: 0.48rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.oip-content .pvp__code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.oip-content .pvp__code {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #6b4423;
  letter-spacing: 0.18em;
}
.oip-content .pvp__copy {
  background: none;
  border: 1px solid rgba(107, 68, 35, 0.22);
  border-radius: 4px;
  color: #9a6830;
  cursor: pointer;
  padding: 4px 8px;
}
.oip-content .pvp__copy:hover {
  border-color: #6b4423;
  color: #6b4423;
}
.oip-content .pvp__code-hint {
  color: #9a7050;
  font-size: 0.5rem;
  margin-top: 6px;
}
.oip-content .pvp__chars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}
.oip-content .pvp__c {
  width: 36px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid rgba(107, 68, 35, 0.22);
  background: rgba(255, 253, 246, 0.7);
  color: #6b4423;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}
.oip-content .pvp__c:focus {
  outline: none;
  border-color: #9a6830;
  box-shadow: 0 0 0 3px rgba(154, 104, 48, 0.12);
}
.oip-content .pvp__csep {
  color: rgba(107, 68, 35, 0.3);
  font-size: 1.2rem;
}
.oip-content .pvp__jerr {
  color: #a03030;
  font-size: 0.55rem;
  text-align: center;
  margin-bottom: 10px;
}
.oip-content .pvp__conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(60, 140, 80, 0.07);
  border: 1px solid rgba(60, 140, 80, 0.22);
  border-radius: 20px;
  color: #2e7a48;
  font-size: 0.52rem;
  padding: 4px 12px;
  margin: 0 auto 14px;
}
.oip-content .pvp__gdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e7a48;
  box-shadow: 0 0 6px #2e7a48;
}
.oip-content .pvp__players {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.oip-content .pvp__pl {
  flex: 1;
  background: rgba(248, 244, 236, 0.7);
  border: 1px solid rgba(107, 68, 35, 0.12);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.oip-content .pvp__pl-y {
  border-color: rgba(107, 68, 35, 0.3);
}
.oip-content .pvp__av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.8rem;
  margin: 0 auto 4px;
  border: 1.5px solid;
}
.oip-content .pvp__av-y {
  background: rgba(107, 68, 35, 0.1);
  border-color: #9a6830;
  color: #6b4423;
}
.oip-content .pvp__av-o {
  background: rgba(107, 68, 35, 0.04);
  border-color: rgba(107, 68, 35, 0.22);
  color: rgba(107, 68, 35, 0.5);
}
.oip-content .pvp__pn {
  color: #5a3a18;
  font-size: 0.58rem;
  font-weight: 700;
}
.oip-content .pvp__pr {
  color: #9a7050;
  font-size: 0.48rem;
  margin-top: 2px;
}
.oip-content .pvp__pr b {
  color: #6b4423;
  display: block;
}
.oip-content .pvp__vs {
  color: rgba(107, 68, 35, 0.28);
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.7rem;
}
.oip-content .pvp__rico {
  text-align: center;
  color: #9a6830;
  margin-bottom: 8px;
}
.oip-content .pvp__rtitle {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #3a2510;
  text-align: center;
  margin-bottom: 4px;
}
.oip-content .pvp__rsub {
  color: #9a7050;
  font-size: 0.6rem;
  text-align: center;
  margin-bottom: 14px;
}
.oip-content .pvp__dcico {
  text-align: center;
  color: rgba(107, 68, 35, 0.28);
  margin-bottom: 8px;
}
.oip-content .pvp__dctitle {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: #3a2510;
  text-align: center;
  margin-bottom: 6px;
}
.oip-content .pvp__dcmsg {
  color: #9a7050;
  font-size: 0.6rem;
  text-align: center;
  margin-bottom: 14px;
}
.oip-content .pvp__notif {
  background: rgba(248, 244, 236, 0.95);
  border-top: 1px solid rgba(107, 68, 35, 0.1);
  color: #7a5010;
  font-size: 0.58rem;
  padding: 8px 14px;
  text-align: center;
}
.oip-content .pvp__notif--success {
  color: #2e7a48;
}
.oip-content .pvp__notif--error {
  color: #a03030;
}
.oip-content .pvp__notif--chat {
  color: #6b4423;
}
#pvp-s-lobby {
  text-align: center;
}
/* ═══════════════════════════════════════════════════════════
   IMAGE BUTTONS — lobby only
═══════════════════════════════════════════════════════════ */

/* Shared image button base */
.lobby-btn-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

/* Earn More — lobby bottom */
.lobby-coin-earn-img {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: clamp(180px, 30vw, 300px);
  transition:
    transform 0.18s,
    filter 0.18s;
  display: block;
}
.lobby-coin-earn-img:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.1);
}
.lobby-coin-earn-img:active {
  transform: scale(0.97);
}

/* Skip & Claim — lobby ad action button */
.rw-action-btn-img {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: clamp(200px, 36vw, 340px);
  transition:
    transform 0.18s,
    filter 0.18s;
  display: inline-block;
}
.rw-action-btn-img:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  filter: none !important;
}
.rw-action-btn-img:not(:disabled):hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.12);
}
.rw-action-btn-img:not(:disabled):active {
  transform: scale(0.97);
}
.rw-action-btn-img .rw-skip-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Countdown badge overlay on the skip button */
.rw-countdown {
  position: absolute;
  top: 50%;
  right: 12%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.72);
  color: #f0d060;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  padding: 3px 9px;
  border-radius: 3px;
  pointer-events: none;
  letter-spacing: 0.06em;
}

/* +10 Reward AD — unlock modal watch-ad button */
.btn-unlock-img {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: clamp(160px, 26vw, 260px);
  transition:
    transform 0.18s,
    filter 0.18s;
  display: block;
  margin: 0 auto;
}
.btn-unlock-img:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.1);
}
.btn-unlock-img:active {
  transform: scale(0.97);
}
.btn-unlock-img .lobby-btn-img {
  display: block;
  width: 100%;
  height: auto;
}

/* Screen-start context overrides for earn more */
#screen-start .lobby-coin-earn-img {
  width: clamp(180px, 28vw, 280px);
}

/* ── Game-skin ad action button — image override ── */
.rw-action-btn-img-wrap {
  position: relative;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  width: clamp(200px, 36vw, 340px);
  min-width: 0 !important;
  transition:
    transform 0.18s,
    filter 0.18s;
}
.rw-action-btn-img-wrap:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
  filter: none !important;
}
.rw-action-btn-img-wrap:not(:disabled):hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.12);
}
.rw-action-btn-img-wrap:not(:disabled):active {
  transform: scale(0.97);
}
.rw-action-btn-img-wrap .rw-skip-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* ── Coin toast — image reward variant ── */
.coin-toast.coin-toast-img {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
.ct-reward-img {
  display: block;
  width: clamp(180px, 32vw, 280px);
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* ── INLINE STYLE REPLACEMENTS (rejection #30) ── */
/* SVG vertical-align in btn-options-pause */
.btn-pause-menu svg {
  vertical-align: middle;
}
/* Hidden compat/runtime elements */
#btn-lobby-theme {
  display: none;
}
#btn-lobby-settings-icon {
  display: none;
}
#online-pvp-host {
  display: none;
}
/* Lobby bottom section placeholder divs on subpages */
.lobby-bottom-section-hidden {
  display: none;
}
/* Flex-grow panels (move history / controls) */
.pp-section-flex {
  flex: 1;
}
