/* Spirits and Spellcraft — Character Sheet styles (paste into WP Coder's CSS field) */

#character-sheet {
  max-width: 800px;
  margin: 0 auto;
  font-family: inherit;
  color: inherit;
}

#character-sheet * {
  box-sizing: border-box;
}

/* Step indicator */
#step-indicator {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 1.5em;
  padding-bottom: 0.75em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.step-label {
  font-size: 0.85em;
  padding: 4px 8px;
  border-radius: 4px;
  color: rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  cursor: pointer;
}

.step-label:hover {
  background: rgba(20, 120, 168, 0.12);
  color: rgba(0, 0, 0, 0.75);
}

.step-label.active {
  color: #fff;
  background: #1478a8;
  font-weight: 600;
}

.step-label.active:hover {
  background: #1478a8;
}

.step-divider {
  color: rgba(0, 0, 0, 0.3);
}

/* Account panel (login state + My Characters list), populated by renderAccountPanel() */
#account-bar {
  margin-bottom: 1em;
  font-size: 0.9em;
}

#account-bar:empty {
  margin-bottom: 0;
}

#account-bar p {
  margin: 0 0 0.5em;
}

#account-bar select {
  max-width: 300px;
  margin-right: 0.5em;
  padding: 0.4em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

#account-bar button {
  padding: 0.4em 0.9em;
  margin-right: 0.5em;
  border: 1px solid #1478a8;
  border-radius: 4px;
  background: #fff;
  color: #1478a8;
  font-weight: 600;
  cursor: pointer;
}

#account-bar button:hover {
  background: #1478a8;
  color: #fff;
}

#save-account-status {
  font-size: 0.9em;
  font-style: italic;
}

/* Load character bar */
#load-character-bar {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 1.5em;
  font-size: 0.9em;
}

/* Randomize Character button (Basic Info step) — the Class/Level mirrors above the button are
   deliberately styled small and inline (rather than the full-width stacked look every other field
   on this step uses) so they read as an optional quick-pick, not a required field you have to
   fill in before you can use the button. */
#randomize-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 0.75em;
  margin-bottom: 1.5em;
  padding-bottom: 1.5em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

#randomize-bar label {
  display: inline;
  margin: 0;
  font-weight: 400;
  font-size: 0.85em;
  color: rgba(0, 0, 0, 0.55);
}

#randomize-bar select,
#randomize-bar input[type="number"] {
  width: auto;
  max-width: 140px;
  padding: 0.35em 0.5em;
  font-size: 0.9em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  background: #fff;
}

#randomize-bar input#char-level-top {
  max-width: 65px;
}

#btn-randomize-character {
  padding: 0.6em 1.2em;
  border: 1px solid #1478a8;
  border-radius: 4px;
  background: #1478a8;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#btn-randomize-character:hover {
  background: #0e5a7d;
}

#randomize-hint {
  flex-basis: 100%;
  margin: 0.5em 0 0;
  font-size: 0.85em;
  color: rgba(0, 0, 0, 0.6);
}

/* Character portrait (Basic Info step) */
#char-portrait-preview-wrap {
  display: flex;
  align-items: center;
  gap: 0.75em;
  margin: 0.5em 0 1.5em;
}

#char-portrait-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  object-fit: cover;
}

#btn-remove-portrait {
  padding: 0.4em 0.8em;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

#btn-remove-portrait:hover {
  border-color: #a33;
  color: #a33;
}

/* Steps / form fields */
.step {
  padding: 0.5em 0 1.5em;
}

.step h2 {
  margin-top: 0;
}

.step label {
  display: block;
  margin-top: 1em;
  margin-bottom: 0.25em;
  font-weight: 600;
  font-size: 0.9em;
}

.step input[type="text"],
.step input[type="number"],
.step select {
  width: 100%;
  max-width: 400px;
  padding: 0.5em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  font-size: 1em;
  background: #fff;
}

.step input[readonly] {
  background: rgba(0, 0, 0, 0.05);
  color: inherit;
}

.step input[type="number"] {
  max-width: 120px;
}

/* Standard Array's per-stat dropdown replaces the number input above — keep it narrow like the
   input it replaces so the modifier span still sits on the same line instead of wrapping. */
.step select.array-ability-select {
  max-width: 160px;
}

/* Buttons (nav, mode, add/remove) */
.step button,
#step-nav button {
  padding: 0.5em 1.2em;
  margin-top: 0.5em;
  margin-right: 0.5em;
  border: 1px solid #1478a8;
  border-radius: 4px;
  background: #fff;
  color: #1478a8;
  font-weight: 600;
  cursor: pointer;
}

