:root {
  --bg-main: #0c0f14;
  --bg-sidebar: #141820;
  --bg-card: #1c222e;
  --bg-card-hover: #242c3b;
  --border: #2c3547;
  --accent-gold: #f5a623;
  --accent-gold-hover: #ffb845;
  --accent-blue: #3b82f6;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --text-main: #f0f4f8;
  --text-muted: #8b9bb4;
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-height: 52px;
  --sidebar-width: 360px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Visibility Utilities */
.mobile-only { display: none !important; }
.hide-on-mobile { display: flex !important; }

.header {
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  flex-shrink: 0;
  gap: 8px;
  overflow: hidden;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
  min-width: 0;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 2;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.logo-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-gold);
  white-space: nowrap;
  line-height: 1.1;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.logo-text {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
}

.status-label {
  white-space: nowrap;
  display: inline-block;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold);
  transition: background 0.3s;
  flex-shrink: 0;
}

.status-badge.connected .status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-badge.disconnected .status-dot {
  background: var(--accent-red);
}

/* Tool Buttons */
.tool-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover, .tool-btn.active {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--accent-gold);
}

.role-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-gold);
  padding: 0 6px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  max-width: 96px;
  white-space: nowrap;
}

.btn-logout-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
  padding: 0;
  flex-shrink: 0;
}

.btn-logout-icon:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
  transform: scale(1.05);
}

.btn-audio-icon {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-gold);
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
  padding: 0;
  flex-shrink: 0;
}

.btn-audio-icon:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  transform: scale(1.05);
}

/* Buttons */
.btn {
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  box-sizing: border-box;
}

.btn-primary { background: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }

.btn-gold { background: var(--accent-gold); color: #111; }
.btn-gold:hover { background: var(--accent-gold-hover); }

.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--accent-gold); }

.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0 8px; font-size: 0.8rem; height: 28px; }
.btn-block { width: 100%; margin-top: 10px; height: auto; padding: 8px 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; font-size: 1rem; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.btn-icon:hover { border-color: var(--accent-gold); background: var(--bg-card-hover); }

/* Main Container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebars (Desktop) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-color: var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.sidebar-left { border-right: 1px solid var(--border); }
.sidebar-right { 
  border-left: 1px solid var(--border); 
  width: 360px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold) rgba(0, 0, 0, 0.2);
}

.sidebar-right::-webkit-scrollbar {
  width: 6px;
}

.sidebar-right::-webkit-scrollbar-thumb {
  background: var(--accent-gold);
  border-radius: 4px;
}

.sidebar-right::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--text-main); }
.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background: var(--bg-sidebar);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 80px 14px;
}

.tab-content.active { display: flex; flex-direction: column; gap: 12px; }

/* Combat Tracker */
.combat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.round-badge {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--accent-gold);
}

.initiative-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}

.init-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.init-card.active {
  border-color: var(--accent-gold);
  background: #252a38;
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.2);
}

.init-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.init-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.init-hp-box {
  display: flex;
  align-items: center;
  gap: 4px;
}

.init-hp-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
}

.init-del-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.init-del-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: var(--accent-red);
  color: #ffffff;
}

/* Hero & Monster Spawner Boxes */
.characters-spawn-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: fit-content;
}

.spawn-box-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.char-spawn-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-spawn-row select {
  height: 38px;
  font-size: 0.88rem;
  padding: 6px 10px;
  border-radius: 8px;
}

.characters-roster-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.char-roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.char-roster-item:hover {
  background: rgba(45, 60, 85, 0.85);
  border-color: var(--accent-gold);
}

/* Monsters List */
.monsters-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: 340px;
}

.monster-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.monster-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-red);
}

.monster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.monster-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #ff8c8c;
}

.monster-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Canvas Area */
.canvas-area {
  flex: 1;
  position: relative;
  background: #080a0e;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.turn-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 24, 32, 0.92);
  border: 1px solid var(--accent-gold);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 40;
  white-space: nowrap;
}

.ruler-label {
  position: absolute;
  background: rgba(12, 15, 20, 0.95);
  border: 1px solid var(--accent-blue);
  color: #93c5fd;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: none;
  display: none;
  z-index: 80;
}

/* Player Sheet & Right Sidebar */
.player-panel {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.char-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.char-avatar {
  font-size: 2rem;
  background: var(--bg-sidebar);
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.char-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-gold);
}

.char-class {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.char-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 4px;
  text-align: center;
}

.stat-val {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.attack-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px;
}

.section-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.log-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
}

.log-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.3;
}

.log-item.crit { border-color: var(--accent-gold); background: #2f2715; }
.log-item.fail { border-color: var(--accent-red); background: #2d1818; }
.log-item.secret { border-color: var(--accent-purple); background: #251b36; }

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="text"], input[type="number"], input[type="search"], select, .form-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

input:focus, select:focus { border-color: var(--accent-gold); }
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }
.toggle-row { display: flex; gap: 8px; }

/* Floating Dice Drawer */
.dice-drawer {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 24, 32, 0.95);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  z-index: 90;
  max-width: 95vw;
}

