/* ======================================================================
   RPG Game Styles - Consolidated
   ====================================================================== */

/* ======================================================================
   Ability Scores Grid
   ====================================================================== */

.ability-scores-grid .column.is-4 {
  min-width: 120px;
}

/* Ensure ability score content doesn't wrap */
.ability-score {
  white-space: nowrap;
}

.ability-score .ability-name {
  display: block;
  white-space: normal;
  min-width: 100px;
  margin-left: auto;
  margin-right: auto;
}

/* ======================================================================
   Plague Meter
   ====================================================================== */

.notification.is-plague-meter {
  background: var(--sepia-accent);
  color: white !important;
}

.notification.is-plague-damage {
  background: #8B4513; /* Darker brown, urgent but not panic */
  color: white !important;
  border-left: 4px solid #CD853F; /* Sandy brown accent */
}

/* ======================================================================
   Isekai Floating Action Buttons
   ====================================================================== */

.isekai-floating-actions {
  position: fixed;
  top: 100px;
  right: calc(50% - 400px); /* Position relative to content width - increased for wider screens */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border: 2px solid var(--sepia-border);
}

/* For very wide screens */
@media (min-width: 1601px) {
  .isekai-floating-actions {
    right: 600px;
  }
}

/* For screens between 1201px and 1600px */
@media (min-width: 1201px) and (max-width: 1600px) {
  .isekai-floating-actions {
    right: 240px;
  }
}

/* For screens between 769px and 1200px */
@media (min-width: 769px) and (max-width: 1200px) {
  .isekai-floating-actions {
    right: 80px;
  }
}

.isekai-floating-actions button {
  white-space: nowrap;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .isekai-floating-actions {
    top: auto;
    bottom: 20px;
    right: 10px;
    left: 10px;
    flex-direction: row;
    justify-content: center;
  }
  
  .isekai-floating-actions button {
    flex: 1;
  }
}

/* ======================================================================
   CSS Variables & Root Styles
   ====================================================================== */

:root {
  --sepia-bg: #f4f1e8;
  --sepia-dark: #e8ddc7;
  --sepia-text: #3a2f1f;
  --sepia-accent: #8b6914;
  --sepia-border: #c9b89a;
  --paper-shadow: rgba(58, 47, 31, 0.1);
}

body.rpg-body {
  background-color: var(--sepia-bg);
  background-image: 
    radial-gradient(circle at 25% 25%, var(--sepia-dark) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, var(--sepia-dark) 0%, transparent 50%);
  color: var(--sepia-text);
  min-height: 100vh;
  font-family: 'Garamond', 'Georgia', serif;
}

.container {
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ======================================================================
   Typography
   ====================================================================== */

h1, h2, h3, h4, h5, h6 {
  color: var(--sepia-text);
  font-weight: bold;
  margin-bottom: 1rem;
  text-shadow: 1px 1px 2px var(--paper-shadow);
}

h1 {
  font-size: 2.5rem;
  border-bottom: 3px double var(--sepia-border);
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
}

h2 {
  font-size: 2rem;
  border-bottom: 1px solid var(--sepia-border);
  padding-bottom: 0.3rem;
  margin-bottom: 1.5rem;
}

hr.divider {
  border: none;
  border-top: 2px solid var(--sepia-border);
  margin: 1.5rem 0;
}

/* ======================================================================
   Navigation & Layout Components
   ====================================================================== */

/* Navigation Buttons - Fixed top right */
.navigation-buttons {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  gap: 0.5rem;
}

.navigation-buttons .button {
  background-color: var(--sepia-accent);
  border-color: var(--sepia-border);
  color: white;
}

.navigation-buttons .button.is-small {
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.navigation-buttons .button:hover {
  background-color: var(--sepia-text);
}

/* Settings button specific animation */
.navigation-buttons #settingsBtn:hover {
  transform: rotate(90deg);
  transition: transform 0.3s ease;
}

/* ======================================================================
   Cards & Paper-like Elements
   ====================================================================== */

/* Paper-like cards */
.rpg-card {
  background: linear-gradient(135deg, #f9f6f0 0%, var(--sepia-bg) 100%);
  border: 2px solid var(--sepia-border);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 
    0 4px 6px var(--paper-shadow),
    inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative;
}

.rpg-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    var(--sepia-accent) 0%, 
    transparent 10%, 
    transparent 90%, 
    var(--sepia-accent) 100%);
  border-radius: 8px;
  opacity: 0.3;
  z-index: -1;
}

