/* ============================================================
   NARRATIVE STYLES — Arthurian Legends: The Fallen Crown
   ============================================================ */

/* Narrative Scene Background */
.narrative-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.narrative-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(0deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
}

/* Narrative Scene Container */
.narrative-scene {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

/* Character Portraits */
.narrative-portraits {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.character-portrait {
  position: absolute;
  max-height: 100%;
  transition: all var(--transition-normal);
}

.character-portrait img {
  max-height: 50vh;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.character-portrait.left {
  left: 5%;
  bottom: 0;
}

.character-portrait.center {
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
}

.character-portrait.right {
  right: 5%;
  bottom: 0;
}

.character-portrait.speaking {
  filter: brightness(1.1) drop-shadow(0 0 20px rgba(197, 165, 90, 0.3));
  transform: scale(1.02);
}

.character-portrait.dimmed {
  filter: brightness(0.6) drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

/* Dialogue Box */
.narrative-dialogue-box {
  position: relative;
  margin: 0 var(--space-lg) var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: linear-gradient(135deg, rgba(47, 31, 15, 0.95), rgba(74, 55, 40, 0.95));
  border: 2px solid var(--color-gold-dark);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(197, 165, 90, 0.2);
  min-height: 120px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.narrative-dialogue-box::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 30px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, rgba(47, 31, 15, 0.95), rgba(74, 55, 40, 0.95));
  border-left: 2px solid var(--color-gold-dark);
  border-top: 2px solid var(--color-gold-dark);
  transform: rotate(45deg);
}

/* Speaker Name */
.speaker-name {
  font-family: var(--font-display);
  font-size: var(--font-size-xl);
  color: var(--color-gold);
  margin-bottom: var(--space-sm);
  text-shadow: var(--shadow-sm);
  letter-spacing: 1px;
}

/* Dialogue Text */
.dialogue-text {
  font-size: var(--font-size-lg);
  color: var(--color-parchment);
  line-height: 1.6;
  min-height: 60px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Continue Prompt */
.dialogue-continue {
  text-align: center;
  color: var(--color-gold);
  font-size: var(--font-size-sm);
  margin-top: var(--space-md);
  opacity: 0.7;
  animation: pulse 2s ease-in-out infinite;
}

/* Choices */
.narrative-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin: 0 var(--space-lg) var(--space-lg);
  animation: slideUp 0.3s ease;
}

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

.choice-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: rgba(197, 165, 90, 0.08);
  border: 1px solid rgba(197, 165, 90, 0.3);
  border-radius: var(--border-radius-md);
  color: var(--color-parchment);
  font-size: var(--font-size-base);
  font-family: var(--font-body);
  text-align: left;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.choice-btn:hover {
  background: rgba(197, 165, 90, 0.2);
  border-color: var(--color-gold);
  box-shadow: var(--shadow-glow-gold);
  transform: translateX(4px);
}

.choice-btn.chivalry {
  border-left: 3px solid var(--color-gold);
}

.choice-btn.chivalry:hover {
  background: rgba(197, 165, 90, 0.25);
}

.choice-btn.pragmatism {
  border-left: 3px solid var(--color-silver);
}

.choice-btn.pragmatism:hover {
  background: rgba(192, 192, 192, 0.15);
}

.choice-text {
  flex: 1;
}

.choice-alignment {
  font-size: var(--font-size-sm);
  opacity: 0.7;
  margin-left: var(--space-md);
  font-style: italic;
}

.choice-alignment.chivalry {
  color: var(--color-gold);
}

.choice-alignment.pragmatism {
  color: var(--color-silver);
}

/* ============================================================
   INVENTORY UI
   ============================================================ */

.inventory-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0a0a0a, #1a1a2e);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(197, 165, 90, 0.3);
  padding-bottom: var(--space-md);
}

.inventory-header h2 {
  font-size: var(--font-size-2xl);
  color: var(--color-gold);
}

.inventory-tabs {
  display: flex;
  gap: var(--space-sm);
}

.tab-btn {
  padding: var(--space-sm) var(--space-md);
  background: rgba(197, 165, 90, 0.1);
  border: 1px solid rgba(197, 165, 90, 0.2);
  border-radius: var(--border-radius-sm);
  color: var(--color-silver);
  font-size: var(--font-size-sm);
  font-family: var(--font-body);
}

.tab-btn.active {
  background: rgba(197, 165, 90, 0.25);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.inventory-content {
  flex: 1;
  display: flex;
  gap: var(--space-lg);
  overflow: hidden;
}

.inventory-grid {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-sm);
  overflow-y: auto;
  padding: var(--space-sm);
  align-content: start;
}

.inventory-slot {
  aspect-ratio: 1;
  background: rgba(60, 36, 21, 0.8);
  border: 1px solid rgba(139, 139, 139, 0.3);
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  padding: var(--space-xs);
}

.inventory-slot:hover {
  border-color: var(--color-gold);
  background: rgba(197, 165, 90, 0.15);
}

.inventory-slot.selected {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-glow-gold);
}

.inventory-slot.equipped::after {
  content: 'E';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  color: var(--color-gold);
  font-weight: bold;
}

.inventory-slot .item-icon {
  font-size: 28px;
  margin-bottom: 2px;
}

.inventory-slot .item-quantity {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  color: var(--color-parchment);
  background: rgba(0,0,0,0.6);
  padding: 0 4px;
  border-radius: 2px;
}

/* Rarity borders */
.inventory-slot.common { border-color: rgba(255,255,255,0.3); }
.inventory-slot.uncommon { border-color: var(--color-forest); }
.inventory-slot.epic { border-color: #9932CC; }
.inventory-slot.legendary { border-color: var(--color-gold); box-shadow: 0 0 8px rgba(197, 165, 90, 0.3); }

/* Item Details Panel */
.item-details {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(197, 165, 90, 0.2);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  overflow-y: auto;
}

.item-details h3 {
  font-size: var(--font-size-xl);
  color: var(--color-gold);
  margin-bottom: var(--space-md);
}

.item-details .item-category {
  font-size: var(--font-size-sm);
  color: var(--color-silver);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-md);
}

.item-details .item-stats {
  margin-bottom: var(--space-lg);
}

.item-stat {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: var(--font-size-sm);
}

.item-stat-label { color: var(--color-silver); }
.item-stat-value { color: var(--color-parchment); font-weight: bold; }

.item-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.btn-item-action {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: rgba(197, 165, 90, 0.15);
  border: 1px solid var(--color-gold-dark);
  border-radius: var(--border-radius-sm);
  color: var(--color-parchment);
  font-size: var(--font-size-sm);
  font-family: var(--font-body);
}

.btn-item-action:hover {
  background: rgba(197, 165, 90, 0.3);
  border-color: var(--color-gold);
}

/* Player Stats Sidebar */
.player-stats-sidebar {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(197, 165, 90, 0.2);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  overflow-y: auto;
}

.player-stats-sidebar h3 {
  font-size: var(--font-size-lg);
  color: var(--color-gold);
  margin-bottom: var(--space-md);
}

.player-stat-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.player-stat-name { color: var(--color-silver); }
.player-stat-val { color: var(--color-parchment); font-weight: bold; }

/* Responsive Narrative */
@media (max-width: 768px) {
  .narrative-dialogue-box {
    margin: 0 var(--space-sm) var(--space-sm);
    padding: var(--space-md);
  }
  
  .narrative-choices {
    margin: 0 var(--space-sm) var(--space-sm);
  }
  
  .choice-btn {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
  }
  
  .inventory-content {
    flex-direction: column;
  }
  
  .inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }
}
