


.game-select-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: clamp(24px, 3vw, 40px);
  padding: clamp(14px, 2vw, 20px);
  direction: rtl;
}

.game-select-container--root {
  background-image:
    linear-gradient(180deg, rgba(10, 12, 28, 0.9), rgba(11, 13, 30, 0.94)),
    radial-gradient(circle at top center, rgba(108, 99, 255, 0.14), transparent 34%),
    var(--home-stage-banner-image);
  background-size: 100% 100%, 100% 100%, var(--home-stage-banner-size);
  background-position: center center, center top, var(--home-stage-banner-pos);
  background-repeat: no-repeat;
}

.game-select-container--root .game-select__title {
  color: rgba(226, 232, 255, 0.92);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

.game-select__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-align: center;
}


.game-cards {
  display: flex;
  flex-direction: row;
  gap: clamp(14px, 1.8vw, 24px);
  justify-content: center;
  flex-wrap: wrap;
}


.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: clamp(128px, 16vw, 160px);
  height: clamp(148px, 18vw, 180px);
  background-color: var(--color-bg-card);
  border: 2px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  padding: 16px;
}

.game-card:hover {
  border-color: var(--color-primary);
  background-color: var(--color-bg-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.game-card.selected {
  border-color: var(--color-accent);
  background-color: rgba(0,212,255,0.08);
  box-shadow: 0 0 18px rgba(0,212,255,0.3);
}

.game-card__icon {
  font-size: 3rem;
  line-height: 1;
}

.game-card--chess   .game-card__icon { color: #f0f0f0; }
.game-card--billiard .game-card__icon { color: #4cff6e; }
.game-card--domino  .game-card__icon { color: #ffd700; }

.game-card__name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  direction: rtl;
}


.game-options-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  width: 100%;
  max-width: 480px;
  animation: fadeInUp 0.25s ease;
  padding: clamp(18px, 2vw, 24px);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
  box-shadow: var(--shadow-md);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.game-options-panel__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  direction: rtl;
}

.game-options-panel__desc {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.8;
  text-align: center;
}

.game-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: min(100%, 980px);
}

.game-options-grid--chess {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.game-options-panel--practice {
  border-color: rgba(108,99,255,0.4);
  background:
    radial-gradient(circle at top left, rgba(108,99,255,0.18), transparent 44%),
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
}

.game-options__modes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-mode-btn {
  padding: 8px 22px;
  background-color: var(--color-bg-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius-full);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Cairo', sans-serif;
  direction: rtl;
}

.game-mode-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.game-mode-btn.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}


.game-start-btn {
  padding: 12px 48px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--border-radius-full);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Cairo', sans-serif;
  box-shadow: var(--shadow-glow);
  direction: rtl;
  border: none;
}

.game-start-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 0 28px rgba(108,99,255,0.7);
}


.game-back-btn {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  transition: color var(--transition-fast);
}

.game-back-btn:hover {
  color: var(--color-primary);
}


#game-frame {
  flex: 1;
  min-height: 100%;
  display: none;
}

#game-frame.game-frame--billiard {
  position: relative;
  height: 100%;
  min-width: 0;
  background: transparent;
}

.billiard-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: stretch;
  background: transparent;
}

.billiard-side-zone {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 118px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 6;
}

.billiard-party-slot {
  position: absolute;
  left: 50%;
  width: 62px;
  height: 62px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(16, 20, 46, 0.92);
  overflow: visible;
  pointer-events: none;
  transition: filter 180ms ease, transform 180ms ease;
}

.billiard-party-slot::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 3px solid transparent;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.billiard-party-slot--top {
  top: 16px;
}

.billiard-party-slot--bottom {
  bottom: 16px;
}

.billiard-party-slot__image {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transform-origin: center center;
  will-change: transform;
}

.billiard-party-slot__frame {
  position: absolute;
  inset: -12%;
  pointer-events: none;
}

.billiard-party-slot__frame.is-empty {
  display: none;
}

.billiard-party-slot__frame-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
}

.billiard-party-slot.is-active-turn {
  filter: brightness(1.08);
}

.billiard-party-slot.is-active-turn::after {
  opacity: 1;
  transform: scale(1);
  border-color: var(--color-accent, var(--color-gold, #d4af37));
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--color-gold, #d4af37) 55%, transparent),
    var(--shadow-glow, 0 0 10px #d4af37);
}

.billiard-side-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.billiard-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 112px;
  margin-top: 6px;
}

.billiard-hud[hidden] {
  display: none;
}

.billiard-hud__panel {
  position: relative;
  width: 35px;
  height: 23px;
  flex: 0 0 auto;
}

.billiard-hud__bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.billiard-hud__value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 1px;
  color: #f2d590;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  direction: ltr;
}

.billiard-side-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.billiard-side-btn > img:not(.billiard-spin-btn__spot) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.billiard-spin-btn__spot {
  position: absolute;
  width: 6.25px;
  height: 6.25px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.billiard-side-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-top: 2px;
  margin-bottom: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.billiard-side-icon--settings {
  align-self: flex-end;
  margin-right: 6px;
}

.billiard-side-icon--replay {
  align-self: flex-start;
  margin-left: 6px;
  width: 36px;
  height: 36px;
}

.billiard-side-icon--exit {
  align-self: flex-start;
  margin-left: 4px;
  width: 28px;
  height: 28px;
}

.billiard-side-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.billiard-side-icon.is-busy {
  opacity: 0.55;
  cursor: progress;
}

.billiard-settings-popup {
  position: absolute;
  bottom: 84px;
  left: 126px;
  z-index: 9;
}

.billiard-settings-popup[hidden] {
  display: none;
}

.billiard-replay-popup {
  position: absolute;
  bottom: 42px;
  left: 118px;
  z-index: 9;
}

.billiard-replay-popup[hidden] {
  display: none;
}

.billiard-replay-card {
  width: 148px;
  padding: 10px;
  border: 1px solid rgba(29, 34, 47, 0.22);
  border-radius: 12px;
  background: rgba(244, 247, 253, 0.96);
  box-shadow: 0 12px 24px rgba(8, 12, 20, 0.22);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.billiard-replay-card__title {
  color: #243040;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.billiard-replay-card__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.billiard-replay-card__btn {
  min-width: 58px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(29, 34, 47, 0.16);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.billiard-replay-card__btn--confirm {
  background: #d0a510;
  color: #111822;
}

.billiard-replay-card__btn--cancel {
  background: rgba(255, 255, 255, 0.8);
  color: #243040;
}

.billiard-settings-card {
  width: 208px;
  padding: 10px;
  border: 1px solid rgba(29, 34, 47, 0.22);
  border-radius: 14px;
  background: rgba(244, 247, 253, 0.96);
  box-shadow: 0 12px 24px rgba(8, 12, 20, 0.22);
}

.billiard-settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.billiard-settings-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.billiard-settings-item__visual {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.billiard-settings-item__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.billiard-settings-item__title {
  color: #243040;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
}

.billiard-settings-speed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.billiard-settings-speed__title {
  color: #243040;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.billiard-settings-speed__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.billiard-settings-speed__option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid rgba(29, 34, 47, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #243040;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.billiard-settings-speed__option input {
  margin: 0;
  accent-color: #b58e1b;
}

.billiard-settings-speed__option span {
  line-height: 1;
}

.billiard-rack {
  position: relative;
  width: 112px;
  height: 25px;
  flex: 0 0 auto;
}

.billiard-rack__bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

.billiard-rack__slots {
  position: absolute;
  inset: 0;
}

.billiard-rack__slot {
  position: absolute;
  overflow: hidden;
  display: block;
}

.billiard-rack__slot.is-hidden {
  display: none;
}

.billiard-rack__slot--sheet img,
.billiard-rack__slot--eight img {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.billiard-rack__slot--eight img {
  width: 100%;
  height: 100%;
}

.billiard-rack__slot--sheet {
  border-radius: 999px;
}

.billiard-rack__ball--eight img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.billiard-crop-shell {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: stretch;
}

.billiard-crop-box {
  position: relative;
  overflow: hidden;
  background: transparent;
  flex: 0 0 auto;
  transform: scale(1);
  transform-origin: right top;
  margin-left: auto;
  margin-right: 0;
}

.billiard-source-frame {
  position: absolute;
  width: 120.6794468887%;
  height: 119.7339246119%;
  top: -1.5513307985%;
  left: -10.3394085481%;
  border: 0;
  background: #000;
}

.billiard-spin-popup {
  position: absolute;
  top: 96px;
  left: 132px;
  width: 220px;
  height: 220px;
  z-index: 9;
}

.billiard-spin-popup[hidden] {
  display: none;
}

.billiard-spin-board {
  position: relative;
  width: 220px;
  height: 220px;
}

.billiard-spin-board__bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.billiard-spin-board__spot {
  position: absolute;
  width: 24px;
  height: 24px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.game-frame__content {
  text-align: center;
  color: var(--color-text-muted);
  direction: rtl;
  padding: 28px 20px;
  width: 100%;
}

.game-frame__icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.game-frame__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
}

.game-frame__subtitle {
  font-size: 0.9rem;
  margin-bottom: 22px;
}

.game-frame__spinner {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--color-primary);
  font-size: 0.9rem;
}

.game-frame__exit-btn {
  margin-top: 20px;
  padding: 10px 28px;
  border-radius: 999px;
  background: rgba(231,76,60,0.15);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.game-frame__exit-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}


.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.challenge-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  direction: rtl;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.challenge-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.challenge-card__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.challenge-card__game {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.challenge-card__meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.challenge-card__cta {
  padding: 8px 14px;
  border-radius: var(--border-radius-full);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.challenge-card__cta:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}


.waiting-state {
  justify-content: center;
}

.waiting-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-xl);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
  min-width: 260px;
}

.waiting-card__icon {
  font-size: 3rem;
}

.waiting-card__title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text);
}

.waiting-card__subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.waiting-card__spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--color-primary);
  font-size: 0.9rem;
}

