/* ==========================================================================
   Bagh-Chal (Тигры и Козы) — Authentic Nepalese Board Game Stylesheet
   Warm Himalayan Gold, Dark Wood, Parchment, Brass & Turquoise Palette
   ========================================================================== */

:root {
  --bg-dark: #0f141a;
  --bg-card: rgba(22, 29, 39, 0.92);
  --bg-card-border: rgba(212, 168, 83, 0.25);
  --text-main: #f0f4f8;
  --text-muted: #9baec2;
  --gold-primary: #d4a853;
  --gold-glow: rgba(212, 168, 83, 0.4);
  --tiger-color: #ff7722;
  --tiger-glow: rgba(255, 119, 34, 0.45);
  --goat-color: #38bdf8;
  --goat-glow: rgba(56, 189, 248, 0.45);
  --board-wood: #2a1e12;
  --board-parchment: #f7f1e1;
  --board-line: #3b2a1a;
  --board-rosette: #9e7236;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(212, 168, 83, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(255, 119, 34, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(56, 189, 248, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Top Header ── */
.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: rgba(15, 20, 26, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 168, 83, 0.2);
  z-index: 50;
  height: 52px;
  flex-shrink: 0;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-primary);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  background: rgba(212, 168, 83, 0.15);
  border: 1px solid rgba(212, 168, 83, 0.4);
  border-radius: 12px;
  color: #ecd29b;
  text-transform: uppercase;
}

.top-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.top-btn:hover {
  background: rgba(212, 168, 83, 0.18);
  border-color: var(--gold-primary);
  color: #fff;
  transform: translateY(-1px);
}

.profile-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(212, 168, 83, 0.3);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.profile-pill:hover {
  background: rgba(212, 168, 83, 0.15);
  border-color: var(--gold-primary);
}

.profile-pill .pill-avatar {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 168, 83, 0.2);
  border-radius: 50%;
  font-size: 0.95rem;
}

.profile-pill .pill-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

/* ── Main Layout ── */
.app-main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  gap: 16px;
  height: calc(100vh - 48px);
  min-height: 0;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ── Left & Right Sidebars ── */
.sidebar {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(78vh, 620px);
  max-height: calc(100vh - 80px);
  justify-content: flex-start;
  align-self: center;
}

.sidebar-right .actions-row {
  margin-top: auto;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

.card-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gold-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Mode & Side Selectors ── */
.choice-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.choice-btn {
  flex: 1;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.choice-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.choice-btn.active {
  background: rgba(212, 168, 83, 0.2);
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(212, 168, 83, 0.2);
}

/* ── Status Banner & Turn Indicator ── */
.turn-panel-card {
  position: relative;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.turn-panel-card.timer-warning {
  border-color: #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.45) !important;
}

.timer-badge {
  font-family: 'Consolas', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.turn-banner.is-goat {
  border-color: var(--goat-color);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(15, 23, 42, 0.6) 100%);
  box-shadow: 0 0 16px var(--goat-glow);
}

.turn-banner.is-tiger {
  border-color: var(--tiger-color);
  background: linear-gradient(135deg, rgba(255, 119, 34, 0.18) 0%, rgba(20, 10, 5, 0.6) 100%);
  box-shadow: 0 0 16px var(--tiger-glow);
}

.turn-avatar-box {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.turn-banner.is-goat .turn-avatar-box {
  border-color: var(--goat-color);
}

.turn-banner.is-tiger .turn-avatar-box {
  border-color: var(--tiger-color);
}

.turn-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.turn-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: turnPulseRing 1.8s infinite ease-out;
  pointer-events: none;
}

.turn-banner.is-goat .turn-pulse-ring {
  color: var(--goat-color);
}

.turn-banner.is-tiger .turn-pulse-ring {
  color: var(--tiger-color);
}

@keyframes turnPulseRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.turn-texts {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.turn-who-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: #10b981;
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.turn-who-tag.is-ai {
  background: #f59e0b;
  color: #111;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.turn-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.phase-tag {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--gold-primary);
  font-weight: 600;
}

/* ── 60-Second Timer UI ── */
.turn-timer-container {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 6px;
  transition: all 0.3s ease;
}

.turn-timer-container.is-critical {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  animation: timerBorderPulse 0.8s infinite alternate ease-in-out;
}

@keyframes timerBorderPulse {
  0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.3); }
  100% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.7); }
}

.timer-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.timer-desc-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 600;
}

.timer-countdown {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: 'Consolas', monospace;
}

.timer-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  transition: color 0.2s ease;
}

.turn-timer-container.is-critical .timer-num {
  color: #ff4d4d;
  animation: timerNumShake 0.4s infinite ease-in-out;
}

