/* ============================================================================
   playSoF.org — sof-game.css  v1
   Game Engine styles — appended to sof.css (or loaded separately after it).
   Depends on CSS variables defined in sof.css :root.
   ============================================================================ */

/* ============================================================================
   PLAY CARD STATE MACHINE
   #sof-play-card[data-state="..."] controls visibility of panels.
   All panels default to visible; hide rules are applied per state.
   ============================================================================ */

/* Slim card during video — show only decorative border, no content */
.sof-page--slim #sof-stats-bar   { opacity: 0; pointer-events: none; }
.sof-page--slim #sof-play-card   { opacity: 0; pointer-events: none; }

/* Transition for slim/expand */
#sof-stats-bar,
#sof-play-card {
  transition: opacity 0.3s ease;
}

/* Loading state */
#sof-play-card[data-state="loading"] .pc-stub-note { display: none; }

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.pc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  padding: 32px 0;
}

.pc-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(185,137,47,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: sof-spin 0.8s linear infinite;
}

@keyframes sof-spin {
  to { transform: rotate(360deg); }
}

.pc-loading-text {
  font-family: 'Cinzel', serif;
  font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ============================================================================
   ERROR DISPLAY
   ============================================================================ */

.pc-error {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  padding: 24px 0; text-align: center;
}
.pc-error-icon {
  font-size: 2rem; color: var(--blood-bright); opacity: .7;
}
.pc-error-text {
  font-size: clamp(13px,1vw,16px);
  color: var(--ink-soft); line-height: 1.5; max-width: 320px;
}
.choice-btn--retry {
  background: linear-gradient(135deg, var(--blood), var(--blood-bright));
  color: var(--parch-light); border-color: var(--blood-bright);
}

/* ============================================================================
   ONBOARDING — HERO GRID
   ============================================================================ */

.pc-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.pc-hero-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  padding: 10px 6px;
  background: linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid rgba(120,86,40,.35);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s, transform .12s;
  user-select: none;
}

.pc-hero-card:hover:not(.pc-hero-card--disabled) {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
  transform: translateY(-2px);
}

.pc-hero-card--disabled {
  opacity: .5; cursor: default;
}

.pc-hero-card--highlighted {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px var(--gold-glow), 0 4px 12px rgba(0,0,0,.25);
  transform: translateY(-2px);
}

.pc-hero-card--selected {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px var(--gold-glow), 0 0 24px var(--gold-glow);
  background: linear-gradient(180deg, #fffbef 0%, var(--parch-light) 100%);
}

.choice-btn--edit-hero {
  width: auto; padding: 3px 10px; font-size: 11px;
  margin-top: 2px;
}

/* ============================================================================
   BUSY HERO CARD — character already playing another adventure
   ============================================================================ */

.pc-hero-card--busy {
  opacity: .55;
  cursor: default;
  pointer-events: none;
}

.pc-hero-busy-note {
  font-size: 10px;
  color: var(--ink-faint);
  text-align: center;
  margin: 0;
  font-style: italic;
}

/* ============================================================================
   ADVENTURE SELECTION SCREEN
   ============================================================================ */

.pc-adv-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.pc-adv-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid rgba(120,86,40,.35);
  border-radius: var(--radius);
}

.pc-adv-cover {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: var(--radius);
  background: var(--parch-dark);
  border: 1px dashed rgba(120,86,40,.4);
}

.pc-adv-info {
  flex: 1;
  min-width: 0;
}

.pc-adv-title {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-adv-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
}

.pc-adv-card .choice-btn--primary {
  flex-shrink: 0;
  width: auto;
  padding: 8px 16px;
  white-space: nowrap;
}

.pc-hero-card--new { justify-content: center; }
.pc-hero-portrait--new {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--ink-faint);
  background: var(--parch-dark);
  border: 1px dashed rgba(120,86,40,.4);
}

.pc-hero-portrait {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--parch-dark);
  border: 1px solid rgba(120,86,40,.3);
  display: flex; align-items: center; justify-content: center;
}

.pc-hero-portrait img {
  width: 100%; height: 100%; object-fit: cover;
}

.pc-hero-name {
  font-family: 'Cinzel', serif;
  font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink);
  text-align: center; line-height: 1.3;
}

.pc-hero-class {
  font-size: 10px; color: var(--ink-faint);
  font-family: 'Cinzel', serif; letter-spacing: .08em;
  text-align: center;
}

/* ============================================================================
   GENDER SELECTOR
   ============================================================================ */

.pc-gender-select {
  margin: 8px 0;
}

.pc-gender-label {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 8px;
}

.pc-gender-btns {
  display: flex; gap: 8px;
}

.choice-btn--gender {
  flex: 1;
  background: linear-gradient(135deg, var(--parch-light), var(--parch));
  opacity: .65;
}

.choice-btn--gender.active {
  opacity: 1;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

/* ============================================================================
   OPEN GAMES (resume screen)
   ============================================================================ */

.pc-open-games {
  display: flex; flex-direction: column; gap: 10px;
  margin: 8px 0;
}

.pc-game-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: rgba(43,29,14,.07);
  border: 1px solid rgba(120,86,40,.25);
  border-radius: var(--radius);
}

.pc-game-hero {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  background: var(--parch-dark);
  border: 1px solid rgba(120,86,40,.3);
}