.dice-scroll-box {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dice-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.dice-btn:hover, .dice-btn:active { background: var(--accent-gold); color: #111; transform: scale(1.08); }
.dice-btn.dice-d20 { border-color: var(--accent-gold); color: var(--accent-gold); }

/* Dice Modal Grid */
.dice-grid-modal {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.dice-poly-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.dice-poly-btn:hover, .dice-poly-btn:active {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.18);
  transform: translateY(-2px);
}

.dice-poly-btn.gold {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.12);
  color: var(--accent-gold);
  font-weight: 700;
}

.poly-icon {
  font-size: 1.25rem;
}

.poly-name {
  font-size: 0.85rem;
  font-weight: 700;
}

/* Attack Action Modal */
.attacker-info-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.attacker-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.attack-mod-btn {
  flex: 1;
  text-align: center;
  transition: all 0.15s ease;
}

.attack-mod-btn.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #080a0e;
  font-weight: 700;
}

.attack-result-box {
  background: #121822;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.attack-result-box.hit {
  border-color: var(--accent-green);
  background: rgba(46, 204, 113, 0.12);
}

.attack-result-box.crit {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.18);
  box-shadow: 0 0 15px rgba(245, 166, 35, 0.3);
}

.attack-result-box.miss {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.12);
}

.attack-result-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.attack-result-desc {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.4;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal-overlay.open, .modal-overlay.active { display: flex; }

.modal-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-gold);
  border-radius: 12px;
  width: 90%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.modal-header {
  padding: 12px 16px;
  background: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body { padding: 18px; }
.qr-image-wrapper { margin: 12px auto; width: 170px; height: 170px; border-radius: 8px; overflow: hidden; }
.qr-image-wrapper img { width: 100%; height: 100%; }
.url-copy-box { display: flex; gap: 6px; margin-top: 12px; }
.url-copy-box input { flex: 1; }

/* AI Result Box */
.ai-result-box {
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  padding: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 250px;
  overflow-y: auto;
}

/* Saved Maps Modal & Grid */
.modal-card.modal-lg {
  max-width: 680px;
  width: 95%;
}

.saved-maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 4px;
}

.saved-map-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s;
}

.saved-map-card:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

.saved-map-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saved-map-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.saved-map-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.3;
}

.saved-map-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Campaign Selector in Header */
.campaign-selector-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.campaign-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent-gold);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  max-width: 130px;
  text-overflow: ellipsis;
}

/* User Profile Badge */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  max-width: 140px;
  height: 34px;
  box-sizing: border-box;
}

.user-avatar { font-size: 0.95rem; }
.user-name { font-weight: 600; color: var(--text-main); max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-logout { background: transparent; border: none; cursor: pointer; font-size: 0.85rem; color: var(--text-muted); transition: color 0.2s; padding: 0 2px; }
.btn-logout:hover { color: var(--accent-red); }

#btnShareQR {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111;
  font-weight: 700;
  padding: 0 12px;
  height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  white-space: nowrap;
  flex-shrink: 0;
}

#btnShareQR:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}

/* Simulated Fullscreen Fallback */
body.simulated-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  overflow: hidden !important;
}

/* Telegram Auth Overlay */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 10, 14, 0.96);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
}

.login-overlay.active { display: flex; }

.login-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--accent-gold);
  border-radius: 16px;
  width: 92%;
  max-width: 720px;
  padding: 24px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 166, 35, 0.15);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
}

.login-header { text-align: center; }
.login-logo { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 900; color: var(--accent-gold); margin-bottom: 4px; }
.login-header h2 { font-size: 1.2rem; color: var(--text-main); margin-bottom: 4px; }
.login-subtitle { font-size: 0.85rem; color: var(--text-muted); }

/* Role Selection Grid */
.login-role-selection {
  margin: 14px 0 16px 0;
  text-align: left;
}

.role-selector-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.role-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.role-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.role-card:hover {
  border-color: var(--accent-blue);
  background: #1c2230;
  transform: translateY(-2px);
}

.role-card.active {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.12);
  box-shadow: 0 0 12px rgba(245, 166, 35, 0.25);
}

.role-card-badge {
  font-size: 1.4rem;
}

.role-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.role-card-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Character Spawner Box (DM) */
.characters-spawn-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.char-spawn-row {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#charSpawnSelect {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Search Box */
.search-box {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.search-box input, #bestiarySearch {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.spawn-box-title, .builder-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.map-builder-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.brush-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.3;
}

/* Fog of War Styles */
.fow-control-box {
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.fow-brush-row, .fow-quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.fow-tool-btn.active {
  border-color: #9b59b6;
  background: rgba(155, 89, 182, 0.3);
  color: #dcdde1;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(155, 89, 182, 0.4);
}

.quick-spawn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.quick-spawn-grid .btn {
  padding: 6px 2px;
  font-size: 0.74rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--bg-main);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.login-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.method-title { font-weight: 700; font-size: 0.9rem; color: var(--text-main); margin-bottom: 8px; }
.auth-qr-wrapper { width: 150px; height: 150px; border-radius: 8px; overflow: hidden; border: 2px solid var(--border); margin-bottom: 10px; }
.auth-qr-wrapper img { width: 100%; height: 100%; }

.pin-display {
  font-family: monospace;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--accent-gold);
  background: var(--bg-card);
  border: 2px dashed var(--accent-gold);
  border-radius: 8px;
  padding: 8px 16px;
  margin: 10px 0;
  text-shadow: 0 0 10px rgba(245, 166, 35, 0.4);
}

.pin-instructions { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 8px; }

.copy-cmd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.copy-cmd-row:hover {
  border-color: var(--accent-blue);
}

.copy-code-badge {
  font-family: monospace;
  color: #60a5fa;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  user-select: text;
  -webkit-user-select: text;
  letter-spacing: 0.5px;
}

.btn-copy-cmd {
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy-cmd.copied {
  background: var(--accent-green) !important;
  color: #fff !important;
}

.auth-status-indicator { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--accent-gold); margin-top: 12px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-gold); animation: pulseAnim 1.5s infinite; }

