/* ========================================
   PATHFINDER CHARACTER SHEETS - SHARED STYLES
   Refactored to use CSS variables for all character-specific colors
   ======================================== */

:root {
  /* Default theme: Elira (Icy Blue) */
  --primary: #1a3a5c;
  --secondary: #4a9cc7;
  --accent: #a8d5e8;
  --gold: #c4a962;
  --gold-light: #d4c182;
  --text: #e8f4f8;
  --text-muted: #8ab4c7;
  --background: #0d1b2a;
  --background-light: #1b2d42;
  --card-bg: rgba(26, 58, 92, 0.7);
  --border: rgba(168, 213, 232, 0.3);
  --magical: #7b68ee;
  --magical-glow: rgba(123, 104, 238, 0.4);

  /* RGB components for rgba() usage */
  --glow-rgb: 74, 156, 199;
  --primary-rgb: 26, 58, 92;
  --accent-rgb: 168, 213, 232;
  --magical-rgb: 123, 104, 238;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { overflow-x: hidden; }

body {
  background: #0a0a0a;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px 20px 70px 20px;
  font-family: 'Crimson Text', Georgia, serif;
  overflow-x: hidden;
  width: 100%;
}

/* Background image */
.page-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('Character/background.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  z-index: -1;
  pointer-events: none;
}

/* Footer Navigation - Floating Button */
.back-nav {
  position: fixed !important;
  bottom: 20px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%);
  padding: 0;
  background: transparent !important;
  border: none;
  z-index: 9999 !important;
}
.back-nav .version { display: none; }
.back-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 30px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}
.back-nav a:hover {
  color: var(--gold);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.poster {
  width: 800px;
  max-width: 100%;
  min-height: 1200px;
  background: var(--background);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(var(--glow-rgb), 0.2);
}

.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at top, rgba(var(--glow-rgb), 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at bottom, rgba(var(--primary-rgb), 0.3) 0%, transparent 50%),
    linear-gradient(180deg, var(--background) 0%, var(--background-light) 50%, var(--background) 100%);
  opacity: 0.95;
}

.character-header {
  position: relative;
  text-align: center;
  padding: 30px 20px 20px;
  background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.9) 0%, transparent 100%);
  border-bottom: 2px solid var(--border);
}
.character-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.character-name {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 0 30px rgba(var(--glow-rgb), 0.5), 0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.character-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.portrait-section {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}
.portrait-frame {
  position: relative;
  width: 300px;
  height: 380px;
  border: 4px solid var(--gold);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(var(--glow-rgb), 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
}
.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.bloodline-badge {
  margin-top: 15px;
  padding: 8px 24px;
  background: linear-gradient(135deg, var(--card-bg), rgba(var(--magical-rgb), 0.2));
  border: 1px solid var(--magical);
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 20px var(--magical-glow);
}
.bloodline-icon { font-size: 1.2rem; }
.bloodline-text {
  font-family: 'Cinzel', serif;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.section-header {
  position: relative;
  text-align: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
}
.section-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.15em;
}
.section-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.attributes-section {
  position: relative;
  padding: 20px;
  background: linear-gradient(180deg, transparent, var(--card-bg), transparent);
}
.attributes-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}
.attribute-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.attribute-card.highlight {
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(var(--glow-rgb), 0.3);
}
.attr-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}
.attr-value {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
  order: 3;
}
.attr-mod {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--secondary);
  order: 2;
}

.combat-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.combat-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 15px;
}
.stat-icon { font-size: 0.9rem; }
.stat-icon.heart, .combat-stat:nth-child(2) .stat-icon { color: #e74c3c; }
.stat-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.stat-value .hp-temp-value {
  color: #27ae60;
  font-weight: 700;
}

/* Quick Reference Section */
.quick-ref-section {
  position: relative;
  padding: 15px;
  margin: 15px;
  background: var(--card-bg);
  border: 2px solid var(--secondary);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(var(--glow-rgb), 0.2);
}
.quick-ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.qr-box {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  border: 1px solid var(--border);
}
.qr-box.highlight {
  border-color: var(--secondary);
  background: rgba(var(--glow-rgb), 0.15);
}
.qr-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.qr-value {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.qr-sub { font-size: 0.6rem; color: var(--accent); }
.init-box {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
}
.init-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.8rem;
}
.init-row .label { color: var(--text-muted); }
.init-row .value {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--text);
}
.init-row.special {
  color: var(--accent);
  font-size: 0.7rem;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
  padding-top: 6px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 15px;
}
.two-column::before { display: none; }

.spells-section, .equipment-section {
  position: relative;
  padding: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.casting-info {
  text-align: center;
  padding: 8px;
  margin-bottom: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
}
.casting-info p { font-size: 0.75rem; color: var(--text); margin: 0; }
.casting-info strong { color: var(--gold); }

.spell-level { margin-bottom: 12px; }
.spell-level h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.spell-level .slots {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: normal;
}
.spell-list { list-style: none; }
.spell-list li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.8rem;
  color: var(--text);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
}
.spell-list li:last-child { border-bottom: none; }
.spell-icon {
  font-size: 0.8rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.spell-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
.spell-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}
.spell-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.spell-desc strong { color: var(--gold); }
.spell-desc em {
  color: var(--secondary);
  font-style: italic;
  display: block;
  margin-top: 1px;
  font-size: 0.6rem;
}

.focus-spell {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px solid var(--magical);
}
.focus-spell h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--magical);
  margin-bottom: 6px;
}
.focus-points {
  font-size: 0.7rem;
  color: var(--magical);
  font-weight: normal;
}

.equipment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.equipment-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.equipment-item.magical {
  border-color: var(--magical);
  box-shadow: 0 0 8px var(--magical-glow);
}
.item-icon-fallback {
  font-size: 1.5rem;
  width: 32px;
  text-align: center;
  flex-shrink: 0;
}
.item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.item-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
}
.item-type { font-size: 0.65rem; color: var(--secondary); }
.item-type strong { color: var(--gold); }
.item-desc {
  font-size: 0.6rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.money-pouch {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px;
  background: rgba(var(--glow-rgb), 0.1);
  border-radius: 6px;
  margin-bottom: 12px;
}
.coin {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 600;
}
.coin.gold { color: var(--gold); }

.proficiencies-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.proficiency {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prof-name {
  width: 80px;
  font-size: 0.7rem;
  color: var(--text);
}
.prof-bar {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
  overflow: hidden;
}
.prof-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), var(--accent));
  border-radius: 3px;
}
.prof-rank {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 3px;
}
.prof-rank.trained { background: #4a9cc7; color: #0d1b2a; }
.prof-rank.expert { background: #c4a962; color: #0d1b2a; }
.prof-rank.master { background: #7b68ee; color: white; }
.prof-rank.legendary { background: linear-gradient(135deg, #c4a962, #7b68ee); color: white; }

/* Skills List - New Format */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.skill-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}
.skill-item.lore {
  opacity: 0.85;
  font-style: italic;
}
.skill-name {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.skill-rank {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  flex-shrink: 0;
}
.skill-rank.trained { background: #4a9cc7; color: #0d1b2a; }
.skill-rank.expert { background: #c4a962; color: #0d1b2a; }
.skill-rank.master { background: #7b68ee; color: white; }
.skill-rank.legendary { background: linear-gradient(135deg, #c4a962, #7b68ee); color: white; }
.skill-arrow {
  color: var(--text-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}
.skill-mod {
  min-width: 32px;
  text-align: right;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Feats List */
.feats-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.feat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.feat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3);
}
.feat-card.mythic {
  border-color: var(--magical);
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(var(--magical-rgb), 0.1) 100%);
}
.feat-card.mythic:hover {
  border-color: var(--magical);
  box-shadow: 0 0 12px rgba(var(--magical-rgb), 0.4);
}
.feat-card summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  transition: background 0.2s ease;
}
.feat-card summary::-webkit-details-marker {
  display: none;
}
.feat-card summary:hover {
  background: rgba(var(--accent-rgb), 0.1);
}
.feat-card[open] summary {
  background: rgba(var(--accent-rgb), 0.15);
  border-bottom: 1px solid var(--border);
}
.feat-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.feat-header {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.feat-name {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}
.feat-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}
.feat-details {
  padding: 10px;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--text-muted);
  border-top: 1px solid rgba(168, 213, 232, 0.1);
}
.feat-details p {
  margin: 0 0 8px 0;
}
.feat-details p:last-child {
  margin-bottom: 0;
}
.feat-details strong {
  color: var(--text);
}

.languages h3 {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 6px;
}
.language-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.lang-tag {
  padding: 3px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Expandable Spell Cards */
.spell-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(200,200,200,0.2);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.3s;
  scroll-margin-top: 20px;
}
.spell-card:hover { border-color: var(--gold); }
.spell-card[open] {
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--magical-glow);
}
.spell-card:target {
  border-color: #c9a227 !important;
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.5) !important;
  animation: highlight-pulse 2s ease-out;
}
@keyframes highlight-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(201, 162, 39, 0.5); }
  50% { box-shadow: 0 0 30px rgba(201, 162, 39, 0.8); }
}
.spell-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.spell-card summary::-webkit-details-marker { display: none; }
.spell-card summary::after {
  content: '▶';
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.spell-card[open] summary::after { transform: rotate(90deg); }
.spell-card .spell-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}
.spell-card .spell-header { flex: 1; }
.spell-card .spell-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.spell-card .spell-name .signature { color: var(--gold); }
.spell-card .spell-quick {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.spell-card .spell-quick strong { color: var(--gold); }
.spell-details {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(200,200,200,0.1);
  background: rgba(0,0,0,0.2);
}
.spell-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.detail-box {
  background: rgba(0,0,0,0.3);
  padding: 8px;
  border-radius: 6px;
  border-left: 2px solid var(--gold);
}
.detail-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.detail-value { font-size: 0.8rem; color: var(--text); }
.detail-value strong { color: var(--gold); }
.spell-description {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.spell-description p { margin-bottom: 6px; }
.spell-description p:last-child { margin-bottom: 0; }
.heighten-info {
  margin-top: 8px;
  padding: 8px;
  background: rgba(var(--glow-rgb), 0.1);
  border: 1px dashed var(--gold);
  border-radius: 6px;
  font-size: 0.7rem;
  color: #c9d1d9;
}
.heighten-info strong { color: var(--gold); }
.spell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.spell-tag {
  font-size: 0.55rem;
  padding: 2px 6px;
  background: rgba(var(--glow-rgb), 0.2);
  border: 1px solid var(--gold);
  border-radius: 10px;
  color: var(--gold);
  text-transform: uppercase;
}
.spell-tag.damage { background: rgba(231,76,60,0.2); border-color: #e74c3c; color: #e74c3c; }
.spell-tag.buff { background: rgba(39,174,96,0.2); border-color: #27ae60; color: #27ae60; }
.spell-tag.debuff { background: rgba(155,89,182,0.2); border-color: #9b59b6; color: #9b59b6; }
.spell-tag.healing { background: rgba(231,76,60,0.2); border-color: #e74c3c; color: #ff6b6b; }

/* Expandable Equipment Cards */
.equip-card {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(200,200,200,0.2);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.3s;
  scroll-margin-top: 20px;
}
.equip-card.magical { border-color: var(--magical); }
.equip-card:hover { border-color: var(--magical); }
.equip-card[open] {
  border-color: var(--magical);
  box-shadow: 0 0 10px var(--magical-glow);
}
.equip-card:target {
  border-color: #c9a227 !important;
  box-shadow: 0 0 20px rgba(201, 162, 39, 0.5) !important;
  animation: highlight-pulse 2s ease-out;
}
.equip-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.equip-card summary::-webkit-details-marker { display: none; }
.equip-card summary::after {
  content: '▶';
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.equip-card[open] summary::after { transform: rotate(90deg); }
.equip-card .equip-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}
.equip-card .equip-header { flex: 1; }
.equip-card .equip-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}
.equip-card.magical .equip-name { color: var(--magical); }
.equip-card .equip-quick {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.equip-card .equip-quick strong { color: var(--gold); }
.equip-details {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(200,200,200,0.1);
  background: rgba(0,0,0,0.2);
}
.equip-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.equip-detail-box {
  background: rgba(0,0,0,0.3);
  padding: 8px;
  border-radius: 6px;
  border-left: 2px solid var(--magical);
}
.equip-detail-box .detail-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 3px;
}
.equip-detail-box .detail-value { font-size: 0.8rem; color: var(--text); }
.equip-detail-box .detail-value strong { color: var(--magical); }
.equip-description {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #c9d1d9;
}
.equip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.equip-tag {
  font-size: 0.55rem;
  padding: 2px 6px;
  background: rgba(var(--magical-rgb), 0.2);
  border: 1px solid var(--magical);
  border-radius: 10px;
  color: var(--magical);
  text-transform: uppercase;
}
.equip-tag.weapon { background: rgba(231,76,60,0.2); border-color: #e74c3c; color: #e74c3c; }
.equip-tag.armor { background: rgba(52,152,219,0.2); border-color: #3498db; color: #3498db; }

.character-footer {
  position: relative;
  padding: 15px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(var(--primary-rgb), 0.9));
  border-top: 1px solid var(--border);
  margin-top: 15px;
}
.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}
.trait {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.divider { color: var(--gold); opacity: 0.6; }
.footer-decoration {
  margin-top: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Responsive Design */
@media (max-width: 840px) {
  body { padding: 10px 10px 70px 10px; }
  .poster { width: 100%; min-height: auto; }
  .character-name { font-size: 1.8rem; letter-spacing: 0.08em; }
  .portrait-frame { width: 250px; height: 320px; }
  .attributes-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .two-column { grid-template-columns: 1fr; }
  .footer-content { gap: 10px; }
  .combat-stats { gap: 10px; }
}

@media (max-width: 480px) {
  body { padding: 5px 5px 70px 5px; }
  .character-header { padding: 20px 10px 15px; }
  .character-name { font-size: 1.4rem; }
  .character-subtitle { font-size: 0.75rem; }
  .portrait-section { padding: 15px 10px; }
  .portrait-frame { width: 100%; max-width: 260px; height: 330px; }
  .attributes-section { padding: 15px 10px; }
  .attributes-grid { gap: 6px; }
  .attribute-card { padding: 8px 4px; min-width: 0; }
  .attr-label { font-size: 0.6rem; }
  .attr-value { font-size: 0.7rem; }
  .attr-mod { font-size: 1.1rem; }
  .combat-stats { gap: 6px; }
  .combat-stat { padding: 5px 8px; gap: 4px; }
  .stat-label { font-size: 0.6rem; }
  .stat-value { font-size: 0.85rem; }
  .section-header h2 { font-size: 1rem; letter-spacing: 0.08em; }
  .two-column { padding: 10px; gap: 10px; }
  .spells-section, .equipment-section { padding: 10px; }
  .equipment-item { padding: 8px 6px; }
  .trait { font-size: 0.65rem; }
  .divider { display: none; }
}

@media (max-width: 360px) {
  body { padding: 2px 2px 70px 2px; }
  .character-name { font-size: 1.2rem; letter-spacing: 0.05em; }
  .character-subtitle { font-size: 0.65rem; }
  .portrait-frame { max-width: 240px; height: 300px; }
  .attributes-section { padding: 10px 5px; }
  .attributes-grid { gap: 4px; }
  .attribute-card { padding: 6px 2px; }
  .attr-label { font-size: 0.55rem; }
  .attr-value { font-size: 0.65rem; }
  .combat-stats { gap: 4px; }
  .combat-stat { padding: 4px 6px; }
  .stat-icon { font-size: 0.75rem; }
  .stat-label { font-size: 0.55rem; }
  .stat-value { font-size: 0.75rem; }
  .section-header h2 { font-size: 0.85rem; }
  .two-column { padding: 8px 5px; }
  .spells-section, .equipment-section { padding: 8px; }
  .spell-name { font-size: 0.7rem; }
  .spell-desc { font-size: 0.55rem; }
  .item-name { font-size: 0.7rem; }
  .item-icon-fallback { font-size: 1.2rem; width: 26px; }
  .prof-name { width: 60px; font-size: 0.6rem; }
  .trait { font-size: 0.6rem; }
}

/* ========================================
   CONDITION TRACKER
   ======================================== */

/* FAB Button */
.conditions-fab {
  position: fixed;
  bottom: 80px;
  right: 30px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conditions-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.conditions-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  border: 2px solid var(--bg);
}

/* Modal */
.conditions-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.conditions-modal.visible {
  display: flex;
}

.conditions-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 25px;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.conditions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.conditions-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold);
  margin: 0;
}

.conditions-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.conditions-close:hover {
  color: #e74c3c;
}

/* Sections */
.conditions-section {
  margin-bottom: 25px;
}

.conditions-section .section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-left: 8px;
  border-left: 3px solid var(--accent);
}

.conditions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

/* Condition Cards */
.condition-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.2s ease;
}

.condition-card.buff {
  border-color: rgba(39, 174, 96, 0.3);
}

.condition-card.buff.active {
  background: rgba(39, 174, 96, 0.1);
  border-color: #27ae60;
}

.condition-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.condition-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.condition-name {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.condition-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 8px;
}

/* Debuff Controls */
.condition-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 8px 0;
}

.condition-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  border-radius: 6px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.condition-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: scale(1.05);
}

.condition-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.condition-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gold);
  min-width: 20px;
  text-align: center;
}

/* Buff Controls */
.condition-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  margin: 8px 0;
}

.condition-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  transition: 0.3s;
  border-radius: 50%;
}

.condition-toggle input:checked + .toggle-slider {
  background-color: #27ae60;
  border-color: #27ae60;
}

.condition-toggle input:checked + .toggle-slider:before {
  transform: translateX(24px);
  background-color: white;
}

/* Heroism Select */
.heroism-select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  margin: 8px 0;
  transition: all 0.2s ease;
}

.heroism-select:hover {
  border-color: var(--accent);
}

.heroism-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent), 0.2);
}

/* Character Selector (quickref only) */
.character-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.char-select-btn {
  flex: 1;
  min-width: 80px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.char-select-btn:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--accent);
}

.char-select-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* Footer */
.conditions-footer {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.conditions-clear-btn {
  padding: 8px 20px;
  background: rgba(231, 76, 60, 0.2);
  border: 1px solid #e74c3c;
  border-radius: 6px;
  color: #e74c3c;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.conditions-clear-btn:hover {
  background: #e74c3c;
  color: white;
}

/* Visual Indicators on Stats */
.stat-modified {
  position: relative;
}

.stat-modified::after {
  content: attr(data-modifier);
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e74c3c;
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
  min-width: 20px;
  text-align: center;
}

.stat-modified.buff::after {
  background: #27ae60;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .conditions-fab {
    bottom: 70px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
  }

  .conditions-badge {
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .conditions-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .conditions-panel {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    padding: 20px;
  }

  .conditions-header h2 {
    font-size: 1.1rem;
  }

  .conditions-grid {
    grid-template-columns: 1fr;
  }

  .condition-card {
    padding: 10px;
  }
}

@media (max-width: 360px) {
  .conditions-fab {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
  }

  .conditions-badge {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
  }

  .conditions-panel {
    padding: 15px;
  }

  .condition-btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
}

/* ========================================
   HP TRACKER
   ======================================== */

/* HP Modal */
.hp-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.hp-modal.visible {
  display: flex;
}

.hp-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 25px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.hp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.hp-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold);
  margin: 0;
}

.hp-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-close:hover {
  color: #e74c3c;
}

/* HP Current Display */
.hp-current-display {
  text-align: center;
  margin-bottom: 20px;
}

.hp-current-value {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: var(--text);
  font-weight: 700;
}

.hp-temp-value {
  color: #27ae60;
  font-weight: 700;
}

/* HP Tabs */
.hp-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.hp-tab {
  flex: 1;
  padding: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hp-tab:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: var(--accent);
}

.hp-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* HP Input Section */
.hp-input-section {
  margin-bottom: 15px;
}

.hp-input-section label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hp-input-section input {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.2rem;
  font-family: 'Cinzel', serif;
  text-align: center;
  transition: all 0.2s ease;
}

.hp-input-section input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent), 0.2);
}

/* HP Quick Buttons */
.hp-quick-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.hp-quick-btn {
  flex: 1;
  padding: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hp-quick-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: scale(1.05);
}

/* HP Temp Section */
.hp-temp-section {
  margin-bottom: 15px;
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.3);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.hp-temp-header {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #27ae60;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  user-select: none;
  transition: background 0.2s ease;
}

.hp-temp-header:hover {
  background: rgba(39, 174, 96, 0.15);
}

.hp-temp-toggle {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.hp-temp-section.collapsed .hp-temp-toggle {
  transform: rotate(-90deg);
}

.hp-temp-content {
  padding: 12px 15px;
  display: flex;
  gap: 8px;
  align-items: stretch;
  transition: all 0.3s ease;
  max-height: 100px;
  opacity: 1;
}

.hp-temp-section.collapsed .hp-temp-content {
  max-height: 0;
  padding: 0 15px;
  opacity: 0;
  overflow: hidden;
}

.hp-temp-content input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(39, 174, 96, 0.3);
  border-radius: 6px;
  color: var(--text);
  font-size: 1.1rem;
  font-family: 'Cinzel', serif;
  text-align: center;
}

.hp-temp-content input:focus {
  outline: none;
  border-color: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.hp-temp-btn {
  flex-shrink: 0;
  width: 70px;
  padding: 10px 0;
  background: #27ae60;
  border: 1px solid #27ae60;
  border-radius: 6px;
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hp-temp-btn:hover {
  background: #229954;
  border-color: #229954;
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(39, 174, 96, 0.4);
}

/* HP Actions */
.hp-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.hp-apply-btn {
  padding: 12px 40px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--bg);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hp-apply-btn:hover {
  background: var(--secondary);
  border-color: var(--secondary);
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.hp-cancel-btn {
  padding: 12px 30px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hp-cancel-btn:hover {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
  color: #e74c3c;
  transform: scale(1.05);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .hp-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .hp-panel {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 20px;
  }

  .hp-current-value {
    font-size: 1.8rem;
  }

  .hp-tab {
    font-size: 0.85rem;
    padding: 8px;
  }

  .hp-quick-btn {
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .hp-panel {
    padding: 15px;
  }

  .hp-current-value {
    font-size: 1.6rem;
  }

  .hp-temp-content {
    gap: 6px;
  }

  .hp-temp-btn {
    width: 60px;
    font-size: 0.75rem;
    padding: 8px 0;
  }
}