.step button:hover,
#step-nav button:hover {
  background: #1478a8;
  color: #fff;
}

#step-nav {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
}

/* Ability score mode selector */
#ability-mode-selector {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

.mode-btn {
  padding: 0.5em 1em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.mode-btn.active {
  background: #1478a8;
  border-color: #1478a8;
  color: #fff;
}

#pointbuy-remaining {
  font-size: 0.9em;
}

/* ASI section */
#asi-section {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 1px solid rgba(0, 0, 0, 0.15);
}

.asi-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.75em;
}

.asi-row label {
  margin: 0;
  min-width: 220px;
}

/* Class Abilities */
#class-abilities-container {
  margin-top: 0.5em;
}

.class-ability {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 0.75em 1em;
  margin-bottom: 0.75em;
  background: rgba(0, 0, 0, 0.02);
}

.class-ability h4 {
  margin: 0 0 0.35em;
}

.class-ability p {
  margin: 0 0 0.5em;
  font-size: 0.92em;
  line-height: 1.4;
}

.class-choice-select,
.class-choice-text {
  display: inline-block;
  margin: 0.25em 0.5em 0.25em 0;
  padding: 0.4em;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.class-choice-row {
  margin: 0.25em 0;
}

.class-choice-warning {
  margin: 0.25em 0 0.5em;
  font-size: 0.85em;
  color: #b3261e;
  line-height: 1.35;
}

.class-choice-desc {
  margin: 0.25em 0 0.5em;
  font-size: 0.85em;
  color: rgba(0, 0, 0, 0.65);
  line-height: 1.35;
}

.pick-list {
  margin: 0.25em 0 0 1.25em;
  padding: 0;
}

.pick-list li {
  font-size: 0.92em;
  margin-bottom: 0.2em;
}

/* Weapons */
#weapon-list {
  margin-top: 1em;
}

.weapon-card {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 0.75em 1em;
  margin-bottom: 0.75em;
}

.weapon-card h4 {
  margin: 0 0 0.5em;
}

.weapon-card ul {
  margin: 0.5em 0;
  padding-left: 1.2em;
}

.fighting-style-select {
  margin-right: 0.5em;
}

.btn-remove-weapon,
.btn-remove-style,
.btn-level-up {
  font-size: 0.85em;
  padding: 0.3em 0.7em;
}

/* Skills */
#skill-groups-container {
  margin-top: 1em;
}

.skill-group {
  margin-bottom: 1.25em;
}

.skill-group h3 {
  margin-bottom: 0.4em;
  font-size: 1em;
}

.skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  margin-bottom: 0.3em;
}

.skill-btn {
  flex: 1;
  text-align: left;
  padding: 0.4em 0.7em;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.skill-btn.skill-untrained {
  color: rgba(0, 0, 0, 0.6);
}

.skill-btn.skill-proficient {
  background: #e6f2f6;
  border-color: #1478a8;
  color: #0e5a7d;
}

.skill-btn.skill-expert {
  background: #fbeef3;
  border-color: #d65384;
  color: #9a3c5f;
  font-weight: 600;
}

.skill-btn.skill-disabled {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.35);
  cursor: not-allowed;
}

.skill-dice {
  font-size: 0.85em;
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

/* Spells */
#spell-preview {
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  padding: 1em;
  margin-top: 1em;
  background: rgba(0, 0, 0, 0.02);
}

.spell-card {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 0.75em 1em;
  margin-bottom: 0.75em;
}

.spell-card p {
  font-size: 0.9em;
  margin: 0.5em 0 0;
}

/* Equipment */
.equipment-weapon-slot {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 0.75em 1em;
  margin-bottom: 0.75em;
}

.equipment-weapon-type,
.equipment-weapon-item,
.equipment-implement {
  margin-right: 0.5em;
  margin-bottom: 0.5em;
}

/* Review step */
#review-summary h3 {
  margin-top: 1.25em;
  margin-bottom: 0.4em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

#review-summary ul {
  margin: 0 0 0.5em;
  padding-left: 1.2em;
}

#review-summary li {
  margin-bottom: 0.2em;
  font-size: 0.92em;
}

/* Defines the physical printable area so fitPrintSheetToPage()'s page-height guess (see script.js)
   lines up with what actually prints — Letter, 0.4in margins. Adjust both together if you change this. */
@page {
  size: letter;
  margin: 0.4in;
}