/* Filigree decorations */
.filigree-corner {
  position: absolute;
  width: 60px;
  height: 60px;
  opacity: 0.3;
}

.filigree-corner::before,
.filigree-corner::after {
  content: '';
  position: absolute;
  background: var(--sepia-accent);
}

.filigree-corner.top-left {
  top: 10px;
  left: 10px;
}

.filigree-corner.top-left::before {
  width: 40px;
  height: 2px;
}

.filigree-corner.top-left::after {
  width: 2px;
  height: 40px;
}

.filigree-corner.bottom-right {
  bottom: 10px;
  right: 10px;
  transform: rotate(180deg);
}

.filigree-corner.bottom-right::before {
  width: 40px;
  height: 2px;
}

.filigree-corner.bottom-right::after {
  width: 2px;
  height: 40px;
}

/* ======================================================================
   Buttons
   ====================================================================== */

.button.rpg-button {
  background: linear-gradient(135deg, var(--sepia-accent) 0%, #a47e1b 100%);
  border: 2px solid var(--sepia-border);
  color: white;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 4px var(--paper-shadow);
  transition: all 0.3s ease;
}

.button.rpg-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--paper-shadow);
  background: linear-gradient(135deg, #a47e1b 0%, var(--sepia-accent) 100%);
}

.button.rpg-button-secondary {
  background: var(--sepia-bg);
  border: 2px solid var(--sepia-border);
  color: var(--sepia-text);
}

.button.rpg-button-secondary:hover {
  background: var(--sepia-dark);
}

/* ======================================================================
   Character Selection & Cards
   ====================================================================== */

/* Character Cards */
.character-card {
  background: var(--sepia-bg);
  border: 1px solid var(--sepia-border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  display: block;
}

.character-card:hover {
  background: var(--sepia-dark);
  transform: translateX(10px);
  box-shadow: 0 2px 8px var(--paper-shadow);
}

.character-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  width: 100%;
}

.character-card-link:hover {
  color: inherit;
  text-decoration: none;
}

.character-card .columns {
  margin: 0;
}

.character-card .column {
  padding: 0.5rem;
}

/* Character Selection Cards - button_to styling */
.character-card form {
  display: block;
  width: 100%;
}

.character-card button.character-card-link {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.character-card button.character-card-link:hover {
  background: var(--sepia-light);
}

/* Character Info */
.character-info {
  padding-left: 1rem;
}

.character-class {
  color: var(--sepia-accent);
  font-weight: bold;
}

.character-race {
  color: var(--sepia-text);
  font-style: italic;
}

/* ======================================================================
   Character Portraits
   ====================================================================== */

.character-portrait {
  border: 2px solid var(--sepia-border);
  border-radius: 4px;
  overflow: hidden;
  max-width: 256px;
  height: auto !important;
}

.character-portrait img {
  width: 100%;
  height: auto !important;
  max-width: 256px;
  object-fit: contain;
}

/* Scale down character list images by 50% */
.character-list-portrait {
  transform: scale(0.5);
  transform-origin: center;
}

/* Character card display specific portraits */
.character-card-display .character-portrait {
  border: 3px solid var(--sepia-border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 256px;
}

/* ======================================================================
   Character Sheets
   ====================================================================== */

/* Character Sheet Container */
.character-sheet {
  background: linear-gradient(135deg, #f9f6f0 0%, var(--sepia-bg) 100%);
  border: 3px double var(--sepia-border);
  border-radius: 8px;
  padding: 2rem;
  position: relative;
}

/* Character Modal Body */
.character-modal-body {
  padding: 0.75rem !important;
}

.character-sheet {
  padding: 0.5rem;
}

/* Character Card Display */
.character-card-display {
  background: var(--sepia-light);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.character-card-display .character-info h2 {
  color: var(--sepia-text);
  margin-bottom: 0.5rem;
}

.character-card-display .character-class {
  color: var(--sepia-accent);
  font-size: 1.1em;
}

.character-card-display .character-race {
  color: var(--sepia-dark);
  font-size: 1em;
}

.character-card-display .character-patron {
  color: #666;
  font-style: normal;
}

.character-card-display .character-details span {
  margin-right: 0.75rem;
}

.character-card-display .character-details span:last-child {
  margin-right: 0;
}

/* Character Header */
.character-header {
  border-bottom: 2px solid var(--sepia-border);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.character-name {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--sepia-text);
  text-shadow: 1px 1px 2px var(--paper-shadow);
  margin-bottom: 0.5rem;
}

.character-basic-info {
  font-size: 1.2rem;
  color: var(--sepia-accent);
  font-weight: 600;
}

.basic-info-item {
  display: inline-block;
}

.basic-info-separator {
  margin: 0 0.8rem;
  opacity: 0.6;
}

/* Section Titles */
.section-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--sepia-text);
  border-bottom: 1px solid var(--sepia-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.character-sheet h3.subtitle {
  color: var(--sepia-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--sepia-border);
  padding-bottom: 0.25rem;
}

.empty-section-spacer {
  display: block;
  height: 0.75rem;
}

/* ======================================================================
   Ability Scores & Stats
   ====================================================================== */

/* Ability Scores */
.stats-section .columns {
  margin-top: 0.5rem;
}

.ability-score {
  text-align: center;
  background: var(--sepia-dark);
  border: 2px solid var(--sepia-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
}

.ability-name {
  display: block;
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--sepia-accent);
  margin-bottom: 0.25rem;
  letter-spacing: 0.1em;
}

.ability-value-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
}

.ability-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--sepia-text);
  line-height: 1;
}

.ability-bonus {
  font-size: 1rem;
  color: var(--sepia-accent);
  font-weight: 600;
}

/* Stat Grids and Rows */
.stat-grid {
  display: grid;
  gap: 0.5rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 600;
  color: var(--sepia-text);
  min-width: 40px;
}

.stat-value {
  color: var(--sepia-text);
  font-weight: 500;
}

/* Character sheet preview responsive stat rows */
#character-sheet-preview .stat-row {
  /* On very narrow screens, allow stat-row to wrap */
  flex-wrap: wrap;
}