@keyframes pulseAnim {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.4); opacity: 1; box-shadow: 0 0 10px var(--accent-gold); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.login-remember-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
}

.remember-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

.remember-label:hover {
  color: var(--text-main);
}

/* Saved Maps Modal */
.modal-lg { max-width: 680px; }
.saved-maps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; max-height: 380px; overflow-y: auto; }
.saved-map-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; gap: 6px; }
.saved-map-card:hover { border-color: var(--accent-gold); background: var(--bg-card-hover); transform: translateY(-2px); }
.saved-map-title { font-weight: 700; font-size: 0.9rem; color: var(--accent-gold); }
.saved-map-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Role based desktop filtering */
body.role-player .dm-only { display: none !important; }

/* ========================================================================= */
/* 📺 ABSOLUTE TV / SPECTATOR MODE (100% Clean Display with ZERO Clutter)    */
/* ========================================================================= */
body.role-spectator,
body.role-tv,
body.tv-mode {
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #000000 !important;
}

/* Hide ALL headers, navigation bars, sidebars, floating toolbars, drawers, banners */
body.role-spectator header,
body.role-spectator .header,
body.role-spectator .app-header,
body.role-spectator aside,
body.role-spectator .sidebar,
body.role-spectator .sidebar-left,
body.role-spectator .sidebar-right,
body.role-spectator #sidebarLeft,
body.role-spectator #sidebarRight,
body.role-spectator .mobile-nav-bar,
body.role-spectator #mobileBottomNav,
body.role-spectator .mobile-tool-fabs,
body.role-spectator #canvasFloatingTools,
body.role-spectator .dice-drawer,
body.role-spectator #diceDrawer,
body.role-spectator .quick-dice-toolbar,
body.role-spectator #quickDiceBar,
body.role-spectator .floating-fog-panel,
body.role-spectator #floatingFogToolbar,
body.role-spectator .floating-spell-panel,
body.role-spectator #floatingSpellToolbar,
body.role-spectator .tap-to-place-banner,
body.role-spectator #tapToPlaceBanner,
body.role-spectator .turn-banner,
body.role-spectator .drawer-backdrop,
body.role-spectator #drawerBackdrop,
body.role-spectator .dm-only,
body.role-tv header,
body.role-tv .header,
body.role-tv .app-header,
body.role-tv aside,
body.role-tv .sidebar,
body.role-tv .sidebar-left,
body.role-tv .sidebar-right,
body.role-tv #sidebarLeft,
body.role-tv #sidebarRight,
body.role-tv .mobile-nav-bar,
body.role-tv #mobileBottomNav,
body.role-tv .mobile-tool-fabs,
body.role-tv #canvasFloatingTools,
body.role-tv .dice-drawer,
body.role-tv #diceDrawer,
body.role-tv .quick-dice-toolbar,
body.role-tv #quickDiceBar,
body.role-tv .floating-fog-panel,
body.role-tv #floatingFogToolbar,
body.role-tv .floating-spell-panel,
body.role-tv #floatingSpellToolbar,
body.role-tv .tap-to-place-banner,
body.role-tv #tapToPlaceBanner,
body.role-tv .turn-banner,
body.role-tv .drawer-backdrop,
body.role-tv #drawerBackdrop,
body.role-tv .dm-only,
body.tv-mode header,
body.tv-mode .header,
body.tv-mode .app-header,
body.tv-mode aside,
body.tv-mode .sidebar,
body.tv-mode .sidebar-left,
body.tv-mode .sidebar-right,
body.tv-mode #sidebarLeft,
body.tv-mode #sidebarRight,
body.tv-mode .mobile-nav-bar,
body.tv-mode #mobileBottomNav,
body.tv-mode .mobile-tool-fabs,
body.tv-mode #canvasFloatingTools,
body.tv-mode .dice-drawer,
body.tv-mode #diceDrawer,
body.tv-mode .quick-dice-toolbar,
body.tv-mode #quickDiceBar,
body.tv-mode .floating-fog-panel,
body.tv-mode #floatingFogToolbar,
body.tv-mode .floating-spell-panel,
body.tv-mode #floatingSpellToolbar,
body.tv-mode .tap-to-place-banner,
body.tv-mode #tapToPlaceBanner,
body.tv-mode .turn-banner,
body.tv-mode .drawer-backdrop,
body.tv-mode #drawerBackdrop,
body.tv-mode .dm-only {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Fullscreen Canvas Container */
body.role-spectator .main-container,
body.role-tv .main-container,
body.tv-mode .main-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 10 !important;
}

body.role-spectator .canvas-area,
body.role-tv .canvas-area,
body.tv-mode .canvas-area {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  cursor: default !important;
}

body.role-spectator #vttCanvas,
body.role-tv #vttCanvas,
body.tv-mode #vttCanvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* Subtle Floating TV Badge / Menu in Top Right */
.tv-mode-control {
  display: none;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 99999;
}

