/*
 * Organism: Narrative Panel
 * =========================
 * The main story/narrative area with input field at the bottom.
 * Enhanced with D&D theming and immersive visual effects.
 * Uses design tokens from: terminal/_tokens.css
 */

/* ========================================
 * Narrative Panel Content Container
 * ======================================== */

.narrative-panel-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%; /* Prevent overflow beyond parent */
  overflow: hidden;
  background: var(--color-bg-primary);
}

/* ========================================
 * Narrative Filter Bar
 * ======================================== */

.narrative-filters {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.nf-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nf-btn:hover {
  background: rgba(255, 215, 0, 0.1);
  color: var(--color-text-primary);
  border-color: rgba(255, 215, 0, 0.2);
}

.nf-btn.nf-active {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.25) 0%,
    rgba(184, 134, 11, 0.25) 100%
  );
  color: var(--color-gold);
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.nf-btn svg {
  width: 12px;
  height: 12px;
}

/* Dynamic filter buttons (Discoveries, Personal) */
.nf-btn.nf-dynamic {
  gap: 3px;
}

.nf-btn.nf-dynamic .nf-icon {
  font-size: 10px;
  line-height: 1;
}

.nf-btn.nf-dynamic .nf-label {
  font-size: 10px;
}

/* Count badge for dynamic filters */
.nf-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 600;
  background: rgba(255, 215, 0, 0.2);
  color: var(--color-gold);
  border-radius: 8px;
  margin-left: 2px;
}

.nf-btn.nf-active .nf-count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

/* Empty count - hide completely */
.nf-count:empty {
  display: none;
}

/* Discoveries filter - blue theme (perception) */
.nf-btn[data-filter="discoveries"].nf-active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.25) 0%,
    rgba(37, 99, 235, 0.25) 100%
  );
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.nf-btn[data-filter="discoveries"].nf-active .nf-count {
  background: rgba(59, 130, 246, 0.3);
}

/* Personal filter - purple theme (character-specific) */
.nf-btn[data-filter="personal"].nf-active {
  background: linear-gradient(
    135deg,
    rgba(147, 51, 234, 0.25) 0%,
    rgba(126, 34, 206, 0.25) 100%
  );
  color: #c084fc;
  border-color: rgba(147, 51, 234, 0.4);
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.2);
}

.nf-btn[data-filter="personal"].nf-active .nf-count {
  background: rgba(147, 51, 234, 0.3);
}

/* ========================================
 * Narrative Output (scrollable story area)
 * ======================================== */

.narrative-output {
  flex: 1;
  min-height: 0; /* Critical for flex children to shrink properly */
  overflow-y: auto;
  padding: var(--space-4);
  background: var(--color-bg-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-primary);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.3) rgba(0, 0, 0, 0.2);
}

.narrative-output::-webkit-scrollbar {
  width: 8px;
}

.narrative-output::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.narrative-output::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 215, 0, 0.4) 0%,
    rgba(184, 134, 11, 0.4) 100%
  );
  border-radius: 4px;
}

.narrative-output::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 215, 0, 0.6) 0%,
    rgba(184, 134, 11, 0.6) 100%
  );
}

/* ========================================
 * Narrative Entry Base Styles
 * ======================================== */

.narrative-entry {
  margin-bottom: var(--narrative-entry-spacing);
  padding: var(--space-2) var(--space-3);
  border-radius: 0;
  animation: entrySlideIn 0.3s ease-out;
  position: relative;
  transition: background 0.15s ease;
}

/* Prevent animation replay on restored entries after panel layout changes */
.narrative-entry--restored {
  animation: none !important;
}

.narrative-entry:hover {
  background: rgba(255, 255, 255, 0.02);
}

.narrative-entry p {
  margin: 0 0 var(--space-2);
}

.narrative-entry p:last-child {
  margin-bottom: 0;
}

.narrative-entry code {
  background: var(--color-bg-tertiary);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-accent-primary);
}

/* ========================================
 * Entry Type: DM (Dungeon Master)
 * Flat minimal style with subtle color shift
 * ======================================== */

.narrative-entry.dm {
  background: rgba(139, 69, 19, 0.08);
  color: #e8dcc4;
}

.narrative-entry.dm:hover {
  background: rgba(139, 69, 19, 0.12);
}

/* ========================================
 * Entry Type: Player
 * Clean, modern terminal style
 * ======================================== */

.narrative-entry.player {
  background: transparent;
  color: var(--color-accent-secondary);
  font-family: var(--font-mono);
}