.stat-block {
  background: var(--sepia-dark);
  border: 1px solid var(--sepia-border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.stat-block .stat-label {
  font-weight: bold;
  color: var(--sepia-accent);
}

.stat-block .stat-value {
  font-size: 1.2rem;
  color: var(--sepia-text);
}

/* ======================================================================
   Character Sheet Sections
   ====================================================================== */

/* Mechanical Blocks */
.mechanical-block {
  background: var(--sepia-dark);
  border: 1px solid var(--sepia-border);
  border-radius: 6px;
  padding: 1rem;
}

/* Skills */
.skill-item {
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--sepia-border);
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.skill-item:last-child {
  border-bottom: none;
}

.skill-name {
  flex-grow: 1;
}

.skill-bonus {
  color: var(--sepia-accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Equipment */
.equipment-section,
.status-effects-section,
.backstory-section {
  margin-top: 1rem;
}

.equipment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.equipment-item {
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--sepia-border);
  position: relative;
  padding-left: 1.5rem;
}

.equipment-item:last-child {
  border-bottom: none;
}

.equipment-item::before {
  content: "⚔";
  position: absolute;
  left: 0;
  color: var(--sepia-accent);
  font-size: 0.9rem;
}

/* Override for equipment items in character sheet - clean display */
.character-sheet .equipment-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: #fffbf0;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
}

.character-sheet .equipment-item::before {
  display: none !important;
}

.character-sheet .equipment-item *::before {
  display: none !important;
}

/* Consequence Item Equipment Styling - Similar to character sheet */
.consequence-item .equipment-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: #fffbf0;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
}

.consequence-item .equipment-item::before {
  display: none !important;
}

.consequence-item .equipment-item *::before {
  display: none !important;
}

/* Status Effect Styling - Similar to equipment items */
.status-effect-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: #fffbf0;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
}

.status-effect-name {
  font-weight: bold;
}

.status-effect-name.status-permanent {
  color: #007bff !important; /* Blue for permanent */
}

.status-effect-name.status-positive {
  color: #28a745 !important; /* Green for buffs */
}

.status-effect-name.status-negative {
  color: #dc3545 !important; /* Red for debuffs */
}

.status-effect-name.status-neutral {
  color: #6c757d !important; /* Grey for neutral */
}

.status-effect-bonuses {
  color: #666;
  font-style: italic;
}

.status-effect-duration {
  font-style: italic;
}

