@font-face {
  font-family: 'MedievalSharp';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/MedievalSharp.ttf') format('truetype');
}

@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/Cinzel-Bold.ttf') format('truetype');
}

:root {
  --card-height: 28vh;
  --card-table-height: 22vh;

  /* Interactive highlight colors: golden → green → blue */
  --color-selectable: 255, 215, 100;   /* golden — first available click */
  --color-selected: 100, 255, 120;     /* green — after click / selected */
  --color-target: 100, 200, 255;       /* blue — second target / argument */

  /* Z-index layers (ordered bottom → top) */
  --z-base: 0;                /* character card wraps, company card area */
  --z-attachment: 1;          /* character attachments, deck pile labels */
  --z-drafted: 5;             /* drafted card rows */
  --z-board: 10;              /* hand/opponent arcs, company nav, events in play */
  --z-panel: 15;              /* deck box, pass button, selected hand card */
  --z-preview: 50;            /* card preview panel */
  --z-instruction: 60;        /* instruction text overlay */
  --z-hover: 100;             /* dev toolbar, hovered arcs/rows, tooltips, chain panel */
  --z-modal: 200;             /* settings modal, toast, floating dice */
  --z-overlay: 300;           /* site deck modal, dice overlay */
  --z-set-aside: 400;         /* set-aside pile (above modals during draft) */
  --z-action-backdrop: 999;   /* action/target backdrop */
  --z-action-menu: 1000;      /* action/target tooltip menus */
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #0b0d12;
  color: #e0e0e0;
  padding: 1rem;
}

/* Atmospheric backdrop for all post-login lobby screens.
   Sits behind body content; covered by the fixed auth-screen when logged out
   and by #visual-view when in-game, so it only shows in lobby/decks/mail. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--visual-bg, url('images/visual-bg.png')) center/cover no-repeat;
  filter: brightness(0.55) saturate(0.85);
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(11,13,18,0.4) 0%, rgba(11,13,18,0.85) 70%, rgba(11,13,18,0.95) 100%),
    linear-gradient(180deg, rgba(11,13,18,0.5) 0%, rgba(11,13,18,0.7) 100%);
  z-index: -1;
  pointer-events: none;
}

h1 {
  color: #c4a35a;
  margin-bottom: 1rem;
}

/* Floating toolbar overlay */

h2 {
  color: #8899aa;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

/* ---- Auth screen (login + register, split layout) ---- */

.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  background: #0b0d12;
  z-index: 1;
}

.auth-screen.hidden {
  display: none;
}

@media (max-width: 900px) {
  .auth-screen {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    display: none;
  }
}

/* Hero pane (left) */

.auth-hero {
  position: relative;
  overflow: hidden;
  background: var(--auth-hero-bg, url('images/visual-bg.png')) center/cover no-repeat;
  animation: auth-hero-pan 40s ease-in-out infinite alternate;
}

@keyframes auth-hero-pan {
  from { background-size: 110% auto; background-position: 30% 40%; }
  to   { background-size: 125% auto; background-position: 60% 55%; }
}

.auth-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 60%, rgba(0,0,0,0.85) 100%),
    linear-gradient(90deg, rgba(11,13,18,0) 60%, rgba(11,13,18,0.95) 100%);
  pointer-events: none;
}

.auth-hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 5rem;
  color: #f0e6c8;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 24px rgba(0,0,0,0.6);
}

.auth-logo {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  margin: 0 0 1.25rem 0;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.auth-logo-line--small {
  font-family: 'MedievalSharp', 'Cinzel', serif;
  font-size: 1.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #c4a35a;
  font-weight: 400;
}

.auth-logo-line--big {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #f5d98a 0%, #c4a35a 50%, #8b6f3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

.auth-tagline {
  font-family: 'Cinzel', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: #d8c89a;
  max-width: 28rem;
  margin: 0;
  letter-spacing: 0.02em;
}

/* Panel pane (right) */

.auth-panel-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 3rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(196,163,90,0.08) 0%, rgba(11,13,18,0) 60%),
    #0b0d12;
}

.auth-panel {
  width: 100%;
  max-width: 26rem;
  padding: 2.25rem 2.25rem 2rem;
  background: linear-gradient(180deg, #1a1a2e 0%, #14141f 100%);
  border: 1px solid #c4a35a;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(196,163,90,0.15),
    0 24px 48px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
}

.auth-panel::before,
.auth-panel::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid #c4a35a;
  pointer-events: none;
}

.auth-panel::before {
  top: -6px;
  left: -6px;
  border-right: none;
  border-bottom: none;
}

.auth-panel::after {
  bottom: -6px;
  right: -6px;
  border-left: none;
  border-top: none;
}

/* Tab toggle */

.auth-tabs {
  display: flex;
  gap: 0;
  margin: 0 -0.5rem 1.5rem;
  border-bottom: 1px solid rgba(196,163,90,0.25);
}

.auth-tab {
  flex: 1;
  padding: 0.6rem 0.5rem 0.85rem;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.05em;
  background: transparent;
  color: #6b6b7a;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab:hover {
  color: #d4b36a;
}

.auth-tab--active {
  color: #f5d98a;
  border-bottom-color: #c4a35a;
}

/* Forms — only the active tab's form is shown */

.auth-form {
  display: none;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-screen--login .auth-form--login,
.auth-screen--register .auth-form--register {
  display: flex;
}

.auth-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.auth-label-text {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a7d5a;
}

.auth-label-hint {
  color: #555;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.02em;
}

.auth-form input {
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  background: #0b0d12;
  color: #e8dfc4;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input::placeholder {
  color: #4a4a5a;
}

.auth-form input:focus {
  outline: none;
  border-color: #c4a35a;
  box-shadow: 0 0 0 3px rgba(196,163,90,0.15);
}

.auth-submit {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #d4b36a 0%, #c4a35a 50%, #9a7f3e 100%);
  color: #1a1a2e;
  border: 1px solid #8b6f3a;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}

.auth-submit:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 10px rgba(196,163,90,0.3), inset 0 1px 0 rgba(255,255,255,0.4);
}

.auth-submit:active {
  transform: translateY(1px);
}

.auth-error {
  color: #e57373;
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
}

/* ---- Lobby screen ---- */

.lobby-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(180deg, rgba(11,13,18,0.85) 0%, rgba(11,13,18,0.7) 100%);
  border-bottom: 1px solid rgba(196,163,90,0.35);
  box-shadow: 0 2px 12px rgba(0,0,0,0.5), inset 0 -1px 0 rgba(196,163,90,0.08);
  backdrop-filter: blur(6px);
  margin: -1rem -1rem 1.25rem;
}

.lobby-nav-brand {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  background: linear-gradient(180deg, #f5d98a 0%, #c4a35a 60%, #8b6f3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0.1rem 0.25rem 0.1rem 0.25rem;
}

.lobby-nav-version {
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(196, 163, 90, 0.7);
  letter-spacing: 0.05em;
  margin-left: 0.35rem;
}

.lobby-nav-divider {
  width: 1px;
  height: 1.5rem;
  background: linear-gradient(180deg, transparent, rgba(196,163,90,0.4), transparent);
  margin: 0 0.85rem 0 0.5rem;
}

.lobby-nav-item {
  padding: 0.45rem 1.1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  background: transparent;
  color: #8a8a98;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
}

.lobby-nav-item:hover {
  color: #d4b36a;
  text-shadow: 0 0 12px rgba(196,163,90,0.4);
}

.lobby-nav-item--active {
  color: #f5d98a;
  border-bottom-color: #c4a35a;
  text-shadow: 0 0 12px rgba(196,163,90,0.35);
}

/* ---- Lobby stage (page wrapper for lobby/decks/inbox screens) ---- */

.lobby-stage {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 2rem;
}

.lobby-stage-header {
  text-align: center;
  margin: 1rem 0 2rem;
}

.lobby-stage-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #f5d98a 0%, #c4a35a 50%, #8b6f3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.7));
}

.lobby-stage-subtitle {
  font-family: 'Cinzel', serif;
  font-style: italic;
  color: #b8a87a;
  font-size: 1rem;
  margin: 0;
  letter-spacing: 0.02em;
}

/* ---- Reusable parchment panel ---- */

.panel {
  position: relative;
  padding: 1.5rem 1.5rem 1.25rem;
  background: linear-gradient(180deg, rgba(26,26,46,0.92) 0%, rgba(20,20,31,0.92) 100%);
  border: 1px solid rgba(196,163,90,0.55);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(196,163,90,0.1),
    0 16px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

.panel::before,
.panel::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1px solid #c4a35a;
  pointer-events: none;
}

.panel::before {
  top: -5px;
  left: -5px;
  border-right: none;
  border-bottom: none;
}

.panel::after {
  bottom: -5px;
  right: -5px;
  border-left: none;
  border-top: none;
}

.panel-title {
  font-family: 'Cinzel', serif;
  color: #f5d98a;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(196,163,90,0.25);
  text-shadow: 0 0 12px rgba(196,163,90,0.25);
}

/* Lobby screen 2-column grid */

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .lobby-grid {
    grid-template-columns: 1fr;
  }
}

.lobby-nav-badge {
  font-size: 0.75rem;
  color: #ff6b6b;
  font-family: 'Segoe UI', sans-serif;
}

.lobby-nav-spacer {
  flex: 1;
}

.lobby-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #334;
}

.lobby-title {
  font-family: 'Cinzel', serif;
  color: #c4a35a;
  margin: 0;
  flex: 1;
}

.lobby-credits-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(135deg, #7a6320, #a8892e);
  color: #e8d9a0;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.lobby-credits-badge:hover {
  filter: brightness(1.15);
}

.lobby-credits-badge:active {
  transform: scale(0.97);
}

.lobby-credits-badge::before {
  content: '\1FA99';
}

/* ---- Credit Usage page ---- */

.credits-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

.credits-page-title {
  font-family: 'Cinzel', serif;
  color: #c4a35a;
  margin: 0 0 0.75rem;
}

.credits-page-summary {
  color: #e8d9a0;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.credits-page-list {
  margin-top: 0.5rem;
}

.credits-page-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(20, 20, 36, 0.6);
  border: 1px solid #334;
  font-size: 0.9rem;
}

.credits-page-table th,
.credits-page-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #2a2a40;
}

.credits-page-table th {
  background: rgba(196, 163, 90, 0.12);
  color: #c4a35a;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
}

.credits-page-table tbody tr:hover {
  background: rgba(196, 163, 90, 0.06);
}

.credits-col-amount,
.credits-col-balance {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 6rem;
}

.credits-amount-pos {
  color: #7fdc8a;
  font-weight: 700;
}

.credits-amount-neg {
  color: #ff8a8a;
  font-weight: 700;
}

.credits-amount-zero {
  color: #888;
}

.screen-player-name {
  color: #e0e0e0;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.lobby-logout {
  margin-left: 1rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  color: #d32f2f;
  border: 1px solid #d32f2f;
  border-radius: 4px;
  cursor: pointer;
}

