.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--purple); }
.muted { color: var(--grey-500); }
.small { font-size: .86rem; }
.beta-pill { display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 8px; background: var(--yellow); font-size: .64rem; font-weight: 900; letter-spacing: .1em; line-height: 1; }
.browser-support-pill { appearance: none; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--ink); border-radius: 999px; padding: 4px 9px; font: inherit; font-size: .64rem; font-weight: 900; letter-spacing: .08em; line-height: 1; text-transform: uppercase; cursor: pointer; }
.browser-support-pill.is-supported { background: #6EE7A8; color: var(--ink); }
.browser-support-pill.is-unsupported { background: var(--ink); color: var(--white); }
.browser-support-pill:hover, .browser-support-pill:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.browser-support-dialog { width: min(calc(100% - 32px), 570px); padding: 0; border: var(--border); border-radius: var(--radius-lg); background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.browser-support-dialog::backdrop { background: rgb(25 18 45 / .72); }
.browser-support-dialog-inner { display: grid; gap: 14px; justify-items: start; padding: clamp(22px, 6vw, 36px); }
.browser-support-dialog-inner h2, .browser-support-dialog-inner p { margin: 0; }
.browser-support-dialog-inner p { line-height: 1.55; }
.browser-support-dialog-inner .btn { width: 100%; margin-top: 4px; }
.browser-checkout-notice { border: 2px solid var(--ink); border-radius: var(--radius-md); padding: 16px; background: var(--grey-50); }
.browser-checkout-notice strong { display: block; margin-bottom: 5px; }
.browser-checkout-notice p { margin: 0; line-height: 1.5; }
.status-pill, .tag { display: inline-flex; align-items: center; border: 2px solid var(--ink); border-radius: 999px; padding: 6px 10px; background: var(--yellow); font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.btn { min-height: 54px; border: var(--border); border-radius: var(--radius-sm); padding: 12px 18px; font-weight: 900; background: var(--white); box-shadow: 3px 3px 0 var(--ink); transition: transform .12s ease, box-shadow .12s ease; }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--yellow); }
.btn-purple { background: var(--purple); color: var(--white); }
.btn-ghost { box-shadow: none; background: var(--paper); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.player-count-grid .choice:last-child { grid-column: span 2; }
.choice { min-height: 72px; border: var(--border); border-radius: var(--radius-md); background: var(--white); font-weight: 900; font-size: 1.15rem; display: grid; place-items: center; gap: 3px; padding: 10px; }
.choice.is-selected { background: var(--purple); color: var(--white); box-shadow: var(--shadow); }
.choice.is-unavailable, .choice:disabled { background: var(--grey-50); color: var(--grey-500); border-color: var(--grey-500); opacity: .62; cursor: not-allowed; box-shadow: none; }
.choice.is-unavailable:hover, .choice:disabled:hover { transform: none; box-shadow: none; }
.choice-unavailable-label { display: block; font-size: .62rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.panel, .theme-card, .character-card, .question-card, .preview-page { border: var(--border); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); overflow: hidden; }
.panel-body, .question-card, .character-card { padding: 22px; }
.theme-card { transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.theme-card.is-selected { background: var(--purple-pale); }
.theme-card-image { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--purple-pale); border-bottom: var(--border); }
.theme-card-body { padding: 20px; }
.theme-card-body p { margin-bottom: 14px; }
.theme-card-body .btn { width: 100%; }
.theme-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.theme-price-tag { background: var(--purple); color: var(--white); }
.playtesting-tag { background: #93C5FD; color: var(--ink); }
.playtesting-tag-button { cursor: pointer; box-shadow: none; }
.playtesting-tag-button:hover, .playtesting-tag-button:focus-visible { background: #60A5FA; outline: 2px solid var(--ink); outline-offset: 2px; }
.playtesting-dialog { width: min(calc(100% - 32px), 560px); padding: 0; border: var(--border); border-radius: var(--radius-lg); background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.playtesting-dialog::backdrop { background: rgb(25 18 45 / .72); }
.playtesting-dialog-inner { display: grid; gap: 14px; justify-items: start; padding: clamp(22px, 6vw, 36px); }
.playtesting-dialog-inner h2, .playtesting-dialog-inner p { margin: 0; }
.playtesting-dialog-inner p { line-height: 1.55; }
.playtesting-dialog-inner .btn { width: 100%; margin-top: 4px; }
.theme-selection-status { min-height: 1.5rem; margin: -12px 0 14px; font-size: .86rem; font-weight: 800; color: var(--purple); }
.empty-state { border: var(--border); border-radius: var(--radius-lg); background: var(--purple-pale); padding: 24px; }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-weight: 900; }
.character-name-field > label { text-align: center; }
.character-name-input { text-align: center; }
.input, .select { width: 100%; min-height: 54px; border: var(--border); border-radius: var(--radius-sm); background: var(--white); padding: 11px 14px; }
.input:focus, .select:focus { border-color: var(--purple); }
.helper-row { display: flex; justify-content: space-between; gap: 12px; font-size: .8rem; color: var(--grey-500); }
.helper-row-end { justify-content: flex-end; }
.carousel-control { display: grid; grid-template-columns: 48px minmax(0,1fr) 48px; gap: 10px; align-items: center; margin-bottom: 20px; }
.carousel-control.is-fixed { grid-template-columns: minmax(0, 1fr); }
.carousel-arrow { width: 48px; height: 48px; border: var(--border); border-radius: 50%; background: var(--yellow); font-size: 1.4rem; font-weight: 900; }
.carousel-value { min-height: 62px; border: var(--border); border-radius: var(--radius-md); background: var(--grey-50); display: grid; place-items: center; padding: 10px; text-align: center; font-weight: 900; min-width: 0; }
.character-card-stack { scroll-margin-top: 110px; }
.character-icon { width: min(58vw, 220px); aspect-ratio: 1; margin: 0 auto; object-fit: contain; }
.character-fixed-visual { display: grid; justify-items: center; gap: 10px; margin: 0 auto 24px; }
.character-fixed-visual .character-icon { margin-bottom: 0; }
.character-adjectives { margin: 0; }
.character-icon-helper { margin: -2px 0 0; color: var(--grey-500); font-size: .78rem; font-weight: 800; text-align: center; }
.character-role { text-align: center; font-size: .8rem; text-transform: uppercase; font-weight: 900; letter-spacing: .1em; margin-bottom: 18px; }
.character-description { text-align: center; margin: 6px auto 0; max-width: 42rem; line-height: 1.55; }
.victim-adjectives { margin: -4px 0 22px; }
.adjective-line { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.adjective-pill { border: 2px solid var(--ink); border-radius: 999px; padding: 5px 9px; color: var(--ink); font-weight: 900; line-height: 1.2; }
.adjective-pill[data-tone="friendly"] { background: var(--tone-friendly); }
.adjective-pill[data-tone="intelligent"] { background: var(--tone-intelligent); }
.adjective-pill[data-tone="secretive"] { background: var(--tone-secretive); }
.adjective-pill[data-tone="manipulative"] { background: var(--tone-manipulative); }
.adjective-pill[data-tone="careless"] { background: var(--tone-careless); }
.adjective-pill[data-tone="hostile"] { background: var(--tone-hostile); }
.adjective-pill[data-tone="evil"] { background: var(--tone-evil); color: var(--white); }
.adjective-pill[data-tone="formal"] { background: var(--tone-formal); }
.adjective-pill[data-tone="calm"] { background: var(--tone-calm); }
.adjective-pill[data-tone="quirky"] { background: var(--tone-quirky); }
.adjective-pill[data-tone="romantic"] { background: var(--tone-romantic); }
.difficulty-list { display: grid; gap: 14px; }
.difficulty-card { text-align: left; padding: 20px; border: var(--border); border-radius: var(--radius-md); background: var(--white); }
.difficulty-card h2 { margin: 0 0 6px; line-height: 1.15; }
.difficulty-card p { margin: 0; }
.difficulty-card.is-selected { background: var(--yellow); box-shadow: var(--shadow); }
.clean-question-card { display: grid; place-items: center; min-height: 170px; }
.question-answer-control { max-width: 560px; font-size: 1.05rem; }
.cover-carousel-preview { margin: 0; width: min(100%, 360px); }
.cover-carousel-preview img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; }
.cover-carousel-preview figcaption { padding-top: 8px; text-align: center; font-size: .82rem; }
.preview-page { box-shadow: 5px 5px 0 var(--ink); }
.preview-cover {
  position: relative;
  width: min(100%, 620px);
  aspect-ratio: 210 / 297;
  container-type: inline-size;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  display: block;
  overflow: hidden;
  background: var(--ink);
}
.preview-cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.preview-cover-panel {
  position: absolute;
  z-index: 1;
  top: var(--cover-panel-top, 8.55%);
  left: 50%;
  width: var(--cover-panel-width, 78%);
  transform: translateX(-50%);
  background: var(--cover-panel-background, var(--ink));
  color: var(--cover-panel-text, var(--white));
  border: 3px solid var(--white);
  border-radius: clamp(10px, 2.4cqw, var(--radius-md));
  padding: clamp(12px, 4cqw, 28px);
  text-align: center;
}
.preview-cover-panel .eyebrow { color: inherit; font-size: clamp(.56rem, 1.75cqw, .78rem); }
.preview-cover-title {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 7.8cqw, 3.8rem);
  line-height: .98;
  overflow-wrap: anywhere;
}
.preview-cover-byline { margin: 0 0 14px; font-size: clamp(.7rem, 2.2cqw, 1rem); }
.preview-cover-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: clamp(6px, 1.8cqw, 10px); }
.preview-cover-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: clamp(5px, 1.4cqw, 7px) clamp(9px, 2.4cqw, 13px);
  color: var(--ink);
  font-size: clamp(.56rem, 1.75cqw, .8rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}
.preview-cover-player-pill { background: var(--purple); }
.preview-cover-difficulty-pill { background: var(--yellow); }
.preview-page-inner { padding: 24px; }
.cast-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.cast-card { position: relative; border: 2px solid var(--ink); border-radius: var(--radius-md); padding: 38px 14px 14px; background: var(--grey-50); text-align: center; }
.cast-card img { width: 82px; height: 82px; object-fit: contain; border-radius: 15px; margin: 0 auto 10px; }
.document-section { margin: 0 0 22px; }
.document-section:last-child { margin-bottom: 0; }
.document-section h3 { padding-bottom: 8px; border-bottom: 3px solid var(--purple); }
.rich-paragraph { margin: 0; white-space: pre-wrap; }
.preview-document .rich-paragraph { padding-left: 0; }
.rich-run.semantic-suspect-name, .semantic-suspect-name { color: var(--text-suspect); font-weight: 900; }
.rich-run.semantic-witness-name, .semantic-witness-name { color: var(--text-witness); font-weight: 900; }
.rich-run.semantic-victim-name, .semantic-victim-name { color: var(--ink); font-weight: 900; }
.rich-run.semantic-custom-field, .semantic-custom-field { color: var(--text-custom); font-weight: 900; }
.rich-run.semantic-time, .semantic-time { color: var(--text-time); font-weight: 900; }
.preview-notice { width: 100%; border: 3px dashed var(--ink); border-radius: var(--radius-md); background: var(--purple-pale); padding: 18px; font-weight: 800; }
.preview-notice-accuracy { background: var(--yellow); }
.preview-notice-spoiler { background: var(--purple-pale); }
.error-panel { border: var(--border); border-radius: var(--radius-md); background: #fff2f2; padding: 20px; }
.loading { display: grid; place-items: center; min-height: 260px; font-weight: 900; }
.loading::after { content: ""; width: 44px; height: 44px; border: 6px solid var(--purple-pale); border-top-color: var(--purple); border-radius: 50%; animation: spin .8s linear infinite; margin-top: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
.blueprint-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.blueprint-list > * { border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--grey-50); }

@media (min-width: 560px) {
  .cast-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


@media (min-width: 760px) {
  .choice-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .player-count-grid .choice:last-child { grid-column: auto; }
  .character-card, .question-card { padding: 34px; }
  .cast-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Refinement patch: reset action, icon controls, cover previews and document fonts */
.header-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--white);
  font-size: .72rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
}
.header-reset-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.header-reset-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.header-recover-btn { background: var(--purple-pale); }

.theme-card-image { object-position: center bottom; }

.carousel-arrow:disabled {
  opacity: .34;
  cursor: not-allowed;
  background: var(--grey-100);
  transform: none;
  box-shadow: none;
}
.character-icon-carousel { width: min(100%, 370px); margin: 0 auto; justify-self: center; }
.character-icon-carousel .carousel-value {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.document-font-section { margin: 8px 0 28px; }
.document-font-section h2 { margin-bottom: 12px; }
.document-font-options { display: grid; grid-template-columns: 1fr; gap: 10px; }
.document-font-option {
  min-height: 76px;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--white);
  padding: 12px 14px;
  display: grid;
  gap: 5px;
  text-align: left;
}
.document-font-option.is-selected { background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); }
.document-font-sample { font-size: 1rem; font-weight: 400; }

.cover-carousel-preview { width: min(100%, 330px); }
.cover-carousel-preview img {
  width: 100%;
  aspect-ratio: 210 / 297;
  object-fit: contain;
  object-position: center;
  background: var(--grey-50);
  border-radius: 14px;
}

.preview-page { font-family: var(--document-font-family, inherit); }
.preview-character-heading { text-align: center; }

@media (min-width: 560px) {
  .document-font-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Step 8 preview refinements: squarer cover panel, tighter cast cards and PDF-aligned rules */
.preview-cover-panel {
  border-radius: clamp(3px, .8cqw, 7px);
}

.cast-card img {
  margin-bottom: 2px;
}

.cast-card > strong {
  display: block;
  line-height: 1.15;
}

.preview-rules-heading {
  margin: 0 0 18px;
  text-align: center;
}

.preview-read-aloud-box {
  margin: 0 0 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--yellow);
  padding: 14px 16px;
}

.preview-read-aloud-title {
  margin: 0 0 4px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.preview-read-aloud-text {
  margin: 0;
}

.preview-rules-divider {
  height: 3px;
  margin: 0 0 22px;
  background: var(--purple);
}

.preview-rules-announcement > .document-section {
  margin-bottom: 24px;
}

.preview-rules-flow {
  display: grid;
  gap: 0;
}

.preview-rules-paragraph {
  margin: 0 0 1rem;
  line-height: 1.6;
}

.preview-rule-character-info {
  color: var(--text-witness);
  font-weight: 900;
}

.preview-rule-secret-info {
  color: var(--text-suspect);
  font-weight: 900;
}

.preview-rules-summary {
  margin-top: 8px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--purple-pale);
  padding: 16px;
}

.preview-rules-summary-list {
  margin: 6px 0 14px;
  padding-left: 18px;
}

.preview-rules-summary-list .preview-rules-paragraph {
  position: relative;
  margin-bottom: 6px;
}

.preview-rules-summary-list .preview-rules-paragraph::before {
  content: "•";
  position: absolute;
  left: -16px;
  font-weight: 900;
}

.preview-rules-summary > .preview-rules-paragraph:last-child,
.preview-rules-summary-list .preview-rules-paragraph:last-child {
  margin-bottom: 0;
}

.preview-character-icon {
  display: block;
  width: min(42vw, 160px);
  aspect-ratio: 1;
  margin: 8px auto 12px;
  object-fit: contain;
}

/* Checkout, recovery and local-only PDF/ZIP export */
.checkout-panel,
.prepared-order-panel,
.recovery-panel,
.local-export-panel {
  display: grid;
  gap: 14px;
}

.checkout-panel h2,
.checkout-panel p,
.prepared-order-panel h2,
.prepared-order-panel p,
.recovery-panel h2,
.recovery-panel p,
.local-export-panel h2,
.local-export-panel p {
  margin: 0;
}

.checkout-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.checkout-primary-button { width: 100%; }

.checkout-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.checkout-price strong { font-size: 1.55rem; }

.checkout-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.35rem;
  line-height: 1.45;
}

.checkout-status { min-height: 1.5em; margin: 0; font-size: .9rem; }
.checkout-status.is-success { color: #176b3a; font-weight: 900; }
.checkout-status.is-error { color: #a01818; font-weight: 900; }

.generation-progress {
  display: grid;
  gap: 11px;
  margin-top: 2px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--purple-pale);
}

.generation-progress[hidden] { display: none; }

.generation-progress-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.generation-spinner {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border: 4px solid var(--white);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.generation-progress-track {
  height: 13px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--white);
}

.generation-progress-fill {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  animation: generation-progress-slide 1.35s ease-in-out infinite;
}

.generation-progress-message,
.generation-progress-note { margin: 0; }
.generation-progress-message { font-weight: 900; }
.generation-progress-note { font-size: .82rem; line-height: 1.45; }

@keyframes generation-progress-slide {
  0% { transform: translateX(-115%); }
  50% { transform: translateX(70%); }
  100% { transform: translateX(240%); }
}

@media (prefers-reduced-motion: reduce) {
  .generation-spinner,
  .generation-progress-fill { animation: none; }
  .generation-progress-fill { width: 100%; }
}

.recover-link { margin: 16px 0 0; text-align: center; }
.recover-link a { color: var(--purple); font-weight: 900; }

.recovery-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: white;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.recovery-code-row {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.recovery-code {
  margin: 12px 0;
  padding: 14px;
  border: 2px dashed var(--purple);
  border-radius: 12px;
  background: var(--purple-pale);
  color: var(--purple);
  font-size: clamp(1.05rem, 4.8vw, 1.45rem);
  font-weight: 950;
  letter-spacing: .06em;
  text-align: center;
  overflow-wrap: anywhere;
}

.recovery-code-inline { margin: 4px 0 0; padding: 10px; text-align: left; }

.order-details { display: grid; gap: 8px; }
.order-details > div { display: flex; justify-content: space-between; gap: 16px; }
.order-details span { text-align: right; overflow-wrap: anywhere; }

.recovery-dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 10px 10px 0 var(--ink);
}

.recovery-dialog::backdrop { background: rgb(25 18 45 / .72); }
.recovery-dialog-inner { display: grid; gap: 14px; padding: clamp(20px, 5vw, 34px); }
.recovery-dialog-inner h2, .recovery-dialog-inner p { margin: 0; }

.local-export-panel {
  margin-top: 18px;
  background: var(--purple-pale);
}

.local-export-button {
  width: 100%;
  margin-top: 4px;
}

@media (min-width: 560px) {
  .checkout-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recovery-code-row { grid-template-columns: 1fr auto; align-items: end; }

  .local-export-button {
    width: auto;
    justify-self: start;
  }
}

/* Character assignment + role clarity */
.character-card { position: relative; }
.character-card-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}
.character-card-topline .character-role {
  margin: 2px 0 0;
  text-align: left;
}
.character-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.character-type-pill.is-suspect { background: var(--tone-hostile); color: var(--white); }
.character-type-pill.is-witness { background: var(--tone-formal); color: var(--ink); }
.character-type-pill.is-victim { background: var(--ink); color: var(--white); }
.character-player-name-mount { margin-top: 4px; }
.character-add-player-name { width: 100%; }
.character-player-name-field { margin: 0; }
.character-player-name-field > label { text-align: center; }
.character-player-name-input { text-align: center; }
.character-player-name-helper { margin: 0; text-align: center; }
.cast-card-player-line { margin: 0; font-weight: 400; }
.cast-card-player-line strong, .cast-card-name { font-weight: 900; font-style: normal; }
.cast-card-player-line span { font-weight: 400; font-style: normal; }
.cast-character-type-pill {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.cast-character-type-pill.is-suspect { background: var(--tone-hostile); color: var(--white); }
.cast-character-type-pill.is-witness { background: var(--tone-formal); color: var(--ink); }
.cast-character-type-pill.is-victim { background: var(--ink); color: var(--white); }
.character-icon { transition: opacity .1s ease; }

@media (max-width: 480px) {
  .character-card-topline { grid-template-columns: 1fr; }
  .character-card-topline .character-role { text-align: center; }
  .character-type-pill { justify-self: center; }
}


/* Order expiry guidance */
.order-expiry-note {
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--yellow);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 850;
  line-height: 1.45;
}

.order-expiry-note.is-paid {
  background: var(--purple-pale);
}

/* Site-wide FAQ help */
.help-page-footer {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 24px 0 4px;
}

.help-launcher {
  border: 0;
  padding: 4px 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.help-launcher:hover,
.help-launcher:focus-visible {
  color: var(--purple-dark, var(--purple));
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 4px;
}

.help-dialog {
  width: min(calc(100% - 24px), 760px);
  max-height: min(88vh, 820px);
  padding: 0;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.help-dialog::backdrop {
  background: rgb(25 18 45 / .76);
}

.help-dialog-shell {
  display: grid;
  max-height: min(88vh, 820px);
  overflow: auto;
  overscroll-behavior: contain;
}

.help-dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 18px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.help-dialog-header h2 {
  margin: 5px 0 0;
  font-size: clamp(1.45rem, 5vw, 2rem);
  line-height: 1.05;
}

.help-dialog-close {
  flex: 0 0 auto;
  min-height: 38px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: .76rem;
  font-weight: 900;
  cursor: pointer;
}

.help-dialog-close:hover,
.help-dialog-close:focus-visible {
  background: var(--yellow);
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.help-faq-list {
  display: grid;
  gap: 10px;
  padding: 18px 22px 6px;
}

.help-faq-item {
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--white);
  overflow: hidden;
}

.help-faq-item summary {
  position: relative;
  padding: 15px 46px 15px 16px;
  font-weight: 900;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}

.help-faq-item summary::-webkit-details-marker {
  display: none;
}

.help-faq-item summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--purple);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.help-faq-item[open] summary {
  background: var(--purple-pale);
  border-bottom: 2px solid var(--ink);
}

.help-faq-item[open] summary::after {
  content: "−";
}

.help-faq-answer {
  padding: 14px 16px 16px;
}

.help-faq-answer p {
  margin: 0 0 10px;
  line-height: 1.55;
}

.help-faq-answer p:last-child {
  margin-bottom: 0;
}

.help-dialog-contact {
  display: grid;
  gap: 12px;
  margin: 18px 22px 24px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--purple-pale);
}

.help-dialog-contact p {
  margin: 0;
  font-weight: 800;
}

.help-email-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  text-align: center;
  text-decoration: none;
}