.waiting-card__cancel {
  padding: 10px 16px;
  border-radius: var(--border-radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  color: var(--color-text);
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.waiting-card__cancel:hover {
  transform: translateY(-1px);
  border-color: var(--color-primary);
}

.panel--chess-training-center {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.12), transparent 38%),
    linear-gradient(180deg, rgba(17,17,34,0.98), rgba(13,13,27,1));
}

.chess-training-shell {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.6vw, 18px);
  padding: var(--center-stage-padding);
  direction: ltr;
}

.chess-training-shell__top {
  position: relative;
  flex: 0 0 75%;
  min-height: 0;
  display: flex;
}

.chess-training-shell--active {
  gap: 0;
  padding-block: 0;
}

.chess-training-shell--active .chess-training-shell__top {
  flex: 1 1 auto;
}

.chess-training-shell--active .chess-training-shell__stage,
.chess-training-shell--active .chess-training-shell__board-column,
.chess-training-shell--active .chess-stage {
  height: 100%;
}

.chess-training-shell__hub-placeholder {
  flex: 1;
  min-height: 0;
  border-radius: var(--center-stage-radius);
  border: 1px solid rgba(255,255,255,0.06);
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 40%),
    linear-gradient(180deg, rgba(18,18,34,0.58), rgba(10,10,22,0.42));
}

.chess-training-shell__back-btn {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(20,20,42,0.92);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.chess-training-shell__back-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108,99,255,0.78);
  background: rgba(38,34,76,0.96);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}

.chess-hub {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--center-stage-padding);
  direction: rtl;
}

.chess-hub__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding-inline: clamp(8px, 1vw, 14px);
  position: relative;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(26, 26, 48, 0.92), rgba(16, 16, 30, 0.88));
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
}

.chess-hub__tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 10px;
  scrollbar-width: none;
}

.chess-hub__tabs::-webkit-scrollbar {
  display: none;
}

.chess-hub__tab {
  position: relative;
  z-index: 1;
  min-height: 48px;
  padding: 11px 22px 12px;
  border: 1px solid rgba(255,255,255,0.11);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background:
    linear-gradient(180deg, rgba(38, 38, 64, 0.9), rgba(20, 20, 36, 0.96));
  color: var(--color-text-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  margin-inline-start: -10px;
  transform: translateY(8px);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.chess-hub__tab:first-child {
  margin-inline-start: 0;
}

.chess-hub__tab:hover {
  color: var(--color-text);
  border-color: rgba(255,255,255,0.18);
  background:
    linear-gradient(180deg, rgba(44, 44, 72, 0.92), rgba(22, 22, 38, 0.98));
}

.chess-hub__tab.is-active {
  z-index: 3;
  transform: translateY(1px);
  color: var(--color-text);
  border-color: rgba(108,99,255,0.52);
  background:
    linear-gradient(180deg, rgba(30, 30, 54, 0.98), rgba(18, 18, 34, 0.98));
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

.chess-hub__tab-prefix {
  font-size: 1rem;
  line-height: 1;
}

.chess-hub__tab-icon {
  width: 16px;
  height: 16px;
}

.chess-hub__back-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(28, 28, 52, 0.96), rgba(18, 18, 34, 0.98));
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.chess-hub__back-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108,99,255,0.78);
  background:
    linear-gradient(180deg, rgba(42, 42, 74, 0.98), rgba(24, 24, 44, 0.98));
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}

.chess-hub__back-icon {
  width: 18px;
  height: 18px;
}

.chess-hub__queue-indicator-slot {
  flex: 0 0 clamp(76px, 9vw, 104px);
  min-width: clamp(76px, 9vw, 104px);
  display: flex;
  align-items: flex-end;
}

.chess-hub__queue-indicator {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(28, 28, 52, 0.96), rgba(18, 18, 34, 0.98));
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.chess-hub__queue-indicator.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.chess-hub__queue-indicator[data-queue-indicator-state="running"] {
  border-color: rgba(52, 211, 153, 0.48);
}

.chess-hub__queue-indicator[data-queue-indicator-state="paused"] {
  border-color: rgba(251, 191, 36, 0.42);
}

.chess-hub__queue-indicator[data-queue-indicator-state="stopped"] {
  border-color: rgba(255,255,255,0.12);
}

.chess-hub__queue-indicator-close,
.chess-hub__queue-indicator-action {
  border: 0;
  background: transparent;
  color: var(--color-text);
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
}

.chess-hub__queue-indicator-close {
  min-width: 12px;
  font-size: 0.78rem;
  line-height: 1;
  color: var(--color-text-muted);
}

.chess-hub__queue-indicator-action {
  font-size: 0.76rem;
  white-space: nowrap;
  color: rgba(114, 161, 255, 0.98);
}

.chess-hub__queue-indicator-action[disabled] {
  cursor: default;
  opacity: 0.55;
}

.chess-hub__body {
  flex: 1;
  min-height: 0;
  margin-top: -1px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0 0 var(--center-stage-radius) var(--center-stage-radius);
  background:
    linear-gradient(180deg, rgba(18,18,34,0.78), rgba(10,10,22,0.56));
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chess-hub__empty {
  height: 100%;
  border-radius: inherit;
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 40%),
    linear-gradient(180deg, rgba(18,18,34,0.58), rgba(10,10,22,0.42));
}

.chess-waiting {
  height: 100%;
  overflow: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  direction: rtl;
  text-align: right;
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 42%),
    linear-gradient(180deg, rgba(18,18,34,0.72), rgba(10,10,22,0.48));
}

