/* ================================================================
   Solo RPG Engine – Claude-styled Web UI
   ================================================================ */

/* ------ Design tokens ------ */
:root {
  /* Light theme */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F9F7F5;
  --bg-user-msg: #F3F0EE;
  --bg-input: #FFFFFF;
  --bg-sidebar: #2D2B28;
  --bg-sidebar-hover: #3D3B38;
  --bg-sidebar-active: #4D4B48;

  --text-primary: #1A1816;
  --text-secondary: #6B6560;
  --text-muted: #9B9590;
  --text-sidebar: #E8E4E0;
  --text-sidebar-muted: #9B9590;

  --accent: #D97706;
  --accent-hover: #B45309;
  --accent-subtle: #FEF3C7;

  --border: #E8E4E0;
  --border-input: #D1CBC5;
  --border-input-focus: #D97706;

  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --success: #16A34A;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --sidebar-width: 260px;
  --info-panel-width: 320px;
  --chat-max-width: 768px;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  --transition: 150ms ease;
}

/* ------ Dark theme ------ */
[data-theme="dark"] {
  --bg-primary: #1A1816;
  --bg-secondary: #242220;
  --bg-user-msg: #2D2B28;
  --bg-input: #242220;
  --bg-sidebar: #141210;
  --bg-sidebar-hover: #242220;
  --bg-sidebar-active: #2D2B28;

  --text-primary: #E8E4E0;
  --text-secondary: #9B9590;
  --text-muted: #6B6560;
  --text-sidebar: #E8E4E0;
  --text-sidebar-muted: #6B6560;

  --accent: #F59E0B;
  --accent-hover: #D97706;
  --accent-subtle: #451A03;

  --border: #3D3B38;
  --border-input: #4D4B48;
  --border-input-focus: #F59E0B;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

/* ------ Reset ------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  display: flex;
  overflow: hidden;
}

/* ------ Sidebar ------ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-sidebar-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.sidebar-collapse-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar);
}

.sidebar.collapsed {
  display: none !important;
}

/* Floating button to reopen left sidebar */
.sidebar-expand-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.sidebar-expand-btn:hover {
  background: var(--bg-primary);
}

body.sidebar-collapsed .sidebar-expand-btn {
  display: flex;
}

.sidebar-section {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-sidebar-muted);
  margin-bottom: 8px;
  padding: 0 4px;
}

.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.campaign-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.campaign-item:hover { background: var(--bg-sidebar-hover); }
.campaign-item.active { background: var(--bg-sidebar-active); font-weight: 500; }