.narrative-entry.player::before {
  content: '>';
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  color: var(--color-accent-secondary);
  font-weight: bold;
  opacity: 0.5;
}

.narrative-entry.player {
  padding-left: calc(var(--space-3) + 1.2em);
}

/* ========================================
 * Party Action Indicator (Multiplayer)
 * Shows who performed an action in party play
 * ======================================== */

.party-action-indicator {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 8px;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gold);
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.15) 0%,
    rgba(184, 134, 11, 0.15) 100%
  );
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 3px;
}

.party-action-indicator::after {
  content: "'s action";
  font-weight: 400;
  opacity: 0.7;
  margin-left: 2px;
}

/* ========================================
 * Entry Type: System
 * Subtle, informational
 * ======================================== */

.narrative-entry.system {
  background: transparent;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-3);
  opacity: 0.7;
}

.narrative-entry.system:hover {
  opacity: 1;
}

/* ========================================
 * Entry Type: Combat
 * Intense with pulse glow effect (kept)
 * ======================================== */

.narrative-entry.combat {
  background: rgba(220, 20, 60, 0.1);
  color: #ff6b6b;
  animation: combatPulse 2s ease-in-out infinite;
}

.narrative-entry.combat:hover {
  background: rgba(220, 20, 60, 0.15);
}

/* ========================================
 * Entry Type: Success (rolls, achievements)
 * ======================================== */

.narrative-entry.success {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
}

/* ========================================
 * Entry Type: Magic/Spell
 * Mystical with shimmer effect (kept)
 * ======================================== */

.narrative-entry.magic {
  background: rgba(138, 43, 226, 0.1);
  color: #c084fc;
  animation: magicShimmer 3s ease-in-out infinite;
}

/* ========================================
 * Entry Type: Lore/Description
 * Atmospheric, immersive
 * ======================================== */

.narrative-entry.lore {
  background: rgba(70, 130, 180, 0.08);
  font-style: italic;
  color: #b8cde0;
}

/* ========================================
 * Entry Type: Player Chat
 * Player-to-player messages (bypasses AI DM)
 * ======================================== */

.narrative-entry.player_chat,
.narrative-entry.player-chat {
  background: linear-gradient(
    135deg,
    rgba(106, 159, 181, 0.12) 0%,
    rgba(70, 130, 180, 0.08) 100%
  );
  border-left: 3px solid #6a9fb5;
  padding-left: var(--space-4);
  margin-left: var(--space-4);
  font-style: italic;
  color: #c8dce8;
}

