/**
 * Daggerheart Character Sheet - Complete Rewrite CSS
 * Matches official paper character sheet layout
 * Mobile-first responsive design with print support
 *
 * Fixes:
 * - Fixed dimensions to prevent UI jumping
 * - Gold counter odometer styling
 * - Better checkbox styling
 * - Improved mobile responsiveness
 * - Better print support
 */

/* ============================================
   CSS VARIABLES & CLASS COLORS
   ============================================ */

:root {
  /* Class Colors */
  --color-bard: #8B2942;
  --color-druid: #2D5A3D;
  --color-guardian: #3D5A80;
  --color-ranger: #6B4423;
  --color-rogue: #4A3B5C;
  --color-seraph: #B8860B;
  --color-sorcerer: #5B2C6F;
  --color-warrior: #8B0000;
  --color-wizard: #1E3A5F;

  /* Light Mode (Default) */
  --sheet-bg: #f4f1e9;
  --sheet-border: #2c2c2c;
  --sheet-text: #1a1a1a;
  --sheet-muted: #666;
  --sheet-accent: #8B4513;
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: #999;
  --section-bg: rgba(255, 255, 255, 0.5);
  --section-header-bg: rgba(0, 0, 0, 0.1);

  /* Touch Target Sizes */
  --touch-target-min: 44px;
  --checkbox-size: 32px;
  --checkbox-size-mobile: 40px;
}

/* ============================================
   CHARACTER SHEET CONTAINER
   ============================================ */

.character-sheet-form {
  background: var(--sheet-bg);
  color: var(--sheet-text);
  max-width: 1000px;
  margin: 0 auto;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
}

.character-sheet-form,
.character-sheet-form * {
  box-sizing: border-box;
}

/* Prevent any unexpected layout shifts */
.character-sheet-form input,
.character-sheet-form textarea,
.character-sheet-form button {
  font-family: inherit;
}

/* ============================================
   CLASS BANNER
   ============================================ */

.class-banner {
  background: linear-gradient(135deg, var(--class-color, #3D5A80), rgba(0, 0, 0, 0.3));
  color: #fff;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  min-height: 120px;
}

/* Class-specific colors */
.class-banner.bard { --class-color: var(--color-bard); }
.class-banner.druid { --class-color: var(--color-druid); }
.class-banner.guardian { --class-color: var(--color-guardian); }
.class-banner.ranger { --class-color: var(--color-ranger); }
.class-banner.rogue { --class-color: var(--color-rogue); }
.class-banner.seraph { --class-color: var(--color-seraph); }
.class-banner.sorcerer { --class-color: var(--color-sorcerer); }
.class-banner.warrior { --class-color: var(--color-warrior); }
.class-banner.wizard { --class-color: var(--color-wizard); }

.class-banner-left {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  align-items: center;
}

/* ============================================
   PORTRAIT
   ============================================ */

.portrait-section {
  flex-shrink: 0;
}

.portrait-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  /* Fixed size to prevent jumping */
  min-width: 80px;
  min-height: 80px;
}

.portrait-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portrait-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
}

.portrait-placeholder-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.portrait-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.portrait-container:hover .portrait-overlay,
.portrait-container:focus .portrait-overlay {
  opacity: 1;
}

.portrait-edit-label {
  color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

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

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

.portrait-modal-content {
  background: var(--sheet-bg);
  color: var(--sheet-text);
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.portrait-modal-content h3 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.portrait-modal-preview {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 3px solid var(--sheet-border);
  background: rgba(0, 0, 0, 0.1);
}

.portrait-modal-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-modal-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-portrait-upload {
  background: var(--sheet-accent);
  color: #fff;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  min-height: var(--touch-target-min);
}

.btn-portrait-upload:hover {
  opacity: 0.9;
}

.portrait-url-input-group {
  display: flex;
  gap: 0.5rem;
}

.portrait-url-input-group input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  min-height: var(--touch-target-min);
}

.btn-portrait-apply {
  background: #4caf50;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  min-height: var(--touch-target-min);
}

.btn-portrait-remove {
  background: #f44336;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  min-height: var(--touch-target-min);
}

.btn-portrait-close {
  background: transparent;
  color: var(--sheet-muted);
  border: 1px solid var(--sheet-muted);
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  min-height: var(--touch-target-min);
}

.btn-portrait-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ============================================
   CLASS INFO & HEADER FIELDS
   ============================================ */

.class-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.class-banner-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.class-banner-domains {
  font-size: 0.9rem;
  opacity: 0.9;
  font-style: italic;
}

.class-banner-right {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
}

.header-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.header-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-field label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.9;
}

.header-field input {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 130px;
  min-height: 32px;
}

.header-field input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.header-field input:focus {
  outline: none;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.3);
}

/* Level Display */
.level-display {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-align: center;
  min-width: 60px;
}

.level-number {
  font-size: 1.5rem;
  font-weight: 700;
}

.level-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* Print Button */
.print-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--touch-target-min);
}

.print-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.print-icon {
  font-size: 1rem;
}

/* ============================================
   MAIN LAYOUT - TWO COLUMN
   ============================================ */

.sheet-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 768px) {
  .sheet-body {
    grid-template-columns: 1fr 1fr;
  }
}

.sheet-column {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sheet-column-left {
  border-right: none;
}

@media (min-width: 768px) {
  .sheet-column-left {
    border-right: 1px solid var(--sheet-border);
  }
}

/* ============================================
   SECTION STYLING
   ============================================ */

.sheet-section {
  background: var(--section-bg);
  border: 1px solid var(--sheet-border);
  border-radius: 4px;
  overflow: hidden;
  /* Fixed min-height to prevent jumping */
  min-height: 50px;
}

.section-header {
  background: var(--section-header-bg);
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--sheet-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
}

.section-content {
  padding: 0.75rem;
}

/* ============================================
   COLLAPSIBLE SECTIONS
   ============================================ */

.collapsible-trigger {
  cursor: pointer;
  user-select: none;
}

.collapse-icon::after {
  content: '\25BC'; /* Down arrow */
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  display: inline-block;
}

.collapsible-section.collapsed .collapse-icon::after {
  transform: rotate(-90deg);
}

.collapsible-section.collapsed .section-content {
  display: none;
}

/* On desktop, always show content */
@media (min-width: 768px) {
  .collapsible-section .section-content {
    display: block !important;
  }

  .collapse-icon {
    display: none;
  }

  .collapsible-trigger {
    cursor: default;
  }
}

/* ============================================
   COMBAT STATS ROW
   ============================================ */

.combat-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  text-align: center;
}

.combat-stat {
  background: var(--input-bg);
  border: 1px solid var(--sheet-border);
  border-radius: 4px;
  padding: 0.5rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.combat-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sheet-muted);
  margin-bottom: 0.25rem;
}

.combat-stat-input {
  width: 100%;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: none;
  background: transparent;
  font-family: inherit;
  padding: 0;
  min-height: 36px;
}

.combat-stat-input:focus {
  outline: none;
  background: rgba(139, 69, 19, 0.1);
  border-radius: 4px;
}

.combat-stat-hint {
  font-size: 0.6rem;
  color: var(--sheet-muted);
  margin-top: 0.25rem;
}

/* ============================================
   PROFICIENCY DOTS
   ============================================ */

.proficiency-display {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

.proficiency-dots {
  display: flex;
  gap: 4px;
}

.proficiency-dot {
  width: 16px;
  height: 16px;
  border: 2px solid var(--sheet-border);
  border-radius: 50%;
  background: #fff;
}

.proficiency-dot.filled {
  background: var(--sheet-border);
}

/* ============================================
   TRAIT BOXES - 2x3 GRID
   ============================================ */

.traits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.trait-box {
  background: var(--input-bg);
  border: 2px solid var(--sheet-border);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
  position: relative;
  min-height: 100px;
}

.trait-box.spellcast {
  border-color: var(--sheet-accent);
  box-shadow: 0 0 0 2px rgba(139, 69, 19, 0.2);
}

.trait-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.trait-value-input {
  width: 50px;
  height: 36px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  margin: 0 auto 0.25rem;
  display: block;
}

.trait-value-input:focus {
  outline: none;
  border-color: var(--sheet-accent);
}

.trait-skills {
  font-size: 0.55rem;
  color: var(--sheet-muted);
  line-height: 1.3;
}

.spellcast-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--sheet-accent);
  color: #fff;
  font-size: 0.45rem;
  padding: 2px 4px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   DAMAGE THRESHOLDS - CORRECTED
   ============================================ */

.damage-info-text {
  font-size: 0.75rem;
  color: var(--sheet-muted);
  text-align: center;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.damage-thresholds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.threshold-item {
  background: var(--input-bg);
  border: 2px solid var(--sheet-border);
  border-radius: 4px;
  padding: 0.5rem;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.threshold-item.minor-info {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.threshold-item.major {
  border-color: #ff9800;
}

.threshold-item.severe {
  border-color: #f44336;
}

.threshold-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.threshold-description {
  font-size: 0.65rem;
  color: var(--sheet-muted);
  margin-bottom: 0.25rem;
}

.threshold-note {
  font-size: 0.6rem;
  color: var(--sheet-muted);
  font-style: italic;
}

.threshold-input {
  width: 60px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  padding: 0.25rem;
  font-family: inherit;
  margin: 0.25rem auto;
  display: block;
}

.threshold-calculated {
  font-size: 0.65rem;
  color: var(--sheet-accent);
  font-weight: 600;
}

/* ============================================
   RESOURCE ROWS (HP, STRESS, HOPE, ARMOR)
   ============================================ */

.resource-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  min-height: 44px;
}

.resource-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 55px;
}

.checkbox-slots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.resource-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sheet-muted);
  min-width: 35px;
}

/* ============================================
   CHECKBOX SLOTS - FIXED: Touch-friendly, no fill-all
   ============================================ */

.checkbox-slot {
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  border: 2px solid var(--sheet-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 0;
  /* Touch-friendly */
  min-width: var(--checkbox-size);
  min-height: var(--checkbox-size);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.checkbox-slot:hover,
.checkbox-slot:focus {
  border-color: var(--sheet-accent);
  outline: none;
}

.checkbox-slot.checked {
  background: var(--sheet-border);
}

.checkbox-slot.checked::after {
  content: '\2717'; /* X mark */
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
}

/* HP specific styling */
.checkbox-slot.hp {
  border-color: #c62828;
}

.checkbox-slot.hp.checked {
  background: #c62828;
}

/* Stress specific styling */
.checkbox-slot.stress {
  border-color: #7c4dff;
}

.checkbox-slot.stress.checked {
  background: #7c4dff;
}

/* Hope specific styling - Diamond shape */
.checkbox-slot.hope {
  border-color: #ffd700;
  border-radius: 0;
  transform: rotate(45deg);
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
}

.checkbox-slot.hope.checked {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.checkbox-slot.hope.checked::after {
  content: '';
}

/* Armor specific styling */
.checkbox-slot.armor {
  border-color: #607d8b;
  border-radius: 50%;
}

.checkbox-slot.armor.checked {
  background: #607d8b;
}

.checkbox-slot.armor.checked::after {
  content: '';
}

/* ============================================
   HOPE SECTION
   ============================================ */

.hope-slots {
  gap: 8px;
}

.hope-feature-section {
  margin-top: 0.75rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

.hope-feature-text {
  min-height: 80px;
  font-style: italic;
}

/* ============================================
   EXPERIENCES
   ============================================ */

.experiences-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.experience-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.experience-name {
  flex: 1;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  min-height: var(--touch-target-min);
}

.experience-modifier {
  width: 50px;
  text-align: center;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  padding: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  background: #fff;
  min-height: var(--touch-target-min);
}

.experience-remove {
  width: 36px;
  height: 36px;
  border: 1px solid #f44336;
  border-radius: 50%;
  background: transparent;
  color: #f44336;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-width: 36px;
}

.experience-remove:hover {
  background: #f44336;
  color: #fff;
}

.add-btn {
  background: rgba(76, 175, 80, 0.1);
  border: 1px dashed #4caf50;
  color: #4caf50;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
  min-height: var(--touch-target-min);
  width: 100%;
}

.add-btn:hover {
  background: rgba(76, 175, 80, 0.2);
}

/* ============================================
   WEAPON BLOCKS
   ============================================ */

.weapons-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.weapon-block {
  background: var(--input-bg);
  border: 1px solid var(--sheet-border);
  border-radius: 6px;
  padding: 0.75rem;
}

.weapon-block.primary {
  border-left: 4px solid var(--sheet-accent);
}

.weapon-block.secondary {
  border-left: 4px solid #607d8b;
}

.weapon-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.weapon-type-badge {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.1);
}

.weapon-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.weapon-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.weapon-field label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sheet-muted);
}

.weapon-field input {
  border: 1px solid var(--input-border);
  border-radius: 3px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  min-height: 32px;
}

.weapon-field input:focus {
  outline: none;
  border-color: var(--sheet-accent);
}

.weapon-field.full-width {
  grid-column: span 2;
}

.inventory-weapons-section {
  margin-top: 1rem;
}

.subsection-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  color: var(--sheet-muted);
}

/* ============================================
   ARMOR BLOCK
   ============================================ */

.armor-block {
  background: var(--input-bg);
  border: 1px solid var(--sheet-border);
  border-radius: 6px;
  padding: 0.75rem;
}

.armor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.armor-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.armor-field label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sheet-muted);
}

.armor-field input {
  border: 1px solid var(--input-border);
  border-radius: 3px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  min-height: 32px;
}

.armor-field input:focus {
  outline: none;
  border-color: var(--sheet-accent);
}

.armor-field.full-width {
  grid-column: span 2;
}

/* ============================================
   GOLD COUNTER - ODOMETER STYLE
   ============================================ */

.gold-counter {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gold-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gold-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 70px;
  color: var(--sheet-muted);
}

.gold-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gold-btn {
  width: 36px;
  height: 36px;
  border: 2px solid #d4a574;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  color: #8B4513;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-width: 36px;
  transition: all 0.15s ease;
}

.gold-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffd700, #d4a574);
  border-color: #8B4513;
}

.gold-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gold-value {
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  background: #fff;
  border: 2px solid #d4a574;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: #8B4513;
}

.gold-conversion-note {
  font-size: 0.65rem;
  color: var(--sheet-muted);
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* ============================================
   TEXT AREAS (CLASS FEATURES, NOTES, INVENTORY)
   ============================================ */

.text-area-field {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  background: #fff;
}

.text-area-field:focus {
  outline: none;
  border-color: var(--sheet-accent);
}

.text-area-field.large {
  min-height: 150px;
}

.class-features-text {
  white-space: pre-wrap;
}

/* ============================================
   FULL WIDTH SECTION
   ============================================ */

.sheet-full-width {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .sheet-full-width {
    padding: 1rem 2rem;
  }
}

/* ============================================
   FOOTER
   ============================================ */

.sheet-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.7rem;
  color: var(--sheet-muted);
  border-top: 1px solid var(--sheet-border);
}

/* ============================================
   SYNC INDICATOR
   ============================================ */

.sheet-sync-indicator {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: rgba(76, 175, 80, 0.95);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sheet-sync-indicator.visible {
  opacity: 1;
}

.sync-icon {
  font-size: 1rem;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 767px) {
  .class-banner {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1rem;
  }

  .class-banner-left {
    flex-direction: column;
    align-items: center;
  }

  .class-banner-right {
    align-items: center;
    margin-top: 0.75rem;
  }

  .header-fields-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .header-field input {
    width: 100%;
  }

  .traits-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .combat-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .combat-stats-row .combat-stat:nth-child(3) {
    grid-column: span 2;
  }

  .damage-thresholds {
    grid-template-columns: 1fr;
  }

  .weapon-fields {
    grid-template-columns: 1fr;
  }

  .weapon-field.full-width {
    grid-column: span 1;
  }

  .armor-fields {
    grid-template-columns: 1fr;
  }

  .armor-field.full-width {
    grid-column: span 1;
  }

  /* Larger touch targets on mobile */
  .checkbox-slot {
    width: var(--checkbox-size-mobile);
    height: var(--checkbox-size-mobile);
    min-width: var(--checkbox-size-mobile);
    min-height: var(--checkbox-size-mobile);
  }

  .checkbox-slot.hope {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .gold-btn {
    width: 44px;
    height: 44px;
  }
}

/* ============================================
   DARK MODE
   ============================================ */

.character-sheet-form.dark-mode {
  --sheet-bg: #1a1a2e;
  --sheet-border: #3d3d5c;
  --sheet-text: #e0e0e0;
  --sheet-muted: #999;
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: #4a4a6a;
  --section-bg: rgba(255, 255, 255, 0.05);
  --section-header-bg: rgba(255, 255, 255, 0.05);
}

.character-sheet-form.dark-mode input,
.character-sheet-form.dark-mode textarea {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.character-sheet-form.dark-mode input::placeholder,
.character-sheet-form.dark-mode textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.character-sheet-form.dark-mode .checkbox-slot {
  background: rgba(255, 255, 255, 0.1);
}

/* Dark mode checked states - must override base dark mode background */
.character-sheet-form.dark-mode .checkbox-slot.checked {
  background: var(--sheet-border);
}

.character-sheet-form.dark-mode .checkbox-slot.hp.checked {
  background: #c62828;
}

.character-sheet-form.dark-mode .checkbox-slot.stress.checked {
  background: #7c4dff;
}

.character-sheet-form.dark-mode .checkbox-slot.hope.checked {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
}

.character-sheet-form.dark-mode .checkbox-slot.armor.checked {
  background: #607d8b;
}

.character-sheet-form.dark-mode .gold-value {
  background: rgba(255, 255, 255, 0.1);
}

.character-sheet-form.dark-mode .gold-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(212, 165, 116, 0.3));
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  /* Hide UI chrome */
  .print-btn,
  .sheet-sync-indicator,
  .collapse-icon,
  .add-btn,
  .experience-remove,
  .portrait-overlay,
  .portrait-modal {
    display: none !important;
  }

  /* Reset page */
  body {
    background: #fff !important;
    margin: 0;
    padding: 0;
  }

  .character-sheet-form {
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    font-size: 10pt;
  }

  /* Force two-column layout */
  .sheet-body {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }

  /* Show all collapsible sections */
  .collapsible-section .section-content {
    display: block !important;
  }

  /* Page settings */
  @page {
    size: letter;
    margin: 0.5in;
  }

  /* Prevent page breaks inside sections */
  .sheet-section {
    page-break-inside: avoid;
  }

  /* Class banner colors */
  .class-banner {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Checkbox styling for print */
  .checkbox-slot {
    border: 1.5pt solid #000 !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .checkbox-slot.checked {
    background: #000 !important;
  }

  .checkbox-slot.checked::after {
    color: #fff !important;
  }

  /* Input styling for print */
  input,
  textarea {
    border: none !important;
    border-bottom: 1px solid #999 !important;
    background: transparent !important;
    padding: 2pt !important;
  }

  /* Gold display for print */
  .gold-btn {
    display: none !important;
  }

  .gold-value {
    border: 1pt solid #000 !important;
  }

  /* Footer */
  .sheet-footer {
    margin-top: 1rem;
  }
}

/* ============================================
   BACKGROUND SECTION
   ============================================ */

.background-questions {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.dark-mode .background-questions {
  background: rgba(255, 255, 255, 0.05);
}

.questions-label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--sheet-muted);
}

.questions-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.questions-list li {
  margin-bottom: 0.35rem;
}

/* ============================================
   CONNECTIONS SECTION
   ============================================ */

.connections-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.connection-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.connection-question {
  font-size: 0.85rem;
  font-weight: 600;
  font-style: italic;
  color: var(--sheet-accent);
}

.dark-mode .connection-question {
  color: #b388ff;
}

.connection-answer {
  min-height: 60px;
  resize: vertical;
}

/* ============================================
   BEASTFORMS SECTION (DRUID)
   ============================================ */

.beastform-tier {
  margin-bottom: 1.5rem;
}

.beastform-tier:last-child {
  margin-bottom: 0;
}

.tier-header {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--color-druid);
  color: var(--color-druid);
}

.dark-mode .tier-header {
  color: #8fbc8f;
  border-color: #8fbc8f;
}

.beastform-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.beastform-card {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.85rem;
}

.dark-mode .beastform-card {
  background: rgba(45, 90, 61, 0.1);
  border-color: rgba(45, 90, 61, 0.3);
}

.beastform-header {
  margin-bottom: 0.5rem;
}

.beastform-header strong {
  font-size: 0.95rem;
  color: var(--color-druid);
}

.dark-mode .beastform-header strong {
  color: #8fbc8f;
}

.beastform-examples {
  font-size: 0.75rem;
  color: var(--sheet-muted);
  font-style: italic;
  margin-left: 0.5rem;
}