@keyframes timerNumShake {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.timer-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.turn-timer-container.is-critical .timer-unit {
  color: #ff7777;
}

.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #d4a853 100%);
  border-radius: 3px;
  transition: width 0.2s linear, background 0.3s ease;
}

.turn-timer-container.is-critical .timer-progress-fill {
  background: linear-gradient(90deg, #ef4444 0%, #ff7722 100%);
}

.timer-subtext {
  font-size: 0.65rem;
  color: #8fa0b5;
  margin-top: 4px;
  text-align: center;
}

/* ── Turn Alert Toast ── */
.turn-alert-box {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #fca5a5;
  font-size: 0.74rem;
  font-weight: 600;
  text-align: center;
  animation: alertFadeIn 0.3s ease;
}

@keyframes alertFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Tiger Status Indicators ── */
.tiger-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.tiger-status-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 119, 34, 0.3);
  border-radius: 8px;
  font-size: 0.72rem;
  transition: all 0.2s;
}

.tiger-status-slot.trapped {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.15);
  filter: grayscale(0.8);
}

.tiger-status-slot .slot-icon {
  font-size: 1.1rem;
}

.tiger-status-slot .slot-text {
  font-size: 0.62rem;
  margin-top: 2px;
  font-weight: 600;
}

/* ── Goat Reserve Tray (5 columns x 4 rows grid) ── */
.goat-reserve-tray {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-top: 6px;
}

.goat-token {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--goat-color);
  transition: all 0.25s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.goat-token.placed {
  opacity: 0.15;
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
  transform: scale(0.85);
  box-shadow: none;
}

/* ── Captured Goats Tray ── */
.captured-tray {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin-top: 6px;
}

.captured-slot {
  flex: 1;
  height: 38px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all 0.3s ease;
}

.captured-slot.eaten {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
  animation: captureBounce 0.4s ease;
}

@keyframes captureBounce {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Tactical Assistance Cards (3 Uses Each) ── */
.tactics-card {
  display: flex;
  flex-direction: column;
}

.charges-info {
  font-size: 0.68rem;
  color: var(--gold-primary);
  font-weight: 600;
}

.tactics-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.tactic-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 168, 83, 0.25);
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.tactic-btn:hover:not(:disabled) {
  background: rgba(212, 168, 83, 0.18);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212, 168, 83, 0.2);
}

.tactic-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(0.8);
  border-color: rgba(255, 255, 255, 0.08);
}

.tactic-btn-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tactic-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.tactic-texts {
  display: flex;
  flex-direction: column;
}

.tactic-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
}

.tactic-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.charge-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border-radius: 20px;
  background: rgba(10, 15, 24, 0.7);
  border: 1px solid rgba(212, 168, 83, 0.35);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
}

.charge-symbol-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.charge-symbol-dot svg {
  display: block;
  pointer-events: none;
}