/* Print-only character sheet (built by renderPrintSheet()). Clamped to height:0/overflow:hidden
   rather than display:none so fitPrintSheetToPage() can still measure its real content height —
   scrollHeight reports the full (clipped) content height even at height:0, and this avoids the
   scrollbar/layout side effects that position:absolute + a huge negative offset can cause on the
   live page. Width is fixed to match the printable page width (Letter minus 0.4in margins) so
   text wrapping/columns measure the same while hidden as they will on paper.
   --ps-scale is set by fitPrintSheetToPage() right before printing to shrink everything (every
   font-size in this section is relative to it) until it fits one page, or as close as it can get. */
#print-sheet {
  width: 7.7in;
  height: 0;
  overflow: hidden;
  color: #000;
  background: #fff;
  --ps-scale: 1;
  font-size: calc(10px * var(--ps-scale));
  line-height: 1.25;
}

.ps-header {
  border-bottom: 2px solid #000;
  padding-bottom: 0.15em;
  margin-bottom: 0.3em;
}

.ps-header h1 {
  margin: 0;
  font-size: 1.6em;
}

.ps-header-meta {
  font-size: 1em;
}

/* Page 1: two side-by-side column rows (Abilities | HP/MP/Defenses, then Weapons+Class
   Abilities | Skills). Page 2 (.ps-page-2) forces a page break and runs full width. */
.ps-row-cols2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1.2em;
  align-items: start;
}

.ps-col {
  min-width: 0;
}

.ps-abilities-col,
.ps-stats-col {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 2px 6px;
}

.ps-ability-row,
.ps-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 1px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

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

.ps-ability-label,
.ps-stat-label {
  font-weight: 700;
}

.ps-ability-score {
  font-weight: 700;
}

.ps-ability-mod {
  min-width: 2em;
  text-align: right;
}

.ps-stat-value {
  font-weight: 700;
}

.ps-stat-note {
  margin-top: 0.25em;
  font-size: 0.95em;
}

.ps-section {
  margin-bottom: 0.35em;
  break-inside: avoid-column;
}

.ps-section h2 {
  font-size: 1em;
  margin: 0 0 0.15em;
  padding-bottom: 0.1em;
  border-bottom: 1px solid #000;
}

.ps-subheading {
  font-size: 0.95em;
  margin: 0.3em 0 0.1em;
}

.ps-weapon-line,
.ps-maneuver {
  break-inside: avoid;
  font-size: 0.95em;
  margin-bottom: 0.1em;
}

.ps-columns {
  column-count: 2;
  column-gap: 1.2em;
}

.ps-columns h2 {
  column-span: all;
}

/* Single column, full height — no artificial column split, so the list just runs as long as it
   needs to and fills whatever vertical space the sibling column (Weapons/Class Abilities) takes. */
.ps-skills-columns {
  border: 1px solid #000;
  border-radius: 4px;
  padding: 2px 6px;
}

.ps-skill-group h3 {
  margin-top: 0.3em;
}

.ps-skill-group:first-child h3 {
  margin-top: 0;
}

.ps-skill-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5em;
  break-inside: avoid;
  font-size: 0.95em;
  padding: 1px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

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

.ps-skill-dice {
  white-space: nowrap;
  font-weight: 700;
}

.ps-skill-line.ps-skill-proficient {
  font-weight: 600;
}

.ps-skill-line.ps-skill-expert {
  font-weight: 700;
}

.ps-skill-line.ps-skill-disabled {
  color: rgba(0, 0, 0, 0.45);
}

.ps-feature,
.ps-spell {
  break-inside: avoid-column;
  margin-bottom: 0.3em;
}

.ps-feature h3,
.ps-spell h3 {
  font-size: 0.95em;
  margin: 0 0 0.1em;
}

.ps-feature p,
.ps-spell p {
  margin: 0 0 0.15em;
}

.ps-picks {
  margin: 0.1em 0 0.3em;
}

.ps-pick {
  font-size: 0.85em;
  margin-bottom: 0.15em;
}

.ps-background-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 1em;
}

/* Only forced when fitPrintSheetToPage() (script.js) determines everything can't be shrunk to
   fit one page even at the minimum readable scale — otherwise this section just flows normally
   right after page 1's content, all on the same page. */
.ps-page-2.ps-force-break {
  break-before: page;
  page-break-before: always;
}

/* Print: bypass ads/theme chrome entirely by hiding the whole page and
   showing only the character sheet, then swap the interactive UI for the
   dense print-only layout. */
@media print {
  body * {
    visibility: hidden;
  }

  #character-sheet,
  #character-sheet * {
    visibility: visible;
  }

  #character-sheet {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }

  #step-indicator,
  #account-bar,
  #load-character-bar,
  #randomize-bar,
  #step-nav,
  .step {
    display: none !important;
  }

  #print-sheet {
    height: auto !important;
    overflow: visible !important;
  }
}