.narrative-entry.player_chat:hover,
.narrative-entry.player-chat:hover {
  box-shadow:
    0 2px 8px rgba(106, 159, 181, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.player-chat-sender {
  color: #6a9fb5;
  font-weight: bold;
  font-style: normal;
  margin-right: var(--space-2);
}

.lobby-chat-sender {
  color: #8ec07c;
  font-weight: 600;
  font-style: normal;
  margin-right: var(--space-2);
}

/* ========================================
 * Wiki-Style Links
 * Clickable entity references in chat
 * ======================================== */

.wiki-link {
  color: #90a959;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0 2px;
  border-radius: 2px;
}

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

/* Spell entity links */
.wiki-link[data-entity-type="spell"] {
  color: #aa759f;
}

.wiki-link[data-entity-type="spell"]:hover {
  color: #c99bc1;
  background: rgba(170, 117, 159, 0.15);
}

/* Skill entity links */
.wiki-link[data-entity-type="skill"] {
  color: #6a9fb5;
}

.wiki-link[data-entity-type="skill"]:hover {
  color: #8cc4d9;
  background: rgba(106, 159, 181, 0.15);
}

/* Ability entity links */
.wiki-link[data-entity-type="ability"] {
  color: #f4bf75;
}

.wiki-link[data-entity-type="ability"]:hover {
  color: #ffd699;
  background: rgba(244, 191, 117, 0.15);
}

/* Game term entity links */
.wiki-link[data-entity-type="term"] {
  color: #ac9d9a;
}

.wiki-link[data-entity-type="term"]:hover {
  color: #cfc4c1;
  background: rgba(172, 157, 154, 0.15);
}

/* Unknown entity links (default) */
.wiki-link[data-entity-type="unknown"] {
  color: #90a959;
}

/* NPC entity links - warm amber for characters */
.wiki-link[data-entity-type="npc"] {
  color: #f4bf75;
  text-decoration-style: solid;
}

.wiki-link[data-entity-type="npc"]:hover {
  color: #ffd699;
  background: rgba(244, 191, 117, 0.15);
}

/* Location entity links - teal for places */
.wiki-link[data-entity-type="location"] {
  color: #5fb3b3;
  text-decoration-style: solid;
}

.wiki-link[data-entity-type="location"]:hover {
  color: #7fcfcf;
  background: rgba(95, 179, 179, 0.15);
}

/* Condition entity links - red-orange for status effects */
.wiki-link[data-entity-type="condition"] {
  color: #d27b53;
}

.wiki-link[data-entity-type="condition"]:hover {
  color: #e89b73;
  background: rgba(210, 123, 83, 0.15);
}

/* Skill opportunity links - golden D&D dice themed */
.wiki-link[data-entity-type="skill_opportunity"],
.skill-opportunity {
  color: #fcd34d;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 215, 0, 0.5);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.05), rgba(255, 215, 0, 0.02));
}

.wiki-link[data-entity-type="skill_opportunity"]:hover,
.skill-opportunity:hover {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  text-decoration-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

/* Narrative hooks - purple/mystical for story threads */
.narrative-hook {
  color: #c792ea;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0 2px;
  border-radius: 2px;
}

.narrative-hook:hover {
  color: #e0b0ff;
  background: rgba(199, 146, 234, 0.15);
  text-decoration-style: solid;
}

/* Enrichment link base (shared styling) */
.enrichment-link {
  cursor: pointer;
  transition: all 0.15s ease;
}

.enrichment-link:active {
  transform: scale(0.98);
}

/* Enrichment applied animation */
.enrichment-applied {
  animation: enrichmentPulse 0.5s ease-out;
}

@keyframes enrichmentPulse {
  0% { background-color: transparent; }
  50% { background-color: rgba(144, 169, 89, 0.1); }
  100% { background-color: transparent; }
}

/* Inquiry sent feedback */
.inquiry-sent {
  animation: inquirySent 0.5s ease-out;
}

@keyframes inquirySent {
  0% { background-color: rgba(199, 146, 234, 0.3); }
  100% { background-color: transparent; }
}

/* Skill check triggered feedback */
.skill-check-triggered {
  animation: skillCheckTriggered 0.5s ease-out;
}

@keyframes skillCheckTriggered {
  0% { background-color: rgba(255, 215, 0, 0.4); box-shadow: 0 0 12px rgba(255, 215, 0, 0.6); }
  100% { background-color: transparent; box-shadow: none; }
}

/* ========================================
 * Entry Type: Reflex Response
 * Instant flavor text while AI generates
 * ======================================== */

.narrative-entry.reflex-response {
  background: transparent;
  border-left: 2px solid rgba(255, 215, 0, 0.3);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  opacity: 0.85;
}

.narrative-entry.reflex-response .reflex-text {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: var(--font-size-sm);
}

.narrative-entry.reflex-response:hover {
  transform: none;
}

/* Fade-in animation for reflex responses */
.narrative-entry.animate-fade-in {
  animation: reflexFadeIn 0.2s ease-out;
}

@keyframes reflexFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 0.85;
    transform: translateY(0);
  }
}

/* ========================================
 * Entry Type: Character Thought
 * In-character musings during LLM wait
 * ======================================== */

.narrative-entry.character-thought {
  background: linear-gradient(
    135deg,
    rgba(147, 51, 234, 0.08) 0%,
    rgba(126, 34, 206, 0.05) 100%
  );
  border-left: 2px solid rgba(147, 51, 234, 0.4);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  opacity: 0.9;
}

.narrative-entry.character-thought .thought-text {
  color: #c4b5fd;
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.narrative-entry.character-thought:hover {
  transform: none;
  opacity: 1;
}

/* Memory-based thoughts - slightly warmer tone */
.narrative-entry.character-thought.thought-memory {
  border-left-color: rgba(251, 191, 36, 0.4);
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.06) 0%,
    rgba(245, 158, 11, 0.03) 100%
  );
}

.narrative-entry.character-thought.thought-memory .thought-text {
  color: #fde68a;
}

/* Situation-based thoughts - neutral tone */
.narrative-entry.character-thought.thought-situation {
  border-left-color: rgba(148, 163, 184, 0.4);
  background: linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.06) 0%,
    rgba(100, 116, 139, 0.03) 100%
  );
}

.narrative-entry.character-thought.thought-situation .thought-text {
  color: #cbd5e1;
}

/* Suggestion thoughts - helpful green hint */
.narrative-entry.character-thought.thought-suggestion {
  border-left-color: rgba(74, 222, 128, 0.4);
  background: linear-gradient(
    135deg,
    rgba(74, 222, 128, 0.06) 0%,
    rgba(34, 197, 94, 0.03) 100%
  );
}