.campaign-item-name {
  flex: 1;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

.campaign-item-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.campaign-item:hover .campaign-item-delete {
  opacity: 1;
}

.campaign-item-delete:hover {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.sidebar-actions {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text-sidebar);
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  text-align: left;
  width: 100%;
}
.sidebar-btn:hover:not(:disabled) { background: var(--bg-sidebar-hover); }
.sidebar-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sidebar-btn.btn-danger:hover:not(:disabled) { background: rgba(220,38,38,0.2); color: #FCA5A5; }

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ------ Main ------ */
.main {
  flex: 1;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: var(--bg-primary);
}

/* ------ Info Panel (Right Sidebar) ------ */
.info-panel {
  width: var(--info-panel-width);
  min-width: var(--info-panel-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform var(--transition);
  z-index: 50;
  position: relative;
}

.info-panel.collapsed {
  display: none !important;
}

/* Floating button to reopen right info panel */
.info-panel-expand-btn {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.info-panel-expand-btn:hover {
  background: var(--bg-primary);
}

body.info-panel-collapsed .info-panel-expand-btn {
  display: flex;
}

.info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.info-panel-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.info-panel-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.info-panel-toggle:hover {
  background: var(--bg-primary);
}

.info-panel.collapsed .info-panel-toggle svg {
  transform: rotate(180deg);
}

.info-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.info-section {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  overflow: hidden;
}

.info-section summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  list-style: none;
}

.info-section summary::-webkit-details-marker {
  display: none;
}

.info-section summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  font-size: 10px;
  transition: transform var(--transition);
  color: var(--text-secondary);
}

.info-section[open] summary::before {
  transform: rotate(90deg);
}

.info-section summary:hover {
  background: var(--bg-secondary);
}

.info-section-body {
  padding: 0 16px 12px 16px;
  font-size: 13px;
  line-height: 1.6;
}

.char-card {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.char-card:last-child {
  border-bottom: none;
}

.char-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.char-card-name::-webkit-details-marker {
  display: none;
}

.char-card-name::before {
  content: '▶';
  display: inline-block;
  margin-right: 8px;
  font-size: 10px;
  transition: transform var(--transition);
}

.char-details-accordion[open] .char-card-name::before {
  transform: rotate(90deg);
}

.char-details-content {
  margin-top: 12px;
}

.char-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0;
  font-size: 12px;
}

.stat-badge {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.char-expandable {
  margin-top: 8px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

.char-expandable summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
}

.char-expandable-content {
  padding-top: 6px;
  font-size: 12px;
}

.equipment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.equipment-list li {
  padding: 2px 0;
  color: var(--text-primary);
}

.stat-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin: 8px 0;
}

.stat-table thead th {
  text-align: left;
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-table tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.stat-table tbody tr:last-child td {
  border-bottom: none;
}

.dm-positive {
  color: var(--success);
  font-weight: 600;
}

.dm-negative {
  color: var(--danger);
  font-weight: 600;
}

.char-credits {
  margin: 10px 0;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.char-subsection {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.char-subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ship-stat-line {
  font-size: 12px;
  padding: 2px 0;
  color: var(--text-primary);
}

.empty-state-small {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.npc-card {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.npc-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.npc-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.loyalty-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.loyalty-positive {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.loyalty-negative {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.loyalty-neutral {
  background: var(--border);
  color: var(--text-muted);
}

.event-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.event-item:last-child {
  border-bottom: none;
}

.event-turn {
  color: var(--text-muted);
  font-size: 11px;
}

.location-card {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.location-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.location-system {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.location-badges {
  display: flex;
  gap: 6px;
  margin: 4px 0;
}

.location-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
}

.location-tl {
  background: var(--accent);
  color: var(--bg-primary);
}

.location-starport {
  background: var(--text-muted);
  color: var(--bg-primary);
}

.location-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 6px 0;
  line-height: 1.4;
}

.location-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}

.event-desc {
  color: var(--text-primary);
  margin-top: 2px;
}

.context-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.context-file-item {
  padding: 6px 10px;
  margin: 4px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-type-badge {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent);
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.view { height: 100%; }

/* ------ Campaign selection ------ */
.view-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.select-hero {
  text-align: center;
  margin-bottom: 40px;
}
.select-hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}
.select-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
}

.select-campaigns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 480px;
}

.select-campaign-card {
  position: relative;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-secondary);
}
.select-campaign-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.select-campaign-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}
.select-campaign-card .meta {
  font-size: 13px;
  color: var(--text-secondary);
}
.btn-delete-campaign {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.btn-delete-campaign:hover {
  background: var(--danger);
  color: white;
}

.select-create {
  width: 100%;
  max-width: 480px;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.select-create h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus { border-color: var(--border-input-focus); }

.form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--border-input-focus); }

.form-actions {
  display: flex;
  gap: 8px;
}

/* Textarea styling */
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  line-height: 1.5;
  transition: border-color var(--transition);
}
.form-textarea:focus { border-color: var(--border-input-focus); }
.form-textarea::placeholder { color: var(--text-muted); }

/* Collapsible advanced options */
.create-advanced {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.create-advanced summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.create-advanced summary:hover {
  background: var(--bg-primary);
}
.create-advanced[open] summary {
  border-bottom: 1px solid var(--border);
}
.create-advanced > :not(summary) {
  padding: 0 14px;
}
.create-advanced > .form-group:first-of-type {
  margin-top: 14px;
}

/* Tone slider styling */
.slider-group label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slider-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  background: var(--accent);
  color: #FFF;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Range input */
input[type="range"].tone-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border);
  outline: none;
  margin: 8px 0 4px;
  border: none;
  padding: 0;
}
input[type="range"].tone-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input[type="range"].tone-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Character count */
.char-count {
  float: right;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Field descriptions / helper text */
.field-description {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 4px 0 8px;
}

/* Game system hook card */
.system-hook {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.system-hook-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 10px;
}
.system-hook-lore-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 4px;
}
.system-hook-lore {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #FFF;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-secondary); }

/* ------ Chat view ------ */
.view-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-shrink: 0;
}
.chat-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.chat-turn {
  font-size: 13px;
  color: var(--text-muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Message wrapper: centres content like Claude */
.msg {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 0 24px;
}

.msg-inner {
  width: 100%;
  max-width: var(--chat-max-width);
  padding: 12px 0;
}

/* User message */
.msg-user .msg-inner {
  background: var(--bg-user-msg);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  margin-left: auto;
  max-width: 85%;
  width: auto;
}

/* GM / assistant message */
.msg-gm .msg-inner {
  padding: 12px 0;
}

.msg-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 4px;
}

.msg-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Markdown inside messages */
.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content strong { font-weight: 600; }
.msg-content em { font-style: italic; }
.msg-content ul, .msg-content ol { margin: 8px 0; padding-left: 24px; }
.msg-content li { margin-bottom: 4px; }
.msg-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
}
.msg-content pre code {
  background: none;
  padding: 0;
}
.msg-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--text-secondary);
}
.msg-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
  font-weight: 600;
  margin: 16px 0 6px;
}
.msg-content h1 { font-size: 1.3em; }
.msg-content h2 { font-size: 1.15em; }
.msg-content h3 { font-size: 1.05em; }

