/* RPG Session - Dark Moody Theme */

:root {
  /* Dark moody color palette */
  --bg-dark: #0a0a0c;
  --bg-primary: #0f0f12;
  --bg-secondary: #151518;
  --bg-card: #1a1a1e;
  --bg-hover: #222226;
  --bg-input: #1c1c20;

  --text-primary: #d4d4d8;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;

  /* Muted steel accent */
  --steel: #71717a;
  --steel-light: #a1a1aa;
  --steel-dark: #52525b;
  --steel-dim: rgba(113, 113, 122, 0.1);

  --accent: #71717a;
  --accent-hover: #a1a1aa;
  --accent-dim: rgba(113, 113, 122, 0.1);

  --success: #3d6b4f;
  --warning: #8b7355;
  --error: #6b3d3d;

  --border: #27272a;
  --border-focus: #52525b;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.7);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 17px;
}

/* Subtle noise texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 10000;
}

.hidden {
  display: none !important;
}

/* Auth Screen - Dark dungeon atmosphere */
#auth-screen {
  position: relative;
  overflow: hidden;
}

#auth-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    /* Dark vignette */
    radial-gradient(ellipse at center, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%),
    /* Illustrated fantasy background */
    url("https://images5.alphacoders.com/911/911857.jpg");
  background-size: cover;
  background-position: center;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

#auth-screen::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 0;
}

#auth-screen .auth-container {
  position: relative;
  z-index: 1;
  background: rgba(20, 18, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(201, 165, 90, 0.25);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.8),
    0 0 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Lobby Screen - Stone dungeon atmosphere */
#lobby-screen {
  position: relative;
  overflow: auto;
}

#lobby-screen::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.75) 100%),
    url("https://images5.alphacoders.com/911/911857.jpg");
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}

#lobby-screen .lobby-container,
#settings-screen .settings-container {
  position: relative;
  z-index: 1;
}

#settings-screen {
  position: relative;
  overflow: auto;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 2rem 1rem;
}

#settings-screen::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.75) 100%),
    url("https://images5.alphacoders.com/911/911857.jpg");
  background-size: cover;
  background-position: center;
  pointer-events: none;
  z-index: 0;
}

#settings-screen::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 0;
}

/* Game Screen - Mystical fog atmosphere */
#game-screen {
  position: relative;
  overflow: hidden;
}

#game-screen::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    /* Subtle mist layers */
    radial-gradient(ellipse at 30% 100%, rgba(113, 113, 122, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 0%, rgba(80, 80, 90, 0.03) 0%, transparent 40%),
    /* Arcane symbols fade (very subtle) */
    radial-gradient(ellipse at 50% 50%, transparent 0%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
  z-index: 0;
  animation: fog-drift 30s ease-in-out infinite alternate;
}

@keyframes fog-drift {
  0% {
    opacity: 0.6;
    transform: scale(1) translateX(0);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02) translateX(5px);
  }
  100% {
    opacity: 0.5;
    transform: scale(1) translateX(-5px);
  }
}

#game-screen .game-layout {
  position: relative;
  z-index: 1;
}

/* Base screen styles */
.screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  border: 1px solid var(--border);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: #c9a55a;
  text-shadow:
    0 0 20px rgba(201, 165, 90, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.05em;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.03em;
}

.form-group.radio-group label {
  display: flex !important;
  align-items: center;
  margin-bottom: 0;
  font-family: 'Crimson Pro', serif;
  font-weight: normal;
  font-size: 1rem;
  letter-spacing: normal;
  gap: 0.5rem;
}

.form-group.radio-group input[type="radio"] {
  width: auto;
  flex-shrink: 0;
}

.form-group.radio-group label span {
  display: inline;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.form-group input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.btn-primary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--steel) 0%, var(--steel-dark) 100%);
  color: var(--bg-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 12px rgba(113, 113, 122, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

.error-message {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(139, 58, 58, 0.15);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  color: #d48888;
  font-size: 0.875rem;
  text-align: center;
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.disconnected { background: var(--error); }

/* Lobby Screen */
.lobby-container {
  background: rgba(20, 18, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 600px;
  margin: 1rem;
  border: 1px solid rgba(201, 165, 90, 0.25);
}

.lobby-container h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.lobby-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-style: italic;
}

#player-name-display {
  color: var(--steel-light);
  font-weight: 600;
}

.games-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  max-height: 300px;
  overflow-y: auto;
}

.game-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.game-card:hover {
  background: var(--bg-hover);
  border-color: var(--steel);
}

.game-card.default-game {
  border-color: var(--steel);
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--steel-dim) 100%);
}

.game-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.game-emoji {
  font-size: 1.5rem;
}

.game-name {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
}

.game-default-badge {
  font-size: 0.65rem;
  background: var(--steel);
  color: var(--bg-dark);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-left: 0.5rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-join {
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--steel) 0%, var(--steel-dark) 100%);
  color: var(--bg-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-join:hover { box-shadow: 0 0 10px rgba(113, 113, 122, 0.3); }

.btn-delete-game {
  padding: 0.5rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-delete-game:hover {
  background: rgba(139, 58, 58, 0.15);
  border-color: var(--error);
  color: #d48888;
}

.create-game-form {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.create-game-form h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
}

.create-game-form form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.create-game-form input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
}

.create-game-form input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.genre-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.genre-selector label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: 'Cinzel', serif;
  white-space: nowrap;
}

.genre-selector select {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 0.875rem;
  cursor: pointer;
  min-width: 180px;
}

.genre-selector select:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.genre-selector select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.empty-games {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-style: italic;
}

.game-card.loading {
  opacity: 0.7;
  pointer-events: none;
}

.loading-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-style: italic;
}

.loading-text::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--steel);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Typing indicator */
.typing-dots {
  display: flex !important;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
  font-style: normal !important;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--steel);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
  display: inline-block;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Game Layout */
#game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.game-layout {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* Scroll to bottom button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 4.5rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
}

.scroll-bottom-btn:hover {
  transform: scale(1.1);
}

.scroll-bottom-btn.hidden {
  display: none;
}

/* Chat Area */
.chat-area {
  position: relative;
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
}

.chat-header {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.chat-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.player-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.players-label { color: var(--text-muted); }
#player-names { color: var(--steel-light); font-weight: 500; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-logout {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(139, 58, 58, 0.15);
  border-color: var(--error);
  color: #d48888;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message {
  max-width: 85%;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 17px;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.outgoing {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--steel-dim) 100%);
  border-color: var(--steel-dark);
}

.message.system {
  align-self: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

.message .sender {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--steel-light);
  margin-bottom: 0.125rem;
  letter-spacing: 0.03em;
}

.message.outgoing .sender { color: var(--text-secondary); }

.message .text {
  color: var(--text-primary);
  word-wrap: break-word;
  line-height: 1.15 !important;
}

.message .text br {
  display: block;
  content: "";
  margin-top: 0.1rem;
}

.message .timestamp {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-align: right;
  font-style: italic;
}

/* GM messages have special styling */
.message .text strong { color: #c9a55a; }
.message .text em { color: #8b9dc3; }
.message .text code {
  background: var(--bg-input);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

/* Constrain lists inside chat bubbles */
.message .text ul,
.message .text ol {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
  max-width: 100%;
  overflow-wrap: break-word;
}

.message .text li {
  margin-bottom: 0.125rem;
}

/* Dice Roll Styling */
.dice-roll {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9em;
  margin: 0.125rem;
  border: 1px solid;
}
.dice-roll dice-roll {
  background: rgba(113, 113, 122, 0.15);
  border-color: var(--steel-dark);
  color: var(--text-primary);
}
.dice-roll.dice-roll {
  background: rgba(113, 113, 122, 0.2);
  border-color: var(--steel);
  color: var(--steel-light);
  font-family: 'Fira Code', 'Consolas', monospace;
}
.dice-roll.dice-result {
  background: rgba(61, 107, 79, 0.15);
  border-color: var(--success);
  color: #7cb899;
}
.dice-roll.dice-push {
  background: rgba(139, 115, 85, 0.15);
  border-color: var(--warning);
  color: #c9a55a;
}

/* Character References */
.char-ref {
  background: var(--steel-dim);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  color: var(--steel-light);
  font-size: 0.9em;
  border-bottom: 1px dotted var(--steel-dark);
}

/* Item Loot Styling */
.item-loot {
  display: block;
  background: rgba(61, 107, 79, 0.1);
  border-left: 3px solid var(--success);
  padding: 0.25rem 0.5rem;
  margin: 0.25rem 0;
  color: #7cb899;
  font-style: italic;
}
.item-context {
  color: var(--warning);
  font-weight: 500;
}

/* Scene Headers (GM narration) */
.scene-header {
  color: var(--steel-light);
  font-weight: 600;
  border-bottom: 1px solid var(--steel-dark);
  padding-bottom: 0.125rem;
}

/* GM messages enhanced styling */
.message.incoming .text p {
  margin: 0.25rem 0;
}
.message.incoming .text p:first-child {
  margin-top: 0;
}
.message.incoming .text p:last-child {
  margin-bottom: 0;
}

/* Character Sheet Styling */
.markdown-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #c9a55a;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
}

.markdown-content h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b9dc3;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  padding-left: 0.75rem;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid #8b9dc3;
}

.markdown-content h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--steel-light);
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.markdown-content hr.section-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--steel-dark), transparent);
  margin: 1rem 0;
}

.markdown-content p {
  margin: 0.375rem 0;
}

.markdown-content strong {
  color: var(--steel-light);
}

.markdown-content em {
  color: var(--text-secondary);
}

.markdown-content code {
  background: var(--bg-input);
  padding: 0.0625rem 0.25rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* Tables in character sheets */
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.9em;
}

.markdown-content td {
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.markdown-content td:first-child {
  font-weight: 600;
  color: var(--steel-light);
}

.chat-form {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

#chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#chat-input:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px var(--gold-dim);
}

.btn-send {
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, var(--steel) 0%, var(--steel-dark) 100%);
  color: var(--bg-dark);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-send:hover { box-shadow: 0 0 10px rgba(113, 113, 122, 0.3); }

/* Sidebar */
.sidebar {
  width: 480px;
  min-width: 480px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.sidebar-tabs {
  display: flex;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.sidebar-tabs::-webkit-scrollbar { display: none; }
/* Scroll fade indicators to show more tabs exist */
.sidebar-tabs::before,
.sidebar-tabs::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-tabs::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-primary) 60%, transparent);
}
.sidebar-tabs::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-primary) 60%, transparent);
}
.sidebar-tabs.can-scroll::before,
.sidebar-tabs.can-scroll::after {
  opacity: 1;
}

.tab-btn[data-tab="combat"] {
  display: none;
}

.tab-btn[data-tab="combat"].visible {
  display: block;
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* Combat current turn marker - styled line */
#combat-content li.combat-current-turn {
  background: rgba(217, 119, 6, 0.15);
  border-radius: 4px;
}

/* Combat current turn - orange accent for name */
#combat-content li.combat-current-turn strong:first-child {
  color: #d97706 !important;
}

.tab-btn {
  flex: 1;
  padding: 0.875rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  min-width: 0;
}

.tab-btn:hover { color: var(--text-secondary); background: var(--bg-hover); }
.tab-btn.active {
  background: var(--bg-secondary);
  color: var(--steel-light);
  border-bottom-color: var(--steel);
}

.panel {
  flex: 1 1 0;
  padding: 0.75rem;
  overflow-y: auto;
  display: none;
  min-height: 0;
}

.panel.active { display: block; }

.panel h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--steel-light);
  letter-spacing: 0.03em;
}

/* Markdown Content Styling */
.markdown-content {
  font-size: 0.95rem;
  line-height: 1.5;
}

.markdown-content h1,
.markdown-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #c9a55a;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
}

.markdown-content h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b9dc3;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  padding-left: 0.75rem;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid #8b9dc3;
}

.markdown-content h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--steel-light);
  margin: 0.75rem 0 0.375rem;
  padding-bottom: 0.25rem;
  padding-left: 1rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.markdown-content p { margin-bottom: 0.5rem; }

.markdown-content ul, .markdown-content ol {
  margin: 0.25rem 0;
  padding-left: 1.25rem;
}

.markdown-content li {
  margin-bottom: 0.125rem;
  color: var(--text-secondary);
}

.markdown-content strong { color: #c9a55a; font-weight: 600; }
.markdown-content em { color: #8b9dc3; }

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.markdown-content th,
.markdown-content td {
  padding: 0.25rem 0.5rem;
  text-align: left;
  border: 1px solid var(--border);
}

.markdown-content th {
  background: var(--bg-card);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-content td { color: var(--text-secondary); }
.markdown-content td:first-child { color: var(--steel-light); font-weight: 500; }

.markdown-content code {
  background: var(--bg-card);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

.markdown-content blockquote {
  border-left: 3px solid var(--steel);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Dice Panel */
.dice-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dice-btn {
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.dice-btn:hover {
  background: var(--bg-hover);
  border-color: var(--steel);
}

.dice-form { margin-bottom: 1rem; }
.dice-form .form-group { margin-bottom: 0.75rem; }
.dice-form input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem;
}

.dice-log { margin-top: 1rem; }
.dice-log h4 { font-family: 'Cinzel', serif; font-size: 0.875rem; margin-bottom: 0.5rem; }

.dice-log-entries {
  max-height: 200px;
  overflow-y: auto;
}

.dice-entry {
  padding: 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.dice-entry .roller { color: var(--steel-light); font-weight: 500; }
.dice-entry .roll-result { font-family: 'Fira Code', monospace; color: var(--success); }
.dice-entry .roll-reason { color: var(--text-muted); font-size: 0.8rem; }

/* Player Selector */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  flex-shrink: 0;
  overflow: visible;
}

.panel-header h3 {
  margin-bottom: 0;
}

.player-selector {
  padding: 0.3rem 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 0.8rem;
  cursor: pointer;
  max-width: 160px;
}

.player-selector:focus {
  outline: none;
  border-color: var(--steel);
}

.player-selector option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.player-selector option.you {
  color: var(--steel-light);
  font-weight: 600;
}
.notes-content,
.inventory-list {
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 150px;
}

/* Compact styling for all markdown content in sidebar */
.notes-content,
#character-content.markdown-content,
#inventory-list.markdown-content {
  font-size: 1.05rem;
  line-height: 1.5;
}

.notes-content strong,
#character-content.markdown-content strong { color: #c9a55a; }

.notes-content em,
#character-content.markdown-content em { color: #8b9dc3; }

/* Notes specific header styles - same as character sheet */
.notes-content h1,
.notes-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #c9a55a !important;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border) !important;
  letter-spacing: 0.03em;
}

#character-content.markdown-content h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #c9a55a !important;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border) !important;
  letter-spacing: 0.03em;
}

.notes-content h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: #8b9dc3;
  margin: 1rem 0 0.5rem;
  padding-bottom: 0.25rem;
  padding-left: 0.75rem;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid #8b9dc3;
}

.notes-content h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--steel-light);
  margin: 0.75rem 0 0.375rem;
  padding-bottom: 0.25rem;
  padding-left: 0;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Horizontal rules in notes */
.notes-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--steel-dark), transparent);
  margin: 1rem 0;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.inventory-item {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}

.inventory-item:last-child {
  border-bottom: none;
}

.inventory-item .item-name { color: var(--text-primary); }
.inventory-item .item-qty { color: var(--text-muted); font-size: 0.8rem; }

.inventory-credits {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  font-style: italic;
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  padding: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-nav::-webkit-scrollbar { display: none; }

.mobile-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  min-width: 4rem;
}

.mobile-tab .icon { font-size: 1.25rem; margin-bottom: 0.25rem; }
.mobile-tab.active { color: var(--steel-light); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { width: 380px; min-width: 380px; }
}

