/* ========== SHARED STYLES FOR D&S QUIZ AND CHARACTER SHEET ========== */

/* ── Color Palette ── */
:root {
  --navy: #1e2d4a;
  --navy-mid: #2a3a5c;
  --gold: #b8922a;
  --gold-lt: #d4a843;
  --parchment: #f5edd8;
  --parchment-dk: #e8d9b8;
  --parchment-dkr: #d4c098;
  --ink: #1a140a;
  --ink-mid: #3a2e1a;
  --ink-lt: #6b5a3a;
  --rule: #c8b080;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ========== QUIZ STYLES (index.html) ========== */

body.quiz-page {
  font-family: Georgia, 'Times New Roman', serif;
  background: #faf8f4;
  color: #1a1a18;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem;
}

body.sheet-page {
  background: #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
  font-family: 'Crimson Text', Georgia, serif;
  color: var(--ink);
}

.container {
  width: 100%;
  max-width: 640px;
}

/* ── Header ── */
.site-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.site-header .brand {
  display: inline-block;
  max-height: 60px;
  width: 100%;
  margin-bottom: 1.5rem;
  filter: brightness(0.125);
}
.site-header h1 {
  font-size: 24px;
  font-weight: normal;
  color: #1a1a18;
  line-height: 1.35;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  margin-top: 4rem;
  border-top: 1px solid #e0ddd6;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  color: #666;
}
.site-footer a {
  color: #1a1a18;
  text-decoration: none;
  border-bottom: 1px solid #1a1a18;
  transition: opacity 0.15s;
}
.site-footer a:hover {
  opacity: 0.7;
}

/* ── Result Button ── */
.result-btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 10px 24px;
  background: #1a1a18;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
}
.result-btn:hover {
  opacity: 0.85;
}
.result-btn:active {
  opacity: 0.7;
}

/* ── Progress ── */
.progress-bar {
  height: 2px;
  background: #e0ddd6;
  border-radius: 2px;
  margin-bottom: 2.5rem;
}
.progress-fill {
  height: 100%;
  background: #1a1a18;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Question ── */
.q-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 0.6rem;
  font-family: system-ui, sans-serif;
}
.q-text {
  font-size: 21px;
  line-height: 1.5;
  color: #1a1a18;
  margin-bottom: 2rem;
}