/* Thinking / loading indicator */
.msg-thinking .msg-inner {
  padding: 12px 0;
}
.thinking-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
}
.thinking-dots .dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-pulse 1.4s infinite;
}
.thinking-dots .dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots .dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* System messages */
.msg-system .msg-inner {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

/* Welcome message */
.msg-welcome .welcome-inner {
  font-style: normal;
  font-size: 15px;
  color: var(--text);
  padding: 24px 16px;
}

.msg-welcome .welcome-inner p {
  margin: 0 0 16px;
}

.welcome-create-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent, #6366f1);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.welcome-create-btn:hover {
  background: var(--accent-hover, #4f46e5);
}

/* ------ Input area ------ */
.chat-input-area {
  padding: 16px 24px 24px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.scroll-to-bottom {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all var(--transition);
  z-index: 10;
}

.scroll-to-bottom:hover {
  background: var(--accent-hover);
  transform: translate(-50%, -2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.scroll-to-bottom:active {
  transform: translate(-50%, 0);
}

.chat-input-wrapper {
  width: 100%;
  max-width: var(--chat-max-width);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px 8px 16px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.chat-input-wrapper:focus-within {
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px rgba(217,119,6,0.1);
}

#chat-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  max-height: 200px;
  background: transparent;
  color: var(--text-primary);
}
#chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.05); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------ Modal ------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-secondary); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
}

/* Status modal sections */
.status-section {
  margin-bottom: 20px;
}
.status-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.status-section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.status-section th, .status-section td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
.status-section th {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: #FFF;
  box-shadow: var(--shadow-md);
  animation: toast-in 300ms ease forwards;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------ Responsive ------ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .msg-user .msg-inner { max-width: 90%; }
  .chat-header { padding-left: 56px; }

  .info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    height: 60vh;
    max-height: 80vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    z-index: 150;
  }

  .info-panel.open {
    transform: translateY(0);
  }

  .info-panel.collapsed {
    transform: translateY(100%);
  }

  .main {
    max-width: 100vw !important;
  }
}

/* ------ Roll modifier tooltips ------ */
.roll-mod {
  text-decoration: underline dotted var(--accent);
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
  font-weight: 600;
  color: var(--accent);
  padding: 0 1px;
}

.roll-mod:hover::after,
.roll-mod:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  z-index: 50;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.roll-mod:hover::before,
.roll-mod:focus::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--bg-sidebar);
  z-index: 50;
  pointer-events: none;
}

/* Entity highlighting (characters, NPCs, locations) */
.entity {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
  padding: 0 1px;
  transition: all var(--transition);
}

.entity-character {
  text-decoration-color: #3b82f6;
  color: #3b82f6;
}

.entity-npc {
  text-decoration-color: #f59e0b;
  color: #f59e0b;
}

.entity-location {
  text-decoration-color: #10b981;
  color: #10b981;
}

.entity:hover,
.entity:focus {
  text-decoration-style: solid;
  font-weight: 500;
}

/* Entity tooltips (reuse roll-mod tooltip pattern) */
.entity:hover::after,
.entity:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  z-index: 50;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.entity:hover::before,
.entity:focus::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--bg-sidebar);
  z-index: 50;
  pointer-events: none;
}

/* ------ Map containers ------ */
.map-container {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.map-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-secondary);
  padding: 8px 12px 4px;
  letter-spacing: 0.02em;
}

.map-svg-wrap {
  padding: 4px 8px 8px;
  text-align: center;
}

.map-svg-wrap svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.map-container[data-map-grid] .map-svg-wrap svg {
  cursor: crosshair;
}

.map-measure-info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px 8px;
  text-align: center;
  font-family: var(--font-mono);
  min-height: 24px;
}

.measure-marker {
  pointer-events: none;
}

/* ------ Login view ------ */
.view-login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 300;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 40px;
  max-width: 400px;
  width: 100%;
}
.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-subtitle {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 8px;
}
.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  font-weight: 500;
}
.login-success {
  color: var(--success);
  font-size: 13px;
  margin-top: 12px;
  font-weight: 500;
}
.auth-form-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ------ Auth forms ------ */
.auth-form {
  width: 100%;
  max-width: 320px;
  margin-top: 24px;
  text-align: left;
}
.auth-form .form-group {
  margin-bottom: 16px;
}
.auth-form .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.auth-form .form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.auth-form .form-group input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-full {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}
.auth-switch {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}
.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.auth-switch a:hover {
  text-decoration: underline;
}