@media (max-width: 768px) {
  .game-layout { flex-direction: column; }

  #game-screen {
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
  }

  .chat-area {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex: 1;
    min-height: 0; /* Allow flex to shrink */
  }

  .chat-messages {
    flex: 1;
    min-height: 0; /* Allow flex to shrink */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.visible { display: flex; }
  .chat-area.hidden-mobile { display: none; }

  .mobile-nav { display: flex; }
  .sidebar-tabs {
    display: flex;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg-primary);
    transform: translateZ(0);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar-tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex: 0 0 auto;
    padding: 0.875rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    min-width: 0;
    position: relative;
    z-index: 61;
  }
  .message { max-width: 90%; }

  .chat-header {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }
  .chat-header h2 {
    font-size: 0.95rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
  }
  .header-right {
    gap: 0.4rem;
    flex-shrink: 0;
  }
  .header-right .player-list { display: none; }
  .btn-logout {
    padding: 0.4rem 0.6rem;
    font-size: 0.7rem;
  }
  .btn-search { padding: 0.4rem 0.5rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Auth Tabs */
.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-tab {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab:hover {
  background: var(--bg-hover);
}

.auth-tab.active {
  background: var(--steel-dim);
  border-color: var(--steel);
  color: var(--text-primary);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

/* Admin Panel */
.admin-panel {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.admin-panel h3 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.pending-users-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pending-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pending-user-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pending-user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.pending-user-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pending-user-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-approve {
  padding: 0.4rem 0.75rem;
  background: #3d6b4f;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-approve:hover {
  background: #4a7c5e;
}

.btn-reject {
  padding: 0.4rem 0.75rem;
  background: #6b3d3d;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reject:hover {
  background: #7c4a4a;
}
/* Settings Screen */
.settings-container {
  background: rgba(20, 18, 15, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: 500px;
  margin: 0 auto;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 165, 90, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.settings-header h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.btn-back {
  padding: 0.6rem 1.2rem;
  background: var(--bg-card);
  color: #ffffff;
  border: 1px solid var(--steel-light);
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  background: var(--bg-hover);
  border-color: #ffffff;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.settings-section h3 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.settings-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.success-message {
  color: #4a7c5e;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Chat Search */
.btn-search {
  padding: 0.375rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-search:hover {
  background: var(--bg-hover);
  border-color: var(--steel);
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.search-bar input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
}

.search-bar select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
}

.search-bar .btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-cancel {
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.btn-cancel:hover {
  color: var(--text-primary);
}

/* End Combat Button */
.btn-end-combat {
  padding: 0.35rem 0.75rem;
  background: #8b0000;
  border: 1px solid #a00;
  border-radius: 4px;
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-end-combat:hover {
  background: #a00;
  border-color: #c00;
}

.btn-end-combat:active {
  background: #700;
}

/* Search Results */
.search-results-header {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.search-results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--steel-light);
  font-size: 0.9rem;
}

.btn-close-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.btn-close-search:hover {
  color: var(--text-primary);
}

.message.search-result {
  background: var(--bg-card);
  border-left: 3px solid var(--warning);
}

.message.search-result .sender {
  color: var(--warning);
}

.message.search-result mark {
  background: var(--warning);
  color: var(--bg-dark);
  padding: 0 0.125rem;
  border-radius: 2px;
}

.search-result-context {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

/* Music Controls */
.success-message.hidden {
  display: none;
}

.lobby-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn-settings {
  padding: 0.6rem 1rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-settings:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--steel);
}

/* ============================================
   Combat Panel
   ============================================ */

#combat-panel {
  display: none;
  flex-direction: column;
  height: 100%;
}

#combat-panel.active {
  display: flex;
}

/* Mobile combat tab */
@media (max-width: 768px) {
  .mobile-tab[data-tab="combat"] {
    display: none;
  }
  .mobile-tab[data-tab="combat"].visible {
    display: flex;
  }
}

/* Combat Banner Animation */
.combat-banner {
  background: linear-gradient(135deg, var(--error) 0%, #8b0000 100%);
  color: white;
  padding: 0.75rem 1rem;
  text-align: center;
  animation: combatPulse 0.5s ease-out;
  border-bottom: 2px solid var(--warning);
}

.combat-banner.hidden {
  display: none;
}

.combat-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.combat-banner .combat-icon {
  font-size: 1.5rem;
  animation: swordSlash 0.6s ease-out;
}

.combat-banner .combat-text {
  font-size: 1.1rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.combat-banner .combat-location {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.9;
  font-style: italic;
}

@keyframes combatPulse {
  0% {
    opacity: 0;
    transform: scaleY(0);
  }
  50% {
    transform: scaleY(1.2);
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes swordSlash {
  0% {
    transform: rotate(-45deg) scale(0);
    opacity: 0;
  }
  50% {
    transform: rotate(15deg) scale(1.3);
  }
  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

/* GM Reminder FAB - DELETED */

.combat-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.combat-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--error);
}

.combat-location {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.combat-round {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-left: auto;
}

#combat-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.combatant-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.combatant {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.combatant.active-turn {
  border-color: var(--warning);
  box-shadow: 0 0 8px rgba(139, 115, 85, 0.3);
}

.combatant.enemy {
  border-left: 3px solid var(--error);
}

.combatant.player {
  border-left: 3px solid var(--success);
}

.combatant.player .combatant-name {
  color: var(--success);
}

.combatant.enemy .combatant-name {
  color: var(--error);
}

.combatant-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.combatant-icon {
  font-size: 1rem;
}

.combatant-name {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
}

.turn-indicator {
  color: var(--warning);
  margin-left: auto;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.combatant-hp {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.hp-bar-container {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.hp-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.hp-bar.hp-high { background: var(--success); }
.hp-bar.hp-medium { background: var(--warning); }
.hp-bar.hp-low { background: var(--error); }

.hp-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: right;
}

.combatant-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.combatant-stats .stat {
  color: var(--steel-light);
}

.combatant-stats .attack {
  color: var(--text-muted);
  font-style: italic;
}

.btn-danger {
  width: 100%;
  padding: 0.6rem;
  background: var(--error);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #8b4d4d;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--accent-hover);
}


/* Genre Wizard Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
}

.wizard-content {
  background: var(--bg-color);
  border: 2px solid var(--accent);
  max-width: 500px;
  width: 90%;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.wizard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-close {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
  border-color: var(--accent-hover);
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
}

.form-group.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
}

.progress-container {
  width: 100%;
  height: 12px;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
  margin: 1.5rem 0;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.status-text {
  text-align: center;
  font-style: italic;
  color: var(--text-secondary);
}

/* Markdown tables in chat */
.markdown-table {
  width: auto;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.9em;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.markdown-table th {
  background: var(--steel-dim);
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--border);
}
.markdown-table td {
  padding: 5px 12px;
  border: 1px solid var(--border);
}
.markdown-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}

/* ============================================
   File Editor
   ============================================ */

.file-editor-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0.5rem;
}

.file-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.file-breadcrumb {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tree {
  flex: 0 0 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  font-size: 0.8rem;
}

.file-tree.file-tree-full {
  flex: 1;
  min-height: 300px;
  font-size: 0.9rem;
}

/* Editor modal */
.file-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-editor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.file-editor-modal-card {
  position: relative;
  width: min(92vw, 1100px);
  height: min(88vh, 900px);
  background: var(--bg-panel, #1d1f24);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.file-editor-modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.file-editor-modal-header .file-breadcrumb {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-editor-modal .file-editor-textarea {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  resize: none;
  width: 100%;
  min-height: 0;
}
.file-editor-modal .file-editor-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}
.file-editor-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* File tree modal (game files browser) */
.file-tree-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-tree-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.file-tree-modal-card {
  position: relative;
  width: min(90vw, 700px);
  height: min(80vh, 700px);
  background: var(--bg-panel, #1d1f24);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.file-tree-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.file-tree-modal-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin: 0;
}
.file-tree-modal-card .file-editor-panel {
  flex: 1;
  display: flex;
  min-height: 0;
}

.file-tree-item {
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
}
.file-tree-item:hover { background: var(--bg-hover); }
.file-tree-item.selected { background: var(--steel-dim); color: var(--accent-hover); }
.file-tree-item.directory { font-weight: 600; }
.file-tree-item .toggle { width: 1rem; text-align: center; }
.file-tree-children { padding-left: 0.75rem; }

.file-editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.file-editor-textarea {
  flex: 1;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: none;
  width: 100%;
}
.file-editor-textarea:focus { outline: none; border-color: var(--border-focus); }

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.admin-tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom-color: var(--bg-card);
}
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
.pdf-file-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.pdf-file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin-bottom: 0.25rem;
  font-size: 0.9em;
}
.pdf-file-list .pdf-size {
  opacity: 0.6;
  font-size: 0.85em;
  margin-left: 0.4em;
}
.btn-remove-pdf {
  background: transparent;
  border: none;
  color: #c66;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 0.5em;
}
.btn-remove-pdf:hover {
  color: #f88;
}