.narrative-entry.character-thought.thought-suggestion .thought-text {
  color: #86efac;
}

/* Creation thoughts - mystical cyan for character birth */
.narrative-entry.character-thought.thought-creation {
  border-left-color: rgba(34, 211, 238, 0.4);
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.06) 0%,
    rgba(6, 182, 212, 0.03) 100%
  );
}

.narrative-entry.character-thought.thought-creation .thought-text {
  color: #67e8f9;
}

/* Thought fade-in animation */
.narrative-entry.animate-thought-in {
  animation: thoughtFadeIn 0.3s ease-out;
}

@keyframes thoughtFadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 0.9;
    transform: translateY(0);
  }
}

/* Reduce animation for accessibility */
@media (prefers-reduced-motion: reduce) {
  .narrative-entry.animate-thought-in {
    animation: none;
  }
}

/* ========================================
 * Input Area (fixed at bottom)
 * ======================================== */

.input-area {
  flex-shrink: 0;
  flex-grow: 0; /* Prevent input area from growing */
  max-height: 200px; /* Prevent input from growing unbounded */
  padding: var(--space-3);
  /* Safe area support for notches, home indicators, and iPad split view */
  padding-left: max(var(--space-3), env(safe-area-inset-left));
  padding-right: max(var(--space-3), env(safe-area-inset-right));
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.6) 100%
  );
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Input field styling */
.input-area input[type="text"],
.input-area textarea {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 215, 0, 0.3);
  color: var(--color-text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-area input[type="text"]:focus,
.input-area textarea:focus {
  outline: none;
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* ========================================
 * Selection Trays (spell, equipment, etc.)
 * ======================================== */

.selection-tray,
.equipment-tray,
.spell-tray {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  animation: traySlideUp 0.3s ease-out;
}

.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  flex: 1;
}

.send-selections-btn {
  flex-shrink: 0;
  align-self: flex-end;
}

/* Tray Variants */
.spell-tray {
  border-color: #8a2be2;
  background: linear-gradient(
    180deg,
    rgba(138, 43, 226, 0.1) 0%,
    rgba(75, 0, 130, 0.05) 100%
  );
}

.equipment-tray {
  border-color: #daa520;
  background: linear-gradient(
    180deg,
    rgba(218, 165, 32, 0.1) 0%,
    rgba(184, 134, 11, 0.05) 100%
  );
}

/* ========================================
 * Loading Spinner
 * Used by showLoading() in terminal_controller.js
 * ======================================== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: loadingSpin 0.8s linear infinite;
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  display: inline-block;
  margin-left: 8px;
  color: var(--gold-text, #ffd700);
  font-size: 13px;
  font-style: italic;
  animation: loadingFade 1.5s ease-in-out infinite;
}

@keyframes loadingFade {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

#loading-indicator {
  display: flex;
  align-items: center;
  padding: 8px 0;
}

/* Container class for loading indicator when it has text (prevents container from spinning) */
.loading-container {
  display: flex;
  align-items: center;
  padding: 8px 0;
}

/* ========================================
 * Typing Indicator
 * ======================================== */

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #ffd700;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ========================================
 * Animations
 * ======================================== */

@keyframes entrySlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

@keyframes combatPulse {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(220, 20, 60, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  50% {
    box-shadow:
      0 2px 12px rgba(220, 20, 60, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

@keyframes magicShimmer {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(138, 43, 226, 0.2),
      inset 0 0 20px rgba(138, 43, 226, 0.05);
  }
  50% {
    box-shadow:
      0 2px 12px rgba(138, 43, 226, 0.35),
      inset 0 0 30px rgba(138, 43, 226, 0.1);
  }
}

@keyframes traySlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
 * Dice Roll Display
 * ======================================== */

.dice-result {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: bold;
}

.dice-result.critical {
  background: rgba(52, 211, 153, 0.2);
  border-color: #34d399;
  color: #34d399;
  animation: criticalGlow 0.5s ease-out;
}

.dice-result.fumble {
  background: rgba(220, 20, 60, 0.2);
  border-color: #dc143c;
  color: #dc143c;
}

@keyframes criticalGlow {
  0% {
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.8);
  }
  100% {
    box-shadow: 0 0 5px rgba(52, 211, 153, 0.3);
  }
}

/* ========================================
 * Markdown Tables
 * ======================================== */

.narrative-entry table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-size: var(--font-size-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.narrative-entry thead {
  background: linear-gradient(
    180deg,
    rgba(255, 215, 0, 0.15) 0%,
    rgba(184, 134, 11, 0.1) 100%
  );
}

.narrative-entry th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: bold;
  color: #ffd700;
  border-bottom: 2px solid rgba(255, 215, 0, 0.4);
  white-space: nowrap;
}

.narrative-entry td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
  color: var(--color-text-primary);
}

.narrative-entry tbody tr:last-child td {
  border-bottom: none;
}

.narrative-entry tbody tr:nth-child(even) {
  background: rgba(255, 215, 0, 0.03);
}

.narrative-entry tbody tr:hover {
  background: rgba(255, 215, 0, 0.08);
}

/* Compact table variant for DM entries */
.narrative-entry.dm table {
  background: rgba(139, 69, 19, 0.1);
  border-color: rgba(255, 215, 0, 0.25);
}

.narrative-entry.dm thead {
  background: linear-gradient(
    180deg,
    rgba(139, 69, 19, 0.2) 0%,
    rgba(160, 82, 45, 0.15) 100%
  );
}

/* Combat table styling */
.narrative-entry.combat table {
  border-color: rgba(220, 20, 60, 0.4);
}

.narrative-entry.combat thead {
  background: linear-gradient(
    180deg,
    rgba(220, 20, 60, 0.2) 0%,
    rgba(139, 0, 0, 0.15) 100%
  );
}

.narrative-entry.combat th {
  color: #ff6b6b;
  border-bottom-color: rgba(220, 20, 60, 0.4);
}

.narrative-entry.combat td {
  border-bottom-color: rgba(220, 20, 60, 0.15);
}

/* ========================================
 * Reduced Motion
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
  .narrative-entry,
  .selection-tray,
  .equipment-tray,
  .spell-tray {
    animation: none;
  }

  .narrative-entry.combat,
  .narrative-entry.magic {
    animation: none;
  }

  .typing-indicator span {
    animation: none;
    opacity: 1;
  }
}

/* Reconnecting Indicator */
.reconnecting-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: rgba(30, 30, 30, 0.95);
  border: 2px solid var(--color-accent-primary);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  color: var(--color-accent-primary);
  animation: pulse-border 2s ease-in-out infinite;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.reconnect-icon {
  font-size: var(--font-size-xl);
  animation: spin 2s linear infinite;
}

.reconnect-text {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--color-accent-primary); opacity: 1; }
  50% { border-color: var(--color-accent-secondary); opacity: 0.7; }
}

