/**
 * Unified Renderer Styles
 * =======================
 * Single source of truth for all dynamic rendering:
 * - Tooltips, menus, cards (entity interactions)
 * - Selection grids (choices)
 * - Segments (narrative)
 * - Interactive elements (rolls, actions)
 */

/* ===========================================================================
   Shared
   =========================================================================== */

.unified-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999 !important;
  background: transparent;
}

.unified-loading {
  position: fixed;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-muted);
}

.unified-loading__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: unified-spin 0.8s linear infinite;
}

@keyframes unified-spin {
  to { transform: rotate(360deg); }
}

/* ===========================================================================
   Tooltip
   =========================================================================== */

.unified-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 300px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  pointer-events: none;
  animation: unified-fade-in 0.15s ease-out;
}

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

.unified-tooltip--below {
  animation-name: unified-fade-in-below;
}

@keyframes unified-fade-in-below {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.unified-tooltip__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--space-1);
}

.unified-tooltip__title {
  font-weight: 600;
  color: var(--text-primary);
}

.unified-tooltip__subtitle {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-style: italic;
}

.unified-tooltip__body {
  color: var(--text-secondary);
}

/* ===========================================================================
   Menu
   =========================================================================== */

.unified-menu {
  position: fixed !important;
  z-index: 1001 !important;
  min-width: 180px;
  max-width: 240px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: unified-menu-in 0.15s ease-out;
}

@keyframes unified-menu-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.unified-menu__header {
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-color);
}

.unified-menu__divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border-color);
}

.unified-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.unified-menu__item:hover {
  background: var(--surface-hover);
}

.unified-menu__item--danger {
  color: var(--color-error);
}

.unified-menu__item--danger:hover {
  background: var(--color-error-bg);
}

.unified-menu__icon {
  display: flex;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.unified-menu__item:hover .unified-menu__icon {
  color: inherit;
}

/* ===========================================================================
   Card
   =========================================================================== */

.unified-card {
  position: fixed;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  background: var(--surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: unified-card-in 0.2s ease-out;
}

@keyframes unified-card-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.unified-card--sm { width: 280px; max-height: 320px; }
.unified-card--md { width: 360px; max-height: 480px; }
.unified-card--lg { width: 480px; max-height: 600px; }

.unified-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-color);
}

.unified-card__header-content {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  flex: 1;
}

.unified-card__type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-primary-bg);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  flex-shrink: 0;
}

.unified-card__titles {
  flex: 1;
  min-width: 0;
}

.unified-card__title {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.unified-card__subtitle {
  margin: var(--space-1) 0 0;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

.unified-card__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.unified-card__close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.unified-card__body {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.unified-card__description {
  margin: 0 0 var(--space-3);
  color: var(--text-secondary);
  line-height: 1.5;
}

.unified-card__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.unified-card__stat {
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
  background: var(--surface-secondary);
  border-radius: var(--radius-sm);
}

.unified-card__stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.unified-card__stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

.unified-card__actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-color);
  background: var(--surface-secondary);
}

.unified-card__action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-color);
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.1s ease;
}

.unified-card__action:hover {
  background: var(--surface-hover);
}

.unified-card__action--primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--accent-primary-contrast);
}

.unified-card__action--primary:hover {
  background: var(--accent-primary-hover);
}

.unified-card__action--danger {
  color: var(--color-error);
  border-color: var(--color-error);
}

.unified-card__action--danger:hover {
  background: var(--color-error-bg);
}

/* Type variants */
.unified-card--npc .unified-card__type-icon { background: #e8f4f8; color: #0891b2; }
.unified-card--item .unified-card__type-icon { background: #fef3c7; color: #d97706; }
.unified-card--spell .unified-card__type-icon { background: #ede9fe; color: #7c3aed; }
.unified-card--location .unified-card__type-icon { background: #dcfce7; color: #16a34a; }
.unified-card--condition .unified-card__type-icon { background: #fef9c3; color: #ca8a04; }

/* ===========================================================================
   Selection Grid
   =========================================================================== */

.unified-selection {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
}

.unified-selection__prompt {
  padding: var(--space-2);
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-style: italic;
}

.unified-selection__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.unified-selection__filter {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.unified-selection__filter:hover {
  border-color: var(--accent-primary);
}

.unified-selection__filter--active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--accent-primary-contrast);
}

.unified-selection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.unified-selection__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.unified-selection__card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.unified-selection__card--selected {
  border-color: var(--accent-primary);
  background: var(--accent-primary-bg);
}

.unified-selection__card--selected::after {
  content: '✓';
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--accent-primary-contrast);
  border-radius: 50%;
  font-size: var(--font-size-xs);
  font-weight: bold;
}

.unified-selection__info {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--surface-secondary);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  cursor: pointer;
  z-index: 1;
}

.unified-selection__info:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--accent-primary-contrast);
}