.chess-waiting__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chess-waiting__title {
  color: #fffdfb;
  font-size: clamp(1.02rem, 1.5vw, 1.28rem);
  font-weight: 900;
}

.chess-waiting__subtitle {
  color: rgba(255,255,255,0.76);
  font-size: 0.84rem;
  line-height: 1.8;
}

.chess-waiting__note {
  padding: 10px 14px;
  border: 1px solid rgba(255, 197, 120, 0.24);
  border-radius: 14px;
  background: rgba(60, 39, 10, 0.34);
  color: rgba(255, 224, 176, 0.94);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.7;
}

.chess-waiting__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  align-content: start;
  min-height: 100%;
  padding: 0;
  box-sizing: border-box;
}

.chess-waiting__empty {
  flex: 1;
  min-height: 190px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  background: rgba(9, 10, 22, 0.52);
  color: rgba(255,255,255,0.84);
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  line-height: 1.8;
}

.chess-waiting__empty strong {
  color: #fffdfb;
  font-size: 1rem;
  font-weight: 900;
}

.chess-waiting__empty span {
  font-size: 0.84rem;
}

.chess-waiting-card {
  border: 2px solid rgba(255,255,255,0.88);
  border-radius: 22px;
  background: rgba(12, 13, 25, 0.98);
  box-shadow: none;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 182px;
}

.chess-waiting-card.is-clickable {
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.chess-waiting-card.is-clickable:hover {
  border-color: rgba(120, 196, 255, 0.94);
  background: rgba(16, 18, 32, 0.98);
}

.chess-waiting-card.is-clickable:focus-visible {
  outline: 2px solid rgba(108,99,255,0.78);
  outline-offset: 2px;
}

.chess-waiting-card__summary {
  display: grid;
  direction: ltr;
  grid-template-columns: 88px 52px 52px 92px;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
}

.chess-waiting-card__profile {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: inherit;
  direction: rtl;
}

.chess-waiting-card__profile:focus-visible {
  outline: 2px solid rgba(108,99,255,0.78);
  outline-offset: 2px;
  border-radius: 18px;
}

.chess-waiting-card__avatar {
  position: relative;
  width: 74px;
  min-width: 74px;
  height: 74px;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.92);
  background: #17192c;
  display: grid;
  place-items: center;
}

.chess-waiting-card__avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chess-waiting-card__avatar-fallback {
  color: #fffdfb;
  font-size: 1.35rem;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.chess-waiting-card__player-name {
  min-width: 0;
  color: #fffdfb;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chess-waiting-card__token {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  direction: rtl;
}

.chess-waiting-card__token-shape {
  width: auto;
  min-width: 0;
  height: auto;
  border-radius: 0;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chess-waiting-card__token-shape--mode {
  background: transparent;
  border: 0;
}

.chess-waiting-card__token-icon {
  width: 2.05rem;
  height: 2.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chess-waiting-card__token-graphic {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.chess-waiting-card__token--mode .chess-waiting-card__token-graphic {
  filter: brightness(0) invert(1);
}

.chess-waiting-card__token-label {
  color: rgba(255,255,255,0.84);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
}

.chess-waiting-card__rating-stack {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  direction: rtl;
}

.chess-waiting-card__rating {
  width: 100%;
  min-height: 50px;
  border: 2px solid rgba(255,255,255,0.92);
  border-radius: 0;
  background: rgba(10, 11, 22, 0.9);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.chess-waiting-card__rating-title {
  color: #fffdfb;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
}

.chess-waiting-card__rating-value {
  color: #fffdfb;
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1;
}

.chess-waiting-card__rating-state {
  color: rgba(255,255,255,0.86);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  width: 100%;
}

.chess-waiting-card__time {
  color: #fff7f0;
  font-size: clamp(1.55rem, 2.4vw, 2.18rem);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  direction: ltr;
  letter-spacing: 0.01em;
}

.chess-hub__state-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: clamp(24px, 3vw, 34px);
  text-align: center;
  color: var(--color-text);
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 42%),
    linear-gradient(180deg, rgba(18,18,34,0.7), rgba(10,10,22,0.5));
}

.chess-hub__state-title {
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  font-weight: 900;
}

.chess-hub__state-text {
  max-width: 520px;
  color: rgba(255,255,255,0.84);
  font-size: 0.95rem;
  line-height: 1.7;
}

.chess-hub__state-meta {
  color: rgba(155, 215, 255, 0.88);
  font-size: 0.86rem;
  font-weight: 700;
}

.chess-hub__state-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.chess-hub__state-card--waiting,
.chess-hub__state-card--live {
  position: relative;
  overflow: hidden;
}

.chess-hub__waiting-visual {
  position: relative;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}

.chess-hub__waiting-ring,
.chess-hub__waiting-core {
  position: absolute;
  border-radius: 999px;
}

.chess-hub__waiting-ring {
  inset: 0;
  border: 1px solid rgba(121, 200, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(74, 104, 255, 0.16);
  animation: chess-waiting-pulse 2.6s ease-in-out infinite;
}

.chess-hub__waiting-core {
  inset: 24px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.46), transparent 18%),
    linear-gradient(180deg, rgba(74, 104, 255, 0.9), rgba(28, 200, 255, 0.9));
  box-shadow: 0 0 24px rgba(33, 154, 255, 0.28);
}

.chess-hub__waiting-grid {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chess-hub__waiting-grid--live {
  margin-top: 4px;
}

.chess-hub__waiting-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(9, 10, 22, 0.62);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chess-hub__waiting-item-label {
  color: rgba(255,255,255,0.56);
  font-size: 0.72rem;
  font-weight: 800;
}

.chess-hub__waiting-item-value {
  color: #fffdfb;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.6;
}

.chess-hub__waiting-note {
  max-width: 560px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 197, 120, 0.24);
  border-radius: 14px;
  background: rgba(60, 39, 10, 0.34);
  color: rgba(255, 224, 176, 0.94);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.7;
}

.chess-hub__live-badge {
  min-height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(130, 206, 255, 0.2);
  background: rgba(31, 66, 140, 0.24);
  color: #9bd7ff;
  font-size: 0.76rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chess-hub__state-btn {
  min-width: 132px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,0.82);
  border-radius: 14px;
  background: linear-gradient(90deg, #4a68ff 0%, #1cc8ff 100%);
  color: #fffdfb;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.chess-hub__state-btn--ghost {
  background: rgba(18, 18, 36, 0.52);
}

.chess-home {
  height: 100%;
  padding: clamp(18px, 2.2vw, 28px);
  direction: rtl;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chess-home__layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 30%) minmax(0, 1fr);
  grid-template-areas: "actions times";
  gap: clamp(18px, 2vw, 28px);
  align-items: stretch;
}

@keyframes chess-waiting-pulse {
  0% {
    transform: scale(0.92);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.92);
    opacity: 0.5;
  }
}

.chess-home__panel {
  min-height: 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(20,20,38,0.96), rgba(11,11,24,0.98)),
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 55%);
  box-shadow: 0 16px 40px rgba(0,0,0,0.24);
}

.chess-home__panel--times {
  grid-area: times;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(18px, 2vw, 24px);
}

.chess-home__time-grid {
  display: grid;
  gap: 8px;
}