body.role-spectator .tv-mode-control,
body.role-tv .tv-mode-control,
body.tv-mode .tv-mode-control {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.tv-control-btn {
  background: rgba(15, 20, 32, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(245, 166, 35, 0.25);
  color: #94a3b8;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0.35;
  transition: all 0.25s ease;
}

.tv-control-btn:hover,
.tv-control-btn:active,
.tv-mode-control:hover .tv-control-btn {
  opacity: 1;
  background: rgba(15, 20, 32, 0.95);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 16px rgba(245, 166, 35, 0.4);
  transform: scale(1.04);
}

.tv-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(15, 20, 32, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--accent-gold);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(245, 166, 35, 0.2);
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.15s ease-out;
}

.tv-dropdown-menu.open {
  display: flex !important;
}

.tv-menu-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
  padding: 4px 8px 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.tv-menu-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s;
}

.tv-menu-item:hover {
  background: var(--bg-hover);
  color: var(--accent-gold);
}

.tv-menu-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-menu-item:hover {
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent-gold);
}


/* ========================================================================= */
/* 📱 MOBILE RESPONSIVE ADAPTATION (Phones / Small Screens) */
/* ========================================================================= */
@media (max-width: 768px) {
  .mobile-only { display: flex !important; }
  .hide-on-mobile { display: none !important; }

  :root {
    --header-height: 46px;
  }

  .header {
    padding: 0 10px;
    height: var(--header-height);
  }

  .logo-text { display: none; }
  .logo-icon { font-size: 1.4rem; }
  .campaign-selector-box { display: none !important; }

  /* Full screen canvas */
  .main-container {
    height: calc(100vh - var(--header-height) - 56px);
    height: calc(100dvh - var(--header-height) - 56px);
  }

  .canvas-area {
    width: 100% !important;
    height: 100% !important;
  }

  /* Sidebars transform into Bottom Sheets / Slide-up Drawers */
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 88vh !important;
    height: auto !important;
    background: var(--bg-sidebar) !important;
    border: none !important;
    border-top: 2px solid var(--accent-gold) !important;
    border-radius: 18px 18px 0 0 !important;
    z-index: 250 !important;
    transform: translateY(105%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 90px !important;
  }

  .sidebar.drawer-open {
    transform: translateY(0) !important;
  }

  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    position: relative;
  }

  .drawer-handle {
    width: 44px;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
  }

  .drawer-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-family: var(--font-serif);
    margin-top: 4px;
  }

  .btn-close-drawer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
  }

  /* Backdrop */
  .drawer-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 240;
    display: none;
    opacity: 0;
    transition: opacity 0.25s;
  }

  .drawer-backdrop.active {
    display: block;
    opacity: 1;
  }

  /* Mobile Bottom Nav Bar */
  .mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 220;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    gap: 2px;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s;
  }

  .nav-item.active, .nav-item:active {
    color: var(--accent-gold);
  }

  .nav-icon {
    font-size: 1.2rem;
  }

  /* Mobile Tool FABs on Canvas */
  .mobile-tool-fabs {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
  }

  .fab-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(20, 24, 32, 0.9);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    cursor: pointer;
  }

  .fab-btn.active {
    border-color: var(--accent-gold);
    background: #252a38;
    color: var(--accent-gold);
  }

  /* Floating Fog of War Quick Toolbar on Canvas */
  .floating-fog-panel {
    position: absolute;
    top: 12px;
    left: 58px;
    background: rgba(18, 22, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent-gold);
    border-radius: 12px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 65;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    font-size: 0.78rem;
    color: var(--text-main);
    animation: fadeIn 0.2s ease;
    max-width: 250px;
  }

  .fog-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
    font-size: 0.8rem;
  }

  .fog-switch-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--accent-gold);
    cursor: pointer;
  }

  .fog-panel-row {
    display: flex;
    gap: 4px;
    align-items: center;
  }

  .fog-mode-btn {
    flex: 1;
    font-size: 0.72rem;
    padding: 4px 6px;
    border-radius: 6px;
    background: #222836;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
  }

  .fog-mode-btn.active {
    background: var(--accent-gold) !important;
    color: #0d1117 !important;
    font-weight: 700;
    border-color: var(--accent-gold);
  }

  .btn-outline-danger {
    border: 1px solid #ef4444;
    color: #ef4444;
    background: transparent;
    padding: 3px 6px;
    font-size: 0.7rem;
    border-radius: 6px;
    cursor: pointer;
  }
  .btn-outline-danger:hover {
    background: #ef4444;
    color: #fff;
  }

  .btn-outline-info {
    border: 1px solid #38bdf8;
    color: #38bdf8;
    background: transparent;
    padding: 3px 6px;
    font-size: 0.7rem;
    border-radius: 6px;
    cursor: pointer;
  }
  .btn-outline-info:hover {
    background: #38bdf8;
    color: #000;
  }

  .btn-outline-warning {
    border: 1px solid #f59e0b;
    color: #f59e0b;
    background: transparent;
    padding: 3px 6px;
    font-size: 0.7rem;
    border-radius: 6px;
    cursor: pointer;
  }
  .btn-outline-warning:hover {
    background: #f59e0b;
    color: #000;
  }

  /* Floating Spell FX Panel */
  .floating-spell-panel {
    position: absolute;
    top: 52px;
    left: 58px;
    background: rgba(18, 22, 30, 0.96);
    backdrop-filter: blur(12px);
    border: 1px solid #8b5cf6;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 65;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.8), 0 0 15px rgba(139, 92, 246, 0.25);
    font-size: 0.78rem;
    color: var(--text-main);
    animation: fadeIn 0.2s ease;
    max-width: 270px;
  }

  .spell-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.25);
    padding-bottom: 5px;
    font-size: 0.82rem;
    color: #c4b5fd;
  }

  .spell-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .spell-preset-btn {
    font-size: 0.72rem;
    padding: 5px 6px;
    border-radius: 6px;
    background: #1e1b4b;
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .spell-preset-btn:hover {
    background: #4338ca;
    border-color: #a78bfa;
    color: #fff;
  }

  .spell-preset-btn.active {
    background: #7c3aed !important;
    color: #ffffff !important;
    font-weight: 700;
    border-color: #c4b5fd;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
  }

  .spell-panel-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 4px;
    text-align: center;
  }

  /* Floating Dice Drawer on Mobile */
  .dice-drawer {
    bottom: 66px !important;
    padding: 6px 10px;
    border-radius: 25px;
    width: auto;
    max-width: 95vw;
  }

  .dice-scroll-box {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dice-btn {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
  }

  /* Login Card on Mobile */
  .login-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Map Builder & Brush Tool Styles */
.map-builder-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.builder-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.shape-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.shape-btn {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 9px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shape-btn:hover {
  border-color: var(--accent-blue);
  background: #1e2430;
}

.shape-btn.active {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.2);
  color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.35);
  font-weight: 700;
}

