/* Tailwind handles menu screen styles. Custom overrides below. */

/* Ensure decorative bg dots in landing don't block interactions */
#bg-dot-grid {
  pointer-events: none;
}

/* ── Reusable 3D game buttons (PLAY / CONTINUE style) ─────────── */
.game-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 14px 20px;
  border: none;
  border-radius: 18px;
  font-family: 'Lilita One', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.game-btn__icon {
  flex-shrink: 0;
}

.game-btn--gold {
  background: linear-gradient(180deg, #FFE580 0%, #FFC93C 42%, #F5940C 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(140, 60, 0, 0.35),
    0 7px 0 0 #B85E00,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--blue {
  background: linear-gradient(180deg, #7FD3FF 0%, #2E9BFF 45%, #0B62D6 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(0, 40, 110, 0.35),
    0 7px 0 0 #0A3F8F,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px) scale(1.015);
}

.game-btn:active:not(:disabled),
.game-btn.is-pressed:not(:disabled) {
  transform: translateY(4px);
}

.game-btn--gold:active:not(:disabled),
.game-btn--gold.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(140, 60, 0, 0.35),
    0 2px 0 0 #B85E00,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn--blue:active:not(:disabled),
.game-btn--blue.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(0, 40, 110, 0.35),
    0 2px 0 0 #0A3F8F,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55) brightness(0.75);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    0 4px 0 0 rgba(0, 0, 0, 0.25);
  opacity: 0.75;
}

/* ── Additional glossy color variants ─────────────────────────── */
.game-btn--green {
  background: linear-gradient(180deg, #9BF0A8 0%, #4CC966 45%, #229A3E 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(0, 60, 10, 0.35),
    0 7px 0 0 #167A2C,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--green:active:not(:disabled),
.game-btn--green.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(0, 60, 10, 0.35),
    0 2px 0 0 #167A2C,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn--purple {
  background: linear-gradient(180deg, #D8AFFF 0%, #A855F7 45%, #7E22CE 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(60, 0, 90, 0.35),
    0 7px 0 0 #581C87,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--purple:active:not(:disabled),
.game-btn--purple.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(60, 0, 90, 0.35),
    0 2px 0 0 #581C87,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn--orange {
  background: linear-gradient(180deg, #FFB870 0%, #FF8A1E 45%, #D9560A 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(90, 30, 0, 0.35),
    0 7px 0 0 #A03D00,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--orange:active:not(:disabled),
.game-btn--orange.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(90, 30, 0, 0.35),
    0 2px 0 0 #A03D00,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn--red {
  background: linear-gradient(180deg, #FF9E9E 0%, #F04747 45%, #B91C1C 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(90, 0, 0, 0.35),
    0 7px 0 0 #7F1414,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--red:active:not(:disabled),
.game-btn--red.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 6px rgba(90, 0, 0, 0.35),
    0 2px 0 0 #7F1414,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.game-btn--dark {
  background: linear-gradient(180deg, #4A6178 0%, #2C3E50 45%, #16222D 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -5px 6px rgba(0, 0, 0, 0.35),
    0 7px 0 0 #0F1A24,
    0 10px 16px rgba(0, 0, 0, 0.35);
}

.game-btn--dark:active:not(:disabled),
.game-btn--dark.is-pressed:not(:disabled) {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.25),
    inset 0 -5px 6px rgba(0, 0, 0, 0.35),
    0 2px 0 0 #0F1A24,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

/* ── Button shape modifiers ────────────────────────────────────── */
.game-btn--round {
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  flex-shrink: 0;
  /* circular buttons need a soft radial shadow, not the flat rectangular
     "ledge" shadow used by chunky rect buttons — that shadow's straight
     bottom edge peeks out past the curved corners and reads as a gap */
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    inset 0 -4px 6px rgba(0, 0, 0, 0.35),
    0 3px 6px rgba(0, 0, 0, 0.35) !important;
}

.game-btn--round:active:not(:disabled),
.game-btn--round.is-pressed:not(:disabled) {
  transform: translateY(2px) !important;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.55),
    inset 0 -3px 4px rgba(0, 0, 0, 0.35),
    0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.game-btn--square {
  width: 48px;
  height: 48px;
  min-height: 0;
  padding: 0;
  border-radius: 12px;
  flex-shrink: 0;
}

.game-btn--large {
  min-height: 62px;
  font-size: 1.25rem;
  border-radius: 20px;
}

.game-btn--pill {
  min-height: 46px;
  border-radius: 14px;
  font-size: 0.95rem;
}

/* ═══════════════════════════════════════════════════════════════
   GAME SETUP SCREEN — wooden carved panel theme
   ═══════════════════════════════════════════════════════════════ */

.setup-bg {
  background-color: #1a1208;
  background-image:
    linear-gradient(rgba(10, 8, 4, 0.55), rgba(10, 8, 4, 0.55)),
    url('../assets/bg-board.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

@supports (-webkit-touch-callout: none) {
  .setup-bg {
    background-attachment: scroll, scroll;
  }
}

.setup-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: linear-gradient(180deg, #6B4A30 0%, #4E3420 55%, #3A2617 100%);
  border: 6px solid #2A1B0F;
  border-radius: 28px;
  padding: 20px 18px 24px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.08),
    inset 0 -10px 22px rgba(0, 0, 0, 0.45),
    0 14px 28px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.setup-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 20px;
}

.setup-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.setup-header .game-btn--round {
  position: absolute;
  left: 0;
}

.setup-ribbon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(190px, 58vw, 280px);
  aspect-ratio: 951 / 260;
  background: url('../assets/blue-banner.png') no-repeat center / 100% 100%;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.4));
}

.setup-ribbon span {
  font-family: 'Lilita One', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(-22%);
}

.setup-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

.setup-label {
  font-family: 'Lilita One', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 225, 190, 0.65);
}

/* ── Mode cards ── */
.mode-grid {
  display: flex;
  gap: 10px;
}

.toggle-btn-card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 12px;
  border-radius: 16px;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Lilita One', sans-serif;
}

.toggle-btn-card[data-value="bot"] {
  background: linear-gradient(180deg, #6FC5FF 0%, #2E86E0 55%, #1660B0 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 0 0 #0F4A8A, 0 8px 14px rgba(0, 0, 0, 0.35);
}

.toggle-btn-card[data-value="friend"] {
  background: linear-gradient(180deg, #D8AFFF 0%, #A855F7 55%, #7E22CE 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 0 0 #581C87, 0 8px 14px rgba(0, 0, 0, 0.35);
}

.toggle-btn-card.active {
  border-color: #FFD700;
  box-shadow:
    0 0 0 3px rgba(255, 215, 0, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.5),
    0 5px 0 0 rgba(0, 0, 0, 0.3),
    0 8px 16px rgba(0, 0, 0, 0.4);
}

.toggle-btn-card::before {
  content: '';
  position: absolute;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  box-shadow: 0 0 10px 3px rgba(255, 215, 0, 0.9);
  transition: opacity 0.15s ease;
}

.toggle-btn-card.active::before {
  opacity: 1;
}

.toggle-btn-card img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.toggle-btn-card .mode-label {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ── Name field ── */
.name-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #241811;
  border: 2px solid rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  padding: 6px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

.name-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #6FC5FF 0%, #2E86E0 55%, #1660B0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.name-avatar--purple {
  background: linear-gradient(180deg, #D8AFFF 0%, #A855F7 55%, #7E22CE 100%);
}

.name-field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'Lilita One', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 6px 4px;
}

.name-field input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.name-edit {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #6FC5FF 0%, #2E86E0 55%, #1660B0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 3px 0 0 #0F4A8A;
  transition: transform 0.07s;
}

.name-edit:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 0 0 #0F4A8A;
}

/* ── Board size row ── */
.size-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.size-pill {
  flex: 1;
  text-align: center;
  background: #241811;
  border: 2px solid rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  padding: 12px 10px;
  font-family: 'Lilita One', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: #fff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ── Difficulty pills ── */
.difficulty-row {
  display: flex;
  gap: 10px;
}

.difficulty-row .toggle-btn {
  flex: 1;
  padding: 13px 0;
  border-radius: 14px;
  border: 3px solid transparent;
  font-family: 'Lilita One', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: all 0.15s ease;
}

.difficulty-row .toggle-btn[data-value="easy"] {
  background: linear-gradient(180deg, #5FAE6E 0%, #21622f 50%, #063711 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 5px 0 0 #0F4A1B, 0 8px 14px rgba(0, 0, 0, 0.3);
}

.difficulty-row .toggle-btn[data-value="smart"] {
  background: linear-gradient(180deg, #FFE580 0%, #FFC93C 50%, #F5940C 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 0 0 #B85E00, 0 8px 14px rgba(0, 0, 0, 0.3);
}

.difficulty-row .toggle-btn:not(.active) {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.difficulty-row .toggle-btn.active {
  border-color: rgba(255, 255, 255, 0.85);
  opacity: 1;
  filter: none;
}

/* ── Compact layout: small / short viewports (fit one screen, no scroll) ── */
@media (max-width: 600px),
(max-height: 760px) {
  .setup-view {
    padding: 58px 10px 12px;
  }

  .setup-frame {
    padding: 12px 12px 14px;
    gap: 9px;
    border-width: 4px;
    border-radius: 20px;
  }

  .setup-section {
    gap: 4px;
  }

  .setup-ribbon {
    width: clamp(150px, 54vw, 220px);
  }

  .setup-ribbon span {
    font-size: 0.85rem;
  }

  .game-btn--round {
    width: 36px;
    height: 36px;
  }

  .game-btn--round svg {
    width: 15px;
    height: 15px;
  }

  .setup-label {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  .mode-grid {
    gap: 8px;
  }

  .toggle-btn-card {
    padding: 8px 6px 7px;
    gap: 3px;
    border-width: 2px;
  }

  .toggle-btn-card img {
    width: 36px;
    height: 36px;
  }

  .toggle-btn-card .mode-label {
    font-size: 0.65rem;
  }

  .toggle-btn-card::before {
    top: 4px;
    width: 6px;
    height: 6px;
  }

  .name-field {
    padding: 4px;
    gap: 8px;
    border-radius: 12px;
  }

  .name-avatar,
  .name-edit {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .name-field input {
    font-size: 0.9rem;
    padding: 4px;
  }

  .size-row {
    gap: 8px;
  }

  .game-btn--square {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .size-pill {
    padding: 8px 8px;
    font-size: 1.15rem;
    border-radius: 12px;
  }

  .difficulty-row {
    gap: 8px;
  }

  .difficulty-row .toggle-btn {
    padding: 9px 0;
    font-size: 0.72rem;
    border-radius: 12px;
  }

  .game-btn--large {
    min-height: 46px;
    font-size: 0.95rem;
    border-radius: 16px;
    gap: 6px;
  }
}

/* ── Extra-compact: very short viewports (landscape phones) ── */
@media (max-height: 480px) {
  .setup-view {
    padding: 10px 10px 6px;
    align-items: center;
    justify-content: flex-start;
  }

  .setup-frame {
    padding: 8px 10px 10px;
    gap: 5px;
    border-width: 3px;
    border-radius: 16px;
  }

  .setup-section {
    gap: 2px;
  }

  .setup-ribbon {
    width: clamp(120px, 30vw, 170px);
  }

  .setup-ribbon span {
    font-size: 0.7rem;
  }

  .game-btn--round {
    width: 28px;
    height: 28px;
  }

  .game-btn--round svg {
    width: 12px;
    height: 12px;
  }

  .setup-label {
    font-size: 0.52rem;
  }

  .mode-grid {
    gap: 6px;
  }

  .toggle-btn-card {
    padding: 5px 6px 5px;
    gap: 2px;
  }

  .toggle-btn-card img {
    width: 24px;
    height: 24px;
  }

  .toggle-btn-card .mode-label {
    font-size: 0.56rem;
  }

  .name-field {
    padding: 3px;
    gap: 6px;
  }

  .name-avatar,
  .name-edit {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }

  .name-avatar svg,
  .name-edit svg {
    width: 13px;
    height: 13px;
  }

  .name-field input {
    font-size: 0.78rem;
    padding: 2px;
  }

  .size-row {
    gap: 6px;
  }

  .game-btn--square {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .game-btn--square .material-symbols-outlined {
    font-size: 1rem;
  }

  .size-pill {
    padding: 5px 8px;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  .difficulty-row {
    gap: 6px;
  }

  .difficulty-row .toggle-btn {
    padding: 5px 0;
    font-size: 0.62rem;
    border-radius: 10px;
  }

  .game-btn--large {
    min-height: 34px;
    font-size: 0.8rem;
    border-radius: 12px;
    gap: 4px;
  }

  .game-btn--large .material-symbols-outlined {
    font-size: 1.1rem;
  }
}