.unified-selection__name {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--space-2);
}

.unified-selection__desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  line-height: 1.4;
}

.unified-selection__badge {
  position: absolute;
  top: calc(-1 * var(--space-1));
  right: var(--space-3);
  padding: 2px var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
}

.unified-selection__badge--beginner { background: var(--color-success-bg); color: var(--color-success); }
.unified-selection__badge--recommended { background: var(--accent-primary-bg); color: var(--accent-primary); }
.unified-selection__badge--dm-suggested { background: var(--color-warning-bg); color: var(--color-warning); }

/* ===========================================================================
   Segments (Narrative)
   =========================================================================== */

.unified-segment {
  margin: var(--space-2) 0;
}

.unified-segment--dialogue {
  padding-left: var(--space-4);
  border-left: 3px solid var(--accent-primary);
}

.unified-segment__speaker {
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: var(--space-1);
}

.unified-segment__content {
  color: var(--text-primary);
  line-height: 1.6;
}

.unified-segment__content--dialogue {
  font-style: italic;
}

.unified-segment__content--narration {
  color: var(--text-secondary);
}

.unified-segment__content--action {
  color: var(--text-primary);
  font-weight: 500;
}

.unified-segment__content--perception {
  color: var(--color-info);
  padding: var(--space-2);
  background: var(--color-info-bg);
  border-radius: var(--radius-sm);
}

/* Entity links in content */
.unified-entity-link {
  color: var(--accent-primary);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}

.unified-entity-link:hover {
  text-decoration-style: solid;
}

/* ===========================================================================
   Roll Prompt
   =========================================================================== */

.unified-roll-prompt {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.unified-roll-prompt__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.unified-roll-prompt__skill {
  font-weight: 600;
  color: var(--text-primary);
}

.unified-roll-prompt__dc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.unified-roll-prompt__reason {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
}

.unified-roll-prompt__actions {
  display: flex;
  gap: var(--space-2);
}

.unified-roll-prompt__btn {
  flex: 1;
  padding: var(--space-2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.1s ease;
}

.unified-roll-prompt__btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent-primary);
}

/* ===========================================================================
   Quick Actions
   =========================================================================== */

.unified-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2);
}