/* Active charge: bright glowing gold coin */
.charge-symbol-dot.active {
  background: radial-gradient(circle at 35% 35%, #ffe494 0%, #d4a853 60%, #8c631a 100%);
  color: #1f1406;
  border: 1.5px solid #fff2d1;
  box-shadow: 0 0 10px rgba(212, 168, 83, 0.65), 0 2px 4px rgba(0, 0, 0, 0.4);
  transform: scale(1);
}

.charge-symbol-dot.active:hover {
  transform: scale(1.18);
  box-shadow: 0 0 14px rgba(212, 168, 83, 0.9);
}

/* Locked for current turn: distinct cool gray coin (available next turn) */
.charge-symbol-dot.locked {
  background: radial-gradient(circle at 35% 35%, #475569 0%, #334155 70%, #1e293b 100%);
  color: #94a3b8;
  border: 1.5px solid #64748b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: scale(0.95);
  filter: grayscale(1);
  opacity: 0.75;
}

.charge-symbol-dot.locked:hover {
  transform: scale(1.04);
  color: #cbd5e1;
}

/* Spent / used charge: dimmed dashed coin */
.charge-symbol-dot.spent {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.18);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  opacity: 0.4;
  transform: scale(0.88);
  box-shadow: none;
}

.tactic-btn:disabled .charge-badge {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ── Control Actions ── */
.actions-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.act-btn {
  flex: 1;
  padding: 7px 6px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

.act-btn:hover {
  background: rgba(212, 168, 83, 0.25);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.act-btn.primary {
  background: linear-gradient(135deg, #d4a853 0%, #a67c2e 100%);
  color: #1a120b;
  font-weight: 700;
  border: none;
}

.act-btn.primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px rgba(212, 168, 83, 0.4);
}

/* ==========================================================================
   THE AUTHENTIC NEPALI BOARD (Centerpiece)
   ========================================================================== */
.board-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.nepal-board-frame {
  position: relative;
  /* Maintain square aspect ratio and fit viewport height */
  aspect-ratio: 1 / 1;
  height: min(78vh, 620px);
  max-width: min(calc(100vw - 540px), min(78vh, 620px));
  max-height: calc(100vh - 80px);
  background: #c89d47;
  border-radius: 12px;
  box-shadow: 
    0 16px 40px rgba(0, 0, 0, 0.7),
    0 0 0 4px #5c421e,
    0 0 0 8px #d4a853,
    0 0 25px rgba(212, 168, 83, 0.35);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* The ornate border replicating the traditional art uploaded by user */
.nepal-board-frame::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid #5a3d1b;
  border-radius: 8px;
  pointer-events: none;
}

/* Ornamental corner patterns */
.corner-ornament {
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  opacity: 0.85;
}

.corner-top-left { top: 6px; left: 6px; }
.corner-top-right { top: 6px; right: 6px; transform: scaleX(-1); }
.corner-bottom-left { bottom: 6px; left: 6px; transform: scaleY(-1); }
.corner-bottom-right { bottom: 6px; right: 6px; transform: scale(-1, -1); }

/* Border decorative labels replicating Tigers and Goats running around border */
.border-decor-top, .border-decor-bottom {
  position: absolute;
  left: 36px;
  right: 36px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 0.75rem;
  color: #4a3418;
  opacity: 0.9;
  pointer-events: none;
  font-weight: 600;
  letter-spacing: 2px;
}

.border-decor-top { top: 4px; }
.border-decor-bottom { bottom: 4px; }

.border-decor-left, .border-decor-right {
  position: absolute;
  top: 36px;
  bottom: 36px;
  width: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  font-size: 0.75rem;
  color: #4a3418;
  opacity: 0.9;
  pointer-events: none;
}

.border-decor-left { left: 4px; }
.border-decor-right { right: 4px; }

/* Inner board field with parchment texture and green inner border */
.nepal-inner-field {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fdfaf3;
  border: 4px solid #485c34; /* Traditional deep forest green border */
  border-radius: 4px;
  box-shadow: inset 0 0 16px rgba(59, 42, 26, 0.2);
}

/* SVG Board Layer (Lines, Mandala Rosettes) */
.board-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Interactive Board Layer (Nodes and Pieces) */
.board-interactive-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Node intersection hotspots */
.board-node {
  position: absolute;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.board-node.animating-node {
  z-index: 40;
  pointer-events: none;
}

/* Hover over empty node */
.board-node.can-place:hover,
.board-node.can-move-to:hover {
  transform: translate(-50%, -50%) scale(1.15);
}

/* Indicator ring when a node is a valid destination */
.board-node.can-move-to::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.55);
  box-shadow: 0 0 10px var(--gold-glow);
  animation: pulseTarget 1.2s infinite ease-in-out;
  pointer-events: none;
}

.board-node.can-jump-to::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
  animation: pulseCapture 1s infinite ease-in-out;
  pointer-events: none;
}

.board-node.hint-target::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #10b981;
  background: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.9);
  animation: pulseCapture 0.9s infinite ease-in-out;
  pointer-events: none;
}