.pc-hero-img {
  width: 100%; height: 100%; object-fit: cover;
}

.pc-game-info {
  flex: 1; min-width: 0;
}

.pc-game-name {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 13px; color: var(--ink); letter-spacing: .05em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pc-game-class,
.pc-game-progress,
.pc-game-hp {
  font-size: 11px; color: var(--ink-faint);
  font-family: 'Cinzel', serif; letter-spacing: .06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pc-game-hp { color: var(--blood-bright); }

/* .choice-btn defaults to width:100%, which (combined with .pc-game-info's
   flex-basis:0 from flex:1) squeezes the name/class/progress text to near
   zero width — override so the button sizes to its own content instead. */
.pc-game-card .choice-btn { width: auto; flex-shrink: 0; }

.pc-delete-game-btn {
  width: auto; flex-shrink: 0;
  padding: 4px 10px;
  font-size: 11px; font-family: 'Cinzel', serif; letter-spacing: .06em;
  background: none; border: 1px solid rgba(160, 40, 20, .25);
  border-radius: 3px; color: var(--ink-faint); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pc-delete-game-btn:hover { border-color: var(--blood); color: var(--blood-bright); }
.pc-delete-game-btn:disabled { opacity: .4; cursor: default; }

/* ============================================================================
   COMBAT — PREPARATION
   ============================================================================ */

.pc-enemy-info {
  padding: 12px;
  background: rgba(43,29,14,.1);
  border: 1px solid rgba(120,86,40,.3);
  border-radius: var(--radius);
  margin: 8px 0;
}

.pc-enemy-name {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(15px,1.4vw,18px); color: var(--ink);
  letter-spacing: .06em; margin-bottom: 4px;
}

.pc-enemy-stats {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .1em; color: var(--ink-faint);
}

.choice-btn--combat {
  background: linear-gradient(135deg, var(--blood), var(--blood-bright));
  color: var(--parch-light);
  border-color: var(--blood-bright);
}

.choice-btn--combat:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--blood-bright), #c94040);
  box-shadow: 0 0 0 2px rgba(124,32,32,.35), 0 2px 8px rgba(0,0,0,.25);
}

/* Primary action button */
.choice-btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--ink); font-weight: 700;
  border-color: var(--gold-bright);
}

.choice-btn--primary:hover:not(:disabled) {
  box-shadow: 0 0 0 2px var(--gold-glow), 0 2px 8px rgba(0,0,0,.2);
}

/* Dev stub note */
.pc-stub-note {
  font-style: italic; color: var(--ink-faint);
  font-size: clamp(12px,.9vw,14px);
  border: 1px dashed rgba(120,86,40,.3);
  padding: 10px; border-radius: var(--radius);
  text-align: center;
}

/* ============================================================================
   DEV MODE — LEFT PANEL TEXT DISPLAY
   Replaces YouTube player during development.
   Parchment background, black text, section number + title header.
   ============================================================================ */

.sof-dev-panel {
  /* 'inset' shorthand not supported before Chrome 87 — use explicit four-side offsets */
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 4;
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 45%, var(--parch-dark) 100%);
  border-radius: var(--radius);
  overflow: hidden;
}

.sof-dev-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(120,86,40,.3);
  background: rgba(43,29,14,.06);
  flex-shrink: 0;
}

.sof-dev-section-no {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(13px,1.2vw,16px);
  color: #000;
  letter-spacing: .05em;
}

.sof-dev-badge {
  font-family: 'Cinzel', serif; font-size: 9px;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--parch-light);
  background: var(--blood);
  padding: 2px 6px; border-radius: var(--radius);
  opacity: .8;
}

.sof-dev-body {
  /* flex: 0 0 auto — body sizes to content; button appears right after text,
     not forced to the bottom. max-height caps it so long texts still scroll. */
  flex: 0 0 auto;
  max-height: 55vh;
  overflow-y: auto;
  padding: 14px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.sof-dev-text {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(15px,1.1vw,18px);
  color: #000;
  line-height: 1.65;
}

.sof-dev-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(120,86,40,.3);
  background: rgba(43,29,14,.06);
  flex-shrink: 0;
}

.sof-dev-finish-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  border: none; border-radius: var(--radius);
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(11px,.95vw,13px); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink);
  cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}

.sof-dev-finish-btn:hover {
  box-shadow: 0 0 0 3px var(--gold-glow);
  transform: translateY(-1px);
}

/* External embed (killerplayer etc.) — finish bar overlays bottom of container */
.sof-ext-finish-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 100%);
  z-index: 10;
}

/* ============================================================================
   SETTINGS — SPLIT ANIMATION TOGGLE
   New row added between Musik and Split-Animation slider.
   Uses identical .settings-row structure — no new CSS needed.
   (The HTML for this row is added to index.php)
   ============================================================================ */

/* ============================================================================
   SPLIT ANIMATION — grid transition
   Applied dynamically via JS setSplit()
   #sof-book grid-template-columns transition is set inline by JS.
   ============================================================================ */

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

/* See sof.css for why landscape phones need (max-height: 500px) too — a
   width-only query misses them (innerWidth often exceeds 768px there) — and
   why (pointer: coarse) is required alongside it (otherwise a short desktop
   browser window, e.g. with DevTools docked, would wrongly match too). */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  /* Tighten the onboarding/hero-select card — on mobile the play card area
     is wide (90% active-side split) but short on height, so large gaps
     between the title, intro text and hero grid eat into the visible area. */
  #sof-play-card { gap: 6px; }
  .card-section-title { padding-top: 2px; margin-bottom: .1em; }
  .card-body-text { margin-bottom: .3em; }
  .pc-gender-select { margin: 4px 0; }
  .pc-gender-label { margin-bottom: 4px; }
  .choices-wrap { margin-top: 6px; }

  .pc-hero-grid {
    /* Cap column width instead of letting 1fr stretch cards across the
       full card width — that left tiny 44px portraits floating in oversized
       cells with large empty gaps between them. */
    grid-template-columns: repeat(auto-fill, minmax(64px, 80px));
    justify-content: center;
    gap: 8px;
    margin: 6px 0;
  }
  .pc-hero-portrait { width: 44px; height: 44px; }
  .pc-game-card { flex-wrap: wrap; }
}

/* ============================================================================
   sof-game.css ADDITIONS v2
   Append to existing sof-game.css (or replace file with full version)
   New styles: choices, combat log, check roll, chronicle overlay
   ============================================================================ */

/* ============================================================================
   LOCKED CHOICE
   ============================================================================ */

.choice-btn--locked {
  opacity: .45;
  cursor: not-allowed;
  border-style: dashed;
  border-color: rgba(120,86,40,.3);
}

.choice-lock-text {
  display: block;
  font-size: clamp(10px,.82vw,12px);
  color: var(--ink-faint);
  font-family: 'Cinzel', serif;
  letter-spacing: .08em;
  margin-top: 3px;
  font-style: italic;
}

/* ============================================================================
   COMBAT
   ============================================================================ */

.pc-combat-log {
  flex: 1;
  overflow-y: auto;
  max-height: 180px;
  padding: 8px 10px;
  background: rgba(43,29,14,.08);
  border: 1px solid rgba(120,86,40,.2);
  border-radius: var(--radius);
  margin: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.pc-combat-entry {
  font-size: clamp(12px,.9vw,14px);
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 3px;
  font-family: 'EB Garamond', serif;
}

.choice-btn--defend {
  background: linear-gradient(135deg, var(--arcane), #4a5a8a);
  color: var(--parch-light);
  border-color: #5a6a9a;
}
.choice-btn--heal {
  background: linear-gradient(135deg, var(--forest), #5e7040);
  color: var(--parch-light);
  border-color: #6e8050;
}
.choice-btn--disc {
  background: linear-gradient(135deg, #5a3a6a, #7a5a8a);
  color: var(--parch-light);
  border-color: #8a6a9a;
}
.choice-btn--flee {
  background: linear-gradient(135deg, rgba(43,29,14,.4), rgba(43,29,14,.6));
  color: var(--parch-dark);
  border-color: rgba(120,86,40,.4);
}

.choice-btn--defend:hover:not(:disabled),
.choice-btn--heal:hover:not(:disabled),
.choice-btn--disc:hover:not(:disabled),
.choice-btn--flee:hover:not(:disabled) {
  box-shadow: 0 0 0 2px rgba(185,137,47,.3), 0 2px 8px rgba(0,0,0,.25);
  transform: translateY(-1px);
}

/* ============================================================================
   SKILL / LUCK CHECK
   ============================================================================ */

.pc-check-info {
  padding: 10px;
  background: rgba(43,29,14,.07);
  border: 1px solid rgba(120,86,40,.25);
  border-radius: var(--radius);
  margin: 8px 0;
}

.pc-check-skill {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(13px,1.1vw,15px); color: var(--ink);
  letter-spacing: .06em; margin-bottom: 4px;
}

.pc-check-dc {
  font-family: 'Cinzel', serif;
  font-size: 12px; color: var(--ink-faint); letter-spacing: .1em;
}

.pc-check-result {
  min-height: 48px;
  margin: 8px 0;
}
/* Before the roll fires, the result area is empty — don't reserve space for it */
.pc-check-result:empty {
  min-height: 0;
  margin: 0;
}

.pc-check-roll {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: 'Cinzel', serif;
  font-size: clamp(14px,1.1vw,17px);
  animation: sof-fadein .3s ease;
}

.pc-check-success {
  background: rgba(78,95,51,.15);
  border: 1px solid rgba(78,95,51,.4);
  color: var(--forest);
}

.pc-check-fail {
  background: rgba(124,32,32,.1);
  border: 1px solid rgba(124,32,32,.3);
  color: var(--blood-bright);
}

.pc-dice-result { font-weight: 700; font-size: 1.2em; }
.pc-stat-bonus  { color: var(--ink-faint); }
.pc-total-result { font-weight: 700; }
.pc-check-verdict { letter-spacing: .08em; }

@keyframes sof-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   CHRONICLE BUTTON — two contexts:
   1. Inside #sof-stats-bar (decision state): compact inline button, left of
      the HP/KK/... stats. Overrides via the #sof-stats-bar selector below.
   2. Standalone at bottom of play card (ending/defeat screen): full-width
      row via the base .pc-chronicle-btn rules.
   ============================================================================ */

.pc-chronicle-btn {
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: 1px solid rgba(120,86,40,.3);
  border-radius: var(--radius);
  font-family: 'Cinzel', serif;
  font-size: clamp(10px,.85vw,12px);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); cursor: pointer;
  transition: border-color .18s, color .18s;
  margin-top: 8px;
}

.pc-chronicle-btn:hover {
  border-color: var(--gold);
  color: var(--ink);
}

/* Stop game button — right edge of stats bar */
.pc-stop-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 2px 8px;
  font-size: 10px;
  font-family: 'Cinzel', serif;
  letter-spacing: .07em;
  background: none;
  border: 1px solid rgba(120, 86, 40, .28);
  border-radius: 3px;
  color: var(--ink-faint);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pc-stop-btn:hover {
  border-color: var(--blood);
  color: var(--blood-bright);
}

/* Compact inline variant when living inside the stats bar */
#sof-stats-bar .pc-chronicle-btn {
  flex-shrink: 0;
  width: auto;
  padding: 2px 8px;
  margin: 0;
  font-size: 10px;
}

/* ============================================================================
   CHRONICLE OVERLAY — scrollable, full-height
   ============================================================================ */

.pc-overlay-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(23,15,8,.75);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.pc-overlay-box {
  width: 100%; max-width: 540px;
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  background:
    radial-gradient(ellipse 70% 50% at 30% 18%, var(--parch-light) 0%, transparent 60%),
    linear-gradient(180deg, var(--parch-light) 0%, var(--parch) 100%);
  border: 1px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
  overflow: hidden;
}

.pc-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(120,86,40,.3);
  background: rgba(43,29,14,.06);
  flex-shrink: 0;
}

.pc-overlay-title {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(14px,1.2vw,17px); color: var(--ink);
  letter-spacing: .08em;
}

.pc-overlay-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--ink-faint); line-height: 1;
  transition: color .18s;
}
.pc-overlay-close:hover { color: var(--gold); }

.pc-overlay-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

/* Chronicle entries */
.pc-chronicle-entry {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(120,86,40,.12);
  font-size: clamp(13px,.95vw,15px);
}
.pc-chronicle-entry:last-child { border-bottom: none; }

.pc-chr-step {
  font-family: 'Cinzel', serif; font-size: 10px;
  color: var(--ink-faint); letter-spacing: .1em;
  min-width: 22px; text-align: right; flex-shrink: 0;
}

.pc-chr-section {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: 12px; color: var(--gold);
  min-width: 36px; flex-shrink: 0;
}

.pc-chr-choice {
  color: var(--ink-soft); line-height: 1.4;
  font-family: 'EB Garamond', serif;
}

/* ============================================================================
   REST / MAHLZEITEN (meal action — repeatable, doesn't advance the section)
   ============================================================================ */

.pc-meal-row { margin-bottom: 10px; }

.choice-btn--meal {
  background: linear-gradient(135deg, var(--parch), var(--parch-light));
  border-color: var(--gold);
  color: var(--ink); font-weight: 700;
}
.choice-btn--meal:hover:not(:disabled) {
  box-shadow: 0 0 0 2px var(--gold-glow), 0 2px 8px rgba(0,0,0,.2);
}

/* Replay title button — looks like the section h2 but is clickable */
button.pc-section-replay {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
}
button.pc-section-replay:hover {
  opacity: .72;
}
.pc-replay-arrow {
  font-size: .65em;
  vertical-align: middle;
  margin-right: 2px;
  opacity: .6;
}

/* ============================================================================
   VENDOR SCREEN (ENGINE-05)
   ============================================================================ */

.choice-btn--vendor {
  background: linear-gradient(135deg, var(--parch), var(--parch-light));
  border-color: var(--gold);
  color: var(--ink); font-weight: 700;
}
.choice-btn--vendor:hover:not(:disabled) {
  box-shadow: 0 0 0 2px var(--gold-glow), 0 2px 8px rgba(0,0,0,.2);
}

.pc-vendor-denied {
  font-style: italic; color: var(--blood);
  font-size: clamp(12px,.9vw,14px);
  border: 1px dashed var(--blood);
  padding: 10px; border-radius: var(--radius);
  text-align: center;
}

.pc-vendor-box { max-width: 600px; }

.pc-vendor-gold {
  font-family: 'Cinzel', serif; font-weight: 700;
  color: var(--gold-bright);
  padding: 4px 0 10px;
  border-bottom: 1px solid rgba(120,86,40,.2);
  margin-bottom: 10px;
}

.pc-vendor-catalog, .pc-vendor-sell-list { display: flex; flex-direction: column; gap: 6px; }

.pc-vendor-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 4px;
  border-bottom: 1px solid rgba(120,86,40,.12);
}
.pc-vendor-item:last-child { border-bottom: none; }

.pc-vendor-item-info {
  color: var(--ink-soft); font-family: 'EB Garamond', serif;
  font-size: clamp(13px,.95vw,15px);
  flex: 1 1 auto; min-width: 0;
  overflow-wrap: break-word; word-break: break-word;
}

.pc-vendor-item .choice-btn {
  width: auto; flex-shrink: 0;
}
.choice-btn--vendor-buy, .choice-btn--vendor-sell {
  flex-shrink: 0; padding: 5px 12px; font-size: 12px;
}
.choice-btn--vendor-sell {
  background: linear-gradient(135deg, var(--parch-dark), var(--parch));
}

.pc-vendor-sell-label {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .08em; color: var(--ink-faint);
  margin: 12px 0 6px;
}

/* ============================================================================
   HERO CREATION WIZARD (member flow)
   ============================================================================ */

.pc-wizard-box { max-width: 640px; }

.pc-wizard-label {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .08em; color: var(--ink-faint);
  margin: 12px 0 6px;
}

.pc-wizard-subtitle {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(15px,1.3vw,18px); color: var(--ink);
  margin: 0 0 4px;
}

.pc-wizard-input {
  width: 100%; padding: 7px 10px; font-size: 14px;
  font-family: 'EB Garamond', serif;
  border: 1px solid var(--gold); border-radius: var(--radius);
  background: var(--parch-light); color: var(--ink);
}

.pc-wizard-subclass-grid, .pc-wizard-discipline-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.pc-wizard-subclass-card {
  border: 1px solid rgba(120,86,40,.3); border-radius: var(--radius);
  padding: 8px 10px; cursor: pointer; transition: border-color .18s, background .18s;
  background: rgba(43,29,14,.03);
}
.pc-wizard-subclass-card:hover { border-color: var(--gold); background: rgba(43,29,14,.07); }

.pc-wizard-subclass-name {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px;
  color: var(--ink); margin: 0 0 3px;
}

.pc-wizard-subclass-fest {
  font-size: 11px; color: var(--ink-faint); margin: 0;
}

.choice-btn--discipline.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--ink); font-weight: 700;
}

/* Discipline selector label (shown when multiple disciplines to choose from) */
.pc-disc-select-label {
  font-size: .8em;
  color: var(--ink-faint);
  margin: 0 0 4px;
  text-align: center;
}

/* ============================================================================
   EQUIP PICKER (combat preparation — choose weapon/armor to equip)
   ============================================================================ */

.pc-equip-picker { margin: 10px 0; }

.pc-equip-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 4px 0;
}

.pc-equip-row-label {
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 12px;
  color: var(--ink-faint); min-width: 60px;
}

.pc-equip-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }

.choice-btn--equip { padding: 5px 10px; font-size: 12px; }
.choice-btn--equip.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--ink); font-weight: 700;
}

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

@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .pc-combat-log { max-height: 120px; }
  .pc-overlay-box { max-height: calc(100vh - 40px); }
}

/* ============================================================================
   DEV GATE — access key field (shown only when SOF_DEV_MODE=1)
   ============================================================================ */

.pc-dev-gate {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(43,29,14,.08);
  border: 1px solid rgba(185,137,47,.3);
  border-radius: var(--radius);
}

.pc-dev-gate-label {
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint);
}

.pc-dev-gate-input-wrap { position: relative; display: flex; }

.pc-dev-gate-input {
  flex: 1;
  padding: 8px 36px 8px 10px;
  border: 1px solid rgba(120,86,40,.4);
  border-radius: var(--radius);
  background: rgba(255,252,240,.85);
  font-family: 'EB Garamond', serif; font-size: 16px;
  color: var(--ink); letter-spacing: .2em;
  transition: border-color .18s;
}

.pc-dev-gate-input:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

/* Same eye-icon show/hide toggle as the member login panel
   (.login-panel-password-toggle in sof.css) */
.pc-dev-gate-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px 6px;
  opacity: .55; transition: opacity .15s;
}
.pc-dev-gate-toggle:hover { opacity: 1; }
.pc-dev-gate-toggle[aria-pressed="true"] { opacity: 1; }

.pc-dev-gate-error {
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--blood-bright);
}

.pc-dev-gate-error.hidden { display: none; }

/* Collapsed state — added once a key has been typed in, so the field
   doesn't keep eating vertical space on small/landscape mobile screens
   once it's served its purpose. Removed again if the field is cleared. */
.pc-dev-gate--filled {
  gap: 0;
  padding: 6px 10px;
}
.pc-dev-gate--filled .pc-dev-gate-label {
  display: none;
}
.pc-dev-gate--filled .pc-dev-gate-input {
  padding: 5px 32px 5px 8px;
  font-size: 13px;
}
.pc-dev-gate--filled .pc-dev-gate-toggle {
  font-size: 13px;
}

/* ============================================================================
   HERO PORTRAIT — top-right corner of play card
   ============================================================================ */

.pc-hero-portrait-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 2px 12px rgba(0,0,0,.4), 0 0 0 1px rgba(185,137,47,.3);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  z-index: 3;
}

.pc-hero-portrait-corner:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 18px rgba(0,0,0,.5), 0 0 0 2px var(--gold-glow);
}

.pc-hero-portrait-corner img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* Full-size portrait overlay */
.pc-portrait-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(23,15,8,.85);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  cursor: pointer;
}

.pc-portrait-overlay-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 320px;
}

.pc-portrait-full {
  width: 100%; max-width: 320px;
  max-height: 70vh;
  height: auto;
  border-radius: 6px;
  border: 2px solid var(--gold);
  box-shadow: 0 0 60px rgba(185,137,47,.35), 0 8px 40px rgba(0,0,0,.7);
  object-fit: contain;
  display: block;
}

.pc-portrait-name {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(16px,1.4vw,20px); color: var(--parch-light);
  letter-spacing: .06em; text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
}

.pc-portrait-class {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); text-align: center;
}

/* ============================================================================
   LOOT SCREEN — post-combat victory
   ============================================================================ */

.pc-loot-gold {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(185,137,47,.12);
  border: 1px solid rgba(185,137,47,.35);
  border-radius: var(--radius);
  margin: 8px 0;
}