@media (min-width: 760px) {
  .help-launcher {
    right: 28px;
    bottom: 90px;
  }

  .help-dialog-header,
  .help-faq-list {
    padding-inline: 28px;
  }

  .help-dialog-contact {
    margin-inline: 28px;
  }
}

/* Reusable automatic promotion UI */
.promotion-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 29;
  display: flex;
  justify-content: center;
  padding: 0 14px 8px;
  pointer-events: none;
}
.promotion-pill {
  pointer-events: auto;
  max-width: min(100%, 660px);
  min-height: 42px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  padding: 8px 16px;
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}
.promotion-pill:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.promotion-pill:active { transform: translate(1px, 1px); box-shadow: none; }
.promotion-dialog {
  width: min(calc(100% - 32px), 540px);
  padding: 0;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.promotion-dialog::backdrop { background: rgb(25 18 45 / .72); }
.promotion-dialog-inner { display: grid; gap: 14px; padding: clamp(22px, 6vw, 36px); }
.promotion-dialog-inner h2, .promotion-dialog-inner p { margin: 0; }
.promotion-dialog-inner .btn { width: 100%; }
.promotion-code-display {
  border: 3px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--purple-pale);
  padding: 16px 12px;
  font-size: clamp(1.2rem, 6vw, 1.75rem);
  font-weight: 900;
  letter-spacing: .07em;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Paid checkout success: keep the final step focused on download, email and recovery. */
.paid-order-panel {
  gap: 18px;
}

.paid-order-panel .checkout-actions {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.paid-download-button {
  width: 100%;
}

.paid-delivery-note {
  margin: 0;
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.55;
}

.paid-order-divider {
  height: 2px;
  background: var(--ink);
}

.paid-order-panel .recovery-code-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 0;
}

.paid-order-panel .recovery-code-inline {
  margin-top: 3px;
  padding: 10px 12px;
  font-size: clamp(.95rem, 3.7vw, 1.15rem);
}

.paid-recovery-help {
  margin: -7px 0 0;
  line-height: 1.45;
}

.paid-order-expiry {
  margin: 0;
  padding-top: 13px;
  border-top: 1.5px solid var(--ink);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 850;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .paid-order-panel .recovery-code-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .paid-order-panel .recovery-code-row .btn {
    width: 100%;
  }
}

/* Mystery preparation: keep generation, context and recovery in a simple hierarchy. */
.preparing-order-panel {
  gap: 16px;
}

.preparing-order-panel .checkout-actions {
  margin-top: 0;
}

.generation-progress-clean {
  gap: 9px;
  margin: 0;
  padding: 8px 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.generation-progress-clean .generation-progress-heading {
  gap: 12px;
}

.generation-progress-clean .generation-spinner {
  width: 29px;
  height: 29px;
  flex-basis: 29px;
  border-color: var(--purple-pale);
  border-top-color: var(--purple);
}

.generation-progress-clean .generation-progress-heading strong {
  font-size: 1.08rem;
}

.generation-progress-clean .generation-progress-message {
  padding-left: 41px;
  font-weight: 700;
  line-height: 1.5;
}

.preparation-auto-update {
  min-height: 0;
  font-size: .92rem;
  line-height: 1.5;
}

.preparation-divider {
  height: 2px;
  background: var(--ink);
}

.preparing-order-panel .recovery-code-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 0;
}

.preparing-order-panel .recovery-code-inline {
  margin-top: 3px;
  padding: 10px 12px;
  font-size: clamp(.95rem, 3.7vw, 1.15rem);
}

.preparation-recovery-help {
  margin: -7px 0 0;
  line-height: 1.45;
}

.preparation-expiry {
  margin: 0;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 850;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .generation-progress-clean .generation-progress-message {
    padding-left: 0;
  }

  .preparing-order-panel .recovery-code-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .preparing-order-panel .recovery-code-row .btn {
    width: 100%;
  }
}

/* Checkout hand-off: the footer is the only checkout action. */
.checkout-footer-button:disabled {
  background: var(--grey-100);
  color: var(--grey-500);
  border-color: var(--grey-500);
  opacity: 1;
  box-shadow: none;
}

.checkout-footer-button:disabled:hover {
  transform: none;
  box-shadow: none;
}

.ready-checkout-panel {
  gap: 12px;
}

.ready-checkout-panel .recovery-code-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 0;
}

.ready-checkout-panel .recovery-code-inline {
  margin-top: 3px;
  padding: 9px 11px;
  font-size: clamp(.95rem, 3.5vw, 1.08rem);
}

.ready-checkout-recovery-help,
.ready-checkout-note,
.ready-checkout-expiry {
  margin: 0;
  line-height: 1.45;
}

.ready-checkout-note {
  min-height: 0;
  padding-top: 12px;
  border-top: 1.5px solid var(--ink);
  font-size: .9rem;
}

.ready-checkout-expiry {
  color: var(--ink);
  font-size: .84rem;
  font-weight: 850;
}

@media (max-width: 480px) {
  .ready-checkout-panel .recovery-code-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ready-checkout-panel .recovery-code-row .btn {
    width: 100%;
  }
}

/* Checkout robustness polish: delivery status, restart action and expired preparation. */
.paid-create-another-button {
  width: 100%;
}

.paid-delivery-note.is-warning {
  padding: 11px 13px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--purple-pale);
}

.expired-order-panel {
  gap: 14px;
}

.expired-order-panel .btn {
  width: 100%;
}