@keyframes pulseTarget {
  0%, 100% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

@keyframes pulseCapture {
  0%, 100% { transform: scale(0.85); opacity: 0.7; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* Pieces styling */
.piece {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  position: relative;
}

/* Tiger Piece: Royal Bengal Tiger Token */
.piece.tiger {
  background: radial-gradient(circle at 35% 35%, #ff944d 0%, #d45500 70%, #802b00 100%);
  border: 2px solid #ffe1a6;
  box-shadow: 0 4px 12px rgba(212, 85, 0, 0.5);
  color: #fff;
}

.piece.tiger:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 16px var(--tiger-glow);
}

.piece.tiger.selected {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px #fff, 0 0 18px var(--tiger-color);
  animation: tigerProwl 1.5s infinite alternate ease-in-out;
}

@keyframes tigerProwl {
  0% { transform: scale(1.15); }
  100% { transform: scale(1.22); }
}

.piece.tiger.trapped {
  filter: grayscale(0.7) brightness(0.8);
  border-color: #ef4444;
}

/* Goat Piece: Himalayan Mountain Goat Token */
.piece.goat {
  background: radial-gradient(circle at 35% 35%, #60a5fa 0%, #1e40af 80%, #0f172a 100%);
  border: 2px solid #bfdbfe;
  box-shadow: 0 4px 10px rgba(30, 64, 175, 0.45);
  color: #fff;
}

.piece.goat:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 14px var(--goat-glow);
}

.piece.goat.selected {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px #fff, 0 0 16px var(--goat-color);
}

.piece.goat.vulnerable {
  animation: goatShiver 1.8s infinite ease-in-out;
}

@keyframes goatShiver {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Jump animation */
.piece.jumping {
  animation: tigerJumpArc 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes tigerJumpArc {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.35) translateY(-14px); }
  100% { transform: scale(1) translateY(0); }
}

/* ── Modals ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 16px;
}

.modal-backdrop.open,
.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #141c26;
  border: 1px solid var(--gold-primary);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 168, 83, 0.2);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 88vh;
  overflow-y: auto;
}

.modal-backdrop.open .modal-card,
.modal-backdrop.active .modal-card {
  transform: scale(1);
}

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

.victory-stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.victory-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted, #94a3b8);
}

.victory-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-primary, #facc15);
}

/* ── Two-Column Rules Cards Layout ── */
.rules-modal-card {
  max-width: 740px;
}

.rules-intro-banner {
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.28);
  border-radius: 10px;
  padding: 9px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  text-align: center;
  color: #e2e8f0;
}

.rules-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 10px;
}

.rules-card {
  background: rgba(11, 16, 22, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rules-card-wide {
  grid-column: 1 / -1;
}

.rules-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-primary, #facc15);
  display: flex;
  align-items: center;
  gap: 6px;
}

.rules-card-text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.48;
  color: #cbd5e1;
}

.rc-gold   { color: #facc15; font-weight: 700; }
.rc-cyan   { color: #38bdf8; font-weight: 700; }
.rc-green  { color: #4ade80; font-weight: 700; }
.rc-orange { color: #fb923c; font-weight: 700; }
.rc-red    { color: #fb7185; font-weight: 700; }

@media (max-width: 640px) {
  .rules-cards-grid {
    grid-template-columns: 1fr;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.rules-content {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cdd9e5;
}

.rules-content h4 {
  color: var(--gold-primary);
  margin: 12px 0 4px 0;
  font-size: 0.95rem;
}

.rules-content ul {
  padding-left: 20px;
  margin-bottom: 10px;
}

.rules-content li {
  margin-bottom: 4px;
}

.victory-banner {
  text-align: center;
  padding: 10px 0 16px 0;
}

.victory-icon {
  font-size: 3.5rem;
  margin-bottom: 6px;
}

.victory-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-primary);
  margin-bottom: 6px;
}

.victory-desc {
  font-size: 0.92rem;
  color: #cad8e6;
  margin-bottom: 16px;
}

/* ── Responsive media queries ── */
@media (max-width: 1024px) {
  body {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }

  .app-main {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 48px);
    overflow-y: visible;
    padding: 10px 12px 30px 12px;
    gap: 12px;
    max-width: 560px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
  }

  .sidebar {
    width: 100%;
    max-width: 100%;
    height: auto;
    gap: 8px;
  }

  .board-container {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 4px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex: none;
  }

  /* Responsive / Elastic Nepal Board Frame */
  .nepal-board-frame {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: none;
    padding: clamp(14px, 3.5vw, 22px);
    box-sizing: border-box;
  }

  .corner-ornament {
    width: clamp(22px, 5vw, 30px);
    height: clamp(22px, 5vw, 30px);
  }

  .border-decor-top, .border-decor-bottom {
    left: clamp(24px, 6vw, 34px);
    right: clamp(24px, 6vw, 34px);
    font-size: clamp(0.6rem, 1.8vw, 0.72rem);
  }

  .border-decor-left, .border-decor-right {
    top: clamp(24px, 6vw, 34px);
    bottom: clamp(24px, 6vw, 34px);
    font-size: clamp(0.6rem, 1.8vw, 0.72rem);
  }

  /* Compact Goat Reserve on Mobile / Narrow Screen: 10 cols x 2 rows instead of huge 5x4 */
  .goat-reserve-tray {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-top: 6px;
  }

  .goat-token {
    aspect-ratio: 1 / 1;
    font-size: clamp(0.75rem, 2.8vw, 0.95rem);
    border-radius: 6px;
  }
}

@media (max-width: 600px) {
  .piece {
    width: clamp(28px, 7.5vw, 36px);
    height: clamp(28px, 7.5vw, 36px);
    font-size: clamp(1.1rem, 3.8vw, 1.35rem);
  }

  .board-node {
    width: clamp(34px, 9vw, 42px);
    height: clamp(34px, 9vw, 42px);
  }
}
