:root {
  /* Theme derived directly from /img/shlogo.jpg (#541612 Maroon & #C6CBE8 Periwinkle-Silver) */
  --logo-maroon: #541612;
  --logo-periwinkle: #c6cbe8;
  --logo-periwinkle-bright: #dfe3f7;
  --bg-deep: #180504;
  --bg-panel: #2b0b09;
  --bg-card: #38100d;
  --border-subtle: rgba(198, 203, 232, 0.22);
  --border-bright: rgba(198, 203, 232, 0.62);
  --text-main: #f4f5fb;
  --text-muted: #b8bdd9;
  --accent-gold: #f59e0b;
  --accent-cyan: #c6cbe8;
  --accent-blue: #7c86c4;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.65);

  /* Responsive Card Widths that scale with the browser window */
  --card-w-hero: clamp(82px, 5.4vw, 114px);
  --card-w-field: clamp(104px, 7.1vw, 146px);
  --card-w-stage: clamp(112px, 7.6vw, 156px);
  --card-w-hand: clamp(132px, 8.6vw, 178px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: radial-gradient(circle at 50% 0%, #541612 0%, #310c0a 48%, #180504 100%);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* TOP NAVIGATION HEADER — BLENDS SEAMLESSLY WITH /img/shlogo.jpg (#541612) */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 18px;
  background: linear-gradient(90deg, #541612 0%, #46120f 55%, #2f0b09 100%);
  border-bottom: 2px solid rgba(198, 203, 232, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.brand-logo {
  height: clamp(40px, 4.4vh, 52px);
  width: auto;
  display: block;
  border-radius: 4px;
}

.abp-logo {
  height: clamp(28px, 3.2vh, 36px);
  width: auto;
  opacity: 0.95;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.callsign-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(24, 5, 4, 0.65);
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid rgba(198, 203, 232, 0.32);
}

.callsign-box label {
  font-size: 0.72rem;
  color: var(--logo-periwinkle);
  font-weight: 700;
}

.callsign-box input {
  background: transparent;
  border: none;
  color: #fff;
  padding: 2px 4px;
  font-size: 0.8rem;
  font-weight: 700;
  width: 110px;
  outline: none;
}

/* GUIDE MODE TOGGLE SWITCH */
.guide-toggle-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.55);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.guide-toggle-pill.off {
  background: rgba(24, 5, 4, 0.65);
  border-color: var(--border-subtle);
}

.guide-switch {
  width: 30px;
  height: 16px;
  background: #4a1e1b;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}

.guide-toggle-pill.on .guide-switch {
  background: #22c55e;
}

.guide-knob {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.guide-toggle-pill.on .guide-knob {
  transform: translateX(14px);
}

.guide-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--logo-periwinkle-bright);
}

/* HEADER POPOVERS (COMBAT WHEEL) */
.header-popover-wrap {
  position: relative;
}

.floating-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 310px;
  background: rgba(34, 8, 7, 0.98);
  border: 1.5px solid var(--logo-periwinkle);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.82);
  z-index: 200;
}

.header-popover-wrap:hover .floating-popover,
.floating-popover.open {
  display: block;
}

.popover-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--logo-periwinkle-bright);
  margin-bottom: 6px;
}

.popover-desc {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.btn-icon-close {
  background: transparent;
  border: none;
  color: var(--logo-periwinkle);
  cursor: pointer;
  font-size: 0.88rem;
  padding: 2px 6px;
  border-radius: 5px;
}

.btn-icon-close:hover {
  background: rgba(198, 203, 232, 0.15);
  color: #fff;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
  border-radius: 7px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 0.92rem;
  border-radius: 10px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #5c67a8, #838ec9);
  border-color: rgba(223, 227, 247, 0.55);
  color: #fff;
}

.btn-success {
  background: linear-gradient(135deg, #16a34a, #10b981);
  border-color: rgba(134, 239, 172, 0.45);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border-color: rgba(253, 224, 71, 0.45);
  color: #180504;
}

.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border-color: rgba(252, 165, 165, 0.45);
}

.btn-purple {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-color: rgba(216, 180, 254, 0.45);
}

.btn-outline {
  background: rgba(34, 8, 7, 0.75);
  border-color: rgba(198, 203, 232, 0.35);
  color: var(--logo-periwinkle-bright);
}

/* LOBBY & DECK SELECTION LAYOUT */
.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 20px 36px;
}

.hero-welcome-banner {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

@media (max-width: 960px) {
  .hero-welcome-banner {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: linear-gradient(180deg, rgba(48, 13, 11, 0.92), rgba(28, 7, 6, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-lg);
}

.panel-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--logo-periwinkle-bright);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.deck-card {
  background: rgba(64, 17, 14, 0.68);
  border: 2px solid rgba(198, 203, 232, 0.22);
  border-radius: 11px;
  padding: 11px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.deck-card:hover {
  transform: translateY(-2px);
  border-color: var(--logo-periwinkle);
}

.deck-card.selected {
  border-color: var(--logo-periwinkle-bright);
  box-shadow: 0 0 20px rgba(198, 203, 232, 0.35);
  background: linear-gradient(180deg, rgba(84, 22, 18, 0.92), rgba(38, 9, 7, 0.96));
}

.deck-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.deck-portrait {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  object-fit: cover;
  object-position: top center;
  background: #180504;
  border: 1.5px solid rgba(198, 203, 232, 0.35);
}

.deck-style-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
}

.deck-summary {
  font-size: 0.75rem;
  color: #dcdfef;
  line-height: 1.36;
}

.deck-difficulty {
  font-size: 0.68rem;
  color: var(--logo-periwinkle);
  font-weight: 700;
  margin-top: auto;
}

.deck-inspector {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.origin-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.origin-pill {
  padding: 5px 11px;
  border-radius: 7px;
  background: rgba(54, 14, 11, 0.85);
  border: 1px solid rgba(198, 203, 232, 0.3);
  color: var(--logo-periwinkle-bright);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.origin-pill.active {
  background: rgba(198, 203, 232, 0.22);
  border-color: var(--logo-periwinkle-bright);
  color: #fff;
}

.join-code-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.code-input {
  flex: 1;
  background: #180504;
  border: 1.5px solid rgba(198, 203, 232, 0.45);
  color: var(--logo-periwinkle-bright);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
  max-height: 290px;
  overflow-y: auto;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(64, 17, 14, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
}

.room-code-tag {
  font-family: Consolas, monospace;
  font-weight: 800;
  font-size: 0.82rem;
  color: var(--logo-periwinkle-bright);
  background: rgba(198, 203, 232, 0.14);
  border: 1px solid rgba(198, 203, 232, 0.42);
  padding: 2px 7px;
  border-radius: 5px;
}

/* =====================================================
   RESPONSIVE GAME ARENA + PERMANENT CHAT LOG SIDEBAR
   ===================================================== */
.focused-arena {
  max-width: min(98vw, 2240px);
  margin: 0 auto;
  padding: 8px 16px 18px;
  width: 100%;
}

.arena-layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 20vw, 370px);
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 66px);
}

.arena-layout-grid.log-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.arena-layout-grid.log-hidden .event-log-sidebar {
  display: none;
}

@media (max-width: 1100px) {
  .arena-layout-grid {
    grid-template-columns: 1fr;
  }
}

.arena-main-board {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  position: relative;
}

/* 1. UNIFIED ADAPTIVE STATUS & COACH BANNER */
.unified-status-banner {
  background: linear-gradient(90deg, rgba(64, 17, 14, 0.94), rgba(34, 8, 7, 0.96));
  border: 1.5px solid rgba(198, 203, 232, 0.38);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  transition: all 0.25s ease;
}

.unified-status-banner.my-turn-mode {
  background: linear-gradient(90deg, rgba(84, 22, 18, 0.95), rgba(44, 11, 9, 0.96));
  border-color: var(--logo-periwinkle-bright);
  box-shadow: 0 4px 20px rgba(198, 203, 232, 0.18);
}

.unified-status-banner.defend-mode {
  background: linear-gradient(90deg, rgba(136, 19, 19, 0.96), rgba(55, 10, 10, 0.96));
  border-color: #f87171;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.4);
}

.status-main-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.status-headline-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.phase-pill {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--logo-periwinkle);
  color: #2b0b09;
}

.defend-mode .phase-pill {
  background: #ef4444;
  color: #fff;
}

.status-headline-row h2 {
  font-size: clamp(0.92rem, 1.05vw, 1.15rem);
  font-weight: 800;
  color: var(--logo-periwinkle-bright);
}

.status-subtext {
  font-size: clamp(0.76rem, 0.85vw, 0.92rem);
  color: var(--text-muted);
}

.coach-inline-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: clamp(0.76rem, 0.85vw, 0.9rem);
  padding-top: 2px;
}

.coach-tag {
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
}

.coach-inline-row strong {
  color: #fde68a;
}

.coach-exp {
  color: #e2e6f5;
}

.status-actions-col {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.meta-chip {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--logo-periwinkle);
  background: rgba(28, 7, 6, 0.75);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 6px;
}

.meta-chip.room-chip {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.45);
  cursor: pointer;
}

/* 2. OPPONENT HERO STRIP & 4. SELF HERO STRIP */
.compact-opponent-strip,
.self-board-area {
  background: linear-gradient(90deg, rgba(46, 12, 10, 0.9), rgba(30, 8, 7, 0.92));
  border: 1px solid rgba(198, 203, 232, 0.26);
  border-radius: 11px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.self-board-area {
  border-color: rgba(198, 203, 232, 0.38);
}

.opp-left,
.self-hero-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opp-inplay-center,
.self-inplay-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

.opp-right-stats,
.self-controls-cluster {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.hero-avatar {
  width: clamp(42px, 3vw, 54px);
  height: clamp(42px, 3vw, 54px);
  border-radius: 9px;
  object-fit: cover;
  object-position: top center;
  border: 2px solid var(--logo-periwinkle);
}

/* =====================================================
   3. FOUR-ROW CENTRAL BATTLEFIELD STACK
      (AI Defense -> AI Active -> [Action Icon] -> Player Active -> Player Defense)
   ===================================================== */
.battlefield-rows-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}

.active-clash-pair {
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
}

.field-row {
  min-height: clamp(148px, 16.5vh, 215px);
  border-radius: 11px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: relative;
  transition: all 0.22s ease;
}

/* DEFENSE ROWS (AI DEFENSE ROW & PLAYER DEFENSE ROW) — WARM CRIMSON-MAROON */
.defense-field-row {
  background: linear-gradient(180deg, rgba(64, 15, 13, 0.72), rgba(28, 7, 6, 0.85));
  border: 2px solid rgba(239, 68, 68, 0.48);
}

/* ACTIVE ROWS (AI ACTIVE ROW & PLAYER ACTIVE ROW) — PERIWINKLE-SILVER / MAROON CONTRAST */
.active-field-row {
  background: linear-gradient(180deg, rgba(44, 24, 38, 0.76), rgba(26, 9, 12, 0.88));
  border: 2px solid rgba(198, 203, 232, 0.55);
  min-height: clamp(156px, 17.5vh, 225px);
}

.active-field-row.clash-highlight {
  border-color: var(--logo-periwinkle-bright);
  box-shadow: inset 0 0 26px rgba(198, 203, 232, 0.18);
}

.active-field-row.danger-highlight {
  border-color: #f87171;
  box-shadow: inset 0 0 28px rgba(239, 68, 68, 0.28);
}

.field-row-label-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 155px;
  user-select: none;
}

.field-row-title {
  font-size: clamp(0.75rem, 0.85vw, 0.92rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.defense-field-row .field-row-title {
  color: #fca5a5;
}

.active-field-row .field-row-title {
  color: var(--logo-periwinkle-bright);
}

.field-row-sub {
  font-size: clamp(0.66rem, 0.74vw, 0.8rem);
  color: rgba(198, 203, 232, 0.62);
}

.field-row-cards {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  min-height: 132px;
}

.field-row-right {
  min-width: 155px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.field-empty-placeholder {
  font-size: clamp(0.76rem, 0.84vw, 0.9rem);
  color: rgba(198, 203, 232, 0.42);
  font-style: italic;
  text-align: center;
  user-select: none;
}

/* SHARED ARENA DOCK (SINGLE ARENA IN PLAY FOR BOTH PLAYERS) */
.shared-arena-pill-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(64, 17, 14, 0.95), rgba(32, 8, 7, 0.97));
  border: 1.5px solid var(--logo-periwinkle);
  border-radius: 11px;
  padding: 6px 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.shared-arena-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 240px;
}

.shared-arena-tag {
  font-size: 0.64rem;
  font-weight: 900;
  color: var(--logo-periwinkle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.shared-arena-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #fde68a;
}

.shared-arena-rules {
  font-size: 0.7rem;
  color: #dcdfef;
  line-height: 1.3;
}

/* PLAYED CLASH CARD SLOT IN ACTIVE ROW */
.played-clash-slot {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(34, 8, 7, 0.94);
  border: 2px solid var(--logo-periwinkle-bright);
  border-radius: 12px;
  padding: 7px 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.7);
  animation: cardDropIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardDropIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.clash-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 260px;
}

.clash-card-tag {
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #facc15;
}

.clash-card-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}

.clash-card-desc {
  font-size: 0.75rem;
  color: #dcdfef;
  line-height: 1.34;
}

/* AI PRETEND THINKING PLACEHOLDER SLOT */
.ai-thinking-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(64, 17, 14, 0.92);
  border: 2px dashed var(--logo-periwinkle);
  border-radius: 11px;
  padding: 12px 18px;
  color: var(--logo-periwinkle-bright);
  font-size: 0.88rem;
  font-weight: 700;
  animation: pulseThinking 1.1s infinite ease-in-out;
}

@keyframes pulseThinking {
  0%, 100% {
    border-color: rgba(198, 203, 232, 0.45);
    box-shadow: 0 0 10px rgba(198, 203, 232, 0.15);
  }
  50% {
    border-color: #facc15;
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.38);
  }
}

/* STRADDLING ACTION ICON BOX BETWEEN AI ACTIVE ROW & PLAYER ACTIVE ROW */
.center-action-icon-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.action-burst-badge {
  background: radial-gradient(circle, #6d1d18 0%, #3d0f0c 100%);
  border: 2.5px solid var(--logo-periwinkle-bright);
  border-radius: 14px;
  padding: 6px 16px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.85), 0 0 22px rgba(198, 203, 232, 0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: popBurst 0.3s cubic-bezier(0.18, 1.25, 0.4, 1);
}

.action-burst-badge.pow-hit {
  background: radial-gradient(circle, #ef4444 0%, #7f1d1d 100%);
  border-color: #fde047;
  box-shadow: 0 8px 28px rgba(220, 38, 38, 0.85), 0 0 28px rgba(250, 204, 21, 0.8);
}

.action-burst-badge.blocked-hit {
  background: radial-gradient(circle, #059669 0%, #064e3b 100%);
  border-color: #6ee7b7;
}

.action-burst-badge.idle-vs {
  background: rgba(42, 11, 9, 0.94);
  border: 1.5px solid rgba(198, 203, 232, 0.52);
  padding: 4px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
}

/* MOMENTARY TURN PHRASING CALLOUT BANNER */
.momentary-callout-banner {
  background: linear-gradient(135deg, rgba(84, 22, 18, 0.98), rgba(38, 9, 7, 0.99));
  border: 2.5px solid var(--logo-periwinkle-bright);
  border-radius: 16px;
  padding: 10px 20px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.88), 0 0 28px rgba(198, 203, 232, 0.45);
  display: flex;
  align-items: center;
  gap: 14px;
  animation: popBurst 0.28s cubic-bezier(0.18, 1.25, 0.4, 1);
}

.momentary-callout-banner.opp-callout {
  background: linear-gradient(135deg, rgba(115, 22, 18, 0.98), rgba(45, 10, 8, 0.99));
  border-color: #facc15;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.88), 0 0 28px rgba(250, 204, 21, 0.45);
}

@keyframes popBurst {
  0% {
    transform: scale(0.55);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.action-burst-icon {
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--logo-periwinkle-bright);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.8px;
}

.action-burst-sub {
  font-size: 0.76rem;
  font-weight: 700;
  color: #f8fafc;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* PERMANENT CHAT-STYLE LOG OF EVENTS SIDEBAR (RIGHT COLUMN) */
.event-log-sidebar {
  background: linear-gradient(180deg, rgba(42, 11, 9, 0.95), rgba(24, 5, 4, 0.97));
  border: 1px solid rgba(198, 203, 232, 0.32);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 68px);
  position: sticky;
  top: 58px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 1100px) {
  .event-log-sidebar {
    height: 360px;
    position: static;
  }
}

.event-log-header {
  padding: 10px 14px;
  background: rgba(84, 22, 18, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--logo-periwinkle-bright);
}

.event-log-subbar {
  padding: 5px 14px;
  background: rgba(34, 8, 7, 0.88);
  border-bottom: 1px solid rgba(198, 203, 232, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.chat-log-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-log-bubble {
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(58, 15, 12, 0.65);
  border-left: 3px solid var(--logo-periwinkle);
  font-size: 0.78rem;
  line-height: 1.38;
  color: #f1f3fa;
  word-break: break-word;
}

.chat-log-bubble.self-event {
  border-left-color: #22c55e;
  background: rgba(20, 83, 45, 0.28);
}

.chat-log-bubble.opp-event {
  border-left-color: #f87171;
  background: rgba(127, 29, 29, 0.35);
}

.chat-log-bubble.system-event {
  border-left-color: #facc15;
  background: rgba(120, 53, 15, 0.28);
}

.chat-log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--logo-periwinkle);
  margin-bottom: 2px;
  font-weight: 700;
}

/* STAT PILLS */
.stat-pill {
  background: rgba(54, 14, 11, 0.85);
  border: 1px solid rgba(198, 203, 232, 0.28);
  padding: 4px 9px;
  border-radius: 7px;
  font-size: clamp(0.72rem, 0.78vw, 0.84rem);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--logo-periwinkle-bright);
}

.stat-pill.injury-meter {
  background: rgba(127, 29, 29, 0.55);
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.stat-pill.main-char {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fde68a;
}

.stat-pill.stun-badge {
  background: rgba(220, 38, 38, 0.4);
  border-color: #ef4444;
  color: #fca5a5;
}

/* 5. YOUR HAND DOCK (BOTTOM — PRIMARY FOCUS) */
.self-hand-dock {
  background: linear-gradient(180deg, rgba(52, 14, 11, 0.86), rgba(24, 5, 4, 0.96));
  border: 1.5px solid rgba(198, 203, 232, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  transition: all 0.2s ease;
}

.self-hand-dock.active-focus {
  border-color: var(--logo-periwinkle-bright);
  box-shadow: 0 0 24px rgba(198, 203, 232, 0.18);
}

.hand-cards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: clamp(180px, 20vh, 250px);
}

/* =====================================================
   GAME CARD VISUAL COMPONENT (SCALES WITH VIEWPORT)
   ===================================================== */
.game-card {
  width: var(--card-w-hero);
  background: #38100d;
  border: 2px solid rgba(198, 203, 232, 0.36);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  user-select: none;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.58);
}

.game-card.origin-mini {
  width: var(--card-w-hero);
  border-color: rgba(250, 204, 21, 0.65);
}

/* LARGER CARDS IN ACTIVE & DEFENSE ROWS */
.game-card.field-row-card {
  width: var(--card-w-field);
  border-radius: 10px;
}

.game-card.active-stage-card {
  width: var(--card-w-stage);
  border-color: var(--logo-periwinkle-bright);
  border-radius: 10px;
}

.game-card.hand-card {
  width: var(--card-w-hand);
  border-radius: 11px;
}

.game-card:hover {
  transform: translateY(-6px) scale(1.06);
  z-index: 30;
  border-color: var(--logo-periwinkle-bright);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.8);
}

/* UPSIDE-DOWN OPPONENT CARD ORIENTATION (FACING THE AI PLAYER) */
.game-card.opp-upside-down .card-art-wrap img {
  transform: rotate(180deg);
}

.game-card.opp-upside-down:hover {
  transform: translateY(-5px) scale(1.06);
  border-color: #facc15;
}

.game-card.playable-glow {
  border-color: var(--logo-periwinkle-bright);
}

.game-card.deploy-glow {
  border-color: #c084fc;
  box-shadow: 0 0 14px rgba(192, 132, 252, 0.4);
}

.game-card.block-glow {
  border-color: #10b981 !important;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.85) !important;
  transform: translateY(-5px);
}

.game-card.dimmed-card {
  opacity: 0.35;
  filter: grayscale(0.45);
}

.game-card.dimmed-card:hover {
  opacity: 0.92;
  filter: none;
}

.game-card.coach-recommended {
  border-color: #facc15 !important;
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.75) !important;
}

.game-card.nullified {
  filter: grayscale(0.85) brightness(0.65);
}

.card-art-wrap {
  width: 100%;
  aspect-ratio: 0.72;
  background: #541612;
  position: relative;
  overflow: hidden;
}

.card-art-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s ease;
}

.card-art-wrap img.facedown-logo-back {
  object-fit: contain;
  padding: 8px;
  background: #541612;
}

/* HOVER ACTION OVERLAY DIRECTLY ON HAND CARDS */
.card-hover-actions {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24, 5, 4, 0.15) 0%, rgba(24, 5, 4, 0.9) 52%, rgba(24, 5, 4, 0.98) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 5px;
  padding: 28px 8px 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 8;
}

.game-card.hand-card:hover .card-hover-actions,
.game-card.hand-card.selected-touch .card-hover-actions {
  opacity: 1;
}

.card-act-btn {
  width: 100%;
  padding: 5px 7px;
  font-size: clamp(0.7rem, 0.76vw, 0.82rem);
  font-weight: 800;
  border-radius: 6px;
  border: 1px solid rgba(198, 203, 232, 0.3);
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: filter 0.12s;
}

.card-act-btn:hover {
  filter: brightness(1.18);
}

/* ENLARGE BUTTON ALWAYS ABOVE OVERLAY SO IT NEVER FAILS TO CLICK */
.card-zoom-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(34, 8, 7, 0.9);
  border: 1px solid rgba(198, 203, 232, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 22;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s;
}