.pc-loot-gold-icon {
  font-size: 1.4rem; opacity: .8;
}

.pc-loot-gold-text {
  font-family: 'Cinzel', serif; font-weight: 700;
  font-size: clamp(14px,1.2vw,17px);
  color: var(--gold-bright); letter-spacing: .06em;
}

.pc-loot-ep {
  font-family: 'Cinzel', serif; font-size: 13px;
  letter-spacing: .1em; color: var(--forest);
  padding: 4px 14px; margin-bottom: 4px;
}

.pc-levelup-notice {
  font-family: 'Cinzel', serif; font-size: 14px; font-weight: 700;
  letter-spacing: .08em; text-align: center;
  color: var(--gold-bright);
  background: color-mix(in srgb, var(--gold-bright) 12%, transparent);
  border: 1px solid var(--gold-bright);
  border-radius: 4px;
  padding: 8px 16px; margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) {
  .pc-levelup-notice { background: color-mix(in srgb, var(--gold-bright) 8%, transparent); }
}
:root[data-theme="light"] .pc-levelup-notice { background: color-mix(in srgb, var(--gold-bright) 12%, transparent); }
:root[data-theme="dark"]  .pc-levelup-notice { background: color-mix(in srgb, var(--gold-bright) 8%,  transparent); }

.pc-loot-label {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 6px;
}

.pc-loot-items {
  margin: 6px 0;
}

.pc-loot-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: rgba(43,29,14,.06);
  border: 1px solid rgba(120,86,40,.2);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.pc-loot-item-name {
  font-family: 'EB Garamond', serif;
  font-size: clamp(14px,1vw,16px); color: var(--ink-soft);
}

/* ============================================================================
   DEFEAT SCREEN
   ============================================================================ */

.pc-defeat-stats {
  padding: 10px 14px;
  background: rgba(124,32,32,.08);
  border: 1px solid rgba(124,32,32,.2);
  border-radius: var(--radius);
  margin: 8px 0;
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .08em; color: var(--ink-soft);
  line-height: 1.8;
}

.pc-defeat-chronicle {
  margin: 8px 0;
}

.pc-defeat-entry {
  font-size: clamp(12px,.9vw,14px); color: var(--ink-faint);
  font-family: 'EB Garamond', serif; line-height: 1.5;
  padding: 2px 0;
}

/* ============================================================================
   PLAY CARD LAYOUT — flex column with scrollable inventory
   position:relative anchors the absolutely-positioned hero portrait (top-right).
   Resources bar below title, inventory scrolls, decisions pinned to bottom.
   NOTE: base flex/gap/overflow come from sof.css #sof-play-card — here we only
   add position:relative, which sof.css does not set.
   ============================================================================ */

#sof-play-card {
  position: relative;
}

/* ============================================================================
   RESOURCES BAR — compact chip row
   ============================================================================ */

.pc-resources-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid rgba(120,86,40,.15);
  border-bottom: 1px solid rgba(120,86,40,.15);
  margin: 6px 0;
  flex-shrink: 0;
}

/* Two groups inside the bar: persistent resources + adventure-local counters */
.pc-res-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Story-Zähler (adventure-local) are slightly de-emphasised */
.pc-res-group--local .pc-res-chip {
  background: rgba(43,29,14,.04);
  border-color: rgba(120,86,40,.13);
}

/* Thin vertical divider between the two groups */
.pc-res-divider {
  width: 1px;
  height: 22px;
  background: rgba(120,86,40,.25);
  flex-shrink: 0;
  margin: 0 2px;
}

.pc-res-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(43,29,14,.08);
  border: 1px solid rgba(120,86,40,.2);
  border-radius: 12px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-soft);
  cursor: default;
}

.pc-res-chip.pc-res-zero {
  opacity: .45;
}

.pc-res-icon {
  font-size: 12px;
  line-height: 1;
}

.pc-res-val {
  font-weight: 700;
  color: var(--ink);
  min-width: 10px;
  text-align: center;
}

/* ============================================================================
   DEVELOPER — nav jump form (header)
   Compact section-jump form in the top nav, visible only for role=developer.
   ============================================================================ */

.nav-dev-jump { display: flex; align-items: center; }

.nav-dev-jump-form {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-dev-jump-input {
  width: 52px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(200,168,75,.4);
  color: #fff;
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 12px;
  font-family: var(--font-ui, monospace);
  text-align: center;
}

.nav-dev-jump-input:focus {
  outline: none;
  border-color: rgba(200,168,75,.8);
}

/* Remove browser spinners */
.nav-dev-jump-input::-webkit-outer-spin-button,
.nav-dev-jump-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nav-dev-jump-input[type=number] { -moz-appearance: textfield; }

.nav-dev-jump-btn {
  background: rgba(200,168,75,.15);
  border: 1px solid rgba(200,168,75,.4);
  color: rgba(200,168,75,.9);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-ui, sans-serif);
  white-space: nowrap;
}

.nav-dev-jump-btn:hover { background: rgba(200,168,75,.28); }

.nav-dev-heal-btn {
  background: rgba(100,160,220,.15);
  border: 1px solid rgba(100,160,220,.5);
  color: rgba(140,200,255,.9);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: .78rem;
  cursor: pointer;
  font-family: var(--font-ui, sans-serif);
  white-space: nowrap;
}