.brush-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.brush-btn {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 9px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brush-btn:hover {
  border-color: var(--accent-blue);
  background: #1e2430;
}

.brush-btn.active {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.18);
  color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.3);
  font-weight: 700;
}

.brush-btn.brush-eraser.active {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.18);
  color: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.brush-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  margin-bottom: 0;
  line-height: 1.35;
}

.map-actions-row {
  display: flex;
  gap: 8px;
}

.map-actions-row .btn {
  flex: 1;
  font-size: 0.78rem;
  padding: 8px 6px;
  height: 36px;
}

/* Fog of War Styling */
.fow-control-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fow-brush-row, .fow-quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.fow-brush-row .btn, .fow-quick-row .btn {
  height: 38px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: 8px;
}

.fow-tool-btn.active {
  border-color: var(--accent-gold) !important;
  background: rgba(245, 166, 35, 0.22) !important;
  color: var(--accent-gold) !important;
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.35);
}

.save-map-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.input-group {
  display: flex;
  gap: 6px;
}

.input-group .form-control {
  flex: 1;
}

/* Combat Setup Card & Initiation Wizard */
.combat-setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.setup-header {
  margin-bottom: 10px;
}

.setup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.setup-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.setup-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setup-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.setup-step-item:hover {
  background: rgba(245, 166, 35, 0.08);
  border-color: var(--accent-gold);
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-gold);
  color: #121417;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Initiative Phase Modal Items */
.init-roll-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.init-roll-row.rolled {
  border-color: rgba(46, 204, 113, 0.6);
  background: rgba(46, 204, 113, 0.08);
}

.init-roll-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.init-roll-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.init-roll-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.init-roll-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.init-roll-dex {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
}

.init-roll-score-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.init-score-input {
  width: 58px !important;
  min-width: 58px !important;
  max-width: 58px !important;
  height: 38px !important;
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0 !important;
  background: #0f131a !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  color: var(--accent-gold) !important;
  box-sizing: border-box !important;
}

.init-score-input:focus {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 8px rgba(245, 166, 35, 0.3) !important;
}

.init-roll-btn {
  height: 38px;
  padding: 0 12px;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Character Roster List Items */
.char-roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.char-roster-item:hover {
  background: rgba(245, 166, 35, 0.08);
  border-color: rgba(245, 166, 35, 0.4);
}

.char-roster-item.active-hero {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.12);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.15);
}

/* --- Hero Panel Clean & Spacious Styling --- */
.player-panel {
  padding: 16px 16px 120px 16px;
  background: var(--bg-card);
  overflow: visible;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-switcher-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.char-header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.char-avatar {
  font-size: 2.2rem;
  background: var(--bg-sidebar);
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(245, 166, 35, 0.4);
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.char-info {
  flex: 1;
  min-width: 0;
}

.char-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent-gold);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-class {
  font-size: 0.82rem;
  color: #cbd5e1;
  font-weight: 600;
  margin-top: 2px;
}

.char-species-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 1px;
}

/* Vitals & Health */
.char-vitals-container {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.hp-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hp-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s;
}

.hp-display-box {
  text-align: center;
  flex: 1;
}

.hp-display-box .hp-curr {
  font-size: 1.35rem;
  font-weight: 800;
  color: #10b981;
  display: block;
  line-height: 1.1;
  letter-spacing: 0.5px;
}

.hp-display-box .hp-lbl {
  font-size: 0.68rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.hp-progress-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.hp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.3s ease;
  border-radius: 4px;
}

.char-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
}

.stat-box .stat-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f1f5f9;
  display: block;
  line-height: 1.1;
}

.stat-box .stat-lbl {
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 3px;
  display: block;
}

/* Tabs */
.hero-inner-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 14px;
}

.hero-tab-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 0.8rem;
  font-weight: 700;
  background: transparent;
  color: #94a3b8;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
}

.hero-tab-btn.active {
  background: var(--accent-gold);
  color: #0b0e14;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.35);
}

.hero-inner-content {
  margin-top: 10px;
}