.chess-home__row-shell {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.chess-home__row-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.chess-home__row-marker-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

.chess-home__time-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chess-home__time-btn,
.chess-home__increment-btn,
.chess-home__primary-action,
.chess-home__secondary-action,
.chess-home__challenge-picker,
.chess-home__challenge-input {
  font-family: 'Cairo', sans-serif;
}

.chess-home__time-btn {
  min-height: clamp(48px, 6.8vh, 68px);
  border: 1px solid rgba(255,255,255,0.9);
  background: rgba(11, 11, 24, 0.42);
  color: #fff7f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.chess-home__time-btn.is-active,
.chess-home__increment-btn.is-active {
  border-color: rgba(80, 182, 255, 0.96);
  background: linear-gradient(180deg, rgba(39, 58, 140, 0.46), rgba(17, 31, 74, 0.66));
  box-shadow: inset 0 0 0 1px rgba(132, 208, 255, 0.18), 0 10px 22px rgba(10, 24, 62, 0.34);
}

.chess-home__time-btn:hover,
.chess-home__increment-btn:hover,
.chess-home__secondary-action:hover,
.chess-home__challenge-picker:hover {
  transform: translateY(-1px);
  background: rgba(30, 30, 56, 0.82);
}

.chess-home__time-btn span {
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  line-height: 1;
  font-weight: 400;
}

.chess-home__time-btn:not(.chess-home__time-btn--custom) span.is-custom {
  font-size: clamp(0.9rem, 1.4vw, 1.35rem);
  font-weight: 700;
}

.chess-home__time-btn--custom {
  flex-direction: column;
  gap: 4px;
  justify-content: flex-start;
  padding: 6px 4px 8px;
  overflow: hidden;
}

.chess-home__time-btn .chess-home__time-btn-custom-label {
  width: 100%;
  font-size: clamp(0.54rem, 0.75vw, 0.68rem);
  font-weight: 800;
  line-height: 1;
  transform: translateY(-1px);
  text-align: center;
}

.chess-home__time-btn .chess-home__time-btn-custom-value {
  width: 100%;
  font-size: clamp(0.46rem, 0.75vw, 0.62rem);
  font-weight: 700;
  line-height: 1.05;
  direction: ltr;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.chess-home__row-shell--increments {
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.chess-home__increment-btn {
  min-height: 52px;
  padding: 10px 8px;
  border: 1px solid rgba(255,255,255,0.9);
  background: rgba(12, 12, 24, 0.3);
  color: #fff7f0;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

.chess-home__panel--actions {
  grid-area: actions;
  padding: clamp(14px, 1.8vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chess-home__primary-action,
.chess-home__secondary-action {
  min-height: 56px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.85);
  color: #fffdfb;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.chess-home__primary-action {
  background: linear-gradient(90deg, #4a68ff 0%, #1cc8ff 100%);
  box-shadow: 0 14px 28px rgba(20, 74, 255, 0.22);
}

.chess-home__secondary-action {
  background: rgba(12, 12, 24, 0.35);
}

.chess-home__primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(20, 74, 255, 0.28);
}

.chess-home__color-card {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(12, 12, 24, 0.28);
}

.chess-home__color-options {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: stretch;
}

.chess-home__color-options > * + * {
  border-inline-start: 1px solid rgba(255,255,255,0.14);
}

[data-chess-home-actions="1"] .chess-home__primary-action,
[data-chess-home-actions="1"] .chess-home__secondary-action {
  min-width: 0;
  min-height: 56px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

[data-chess-home-actions="1"] .chess-home__primary-action {
  background: linear-gradient(90deg, #4a68ff 0%, #1cc8ff 100%);
}

[data-chess-home-actions="1"] .chess-home__secondary-action {
  background: linear-gradient(180deg, rgba(63, 100, 255, 0.88), rgba(39, 74, 222, 0.92));
}

[data-chess-home-actions="1"] .chess-home__primary-action:hover,
[data-chess-home-actions="1"] .chess-home__secondary-action:hover {
  transform: none;
  box-shadow: none;
}

[data-chess-home-actions="1"] .chess-home__primary-action:hover {
  background: linear-gradient(90deg, #4a68ff 0%, #1cc8ff 100%);
}

[data-chess-home-actions="1"] .chess-home__secondary-action:hover {
  background: linear-gradient(180deg, rgba(63, 100, 255, 0.88), rgba(39, 74, 222, 0.92));
}

.chess-home__color-btn {
  min-height: 56px;
  border: 0;
  background: rgba(10, 11, 24, 0.18);
  color: #fffdfb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.chess-home__color-btn:hover {
  background: rgba(30, 30, 56, 0.72);
}

.chess-home__color-btn.is-active {
  background: linear-gradient(180deg, rgba(39, 58, 140, 0.46), rgba(17, 31, 74, 0.66));
  box-shadow: inset 0 0 0 1px rgba(132, 208, 255, 0.18);
}

.chess-home__color-btn::before {
  content: none !important;
}

.chess-home__color-icon {
  width: clamp(1.7rem, 2.4vw, 2.1rem);
  height: clamp(1.7rem, 2.4vw, 2.1rem);
  object-fit: contain;
  display: block;
}

.chess-home__challenge-card {
  margin-top: -6px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(10, 10, 22, 0.36);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chess-home__challenge-title {
  color: #fffdfb;
  font-size: 0.92rem;
  font-weight: 800;
}

.chess-home__challenge-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chess-home__challenge-send {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.86);
  background: linear-gradient(180deg, rgba(63, 100, 255, 0.92), rgba(26, 61, 214, 0.96));
  color: #fffdfb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chess-home__challenge-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(35, 40, 68, 0.64);
}

.chess-home__challenge-picker {
  min-height: 40px;
  border: 1px solid rgba(255,255,255,0.9);
  background: rgba(12, 12, 24, 0.24);
  color: #fffdfb;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.chess-home__challenge-picker-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chess-home__challenge-picker.is-selected {
  border-color: rgba(83, 176, 255, 0.95);
  background: linear-gradient(180deg, rgba(40, 70, 138, 0.42), rgba(16, 30, 72, 0.52));
}

.chess-home__challenge-menu {
  max-height: 188px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(9, 10, 20, 0.94);
  box-shadow: 0 16px 28px rgba(0,0,0,0.28);
}

.chess-home__challenge-menu--dialog {
  max-height: min(280px, 42vh);
  border-radius: 14px;
}

.chess-home__challenge-picker-state {
  padding: 12px 10px;
  color: rgba(255,255,255,0.82);
  font-size: 0.84rem;
  text-align: center;
}

.chess-home__challenge-picker-state--error {
  color: #ffb7b7;
}

.chess-home__challenge-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: #fffdfb;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: right;
  cursor: pointer;
}

.chess-home__challenge-option:last-child {
  border-bottom: 0;
}

.chess-home__challenge-option:hover,
.chess-home__challenge-option.is-active {
  background: rgba(79, 135, 255, 0.16);
}

.chess-home__challenge-option-name {
  font-size: 0.88rem;
  font-weight: 800;
}

.chess-home__challenge-option-meta {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.62);
  direction: ltr;
  text-align: right;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chess-home__challenge-option-presence {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.chess-home__challenge-option-presence--online {
  background: #16a34a;
}

.chess-home__challenge-option-presence--offline {
  background: #7f1d1d;
}

.chess-home__challenge-or {
  color: rgba(255,255,255,0.74);
  font-size: 0.79rem;
  font-weight: 700;
  text-align: center;
}

.chess-home__custom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 10, 20, 0.72);
  display: grid;
  place-items: center;
  z-index: 12;
}

.chess-home__custom-card {
  width: min(420px, calc(100% - 24px));
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(21, 22, 40, 0.98), rgba(10, 11, 24, 0.98));
  box-shadow: 0 24px 44px rgba(0,0,0,0.34);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chess-home__custom-title {
  color: #fffdfb;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
}

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

.chess-home__custom-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(255,255,255,0.82);
  font-size: 0.82rem;
  font-weight: 700;
}

.chess-home__custom-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(7, 8, 18, 0.88);
  color: #fffdfb;
  padding: 8px 10px;
  outline: none;
  direction: ltr;
}

.chess-home__custom-preview {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8, 10, 20, 0.8);
  color: #9bd7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  direction: ltr;
}

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

.chess-home__custom-btn {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,0.82);
  color: #fffdfb;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.chess-home__custom-btn--cancel {
  background: rgba(19, 22, 40, 0.48);
}

.chess-home__custom-btn--confirm {
  background: linear-gradient(90deg, #4a68ff 0%, #1cc8ff 100%);
}

.chess-home__challenge-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(8, 8, 18, 0.84);
  color: #fffdfb;
  padding: 6px 10px;
  font-size: 0.88rem;
  outline: none;
}

.chess-home__challenge-input::placeholder {
  color: rgba(255,255,255,0.76);
}

.chess-hub__tab-prefix {
  font-size: 0.88rem;
  line-height: 1;
}

.chess-hub__tab-icon {
  width: 13px;
  height: 13px;
}

.chess-training-shell__bottom {
  flex: 0 0 25%;
  min-height: 120px;
  border-radius: var(--center-stage-radius);
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(20,20,38,0.94), rgba(12,12,26,0.98)),
    radial-gradient(circle at top center, rgba(108,99,255,0.12), transparent 56%);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: clamp(16px, 1.8vw, 22px);
  direction: rtl;
}

.chess-training-shell__bottom-title {
  color: var(--color-text-muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

.chess-training-shell__mode-switch {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chess-training-shell__mode-btn {
  width: 100%;
  min-height: 54px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.chess-training-shell__mode-btn:hover,
.chess-training-shell__mode-btn.is-active {
  border-color: rgba(108,99,255,0.78);
  background: rgba(38,34,76,0.96);
  box-shadow: 0 10px 24px rgba(0,0,0,0.26);
}

.chess-training-shell__mode-btn:hover {
  transform: translateY(-1px);
}

.chess-training-drawer {
  position: absolute;
  inset: var(--center-stage-padding);
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: center;
  transform: translateY(calc(-100% - var(--center-stage-padding)));
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  opacity: 0;
  pointer-events: none;
}

.chess-training-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chess-training-drawer__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(5, 6, 16, 0.42);
  cursor: pointer;
}

.chess-training-drawer__body {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100% - 24px));
  height: 100%;
  border-radius: var(--center-stage-radius);
  border: 1px solid rgba(255,255,255,0.1);
  background:
    linear-gradient(180deg, rgba(22,22,44,0.98), rgba(12,12,24,0.98)),
    radial-gradient(circle at top center, rgba(108,99,255,0.12), transparent 48%);
  box-shadow: 0 20px 48px rgba(0,0,0,0.38);
  backdrop-filter: blur(10px);
  padding: clamp(18px, 2vw, 28px);
  direction: rtl;
  text-align: right;
}

.chess-training-drawer__body--empty {
  background:
    linear-gradient(180deg, rgba(18,18,34,0.98), rgba(10,10,20,0.98));
  box-shadow: 0 20px 48px rgba(0,0,0,0.38);
}

.chess-training-drawer__scroll {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
  overflow: auto;
  padding-inline-end: 4px;
}

.chess-training-drawer__eyebrow {
  color: var(--color-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.chess-training-drawer__title {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 800;
}

.chess-training-drawer__mode-switch {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chess-training-drawer__mode-btn,
.chess-training-drawer__choice-btn,
.chess-training-drawer__action-btn {
  padding: 10px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
  font-family: 'Cairo', sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.chess-training-drawer__mode-btn:hover,
.chess-training-drawer__choice-btn:hover,
.chess-training-drawer__action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108,99,255,0.72);
}

.chess-training-drawer__mode-btn.is-active,
.chess-training-drawer__choice-btn.is-active,
.chess-training-drawer__action-btn--primary {
  background: linear-gradient(135deg, rgba(108,99,255,0.88), rgba(125,116,255,0.94));
  border-color: rgba(146,138,255,0.94);
  color: #fff;
  box-shadow: 0 10px 22px rgba(38,34,76,0.3);
}

.chess-training-drawer__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chess-training-drawer__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
}

.chess-training-drawer__card--full {
  grid-column: 1 / -1;
}

.chess-training-drawer__card-title {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 800;
}

.chess-training-drawer__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chess-training-drawer__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chess-training-drawer__note {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.9;
}

.chess-training-drawer__rating-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chess-training-drawer__rating-label {
  color: var(--color-text);
  font-size: 0.84rem;
  font-weight: 700;
}

.chess-training-drawer__rating-value {
  color: var(--color-primary-light);
  font-size: 1rem;
  font-weight: 900;
}

.chess-training-drawer__rating-note {
  color: var(--color-text-muted);
  font-size: 0.75rem;
  line-height: 1.8;
}

.chess-training-drawer__slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  direction: ltr;
}

.chess-training-drawer__fen-input {
  min-height: 92px;
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  background: rgba(10,10,22,0.78);
  color: var(--color-text);
  padding: 12px 14px;
  font-family: Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.8;
  direction: ltr;
  text-align: left;
}

.chess-training-drawer__status,
.chess-training-drawer__substatus {
  border-radius: 16px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px;
}

.chess-training-drawer__status {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.9;
}

.chess-training-drawer__substatus {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.8;
}

.chess-training-drawer__slider {
  flex: 1;
  width: 100%;
  height: 2px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.22);
  border-radius: var(--border-radius-full);
  outline: none;
  cursor: pointer;
}

.chess-training-drawer__slider::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: var(--border-radius-full);
  background: linear-gradient(90deg, var(--color-primary), rgba(255,255,255,0.22));
}

.chess-training-drawer__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border: 2px solid var(--color-primary-light);
  border-radius: 50%;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

.chess-training-drawer__slider::-moz-range-track {
  height: 2px;
  border: 0;
  border-radius: var(--border-radius-full);
  background: linear-gradient(90deg, var(--color-primary), rgba(255,255,255,0.22));
}

.chess-training-drawer__slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--color-primary-light);
  border-radius: 50%;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-sm);
}