.nav-dev-heal-btn:hover { background: rgba(100,160,220,.28); }

.nav-dev-gold-btn {
  background: rgba(100,180,100,.15);
  border: 1px solid rgba(100,180,100,.5);
  color: rgba(160,220,160,.9);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-ui, sans-serif);
  white-space: nowrap;
}

.nav-dev-gold-btn:hover { background: rgba(100,180,100,.28); }

/* ============================================================================
   DEVELOPER PANEL — fixed bottom debug bar
   Visible only when PHP renders #sof-dev-panel (role=developer).
   ============================================================================ */

.sof-dev-panel-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  background: rgba(20, 10, 5, 0.93);
  border-top: 1px solid rgba(200, 168, 75, 0.35);
  padding: 4px 12px;
  font-size: 11px;
  font-family: var(--font-ui, monospace);
}

.sof-dev-panel-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

.sof-dev-badge {
  background: rgba(200, 168, 75, 0.85);
  color: #1a0e00;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sof-dev-debug {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.sof-dev-debug-item {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--ink-faint, rgba(255,255,255,.55));
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

/* Push game footer above the debug bar */
body:has(#sof-dev-panel) #sof-footer {
  padding-bottom: 36px;
}

.pc-res-label {
  font-size: 9px;
  letter-spacing: .08em;
  color: var(--ink-faint);
  text-transform: uppercase;
  margin-left: 2px;
}

/* Hide label on zero-value chips to keep the bar compact */
.pc-res-zero .pc-res-label {
  display: none;
}

/* ============================================================================
   INVENTORY PANEL — capped middle section
   flex:1 = takes remaining space; max-height:40% caps it so choices below
   always get their own space. Items overflow-y:auto within the cap — the
   panel scrolls internally when more items than fit. min-height:24px keeps
   at least the header row always allocated.
   .pc-inventory-header uses position:sticky within the panel's own scroll
   so "RUCKSACK 3/10" stays pinned when the user scrolls many items.
   ============================================================================ */

.pc-inventory-panel {
  flex: 1;
  min-height: 24px;
  max-height: 27%;
  overflow: hidden; /* panel clips; only .pc-inventory-scroll scrolls internally */
  padding: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Scroll container: items only — header stays pinned above this as a flex sibling.
   This avoids position:sticky inside overflow:auto+flex which is unreliable on
   Chrome 44 (Android 6). */
.pc-inventory-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) var(--parch-dark);
  padding-bottom: 4px;
}

.pc-inventory-header {
  /* Plain flex child — header is always visible because it's outside the scroll area */
  background: var(--parch-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(120,86,40,.3);
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.pc-inv-toggle {
  font-size: 10px;
  margin-right: 4px;
  color: var(--gold);
  font-weight: 700;
}

.pc-inv-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pc-inv-capacity {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .06em;
}

.pc-inv-empty {
  font-style: italic;
  color: var(--ink-faint);
  font-size: 13px;
  padding: 8px 0;
}

.pc-inv-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pc-inv-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 8px;
  background: rgba(43,29,14,.05);
  border: 1px solid rgba(120,86,40,.15);
  border-radius: var(--radius);
  font-size: clamp(12px,.9vw,14px);
}

.pc-inv-item-name {
  flex: 1;
  color: var(--ink-soft);
  font-family: 'EB Garamond', serif;
}

.pc-inv-item-slots {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: .04em;
  margin-left: 6px;
}

.pc-inv-item-qty {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: .06em;
}

/* Choices pinned to bottom — remove auto margin, use normal margin */
.choices-wrap {
  flex-shrink: 0;
}

/* ============================================================================
   MOBILE PADDING OVERRIDES — kept at the very end of the file on purpose.
   Earlier attempts placed these inside the "RESPONSIVE ADJUSTMENTS" block
   near the top of the file, but the unconditional (non-media-query) base
   rules for .pc-inv-item, .pc-res-chip, .pc-resources-bar, .pc-inventory-*,
   .pc-vendor-item, .choice-btn--vendor-*/--equip etc. are declared FURTHER
   DOWN in this same file. With equal selector specificity, CSS source order
   decides the winner — so those later base rules were silently overriding
   this block when it sat near the top, even though the @media condition
   matched. Keeping this block last guarantees it always wins on mobile.
   TEST VALUE — padding: 2px on buttons/containers/bars; tune per element
   once confirmed on-device.
   ============================================================================ */
@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .choice-btn--edit-hero,
  .choice-btn--vendor-buy,
  .choice-btn--vendor-sell,
  .choice-btn--equip {
    padding: 2px;
  }
  .pc-inv-item,
  .pc-game-card,
  .pc-vendor-item,
  .pc-enemy-info,
  .pc-res-chip {
    padding: 2px;
  }

  /* Surrounding wrappers (bar/panel) contributed their own padding/margin/
     gap on top of each element's own padding — tighten those too. */
  .pc-resources-bar { padding: 4px 0; margin: 4px 0; gap: 4px; }
  .pc-res-group { gap: 4px; }
  .pc-res-divider { height: 18px; margin: 0 1px; }
  .pc-inventory-panel { padding: 2px 0 0; }
  .pc-inventory-header { padding: 2px 0; }
  .pc-inv-list { gap: 2px; }
  .pc-vendor-catalog, .pc-vendor-sell-list { gap: 2px; }
}