/* 6 Abilities Grid */
.abilities-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ability-mini-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.ability-mini-card:hover {
  border-color: var(--accent-gold);
  background: rgba(245, 166, 35, 0.08);
}

.ability-mini-card .ab-name {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
}

.ability-mini-card .ab-score {
  font-size: 1.05rem;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1.1;
  margin: 2px 0;
}

.ability-mini-card .ab-mod {
  font-size: 0.76rem;
  color: var(--accent-gold);
  font-weight: 800;
}

/* Inventory Summary & Encumbrance */
.inventory-summary-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.wallet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wallet-coin {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  flex: 1;
  justify-content: center;
}

.coin-icon {
  font-size: 1rem;
}

.coin-input {
  width: 48px !important;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 2px !important;
  background: transparent !important;
  border: none !important;
  color: var(--accent-gold) !important;
}

.coin-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
}

.encumbrance-bar {
  margin-top: 8px;
}

.enc-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 4px;
}

.enc-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.enc-fill {
  height: 100%;
  background: #10b981;
  transition: width 0.3s;
}

/* Inventory Item Cards */
.inventory-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  padding-bottom: 20px;
}

.inv-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.inv-card:hover {
  border-color: rgba(245, 166, 35, 0.35);
  background: rgba(30, 41, 59, 0.75);
}

.inv-card.equipped {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.06);
}

.inv-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.inv-card-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.inv-card-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.inv-card-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-card-qty {
  font-size: 0.72rem;
  color: var(--accent-gold);
  font-weight: 800;
  background: rgba(245, 166, 35, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.inv-card-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.inv-tag {
  font-size: 0.7rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 2px 6px;
  font-weight: 600;
}

.inv-tag.stat-atk {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.08);
}

.inv-tag.stat-dmg {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
}

.inv-tag.stat-ac {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
}

.inv-card-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 6px;
  line-height: 1.3;
}

.inv-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-equip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-equip.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

/* --- Token & Character / Monster Stat Card Modal --- */
.tc-main-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.tc-avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.tc-meta {
  flex: 1;
  min-width: 0;
}

.tc-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tc-badges-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tc-badge {
  background: #12161f;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 600;
}

.tc-hp-section {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}

.tc-hp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.tc-hp-controls {
  display: flex;
  gap: 4px;
}

.tc-hp-bar-bg {
  width: 100%;
  height: 8px;
  background: #1c2230;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tc-hp-bar-fill {
  height: 100%;
  background: #10b981;
  transition: width 0.3s ease, background 0.3s ease;
}

.tc-abilities-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.tc-ability-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 2px;
  text-align: center;
}

.tc-ability-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tc-ability-score {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.tc-ability-mod {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.tc-actions-section {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.tc-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.tc-actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.tc-action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #141822;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

.tc-bio-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tc-bio-tab-btn:hover {
  color: var(--text-main);
}

.tc-bio-tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.tc-action-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f1f5f9;
}

.tc-action-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Simulated Fullscreen for webview / iframe / desktop */
body.simulated-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 999999 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Character Manager & Map Library Cards */
.characters-grid, .saved-maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.char-card-item, .map-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.char-card-item:hover, .map-card-item:hover {
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.char-card-header, .map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.char-card-title, .map-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.char-card-badges, .map-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
}

.char-stat-badge {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px 6px;
  color: #cbd5e1;
  font-weight: 600;
}

.char-card-actions, .map-card-actions {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.join-camp-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Chat Messages */
.chat-msg-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 90%;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
}

.chat-msg-item.msg-player {
  align-self: flex-start;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
}

.chat-msg-item.msg-dm {
  align-self: flex-start;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fef3c7;
}

.chat-msg-item.msg-mine {
  align-self: flex-end;
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  color: #ffffff;
}

.chat-msg-item.msg-system {
  align-self: center;
  background: rgba(148, 163, 184, 0.1);
  border: 1px dashed rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-size: 0.75rem;
  text-align: center;
  max-width: 95%;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.chat-msg-time {
  font-size: 0.68rem;
  font-weight: 400;
  color: #64748b;
  margin-left: auto;
}

.party-member-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  color: #e2e8f0;
}

/* ==========================================================================
   🏰 DM CAMPAIGN & LOCATIONS STYLING
   ========================================================================== */
.dm-locations-list, .dm-map-library-list, .dm-party-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  padding-bottom: 20px;
}

.dm-loc-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.dm-loc-card:hover {
  border-color: rgba(245, 166, 35, 0.35);
  background: rgba(30, 41, 59, 0.75);
}

.dm-loc-card.active-scene {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.06);
}

.dm-loc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dm-loc-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dm-loc-type-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 166, 35, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 166, 35, 0.25);
}

.dm-loc-desc {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 5px;
  line-height: 1.35;
}

.dm-loc-map-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 8px;
}

.dm-loc-map-name {
  font-size: 0.76rem;
  color: #60a5fa;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dm-loc-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Map Library Cards */
.dm-map-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.dm-map-card:hover {
  border-color: rgba(245, 166, 35, 0.35);
  background: rgba(30, 41, 59, 0.75);
}

.dm-map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dm-map-card-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dm-map-card-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* DM Party Cards */
.dm-party-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
}

.dm-party-avatar {
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dm-party-info {
  flex: 1;
  min-width: 0;
}

.dm-party-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #f1f5f9;
}

.dm-party-sub {
  font-size: 0.72rem;
  color: #94a3b8;
}