.beastform-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.beastform-stats span {
  background: rgba(0, 0, 0, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}

.dark-mode .beastform-stats span {
  background: rgba(255, 255, 255, 0.05);
}

.beastform-advantages {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.beastform-advantages strong {
  color: var(--sheet-accent);
}

.beastform-features {
  font-size: 0.8rem;
  line-height: 1.5;
}

.beastform-feature {
  margin-bottom: 0.35rem;
}

.beastform-feature strong {
  color: var(--color-druid);
}

.dark-mode .beastform-feature strong {
  color: #8fbc8f;
}

/* ============================================
   COMPANION SECTION (RANGER)
   ============================================ */

.companion-sheet {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.companion-header {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.companion-field {
  flex: 1;
  min-width: 200px;
}

.companion-field label,
.companion-stat label,
.companion-attack label,
.companion-experiences label,
.companion-training label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
  color: var(--color-ranger);
}

.dark-mode .companion-field label,
.dark-mode .companion-stat label,
.dark-mode .companion-attack label,
.dark-mode .companion-experiences label,
.dark-mode .companion-training label {
  color: #d2691e;
}

.companion-stat {
  width: 80px;
}

.companion-stat input {
  text-align: center;
  width: 100%;
}

.companion-stress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.dark-mode .companion-stress {
  background: rgba(255, 255, 255, 0.05);
}

.companion-stress .resource-label {
  min-width: 120px;
}

.companion-attack-fields {
  display: flex;
  gap: 0.5rem;
}

.companion-attack-fields .text-input-field.small {
  width: 80px;
}

.companion-experiences textarea,
.companion-training textarea {
  min-height: 60px;
  resize: vertical;
}

/* ============================================
   MOBILE STYLES FOR NEW SECTIONS
   ============================================ */

@media screen and (max-width: 600px) {
  .beastform-cards {
    grid-template-columns: 1fr;
  }

  .companion-header {
    flex-direction: column;
  }

  .companion-field {
    width: 100%;
    min-width: unset;
  }

  .companion-stat {
    width: 100%;
  }

  .companion-attack-fields {
    flex-direction: column;
  }

  .companion-attack-fields .text-input-field.small {
    width: 100%;
  }

  .companion-stress {
    flex-wrap: wrap;
  }
}

/* ============================================
   ANCESTRY SECTION
   ============================================ */

.ancestry-description {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--sheet-muted);
  margin-bottom: 1rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.dark-mode .ancestry-description {
  background: rgba(255, 255, 255, 0.03);
}

.ancestry-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ancestry-features-note,
.community-features-note {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--sheet-muted);
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.dark-mode .ancestry-features-note,
.dark-mode .community-features-note {
  background: rgba(255, 255, 255, 0.03);
}

/* Feature Cards (shared for ancestry and community) */
.feature-card {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 0.75rem;
}

.dark-mode .feature-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.feature-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sheet-accent);
  margin-bottom: 0.35rem;
}

.dark-mode .feature-name {
  color: #ffd700;
}

.feature-source {
  font-size: 0.8rem;
  font-weight: 400;
  font-style: italic;
  color: var(--sheet-muted);
}

.feature-description {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--sheet-text);
}

/* ============================================
   COMMUNITY SECTION
   ============================================ */

.community-feature {
  margin-bottom: 1rem;
}

.community-adjectives {
  padding-top: 0.75rem;
}

.adjectives-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  color: var(--sheet-muted);
}

.adjective-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.adjective-tag {
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  color: var(--sheet-text);
}

.dark-mode .adjective-tag {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   STARTING INVENTORY SECTION
   ============================================ */

.inventory-group {
  margin-bottom: 1rem;
}

.inventory-group:last-child {
  margin-bottom: 0;
}

.inventory-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
  color: var(--sheet-muted);
}

.inventory-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.inventory-list li {
  margin-bottom: 0.25rem;
}

.inventory-item {
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
}

.dark-mode .inventory-item {
  background: rgba(255, 255, 255, 0.05);
}

.potion-item {
  color: #2e7d32;
  background: rgba(46, 125, 50, 0.1);
  border-left: 3px solid #2e7d32;
}

.dark-mode .potion-item {
  color: #81c784;
  background: rgba(46, 125, 50, 0.15);
}

.flavor-item {
  color: var(--sheet-accent);
  background: rgba(139, 69, 19, 0.1);
  border-left: 3px solid var(--sheet-accent);
}

.dark-mode .flavor-item {
  color: #daa520;
  background: rgba(218, 165, 32, 0.15);
  border-left-color: #daa520;
}

.focus-item {
  color: #5e35b1;
  background: rgba(94, 53, 177, 0.1);
  border-left: 3px solid #5e35b1;
}

.dark-mode .focus-item {
  color: #b388ff;
  background: rgba(179, 136, 255, 0.15);
  border-left-color: #b388ff;
}

/* ============================================
   MOBILE STYLES FOR NEW SECTIONS
   ============================================ */

@media screen and (max-width: 600px) {
  .adjective-tags {
    gap: 0.35rem;
  }

  .adjective-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }

  .feature-card {
    padding: 0.6rem;
  }

  .feature-name {
    font-size: 0.9rem;
  }

  .feature-description {
    font-size: 0.8rem;
  }
}