.card-zoom-btn:hover {
  background: #5c67a8;
  border-color: #fff;
  transform: scale(1.14);
}

.card-zoom-btn img {
  width: 13px;
  height: 13px;
  transform: none !important;
}

.card-combat-pill {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.62rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  background: rgba(42, 11, 9, 0.94);
  border: 1px solid rgba(198, 203, 232, 0.4);
  color: var(--logo-periwinkle-bright);
  z-index: 4;
}

.card-coach-star {
  position: absolute;
  top: 5px;
  left: 5px;
  background: #facc15;
  color: #180504;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 15;
}

.card-footer-title {
  padding: 4px 6px;
  font-size: clamp(0.68rem, 0.72vw, 0.8rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(34, 8, 7, 0.96);
  color: var(--logo-periwinkle-bright);
  text-align: center;
}

/* FLOATING HOVER CARD PREVIEW (DYNAMICALLY POSITIONED RIGHT NEXT TO HOVERED CARD!) */
.hover-card-preview {
  position: fixed;
  top: 120px;
  left: 120px;
  width: 330px;
  background: rgba(30, 7, 6, 0.98);
  border: 2px solid var(--logo-periwinkle-bright);
  border-radius: 12px;
  padding: 13px 15px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.88);
  z-index: 220;
  pointer-events: none;
}

/* WHEEL LIST INSIDE POPOVER */
.wheel-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wheel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(64, 17, 14, 0.68);
  border: 1px solid rgba(198, 203, 232, 0.22);
  font-size: 0.75rem;
}

.wheel-row.active-wheel {
  background: rgba(245, 158, 11, 0.25);
  border-color: #facc15;
}

/* MODALS (CARD ZOOM & RULEBOOK) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 3, 2, 0.86);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 18px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #2b0b09;
  border: 1.5px solid var(--logo-periwinkle);
  border-radius: 16px;
  max-width: 940px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.82);
  overflow: hidden;
}

.modal-header {
  padding: 12px 18px;
  background: #541612;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--logo-periwinkle-bright);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  line-height: 1.55;
}

.rule-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.rule-tab-btn {
  padding: 6px 12px;
  border-radius: 7px;
  background: #3d0f0c;
  border: 1px solid rgba(198, 203, 232, 0.28);
  color: var(--logo-periwinkle);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.rule-tab-btn.active {
  background: #5c67a8;
  border-color: var(--logo-periwinkle-bright);
  color: #fff;
}

.zoom-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 720px) {
  .zoom-layout {
    grid-template-columns: 1fr;
  }
}

.zoom-card-img {
  width: 100%;
  border-radius: 12px;
  border: 2px solid var(--logo-periwinkle);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
}

.toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast-msg {
  background: rgba(54, 14, 11, 0.96);
  border: 1.5px solid var(--logo-periwinkle-bright);
  color: #fff;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
}