/* Question content wrapper for fade animations */
.quiz-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.quiz-content.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* ── Options ── */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 2rem;
}
.opt-btn {
  background: #fff;
  border: 1px solid #dddad3;
  border-radius: 8px;
  padding: 14px 18px;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  font-family: Georgia, serif;
  color: #1a1a18;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}
.opt-btn:hover {
  background: #f5f2ec;
  border-color: #bbb;
}
.opt-btn.selected {
  background: #f5f2ec;
  border-color: #1a1a18;
}

/* ── Nav ── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-btn {
  background: transparent;
  border: 1px solid #dddad3;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 14px;
  font-family: system-ui, sans-serif;
  color: #666;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-btn:hover:not(:disabled) { background: #f5f2ec; }
.nav-btn:disabled { opacity: 0.3; cursor: default; }
.nav-btn.primary {
  border-color: #1a1a18;
  color: #1a1a18;
  font-weight: 500;
}
.q-count {
  font-size: 13px;
  color: #aaa;
  font-family: system-ui, sans-serif;
}

/* ── Result: card front ── */
.card-front {
  background: #fff;
  border: 6px solid #2a3a5c;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1rem;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}
.card-front-header {
  text-align: center;
  padding: 0.9rem 1rem 0.6rem;
  background: #fff;
}
.card-front-name {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 0.04em;
  color: #1a1a18;
  text-transform: uppercase;
}
.card-front-play {
  font-size: 14px;
  font-style: italic;
  color: #555;
  margin-top: 2px;
}
.card-front-img {
  width: 100%;
  background: #ede9e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  gap: 10px;
  border-bottom: 1px solid #dddad3;
}
.card-front-img svg { opacity: 0.25; }
.card-front-desc {
  padding: 0.9rem 1.1rem;
  font-size: 15px;
  line-height: 1.55;
  color: #333;
  text-align: center;
}
.card-front-footer {
  background: #2a3a5c;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-front-footer .brand-text {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
}
.card-front-footer .brand-script {
  font-size: 15px;
  font-style: italic;
  color: #fff;
  font-family: Georgia, serif;
}

/* ── Result: hero section ── */
.result-hero {
  margin-bottom: 2.5rem;
}
.result-hero-img {
  width: 300px;
  max-width: 100%;
  float: left;
  margin: 0 1.5rem 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dddad3;
}
.result-hero-img img {
  width: 100%;
  height: auto;
  display: block;
}
.result-hero::after {
  content: '';
  display: table;
  clear: both;
}
.result-hero-text h2 {
  font-size: 28px;
  font-weight: normal;
  line-height: 1.25;
  margin-bottom: 0.25rem;
  color: #1a1a18;
}
.result-hero-text h2 + p {
    margin-bottom: 1.5rem;
}
.result-hero-text h3 + p {
    margin-bottom: 1.5rem;
}
.result-hero-text .subtitle {
  font-style: italic;
  color: #666;
  font-size: 15px;
  margin-bottom: 0.75rem;
}
.result-hero-text .play-line {
  font-size: 14px;
  color: #555;
  margin-bottom: 1rem;
}
.result-hero-text .description {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: #333;
}
.result-hero-text .about-you-heading {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 0.75rem;
}
.result-hero-text .archetype {
  font-family: Georgia, serif;
  font-size: 14px;
  line-height: 1.6;
  color: #1a140a;
}

/* ── Result: content sections ── */
.result-section {
  margin-bottom: 2.5rem;
}
.result-section-heading {
  font-size: 22px;
  font-weight: normal;
  margin-bottom: 1rem;
  color: #1a1a18;
}
.result-section p {
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  margin-bottom: 0.75rem;
}
.result-section a {
  color: #1a5f7a;
  text-decoration: none;
}
.result-section a:hover {
  text-decoration: underline;
}
.cards{
    width:100%;
}

/* ── Share text container ── */
.share-text-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}
.share-text-input {
  flex: 1;
  border: 1px solid #dddad3;
  border-radius: 6px;
  padding: 0.75rem;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  color: #333;
  background: #fff;
}
.share-text-input:focus {
  outline: none;
  border-color: #1a1a18;
}
.share-copy-btn {
  background: #1a1a18;
  color: #faf8f4;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.25rem;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.share-copy-btn:hover {
  opacity: 0.82;
}

/* ── Result: card back ── */
.card-back {
  background: #f5edd8;
  border: 6px solid #2a3a5c;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}
.card-back-header {
  background: #fff;
  text-align: center;
  padding: 0.8rem 1rem 0.6rem;
  border-bottom: 3px solid #2a3a5c;
}
.card-back-name {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1a1a18;
}
.card-back-body { padding: 1rem 1.1rem 1.1rem; }
.card-back-classrow {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.card-back-class {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #2a3a5c;
  padding: 3px 10px;
  border-radius: 4px;
}
.card-back-alignment {
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #2a3a5c;
  padding: 3px 10px;
  border-radius: 4px;
}
.card-back-traits {
  font-size: 14px;
  font-style: italic;
  text-align: center;
  color: #444;
  margin-bottom: 0.8rem;
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  text-align: center;
  gap: 4px;
  margin-bottom: 0.8rem;
}
.stat-box { display: flex; flex-direction: column; gap: 1px; }
.stat-label {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #1a1a18;
}
.stat-val {
  font-family: system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #333;
}
.card-back-meta {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: #444;
  line-height: 1.7;
  margin-bottom: 0.6rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
}
.card-back-meta span { display: block; }
.card-back-meta strong { color: #1a1a18; }
.card-back-divider {
  border: none;
  border-top: 1px solid #c8b99a;
  margin: 0.6rem 0;
}
.card-back-skills {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: #333;
  line-height: 1.6;
  margin-bottom: 0.4rem;
}
.card-back-skills strong { color: #1a1a18; }
.card-back-details {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: #333;
  line-height: 1.65;
}
.card-back-details strong { color: #1a1a18; }

/* ── Welcome section ── */
.welcome-section {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  display: flex;
  gap: 3rem;
  align-items: stretch;
}
.welcome-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.welcome-title {
  font-size: 22px;
  font-weight: normal;
  color: #1a1a18;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.welcome-sub {
  font-size: 15px;
  color: #666;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.form-group {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
}
.form-group label {
  font-size: 14px;
  font-family: system-ui, sans-serif;
  color: #1a1a18;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-group input {
  border: 1px solid #dddad3;
  border-radius: 6px;
  padding: 11px 13px;
  font-size: 15px;
  font-family: Georgia, serif;
  background: #faf8f4;
  color: #1a1a18;
  transition: border-color 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: #1a1a18;
  background: #fff;
}
.checkbox-group {
  display: flex;
  gap: 10px;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}
.checkbox-group input[type="checkbox"] {
  margin-top: 4px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.checkbox-label {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.privacy-text {
  font-size: 13px;
  color: #888;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.start-btn {
  background: #1a1a18;
  color: #faf8f4;
  border: none;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 15px;
  font-family: system-ui, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  align-self: flex-start;
}
.start-btn:hover { opacity: 0.82; }
.start-btn:disabled { opacity: 0.4; cursor: default; }

.welcome-cards {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 200px;
  height: 280px;
  perspective: 1000px;
}
.card-stack {
  position: relative;
  width: 140px;
  height: 200px;
}
.stacked-card {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background-size: cover;
  background-position: center;
}
.stacked-card:nth-child(1) {
  transform: rotate(-15deg) translateY(-53px) translateX(-8px);
  z-index: 3;
}
.stacked-card:nth-child(2) {
  transform: rotate(-12deg) translateY(286px) translateX(-61px);
  z-index: 2;
}
.stacked-card:nth-child(3) {
  transform: rotate(23deg) translateY(105px) translateX(74px);
  z-index: 1;
}

.hidden { display: none; }

/* ========== CHARACTER SHEET STYLES (character-sheet.html) ========== */

/* ── Print controls (screen only) ── */
.screen-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 1.5rem;
  align-items: center;
}
.btn-print {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 24px;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-print:hover { background: var(--gold-lt); }
.screen-note {
  font-family: 'Crimson Text', serif;
  font-size: 14px;
  color: #aaa;
  font-style: italic;
}

/* ── Sheet wrapper ── */
.sheet {
  width: 8.5in;
  height: 11in;
  background: var(--parchment);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

/* Aged parchment texture overlay */
.sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 20%, rgba(180,140,60,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 80%, rgba(140,100,40,0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(200,160,80,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Hide decorative elements on page 1 */
.sheet .border-frame,
.sheet .corner {
  display: none;
}

/* Navy border frame */
.border-frame {
  position: absolute;
  inset: 0.35in;
  border: 3px solid var(--navy);
  pointer-events: none;
  z-index: 1;
}
.border-frame::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--gold);
  pointer-events: none;
}

.content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Corner ornaments */
.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  z-index: 2;
}
.corner svg { width: 28px; height: 28px; }
.corner-tl { top: calc(0.35in - 14px); left: calc(0.35in - 14px); }
.corner-tr { top: calc(0.35in - 14px); right: calc(0.35in - 14px); transform: scaleX(-1); }
.corner-bl { bottom: calc(0.35in - 14px); left: calc(0.35in - 14px); transform: scaleY(-1); }
.corner-br { bottom: calc(0.35in - 14px); right: calc(0.35in - 14px); transform: scale(-1,-1); }

/* All content sits inside the frame */
.content {
  position: relative;
  z-index: 2;
  padding: 0.6in 0.6in 0.5in;
}

/* ── Sheet header ── */
.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.18in;
  padding-bottom: 0.14in;
  border-bottom: 2px solid var(--navy);
}
.header-left { flex: 1; }
.brand-line {
  font-family: 'Cinzel', serif;
  font-size: 9pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-mid);
  margin-bottom: 4px;
}
.char-name {
  font-family: 'Cinzel', serif;
  font-size: 26pt;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1;
  letter-spacing: 0.04em;
}
.char-play {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 13pt;
  color: var(--ink-lt);
  margin-top: 2px;
}
.header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.class-badge {
  background: var(--navy);
  color: #fff;
  font-family: 'Cinzel', serif;
  font-size: 8.5pt;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 3px;
}
.alignment-badge {
  background: var(--parchment-dk);
  color: var(--ink-mid);
  font-family: 'Cinzel', serif;
  font-size: 8pt;
  letter-spacing: 0.05em;
  padding: 2px 10px;
  border: 1px solid var(--rule);
  border-radius: 3px;
}
.challenge-tag {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink-lt);
  font-style: italic;
}

/* ── Main grid ── */
.main-grid {
  display: grid;
  grid-template-columns: 1.4in 1fr;
  gap: 0.18in;
  margin-bottom: 0.16in;
}

/* ── Stat column ── */
.stat-col { display: flex; flex-direction: column; gap: 0.1in; }

/* Character image */
.char-image-container {
  width: 100%;
  aspect-ratio: 1;
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.stats-block {
  background: var(--navy);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 8px 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 4px;
}
.stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--parchment);
  border-radius: 3px;
  padding: 4px 2px;
}
.stat-name {
  font-family: 'Cinzel', serif;
  font-size: 6pt;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--navy);
}
.stat-val {
  font-family: 'Cinzel', serif;
  font-size: 15pt;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.combat-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.combat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 4px;
}
.combat-row:last-child { border-bottom: none; padding-bottom: 0; }
.combat-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
  font-weight: 700;
}
.combat-val {
  font-family: 'Crimson Text', serif;
  font-size: 10pt;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

/* HP tracker */
.hp-tracker {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 8px;
}
.hp-tracker-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
  font-weight: 700;
  margin-bottom: 4px;
}
.hp-max {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink-lt);
  font-style: italic;
  margin-bottom: 6px;
}
.hp-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.hp-box {
  width: 12px;
  height: 12px;
  border: 1px solid var(--navy-mid);
  border-radius: 2px;
  background: transparent;
}

/* ── Right column ── */
.right-col { display: flex; flex-direction: column; gap: 0.12in; }

/* Traits line */
.traits-line {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 11.5pt;
  color: var(--ink-mid);
  text-align: center;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 5px 0;
}

/* Backstory */
.backstory-block {
  background: rgba(30,45,74,0.05);
  border-left: 3px solid var(--gold);
  padding: 8px 10px;
  border-radius: 0 4px 4px 0;
}
.block-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy-mid);
  font-weight: 700;
  margin-bottom: 4px;
}
.backstory-text {
  font-family: 'IM Fell English', serif;
  font-size: 10pt;
  line-height: 1.55;
  color: var(--ink-mid);
  font-style: italic;
}

/* Skills & senses */
.skills-senses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.1in;
}
.info-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 9px;
}
.info-text {
  font-family: 'Crimson Text', serif;
  font-size: 9.5pt;
  color: var(--ink);
  line-height: 1.55;
}

/* Abilities / features */
.abilities-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  flex: 1;
}
.abilities-text {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  line-height: 1.6;
  color: var(--ink);
}
.abilities-text strong {
  font-weight: 600;
  color: var(--ink);
}

/* ── Bottom section ── */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.14in;
  margin-bottom: 0.14in;
}

.write-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
  display: flex;
  flex-direction: column;
}
.write-lines { flex: 1; display: flex; flex-direction: column; gap: 0; }
.write-line {
  border-bottom: 1px solid var(--rule);
  height: 22px;
  width: 100%;
}

/* Level tracker */
.level-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
}
.level-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.level-pip {
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 7pt;
  color: var(--navy);
  font-weight: 700;
}

/* Spell slots */
.spell-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
}
.spell-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.spell-grid-horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.spell-slot-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.spell-slot-lvl {
  font-family: 'Cinzel', serif;
  font-size: 5.5pt;
  color: var(--navy-mid);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.spell-slot-pip {
  width: 13px;
  height: 13px;
  border: 1px solid var(--navy-mid);
  border-radius: 50%;
  background: transparent;
}
.spell-slot-pip + .spell-slot-pip { margin-top: 2px; }

/* Items */
.items-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
  grid-column: span 2;
}
.item-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 4px;
}
.item-slot {
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid transparent;
  padding: 5px 4px;
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink-lt);
  font-style: italic;
  min-height: 24px;
  display: flex;
  align-items: center;
}
.item-slot:nth-child(odd) { border-right: 1px solid var(--rule); }
.item-slot.item-header {
  font-family: 'Cinzel', serif;
  font-size: 6pt;
  font-style: normal;
  letter-spacing: 0.1em;
  color: var(--navy-mid);
  border-bottom: 1.5px solid var(--navy-mid);
  font-weight: 700;
  min-height: 18px;
}
.item-slot.item-header:nth-child(odd) { border-right: 1px solid var(--rule); }

/* ── Death saves & passive perception bar ── */
.bottom-bar {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.14in;
  align-items: start;
  margin-bottom: 0.1in;
}
.saves-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 10px;
  background: var(--parchment-dk);
}
.saves-row { display: flex; gap: 8px; margin-top: 5px; }
.save-group { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.save-group-label {
  font-family: 'Cinzel', serif;
  font-size: 5.5pt;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
  font-weight: 700;
}
.save-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid;
}
.save-pip.success { border-color: #2a6a3a; }
.save-pip.failure { border-color: #8a2020; }

.perception-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 10px;
  background: var(--parchment-dk);
}
.perception-val {
  font-family: 'Cinzel', serif;
  font-size: 18pt;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-top: 4px;
}

.notes-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
  margin-top: 0.1in;
  display: flex;
  flex-direction: column;
}
.notes-block .backstory-text {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.notes-lines { display: flex; flex-direction: column; gap: 0; margin-top: 0; flex: 1; }
.notes-line {
  border-bottom: 1px solid var(--rule);
  height: 20px;
}

/* ── Footer ── */
.sheet-footer {
  border-top: 2px solid var(--navy);
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-logo {
  height: 24px;
  width: auto;
  filter: brightness(0.3);
}
.footer-url {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink-lt);
  font-style: italic;
}
.footer-card {
  font-family: 'Cinzel', serif;
  font-size: 7.5pt;
  color: var(--ink-lt);
  letter-spacing: 0.06em;
}

/* ── Saving Throws ── */
.saving-throws-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
}
.saves-grid {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink);
  line-height: 1.6;
}
.saves-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}
.saves-line span {
  font-size: 9.5pt;
  min-width: 60px;
}

/* ── Senses Block ── */
.senses-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 7px 9px;
}

/* ── Skills Block ── */
.skills-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
}
.skills-list {
  font-family: 'Crimson Text', serif;
  font-size: 8.5pt;
  color: var(--ink);
}
.skills-list-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin-top: 4px;
}
.skill-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(200, 176, 128, 0.3);
  padding-bottom: 2px;
}
.skill-line span:first-child {
  flex: 1;
}
.skill-line span:last-child {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  min-width: 45px;
  text-align: right;
}

/* ── Attacks Block ── */
.attacks-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
}
.attacks-table {
  width: 100%;
  font-family: 'Crimson Text', serif;
  font-size: 8.5pt;
  border-collapse: collapse;
  margin-top: 4px;
}
.attacks-table th {
  background: rgba(30, 45, 74, 0.1);
  border-bottom: 1.5px solid var(--rule);
  padding: 4px 6px;
  text-align: left;
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
}
.attacks-table td {
  border-bottom: 1px solid var(--rule);
  padding: 4px 6px;
}
.attacks-table tr:last-child td {
  border-bottom: none;
}

/* ── Page 1 Footer ── */
.page1-footer {
  margin-top: auto;
  margin-bottom: 0.12in;
  display: flex;
  flex-direction: column;
  gap: 0.1in;
}
.page1-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.14in;
}

/* ── Page 2 Styles ── */
.page-2 {
  page-break-before: always;
  width: 8.5in;
  min-height: 11in;
  display: flex;
  flex-direction: column;
  background: var(--parchment);
  border: 3px solid var(--navy);
  border-radius: 6px;
  padding: 0.4in;
  box-sizing: border-box;
  position: relative;
  margin: 2rem auto;
}
.page-2-header {
  margin-bottom: 0.14in;
  padding-bottom: 0.12in;
  border-bottom: 2px solid var(--navy);
}
.page-marker {
  font-family: 'Cinzel', serif;
  font-size: 11pt;
  font-weight: 700;
  color: var(--navy-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Spell info inline (in abilities block) */
.spell-info-inline {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}
.spell-info-inline-text {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink);
  line-height: 1.4;
}

/* Spell info display */
.spell-info-block {
  background: var(--parchment-dk);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 0.1in;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.1in;
}
.spell-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.spell-info-label {
  font-family: 'Cinzel', serif;
  font-size: 6.5pt;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
  font-weight: 700;
}
.spell-info-val {
  font-family: 'Cinzel', serif;
  font-size: 11pt;
  font-weight: 700;
  color: var(--ink);
}

/* Page 2 main grid (conditions, death saves, gold) */
.page2-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.1in;
  margin-bottom: 0.1in;
}

/* Page 2 footer */
.page-2-footer {
  margin-top: auto;
  padding-top: 6px;
  border-top: 2px solid var(--navy);
}

/* Hit Dice display */
.hp-hit-dice {
  font-family: 'Crimson Text', serif;
  font-size: 9pt;
  color: var(--ink-lt);
  font-style: italic;
  margin-bottom: 6px;
}

/* Inspiration checkbox */
.inspiration-row {
  align-items: center;
}
.inspiration-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--navy);
}
@media print {
  .inspiration-checkbox {
    appearance: none;
    border: 1.5px solid var(--navy-mid);
    border-radius: 2px;
    background: transparent;
    cursor: pointer;
  }
}

/* Spells section on page 2 */
.spells-block {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--parchment-dk);
  margin-top: 0.1in;
  margin-bottom: 0.1in;
}
.spells-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spell-level-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.spell-level-label {
  font-family: 'Cinzel', serif;
  font-size: 7pt;
  letter-spacing: 0.08em;
  color: var(--navy-mid);
  font-weight: 700;
  min-width: 70px;
  padding-top: 2px;
}
.spell-write-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.spell-write-line {
  border-bottom: 1px solid var(--rule);
  height: 18px;
  width: 100%;
}

/* ========== MEDIA QUERIES ========== */

@media (max-width: 480px) {
  /* Quiz cards */
  .welcome-cards {
    width: 100%;
    height: auto;
    perspective: none;
  }
  .card-stack {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
  }
  .stacked-card {
    position: relative;
    width: 90px;
    height: 130px;
    transform: none !important;
    opacity: 1 !important;
    z-index: auto !important;
  }

  /* Quiz layout */
  .welcome-section {
    flex-direction: column;
    gap: 2rem;
    padding: 1.5rem;
  }
  body.quiz-page { padding: 2rem 1rem; }
  .q-text { font-size: 18px; }
  .result-character { font-size: 26px; }
  .result-hero {
    margin-bottom: 2rem;
  }
  .result-hero-img {
    width: 100%;
    float: none;
    margin: 0 0 1rem 0;
    max-width: 100%;
  }
  .result-hero-text h2 {
    font-size: 24px;
  }
  .nav-btn {
    padding: 10px 16px;
    min-height: 44px;
    min-width: 44px;
  }
}

/* ── Print styles ── */
@media print {
  body.sheet-page {
    background: transparent;
    padding: 0;
    margin: 0;
  }
  .screen-controls { display: none !important; }
  .sheet,
  .page-2 {
    width: 8.5in;
    height: 11in;
    padding: 0.4in;
    box-sizing: border-box;
    margin: 0;
    box-shadow: none;
    border: none;
    border-radius: 0;
  }
  .sheet {
    page-break-after: avoid;
  }
  .page-2 {
    page-break-before: always;
  }
  .page-2-footer {
    border-top: 2px solid var(--navy);
    padding-top: 6px;
  }
  .content {
    padding: 0;
  }
  @page {
    size: letter;
    margin: 0;
  }
  @page :first {
    margin: 0;
  }
}