.status-description {
  margin-top: 0.25rem;
  font-style: italic;
}

/* Consequence Item Status Effect Styling - Similar to character sheet */
.consequence-item .status-effect-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: #fffbf0;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
}

.consequence-item .status-effect-item::before {
  display: none !important;
}

.consequence-item .status-effect-item *::before {
  display: none !important;
}

/* Stat Modification Display */
.stat-base-value {
  text-decoration: line-through;
  color: #999;
}

.stat-modified-positive {
  color: #28a745;
  font-weight: 600;
}

.stat-modified-negative {
  color: #dc3545;
  font-weight: 600;
}

/* Add cursor hint for modified stats with tooltips */
.stat-row[title] {
  cursor: help;
}

/* Status Effects (Boons & Banes) */
.status-effect-item {
  padding: 0.75rem 0;
  border-bottom: 1px dotted var(--sepia-border);
}

.status-effect-item:last-child {
  border-bottom: none;
}

.status-name {
  font-weight: bold;
  color: var(--sepia-accent);
  display: block;
  margin-bottom: 0.25rem;
}

.status-description {
  font-size: 0.9rem;
  color: var(--sepia-text);
  opacity: 0.8;
}

/* Override for status effects in character sheet - clean display */
.character-sheet .status-effect-item {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background-color: #fffbf0;
  border: 1px solid #f5e6b8;
  border-radius: 6px;
}

.character-sheet .status-effect-item::before {
  display: none !important;
}

.character-sheet .status-effect-item *::before {
  display: none !important;
}

/* Titles */
.title-item {
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--sepia-border);
  font-weight: 600;
  color: var(--sepia-accent);
}

.title-item:last-child {
  border-bottom: none;
}

/* Backstory Section */
.backstory-section {
  border-top: 2px solid var(--sepia-border);
  padding-top: 2rem;
  margin-top: 2rem;
}

.backstory-text {
  line-height: 1.7;
  color: var(--sepia-text);
  opacity: 0.9;
  font-size: 1rem;
  max-width: none;
  text-align: justify;
}

.backstory-text p {
  margin-bottom: 1.5rem;
}

.backstory-text p:last-child {
  margin-bottom: 0;
}

/* ======================================================================
   Equipment & Items
   ====================================================================== */

/* Equipment rarity colors */
.rarity-common {
  color: #87CEEB; /* Light blue */
}

.rarity-uncommon {
  color: #28a745; /* Green */
}

.rarity-rare {
  color: #007bff; /* Blue */
}

.rarity-epic,
.rarity-purple {
  color: #8e44ad; /* Purple */
}

.rarity-legendary {
  color: #ff8c00; /* Orange */
}

/* Choice requirement indicators */
.choice-requirement {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-right: 0.5rem;
}

.choice-requirement-class {
  color: #d4af37; /* Gold for class requirements */
}

.choice-requirement-patron {
  color: #8e44ad; /* Purple for patron requirements */
}

.choice-requirement-patron-not {
  color: #e74c3c; /* Red for negative patron requirements */
}

.choice-requirement-title {
  color: #f39c12; /* Orange for title requirements */
}

.choice-requirement-title-not {
  color: #e74c3c; /* Red for negative title requirements */
}

.choice-requirement-race {
  color: #3498db; /* Blue for race requirements */
}

.choice-requirement-item {
  color: #27ae60; /* Green for item requirements */
}

.choice-requirement-title {
  color: #f39c12; /* Orange for title requirements */
}

.choice-requirement-stat {
  color: #9b59b6; /* Purple for minimum stat requirements */
}

.choice-requirement-stat-max {
  color: #e74c3c; /* Red for maximum stat requirements */
}

/* Equipment item styling - override Bulma's strong color reset */
.equipment-item-name {
  font-weight: bold;
}

.equipment-item-name.rarity-uncommon {
  color: #28a745 !important;
}

.equipment-item-name.rarity-rare {
  color: #007bff !important;
}

.equipment-item-name.rarity-epic,
.equipment-item-name.rarity-purple {
  color: #8e44ad !important;
}

.equipment-item-name.rarity-legendary {
  color: #ff8c00 !important;
}

.equipment-item-bonuses, .status-effect-bonuses {
  color: #666;
}

.equipment-description, .status-effect-description {
  margin-top: 0.25rem;
  margin-left: 1rem;
  font-size: 0.9em;
  font-style: italic;
  color: #666;
  opacity: 0.9;
}