.lobby-logout:hover {
  background: rgba(211, 47, 47, 0.15);
}

.lobby-inbox-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  color: #c4a35a;
  border: 1px solid #c4a35a;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}

.lobby-inbox-btn:hover {
  background: rgba(196, 163, 90, 0.15);
}

.inbox-unread-badge {
  font-size: 0.8rem;
  color: #c4a35a;
}

.inbox-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0.85rem;
}

.inbox-tab {
  padding: 0.45rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  color: #6b6b7a;
  border: 1px solid rgba(196,163,90,0.3);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.inbox-tab:first-child {
  border-radius: 3px 0 0 3px;
}

.inbox-tab:last-child {
  border-radius: 0 3px 3px 0;
  border-left: none;
}

.inbox-tab:hover {
  color: #d4b36a;
}

.inbox-tab--active {
  color: #f5d98a;
  border-color: #c4a35a;
  background: rgba(196, 163, 90, 0.12);
  text-shadow: 0 0 12px rgba(196,163,90,0.3);
}

.inbox-action-btn {
  padding: 0.3rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
}

.inbox-action-btn:hover {
  color: #e0d8c8;
  border-color: #888;
  background: rgba(255,255,255,0.05);
}

.inbox-action-btn--danger {
  color: #e57373;
  border-color: rgba(244,67,54,0.4);
}

.inbox-action-btn--danger:hover {
  color: #f44336;
  border-color: #f44336;
  background: rgba(244,67,54,0.1);
}

.inbox-content {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 340px;
  min-width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
  padding: 1rem 1rem 1rem;
}

.inbox-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  background: linear-gradient(180deg, rgba(11,13,18,0.7) 0%, rgba(11,13,18,0.5) 100%);
  border: 1px solid rgba(196,163,90,0.18);
  border-left: 2px solid rgba(196,163,90,0.35);
  border-radius: 3px;
  cursor: pointer;
  gap: 0.75rem;
  transition: border-color 0.15s, transform 0.1s;
}

.inbox-item:hover {
  border-color: rgba(196,163,90,0.55);
  border-left-color: #c4a35a;
  transform: translateX(2px);
}

.inbox-item--unread {
  border-left: 2px solid #c4a35a;
  background: linear-gradient(180deg, rgba(196,163,90,0.08) 0%, rgba(11,13,18,0.5) 100%);
}

.inbox-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.inbox-item-subject {
  font-size: 0.9rem;
  color: #e0d8c8;
}

.inbox-item--unread .inbox-item-subject {
  font-weight: bold;
  color: #f0e8d8;
}

.inbox-item--waiting {
  border-left: 3px solid #b482ff;
}

.inbox-item--waiting .inbox-item-subject {
  font-weight: bold;
  color: #d4bfff;
}

.inbox-item-from {
  font-size: 0.75rem;
  color: #888;
}

.inbox-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.inbox-item-date {
  font-size: 0.75rem;
  color: #666;
}

.inbox-delete-btn {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  background: transparent;
  color: #d32f2f;
  border: 1px solid #d32f2f;
  border-radius: 3px;
  cursor: pointer;
}

.inbox-delete-btn:hover {
  background: rgba(211, 47, 47, 0.15);
}

.inbox-message {
  flex: 1;
  padding: 1.5rem 1.75rem;
  min-height: 60vh;
}

.inbox-msg-subject {
  margin: 0 0 0.5rem;
  font-family: 'Cinzel', serif;
  color: #f5d98a;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(196,163,90,0.25);
}


.inbox-msg-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.inbox-msg-meta > span {
  display: block;
}

.inbox-meta-label {
  display: inline-block;
  width: 8rem;
  color: #666;
}

.inbox-meta-value {
  color: #bbb;
}

.inbox-meta-id {
  font-family: monospace;
  font-size: 0.75rem;
  color: #777;
}

.inbox-copy-btn {
  margin-left: 0.4rem;
  cursor: pointer;
  color: #c4a35a;
  font-size: 1.1rem;
  vertical-align: middle;
}

.inbox-copy-btn:hover {
  color: #e0c870;
}

.inbox-tag {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

.inbox-tag--ai {
  background: rgba(100, 180, 255, 0.15);
  color: #6ab4ff;
}

.inbox-tag--server {
  background: rgba(196, 163, 90, 0.15);
  color: #c4a35a;
}

.inbox-tag--player {
  background: rgba(76, 175, 80, 0.15);
  color: #6abf6e;
}

.inbox-tag--topic {
  background: rgba(255,255,255,0.08);
  color: #aaa;
}

.inbox-status {
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

.inbox-status--new {
  background: rgba(100, 180, 255, 0.15);
  color: #6ab4ff;
}

.inbox-status--read {
  background: rgba(255,255,255,0.08);
  color: #aaa;
}

.inbox-status--processing {
  background: rgba(255, 180, 50, 0.15);
  color: #f0b030;
}

.inbox-status--processed {
  background: rgba(76, 175, 80, 0.15);
  color: #6abf6e;
}

.inbox-status--deleted {
  background: rgba(211, 47, 47, 0.15);
  color: #e05555;
}

.inbox-status--waiting {
  background: rgba(180, 130, 255, 0.15);
  color: #b482ff;
}

.inbox-status--approved {
  background: rgba(76, 175, 80, 0.25);
  color: #4caf50;
}

.inbox-approve-btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.inbox-approve-btn:hover {
  background: #5cbf60;
}

.inbox-approve-btn:disabled {
  background: rgba(76, 175, 80, 0.3);
  color: #6abf6e;
  cursor: default;
}

.inbox-status--declined {
  background: rgba(244, 67, 54, 0.25);
  color: #f44336;
}

.inbox-review-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.inbox-decline-btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.inbox-decline-btn:hover {
  background: #e53935;
}

.inbox-decline-btn:disabled {
  background: rgba(244, 67, 54, 0.3);
  color: #e57373;
  cursor: default;
}

.inbox-delete-btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  background: #666;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.inbox-delete-btn:hover {
  background: #777;
}

.inbox-delete-btn:disabled {
  background: rgba(102, 102, 102, 0.3);
  color: #999;
  cursor: default;
}

.inbox-msg-keywords {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.inbox-msg-keywords > span {
  display: block;
}

.inbox-message-body {
  font-size: 0.9rem;
  color: #e0d8c8;
  line-height: 1.5;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
}

.inbox-message-body h1, .inbox-message-body h2, .inbox-message-body h3 {
  color: #c4a35a;
  margin: 0.75rem 0 0.25rem;
}

.inbox-message-body code {
  background: rgba(255,255,255,0.08);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.85em;
}

.inbox-message-body pre {
  background: rgba(255,255,255,0.05);
  padding: 0.5rem;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

.inbox-message-body a {
  color: #c4a35a;
}

.inbox-message-body .md-image {
  max-width: 250px;
  border-radius: 6px;
  margin: 0.5rem 0;
  display: block;
}

.inbox-message-body ul, .inbox-message-body ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.inbox-message-body p {
  margin: 0.4rem 0;
}

.inbox-message-body table {
  border-collapse: collapse;
  margin: 0.5rem 0;
  width: 100%;
  font-size: 0.85em;
}

.inbox-message-body th, .inbox-message-body td {
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.3rem 0.5rem;
  text-align: left;
}

.inbox-message-body th {
  background: rgba(255,255,255,0.08);
  color: #c4a35a;
}

/* Feature request modal */

#feature-request-modal,
#bug-report-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

#feature-request-backdrop,
#bug-report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

#feature-request-dialog,
#bug-report-dialog {
  position: relative;
  background: #1e1e36;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1.5rem;
  width: 480px;
  max-width: 90vw;
  color: #e0e0e0;
}

#feature-request-dialog h3,
#bug-report-dialog h3 {
  margin: 0 0 0.5rem;
  color: #c4a35a;
  font-size: 1rem;
}

.feature-request-hint,
.report-modal-hint {
  font-size: 0.85rem;
  color: #aaa;
  margin: 0 0 0.75rem;
}

#feature-request-subject,
#feature-request-body,
#bug-report-subject,
#bug-report-body {
  width: 100%;
  box-sizing: border-box;
  background: #16162a;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
}

#feature-request-subject,
#bug-report-subject {
  margin-bottom: 0.5rem;
}

#feature-request-body,
#bug-report-body {
  resize: vertical;
}

.feature-request-actions,
.report-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.feature-request-actions button,
.report-modal-actions button {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
}

#feature-request-cancel,
#bug-report-cancel {
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
}

#feature-request-cancel:hover,
#bug-report-cancel:hover {
  background: rgba(255,255,255,0.05);
  color: #ddd;
}

#feature-request-send,
#bug-report-send {
  background: #c4a35a;
  color: #1a1a2e;
}

#feature-request-send:hover,
#bug-report-send:hover {
  background: #d4b36a;
}

/* Generic in-app alert dialog (replaces native alert()) */

.app-dialog {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.app-dialog-box {
  position: relative;
  background: #1e1e36;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1.5rem;
  width: 420px;
  max-width: 90vw;
  color: #e0e0e0;
}

.app-dialog-message {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.app-dialog-actions button {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  background: #c4a35a;
  color: #1a1a2e;
}

.app-dialog-actions button:hover {
  background: #d4b36a;
}

.app-dialog-actions .app-dialog-btn-cancel {
  background: transparent;
  color: #aaa;
  border: 1px solid #555;
}

.app-dialog-actions .app-dialog-btn-cancel:hover {
  background: rgba(255,255,255,0.05);
  color: #ddd;
}

.lobby-content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
}

.lobby-content--decks {
  grid-template-columns: 1fr 1fr 1fr;
}

.lobby-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lobby-actions {
  margin-top: 0.85rem;
}

.lobby-select-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a7d5a;
  margin-bottom: 0.35rem;
}

.lobby-deck-select {
  padding: 0.7rem 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  background: #0b0d12;
  color: #e8dfc4;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lobby-deck-select:focus {
  outline: none;
  border-color: #c4a35a;
  box-shadow: 0 0 0 3px rgba(196,163,90,0.15);
}

.lobby-play-btn {
  margin-top: 0.85rem;
  padding: 0.85rem 1.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #d4b36a 0%, #c4a35a 50%, #9a7f3e 100%);
  color: #1a1a2e;
  border: 1px solid #8b6f3a;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: filter 0.15s, box-shadow 0.15s, transform 0.1s;
}

.lobby-play-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 10px rgba(196,163,90,0.3), inset 0 1px 0 rgba(255,255,255,0.4);
}

.lobby-play-btn:active {
  transform: translateY(1px);
}

