:root {
  --bg-deep: #070e17;
  --bg-board: #0b1528;
  --bg-card: #0f1c2e;
  --bg-wall: #a34636;
  --accent-gold: #f59e0b;
  --accent-blue: #38bdf8;
  --accent-ruby: #ef4444;
  --accent-green: #22c55e;
  --tile-bg: #c5ccdc;
  --tile-border: #8c9bb7;
  --tile-text: #14357c;
  --stash-bg: #c5ccdc;
  --stash-text: #14357c;
  --text-white: #ffffff;
  --text-muted: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-white);
  font-family: var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  padding-bottom: 50px;
}

/* ===================================================
   TOP STICKY PARLOUR NAVIGATION
   =================================================== */
header.parlour-nav {
  width: 100%;
  background: #091326;
  border-bottom: 2px solid #1e3a8a;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  flex-wrap: wrap;
  gap: 10px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-parlour-home {
  background: #f59e0b;
  color: #000 !important;
  font-weight: 900;
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, background 0.15s;
}

.btn-parlour-home:hover {
  transform: translateY(-1px);
  background: #fbbf24;
}

.parlour-brand {
  color: #38bdf8;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-account-pill:hover,
.btn-account-pill.logged-in {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.pioneer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.pioneer-pill:hover,
.pioneer-pill.unlocked {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  border-color: #facc15;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.6);
}

.btn-finrock-draft {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 20px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.btn-finrock-draft:hover {
  background: rgba(56, 189, 248, 0.35);
  color: #fff;
  border-color: #38bdf8;
}

/* ===================================================
   MAIN PARLOUR CONTAINER
   =================================================== */
main.parlour-main {
  width: 100%;
  max-width: 980px;
  padding: 1rem 1rem 2rem;
  text-align: center;
  position: relative;
}

.title-row {
  margin-bottom: 0.8rem;
}

h1 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 0.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.title-sub {
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Action Controls Toolbar */
.action-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.tool-btn {
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
}

.tool-btn:hover {
  color: #fff;
  border-color: #64748b;
  transform: translateY(-1px);
}

.tool-btn.active {
  background: #1e3a8a;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

/* ===================================================
   THE HUMPTY DUMPTY BRICK WALL & EGG DUEL
   =================================================== */
.humpty-wall-stage {
  width: 100%;
  max-width: 760px;
  margin: 3.5rem auto 1.5rem auto;
  position: relative;
  height: 155px;
}

.humpty-wall {
  width: 100%;
  height: 74px;
  position: absolute;
  bottom: 0;
  left: 0;
  background: 
    linear-gradient(to bottom, #a34636 0%, #75291d 100%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.12) 0px, rgba(0, 0, 0, 0.12) 2px, transparent 2px, transparent 12px);
  border-top: 8px solid #c96552;
  border-bottom: 6px solid #4a150d;
  border-radius: 12px 12px 4px 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 2px 10px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: 
    radial-gradient(#5a1b11 15%, transparent 16%), 
    radial-gradient(#4d180f 15%, transparent 16%);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
}

.wall-mortar-cap {
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 12px;
  background: linear-gradient(180deg, #d4a373 0%, #b07d4b 100%);
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid #6b4423;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.4);
}

.wall-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.turn-pill {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.turn-pill.red {
  border-color: #ef4444;
  color: #ef4444;
}

.match-trophies {
  font-size: 0.78rem;
  color: #f59e0b;
  margin-top: 4px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.mode-badge {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 600;
}

/* Egg Avatars */
.egg-avatar {
  position: absolute;
  bottom: 58px;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.egg-avatar.p1 { left: 24px; }
.egg-avatar.p2 { right: 24px; }

.egg-crown {
  font-size: 20px;
  margin-bottom: -6px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s ease;
}

.egg-avatar.winner .egg-crown {
  opacity: 1;
  transform: translateY(0);
}

.egg-avatar.winner {
  animation: eggAscend 1.5s ease-in-out infinite alternate;
}

@keyframes eggAscend {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.egg-avatar.fallen {
  animation: greatFall 1.2s forwards cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

@keyframes greatFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  30% { transform: translateY(-10px) rotate(-15deg); }
  70% { transform: translateY(80px) rotate(60deg); opacity: 0.8; }
  100% { transform: translateY(220px) rotate(110deg); opacity: 0; }
}

.egg-antennae {
  display: flex;
  justify-content: space-between;
  width: 48px;
  margin-bottom: -2px;
}

.antenna-bulb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.antenna-bulb.pulsing {
  background: #facc15 !important;
  box-shadow: 0 0 16px #facc15, 0 0 28px #f59e0b !important;
  transform: scale(1.4);
}

.egg-body {
  width: 80px;
  height: 100px;
  border-radius: 50% 50% 48% 48% / 60% 60% 42% 42%;
  position: relative;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65), inset -6px -8px 14px rgba(0, 0, 0, 0.3), inset 6px 6px 12px rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.egg-avatar.p1 .egg-body {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #f1f5f9 60%, #cbd5e1 100%);
  border: 3px solid #e2e8f0;
}

.egg-avatar.p1.golden .egg-body {
  background: radial-gradient(circle at 35% 30%, #fffbeb 0%, #fef08a 30%, #f59e0b 70%, #b45309 100%);
  border: 3px solid #facc15;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.7), inset 0 0 15px rgba(255, 255, 255, 0.6);
}

.egg-avatar.p2 .egg-body {
  background: radial-gradient(circle at 35% 30%, #f87171 0%, #dc2626 65%, #991b1b 100%);
  border: 3px solid #ef4444;
  color: #fff;
}

.egg-eyes {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.egg-eye {
  width: 13px;
  height: 17px;
  background: #0f172a;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  animation: eyeBlink 4s infinite ease-in-out;
}

.egg-pupil {
  width: 5px;
  height: 5px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.1s ease;
}

@keyframes eyeBlink {
  0%, 96%, 100% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
}

.egg-smile {
  width: 20px;
  height: 8px;
  border-bottom: 3px solid #0f172a;
  border-radius: 0 0 14px 14px;
  margin-top: 4px;
}

.egg-avatar.p2 .egg-smile {
  border-bottom-color: #450a0a;
}

.egg-badge {
  font-size: 11px;
  font-weight: 800;
  margin-top: 6px;
  color: #0f172a;
}

.egg-avatar.p2 .egg-badge {
  color: #fff;
}

.egg-score-pod {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.egg-score-pod.ivory {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.egg-score-pod.ruby {
  background: #ef4444;
  color: #fff;
  border: 1px solid #f87171;
}

/* Flying Pips Overlay Canvas */
.pips-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* ===================================================
   GAME ARENA: BOARD + SIDEBAR
   =================================================== */
.game-arena {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  margin-top: 10px;
}

@media (max-width: 820px) {
  .game-arena {
    flex-direction: column;
    align-items: center;
  }
}

.board-column {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-board-wrapper {
  background: #091326;
  border: 3px solid #1e3a8a;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.game-board {
  display: grid;
  gap: 8px;
  width: 340px;
  height: 340px;
  margin: 0 auto;
}

@media (min-width: 500px) {
  .game-board {
    width: 380px;
    height: 380px;
  }
}

.game-board.grid-4x4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
}

.game-board.grid-5x5 {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
}

.game-board.grid-6x6 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
}

.game-board.grid-7x7 {
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
}

.game-board.grid-8x8 {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3.5px;
}

.game-board.grid-9x9 {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 2.5px;
}

@media (min-width: 500px) {
  .game-board.grid-7x7,
  .game-board.grid-8x8,
  .game-board.grid-9x9 {
    width: 400px;
    height: 400px;
  }
}

/* Individual Board Square */
.square {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  box-sizing: border-box;
  transition: transform 0.12s, border-color 0.2s, background 0.2s;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4);
}

.game-board.grid-7x7 .square,
.game-board.grid-8x8 .square {
  border-width: 1.5px;
  border-radius: 6px;
}

.game-board.grid-9x9 .square {
  border-width: 1px;
  border-radius: 5px;
}

.square:hover {
  border-color: #38bdf8;
  transform: scale(1.02);
}

.square.tapped {
  border-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.25) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.7);
}

/* Coordinate Watermark */
.cell-coord {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 10px;
  font-family: ui-monospace, monospace;
  color: #475569;
  font-weight: 600;
  pointer-events: none;
  line-height: 1;
}

.game-board.grid-7x7 .cell-coord,
.game-board.grid-8x8 .cell-coord {
  font-size: 7.5px;
  top: 1px;
  left: 2px;
}

.game-board.grid-9x9 .cell-coord {
  font-size: 6.5px;
  top: 1px;
  left: 1px;
}

/* Hide coordinate watermark when cell has a placed die */
.square.has-die .cell-coord {
  display: none !important;
}

/* Plunked Die inside Cell */
.cell-die {
  width: 90%;
  height: 90%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  animation: diePop 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-sizing: border-box;
  line-height: 1;
}

.game-board.grid-5x5 .cell-die { font-size: 1.7rem; border-radius: 7px; }
.game-board.grid-6x6 .cell-die { font-size: 1.45rem; border-radius: 6px; }
.game-board.grid-7x7 .cell-die { font-size: 1.2rem; border-radius: 5px; border-width: 1.5px; }
.game-board.grid-8x8 .cell-die { font-size: 1.05rem; border-radius: 4px; border-width: 1.5px; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.game-board.grid-9x9 .cell-die { font-size: 0.92rem; border-radius: 3.5px; border-width: 1px; box-shadow: 0 2px 5px rgba(0,0,0,0.4); }

.cell-die.p1 {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 100%);
  color: #0f172a;
  border: 2px solid #f59e0b;
}

.cell-die.p2 {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  border: 2px solid #f87171;
}

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

/* Conflict Error Animation */
.square.conflict-flash {
  animation: conflictShake 0.5s ease;
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.35) !important;
}

@keyframes conflictShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Completed Region Highlight */
.square.completed-region {
  border-color: #facc15 !important;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.8) !important;
}

/* Stash / Selection Rack */
.selection-rack-wrap {
  width: 100%;
  max-width: 380px;
  margin-top: 14px;
  padding: 10px 12px;
  background: #091326;
  border: 1px solid #1e3a8a;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 500px) {
  .selection-rack-wrap {
    max-width: 400px;
  }
}

.rack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rack-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.rack-sub {
  font-size: 0.68rem;
  color: #64748b;
}

.stash-container {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  overflow: visible;
  padding: 2px 0;
}

.die-btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 60px;
  height: 52px;
  background: var(--stash-bg);
  border: 2px solid var(--tile-border);
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--stash-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.15s ease;
  padding: 0;
}

.stash-container.grid-7-dice .die-btn,
.stash-container.grid-8-dice .die-btn {
  height: 46px;
  font-size: 1.25rem;
  border-radius: 8px;
}

.stash-container.grid-9-dice .die-btn {
  height: 42px;
  font-size: 1.15rem;
  border-radius: 7px;
  border-width: 1.5px;
}

.die-btn:hover {
  transform: translateY(-2px);
  background: #fff;
  border-color: #38bdf8;
}

.die-btn.plucked {
  background: #38bdf8 !important;
  color: #0f172a !important;
  border-color: #ffffff !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.9) !important;
  transform: translateY(-4px) scale(1.05);
}

/* ===================================================
   TRAINING MODE HUD & BOARD VISUALS
   =================================================== */
.tool-btn.training-btn.active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.6) !important;
}

.training-hud-bar {
  width: 100%;
  max-width: 380px;
  margin: 0 auto 8px auto;
  padding: 6px 10px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid #10b981;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 500px) {
  .training-hud-bar {
    max-width: 400px;
  }
}

.training-hud-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.training-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.training-hud-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #34d399;
  letter-spacing: 0.5px;
}

.training-hud-actions {
  display: flex;
  gap: 6px;
}

.btn-training-act {
  background: #0f172a;
  border: 1px solid #34d399;
  color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-training-act:hover {
  background: #34d399;
  color: #0f172a;
}

.btn-training-act.lab-link {
  text-decoration: none;
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

.btn-training-act.lab-link:hover {
  background: #38bdf8;
  color: #0f172a;
}

/* Training Legal Moves Highlight */
.square.training-legal {
  border-color: #34d399 !important;
  background: rgba(16, 185, 129, 0.18) !important;
  box-shadow: inset 0 0 10px rgba(52, 211, 153, 0.4);
}

.square.training-legal::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
  pointer-events: none;
}

/* Training Hint Highlight */
.square.training-hint {
  border-color: #facc15 !important;
  background: rgba(250, 204, 21, 0.35) !important;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.8) !important;
  animation: hintPulse 0.8s infinite alternate ease-in-out;
}

@keyframes hintPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}
}

/* ===================================================
   SIDEBAR: REGIONAL SCORING & LOG
   =================================================== */
.score-sidebar {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-panel {
  background: var(--bg-card);
  border: 1px solid #1e3a8a;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.panel-rule-tag,
.log-game-pill {
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 600;
}

.region-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.8rem;
  color: #cbd5e1;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.region-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.region-row.dim-note {
  color: #64748b;
  font-size: 0.72rem;
  border-bottom: none;
  margin-top: 4px;
}

/* Match Log Box */
.event-log-box {
  height: 160px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 8px;
  font-size: 0.76rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry {
  color: #cbd5e1;
}

.log-entry.p1 {
  color: #fef08a;
}

.log-entry.p2 {
  color: #fca5a5;
}

.log-entry.bonus {
  color: #4ade80;
  font-weight: 700;
}

.log-entry.system {
  color: #94a3b8;
  font-style: italic;
}

/* Floating Home Button */
.floating-home-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #f59e0b;
  color: #000;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 0.5rem 1rem;
  border-radius: 30px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
  z-index: 999;
  transition: transform 0.2s;
}

.floating-home-btn:hover {
  transform: scale(1.06);
}

/* ===================================================
   MODALS & OVERLAYS
   =================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 5, 24, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: #0f1c2e;
  border: 1px solid #1e3a8a;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
  color: #fff;
}

.form-group {
  margin-bottom: 14px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #fff;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: #38bdf8;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.btn-primary {
  background: #2563eb;
  border: none;
  border-radius: 10px;
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #334155;
  border: none;
  border-radius: 10px;
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Match Scores Table */
.scores-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.scores-table th,
.scores-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
}

.scores-table th {
  color: #94a3b8;
  font-weight: 700;
}

.modal-caption {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  margin-top: 4px;
}

/* Pioneer Modal Styling */
.pioneer-modal-card {
  max-width: 480px;
}

.pioneer-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pioneer-logo {
  font-size: 26px;
}

.pioneer-desc {
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  text-align: center;
  margin-bottom: 12px;
}

.pioneer-referral-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.invitation-sub {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
}

.pioneer-auth-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

/* Agry Vault & Network Tiers Card */
.agry-vault-card {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.4) 0%, rgba(15, 23, 42, 0.7) 100%);
  border: 1px solid rgba(250, 204, 21, 0.4);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.vault-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vault-tier-badge {
  font-size: 12px;
  font-weight: 800;
  color: #facc15;
  letter-spacing: 0.3px;
}

.vault-rate-pill {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid #22c55e;
  color: #4ade80;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.vault-balance-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
}

.vault-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vault-stat-label {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
}

.vault-stat-value {
  font-size: 13px;
  color: #f8fafc;
  font-weight: 800;
}

.vault-network-info {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: #cbd5e1;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  padding-top: 6px;
}

.input-with-button {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.pioneer-claim-btn {
  background: #2563eb;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.pioneer-status {
  font-size: 11px;
  margin-top: 6px;
  color: #94a3b8;
}

.pioneer-forum-bridge {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.pioneer-pm-link {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93c5fd;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
}

.highlight-draft {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.25) 0%, rgba(245, 158, 11, 0.35) 100%) !important;
  border: 1px solid rgba(250, 204, 21, 0.6) !important;
  color: #fef08a !important;
  font-weight: 800 !important;
}

.pioneer-topic-link {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}

.draft-helper-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.draft-helper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.btn-copy-draft {
  background: #334155;
  border: 1px solid #475569;
  color: #f1f5f9;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-copy-draft.copied {
  background: #16a34a;
  color: #fff;
}

.draft-preview-subject {
  font-size: 11px;
  color: #e2e8f0;
}

.draft-preview-body {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 10.5px;
  line-height: 1.4;
  padding: 6px;
  resize: vertical;
}

.pioneer-perks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 30vh;
  overflow-y: auto;
}

.perk-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(30, 41, 59, 0.5);
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 3px solid #facc15;
  text-align: left;
}

.perk-icon {
  font-size: 16px;
}

.perk-text strong {
  display: block;
  font-size: 12px;
  color: #f8fafc;
}

.perk-text span {
  font-size: 11px;
  color: #94a3b8;
}

/* Settings Toggle */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #38bdf8;
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ===================================================
   MEMBER ACCOUNTS & ORGANIZER SUITE
   =================================================== */
.account-modal-card {
  max-width: 480px;
}

.account-modal-header {
  margin-bottom: 16px;
  text-align: center;
}

.account-tab-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 4px;
  margin-top: 12px;
  gap: 4px;
}

.acc-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.acc-tab-btn.active {
  background: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.6);
}

.account-view-panel .panel-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 14px;
  text-align: center;
}

/* Organizer Command Suite */
.organizer-command-suite {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.org-status-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 8px 12px;
  border-radius: 10px;
}

.org-role-badge {
  font-size: 12px;
  font-weight: 800;
  color: #facc15;
}

.btn-org-logout {
  background: #334155;
  border: none;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.suite-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
}

.suite-card-title {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 8px;
}

.suite-form-row {
  display: flex;
  gap: 8px;
}

.active-room-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 12px;
  color: #86efac;
}

.roster-list-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
  margin-top: 6px;
}

.roster-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #cbd5e1;
}

.royalty-badge {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