/* Status Effect Styles */
.status-effect {
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--sepia-border);
}

.status-effect:last-child {
  border-bottom: none;
}

.status-effect-name {
  font-weight: bold;
}

.status-effect-buff {
  color: #22c55e !important;
}

.status-effect-debuff {
  color: #dc2626 !important;
}

.status-effect-condition {
  color: #3b82f6 !important;
}

.status-effect-neutral {
  color: #6b7280 !important;
}

.status-effect-duration {
  color: #9ca3af;
  font-style: italic;
}

.status-effect-mechanics {
  margin-top: 0.25rem;
  margin-left: 1rem;
  color: #6b7280;
  font-size: 0.85em;
}

/* ======================================================================
   Adventure Map
   ====================================================================== */

/* Map Styles */
.adventure-map {
  background: var(--sepia-bg);
  border: 2px solid var(--sepia-border);
  border-radius: 8px;
  padding: 2rem;
  min-height: 600px;
  position: relative;
  overflow-y: auto;
}

.map-node {
  background: var(--sepia-dark);
  border: 2px solid var(--sepia-border);
  border-radius: 50%;
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1rem auto;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 120px;
  min-height: 120px;
}

.map-node p {
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.3;
  padding: 0 0.75rem;
  word-wrap: break-word;
  hyphens: auto;
}

.map-node:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px var(--paper-shadow);
}

/* Tooltip for map nodes - shows after 3s hover */
.map-node-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--sepia-bg);
  border: 2px solid var(--sepia-accent);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 200px;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  transition-delay: 3s; /* Show after 3 seconds of hovering */
  font-size: 0.9rem;
  line-height: 1.4;
}

.map-node-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--sepia-accent);
}

.map-node:hover .map-node-tooltip {
  opacity: 1;
  visibility: visible;
}

.map-node:not(:hover) .map-node-tooltip {
  transition-delay: 0s; /* Hide immediately when not hovering */
}

.map-connector {
  width: 2px;
  height: 40px;
  background: var(--sepia-border);
  margin: -20px auto;
  z-index: -1;
}

/* Map Level Structure */
.map-level {
  margin-bottom: 2rem;
  position: relative;
}

.level-connector {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
  min-height: 40px;
  position: relative;
}

.connection-line {
  width: 2px;
  height: 40px;
  background: var(--sepia-border);
  position: relative;
}

.connection-line::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: -3px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 8px solid var(--sepia-border);
}

/* Individual connection lines for complex three-act maps */
.connection-line.individual-line {
  position: absolute;
  top: 0;
  transform-origin: top center;
  /* Calculate angle and width based on start and end positions */
  --dx: calc(var(--target-left, 50%) - 50%);
  --angle: calc(atan(var(--dx) / 40px));
  --length: calc(sqrt(var(--dx) * var(--dx) + 1600px));
  
  transform: translateX(-50%) rotate(var(--angle));
  width: 2px;
  height: var(--length, 40px);
}

/* When there are many nodes in a level, make them smaller */
.map-level.many-nodes .map-node {
  width: 140px;
  height: 140px;
  margin: 0.8rem auto;
}

.map-level.many-nodes .map-node p {
  font-size: 0.75rem;
}

.map-level.more-nodes .map-node {
  width: 120px;
  height: 120px;
  margin: 0.6rem auto;
}

.map-level.more-nodes .map-node p {
  font-size: 0.7rem;
}

.map-level.most-nodes .map-node {
  width: 100px;
  height: 100px;
  margin: 0.5rem auto;
}

.map-level.most-nodes .map-node p {
  font-size: 0.65rem;
}

/* Node states with enhanced visual hierarchy */
.map-node.locked {
  opacity: 0.25;
  pointer-events: none;
  transform: scale(0.85);
  filter: grayscale(50%);
}

.map-node.available {
  border-color: var(--sepia-accent);
  border-width: 3px;
  box-shadow: 0 4px 12px rgba(139, 105, 20, 0.4);
  transform: scale(1.05);
  background: linear-gradient(135deg, var(--sepia-dark) 0%, var(--sepia-bg) 100%);
}

.map-node.available:hover {
  border-color: var(--sepia-accent);
  box-shadow: 0 6px 20px rgba(139, 105, 20, 0.6);
  transform: scale(1.15);
}