.lobby-play-btn--secondary {
  background: linear-gradient(180deg, #2a2a3a 0%, #1e1e2a 100%);
  color: #d4b36a;
  border-color: #5a4a2a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

.lobby-play-btn--secondary:hover {
  filter: brightness(1.2);
  border-color: #c4a35a;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
}

.lobby-play-btn:disabled,
.lobby-play-btn:disabled:hover {
  background: #2a2a3a;
  color: #5a5a6a;
  border-color: #2a2a3a;
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.lobby-section-title {
  font-family: 'Cinzel', serif;
  color: #f5d98a;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(196,163,90,0.25);
  text-shadow: 0 0 12px rgba(196,163,90,0.25);
}

.lobby-player-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lobby-empty {
  color: #6b6b7a;
  font-size: 0.85rem;
  font-style: italic;
  margin: 0;
}

.lobby-ai-description {
  color: #8a8a98;
  font-size: 0.82rem;
  margin: 1rem 0 0;
  padding: 0.75rem 0.85rem;
  background: rgba(11,13,18,0.5);
  border-left: 2px solid rgba(196,163,90,0.35);
  border-radius: 0 3px 3px 0;
  line-height: 1.5;
}

.lobby-ai-description strong {
  color: #d4b36a;
  font-weight: 700;
}

.lobby-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(180deg, rgba(11,13,18,0.7) 0%, rgba(11,13,18,0.5) 100%);
  border: 1px solid rgba(196,163,90,0.2);
  border-left: 2px solid rgba(196,163,90,0.5);
  border-radius: 3px;
  transition: border-color 0.15s, background 0.15s;
}

.lobby-player-item:hover {
  border-color: rgba(196,163,90,0.5);
  border-left-color: #c4a35a;
}

.lobby-player-item span {
  color: #e8dfc4;
  font-size: 0.95rem;
}

.lobby-player-item button {
  padding: 0.35rem 0.85rem;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #d4b36a 0%, #c4a35a 50%, #9a7f3e 100%);
  color: #1a1a2e;
  border: 1px solid #8b6f3a;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter 0.15s;
}

.lobby-player-item button:hover {
  filter: brightness(1.1);
}

.lobby-player-item button:disabled {
  background: #2a2a3a;
  color: #5a5a6a;
  border-color: #2a2a3a;
  cursor: not-allowed;
  filter: none;
}

#challenge-incoming {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, rgba(196,163,90,0.12) 0%, rgba(196,163,90,0.05) 100%);
  border: 1px solid rgba(196,163,90,0.6);
  border-radius: 3px;
  box-shadow: 0 0 16px rgba(196,163,90,0.15);
  animation: challenge-pulse 2s ease-in-out infinite;
}

@keyframes challenge-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(196,163,90,0.15); }
  50%      { box-shadow: 0 0 24px rgba(196,163,90,0.35); }
}

#challenge-incoming p {
  margin: 0 0 0.65rem;
  color: #f0e6c8;
  font-style: italic;
}

.challenge-actions {
  display: flex;
  gap: 0.5rem;
}

#challenge-incoming button {
  padding: 0.4rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  flex: 1;
  transition: filter 0.15s;
}

#challenge-incoming button:hover {
  filter: brightness(1.15);
}

#accept-challenge-btn {
  background: linear-gradient(180deg, #5fc568 0%, #4caf50 50%, #357a3a 100%);
  border-color: #357a3a;
  color: #0b0d12;
}

#decline-challenge-btn {
  background: linear-gradient(180deg, #4a4a5a 0%, #2a2a3a 100%);
  border-color: #2a2a3a;
  color: #c8c8d4;
}

.lobby-deck-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lobby-deck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(180deg, rgba(11,13,18,0.7) 0%, rgba(11,13,18,0.5) 100%);
  border: 1px solid rgba(196,163,90,0.2);
  border-left: 2px solid rgba(196,163,90,0.4);
  border-radius: 3px;
  transition: border-color 0.15s;
}

.lobby-deck-item:hover {
  border-color: rgba(196,163,90,0.5);
  border-left-color: #c4a35a;
}

.lobby-deck-item--owned {
  border-left-color: #4caf50;
}

.lobby-deck-item--current {
  border-color: #c4a35a;
  border-left-color: #f5d98a;
  background: linear-gradient(180deg, rgba(196,163,90,0.12) 0%, rgba(196,163,90,0.04) 100%);
  box-shadow: 0 0 12px rgba(196,163,90,0.15);
}

.lobby-deck-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.lobby-deck-name {
  color: #e8dfc4;
  font-weight: 700;
  font-size: 0.95rem;
}

.lobby-deck-meta {
  color: #8a8a98;
  font-size: 0.75rem;
  font-style: italic;
}

.lobby-deck-warning {
  color: #e05050;
  font-size: 0.75rem;
}

.lobby-deck-warning--uncertified {
  color: #d4a530;
}

.lobby-deck-item button {
  padding: 0.35rem 0.85rem;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #d4b36a 0%, #c4a35a 50%, #9a7f3e 100%);
  color: #1a1a2e;
  border: 1px solid #8b6f3a;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter 0.15s;
}

.lobby-deck-item button:hover {
  filter: brightness(1.1);
}

.lobby-deck-item button:disabled {
  background: linear-gradient(180deg, #5fc568 0%, #4caf50 50%, #357a3a 100%);
  border-color: #357a3a;
  color: #0b0d12;
  cursor: default;
  filter: none;
}

.lobby-delete-btn {
  background: #c0392b !important;
}
.lobby-delete-btn:hover {
  background: #e74c3c !important;
}

/* ---- Compact deck preview ---- */

#current-deck-preview {
  border: 1px solid #334;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  flex: 1;
}

.compact-deck-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #c4a35a;
  margin-bottom: 0.15rem;
}

.compact-deck-alignment {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}

.compact-deck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.25rem 1rem;
}

.compact-deck-section {
  min-width: 0;
}

.compact-deck-heading {
  font-size: 0.8rem;
  font-weight: bold;
  color: #c4a35a;
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compact-deck-entry {
  font-size: 0.82rem;
  color: #ccc;
  padding: 0.1rem 0;
  line-height: 1.3;
}

.compact-deck-entry--missing {
  color: #666;
}

/* ---- Deck editor ---- */

.deck-editor-back {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  background: transparent;
  color: #c4a35a;
  border: 1px solid #c4a35a;
  border-radius: 4px;
  cursor: pointer;
}

.deck-editor-back:hover {
  background: rgba(196, 163, 90, 0.15);
}

.deck-editor-content {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.deck-editor-section {
  flex: 1;
  min-width: 0;
}

.deck-editor-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deck-editor-card {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  background: #16213e;
  border-radius: 3px;
  gap: 0.5rem;
}

.deck-editor-card-qty {
  color: #888;
  font-size: 0.8rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

.deck-editor-card-name {
  color: #e0e0e0;
  font-size: 0.85rem;
}

.deck-editor-certified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.8em;
  min-width: 0.8em;
  height: 0.8em;
  margin-right: 0.2em;
  font-size: 0.85em;
  flex-shrink: 0;
  position: relative;
  top: -2px;
}

.deck-editor-certified-badge:not(:empty) {
  color: #cd7f32;
}

.deck-editor-card--unknown {
  opacity: 0.35;
}

.deck-editor-card--unknown:hover {
  opacity: 0.7;
}

.deck-editor-request-btn {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  background: transparent;
  color: #c4a35a;
  border: 1px solid #c4a35a;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.deck-editor-request-btn:hover {
  background: rgba(196, 163, 90, 0.15);
}

.deck-editor-request-btn:disabled {
  color: #4caf50;
  border: none;
  cursor: default;
  background: transparent;
}

.deck-editor-certify-btn {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  background: transparent;
  color: #cd7f32;
  border: 1px solid #cd7f32;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.deck-editor-certify-btn:hover {
  background: rgba(205, 127, 50, 0.15);
}

.deck-editor-certify-btn:disabled {
  color: #4caf50;
  border: none;
  cursor: default;
  background: transparent;
}

.deck-editor-notice {
  margin: 0 0 0.75rem 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid #c9a227;
  background: rgba(201, 162, 39, 0.1);
  color: #c9a227;
  font-style: italic;
  font-size: 0.9rem;
}

.deck-editor-preview {
  position: fixed;
  top: 4rem;
  z-index: 100;
  pointer-events: none;
}

.deck-editor-preview.preview-left {
  left: 1rem;
}

.deck-editor-preview.preview-right {
  right: 1rem;
}

.deck-editor-preview:empty {
  display: none;
}

.deck-editor-preview img {
  width: 18rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  display: block;
}

#connect-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#connect-form input {
  padding: 0.5rem;
  font-size: 1rem;
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #334;
  border-radius: 4px;
  width: 200px;
}

#connect-form select {
  padding: 0.5rem;
  font-size: 1rem;
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #334;
  border-radius: 4px;
}

#connect-form button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: #c4a35a;
  color: #1a1a2e;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

#connect-form button:hover {
  background: #d4b36a;
}

.hidden {
  display: none !important;
}

.pile-toggle {
  cursor: pointer;
  display: inline-block;
  width: 1.2em;
  text-align: center;
  font-weight: bold;
  color: #8af;
  border: 1px solid #456;
  border-radius: 3px;
  font-size: 0.85em;
  line-height: 1.2;
  margin-left: 0.3em;
  user-select: none;
}
.pile-toggle:hover {
  background: #345;
  color: #bdf;
}

#toolbar {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  z-index: var(--z-hover);
}

#toolbar-main {
  display: flex;
  gap: 0.5rem;
}

#toolbar-dev {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: stretch;
}

#toolbar-view {
  display: flex;
  align-items: flex-end;
}

#toolbar button {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  background: transparent;
  color: #888;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}

#toolbar button:hover {
  opacity: 1;
  color: #e0e0e0;
  border-color: #c4a35a;
}

#toolbar button:active {
  background: rgba(196, 163, 90, 0.3);
  transform: scale(0.95);
}

#toolbar select {
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
  background: #1e1e36;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}

#toolbar select:hover {
  opacity: 1;
  color: #e0e0e0;
  border-color: #c4a35a;
}

#toolbar select option {
  background: #1e1e36;
  color: #e0e0e0;
}

#toolbar button.btn-flash {
  animation: btn-flash 0.4s ease-out;
}

@keyframes btn-flash {
  0% { background: rgba(196, 163, 90, 0.5); color: #fff; }
  100% { background: transparent; }
}

/* Settings modal */

#settings-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

#settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

#settings-dialog {
  position: relative;
  background: #1e1e36;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 280px;
  color: #e0e0e0;
}

#settings-dialog h3 {
  margin: 0 0 1rem;
  color: #c4a35a;
  font-size: 1rem;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.settings-toggle input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: #444;
  border-radius: 11px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #ccc;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.settings-toggle input:checked + .toggle-slider {
  background: #c4a35a;
}

.settings-toggle input:checked + .toggle-slider::after {
  transform: translateX(18px);
  background: #fff;
}

.settings-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #666;
  line-height: 1.3;
}

#settings-close-btn {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.4rem;
  background: transparent;
  color: #888;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

#settings-close-btn:hover {
  color: #e0e0e0;
  border-color: #c4a35a;
}

#debug-view {
  display: flex;
  gap: 1rem;
}

#left-panel {
  flex: 2;
  min-width: 0;
}

#copy-game-code-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 2px 4px;
  margin-left: 8px;
  vertical-align: middle;
}
#copy-game-code-btn:hover { color: #fff; }

#right-panel {
  flex: 1;
  min-width: 0;
  padding-top: 2.5rem;
  padding-right: 5.2rem;
}

#state, #draft, #mh-info, #site-info {
  background: #16213e;
  padding: 0.75rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  margin-bottom: 1rem;
  min-height: 3rem;
}

.active-player-frame {
  border: 1px solid #8899aa;
  border-radius: 3px;
  padding: 0.25rem 0.4rem;
  margin: 0.15rem 0;
}

.combat-frame {
  border: 2px solid #c44;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  margin: 0.25rem 0;
  background: rgba(180, 40, 40, 0.12);
}

.chain-frame {
  border: 2px solid #c4a35a;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
  margin: 0.25rem 0;
  background: rgba(196, 163, 90, 0.1);
}

#actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#actions button {
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  background: #1a2a4a;
  color: #e0e0e0;
  border: 1px solid #c4a35a44;
  border-left: 3px solid #c4a35a;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  word-break: break-word;
  transition: background 0.15s, border-color 0.15s;
}

#actions button:hover {
  background: #1e3a60;
  border-color: #c4a35a;
  border-left-color: #d4b36a;
}

#actions button:active {
  background: #254a70;
}

#actions button:disabled {
  opacity: 0.5;
  cursor: default;
  border-color: #444;
}

#actions button:disabled:hover {
  background: #1a2a4a;
  border-color: #444;
}

#actions button.action-regress {
  opacity: 0.5;
}

.action-reason {
  color: #c4a35a;
  font-style: italic;
}

.action-json-toggle {
  display: inline-block;
  margin-left: 0.5rem;
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #c4a35a;
  background: #0004;
  border-radius: 3px;
  cursor: pointer;
  vertical-align: middle;
}

.action-json-toggle:hover {
  background: #fff2;
}

.action-json {
  margin-top: 0.4rem;
  padding: 0.4rem;
  font-size: 0.7rem;
  background: #0003;
  border-radius: 3px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #aaa;
  text-align: left;
}

#log-panel {
  margin-top: 0.5rem;
}

#log {
  background: #0f0f23;
  padding: 0.5rem;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  max-height: 1000px;
  overflow-y: auto;
  color: #888;
}

#log div {
  padding: 1px 0;
}

/* Visual view */

#visual-view {
  background: var(--visual-bg, url('images/visual-bg.png')) center/cover no-repeat fixed;
  min-height: 100vh;
  margin: -1rem;
  padding: 1rem;
  position: relative;
  z-index: var(--z-base);
}

#visual-view::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: -1;
}

#instruction-text {
  font-family: 'MedievalSharp', cursive;
  font-size: 1.4rem;
  color: rgba(220, 200, 140, 0.9);
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.8), 0 0 24px rgba(0, 0, 0, 0.6);
  padding: 0.5rem 2rem;
  position: fixed;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-instruction);
  pointer-events: none;
  width: 80vw;
  max-width: 80vw;
  white-space: normal;
}

.drafted-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  position: fixed;
  left: 15vw;
  right: 15vw;
  z-index: var(--z-drafted);
}

.drafted-row:hover {
  z-index: var(--z-hover);
}

.drafted-row:empty {
  display: none;
}

#drafted-self {
  bottom: calc(38vh - 0.6 * var(--card-height));
}

#drafted-opponent {
  top: calc(12vh + 0.2 * var(--card-height));
}

#set-aside {
  position: fixed;
  left: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: var(--z-set-aside);
  background: rgba(10, 8, 4, 0.85);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

#set-aside .set-aside-card + .set-aside-card {
  margin-top: calc(-0.7 * var(--card-table-height));
}

#set-aside:empty {
  display: none;
}

.set-aside-label {
  font-family: 'MedievalSharp', cursive;
  font-size: 1rem;
  color: rgba(220, 200, 140, 0.7);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.set-aside-card {
  height: var(--card-table-height);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  filter: brightness(0.5) saturate(0.5);
  transition: filter 0.2s ease;
  cursor: pointer;
  position: relative;
}

.set-aside-card:hover {
  filter: none;
}

.drafted-card-group {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
}

.drafted-card {
  height: var(--card-table-height);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.drafted-item {
  height: calc(var(--card-table-height) * 0.75);
}

.mind-total {
  font-family: 'Cinzel', serif;
  font-size: 2.6rem;
  font-weight: bold;
  color: rgba(220, 200, 140, 0.9);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  position: fixed;
  left: 2rem;
  margin-top: calc(0.25 * var(--card-height));
  text-align: center;
  line-height: 1;
}

.mind-total-opponent {
  margin-top: calc(0.25 * var(--card-height));
}

.mind-total-label {
  display: block;
  font-family: 'MedievalSharp', cursive;
  font-size: 1.4rem;
  font-weight: normal;
  letter-spacing: 0.05em;
}

.drafted-spacer {
  width: 2rem;
  flex-shrink: 0;
}

.drafted-card-facedown {
  opacity: 0.8;
  box-shadow:
    0 0 10px rgba(var(--color-selectable), 0.6),
    0 4px 16px rgba(0, 0, 0, 0.7);
}


#instruction-text:empty {
  display: none;
}

#visual-board {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  padding-top: 4rem;
  min-height: 80vh;
}

.card-image {
  max-height: 30vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.card-art-wrap {
  position: relative;
  filter:
    drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6))
    drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
}

.card-art-frame {
  clip-path: inset(3% 11% 17% 18% round 6px);
  background: rgb(160, 130, 60);
  padding: 4px;
}

.card-art {
  display: block;
  max-height: 30vh;
  object-fit: cover;
  object-position: center 25%;
  aspect-ratio: 4 / 3;
  border-radius: 2px;
  cursor: pointer;
}

.card-art-wrap .card-full {
  display: none;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  z-index: var(--z-preview);
  pointer-events: none;
}

.card-art-wrap:hover .card-full {
  display: block;
}

/* Deck box: wraps name + score + pile grid */
.deck-box {
  position: fixed;
  left: 1rem;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: rgba(80, 75, 65, 0.75);
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  backdrop-filter: blur(4px);
  width: 8.5rem;
}

.deck-box--self {
  bottom: 0.5rem;
}

.deck-box--opponent {
  top: 0.5rem;
}

.deck-box--compact .player-piles {
  display: none;
}

.deck-box--compact {
  cursor: pointer;
}

.player-label {
  font-family: 'MedievalSharp', cursive;
  font-size: 1rem;
  color: rgba(196, 163, 90, 0.9);
  pointer-events: auto;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  padding: 0.1rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.deck-box-score {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
}

.player-piles {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.3rem;
}

.pile-cell {
  pointer-events: auto;
}

.dice-tray {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(60, 55, 45, 0.75);
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  min-height: 1.8rem;
  perspective: 300px;
}

.dice-tray:empty {
  display: none;
}

.pile-cell--wide {
  grid-column: span 2;
  justify-self: center;
}

#self-site-pile {
  pointer-events: auto;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

#self-site-pile:hover {
  filter: brightness(1.3);
  transform: scale(1.05);
}

#self-site-pile.site-pile--active {
  box-shadow: 0 0 14px 5px rgba(196, 163, 90, 0.9);
  border-radius: 6px;
  animation: site-pile-pulse 1.5s ease-in-out infinite;
}

@keyframes site-pile-pulse {
  0%, 100% { box-shadow: 0 0 14px 5px rgba(196, 163, 90, 0.9); }
  50% { box-shadow: 0 0 22px 8px rgba(196, 163, 90, 1); }
}

/* Fetch-from-pile: highlight sideboard/discard pile during fetch sub-flow */
.pile--fetch-active {
  box-shadow: 0 0 14px 5px rgba(196, 163, 90, 0.9);
  border-radius: 6px;
  animation: site-pile-pulse 1.5s ease-in-out infinite;
}

/* Clickable pile cells (sideboard, victory display) */
.pile-cell--clickable {
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

.pile-cell--clickable:hover {
  filter: brightness(1.3);
  transform: scale(1.05);
}

/* Pile browser modal (shared by site deck, sideboard, victory display) */
#pile-browser-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

#pile-browser-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

#pile-browser-dialog {
  position: relative;
  background: rgba(15, 12, 8, 0.92);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 1.5rem;
  width: 80vw;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  color: #e0e0e0;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

#pile-browser-dialog.pile-browser--overlapping {
  overflow-y: hidden;
}

#pile-browser-dialog h3 {
  margin: 0 0 1rem;
  color: #c4a35a;
  font-family: 'MedievalSharp', serif;
  font-size: 1.2rem;
  text-align: center;
}

#pile-browser-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
}

#pile-browser-grid img {
  height: 25vh;
  aspect-ratio: 5 / 7;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s, box-shadow 0.15s;
  background: #000;
}

#pile-browser-grid img.site-selectable {
  cursor: pointer;
  box-shadow: 0 0 12px 4px rgba(196, 163, 90, 0.8);
  border: 2px solid #c4a35a;
}

#pile-browser-grid img.site-selectable:hover {
  transform: scale(1.08);
  box-shadow: 0 0 18px 6px rgba(196, 163, 90, 1);
}

#pile-browser-grid img.site-dimmed {
  filter: grayscale(0.6) brightness(0.3);
}

/*
 * Rule 2.II.7.2 — a site already in play at another of the player's
 * companies can be the destination of a plan-movement. Paint these cards
 * distinctly from deck-drawn playable sites: dashed border + cool-toned
 * glow so they read as "shared, not drawn."
 */
#pile-browser-grid img.site-in-play-selectable {
  cursor: pointer;
  box-shadow: 0 0 12px 4px rgba(110, 170, 220, 0.75);
  border: 2px dashed #6eaadc;
}

#pile-browser-grid img.site-in-play-selectable:hover {
  transform: scale(1.08);
  box-shadow: 0 0 18px 6px rgba(110, 170, 220, 1);
}

.pile-browser-empty {
  color: #888;
  font-style: italic;
  padding: 2rem;
  text-align: center;
  grid-column: 1 / -1;
}

.pile-browser-stack {
  position: relative;
  height: calc(25vh + 2rem);
  margin: 1rem auto;
}

.pile-browser-stack img {
  position: absolute;
  top: 0;
  height: 25vh;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.pile-browser-stack-label {
  position: absolute;
  bottom: -1.8rem;
  left: 0;
  right: 0;
  text-align: center;
  color: #c4a35a;
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
}

/* ---- Snapshot modal ---- */

#snapshot-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
}