/* Reduce animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reconnect-icon {
    animation: none;
  }
  .reconnecting-indicator {
    animation: none;
  }
}

/* Connection Lost Prompt - requires user action */
.connection-lost-prompt {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.1));
  border: 2px solid #ef4444;
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
}

.connection-lost-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.connection-lost-icon {
  font-size: var(--font-size-2xl);
  color: #ef4444;
  animation: pulse-warning 2s ease-in-out infinite;
}

.connection-lost-message {
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

.connection-lost-refresh {
  padding: var(--space-2) var(--space-4);
  background: #ef4444;
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.connection-lost-refresh:hover {
  background: #dc2626;
}

.connection-lost-refresh:active {
  background: #b91c1c;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  .connection-lost-icon {
    animation: none;
  }
}

/* ========================================
 * Knowledge-Exclusive Content
 * Multiplayer: Info only this character knows
 * ======================================== */

.narrative-entry.knowledge-exclusive {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(138, 43, 226, 0.12) 0%,
    rgba(75, 0, 130, 0.08) 50%,
    rgba(138, 43, 226, 0.12) 100%
  );
  border-left: 4px solid #9333ea;
  border-right: 1px solid rgba(147, 51, 234, 0.3);
  padding-top: calc(var(--space-3) + 24px);
}

.narrative-entry.knowledge-exclusive::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(147, 51, 234, 0.6) 20%,
    rgba(147, 51, 234, 0.8) 50%,
    rgba(147, 51, 234, 0.6) 80%,
    transparent 100%
  );
}

.knowledge-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: linear-gradient(
    135deg,
    rgba(147, 51, 234, 0.25) 0%,
    rgba(126, 34, 206, 0.2) 100%
  );
  border: 1px solid rgba(147, 51, 234, 0.4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: #c084fc;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.knowledge-badge::before {
  content: '👁️';
  font-size: 10px;
}

.knowledge-source {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Perception Check Success Indicator */
.narrative-entry.perception-success {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1) 0%,
    rgba(37, 99, 235, 0.08) 100%
  );
  border-left: 4px solid #3b82f6;
  padding-top: calc(var(--space-3) + 24px);
}