.chess-training-drawer__step-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  background: var(--color-bg-secondary);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.chess-training-drawer__step-btn:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.chess-training-shell__stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.chess-training-shell__play-surface {
  position: relative;
  flex: 0 0 auto;
  width: 726px;
  height: 544px;
  transform-origin: center top;
  margin-top: 5px;
  --chess-board-light-color: #e2d7f5;
  --chess-board-dark-color: #6e5aa4;
}

.chess-training-shell__rail {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 6px;
  min-height: 0;
}

.chess-training-shell__rail--left {
  left: 0;
}

.chess-training-shell__rail--right {
  right: 0;
}

.chess-training-shell__anchor-buttons {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.chess-training-shell__anchor-btn {
  position: absolute;
  width: 84px;
  min-width: 84px;
  height: 40px;
  border: 2px solid rgba(255,255,255,0.92);
  border-radius: 12px;
  background: rgba(18, 18, 36, 0.98);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: 'Cairo', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(0,0,0,0.24);
  pointer-events: auto;
}

.chess-training-shell__anchor-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.chess-training-shell__anchor-btn .fas {
  font-size: 16px;
  line-height: 1;
}

.chess-training-shell__anchor-btn.is-cancel-state {
  border-color: rgba(255, 214, 102, 0.96);
  color: rgba(255, 236, 179, 0.98);
}

.chess-training-shell__anchor-btn.is-disabled,
.chess-training-shell__anchor-btn:disabled {
  opacity: 0.42;
  cursor: default;
  filter: saturate(0.2);
  pointer-events: none;
}

.chess-training-shell__anchor-btn.is-flashing {
  animation: chessAnchorFlash 0.72s ease-in-out infinite alternate;
}

@keyframes chessAnchorFlash {
  from {
    transform: scale(1);
    box-shadow: 0 12px 24px rgba(0,0,0,0.24);
    border-color: rgba(255,255,255,0.92);
  }
  to {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(255, 210, 122, 0.16), 0 16px 28px rgba(255, 210, 122, 0.24);
    border-color: rgba(255, 210, 122, 0.98);
  }
}

.chess-training-shell__anchor-btn[title="استسلام"] {
  border-color: rgba(255, 184, 184, 0.96);
}

.panel--chess-live-left {
  overflow: hidden;
}

.chess-live-left {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  direction: rtl;
  background:
    radial-gradient(circle at top center, rgba(108,99,255,0.08), transparent 42%),
    linear-gradient(180deg, rgba(18,18,34,0.9), rgba(10,10,22,0.96));
}

.chess-live-left__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chess-live-left__title {
  color: #fffdfb;
  font-size: 0.96rem;
  font-weight: 900;
}

.chess-live-left__subtitle,
.chess-live-left__meta,
.chess-live-left__empty {
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  line-height: 1.6;
}

.chess-live-left__badge {
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(70, 110, 255, 0.22);
  color: #9bd7ff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chess-live-left__card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  background: rgba(13, 14, 28, 0.72);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chess-live-left__label {
  color: rgba(255,255,255,0.6);
  font-size: 0.72rem;
  font-weight: 800;
}

.chess-live-left__status {
  color: #fffdfb;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.6;
}

.chess-live-left__clock-grid {
  display: grid;
  gap: 8px;
}

.chess-live-left__clock-card {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  background: rgba(8, 9, 18, 0.82);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chess-live-left__clock-card.is-active {
  border-color: rgba(80, 182, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(132, 208, 255, 0.15);
}

.chess-live-left__clock-name {
  color: rgba(255,255,255,0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.chess-live-left__clock-value {
  color: #fffdfb;
  font-size: 1.12rem;
  font-weight: 900;
  direction: ltr;
}

.chess-live-left__moves {
  max-height: min(42vh, 340px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chess-live-left__move-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.chess-live-left__move-index {
  color: rgba(255,255,255,0.5);
  font-size: 0.74rem;
  font-weight: 700;
}

.chess-live-left__move-cell {
  min-height: 30px;
  border-radius: 10px;
  background: rgba(8, 9, 18, 0.86);
  color: #fffdfb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 0.8rem;
  font-weight: 700;
  direction: ltr;
}

.chess-training-shell__anchor-btn--right {
  right: -2px;
}

.chess-training-shell__anchor-btn--left {
  left: 0;
}

.chess-training-shell__anchor-btn--r0 {
  top: 74px;
  right: 8px;
  width: 74px;
  min-width: 74px;
}

.chess-training-shell__anchor-btn--r1 {
  top: 130px;
  right: 8px;
  width: 74px;
  min-width: 74px;
}

.chess-training-shell__anchor-btn--r2 {
  top: 186px;
  right: 8px;
  width: 74px;
  min-width: 74px;
}

.chess-training-shell__anchor-btn--r3 {
  top: 242px;
  right: 8px;
  width: 74px;
  min-width: 74px;
}

.chess-training-shell__anchor-btn--l0 {
  top: 74px;
}

.chess-training-shell__anchor-btn--l1 {
  top: 130px;
}

.chess-training-shell__anchor-btn--l2 {
  top: 186px;
  left: 0;
  width: 40px;
  min-width: 40px;
}

.chess-training-shell__anchor-btn--l3 {
  top: 186px;
  left: 44px;
  width: 40px;
  min-width: 40px;
}

.chess-training-shell__anchor-btn--l4 {
  top: 242px;
  left: 0;
  width: 40px;
  min-width: 40px;
}

.chess-training-shell__anchor-btn--l5 {
  top: 242px;
  left: 44px;
  width: 40px;
  min-width: 40px;
}

.chess-training-shell__board-column {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 92px;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 544px;
  height: 544px;
}

.chess-training-shell__board-column--uniform {
  box-sizing: border-box;
  padding: 0;
}

.chess-training-shell__icon-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  background: rgba(20,20,42,0.92);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-shadow: var(--shadow-md);
}

.chess-training-shell__icon-btn:hover,
.chess-training-shell__icon-btn.is-active {
  border-color: rgba(108,99,255,0.78);
  background: rgba(38,34,76,0.96);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}

.chess-training-shell__icon-btn:hover {
  transform: translateY(-1px);
}

.chess-training-shell__icon-btn--panel {
  width: 56px;
  min-width: 56px;
  height: 56px;
  flex-direction: column;
  gap: 1px;
}

.chess-training-shell__panel-icon {
  width: 19px;
  height: 19px;
}

.chess-training-shell__panel-arrow {
  transform: rotate(90deg);
}

.chess-training-shell__captures {
  position: absolute;
  top: 338px;
  bottom: 10px;
  width: 42px;
  display: block;
  min-height: 0;
  overflow: visible;
}

.chess-training-shell__captures--left {
  left: 42px;
}

.chess-training-shell__captures--right {
  left: -18px;
}

.chess-training-shell__captures-grid {
  width: 42px;
  height: 100%;
  display: grid;
  grid-template-columns: 18px 18px;
  column-gap: 8px;
  align-items: end;
}

.chess-training-shell__captures-column {
  position: relative;
  width: 18px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  z-index: 0;
}

.chess-training-shell__captures-column::before {
  content: "";
  position: absolute;
  inset: -4px -2px -2px;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
  z-index: -1;
}

.chess-training-shell__captures[data-capture-color="b"] .chess-training-shell__captures-column::before {
  background: rgba(226, 215, 245, 0.92);
}

.chess-training-shell__captures[data-capture-color="w"] .chess-training-shell__captures-column::before {
  background: rgba(110, 90, 164, 0.9);
}

.chess-training-shell__editor-palette {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: auto;
  min-height: 0;
}

.chess-training-shell__editor-piece {
  width: 100%;
  min-height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.chess-training-shell__editor-piece:active {
  cursor: grabbing;
}

.chess-training-shell__editor-piece:hover .chess-training-shell__captured-piece-symbol {
  filter: brightness(1.08);
}

.chess-training-shell__captures-empty {
  min-height: 14px;
}

.piece-white .chess-training-shell__captured-piece-symbol {
  color: #fffef9;
  text-shadow: 0 2px 0 rgba(0,0,0,0.24);
}

.piece-black .chess-training-shell__captured-piece-symbol {
  color: #111118;
  text-shadow: 0 1px 0 rgba(255,255,255,0.12);
}

.chess-training-shell__captured-piece {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
}

.chess-training-shell__captured-piece-symbol {
  font-size: 30px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.chess-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  direction: ltr;
}

.chess-stage__board-wrap {
  position: relative;
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
}

.chess-stage__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.chess-stage__board {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
}

.chess-stage__board-wrap {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  overflow: hidden;
  background: #18172d;
  box-shadow: 0 18px 42px rgba(0,0,0,0.35);
}

.chess-stage__board .cm-chessboard {
  width: 100%;
  height: 100%;
}

.chess-stage__board .cm-chessboard .board {
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.18));
}

.chess-stage__board .cm-chessboard .board .square.white {
  fill: var(--chess-board-light-color) !important;
}

.chess-stage__board .cm-chessboard .board .square.black {
  fill: var(--chess-board-dark-color) !important;
}

.chess-stage__board .cm-chessboard .coordinates .coordinate {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  opacity: 0.64;
}

.chess-stage__board .cm-chessboard .coordinates .coordinate.white {
  fill: rgba(88, 67, 122, 0.92) !important;
}

.chess-stage__board .cm-chessboard .coordinates .coordinate.black {
  fill: rgba(243, 236, 255, 0.78) !important;
}

.chess-stage__board .cm-chessboard .markers .marker.marker-circle-success {
  stroke: rgba(34,197,94,0.95);
  stroke-width: 2.4px;
  opacity: 0.8;
}

.chess-stage__board .cm-chessboard .arrow-success .arrow-line {
  stroke: rgba(34,197,94,0.92);
  opacity: 0.8;
}

.chess-stage__board .cm-chessboard .arrow-success .arrow-head {
  fill: rgba(34,197,94,0.95);
}

.cm-chessboard-draggable-piece {
  position: absolute;
  z-index: 9999;
  display: block;
  overflow: visible;
}

.chess-stage__board::part(board) {
  overflow: hidden;
}

.chess-stage__board::part(square) {
  transition: filter var(--transition-fast), box-shadow var(--transition-fast);
}

.chess-stage__board::part(square):hover {
  filter: brightness(1.04);
}

.chess-stage__board::part(piece) {
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.18));
}

.chess-stage__board::part(notation) {
  opacity: 0.64;
  font-family: 'Cairo', sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.chess-stage__board::part(spare-pieces) {
  gap: 4px;
  padding: 10px 0;
}

.chess-stage__notice {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(8,9,18,0.4);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.chess-stage__notice--error {
  color: #ffd7d2;
  background: rgba(48,10,14,0.48);
}

.chess-training-shell__exit-mark {
  font-size: 1.45rem;
  line-height: 1;
  transform: translateY(-1px);
}

.chess-training-confirm {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
}

.chess-training-confirm__backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(4, 5, 12, 0.62);
  cursor: pointer;
}

.chess-training-confirm__dialog {
  position: relative;
  z-index: 1;
  min-width: 260px;
  max-width: calc(100% - 32px);
  padding: 22px 20px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(24,24,46,0.98), rgba(13,13,28,0.98));
  box-shadow: 0 22px 48px rgba(0,0,0,0.42);
  direction: rtl;
  text-align: center;
}

.chess-training-confirm__title {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 800;
}

.chess-training-confirm__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.chess-training-confirm__btn {
  min-width: 84px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: rgba(255,255,255,0.04);
  color: var(--color-text);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.chess-training-confirm__btn:hover {
  transform: translateY(-1px);
  border-color: rgba(108,99,255,0.62);
}

.chess-training-confirm__btn--danger {
  border-color: rgba(231,76,60,0.58);
  background: rgba(231,76,60,0.14);
  color: #ffd7d2;
}

@media (max-width: 1180px) {
  .game-options-grid--chess {
    grid-template-columns: 1fr;
  }

  .chess-training-drawer__body {
    width: min(700px, calc(100% - 20px));
  }

  .chess-training-drawer__grid {
    grid-template-columns: 1fr;
  }

  .chess-home__layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "times"
      "actions";
  }

  .chess-home__status-pills {
    grid-template-columns: 1fr;
  }

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

  .chess-home__increments {
    grid-template-columns: 1fr;
  }

  .chess-training-shell__icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .chess-training-shell__icon-btn--panel {
    width: 50px;
    min-width: 50px;
    height: 50px;
  }

  .chess-training-shell__stage {
    --chess-stage-rail-width: 50px;
  }

}

@media (max-width: 720px) {
  .chess-waiting__list {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .chess-waiting-card {
    padding: 12px;
  }

  .chess-waiting-card__summary {
    grid-template-columns: 84px 46px 46px 84px;
    gap: 10px;
  }
}

@media (max-width: 1024px) {
  .chess-training-drawer__body {
    width: min(92%, calc(100% - 18px));
  }

  .chess-training-drawer__mode-switch,
  .chess-training-drawer__choices,
  .chess-training-drawer__toolbar {
    gap: 8px;
  }

  .chess-training-drawer__mode-btn,
  .chess-training-drawer__choice-btn,
  .chess-training-drawer__action-btn {
    padding: 9px 12px;
    font-size: 0.8rem;
  }

  .chess-training-shell__stage {
    --chess-stage-rail-width: 46px;
  }

  .chess-training-shell__captured-piece-symbol {
    font-size: clamp(16px, 1.8vw, 22px);
  }
}

/* Neutral theme cleanup overrides */

.game-select-container--root {
  background-color: var(--bg-primary);
  background-image: none;
}

.game-select-container--root .game-select__title {
  color: var(--text-main);
  text-shadow: none;
}

.game-card.selected {
  border-color: var(--border-strong);
  background-color: var(--surface-hover);
  box-shadow: var(--shadow-glow);
}

.game-card {
  background: var(--surface-color);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.game-card--chess .game-card__icon,
.game-card--billiard .game-card__icon,
.game-card--domino .game-card__icon {
  color: var(--text-secondary);
}

.game-options-panel {
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}

.game-options-panel--practice {
  border-color: var(--border-medium);
  background: var(--surface-muted);
}

.game-mode-btn.active {
  background-color: var(--link-color);
  border-color: var(--border-strong);
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow);
}

.game-start-btn,
.challenge-card__cta,
.chess-hub__state-btn,
.chess-home__primary-action,
[data-chess-home-actions="1"] .chess-home__primary-action,
.chess-home__challenge-send,
.chess-home__custom-btn--confirm,
.chess-training-drawer__action-btn--primary {
  background: var(--link-color);
  border-color: var(--link-color);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.game-start-btn:hover,
.chess-home__primary-action:hover,
[data-chess-home-actions="1"] .chess-home__primary-action:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  box-shadow: var(--shadow-md);
}

.game-frame__exit-btn {
  background: var(--surface-muted);
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.panel--chess-training-center,
.chess-hub__body,
.chess-hub__empty,
.chess-home__panel,
.chess-home__challenge-card,
.chess-training-shell__bottom,
.chess-live-left,
.chess-stage__board-wrap {
  background: var(--surface-elevated);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.chess-training-shell__hub-placeholder {
  background: var(--surface-color);
  border-color: var(--border-light);
}

.chess-training-shell__back-btn,
.chess-hub__back-btn,
.chess-training-shell__icon-btn,
.chess-training-shell__anchor-btn,
.chess-home__time-btn,
.chess-home__increment-btn,
.chess-home__color-btn,
.chess-home__challenge-picker,
.chess-home__custom-btn,
.chess-training-shell__mode-btn,
.chess-training-drawer__mode-btn,
.chess-training-drawer__choice-btn,
.chess-training-drawer__action-btn {
  background: var(--surface-color);
  color: var(--text-main);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.chess-training-shell__back-btn:hover,
.chess-hub__back-btn:hover,
.chess-training-shell__icon-btn:hover,
.chess-training-shell__icon-btn.is-active,
.chess-home__time-btn:hover,
.chess-home__increment-btn:hover,
.chess-home__secondary-action:hover,
.chess-home__challenge-picker:hover,
.chess-home__color-btn:hover,
.chess-training-shell__mode-btn:hover,
.chess-training-shell__mode-btn.is-active,
.chess-training-drawer__mode-btn:hover,
.chess-training-drawer__choice-btn:hover,
.chess-training-drawer__action-btn:hover,
.chess-training-drawer__mode-btn.is-active,
.chess-training-drawer__choice-btn.is-active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: var(--shadow-glow);
}

.chess-hub__header {
  background: var(--surface-color);
  border-color: var(--border-light);
}

.chess-hub__tab {
  background: var(--surface-color);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.chess-hub__tab:hover {
  background: var(--surface-hover);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.chess-hub__tab.is-active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: var(--shadow-glow);
}

.chess-hub__queue-indicator {
  background: var(--surface-color);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.chess-hub__queue-indicator[data-queue-indicator-state="running"] {
  border-color: var(--success-color);
}

.chess-hub__queue-indicator[data-queue-indicator-state="paused"] {
  border-color: var(--warning-color);
}

.chess-hub__queue-indicator[data-queue-indicator-state="stopped"] {
  border-color: var(--border-medium);
}

.chess-hub__queue-indicator-action,
.chess-hub__state-meta,
.chess-hub__live-badge,
.chess-live-left__badge {
  color: var(--link-color);
}

.chess-waiting,
.chess-hub__state-card {
  background: var(--surface-color);
}

.chess-waiting__title,
.chess-waiting__empty strong,
.chess-waiting-card__avatar-fallback,
.chess-waiting-card__player-name,
.chess-waiting-card__rating-title,
.chess-waiting-card__rating-value,
.chess-hub__waiting-item-value,
.chess-home__challenge-title,
.chess-home__custom-title,
.chess-live-left__title,
.chess-live-left__status,
.chess-live-left__clock-value {
  color: var(--text-main);
}

.chess-waiting__subtitle,
.chess-hub__state-text,
.chess-waiting-card__token-label,
.chess-waiting-card__rating-state,
.chess-home__challenge-option-meta,
.chess-home__challenge-or,
.chess-home__challenge-picker-state,
.chess-home__custom-field,
.chess-home__challenge-input::placeholder,
.chess-live-left__subtitle,
.chess-live-left__meta,
.chess-live-left__empty,
.chess-live-left__clock-name,
.chess-live-left__move-index {
  color: var(--text-secondary);
}

.chess-waiting__note,
.chess-hub__waiting-note {
  background: var(--surface-muted);
  border-color: var(--warning-color);
  color: var(--warning-color);
}

.chess-waiting__empty,
.chess-hub__waiting-item,
.chess-home__challenge-menu,
.chess-training-drawer__card,
.chess-live-left__card,
.chess-live-left__clock-card,
.chess-live-left__move-cell {
  background: var(--surface-color);
  border-color: var(--border-light);
}

.chess-waiting-card {
  background: var(--surface-color);
  border-color: var(--border-strong);
}

.chess-waiting-card.is-clickable:hover {
  background: var(--surface-hover);
  border-color: var(--link-color);
}

.chess-waiting-card.is-clickable:focus-visible,
.chess-waiting-card__profile:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

.chess-waiting-card__avatar,
.chess-home__challenge-option:hover,
.chess-home__challenge-option.is-active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.chess-waiting-card__rating {
  background: var(--surface-color);
  border-color: var(--border-strong);
}

.chess-waiting-card__time {
  color: var(--text-main);
}

.chess-hub__waiting-ring {
  border-color: var(--border-medium);
  box-shadow: none;
}

.chess-hub__waiting-core {
  background: var(--surface-hover);
  box-shadow: var(--shadow-sm);
}

.chess-hub__waiting-item-label,
.chess-home__challenge-picker-state,
.chess-live-left__label {
  color: var(--text-muted);
}

.chess-hub__state-btn--ghost,
.chess-home__secondary-action,
[data-chess-home-actions="1"] .chess-home__secondary-action,
.chess-home__color-btn,
.chess-home__challenge-picker,
.chess-home__custom-btn--cancel {
  background: var(--surface-color);
  border-color: var(--border-medium);
  color: var(--text-main);
}

[data-chess-home-actions="1"] .chess-home__secondary-action:hover {
  background: var(--surface-hover);
  border-color: var(--link-color);
  color: var(--text-main);
}

.chess-home__time-btn,
.chess-home__increment-btn {
  background: var(--surface-color);
  border-color: var(--border-strong);
  color: var(--text-main);
}

.chess-home__time-btn.is-active,
.chess-home__increment-btn.is-active,
.chess-home__color-btn.is-active,
.chess-home__challenge-picker.is-selected {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text-main);
  box-shadow: var(--shadow-glow);
}

.chess-home__color-card,
.chess-home__challenge-card,
.chess-home__custom-card {
  background: var(--surface-color);
  border-color: var(--border-light);
}

.chess-home__color-options > * + * {
  border-inline-start-color: var(--border-light);
}

.chess-home__challenge-send:disabled {
  background: var(--surface-muted);
  border-color: var(--border-light);
  color: var(--text-muted);
}

.chess-home__challenge-picker-state--error,
.chess-stage__notice--error,
.chess-training-confirm__btn--danger {
  background: var(--surface-muted);
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.chess-home__challenge-option {
  border-bottom-color: var(--border-light);
  color: var(--text-main);
}

.chess-home__custom-overlay,
.chess-training-drawer__backdrop,
.chess-training-confirm__backdrop {
  background: var(--bg-secondary);
}

.chess-home__custom-card,
.chess-training-confirm__dialog {
  background: var(--surface-elevated);
  border-color: var(--border-light);
  box-shadow: var(--shadow-lg);
}

.chess-home__custom-field input,
.chess-home__challenge-input,
.chess-training-drawer__fen-input {
  background: var(--surface-color);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.chess-home__custom-preview,
.chess-training-drawer__status,
.chess-training-drawer__substatus {
  background: var(--surface-muted);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.chess-training-drawer__body,
.chess-training-drawer__body--empty {
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
}

.chess-training-drawer__slider {
  background: var(--border-medium);
}

.chess-training-drawer__slider::-webkit-slider-runnable-track,
.chess-training-drawer__slider::-moz-range-track {
  background: var(--border-strong);
}

.chess-training-shell__play-surface {
  background: var(--surface-color);
  --chess-board-light-color: var(--surface-color);
  --chess-board-dark-color: var(--bg-tertiary);
}

.chess-training-shell__anchor-btn.is-cancel-state,
.chess-training-shell__anchor-btn[title="استسلام"] {
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.chess-live-left__card,
.chess-live-left__clock-card,
.chess-live-left__move-cell {
  background: var(--surface-color);
  border-color: var(--border-light);
}

.chess-live-left__clock-card.is-active {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-glow);
}

.chess-training-shell__captures-column::before {
  box-shadow: var(--shadow-sm);
}

.chess-training-shell__captures[data-capture-color="b"] .chess-training-shell__captures-column::before {
  background: var(--bg-tertiary);
}

.chess-training-shell__captures[data-capture-color="w"] .chess-training-shell__captures-column::before {
  background: var(--surface-color);
}

.piece-white .chess-training-shell__captured-piece-symbol {
  color: var(--surface-color);
  text-shadow: none;
}

.piece-black .chess-training-shell__captured-piece-symbol {
  color: var(--text-main);
  text-shadow: none;
}

.chess-stage__board-wrap {
  background: var(--surface-color);
  box-shadow: var(--shadow-lg);
}

.chess-stage__board .cm-chessboard .board,
.chess-stage__board::part(piece) {
  filter: none;
}

.chess-stage__board .cm-chessboard .coordinates .coordinate.white {
  fill: var(--text-secondary) !important;
}

.chess-stage__board .cm-chessboard .coordinates .coordinate.black {
  fill: var(--text-main) !important;
}

.chess-stage__board .cm-chessboard .markers .marker.marker-circle-success,
.chess-stage__board .cm-chessboard .arrow-success .arrow-line {
  stroke: var(--success-color);
}

.chess-stage__board .cm-chessboard .arrow-success .arrow-head {
  fill: var(--success-color);
}

.chess-stage__notice {
  background: var(--surface-muted);
  color: var(--text-main);
}

.chess-training-confirm__dialog {
  background: var(--surface-elevated);
  border-color: var(--border-light);
}

.chess-training-confirm__btn {
  background: var(--surface-color);
  border-color: var(--border-medium);
  color: var(--text-main);
}

.chess-training-confirm__btn:hover {
  background: var(--surface-hover);
  border-color: var(--link-color);
}