/* ------ Sidebar user info ------ */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}
.user-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-btn-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-sidebar-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-btn-sm:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar);
}

/* ------ Email verification banner ------ */
.verify-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--accent-subtle);
  border-bottom: 1px solid var(--accent);
  font-size: 14px;
  color: var(--text-primary);
  flex-shrink: 0;
}
.verify-resend-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.verify-resend-btn:hover { color: var(--accent-hover); }
.verify-dismiss-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.verify-dismiss-btn:hover { color: var(--text-primary); }

/* ------ Account page ------ */
.view-account {
  overflow-y: auto;
  padding: 24px;
}
.account-container {
  max-width: 640px;
  margin: 0 auto;
}
.account-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.account-header h2 {
  font-size: 20px;
  font-weight: 700;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.account-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.account-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.account-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.account-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}
.account-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.account-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tier-free {
  background: var(--border);
  color: var(--text-secondary);
}
.tier-pro {
  background: #2563EB;
  color: #FFF;
}
.tier-enterprise {
  background: #D97706;
  color: #FFF;
}
.usage-stats {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}
.usage-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.usage-number {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.usage-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}
.usage-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Usage cost display */
.usage-cost-display {
  text-align: center;
  margin: 12px 0 8px;
}
.usage-cost-current {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
}
.usage-cost-separator {
  font-size: 20px;
  color: var(--text-muted);
  margin: 0 4px;
}
.usage-cost-limit {
  font-size: 20px;
  color: var(--text-secondary);
}
.usage-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 8px 0 16px;
}
.usage-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}
.usage-progress-fill.over-limit {
  background: var(--danger);
}
.usage-details {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

/* Admin table */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.admin-limit-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
}

/* ------ Scrollbar ------ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================================================================
   Multiplayer
   ================================================================ */

/* ------ Ghost button (icon-only) ------ */
.btn-ghost {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--bg-user-msg); color: var(--text-primary); }
.btn-xs { font-size: 12px; padding: 2px 8px; }

/* ------ Multiplayer modal ------ */
.mp-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
}
.mp-modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 420px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.mp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.mp-modal-header h3 { margin: 0; font-size: 16px; }
.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0 4px;
}
.btn-close:hover { color: var(--text-primary); }
.mp-modal-body { padding: 16px 20px 20px; }

/* Toggle switch */
.mp-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.mp-toggle-label { font-weight: 500; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Invites */
.mp-invites-section { margin-top: 16px; }
.mp-invites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}
.mp-invites-list { display: flex; flex-direction: column; gap: 6px; }
.mp-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.mp-invite-info { display: flex; flex-direction: column; gap: 2px; }
.mp-invite-name { font-weight: 500; }
.mp-invite-char { color: var(--text-muted); font-size: 12px; }
.mp-invite-actions { display: flex; gap: 4px; }
.mp-empty { color: var(--text-muted); font-size: 13px; padding: 8px 0; }

/* ------ Pending actions panel ------ */
.pending-actions-panel {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  background: var(--bg-secondary);
  max-height: 200px;
  overflow-y: auto;
}
.pending-actions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}
.pending-actions-count {
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.pending-actions-list { display: flex; flex-direction: column; gap: 6px; }
.pending-action-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.pending-action-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.pending-player-name { color: var(--text-muted); font-size: 12px; }
.pending-action-text {
  padding: 4px 0;
  line-height: 1.4;
  outline: none;
}
.pending-action-text.editing {
  background: var(--bg-input);
  border: 1px solid var(--border-input-focus);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
}
.pending-action-controls {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.pending-empty { color: var(--text-muted); font-size: 13px; }

/* ------ Client view ------ */
.view-client {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}
.client-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
}
.client-header h2 { margin: 0; font-size: 18px; }
.client-status { font-size: 13px; color: var(--text-muted); }
.client-status-error { color: var(--danger); }

.client-name-setup {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.client-name-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  max-width: 360px;
  width: 100%;
}
.client-name-card h3 { margin: 0 0 8px; }
.client-name-card p { color: var(--text-secondary); margin: 0 0 20px; font-size: 14px; }
.client-name-card .form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin-bottom: 12px;
  background: var(--bg-input);
  color: var(--text-primary);
}

.client-char-badge {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.client-no-char { color: var(--text-muted); font-style: italic; }

#client-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#client-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.client-action-status {
  padding: 10px 12px;
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
}
.client-action-submitted { color: var(--text-secondary); }

/* Multiplayer badge (sidebar + select cards) */
.mp-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 4px;
}

/* Multiplayer toggle on campaign creation form */
.create-multiplayer-toggle {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}
.mp-create-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.mp-create-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
}
.mp-create-info svg {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
.mp-create-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.mp-create-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