#snapshot-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

#snapshot-dialog {
  position: relative;
  background: rgba(15, 12, 8, 0.92);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  color: #e0e0e0;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

#snapshot-dialog h3 {
  margin: 0 0 1rem;
  color: #c4a35a;
  font-family: 'MedievalSharp', serif;
  font-size: 1.2rem;
  text-align: center;
}

#snapshot-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.snapshot-item {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.snapshot-item:hover {
  background: rgba(196, 163, 90, 0.15);
  border-color: rgba(196, 163, 90, 0.7);
}

.snapshot-item-name {
  font-weight: bold;
  color: #c4a35a;
  margin-bottom: 0.25rem;
}

.snapshot-item-images {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.snapshot-item-images img {
  height: 10rem;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.snapshot-item-desc {
  font-size: 0.85rem;
  color: #aaa;
}

.pile-cell:empty {
  display: none;
}

.deck-pile-wrapper {
  position: relative;
  display: inline-block;
}

.deck-pile-card {
  position: absolute;
  height: 5rem;
  border-radius: 3px;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.deck-pile-card--empty {
  opacity: 0.25;
  box-shadow: none;
}

.deck-pile-label {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translate(-50%, 0);
  z-index: var(--z-attachment);
  font-family: 'MedievalSharp', cursive;
  font-size: 0.8rem;
  color: #f0dc50;
  white-space: nowrap;
  background: rgba(10, 15, 30, 0.85);
  border-radius: 4px;
  padding: 1px 5px;
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
}

.score {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0.1rem 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 4px;
  display: block;
  text-align: center;
  pointer-events: auto;
  cursor: default;
  position: relative;
}

.score:hover .mp-tooltip {
  display: block;
}

.mp-tooltip {
  display: none;
  position: absolute;
  left: 0;
  z-index: var(--z-hover);
  background: rgba(15, 12, 8, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.6);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
}

.mp-tooltip--above {
  bottom: 100%;
  margin-bottom: 0.4rem;
}

.mp-tooltip--below {
  top: 100%;
  margin-top: 0.4rem;
}

.mp-tooltip-table {
  border-collapse: collapse;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: rgba(196, 163, 90, 0.9);
}

.mp-tooltip-table th,
.mp-tooltip-table td {
  padding: 0.15rem 0.5rem;
  text-align: left;
}

.mp-header {
  font-weight: bold;
  border-bottom: 1px solid rgba(196, 163, 90, 0.4);
  padding-bottom: 0.25rem;
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-label {
  text-align: left;
  color: rgba(196, 163, 90, 0.6);
  font-weight: normal;
}

.mp-total {
  font-weight: bold;
  border-top: 1px solid rgba(196, 163, 90, 0.4);
  padding-top: 0.25rem;
}

.mp-adjusted {
  color: #f0dc50;
}

.mp-raw {
  color: rgba(196, 163, 90, 0.4);
  font-size: 0.65rem;
}

.debug-score {
  position: relative;
  cursor: default;
  border-bottom: 1px dotted rgba(196, 163, 90, 0.5);
}

.debug-score:hover .mp-tooltip {
  display: block;
}

#toast-container {
  position: fixed;
  top: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
}

.toast {
  font-family: 'MedievalSharp', cursive;
  font-size: 0.95rem;
  color: rgba(196, 163, 90, 0.95);
  background: rgba(15, 12, 8, 0.9);
  border: 1px solid rgba(196, 163, 90, 0.4);
  border-radius: 6px;
  padding: 0.4rem 1rem;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  opacity: 0;
  animation: toast-in 0.3s ease forwards, toast-out 0.4s ease 9s forwards;
}

.toast--opponent {
  color: rgba(140, 180, 220, 0.95);
  border-color: rgba(140, 180, 220, 0.4);
}

.toast--error {
  color: #e06060;
  border-color: rgba(224, 96, 96, 0.4);
}

.toast--system {
  color: rgba(220, 140, 130, 0.95);
  background: rgba(40, 12, 10, 0.9);
  border-color: rgba(220, 140, 130, 0.4);
  animation: toast-in 0.3s ease forwards;
  pointer-events: auto;
  cursor: default;
}

.toast--system .toast-close {
  margin-left: 0.6rem;
  cursor: pointer;
  opacity: 0.6;
}

.toast--system .toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

#card-preview {
  position: fixed;
  right: 0.5rem;
  top: 2.5rem;
  z-index: var(--z-action-menu);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

#card-preview > img {
  height: 50vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

#card-preview:empty {
  display: none;
}

.card-preview-info {
  background: rgba(10, 8, 4, 0.4);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  box-sizing: border-box;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.card-preview-info img {
  width: 18rem;
  border-radius: 4px;
  margin-bottom: 0.4rem;
  display: block;
}

.card-preview-name {
  font-family: 'MedievalSharp', cursive;
  font-size: 1.1rem;
  color: rgba(220, 200, 140, 1);
  text-align: center;
  margin-bottom: 0.4rem;
}

.card-preview-attr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.1rem 0;
  font-size: 0.8rem;
  color: rgba(210, 200, 170, 0.9);
}

.attr-label {
  color: rgba(160, 145, 110, 0.9);
  margin-right: 0.5rem;
}

.attr-value {
  color: rgba(230, 215, 170, 1);
  text-align: right;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

#pass-btn {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: var(--z-panel);
  font-family: 'MedievalSharp', cursive;
  font-size: 1.4rem;
  color: rgba(220, 200, 140, 0.9);
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 0.6rem 2rem;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  transition: background 0.2s ease, border-color 0.2s ease;
}

#pass-btn:hover {
  background: rgba(196, 163, 90, 0.3);
  border-color: rgba(196, 163, 90, 0.8);
}

.enter-site-btn {
  position: fixed;
  right: 2rem;
  bottom: 5.4rem;
  z-index: var(--z-panel);
  font-family: 'MedievalSharp', cursive;
  font-size: 1.4rem;
  color: rgba(140, 220, 160, 0.9);
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(90, 196, 120, 0.5);
  border-radius: 8px;
  padding: 0.6rem 2rem;
  cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.enter-site-btn:hover {
  background: rgba(90, 196, 120, 0.3);
  border-color: rgba(90, 196, 120, 0.8);
}

/* Card arcs — fanned cards at top and bottom of the visual view */

#hand-arc, #opponent-arc {
  --total: 8;
  --spread: 6deg;
  position: fixed;
  left: 10vw;
  right: 10vw;
  display: flex;
  justify-content: center;
  z-index: var(--z-board);
  pointer-events: none;
}

#hand-arc > *, #opponent-arc > * {
  pointer-events: auto;
}

#hand-arc {
  bottom: -10vh;
  transition: bottom 0.3s ease;
}

/*
 * Hover catch zone: a transparent rectangle that spans the full horizontal
 * extent of the arc and stretches from the top of the visible cards down
 * to the bottom edge of the screen. Without this, the cursor passing
 * through a gap between fanned cards (the "valley" of the arc) loses
 * :hover on every card and the arc flickers shut. The catch zone is
 * suppressed while the hand is empty so we don't block clicks on
 * underlying UI during setup or other handless phases.
 */
#hand-arc:not(:empty)::before {
  content: '';
  position: fixed;
  left: 10vw;
  right: 10vw;
  bottom: 0;
  height: var(--card-height);
  pointer-events: auto;
  z-index: -1;
}

#hand-arc:hover {
  bottom: 0;
  z-index: var(--z-hover);
}

#opponent-arc {
  top: -19vh;
}

.hand-card {
  height: var(--card-height);
  border-radius: 8px;
  box-shadow:
    0 0 12px rgba(var(--color-selectable), 1),
    0 0 30px rgba(var(--color-selectable), 0.7),
    0 4px 16px rgba(0, 0, 0, 0.7);
  margin: 0 var(--card-margin, -2.5vh);
  transform-origin: bottom center;
  transform: rotate(calc((var(--i) - (var(--total) - 1) / 2) * var(--spread)))
             translateY(calc(pow(var(--i) - (var(--total) - 1) / 2, 2) * 1.5%));
  cursor: pointer;
  position: relative;
}


.hand-card-dimmed {
  filter: brightness(0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7) !important;
  cursor: default;
}

.hand-card-playable:hover {
  box-shadow:
    0 0 16px rgba(var(--color-selectable), 1),
    0 0 40px rgba(var(--color-selectable), 0.7),
    0 8px 32px rgba(0, 0, 0, 0.9);
}

.hand-card-selected {
  box-shadow:
    0 0 16px rgba(var(--color-selected), 1),
    0 0 40px rgba(var(--color-selected), 0.7),
    0 4px 16px rgba(0, 0, 0, 0.7);
  z-index: var(--z-panel);
}

.hand-card-selected:hover {
  box-shadow:
    0 0 16px rgba(var(--color-selected), 1),
    0 0 40px rgba(var(--color-selected), 0.7),
    0 8px 32px rgba(0, 0, 0, 0.9);
}

.drafted-card-target {
  box-shadow:
    0 0 16px rgba(var(--color-target), 1),
    0 0 40px rgba(var(--color-target), 0.6),
    0 4px 16px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}


.drafted-card-selectable {
  box-shadow:
    0 0 16px rgba(var(--color-selectable), 1),
    0 0 40px rgba(var(--color-selectable), 0.6),
    0 4px 16px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}


.opponent-card {
  height: var(--card-height);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.7);
  margin: 0 var(--card-margin, -2.5vh);
  transform-origin: top center;
  transform: rotate(calc((var(--i) - (var(--total) - 1) / 2) * var(--spread) * -1))
             translateY(calc(pow(var(--i) - (var(--total) - 1) / 2, 2) * -1.5%));
  cursor: pointer;
  position: relative;
}


/* Card name hover preview */

.card-name {
  cursor: pointer;
  border-bottom: 1px dotted currentColor;
}

#card-hover-img {
  display: none;
  position: fixed;
  pointer-events: none;
  z-index: var(--z-modal);
  height: 500px;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

#card-hover-json {
  display: none;
  position: fixed;
  pointer-events: none;
  z-index: var(--z-modal);
  max-width: 350px;
  margin: 0;
  padding: 0.5rem;
  background: rgba(10, 8, 4, 0.95);
  border: 1px solid rgba(100, 90, 60, 0.6);
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  font-family: monospace;
  font-size: 0.7rem;
  color: rgba(180, 170, 140, 0.9);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Dice roller (Lidless Eye style) ---- */

.dice-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  pointer-events: none;
  animation: dice-fade-in 0.2s ease-out;
}

.dice-overlay.dice-fade-out {
  animation: dice-fade-out 0.3s ease-in forwards;
}

@keyframes dice-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dice-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.dice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.dice-position-red {
  transform: translateY(-100px);
}

.dice-position-black {
  transform: translateY(100px);
}

.dice-row {
  display: flex;
  gap: 3rem;
}