/* --- ℹ️ Help & Rules Reference Modal Styles --- */
.help-tabs-header {
  scrollbar-width: none;
}
.help-tabs-header::-webkit-scrollbar {
  display: none;
}

.help-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.help-tab-btn:hover {
  color: #f1f5f9;
}

.help-tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.help-section-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.help-mini-badge {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.help-rule-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.help-shortcut-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-shortcut-item kbd {
  background: #1e293b;
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

/* =========================================================================
   --- HEALTH CONDITIONS & DEATH SAVING THROWS STYLES (D&D 5.2) ---
   ========================================================================= */

.death-saves-box {
  background: linear-gradient(135deg, rgba(30, 15, 20, 0.95), rgba(15, 23, 42, 0.95));
  border: 1.5px solid #ef4444;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
  animation: pulseRed 2s infinite ease-in-out;
}

@keyframes pulseRed {
  0%, 100% { border-color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
  50% { border-color: #f87171; box-shadow: 0 0 18px rgba(239, 68, 68, 0.5); }
}

.death-saves-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.death-saves-title {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  font-weight: 700;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 6px;
}

.death-save-status-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.death-save-status-badge.dying {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid #ef4444;
}

.death-save-status-badge.stable {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid #10b981;
}

.death-save-status-badge.dead {
  background: rgba(0, 0, 0, 0.6);
  color: #94a3b8;
  border: 1px solid #475569;
}

.death-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.death-save-pips {
  display: flex;
  gap: 8px;
}

.death-pip {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #64748b;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}

.death-pip:hover {
  transform: scale(1.15);
}

.death-pip.success-active {
  background: #10b981;
  border-color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  color: #fff;
}

.death-pip.failure-active {
  background: #ef4444;
  border-color: #f87171;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  color: #fff;
}

.death-save-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.death-save-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Conditions Management Section */
.conditions-section {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}

.conditions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.conditions-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  align-items: center;
}

.condition-chip {
  background: #1e293b;
  border: 1px solid #475569;
  color: #e2e8f0;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.condition-chip:hover {
  background: #334155;
  border-color: #f5a623;
  transform: translateY(-1px);
}

.condition-chip.chip-bloodied {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
  font-weight: 700;
}

.condition-chip.chip-unconscious {
  background: rgba(185, 28, 28, 0.3);
  border-color: #b91c1c;
  color: #fca5a5;
  font-weight: 700;
}

.condition-chip.chip-poisoned {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #86efac;
}

.condition-chip.chip-stunned {
  background: rgba(234, 179, 8, 0.2);
  border-color: #eab308;
  color: #fde047;
}

.condition-chip.chip-prone {
  background: rgba(100, 116, 139, 0.25);
  border-color: #94a3b8;
  color: #cbd5e1;
}

.condition-chip.chip-invisible {
  background: rgba(147, 51, 234, 0.2);
  border-color: #a855f7;
  color: #d8b4fe;
}

.condition-chip.chip-frightened {
  background: rgba(249, 115, 22, 0.2);
  border-color: #f97316;
  color: #fdba74;
}

.condition-chip.chip-restrained {
  background: rgba(14, 165, 233, 0.2);
  border-color: #0ea5e9;
  color: #7dd3fc;
}

.condition-chip-remove {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-left: 2px;
}

.condition-chip-remove:hover {
  color: #ef4444;
}

/* Condition Picker Modal / Popup */
.condition-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.condition-picker-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.74rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.condition-picker-btn:hover {
  background: #334155;
  border-color: var(--accent-gold);
}

.condition-picker-btn.active {
  background: rgba(245, 166, 35, 0.2);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  font-weight: 700;
}

/* Floating Tap-to-Place Monster Banner */
.tap-to-place-banner {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 20, 28, 0.95);
  border: 1.5px solid var(--accent-gold);
  border-radius: 30px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 120;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(245, 166, 35, 0.35);
  backdrop-filter: blur(8px);
  animation: pulseGold 2s infinite ease-in-out;
}

.tap-to-place-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f1f5f9;
}

@keyframes pulseGold {
  0%, 100% { box-shadow: 0 4px 25px rgba(0,0,0,0.7), 0 0 12px rgba(245,166,35,0.25); }
  50% { box-shadow: 0 4px 25px rgba(0,0,0,0.7), 0 0 22px rgba(245,166,35,0.6); }
}

/* ========================================================================= */
/* 📺 ABSOLUTE TV / SPECTATOR MODE ENFORCEMENT (FINAL OVERRIDE)              */
/* ========================================================================= */
body.role-spectator,
body.role-tv,
body.tv-mode {
  overflow: hidden !important;
}

body.role-spectator header,
body.role-spectator .header,
body.role-spectator .app-header,
body.role-spectator aside,
body.role-spectator .sidebar,
body.role-spectator .mobile-nav-bar,
body.role-spectator #mobileBottomNav,
body.role-spectator .mobile-tool-fabs,
body.role-spectator #canvasFloatingTools,
body.role-spectator .dice-drawer,
body.role-spectator #diceDrawer,
body.role-spectator .quick-dice-toolbar,
body.role-spectator #quickDiceBar,
body.role-spectator .floating-fog-panel,
body.role-spectator #floatingFogToolbar,
body.role-spectator .floating-spell-panel,
body.role-spectator #floatingSpellToolbar,
body.role-spectator .tap-to-place-banner,
body.role-spectator #tapToPlaceBanner,
body.role-spectator .turn-banner,
body.role-spectator .drawer-backdrop,
body.role-spectator #drawerBackdrop,
body.role-spectator .dm-only,
body.role-tv header,
body.role-tv .header,
body.role-tv .app-header,
body.role-tv aside,
body.role-tv .sidebar,
body.role-tv .mobile-nav-bar,
body.role-tv #mobileBottomNav,
body.role-tv .mobile-tool-fabs,
body.role-tv #canvasFloatingTools,
body.role-tv .dice-drawer,
body.role-tv #diceDrawer,
body.role-tv .quick-dice-toolbar,
body.role-tv #quickDiceBar,
body.role-tv .floating-fog-panel,
body.role-tv #floatingFogToolbar,
body.role-tv .floating-spell-panel,
body.role-tv #floatingSpellToolbar,
body.role-tv .tap-to-place-banner,
body.role-tv #tapToPlaceBanner,
body.role-tv .turn-banner,
body.role-tv .drawer-backdrop,
body.role-tv #drawerBackdrop,
body.role-tv .dm-only,
body.tv-mode header,
body.tv-mode .header,
body.tv-mode .app-header,
body.tv-mode aside,
body.tv-mode .sidebar,
body.tv-mode .mobile-nav-bar,
body.tv-mode #mobileBottomNav,
body.tv-mode .mobile-tool-fabs,
body.tv-mode #canvasFloatingTools,
body.tv-mode .dice-drawer,
body.tv-mode #diceDrawer,
body.tv-mode .quick-dice-toolbar,
body.tv-mode #quickDiceBar,
body.tv-mode .floating-fog-panel,
body.tv-mode #floatingFogToolbar,
body.tv-mode .floating-spell-panel,
body.tv-mode #floatingSpellToolbar,
body.tv-mode .tap-to-place-banner,
body.tv-mode #tapToPlaceBanner,
body.tv-mode .turn-banner,
body.tv-mode .drawer-backdrop,
body.tv-mode #drawerBackdrop,
body.tv-mode .dm-only {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.role-spectator .main-container,
body.role-tv .main-container,
body.tv-mode .main-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 10 !important;
}

body.role-spectator .canvas-area,
body.role-tv .canvas-area,
body.tv-mode .canvas-area {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  cursor: default !important;
}

body.role-spectator .tv-mode-control,
body.role-tv .tv-mode-control,
body.tv-mode .tv-mode-control {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ==========================================================================
   GAME MODE SWITCHER & EXPLORATION VIEW (GEMINI.md)
   ========================================================================== */

.game-mode-toggle {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
  margin-right: 8px;
}

.mode-toggle-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mode-toggle-btn:hover {
  color: #f1f5f9;
}

.mode-toggle-btn.active {
  background: linear-gradient(135deg, #f5a623, #d97706);
  color: #0f172a;
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.4);
}

.combat-tools-group {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  transition: opacity 0.2s;
}

/* Exploration Mode Container */
.exploration-mode-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  pointer-events: auto !important;
  overscroll-behavior-y: contain;
  padding: 16px 16px 160px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: radial-gradient(circle at center top, #1e293b 0%, #0a0e17 100%);
  z-index: 10;
}

/* Floating Quick Tool FABs (Visible ONLY in Combat Mode) */
#canvasFloatingTools {
  display: none;
}

body.mode-combat #canvasFloatingTools {
  display: flex !important;
}

body:not(.mode-combat) #canvasFloatingTools,
body.mode-exploration #canvasFloatingTools,
body.role-spectator #canvasFloatingTools,
body.role-tv #canvasFloatingTools,
body.tv-mode #canvasFloatingTools {
  display: none !important;
}