.perception-badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: #60a5fa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.perception-badge::before {
  content: '🔍';
  font-size: 10px;
}

/* Shared Party Knowledge */
.narrative-entry.shared-knowledge {
  border-left-color: #22c55e;
}

.shared-knowledge-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: #4ade80;
}

.shared-knowledge-badge::before {
  content: '👥';
  font-size: 10px;
}

/* Secondhand Knowledge (told by another player) */
.narrative-entry.secondhand-knowledge {
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.08) 0%,
    rgba(245, 158, 11, 0.05) 100%
  );
  border-left: 3px solid #f59e0b;
  opacity: 0.9;
}

.secondhand-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(251, 191, 36, 0.15);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: #fbbf24;
}

.secondhand-badge::before {
  content: '💬';
  font-size: 10px;
}

/* Hidden Content Indicator (something you missed) */
.narrative-entry .hidden-content-hint {
  display: block;
  padding: var(--space-2);
  margin-top: var(--space-2);
  background: rgba(100, 116, 139, 0.1);
  border: 1px dashed rgba(100, 116, 139, 0.3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-style: italic;
  text-align: center;
}

.hidden-content-hint::before {
  content: '...';
  display: block;
  letter-spacing: 4px;
  margin-bottom: var(--space-1);
}

/* Knowledge Reveal Animation */
@keyframes knowledgeReveal {
  0% {
    opacity: 0;
    transform: translateY(8px);
    border-left-color: transparent;
  }
  50% {
    border-left-color: #9333ea;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    border-left-color: #9333ea;
  }
}

.narrative-entry.knowledge-exclusive.animate-reveal {
  animation: knowledgeReveal 0.6s ease-out;
}

/* Multiplayer Session Indicator */
.multiplayer-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: #4ade80;
  margin-bottom: var(--space-2);
}

.multiplayer-indicator::before {
  content: '🎮';
  font-size: 12px;
}

/* Reduce animations for accessibility */
@media (prefers-reduced-motion: reduce) {
  .narrative-entry.knowledge-exclusive.animate-reveal {
    animation: none;
  }
}

/* ========================================
 * Inline Selection Cards
 * Used for character creation choices in narrative
 * ======================================== */

/* Selection prompt entry - appears below DM message */
.narrative-entry.selection-prompt {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: calc(-1 * var(--space-2));
  margin-bottom: var(--space-4);
  animation: traySlideUp 0.3s ease-out;
}

.narrative-entry.selection-prompt:hover {
  transform: none;
}

/* Masonry options grid */
.inline-selection-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: var(--space-3);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-md);
  margin-top: var(--space-2);
}

/* Core masonry card styles
 * Uses selection-base custom properties for consistent theming
 * See atoms/_selection_base.css for shared selection styles
 */
