/* ==========================================================================
   eXtreme v1.1 (7iLted-24Cie-5ud0ku) — Official Web Parlour Stylesheet
   https://extreme.twisted23.com/ | https://twisted23.com/extreme/
   Tribute to the greatest game in the world & Brother DarreL, but not KyLe! 🎸🎵
   ========================================================================== */

:root {
  --bg-deep: #050a17;
  --bg-radial: #0f2042;
  --card-bg: #0c162c;
  --border-royal: #1e3a8a;
  --gold-gary: #f59e0b;
  --magenta-darrel: #ec4899;
  --violet-owl: #a855f7;
  --blue-finrock: #38bdf8;
  --crimson-hard: #ef4444;
  --teal-easy: #06b6d4;
  --copper-duh: #fb923c;
  --lab-lime: #84cc16;
  --hint-yellow: #facc15;
  --diag-emerald: #10b981;
  --text-bright: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 50% 0%, var(--bg-radial) 0%, var(--bg-deep) 78%);
  color: var(--text-bright);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 4.5rem;
  overflow-x: hidden;
}

/* Flying Pips Fullscreen Canvas */
.pips-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 300;
}

/* Top Sticky Navigation */
header.parlour-nav {
  width: 100%;
  background: rgba(7, 13, 28, 0.95);
  border-bottom: 2px solid var(--border-royal);
  padding: 0.65rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(10px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-home {
  background: var(--gold-gary);
  color: #000;
  font-weight: 900;
  padding: 0.42rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.88rem;
  transition: transform 0.15s;
}
.btn-home:hover {
  transform: translateY(-1px);
}

.brand-title {
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, #f59e0b, #ec4899, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active-table {
  color: #fff;
  background: rgba(56, 189, 248, 0.15);
}
.nav-links a.lab-pill {
  color: var(--lab-lime);
  border: 1px solid rgba(132, 204, 22, 0.45);
  background: rgba(132, 204, 22, 0.1);
}

/* Tribute Banner */
.tribute-banner {
  max-width: 1120px;
  width: 95%;
  margin: 0.75rem auto 0.6rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(236, 72, 153, 0.14), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 14px;
  padding: 0.7rem 1.15rem;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.45);
  cursor: pointer;
}
.tribute-quote {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fef3c7;
  line-height: 1.4;
}
.tribute-quote span.highlight { color: var(--gold-gary); }
.tribute-quote span.not-kyle { color: var(--magenta-darrel); text-decoration: underline; }
.tribute-links {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.tribute-links a { color: var(--blue-finrock); text-decoration: none; font-weight: 700; }
.tribute-links a:hover { text-decoration: underline; }

/* Quick Controls Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  max-width: 1120px;
  width: 95%;
  margin-bottom: 0.75rem;
}
.tool-btn {
  background: #0f224a;
  color: #e2e8f0;
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  padding: 0.42rem 0.88rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.tool-btn:hover {
  border-color: var(--blue-finrock);
  color: #fff;
  background: #1e3a8a;
}
.tool-btn.lab-active {
  background: var(--lab-lime) !important;
  color: #000 !important;
  border-color: #fff !important;
  box-shadow: 0 0 14px rgba(132, 204, 22, 0.55);
}
.tool-btn.hint-active {
  background: var(--hint-yellow) !important;
  color: #000 !important;
  border-color: #fff !important;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.65);
}
.tool-btn.pace-snail {
  background: rgba(236, 72, 153, 0.32);
  border-color: var(--magenta-darrel);
  color: #fbcfe8;
}
.tool-btn.pace-turtle {
  background: rgba(56, 189, 248, 0.28);
  border-color: var(--blue-finrock);
  color: #bae6fd;
}
.tool-btn.pace-rabbit {
  background: rgba(245, 158, 11, 0.32);
  border-color: var(--gold-gary);
  color: #fde68a;
}

/* 2, 3, or 4 Player Parlour Seat Cards with Animated Mini-Avatars */
.seats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  max-width: 1120px;
  width: 95%;
  margin-bottom: 0.85rem;
}

.seat-card {
  background: var(--card-bg);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  cursor: pointer;
  transition: all 0.22s ease;
  position: relative;
  overflow: hidden;
}
.seat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.35);
}
.seat-card.active-turn {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.65);
}

.seat-avatar-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.mini-egg-avatar {
  width: 42px;
  height: 50px;
  border-radius: 50% 50% 45% 45% / 58% 58% 42% 42%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 3px 6px rgba(255,255,255,0.45), inset 0 -4px 8px rgba(0,0,0,0.55), 0 4px 10px rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.65);
  flex-shrink: 0;
}
.seat-card.active-turn .mini-egg-avatar {
  animation: avatarBob 1.6s ease-in-out infinite;
}
@keyframes avatarBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-3deg); }
}