/* Location Hero Card */
.expl-location-card {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(245, 166, 35, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  background: #0f172a;
}

.expl-location-art {
  position: relative;
  min-height: 220px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #1e293b;
  display: flex;
  align-items: flex-end;
}

.expl-location-overlay {
  width: 100%;
  padding: 20px 24px;
  background: linear-gradient(to top, rgba(10, 14, 23, 0.96) 0%, rgba(10, 14, 23, 0.75) 60%, rgba(10, 14, 23, 0.3) 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.expl-location-title {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: #f5a623;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.expl-location-desc-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 900px;
}

.expl-location-desc {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin: 0;
  max-width: 900px;
  word-break: break-word;
}

.expl-location-desc.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expl-card-desc {
  font-size: 0.78rem;
  color: #cbd5e1;
  margin: 4px 0 0 0;
  line-height: 1.45;
  word-break: break-word;
}

.expl-card-desc.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expl-read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 6px;
  padding: 3px 10px;
  margin-top: 6px;
  color: #f5a623;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.expl-read-more-btn:hover {
  background: rgba(245, 166, 35, 0.25);
  border-color: #f5a623;
  color: #fbbf24;
}

.expl-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

/* 2 Columns Grid: NPCs & Quests */
.expl-grid-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

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

.expl-panel {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.expl-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.expl-panel-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #f8fafc;
}

.expl-npc-list, .expl-quest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expl-npc-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s, border-color 0.2s;
  flex-wrap: wrap;
}

.expl-npc-card:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(245, 166, 35, 0.3);
}

.expl-npc-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 160px;
}

.expl-npc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.expl-npc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 2px solid rgba(245, 166, 35, 0.4);
  flex-shrink: 0;
}

.expl-quest-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