.unified-quick-action {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.unified-quick-action:hover {
  background: var(--surface-hover);
  border-color: var(--accent-primary);
}

.unified-quick-action svg {
  width: 14px;
  height: 14px;
}

/* ===========================================================================
   Inline Selection (within narrative text)
   Wiki-link style: highlighted text, not buttons
   =========================================================================== */

.unified-inline-selection {
  display: inline;
}

.inline-selection-options {
  display: inline;
}

/* Wiki-link style: colored text with dotted underline */
.inline-selection-option {
  display: inline;
  padding: 0 2px;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: #90a959; /* Wiki-link green */
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.inline-selection-option:hover {
  color: #b8d974;
  background: rgba(144, 169, 89, 0.15);
  text-decoration-style: solid;
}

.inline-selection-divider {
  color: var(--text-muted);
  padding: 0 2px;
  opacity: 0.5;
}

/* Selected state - bold and highlighted */
.inline-selection-option--selected {
  color: #b8d974;
  background: rgba(144, 169, 89, 0.2);
  font-weight: 600;
  text-decoration-style: solid;
}

.inline-selection-option--selected:hover {
  background: rgba(144, 169, 89, 0.25);
  cursor: pointer;
}

/* Dimmed state for unselected options after a selection is made */
.inline-selection-option--dimmed {
  opacity: 0.5;
  color: var(--text-muted);
}

.inline-selection-option--dimmed:hover {
  opacity: 1;
  color: #90a959;
}

/* "more..." link styling */
.inline-selection-more {
  font-style: italic;
  color: var(--text-muted);
  text-decoration-style: dashed;
}

.inline-selection-more:hover {
  color: #90a959;
  text-decoration-style: solid;
}

/* ===========================================================================
   Roll Menu (skill/ability/save rolls with advantage/disadvantage)
   =========================================================================== */

.unified-roll-menu-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99998 !important;
  background: rgba(0, 0, 0, 0.4);
}

.unified-roll-menu {
  position: fixed !important;
  z-index: 99999 !important;
  min-width: 220px;
  background: var(--surface-elevated, #1e2127);
  border: 1px solid var(--border-color, #3a3f4b);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono, "JetBrains Mono", "Fira Code", monospace);
  overflow: hidden;
  animation: unified-roll-menu-in 0.15s ease-out;
}

@keyframes unified-roll-menu-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.unified-roll-menu--above {
  animation-name: unified-roll-menu-in-above;
}

@keyframes unified-roll-menu-in-above {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.unified-roll-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #abb2bf);
  background: var(--surface-secondary, #282c34);
  border-bottom: 1px solid var(--border-color, #3a3f4b);
}

.unified-roll-menu__title {
  /* Inherits from header */
}

.unified-roll-menu__badge {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(97, 175, 239, 0.15);
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 4px;
  color: #61afef;
}

.unified-roll-menu__options {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unified-roll-menu__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-secondary, #282c34);
  border: 1px solid var(--border-color, #3a3f4b);
  border-radius: 6px;
  color: var(--text-secondary, #abb2bf);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  /* Mobile-friendly tap target */
  min-height: 44px;
}

.unified-roll-menu__btn:hover {
  background: rgba(97, 175, 239, 0.12);
  border-color: #61afef;
  transform: translateX(2px);
}

.unified-roll-menu__btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 24px;
  padding: 0 4px;
  background: var(--surface-elevated, #1e2127);
  border: 1px solid var(--border-color, #4a5568);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #61afef;
}

.unified-roll-menu__btn-label {
  flex: 1;
  text-align: left;
}

/* Advantage variant */
.unified-roll-menu__btn--advantage {
  border-color: rgba(152, 195, 121, 0.3);
  color: #98c379;
}

.unified-roll-menu__btn--advantage .unified-roll-menu__btn-icon {
  background: rgba(152, 195, 121, 0.1);
  border-color: rgba(152, 195, 121, 0.4);
  color: #98c379;
}

.unified-roll-menu__btn--advantage:hover {
  background: rgba(152, 195, 121, 0.15);
  border-color: rgba(152, 195, 121, 0.5);
}

/* Disadvantage variant */
.unified-roll-menu__btn--disadvantage {
  border-color: rgba(224, 108, 117, 0.3);
  color: #e06c75;
}

.unified-roll-menu__btn--disadvantage .unified-roll-menu__btn-icon {
  background: rgba(224, 108, 117, 0.1);
  border-color: rgba(224, 108, 117, 0.4);
  color: #e06c75;
}

.unified-roll-menu__btn--disadvantage:hover {
  background: rgba(224, 108, 117, 0.15);
  border-color: rgba(224, 108, 117, 0.5);
}

/* Sources section (shows what grants advantage/disadvantage) */
.unified-roll-menu__sources {
  padding: 8px 12px;
  border-top: 1px solid var(--border-color, #3a3f4b);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unified-roll-menu__source {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted, #6b7280);
}

.unified-roll-menu__source-icon {
  font-weight: bold;
  width: 12px;
}

.unified-roll-menu__source--advantage {
  color: #98c379;
}

.unified-roll-menu__source--disadvantage {
  color: #e06c75;
}

/* ===========================================================================
   Modal (Full-screen overlay for announcements, custom content)
   =========================================================================== */

.unified-modal__backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  animation: unified-modal-backdrop-in 0.2s ease-out;
}

@keyframes unified-modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.unified-modal {
  position: fixed !important;
  z-index: 100001 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  padding: var(--space-4, 16px);
  animation: unified-modal-in 0.25s ease-out;
}

@keyframes unified-modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.unified-modal__card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100vh - 64px);
  background: var(--surface-elevated, #1e2127);
  border: 1px solid var(--border-color, #3a3f4b);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* Size variants */
.unified-modal--small .unified-modal__card { max-width: 400px; }
.unified-modal--default .unified-modal__card { max-width: 560px; }
.unified-modal--large .unified-modal__card { max-width: 720px; }
.unified-modal--fullscreen .unified-modal__card {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
}

.unified-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  padding: var(--space-4, 16px);
  background: var(--surface-secondary, #282c34);
  border-bottom: 1px solid var(--border-color, #3a3f4b);
  flex-shrink: 0;
}

.unified-modal__title-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3, 12px);
  flex: 1;
}

.unified-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent-primary-bg, rgba(251, 191, 36, 0.15));
  border-radius: var(--radius-md, 8px);
  color: var(--accent-primary, #fbbf24);
  font-size: 18px;
  flex-shrink: 0;
}

.unified-modal__title {
  margin: 0;
  font-size: var(--font-size-lg, 18px);
  font-weight: 600;
  color: var(--text-primary, #e5e5e5);
}

.unified-modal__subtitle {
  margin: var(--space-1, 4px) 0 0;
  font-size: var(--font-size-sm, 13px);
  color: var(--text-muted, #888);
  font-style: italic;
}

.unified-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted, #888);
  font-size: 24px;
  line-height: 1;
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.unified-modal__close:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #e5e5e5);
}

.unified-modal__body {
  flex: 1;
  padding: var(--space-4, 16px);
  overflow-y: auto;
  color: var(--text-secondary, #abb2bf);
  line-height: 1.6;
}

.unified-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2, 8px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: var(--surface-secondary, #282c34);
  border-top: 1px solid var(--border-color, #3a3f4b);
  flex-shrink: 0;
}

.unified-modal__footer--hidden {
  display: none;
}

.unified-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  padding: var(--space-2, 8px) var(--space-4, 16px);
  border: 1px solid var(--border-color, #3a3f4b);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-primary, #1e2127);
  color: var(--text-primary, #e5e5e5);
  font-size: var(--font-size-sm, 13px);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.unified-modal__btn:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.1));
  border-color: var(--accent-primary, #fbbf24);
}

.unified-modal__btn--primary {
  background: var(--accent-primary, #fbbf24);
  border-color: var(--accent-primary, #fbbf24);
  color: var(--accent-primary-contrast, #000);
}

.unified-modal__btn--primary:hover {
  background: var(--accent-primary-hover, #f59e0b);
}

/* ===========================================================================
   VTT Battle Map (ASCII tactical maps)
   =========================================================================== */

.vtt-map {
  margin: var(--space-3, 12px) 0;
  padding: 0;
  background: var(--surface-secondary, #1a1a2e);
  border: 1px solid var(--border-color, #3a3f4b);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.vtt-map-header {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  padding: var(--space-2, 8px) var(--space-3, 12px);
  background: var(--surface-elevated, #252536);
  border-bottom: 1px solid var(--border-color, #3a3f4b);
}

.vtt-map-icon {
  font-size: 18px;
}

.vtt-map-title {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary, #e5e5e5);
  font-size: var(--font-size-sm, 13px);
}

.vtt-map-dimensions {
  padding: 2px 8px;
  background: rgba(97, 175, 239, 0.15);
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 4px;
  color: #61afef;
  font-size: 11px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
}

.vtt-map-tokens {
  padding: 2px 8px;
  background: rgba(152, 195, 121, 0.15);
  border: 1px solid rgba(152, 195, 121, 0.3);
  border-radius: 4px;
  color: #98c379;
  font-size: 11px;
}

.vtt-map-grid {
  margin: 0;
  padding: var(--space-3, 12px);
  font-family: var(--font-mono, "JetBrains Mono", "Fira Code", "Cascadia Code", monospace);
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-secondary, #abb2bf);
  background: var(--surface-primary, #0d1117);
  white-space: pre;
  overflow-x: auto;
  /* Ensure consistent character width for ASCII alignment */
  letter-spacing: 0;
}

/* ASCII map character highlighting */

/* Border/grid characters - subtle, low contrast */
.vtt-border {
  color: #4a4a5a;
}

/* Coordinate labels (row letters, column numbers) */
.vtt-coord {
  color: #6a7080;
  font-weight: 500;
}

/* Player tokens - bright cyan/teal */
.vtt-player {
  color: #56d4dd;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(86, 212, 221, 0.5);
}

/* Enemy tokens - red/orange */
.vtt-enemy {
  color: #e06c75;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(224, 108, 117, 0.4);
}

/* Empty floor cells */
.vtt-floor {
  color: #3a3f4b;
}

/* Wall characters */
.vtt-wall {
  color: #7a8090;
}

/* Legend section */
.vtt-map-legend {
  padding: var(--space-2, 8px) var(--space-3, 12px);
  background: var(--surface-elevated, #252536);
  border-top: 1px solid var(--border-color, #3a3f4b);
  font-size: 12px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  line-height: 1.6;
}

.vtt-legend-header {
  color: var(--text-primary, #e5e5e5);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.vtt-player-name {
  color: #56d4dd;
}

.vtt-enemy-name {
  color: #e06c75;
}