.mini-egg-crown {
  position: absolute;
  top: -11px;
  font-size: 0.85rem;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.8));
}
.mini-egg-eyes {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}
.mini-egg-eye {
  width: 7px;
  height: 9px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-egg-pupil {
  width: 3.5px;
  height: 4px;
  background: #090d16;
  border-radius: 50%;
}
.mini-egg-smile {
  width: 12px;
  height: 5px;
  border-bottom: 2px solid rgba(0,0,0,0.75);
  border-radius: 0 0 10px 10px;
  margin-top: 2px;
}

.seat-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.seat-name {
  font-weight: 900;
  font-size: 0.96rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-role {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}
.seat-right {
  text-align: right;
  flex-shrink: 0;
}
.seat-pts {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.12rem;
  font-weight: 900;
}
.seat-wins {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  color: var(--blue-finrock);
  font-weight: 700;
}

/* Main Arena Grid */
.arena {
  display: grid;
  grid-template-columns: 1fr 370px;
  gap: 1.15rem;
  max-width: 1120px;
  width: 95%;
  align-items: start;
}
@media (max-width: 920px) {
  .arena { grid-template-columns: 1fr; }
}

/* Tilted 24-Cie Stage */
.stage-box {
  background: radial-gradient(ellipse at center, #0e2248 0%, #050c1a 100%);
  border: 5px solid #2563eb;
  border-radius: 24px;
  padding: 0.9rem 1.15rem;
  box-shadow: 0 28px 65px rgba(0,0,0,0.85), inset 0 2px 14px rgba(56, 189, 248, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.stage-box.theme-wood {
  background: radial-gradient(ellipse at center, #352109 0%, #190f03 100%);
  border-color: #a07855;
}

.stage-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--blue-finrock);
  margin-bottom: 0.35rem;
  z-index: 5;
}

.board-viewport {
  width: 450px;
  height: 450px;
  max-width: 88vw;
  max-height: 88vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.keep24-grid {
  display: grid;
  grid-template-columns: repeat(6, 56px);
  grid-template-rows: repeat(6, 56px);
  gap: 7px;
  transition: transform 0.45s cubic-bezier(0.2, 1, 0.3, 1);
}
@media (max-width: 500px) {
  .keep24-grid {
    grid-template-columns: repeat(6, 46px);
    grid-template-rows: repeat(6, 46px);
    gap: 5px;
  }
}

.keep24-grid.tilt--45 { transform: rotate(-45deg) scale(0.86); }
.keep24-grid.tilt--11 { transform: rotate(-11deg) scale(0.92); }
.keep24-grid.tilt-0   { transform: rotate(0deg) scale(0.98); }
.keep24-grid.tilt-11  { transform: rotate(11deg) scale(0.92); }
.keep24-grid.tilt-45  { transform: rotate(45deg) scale(0.86); }

.cie-cell {
  width: 100%;
  height: 100%;
  border-radius: 11px;
  background: linear-gradient(145deg, #0b1936 0%, #050c1d 100%);
  border: 2px solid rgba(56, 189, 248, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  box-shadow: 0 3px 6px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.08);
}
.cie-cell:hover {
  border-color: rgba(56, 189, 248, 0.85);
}
.stage-box.theme-wood .cie-cell {
  background: linear-gradient(145deg, #29190a 0%, #170d04 100%);
  border-color: rgba(160, 120, 85, 0.55);
}

.cie-cell.has-die {
  background: linear-gradient(145deg, #1d4ed8 0%, #172554 100%);
  border-width: 2.6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.7), inset 0 1px 1px rgba(255,255,255,0.35);
}
.stage-box.theme-wood .cie-cell.has-die {
  background: linear-gradient(145deg, #d4b996 0%, #a07855 100%);
}

.cie-cell.tapped-target, .cie-cell.slide-source {
  border: 3px solid var(--gold-gary) !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.8) !important;
}
.cie-cell.hint-suggested {
  border: 3.2px solid var(--hint-yellow) !important;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.9) !important;
  animation: pulseHint 1.1s ease-in-out infinite;
}
@keyframes pulseHint {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}

/* Lab Mode uses dedicated Phosphor Lime (#84CC16) — never collides with Finrock Blue! */
.cie-cell.legal-lab {
  border: 2.5px solid var(--lab-lime) !important;
  box-shadow: 0 0 12px rgba(132, 204, 22, 0.55);
}

.cie-cell.region-xray {
  border: 3px solid var(--xray-color, #f59e0b) !important;
  box-shadow: 0 0 18px var(--xray-color, #f59e0b) !important;
  z-index: 3;
}

.cie-cell.conflict-flash {
  animation: shakeConflict 0.36s ease;
  border-color: var(--crimson-hard) !important;
  background: rgba(239, 68, 68, 0.4) !important;
}
@keyframes shakeConflict {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.13); }
  75% { transform: scale(0.91); }
}

/* Counter-rotated inner container so numerals stay upright at every tilt angle */
.cie-upright {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s cubic-bezier(0.2, 1, 0.3, 1);
  position: relative;
}
.keep24-grid.tilt--45 .cie-upright { transform: rotate(45deg); }
.keep24-grid.tilt--11 .cie-upright { transform: rotate(11deg); }
.keep24-grid.tilt-0   .cie-upright { transform: rotate(0deg); }
.keep24-grid.tilt-11  .cie-upright { transform: rotate(-11deg); }
.keep24-grid.tilt-45  .cie-upright { transform: rotate(-45deg); }

.cie-numeral {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.45rem;
  font-weight: 900;
  color: #fff;
}
.stage-box.theme-wood .cie-cell.has-die .cie-numeral {
  color: #291704;
}

.cie-coord {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255,255,255,0.34);
}
.cie-cell.legal-lab .cie-coord {
  color: var(--lab-lime);
}
.cie-cell.hint-suggested .cie-coord {
  color: var(--hint-yellow);
}

.heavy-x-pip {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 0.52rem;
  opacity: 0.6;
}

.stage-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Right Side Panel: Die Stash, 17-Region X-Ray & Match Log */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.panel-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border-royal);
  border-radius: 16px;
  padding: 0.95rem 1.05rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 0.65rem;
  color: #e2e8f0;
}

.stash-instruction {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  color: var(--blue-finrock);
  margin-bottom: 0.6rem;
  min-height: 1.2rem;
}

.dice-stash-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
}

.die-btn {
  height: 54px;
  border-radius: 11px;
  background: #1d4ed8;
  border: 2px solid var(--blue-finrock);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.die-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}
.die-btn .die-num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.1;
}
.die-btn .die-quota {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.62rem;
  font-weight: 900;
  color: rgba(255,255,255,0.8);
  letter-spacing: 1px;
}

.die-btn.plucked {
  background: var(--gold-gary);
  color: #000;
  border-color: #fff;
  transform: scale(1.07);
}
.die-btn.plucked .die-quota {
  color: rgba(0,0,0,0.75);
}

.die-btn.hinted {
  background: var(--hint-yellow);
  color: #000;
  border-color: #fff;
  transform: scale(1.07);
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.8);
}
.die-btn.hinted .die-quota {
  color: rgba(0,0,0,0.8);
}