/* ============================================================================
   DICE ROLL ANIMATION OVERLAY
   Canvas renders a true icosahedron (d20) — no CSS geometry needed.
   ============================================================================ */

.pc-dice-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.52);
  border-radius: inherit;
  pointer-events: none;
  animation: pc-dice-overlay-in 0.10s ease-out both;
}

.pc-dice-mover {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pc-dice-overlay--out {
  animation: pc-dice-overlay-out 0.20s ease-in both;
}

@keyframes pc-dice-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pc-dice-overlay-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.pc-dice-canvas {
  display: block;
}

.pc-dice-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: rgba(200, 168, 75, 0.75);
  text-transform: uppercase;
  font-family: var(--font-ui, sans-serif);
}

/* ============================================================================
   DISCIPLINE CHOICE OVERLAY — level-up unlock / upgrade
   Renders as an absolute overlay anchored inside #sof-page-card.
   ============================================================================ */

.pc-disc-choice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: pc-disc-overlay-in 0.25s ease both;
  padding: 12px;
  box-sizing: border-box;
}

@keyframes pc-disc-overlay-in {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1);    }
}

.pc-disc-choice-box {
  background: var(--color-card-bg, #1a1824);
  border: 1px solid rgba(200, 168, 75, 0.35);
  border-radius: 10px;
  padding: 20px 18px 16px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pc-disc-choice-title {
  font-family: var(--font-heading, serif);
  font-size: 1.1rem;
  color: var(--color-gold, #c8a84b);
  margin: 0;
  text-align: center;
}

.pc-disc-choice-sub {
  font-size: 0.85rem;
  color: rgba(220, 210, 185, 0.75);
  text-align: center;
  margin: 0;
}

.pc-disc-choice-status {
  font-size: 0.8rem;
  color: rgba(220, 210, 185, 0.55);
  text-align: center;
  margin: 0 0 4px;
}

/* Tab bar */
.pc-disc-tab-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(200, 168, 75, 0.2);
  padding-bottom: 6px;
}

.pc-disc-tab {
  flex: 1;
  padding: 6px 4px;
  background: transparent;
  border: 1px solid rgba(200, 168, 75, 0.25);
  border-radius: 5px;
  color: rgba(220, 210, 185, 0.6);
  font-family: var(--font-ui, sans-serif);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.pc-disc-tab:hover {
  background: rgba(200, 168, 75, 0.08);
  color: rgba(220, 210, 185, 0.9);
}

.pc-disc-tab--active {
  background: rgba(200, 168, 75, 0.15);
  border-color: rgba(200, 168, 75, 0.55);
  color: var(--color-gold, #c8a84b);
}

/* Scrollable card list */
.pc-disc-tab-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* Individual discipline card */
.pc-disc-card {
  padding: 10px 12px;
  border: 1px solid rgba(200, 168, 75, 0.2);
  border-radius: 7px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s, background 0.15s;
}

.pc-disc-card:hover:not(.pc-disc-card--locked) {
  border-color: rgba(200, 168, 75, 0.45);
  background: rgba(200, 168, 75, 0.06);
}

.pc-disc-card--selected {
  border-color: var(--color-gold, #c8a84b);
  background: rgba(200, 168, 75, 0.12);
}

.pc-disc-card--locked {
  opacity: 0.55;
  cursor: default;
}

.pc-disc-card-name {
  font-family: var(--font-heading, serif);
  font-size: 0.95rem;
  color: rgba(220, 210, 185, 0.95);
  margin-bottom: 4px;
}

.pc-disc-card-effect {
  font-size: 0.78rem;
  color: rgba(200, 168, 75, 0.75);
}

/* Upgrade comparison row */
.pc-disc-card-compare {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.pc-disc-compare-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-disc-compare-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(220, 210, 185, 0.45);
}

.pc-disc-compare-text {
  font-size: 0.78rem;
  color: rgba(200, 168, 75, 0.75);
}

.pc-disc-compare-arrow {
  font-size: 1rem;
  color: rgba(200, 168, 75, 0.5);
  align-self: center;
  flex-shrink: 0;
}

.pc-disc-card-lock-reason {
  font-size: 0.75rem;
  color: rgba(220, 130, 100, 0.8);
  margin-top: 5px;
}

/* Confirm button */
.pc-disc-choice-confirm {
  margin-top: 4px;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(200,168,75,0.25), rgba(200,168,75,0.15));
  border: 1px solid rgba(200,168,75,0.55);
  border-radius: 7px;
  color: var(--color-gold, #c8a84b);
  font-family: var(--font-ui, sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.04em;
}

.pc-disc-choice-confirm:disabled {
  opacity: 0.35;
  cursor: default;
}

.pc-disc-choice-confirm:not(:disabled):hover {
  background: linear-gradient(135deg, rgba(200,168,75,0.38), rgba(200,168,75,0.25));
}

.pc-disc-choice-disclaimer {
  font-size: 0.72rem;
  color: rgba(220, 210, 185, 0.35);
  text-align: center;
  margin: 0;
}

.pc-disc-choice-err {
  font-size: 0.78rem;
  color: rgba(220, 80, 80, 0.9);
  text-align: center;
  margin: 0;
}

.pc-disc-choice-empty {
  font-size: 0.82rem;
  color: rgba(220, 210, 185, 0.5);
  text-align: center;
  padding: 12px 0;
  margin: 0;
}