.masonry-card {
  /* Selection theming via custom properties */
  --selection-accent: var(--accent-success, #4ade80);
  --selection-accent-warning: var(--accent-warning, #f59e0b);

  background: var(--selection-bg, var(--bg-elevated, #1e1e2e));
  border: 1px solid var(--selection-border, var(--border-subtle, #333));
  border-radius: var(--selection-border-radius, 8px);
  padding: 12px;
  cursor: pointer;
  transition: var(--selection-transition, all 0.15s ease);
  position: relative;
}

.masonry-card:hover {
  border-color: var(--selection-border-hover, var(--accent-primary, #4a9eff));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.masonry-card:active {
  transform: translateY(0);
}

/* Selected state - instant visual feedback */
.masonry-card--selected {
  border-color: var(--selection-border-selected, var(--selection-accent));
  background: var(--selection-bg-selected, rgba(74, 222, 128, 0.1));
}

.masonry-card--selected::before {
  content: '\2713';
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--selection-text-selected, var(--selection-accent));
  font-weight: bold;
}

/* Pending state - waiting for server confirmation */
.masonry-card--pending {
  border-color: var(--selection-border-pending, var(--selection-accent-warning));
  background: var(--selection-bg-pending, rgba(245, 158, 11, 0.05));
  opacity: 0.8;
  pointer-events: none;
}

.masonry-card--pending::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--selection-accent-warning);
  border-top-color: transparent;
  border-radius: 50%;
  animation: masonry-spin 0.6s linear infinite;
}

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

/* Hidden state - filtered out by category */
.masonry-card--hidden {
  display: none;
}

/* Dimmed state - when others are selected */
.masonry-card--dimmed {
  opacity: 0.5;
}

.masonry-card--dimmed:hover {
  opacity: 0.8;
}

/* Card content elements */
.masonry-card__name {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary, #e0e0e0);
  margin-bottom: 2px;
}

.masonry-card__desc {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #888);
  line-height: 1.3;
}

/* Button reset for masonry cards */
button.masonry-card {
  font-family: inherit;
  text-align: left;
  width: 100%;
  display: block;
}

/* Info button for Guided mode (explain_option) */
.masonry-card__info-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-surface-elevated, #2a2a2a);
  border: 1px solid var(--color-border, #444);
  color: var(--color-text-muted, #888);
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  z-index: 5;
}

.masonry-card:hover .masonry-card__info-btn,
.masonry-card:focus .masonry-card__info-btn {
  opacity: 1;
}

.masonry-card__info-btn:hover {
  background: var(--color-accent-blue, #61afef);
  color: var(--color-bg, #1a1a1a);
  border-color: var(--color-accent-blue, #61afef);
}

/* Masonry card badges (Beginner Friendly, etc.) */
.masonry-card__badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 4;
}

.masonry-card__badge--beginner {
  background: var(--color-accent-green, #98c379);
  color: var(--color-bg, #1a1a1a);
}

.masonry-card__badge--recommended {
  background: var(--color-accent-purple, #c678dd);
  color: var(--color-bg, #1a1a1a);
}

/* DM Suggested badge for Immersive mode */
.masonry-card__badge--dm-suggested {
  background: var(--color-accent-gold, #e5c07b);
  color: var(--color-bg, #1a1a1a);
  animation: dm-glow 2s ease-in-out infinite;
}

@keyframes dm-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(229, 192, 123, 0.4); }
  50% { box-shadow: 0 0 8px rgba(229, 192, 123, 0.7); }
}

/* Category filter bar
 * Uses selection-base custom properties for consistent chip theming
 */
.category-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-elevated, #1e1e2e);
  border-radius: 6px;
  border: 1px solid var(--border-subtle, #333);
}

.category-filter-bar::before {
  content: 'Filter:';
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary, #888);
  margin-right: 4px;
}

.category-filter-bar .chip {
  /* Override selection properties for filter context */
  --selection-accent: var(--accent-primary, #4a9eff);
  --selection-border-radius: 12px;

  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--selection-border-radius);
  background: var(--selection-bg, var(--bg-base, #121212));
  border: 1px solid var(--selection-border, var(--border-subtle, #444));
  color: var(--selection-text, var(--text-secondary, #aaa));
  cursor: pointer;
  transition: var(--selection-transition, all 0.15s ease);
}

.category-filter-bar .chip:hover {
  border-color: var(--selection-border-hover, var(--selection-accent));
  color: var(--selection-text-hover, var(--text-primary, #e0e0e0));
  background: var(--selection-bg-hover, var(--bg-hover, #1a1a2e));
}

.category-filter-bar .chip--selected {
  background: var(--selection-accent);
  border-color: var(--selection-accent);
  color: var(--bg-base, #121212);
  font-weight: 600;
}

/* Mobile responsive for inline cards */
@media (max-width: 768px) {
  .inline-selection-cards {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    padding: var(--space-2);
  }

  .masonry-card {
    padding: 10px;
  }

  .masonry-card__name {
    font-size: 12px;
  }

  .masonry-card__desc {
    font-size: 10px;
  }
}

/* ========================================
 * Tablet & Mobile Responsive
 * ======================================== */

/* Tablet: reduce input area size */
@media (max-width: 1024px) {
  .input-area {
    max-height: 150px;
    padding: var(--space-2);
    padding-left: max(var(--space-2), env(safe-area-inset-left));
    padding-right: max(var(--space-2), env(safe-area-inset-right));
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
  }

  .narrative-output {
    padding: var(--space-3);
  }
}

/* Mobile: further reduce for smaller screens */
@media (max-width: 768px) {
  .input-area {
    max-height: 80px;  /* Reduced from 120px for more content space */
    min-height: 80px;
    padding: var(--space-2);
    padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
    gap: var(--space-1);
  }

  /* Prevent iOS zoom on input focus */
  .input-area input[type="text"],
  .input-area textarea {
    font-size: 16px;
    padding: 8px 12px;
  }

  .narrative-output {
    padding: var(--space-2);
  }

  .narrative-entry {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
  }

  .narrative-entry.player {
    padding-left: calc(var(--space-3) + 1em);
  }

  .narrative-entry.player::before {
    left: var(--space-2);
    top: var(--space-2);
  }
}

/* ========================================
 * Focus Mode - Compact Input
 * Even smaller input when focus mode is active
 * ======================================== */

.terminal-container--focus-mode .input-area {
  max-height: 60px;
  min-height: 60px;
  padding: var(--space-1) var(--space-2);
  padding-bottom: max(var(--space-1), env(safe-area-inset-bottom));
}

/* ========================================
 * Dynamic Contextual Tabs
 * Location, Summary, NPCs, Quests tabs
 * ======================================== */

/* Separator between filter tabs and dynamic tabs */
.nf-separator {
  width: 1px;
  height: 20px;
  background: rgba(255, 215, 0, 0.2);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Container for dynamic tabs */
.nf-dynamic-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto; /* Push to right side of filter bar */
}

/* Individual dynamic tab button */
.nf-dynamic-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nf-dynamic-tab:hover {
  background: rgba(255, 215, 0, 0.1);
  color: var(--color-text-primary);
  border-color: rgba(255, 215, 0, 0.2);
}

.nf-dynamic-tab.nf-active {
  background: linear-gradient(
    135deg,
    rgba(255, 215, 0, 0.25) 0%,
    rgba(184, 134, 11, 0.25) 100%
  );
  color: var(--color-gold);
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.nf-dynamic-tab .nf-icon {
  font-size: 12px;
  line-height: 1;
}

.nf-dynamic-tab .nf-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hide label on smaller screens */
@media (max-width: 768px) {
  .nf-dynamic-tab .nf-label {
    display: none;
  }
}

/* ========================================
 * Dynamic Tab Content Pane
 * Shows content when a dynamic tab is selected
 * ======================================== */

.narrative-tab-pane {
  flex-shrink: 0;
  max-height: 150px;
  overflow-y: auto;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.4) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  animation: tabPaneSlideDown 0.2s ease-out;
}

@keyframes tabPaneSlideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 150px;
  }
}

.narrative-tab-pane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 215, 0, 0.08);
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.narrative-tab-pane__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.narrative-tab-pane__close {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.narrative-tab-pane__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-primary);
}

.narrative-tab-pane__content {
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-primary);
}

.narrative-tab-pane__content p {
  margin: 0 0 8px;
}

.narrative-tab-pane__content p:last-child {
  margin-bottom: 0;
}

.narrative-tab-pane__content .text-muted {
  color: var(--color-text-muted);
  font-style: italic;
}

/* List styling for NPCs, Quests tabs */
.narrative-tab-pane__content .dynamic-tab-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.narrative-tab-pane__content .dynamic-tab-list li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.narrative-tab-pane__content .dynamic-tab-list li:last-child {
  border-bottom: none;
}

.narrative-tab-pane__content .dynamic-tab-list strong {
  color: var(--color-gold);
}

/* Scrollbar for pane content */
.narrative-tab-pane::-webkit-scrollbar {
  width: 6px;
}

.narrative-tab-pane::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.narrative-tab-pane::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 3px;
}

/* Reduce animation for accessibility */
@media (prefers-reduced-motion: reduce) {
  .narrative-tab-pane {
    animation: none;
  }

  .masonry-card {
    transition: none;
  }

  .masonry-card:hover {
    transform: none;
  }

  .masonry-card--pending::after {
    animation: none;
  }
}

/* ==========================================================================
 * Entry Type: Confirmation (Inline Step Badge)
 * Minimal badge style for step confirmations during character creation
 * Hidden in "Story" tab, visible in "All" tab
 * ========================================================================== */

.narrative-entry.confirmation {
  background: transparent;
  padding: var(--space-1, 4px) var(--space-3, 12px);
  margin-bottom: var(--space-1, 4px);
  animation: confirmationFadeIn 0.2s ease-out;
}

.narrative-entry.confirmation:hover {
  background: transparent;
}

/* Inline confirmation badge */
.confirmation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #888);
}

.confirmation-badge__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--accent-success, #4ade80);
  border-radius: 50%;
  color: var(--color-bg-primary, #1a1a2e);
  font-size: 9px;
  font-weight: 700;
}

.confirmation-badge__text {
  color: var(--color-text-secondary, #aaa);
}

.confirmation-badge__next {
  color: var(--color-text-muted, #888);
  font-style: italic;
  opacity: 0.8;
}

.confirmation-badge__separator {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 2px;
}

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

/* Reduce animation for accessibility */
@media (prefers-reduced-motion: reduce) {
  .narrative-entry.confirmation {
    animation: none;
  }
}