/* Exhausted (all 4 placed) -> Goes BLANK! */
.die-btn.exhausted {
  background: rgba(8, 13, 28, 0.85);
  border-color: rgba(255,255,255,0.1);
  opacity: 0.34;
  cursor: not-allowed;
}

/* Botched (< 4 placed, 0 legal spaces remain) -> DIMS! */
.die-btn.botched {
  background: rgba(20, 25, 43, 0.9);
  border-color: rgba(239, 68, 68, 0.38);
  opacity: 0.30;
  cursor: not-allowed;
}
.die-btn.botched .die-num {
  color: rgba(255,255,255,0.45);
}
.die-btn.botched .die-quota {
  color: var(--crimson-hard);
  font-size: 0.52rem;
  letter-spacing: 0;
}

/* 17-Region Inspector Rows */
.region-group-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 30, 62, 0.75);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  transition: all 0.15s;
}
.region-group-row:hover {
  background: rgba(30, 58, 138, 0.65);
  border-color: rgba(255,255,255,0.3);
}
.region-group-title {
  font-weight: 800;
  font-size: 0.82rem;
}
.region-group-badge {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.74rem;
  font-weight: 800;
  color: #cbd5e1;
}

/* Scrolling Event Log */
.event-log {
  max-height: 155px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.74rem;
}
.log-line {
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: #cbd5e1;
  line-height: 1.35;
}
.log-line.warrior {
  background: rgba(236, 72, 153, 0.16);
  border-left: 3px solid var(--magenta-darrel);
  color: #fbcfe8;
  font-weight: 700;
}
.log-line.bonus {
  background: rgba(56, 189, 248, 0.14);
  border-left: 3px solid var(--blue-finrock);
  color: #bae6fd;
}

/* Sticky Bottom Spoken Play-by-Play Ticker Bar (matching Xcode bottom logLabel) */
.bottom-ticker-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(6, 11, 25, 0.96);
  border-top: 2px solid var(--border-royal);
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  z-index: 250;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.bottom-ticker-badge {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.25);
  border: 1px solid var(--magenta-darrel);
  color: #fbcfe8;
  white-space: nowrap;
}
.bottom-ticker-text {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.84rem;
  font-weight: 700;
  color: #f8fafc;
  text-align: center;
}

/* Seat Configuration Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 1rem;
}
.modal-backdrop.open {
  display: flex;
}
.modal-box {
  background: #0c162c;
  border: 2px solid var(--blue-finrock);
  border-radius: 18px;
  max-width: 420px;
  width: 100%;
  padding: 1.25rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.85);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
}
.modal-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
  line-height: 1.4;
}
.modal-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1.5px solid var(--border-royal);
  background: #060b18;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}
.persona-grid {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.persona-option {
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,0.14);
  background: #111f3d;
  color: #fff;
  font-weight: 800;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.persona-option:hover {
  border-color: var(--blue-finrock);
  background: #1e3a8a;
}