.dice-scene {
  width: 90px;
  height: 90px;
  perspective: 400px;
}

/* Mini dice for inline display next to player names */
.dice-mini {
  width: 24px;
  height: 24px;
  perspective: 200px;
  display: inline-block;
  vertical-align: middle;
}
.dice-mini .dice-face {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.dice-mini .dice-pip {
  width: 5px;
  height: 5px;
}
.dice-mini .dice-eye {
  inset: 3px;
}
.dice-mini .dice-front  { transform: translateZ(12px); }
.dice-mini .dice-back   { transform: rotateY(180deg) translateZ(12px); }
.dice-mini .dice-right  { transform: rotateY(90deg)  translateZ(12px); }
.dice-mini .dice-left   { transform: rotateY(-90deg) translateZ(12px); }
.dice-mini .dice-top    { transform: rotateX(90deg)  translateZ(12px); }
.dice-mini .dice-bottom { transform: rotateX(-90deg) translateZ(12px); }

.dice-inline-pair {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.dice-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

/* Red die: dark red body, black pips */
.dice-red .dice-face {
  background: linear-gradient(135deg, #b22020, #8a1515);
  border: 2px solid #d44;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.3);
}

.dice-red .dice-pip {
  background: radial-gradient(circle at 35% 35%, #222, #000);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.dice-red .dice-eye {
  color: #111;
}

/* Black die: dark body, red pips */
.dice-black .dice-face {
  background: linear-gradient(135deg, #2a2a2a, #151515);
  border: 2px solid #444;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.5);
}

.dice-black .dice-pip {
  background: radial-gradient(circle at 35% 35%, #e03030, #a01010);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.dice-black .dice-eye {
  color: #d03030;
}

.dice-face {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 10px;
}

.dice-pip {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.dice-eye {
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice-eye svg {
  width: 100%;
  height: 100%;
}

.dice-front  { transform: translateZ(45px); }
.dice-back   { transform: rotateY(180deg) translateZ(45px); }
.dice-right  { transform: rotateY(90deg)  translateZ(45px); }
.dice-left   { transform: rotateY(-90deg) translateZ(45px); }
.dice-top    { transform: rotateX(90deg)  translateZ(45px); }
.dice-bottom { transform: rotateX(-90deg) translateZ(45px); }

/* ---- Company views (play phase) ---- */

/* Single company view — one company at full scale */
.company-single {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem;
  padding-top: calc(var(--card-table-height) * 0.5 + 4rem);
  flex: 1;
  width: 100%;
}

.company-single .company-block {
  background: none;
  border-radius: 0;
}


/* Navigation arrows — large fading arrows on left/right of single view */
.company-nav-arrow {
  position: fixed;
  top: 42%;
  transform: translateY(0%);
  background: none;
  border: none;
  color: rgba(196, 163, 90, 0.25);
  cursor: pointer;
  padding: 1rem;
  z-index: var(--z-board);
  transition: color 0.3s;
}

.company-nav-arrow:hover {
  color: rgba(230, 200, 120, 0.8);
}

/* Flash effect for keyboard-activated buttons */
.btn--flash {
  color: rgba(230, 200, 120, 0.9) !important;
  background: rgba(196, 163, 90, 0.15) !important;
  transition: color 0.3s ease-out, background 0.3s ease-out;
}

.company-nav-arrow--left {
  left: 1rem;
}

.company-nav-arrow--right {
  right: 3.5rem;
}

/* View toggle button — right edge of the board */
.company-view-toggle {
  position: absolute;
  right: 0.75rem;
  top: calc(50% + 1rem);
  transform: none;
  background: rgba(30, 30, 30, 0.8);
  border: 1px solid rgba(196, 163, 90, 0.4);
  border-radius: 6px;
  color: rgba(196, 163, 90, 0.8);
  padding: 0.5rem;
  cursor: pointer;
  z-index: var(--z-board);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.company-view-toggle:hover {
  background: rgba(50, 45, 30, 0.9);
  border-color: rgba(196, 163, 90, 0.8);
  color: rgba(230, 200, 120, 1);
}

/* Company block */
.company-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  transition: background 0.2s, box-shadow 0.2s;
}

.company-block--inactive {
  filter: brightness(0.5) saturate(0.6);
}

.company-block--clickable {
  cursor: pointer;
}

.company-block--clickable:hover {
  background: rgba(196, 163, 90, 0.15);
  box-shadow: 0 0 12px rgba(196, 163, 90, 0.3);
}

.company-block--target {
  cursor: pointer;
  background: rgba(var(--color-target), 0.1);
  box-shadow:
    0 0 12px rgba(var(--color-target), 0.6),
    0 0 30px rgba(var(--color-target), 0.3);
}

.company-block--target:hover {
  background: rgba(var(--color-target), 0.2);
  box-shadow:
    0 0 16px rgba(var(--color-target), 0.8),
    0 0 40px rgba(var(--color-target), 0.4);
}

.company-name {
  font-family: 'MedievalSharp', serif;
  font-size: calc(1.2rem * var(--company-scale, 1));
  color: rgba(196, 163, 90, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  text-align: center;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}


.company-name--self {
  background: linear-gradient(135deg, rgba(42, 42, 42, 0.85), rgba(21, 21, 21, 0.85));
  border: 1px solid #444;
}

.company-name--opponent {
  background: linear-gradient(135deg, rgba(178, 32, 32, 0.85), rgba(138, 21, 21, 0.85));
  border: 1px solid #d44;
}

.company-moved-badge {
  color: #4a4;
  margin-left: 0.3rem;
}

/* Cards row: site + characters in one horizontal line */
.company-row {
  display: flex;
  align-items: flex-start;
  gap: calc(0.5rem * var(--company-scale, 1));
  flex-wrap: wrap;
}

/* Site area */
.company-site-area {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: calc(1rem * var(--company-scale, 1));
}

.company-movement-arrow {
  color: #c4a35a;
  padding: 0 0.3rem;
}

.company-movement-arrow svg {
  width: calc(2.5rem * var(--company-scale, 1));
  height: calc(1.5rem * var(--company-scale, 1));
}

.company-movement-path {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.company-card--region {
  height: calc(var(--card-table-height) * var(--company-scale, 1) * 0.6);
  border-radius: 4px;
}

/* Characters shifted down by 25% of card height relative to the site */
.company-row > .character-column {
  margin-top: calc(var(--card-table-height) * var(--company-scale, 1) * 0.25);
}

.character-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.character-card-wrap {
  position: relative;
  z-index: var(--z-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-card-wrap--tapped {
  /* Reserve horizontal space for the rotated card; height matches untapped
     wraps so all characters share the same baseline.  Collapse the empty
     space below the rotated visual (≈14% of card height) so items don't
     drift far below the card. */
  width: calc(var(--card-table-height) * var(--company-scale, 1));
  margin-bottom: calc(var(--card-table-height) * var(--company-scale, 1) * -0.35);
}

/* When a tapped character has attachments, use less collapse so the
   prowess/body badge (which rotates to the bottom-left) stays visible
   above the attachment row. */
.character-card-wrap--tapped.character-card-wrap--has-attachments {
  margin-bottom: calc(var(--card-table-height) * var(--company-scale, 1) * -0.2);
}

/* Card sizing */
.company-card {
  height: calc(var(--card-table-height) * var(--company-scale, 1));
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Fade and collapse cards that have another card below them */
.company-card--faded {
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 75%);
  mask-image: linear-gradient(to bottom, black 50%, transparent 75%);
  margin-bottom: calc(var(--card-table-height) * var(--company-scale, 1) * -0.35);
}

/* Wounded (upside-down) cards fade from the top instead.
   Use margin-top (not margin-bottom) so the collapse happens at the top
   of the rotated inner wrapper, keeping the card at the correct height. */
.company-card--faded-top {
  -webkit-mask-image: linear-gradient(to top, black 50%, transparent 75%);
  mask-image: linear-gradient(to top, black 50%, transparent 75%);
  margin-top: calc(var(--card-table-height) * var(--company-scale, 1) * -0.35);
}

/* Remove mask when card is highlighted so the glow shows through */
.company-card--faded.company-card--influence-source,
.company-card--faded.company-card--influence-selected,
.company-card--faded.company-card--influence-target,
.company-card--faded.company-card--transfer-source,
.company-card--faded.company-card--transfer-selected,
.company-card--faded.company-card--transfer-target,
.company-card--faded.combat-card--assignable,
.company-card--faded.combat-card--supportable,
.company-card--faded.combat-card--strike-assigned,
.company-card--faded.combat-card--current-strike,
.company-card--faded.combat-card--strike-success,
.company-card--faded.combat-card--strike-wounded,
.company-card--faded.combat-card--strike-eliminated,
.company-card--faded-top.company-card--influence-source,
.company-card--faded-top.company-card--influence-selected,
.company-card--faded-top.company-card--influence-target,
.company-card--faded-top.company-card--transfer-source,
.company-card--faded-top.company-card--transfer-selected,
.company-card--faded-top.company-card--transfer-target,
.company-card--faded-top.combat-card--assignable,
.company-card--faded-top.combat-card--supportable,
.company-card--faded-top.combat-card--strike-assigned,
.company-card--faded-top.combat-card--current-strike,
.company-card--faded-top.combat-card--strike-success,
.company-card--faded-top.combat-card--strike-wounded,
.company-card--faded-top.combat-card--strike-eliminated {
  -webkit-mask-image: none;
  mask-image: none;
}

.company-card--site {
}

/* On-guard card wrapper: positioned container so on-guard cards stack over the site */
.on-guard-wrapper {
  position: relative;
  display: inline-block;
}

/* On-guard cards stacked vertically below the site, each offset further down */
.on-guard-card {
  position: absolute;
  left: 0;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  top: calc(25% * var(--og-index, 1));
}

/* Revealable on-guard card — golden glow to indicate it can be clicked */
.on-guard-card--revealable {
  box-shadow:
    0 0 8px rgba(var(--color-selectable), 0.7),
    0 0 16px rgba(var(--color-selectable), 0.4);
}

.on-guard-card:nth-child(2) { --og-index: 1; z-index: 1; }
.on-guard-card:nth-child(3) { --og-index: 2; z-index: 2; }
.on-guard-card:nth-child(4) { --og-index: 3; z-index: 3; }
.on-guard-card:nth-child(5) { --og-index: 4; z-index: 4; }
.on-guard-card:nth-child(6) { --og-index: 5; z-index: 5; }

/* Anchor wrapper around the site card for positioning constraint cards */
.constraint-anchor {
  position: relative;
  display: inline-block;
}

/* Strip of constraint cards on the right side of the site */
.constraint-strip {
  position: absolute;
  top: 0;
  left: 75%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 6;
}

/* Active constraint cards (Stealth, River, etc.) — miniature cards above the site */
.constraint-card {
  height: calc(var(--card-table-height) * var(--company-scale, 1) * 0.33);
  border: 2px solid rgba(120, 200, 255, 0.6);
  border-radius: 4px;
  box-shadow:
    0 0 6px rgba(120, 200, 255, 0.4),
    0 0 14px rgba(120, 200, 255, 0.2);
}

/* Site card not physically owned (split-off company) — ghosted with dashed border */
.company-card--site-ghost {
  opacity: 0.2;
  filter: grayscale(0.5);
  border: 2px dashed rgb(196, 163, 90);
  border-radius: 8px;
}

.company-card--movable {
  cursor: pointer;
  box-shadow:
    0 0 8px rgba(var(--color-selectable), 0.7),
    0 0 20px rgba(var(--color-selectable), 0.4);
}

.company-card--cancelable {
  cursor: pointer;
}

.company-card--item {
}

.company-card--follower {
}

.follower-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Tapped (sideways) — used by items and sites without badges */
.company-card--tapped {
  transform: rotate(90deg);
}

/* Tapped site in site area — add horizontal margin to compensate for
   rotation overflow so the adjacent arrow or region path stays visible. */
.company-site-area > .company-card--tapped {
  margin: 0 calc(var(--card-table-height) * var(--company-scale, 1) * 0.15);
}

/* Wounded (upside down) — used by items without badges */
.company-card--wounded {
  transform: rotate(180deg);
}

/* Inner wrapper rotates both the card image and its badges together */
.character-card-inner {
  position: relative;
  display: inline-block;
}
.character-card-inner--tapped {
  transform: rotate(90deg);
}
.character-card-inner--wounded {
  transform: rotate(180deg);
}

/* Influence move: source character available to move (golden glow) */
.company-card--influence-source {
  cursor: pointer;
  box-shadow:
    0 0 8px rgba(var(--color-selectable), 0.7),
    0 0 20px rgba(var(--color-selectable), 0.4);
}

/* Influence move: source character currently selected (green glow) */
.company-card--influence-selected {
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(var(--color-selected), 1),
    0 0 30px rgba(var(--color-selected), 0.7);
}

/* Influence move: valid controller target (blue glow) */
.company-card--influence-target {
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(var(--color-target), 1),
    0 0 30px rgba(var(--color-target), 0.6);
}

/* Transfer item: item available to transfer (golden glow) */
.company-card--transfer-source {
  cursor: pointer;
  box-shadow:
    0 0 8px rgba(var(--color-selectable), 0.7),
    0 0 20px rgba(var(--color-selectable), 0.4);
}

/* Transfer item: item currently selected (green glow) */
.company-card--transfer-selected {
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(var(--color-selected), 1),
    0 0 30px rgba(var(--color-selected), 0.7);
}

/* Transfer item: valid target character (blue glow) */
.company-card--transfer-target {
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(var(--color-target), 1),
    0 0 30px rgba(var(--color-target), 0.6);
}

/* Character attachments (items, allies, followers) */
.character-attachments {
  position: relative;
  z-index: var(--z-attachment);
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.15rem;
}

/* Stats badge — prowess/body (bottom-right) */
.char-stats-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-family: 'Cinzel', serif;
  font-size: calc(0.7rem * var(--company-scale, 1));
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(160, 35, 35, 0.9), rgba(110, 20, 20, 0.95));
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid rgba(255, 120, 120, 0.4);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Mind badge — cyan circle (left edge, top) */
.char-mind-badge {
  position: absolute;
  left: 6%;
  top: 15%;
  font-family: 'Cinzel', serif;
  font-size: calc(0.7rem * var(--company-scale, 1));
  font-weight: 700;
  color: #fff;
  background: radial-gradient(circle at 35% 35%, rgba(0, 150, 160, 0.9), rgba(0, 90, 100, 0.95));
  width: calc(1.3rem * var(--company-scale, 1));
  height: calc(1.3rem * var(--company-scale, 1));
  line-height: calc(1.3rem * var(--company-scale, 1));
  text-align: center;
  border-radius: 50%;
  border: 1px solid rgba(100, 220, 230, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.company-card--faded ~ .char-mind-badge {
  top: 25%;
}

/* Direct influence badge — amber circle (left edge, below mind) */
.char-di-badge {
  position: absolute;
  left: 6%;
  top: 27%;
  font-family: 'Cinzel', serif;
  font-size: calc(0.7rem * var(--company-scale, 1));
  font-weight: 700;
  color: #fff;
  background: radial-gradient(circle at 35% 35%, rgba(210, 155, 25, 0.9), rgba(140, 100, 10, 0.95));
  width: calc(1.3rem * var(--company-scale, 1));
  height: calc(1.3rem * var(--company-scale, 1));
  line-height: calc(1.3rem * var(--company-scale, 1));
  text-align: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 210, 80, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  padding: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.company-card--faded ~ .char-di-badge {
  top: 43%;
}

/* Title character badge */
.char-title-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: calc(1rem * var(--company-scale, 1));
  color: #c4a35a;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* Item card wrap (for CP badge positioning) */
.item-card-wrap {
  position: relative;
  display: inline-block;
}

/* Item corruption points badge */
.item-cp-badge {
  position: absolute;
  bottom: 10px;
  right: 2px;
  font-family: 'Cinzel', serif;
  font-size: calc(0.7rem * var(--company-scale, 1));
  font-weight: 700;
  color: #ff9090;
  background: linear-gradient(135deg, rgba(30, 0, 0, 0.8), rgba(50, 10, 10, 0.9));
  padding: 1px 3px;
  border-radius: 3px;
  border: 1px solid rgba(255, 100, 100, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Cards in play row (permanent resources, factions, etc.) */
.cards-in-play-row {
  position: absolute;
  top: calc(var(--card-table-height) * 0.3 + 1rem);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  z-index: var(--z-board);
}

.cards-in-play-group {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.cards-in-play-group--inactive {
  filter: brightness(0.5) saturate(0.6);
}

.cards-in-play-group--events {
  border: 1px solid rgba(196, 163, 90, 0.5);
  box-shadow: 0 0 8px rgba(196, 163, 90, 0.4);
}

/* Overview grid */
.company-overview-all {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem;
  padding-top: calc(var(--card-table-height) * 0.6 + 2rem);
}

.company-empty {
  font-family: 'MedievalSharp', serif;
  font-size: 1.2rem;
  color: rgba(196, 163, 90, 0.5);
  text-align: center;
  padding: 2rem;
}

/* Character action tooltip — modal backdrop */
.char-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-action-backdrop);
  background: transparent;
}

/* Character action tooltip — disambiguation menu */
.char-action-tooltip {
  z-index: var(--z-action-menu);
  transform: translate(-50%, -100%);
  margin-top: -8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(30, 25, 18, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.6);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.char-action-tooltip__btn {
  background: rgba(196, 163, 90, 0.15);
  color: #c4a35a;
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 4px;
  padding: 6px 14px;
  font-family: 'MedievalSharp', serif;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.char-action-tooltip__btn:hover {
  background: rgba(196, 163, 90, 0.35);
  border-color: rgba(196, 163, 90, 0.7);
}

/* Sideboard fetch modal — shows sideboard cards for avatar fetch action */
.sideboard-fetch-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-action-menu);
  background: rgba(15, 12, 8, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 1.2rem;
  max-width: 80vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.sideboard-fetch-title {
  color: #c4a35a;
  font-family: 'MedievalSharp', serif;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 0.8rem;
}

.sideboard-fetch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.sideboard-fetch-card {
  height: 25vh;
  border-radius: 4px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sideboard-fetch-card:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(196, 163, 90, 0.7);
}

.sideboard-fetch-card--selected {
  box-shadow: 0 0 14px rgba(120, 220, 120, 0.9);
  outline: 2px solid rgba(120, 220, 120, 0.8);
}

/* Exchange modal — two-pile side-by-side view for deck exhaustion */
.exchange-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-action-menu);
  background: rgba(15, 12, 8, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 1.2rem;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.exchange-columns {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.exchange-column {
  min-width: 0;
}

.exchange-column-heading {
  color: #c4a35a;
  font-family: 'MedievalSharp', serif;
  font-size: 0.95rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

/* Fan grid: cards laid out in a single horizontal row that overlap to fit. */
.exchange-fan-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: flex-start;
  /* Reserve space above so the hover/selected lift is not clipped. */
  padding-top: 24px;
  padding-bottom: 4px;
  overflow: visible;
}

.exchange-fan-grid .sideboard-fetch-card {
  position: relative;
  flex: 0 0 auto;
  z-index: 1;
}

.exchange-fan-grid .sideboard-fetch-card:hover {
  transform: translateY(-18px) scale(1.05);
  z-index: 10;
}

.exchange-fan-grid .sideboard-fetch-card--selected {
  transform: translateY(-18px);
  z-index: 5;
}

.path-choice-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  justify-content: center;
}

.region-type-icon {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

/* Path choice list — movement path selection during reveal-new-site step */
.path-choice-list {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  background: rgba(30, 25, 18, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.6);
  border-radius: 6px;
  z-index: var(--z-hover);
  max-height: 80vh;
  overflow-y: auto;
}

.path-choice-list .char-action-tooltip__btn {
  font-size: 1.1rem;
  padding: 8px 16px;
}

/* ---- Chain of Effects Panel ---- */

#chain-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-preview);
  width: 340px;
  max-height: 65vh;
  overflow-y: auto;
  background: rgba(20, 16, 10, 0.92);
  border: 1px solid rgba(196, 163, 90, 0.5);
  border-radius: 8px;
  padding: 0.8rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  font-family: 'MedievalSharp', serif;
}

.chain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(196, 163, 90, 0.3);
  margin-bottom: 0.4rem;
}

.chain-title {
  color: #c4a35a;
  font-size: 1.15rem;
  font-weight: bold;
}

.chain-mode {
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chain-mode--declaring {
  background: rgba(100, 200, 255, 0.2);
  color: #7cc4e8;
  border: 1px solid rgba(100, 200, 255, 0.4);
}

.chain-mode--resolving {
  background: rgba(255, 180, 80, 0.2);
  color: #e8b84c;
  border: 1px solid rgba(255, 180, 80, 0.4);
  animation: chain-pulse 1.5s ease-in-out infinite;
}

@keyframes chain-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.chain-priority {
  text-align: center;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  padding: 4px 0;
}

.chain-priority--self {
  color: #8ce68c;
  font-weight: bold;
}

.chain-priority--opp {
  color: #c0a0a0;
  font-style: italic;
}

/* Chain entries list */
.chain-entries {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chain-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(196, 163, 90, 0.08);
  border-left: 3px solid rgba(100, 200, 255, 0.6);
  transition: opacity 0.3s ease;
}

.chain-entry--resolved {
  border-left-color: rgba(100, 200, 100, 0.5);
  opacity: 0.55;
}

.chain-entry--negated {
  border-left-color: rgba(220, 80, 80, 0.5);
  opacity: 0.45;
  text-decoration: line-through;
}

.chain-entry__thumb {
  width: 72px;
  height: 100px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(196, 163, 90, 0.3);
}

.chain-entry--negated .chain-entry__thumb {
  filter: grayscale(0.8) brightness(0.5);
}

.chain-entry--resolved .chain-entry__thumb {
  filter: brightness(0.6) saturate(0.5);
}

.chain-entry__desc {
  flex: 1;
  font-size: 0.95rem;
  color: rgba(220, 210, 180, 0.9);
  line-height: 1.3;
  min-width: 0;
}

.chain-card-name {
  color: #c4a35a;
  font-weight: bold;
}

.chain-arrow {
  color: rgba(255, 120, 120, 0.8);
  margin: 0 2px;
}

.chain-declarer {
  display: block;
  font-size: 0.75rem;
  color: rgba(180, 170, 150, 0.6);
  margin-top: 1px;
}

.chain-trigger {
  font-size: 0.8rem;
  color: rgba(180, 160, 120, 0.7);
  font-style: italic;
}

.chain-entry__status {
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 8px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.chain-entry__status--resolved {
  background: rgba(100, 200, 100, 0.15);
  color: rgba(100, 200, 100, 0.8);
}

.chain-entry__status--negated {
  background: rgba(220, 80, 80, 0.15);
  color: rgba(220, 80, 80, 0.8);
}

.chain-nested {
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(196, 163, 90, 0.3);
  font-size: 0.7rem;
  color: rgba(180, 160, 120, 0.7);
  text-align: center;
  font-style: italic;
}

/* Short-event target tooltip (reuses char-action-tooltip styling) */
.chain-target-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-action-backdrop);
  background: transparent;
}

.chain-target-tooltip {
  position: fixed;
  transform: translate(-50%, -100%);
  margin-top: -12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(30, 25, 18, 0.95);
  border: 1px solid rgba(196, 163, 90, 0.6);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: var(--z-action-menu);
}

/* ---- Combat Arena ---- */

.combat-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  position: relative;
  padding: 1rem 2rem;
  gap: 0.5rem;
}

.combat-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  flex: 0 0 auto;
}

.combat-attacker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.combat-card--attacker {
  height: var(--card-table-height);
  width: auto;
  border-radius: 8px;
  box-shadow: 0 0 16px rgba(200, 60, 40, 0.6);
}

.combat-attack-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
  color: rgba(255, 220, 180, 0.9);
  background: rgba(60, 30, 20, 0.7);
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid rgba(200, 100, 60, 0.4);
}

.combat-detainment-badge {
  color: #ffa;
  font-style: italic;
}

.combat-unassigned-strikes {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.combat-strike-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(220, 100, 60, 0.8);
  border: 1px solid rgba(255, 150, 80, 0.6);
}

.combat-defender {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  --company-scale: 1;
}

/* Outer row: claims a full flex row in #visual-board and centers its child. */
.situation-banner-row {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  margin-top: -2rem;
  position: relative;
  z-index: var(--z-panel);
}

/* Inner pill: shrinks to content; never wraps. */
.situation-banner {
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  color: rgba(255, 220, 160, 0.95);
  background: rgba(40, 30, 20, 0.8);
  border: 1px solid rgba(200, 150, 80, 0.5);
  border-radius: 6px;
  padding: 6px 16px;
  white-space: nowrap;
}

.situation-banner-detail {
  font-size: 0.85rem;
  font-weight: normal;
  color: rgba(200, 190, 160, 0.85);
  margin-top: 2px;
}

/* Combat character highlights */

.combat-card--assignable {
  box-shadow: 0 0 12px 4px rgba(var(--color-selectable), 0.7) !important;
  cursor: pointer;
}
.combat-card--assignable:hover {
  box-shadow: 0 0 18px 6px rgba(var(--color-selectable), 0.9) !important;
}

.combat-card--supportable {
  box-shadow: 0 0 12px 4px rgba(var(--color-target), 0.7) !important;
  cursor: pointer;
}
.combat-card--supportable:hover {
  box-shadow: 0 0 18px 6px rgba(var(--color-target), 0.9) !important;
}

.combat-card--strike-assigned {
  box-shadow: 0 0 10px 3px rgba(220, 120, 50, 0.6) !important;
}

.combat-card--current-strike {
  box-shadow: 0 0 14px 5px rgba(255, 160, 60, 0.8) !important;
  animation: combat-pulse 1.2s ease-in-out infinite;
}

@keyframes combat-pulse {
  0%, 100% { box-shadow: 0 0 14px 5px rgba(255, 160, 60, 0.8); }
  50% { box-shadow: 0 0 20px 8px rgba(255, 180, 80, 1); }
}

.combat-card--strike-success {
  box-shadow: 0 0 12px 4px rgba(80, 200, 80, 0.6) !important;
}

.combat-card--strike-wounded {
  box-shadow: 0 0 12px 4px rgba(200, 50, 50, 0.6) !important;
}

.combat-card--strike-eliminated {
  box-shadow: 0 0 12px 4px rgba(100, 50, 50, 0.6) !important;
  opacity: 0.5;
  filter: grayscale(0.7);
}

/* Excess strike badge — red circle, bottom-left of character */
.combat-excess-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(180, 40, 40, 0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: bold;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 100, 80, 0.6);
}

/* Strike result overlay icon */
.combat-result-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.combat-result-overlay--success { color: rgba(80, 220, 80, 0.9); }
.combat-result-overlay--wounded { color: rgba(220, 60, 60, 0.9); }
.combat-result-overlay--eliminated { color: rgba(160, 40, 40, 0.95); }

/* SVG arrow overlay */
.combat-arrows {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
}

.combat-arrow {
  stroke: rgba(220, 100, 60, 0.7);
  stroke-width: 4;
  fill: none;
}

.combat-arrow--active {
  stroke: rgba(255, 160, 60, 0.9);
  stroke-width: 6;
  animation: arrow-pulse 1.2s ease-in-out infinite;
}

@keyframes arrow-pulse {
  0%, 100% { stroke-opacity: 0.9; stroke-width: 6; }
  50% { stroke-opacity: 1; stroke-width: 8; }
}

.combat-arrow--resolved {
  stroke-opacity: 0.5;
  stroke-width: 3;
}
.combat-arrow--success { stroke: rgba(80, 200, 80, 0.6); }
.combat-arrow--wound { stroke: rgba(200, 50, 50, 0.6); }

/* ---- Free Council: pending corruption check highlight ---- */

.cc-pending > .character-card-wrap .company-card {
  box-shadow:
    0 0 12px rgba(var(--color-selectable), 1),
    0 0 30px rgba(var(--color-selectable), 0.7);
}

.cc-passed-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5rem;
  color: rgba(30, 100, 40, 0.85);
  text-shadow: 0 0 12px rgba(30, 100, 40, 0.6);
  pointer-events: none;
  z-index: 10;
}

/* ---- Game Over scoring table ---- */

.go-table {
  width: 90%;
  max-width: 900px;
  margin: 0 auto;
  border-collapse: collapse;
  font-family: 'MedievalSharp', serif;
  color: rgba(220, 220, 220, 0.9);
}

.go-table th, .go-table td {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.go-table thead th {
  font-size: 1.2rem;
  color: rgba(196, 163, 90, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  border-bottom: 2px solid rgba(196, 163, 90, 0.3);
}

.go-cat {
  font-size: 1rem;
  color: rgba(196, 163, 90, 0.7);
  text-align: left;
  width: 100px;
}

.go-player {
  text-align: center;
}

.go-score {
  text-align: center;
  vertical-align: top;
}

.go-score-num {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.go-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.go-card-img {
  height: 60px;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.go-total-label {
  font-size: 1.2rem;
  color: rgba(196, 163, 90, 0.95);
}

.go-total {
  font-size: 1.5rem;
  font-weight: bold;
  color: rgba(196, 163, 90, 0.95);
  border-top: 2px solid rgba(196, 163, 90, 0.3);
}

/* ---- Pseudo-AI Action Panel ---- */

#pseudo-ai-panel {
  position: fixed;
  top: 4rem;
  right: 110px;
  width: 340px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  background: #0e1a2e;
  border: 2px solid #5a8a5a;
  border-radius: 6px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

#pseudo-ai-panel.waiting {
  animation: pseudo-ai-pulse 1.5s ease-in-out infinite;
}

@keyframes pseudo-ai-pulse {
  0%, 100% { border-color: #5a8a5a; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
  50% { border-color: #8aca8a; box-shadow: 0 0 12px rgba(90, 138, 90, 0.4); }
}

#pseudo-ai-panel.minimized {
  max-height: none;
  overflow: hidden;
  width: auto;
  min-width: 0;
}

#pseudo-ai-panel.minimized #pseudo-ai-actions,
#pseudo-ai-panel.minimized #pseudo-ai-nonviable-toggle,
#pseudo-ai-panel.minimized .pseudo-ai-header span {
  display: none;
}

#pseudo-ai-panel.minimized .pseudo-ai-header {
  padding: 0.3rem;
  border-bottom: none;
}

.pseudo-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: #162040;
  border-bottom: 1px solid #c4a35a44;
  font-size: 0.85rem;
  font-weight: bold;
  color: #c4a35a;
}

.pseudo-ai-instruction {
  font-size: 0.75rem;
  font-weight: normal;
  color: #8aca8a;
  font-style: italic;
}

#pseudo-ai-minimize-btn {
  background: none;
  border: 1px solid #c4a35a44;
  color: #c4a35a;
  cursor: pointer;
  border-radius: 3px;
  padding: 0 6px;
  font-size: 0.8rem;
  line-height: 1.4;
}

#pseudo-ai-minimize-btn:hover {
  background: #1e3a60;
}

#pseudo-ai-actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#pseudo-ai-actions button {
  padding: 0.3rem 0.45rem;
  font-size: 0.78rem;
  background: #1a2a4a;
  color: #e0e0e0;
  border: 1px solid #5a8a5a44;
  border-left: 3px solid #5a8a5a;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  word-break: break-word;
  transition: background 0.15s, border-color 0.15s;
}

#pseudo-ai-actions button:hover {
  background: #1e3a60;
  border-color: #5a8a5a;
  border-left-color: #6a9a6a;
}

#pseudo-ai-actions button:active {
  background: #254a70;
}

#pseudo-ai-actions button:disabled {
  opacity: 0.5;
  cursor: default;
  border-color: #444;
}

#pseudo-ai-actions button.action-regress {
  opacity: 0.5;
}

#pseudo-ai-nonviable-toggle {
  display: block;
  width: calc(100% - 1rem);
  margin: 0.3rem 0.5rem 0.5rem;
  padding: 0.25rem;
  font-size: 0.75rem;
  background: #162040;
  color: #888;
  border: 1px solid #333;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
}

#pseudo-ai-nonviable-toggle:hover {
  background: #1e3a60;
  color: #aaa;
}