.map-node.active {
  background: linear-gradient(135deg, var(--sepia-accent) 0%, #b8841c 100%);
  color: white;
  border-color: var(--sepia-accent);
  border-width: 3px;
  box-shadow: 0 4px 16px rgba(139, 105, 20, 0.5);
}

.map-node.completed {
  opacity: 0.7;
  background: linear-gradient(135deg, var(--sepia-border) 0%, var(--sepia-dark) 100%);
  transform: scale(0.9);
}

/* ======================================================================
   Encounters & Gameplay
   ====================================================================== */

/* Encounter Styles */
.encounter-text {
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  text-align: justify;
}

.choice-button {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--sepia-dark);
  border: 2px solid var(--sepia-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.choice-button:hover {
  background: var(--sepia-accent);
  color: white;
  transform: translateX(10px);
}

.difficulty-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-left: 0.5rem;
}

.difficulty-easy {
  background: #90EE90;
  color: #2d5a2d;
}

.difficulty-normal {
  background: #87CEEB;
  color: #1e4d5f;
}

.difficulty-hard {
  background: #FFB6C1;
  color: #8b2635;
}

.roll-result {
  padding: 1rem;
  margin: 1rem 0;
  border-left: 4px solid var(--sepia-accent);
  background: var(--sepia-dark);
}

.roll-success {
  border-color: #90EE90;
}

.roll-failure {
  border-color: #FFB6C1;
}

/* Consequences section enhancements */
.consequences-section {
  font-size: 1.1em;
}

.consequences-heading {
  font-weight: bold;
}

/* ======================================================================
   Game Over & Adventure Log
   ====================================================================== */

/* Game Over Screen */
.game-over-container {
  text-align: center;
}

.adventure-log {
  background: var(--sepia-bg);
  border: 2px solid var(--sepia-border);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: left;
  font-family: 'Courier New', monospace;
  max-height: 500px;
  overflow-y: auto;
}

.adventure-log-entry {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dotted var(--sepia-border);
}

/* ======================================================================
   Modal Overrides
   ====================================================================== */

.modal-card {
  background: var(--sepia-bg);
  border: 2px solid var(--sepia-border);
}

.modal-card-head {
  background: var(--sepia-dark);
  border-bottom: 2px solid var(--sepia-border);
}

.modal-card-title {
  color: var(--sepia-text);
  font-weight: bold;
}

/* ======================================================================
   Responsive Design - Mobile Optimizations
   ====================================================================== */

@media screen and (max-width: 768px) {
  .container {
    padding: 1rem 0.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .rpg-card {
    padding: 1rem;
  }
  
  .map-node {
    width: 120px !important;
    height: 120px !important;
    margin: 0.5rem auto !important;
  }
  
  /* Override dynamic sizing on mobile for better fit */
  .map-level .map-node {
    width: 100px !important;
    height: 100px !important;
    margin: 0.4rem auto !important;
  }
  
  .map-node p {
    font-size: 0.75rem !important;
  }
}

@media screen and (max-width: 320px) {
  #character-sheet-preview .stat-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  #character-sheet-preview .stat-label {
    margin-bottom: 0.125rem;
  }
}

/* ======================================================================
   Polling Animation for Portrait Generation
   ====================================================================== */

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

.polling-pulse {
  animation: pulse 1.5s ease-in-out;
}

#polling-icon {
  animation: pulse 2s infinite ease-in-out;
}

/* Admin Ghosting Mode Styles */
.ghosting-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  padding: 10px 20px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  border-bottom: 3px solid #d63031;
  animation: ghosting-pulse 2s ease-in-out infinite;
}

.ghosting-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
}

.ghosting-indicator .icon {
  font-size: 20px;
  animation: ghost-float 3s ease-in-out infinite;
}

@keyframes ghosting-pulse {
  0%, 100% {
    opacity: 0.95;
  }
  50% {
    opacity: 1;
  }
}

@keyframes ghost-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Adjust body padding when ghosting indicator is present */
body.admin-ghosting {
  padding-top: 60px;
  background: repeating-linear-gradient(
    45deg,
    #f8f9fa,
    #f8f9fa 10px,
    #fff5f5 10px,
    #fff5f5 20px
  );
}

body.admin-ghosting .rpg-container {
  border: 3px solid #ff6b6b;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.2);
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */
