/* Future Forge — design system */

:root {
  --bg-0: #070b14;
  --bg-1: #0c1220;
  --bg-2: #121a2b;
  --bg-3: #1a2438;
  --bg-elevated: #151f33;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef9;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --accent-3: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --glow: 0 0 40px rgba(56, 189, 248, 0.15);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
  --stage-present: #1e293b;
  --stage-prototype: #1e3a5f;
  --stage-transition: #164e63;
  --stage-transformed: #312e81;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* Modest horizontal breathing room (not full-bleed, not huge margins) */
  --page-gutter: clamp(0.75rem, 2vw, 1.25rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(56, 189, 248, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(167, 139, 250, 0.1), transparent 50%),
    radial-gradient(800px 400px at 50% 100%, rgba(52, 211, 153, 0.06), transparent 50%),
    var(--bg-0);
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.45s var(--ease);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Shared page content shell (theme, mission, outcome, etc.) */
.content {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding: 1.25rem var(--page-gutter) 2.5rem;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Title —— */
#screen-title {
  align-items: center;
  justify-content: center;
  padding: 2rem var(--page-gutter);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.title-orb {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 65%);
  filter: blur(4px);
  animation: pulseOrb 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulseOrb {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

.title-card {
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
}

.title-spark-reset-wrap {
  margin: 0.65rem 0 0;
  text-align: center;
}

.title-spark-reset-wrap .btn {
  opacity: 0.85;
}

/* G4 — daily + pins on title */
.daily-card {
  margin-top: 1.75rem;
  text-align: left;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.1), rgba(7, 11, 20, 0.55));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.daily-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.45rem;
}

.daily-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--mono);
}

.daily-hint {
  font-size: 0.78rem;
}

.daily-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--text);
}

.daily-meta {
  margin: 0 0 0.45rem;
  font-size: 0.84rem;
}

.daily-scene {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.daily-actions {
  justify-content: flex-start;
  margin: 0;
}

.pins-panel {
  margin-top: 1.25rem;
  text-align: left;
}

.pins-heading {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: var(--text);
}

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

.pin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.4);
}

.pin-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pin-copy strong {
  font-size: 0.88rem;
  color: var(--text);
}

.pin-copy .muted {
  font-size: 0.78rem;
}

.pin-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mission-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mission-card-wrap .challenge-card {
  width: 100%;
}

.btn-pin {
  align-self: flex-end;
  margin: -0.35rem 0.35rem 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.65);
  color: var(--text-mute);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1;
}

.btn-pin:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fbbf24;
}

.btn-pin.is-pinned,
#btn-daily-pin.is-pinned {
  border-color: rgba(251, 191, 36, 0.5);
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

/* Friends multiplayer */
#screen-friends .friends-content {
  max-width: min(1100px, 100%);
  /* Extra side breathing room so labels/fields never kiss the viewport edge */
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  box-sizing: border-box;
  width: 100%;
}

.friends-vs-solo {
  margin: 0 0 0.65rem;
}

.friends-rules {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  line-height: 1.45;
}

.friends-rules li {
  margin: 0;
}

.friends-hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.friends-panel {
  min-width: 0; /* grid children can shrink without clipping labels */
  overflow: visible;
  /* Content sits directly in .panel (no .panel-body) — give the card real inset */
  padding: 1.15rem 1.35rem 1.35rem;
}

.friends-panel .field {
  min-width: 0;
}

/* Space action buttons off the field above (Create / Join / Hotseat) */
.friends-panel > .btn,
.friends-panel .friends-panel-form > .btn {
  margin-top: 1rem;
}

.friends-panel .field label {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.friends-panel h2 {
  margin: 0 0 0.95rem;
  font-size: 1.1rem;
  padding: 0;
}

.friends-panel-wide {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .friends-hub-grid {
    grid-template-columns: 1fr;
  }

  #screen-friends .friends-content {
    padding-inline: clamp(1rem, 5vw, 1.5rem);
  }
}

.mp-ai-pending {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.08);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.mp-ai-pending[hidden] {
  display: none !important;
}

.mp-ai-log {
  font-size: 0.8rem;
  max-height: 6rem;
  overflow: auto;
  margin-bottom: 0.75rem;
}

.mp-ai-log p {
  margin: 0.25rem 0;
}

.hs-setup {
  margin-top: 0.75rem;
}

.friends-status {
  margin-top: 1rem;
  font-size: 0.88rem;
}

.code-input {
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* display:inline-flex beats UA [hidden] — force hide when attribute is set */
.room-code-chip[hidden] {
  display: none !important;
}

.room-code-chip.sm {
  font-size: 0.78rem;
}

.room-code-chip strong {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  color: var(--accent);
}

/* Room lobby: side padding like friends hub (labels/code never flush to edge) */
#screen-room-lobby .room-lobby-content {
  max-width: min(1200px, 100%);
  width: 100%;
  box-sizing: border-box;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.room-connect-panel {
  padding: 1.15rem 1.35rem 1.25rem;
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), var(--bg-elevated, #151f33));
}

.room-connect-panel h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.room-connect-lead {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.room-connect-grid {
  display: grid;
  grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  gap: 0.85rem 1.25rem;
  align-items: start;
}

.room-connect-field {
  min-width: 0;
}

.room-connect-field-wide {
  grid-column: 2;
}

@media (max-width: 640px) {
  .room-connect-grid {
    grid-template-columns: 1fr;
  }
  .room-connect-field-wide {
    grid-column: 1;
  }
  #screen-room-lobby .room-lobby-content {
    padding-inline: clamp(1rem, 5vw, 1.5rem);
  }
}

.room-connect-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute, #94a3b8);
  margin-bottom: 0.3rem;
}

.room-connect-code {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 1.45rem;
  letter-spacing: 0.14em;
  color: #7dd3fc;
}

.room-connect-urls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.room-connect-urls li {
  margin: 0;
}

.room-connect-urls a,
.room-connect-url {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.95rem;
  color: #6ee7b7;
  word-break: break-all;
}

.room-connect-hint {
  margin: 0.75rem 0 0;
}

.room-connect-actions {
  margin-top: 0.85rem;
  justify-content: flex-start;
}

.room-lobby-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(0, 1.6fr);
  gap: 1.25rem;
  max-width: 100%;
  width: 100%;
}

.room-lobby-layout.room-lobby-wide {
  max-width: 100%;
  grid-template-columns: minmax(15rem, 0.75fr) minmax(0, 2.4fr);
  padding-bottom: 0;
}

/* Party / Mission cards: content sits in .panel with no .panel-body — real inset */
#screen-room-lobby .room-lobby-party,
#screen-room-lobby .room-lobby-mission {
  min-width: 0;
  padding: 1.15rem 1.35rem 1.35rem;
  box-sizing: border-box;
}

#screen-room-lobby .room-lobby-party h2,
#screen-room-lobby .room-lobby-mission h2 {
  margin: 0 0 0.85rem;
  padding: 0;
  font-size: 1.1rem;
}

.room-lobby-mission {
  min-width: 0;
}

.room-mission-summary {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* Visual theme / mission picker (multiplayer) */
.mp-setup-panel {
  width: 100%;
}

.mp-setup-intro h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

.mp-setup-intro {
  margin-bottom: 1rem;
}

.mp-pick-step {
  margin-bottom: 1.25rem;
}

.mp-pick-label {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
}

.mp-pick-blurb {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.9rem;
}

.mp-pick-grid.challenge-grid {
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.85rem;
}

.mp-pick-card.is-selected {
  outline: 2px solid var(--accent-3);
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35), var(--glow);
}

.mp-pick-card.is-selected .cta {
  color: var(--accent-3);
}

.mp-setup-actions {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 0 0.25rem;
  background: linear-gradient(180deg, transparent, rgba(7, 11, 20, 0.92) 30%);
  z-index: 2;
}

/* Hotseat multiplayer bar on solo workshop */
.mp-workshop-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.92);
  padding: 0.3rem var(--page-gutter) 0.35rem;
  z-index: 40;
}

.mp-workshop-bar.is-contrib-locked {
  opacity: 0.85;
}

.mp-workshop-bar.is-contrib-locked #btn-mp-pass-device,
.mp-workshop-bar.is-contrib-locked .mp-seat-tab:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Challenge: defense locked while AI judges */
#challenge-answer.is-evaluating,
#challenge-how-edit.is-evaluating {
  cursor: wait;
  opacity: 0.85;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.9);
}
body.challenge-combat-busy #challenge-answer,
body.challenge-spectator #challenge-answer {
  cursor: default;
}
body.challenge-spectator #mode-panel-defend {
  /* Keep defense panel visible so followers can read the live draft */
  opacity: 1;
}

/* Invent screen: contribution eval in flight after blur */
body.mp-contrib-evaluating #invention-how,
body.mp-contrib-evaluating #invention-impact,
body.mp-contrib-evaluating #invention-name {
  cursor: wait;
  opacity: 0.78;
}
body.mp-contrib-evaluating #tech-list .tech-card {
  pointer-events: none;
  opacity: 0.5;
  cursor: wait;
}
body.mp-contrib-evaluating #btn-fill-other,
body.mp-contrib-evaluating #btn-to-challenge,
body.mp-contrib-evaluating .story-mode-btn {
  cursor: wait;
  opacity: 0.55;
}

/* Active player: leftmost in topbar brand (no extra vertical chrome) */
.brand .mp-active-player {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.15rem 0 0;
  padding: 0.2rem 0.65rem 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.22), rgba(52, 211, 153, 0.14));
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.12);
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .mp-active-player::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.28);
  flex-shrink: 0;
  animation: mp-active-pulse 1.6s ease-in-out infinite;
}

@keyframes mp-active-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.92);
  }
}

.brand .mp-active-player strong {
  color: #7dd3fc;
  font-weight: 800;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand .mp-active-player .mp-active-label {
  color: var(--muted, #94a3b8);
  font-weight: 550;
  font-size: 0.92em;
}

.brand .mp-active-player[hidden] {
  display: none !important;
}

/* Challenge screen: compact multiplayer seat strip (active + viewing) */
.mp-challenge-bar {
  margin: 0;
  padding: 0.4rem 1rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.55);
}
.mp-challenge-bar .mp-view-hint {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}
.mp-challenge-bar .mp-seat-tab {
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
}

.mp-workshop-bar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

/* Shell wraps each story textarea so the notice can cover it exactly */
.story-textarea-shell {
  position: relative;
  display: block;
}

.story-textarea-shell textarea {
  display: block;
  width: 100%;
}

/* Contribution result — solid panel over the edited textarea (auto-dismiss) */
.mp-contrib-banner {
  display: none;
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius, 10px);
  border: 1px solid #334155;
  /* Fully opaque — never see story text through this */
  background: #151f33;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  box-sizing: border-box;
}

.mp-contrib-banner.is-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.mp-contrib-banner.is-over-field.is-visible {
  display: flex;
}

.mp-contrib-banner.is-leaving {
  opacity: 0;
  transform: translateY(2px);
}

.mp-contrib-banner.is-accept {
  border-color: #34d399;
  background: #0d281f; /* solid opaque green */
}

.mp-contrib-banner.is-reject {
  border-color: #f87171;
  background: #2a1212; /* solid opaque red */
}

.mp-contrib-banner .mp-contrib-banner-title {
  display: block;
  font-weight: 750;
  margin-bottom: 0.2rem;
  font-size: 0.92rem;
}

.mp-contrib-banner.is-accept .mp-contrib-banner-title {
  color: #6ee7b7;
}

.mp-contrib-banner.is-reject .mp-contrib-banner-title {
  color: #fca5a5;
}

.mp-contrib-banner .mp-contrib-banner-body {
  margin: 0;
  color: #e2e8f0;
  font-size: 0.86rem;
}

.mp-contrib-banner .mp-contrib-banner-ap {
  margin: 0.3rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Sit directly on top of the textarea inside .story-textarea-shell */
.mp-contrib-banner.is-over-field {
  position: absolute;
  inset: 0;
  z-index: 12;
  margin: 0;
  overflow: auto;
  flex-direction: column;
  justify-content: center;
}

.mp-seat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.mp-seat-tab {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.5);
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
}

/* Ownership / presence color (not turn — turn is upper-left only)
 * green = your invent · neutral = someone else's · red = left the room */
.mp-seat-tab.is-mine {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(16, 185, 129, 0.08);
  color: #d1fae5;
}

.mp-seat-tab.is-other {
  border-color: rgba(100, 116, 139, 0.45);
  background: rgba(30, 41, 59, 0.55);
  color: var(--text-dim);
}

.mp-seat-tab.is-left {
  border-color: rgba(248, 113, 113, 0.75);
  background: rgba(127, 29, 29, 0.4);
  color: #fecaca;
}

.mp-seat-tab:hover {
  color: var(--text);
  filter: brightness(1.08);
}

.mp-seat-tab.is-left:hover {
  color: #fee2e2;
}

/* Currently open invent — stronger ring, keep ownership / left hue */
.mp-seat-tab.is-focused.is-mine {
  border-color: rgba(52, 211, 153, 0.85);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35);
  background: rgba(16, 185, 129, 0.16);
  color: var(--text);
}

.mp-seat-tab.is-focused.is-other {
  border-color: rgba(148, 163, 184, 0.7);
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.28);
  background: rgba(71, 85, 105, 0.28);
  color: var(--text);
}

.mp-seat-tab.is-focused.is-left {
  border-color: rgba(248, 113, 113, 0.95);
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.4);
  background: rgba(153, 27, 27, 0.5);
  color: #fee2e2;
}

/*
 * Whose turn — same green pulse light as the upper-left .mp-active-player badge.
 * On player name only; independent of focus ring / ownership fill.
 */
.mp-seat-tab.is-turn .mp-seat-tab-player {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.mp-seat-tab.is-turn .mp-seat-tab-player::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.28);
  flex-shrink: 0;
  animation: mp-active-pulse 1.6s ease-in-out infinite;
}

.mp-seat-tab .tag-editing {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.4);
}

.mp-seat-tab .tag-viewing {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.4);
}

.mp-seat-tab .tag-left {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.mp-view-hint {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
}

body.mp-hotseat .workshop-layout {
  height: calc(100vh - 57px - 4.25rem);
}

/* Hotseat setup = scrollable pick; play = workshop shell */
#screen-hotseat.is-setup {
  height: auto;
  max-height: none;
  overflow: auto;
}

#screen-hotseat.is-setup .mp-workshop {
  display: none !important;
}

#screen-hotseat:not(.is-setup) {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

#screen-hotseat:not(.is-setup) .mp-setup-shell {
  display: none !important;
}

#screen-hotseat:not(.is-setup) .mp-workshop {
  display: grid;
}

.mp-setup-shell {
  flex: 1;
  width: 100%;
  padding-bottom: 2rem;
}

.mp-setup-with-brief {
  display: grid;
  grid-template-columns: minmax(15rem, 0.85fr) minmax(0, 2.4fr);
  gap: 1.25rem;
  align-items: start;
}

.mp-setup-party {
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
}

.mp-setup-panel.panel {
  padding: 1.15rem 1.35rem 1.5rem;
}

/* Hotseat play reuses .workshop-layout */
.mp-workshop.workshop-layout {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
}

.mp-layer-field {
  padding: 0.5rem 0.85rem 0.25rem;
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.mp-layer-field label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute);
}

.mp-layer-field select {
  width: 100%;
  margin-top: 0.25rem;
}

.mp-party-strip {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.mp-seat-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mp-seat-inline li {
  flex: 0 1 auto;
}

.mp-section-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Local scenario scene — full text; long copy scrolls (see .ws-mission-scene rules) */
.mp-mission-scene {
  margin: 0.55rem 0 0.45rem !important;
  color: var(--text) !important;
  font-size: 0.95rem !important;
  line-height: 1.5;
  white-space: pre-wrap;
}
.mp-mission-scene.quest-brief {
  white-space: normal;
}

.mp-play-problem-brief {
  margin: 0.75rem 0 0.5rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.45);
}

.mp-play-problem-brief[hidden] {
  display: none !important;
}

.mp-play-brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1rem;
}

.mp-play-brief-grid h4 {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
}

.mp-play-brief-grid p {
  margin: 0 !important;
  font-size: 0.84rem !important;
  color: var(--text-dim) !important;
  line-height: 1.45;
}

.mp-play-brief-grid .mp-brief-warn p {
  color: #fcd34d !important;
}

@media (max-width: 1100px) {
  .mp-setup-with-brief {
    grid-template-columns: 1fr;
  }

  .mp-setup-party {
    position: static;
    max-height: none;
  }
}

@media (max-width: 800px) {
  .room-lobby-layout {
    grid-template-columns: 1fr;
  }

  .room-lobby-layout.room-lobby-wide {
    grid-template-columns: 1fr;
  }
}

.room-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.room-player-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.35);
  font-size: 0.88rem;
}

.room-player-list li.is-offline {
  opacity: 0.55;
}

.room-player-list .tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 700;
}

/* —— Multiplayer play shell (full-width, workshop-style) —— */
#screen-hotseat.active,
#screen-room-play.active {
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Online room play uses same workshop grid as hotseat */
#screen-room-play .mp-workshop.workshop-layout {
  display: grid;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
}

#screen-room-play .invent-center {
  overflow: auto;
  min-height: 0;
}

#screen-room-play .tech-library {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#screen-room-play .tech-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.mp-shell {
  display: grid;
  /* legacy: party : invent : vision — prefer .mp-workshop now */
  grid-template-columns: minmax(15rem, 0.9fr) minmax(0, 1.5fr) minmax(0, 1.4fr);
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  gap: 0;
  border-top: 1px solid var(--border);
}

.mp-party-panel,
.mp-main-panel,
.mp-side-panel {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.45);
}

.mp-side-panel {
  border-right: none;
  display: flex;
  flex-direction: column;
  background: rgba(7, 11, 20, 0.55);
  position: relative;
  top: auto;
  max-height: none;
}

.mp-party-panel {
  padding: 1rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Left-rail scenario brief */
.mp-scenario-brief {
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.45;
}

.mp-scenario-brief[hidden] {
  display: none !important;
}

.mp-brief-heading {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
}

.mp-brief-visual {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
}

.mp-brief-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mp-brief-theme {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
}

.mp-brief-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.mp-brief-place {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.mp-brief-scene {
  margin: 0 0 0.75rem;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.mp-brief-stake,
.mp-brief-meters {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
}

.mp-brief-stake .muted,
.mp-brief-meters .muted {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.room-lobby-party .mp-scenario-brief {
  margin-top: 0.75rem;
}

.mp-main-panel {
  padding: 1rem 1.25rem 2rem;
}

.mp-main-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.mp-main-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
}

.mp-main-header .muted {
  margin: 0;
}

.mp-main-header .friends-status {
  margin: 0;
  max-width: 22rem;
  text-align: right;
  font-size: 0.9rem;
}

.mp-play-primary {
  max-width: none;
}

.mp-play-primary h3 {
  margin: 1.15rem 0 0.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}

.mp-play-primary .field textarea {
  min-height: 5.5rem;
}

.mp-play-primary #hs-challenge-answer,
.mp-play-primary #mp-challenge-answer {
  min-height: 6.5rem;
}

/* Vision column fills height like workshop */
.mp-side-panel .side-tabs {
  flex-shrink: 0;
}

.mp-side-panel .side-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
}

.mp-side-panel .side-pane[hidden] {
  display: none !important;
}

.mp-side-panel .vision-canvas-wrap {
  flex: 1;
  min-height: min(42vh, 28rem);
  max-height: none;
}

.mp-side-panel .co-inventor-root {
  flex: 1;
  min-height: min(50vh, 32rem);
  display: flex;
  flex-direction: column;
}

.mp-side-panel .vision-narratives {
  max-height: 9rem;
  overflow: auto;
}

.mp-side-panel .co-messages {
  flex: 1;
  min-height: 12rem;
}

/* Legacy mp-shell (if used): stack only on very narrow; tablet uses workshop rules */
@media (max-width: 719px) {
  .mp-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
  }

  .mp-party-panel,
  .mp-main-panel,
  .mp-side-panel {
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .mp-side-panel .vision-canvas-wrap {
    min-height: 14rem;
  }
}

/* legacy class kept if referenced */
.mp-play-layout {
  display: contents;
}

.hs-open-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 1.25rem;
}

.hs-forge-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: rgba(15, 23, 42, 0.35);
  font-size: 0.85rem;
}

.hs-forge-card.is-active {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2);
}

.hs-forge-card.is-abandoned {
  opacity: 0.65;
}

.hs-forge-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.hs-forge-name {
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.hs-forge-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.35rem 0;
}

.hs-forge-stack .mp-chip.sm,
.mp-chip.sm {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
}

.hs-outcome {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.hs-rank-list {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}

.hs-rank-list li {
  margin-bottom: 0.4rem;
}

.sm {
  font-size: 0.78rem;
}

.mp-party-panel h3,
.mp-main-panel h2,
.mp-main-panel h3 {
  margin-top: 0;
}

.mp-news {
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

.mp-actions {
  margin: 0.5rem 0 1rem;
}

.mp-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.mp-chip {
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.mp-tech-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mp-tech-btn {
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.45);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.mp-tech-btn:hover {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text);
}

.lock-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--accent-2);
  min-height: 1em;
  margin-top: 0.2rem;
}

.field input[type="text"],
.field input:not([type]),
.field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.5);
  color: var(--text);
}

/* Home hero: Future Forge by Warmer Sun (same mark as HUD product logo) */
.title-logo {
  --ws-sun: #ffe29a;
  --ws-amber: #ff9f43;
  --ws-coral: #ff6b4a;
  --ws-cream: #fff4e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 0.75rem;
}

.title-logo-sun {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(
    circle at 35% 35%,
    #fff8e7 0%,
    var(--ws-sun) 28%,
    var(--ws-amber) 62%,
    var(--ws-coral) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 180, 100, 0.35),
    0 0 28px rgba(255, 159, 67, 0.55),
    0 0 56px rgba(255, 107, 74, 0.22);
}

.title-logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

#screen-title h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  color: var(--ws-cream, #fff4e6);
  text-shadow: 0 0 40px rgba(255, 159, 67, 0.18);
}

.title-logo-credit {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: rgba(247, 240, 230, 0.55);
}

.title-logo-link {
  color: #ffd28a;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.title-logo-link:hover {
  color: #fff4e6;
  border-bottom-color: rgba(255, 210, 138, 0.55);
}

.title-logo-link:focus-visible {
  outline: 2px solid rgba(255, 159, 67, 0.7);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Legacy class kept for any residual refs */
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: radial-gradient(
    circle at 35% 35%,
    #fff8e7 0%,
    #ffe29a 28%,
    #ff9f43 62%,
    #ff6b4a 100%
  );
  border: 1px solid rgba(255, 180, 100, 0.35);
  font-size: 0;
  margin-bottom: 1.25rem;
  box-shadow:
    0 0 0 1px rgba(255, 180, 100, 0.28),
    0 0 28px rgba(255, 159, 67, 0.45);
}

.tagline {
  color: var(--text-dim);
  font-size: 1.15rem;
  margin: 0 0 2rem;
}

.pitch {
  text-align: left;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(8px);
}

.pitch h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.pitch ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-dim);
}

.pitch li {
  margin-bottom: 0.45rem;
}

.pitch li strong {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, background 0.15s;
}

/* .btn { display:inline-flex } beats the UA [hidden] rule — force hide (Spark Lobby / End turn / Fill other side) */
.btn[hidden],
button.btn[hidden] {
  display: none !important;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-ghost {
  color: var(--text-dim);
  padding: 0.5rem 0.85rem;
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  border-radius: 999px;
}

/* —— Top bar —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem var(--page-gutter);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.progress-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pill {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-mute);
}

.pill.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.12);
}

.pill.done {
  color: var(--accent-3);
  border-color: rgba(52, 211, 153, 0.35);
}

/* —— Layout shells —— */
.panel {
  background: rgba(18, 26, 43, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-body {
  padding: 1.1rem;
}

/* —— Challenge select —— */
#screen-challenge .content {
  max-width: 1100px;
}

.section-intro {
  margin-bottom: 1.5rem;
}

.section-intro h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.section-intro p {
  margin: 0;
  color: var(--text-dim);
  max-width: 52ch;
}

.mission-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.mission-intro-text {
  flex: 1;
  min-width: min(100%, 28rem);
}

.mission-status {
  margin: 0 0 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text-dim);
  font-size: 0.92rem;
}

/* Theme brief — readable while scenarios draft */
.problem-brief {
  margin: 0 0 1.25rem;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(165deg, rgba(18, 26, 43, 0.95), rgba(12, 18, 32, 0.88));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.problem-brief.is-drafting {
  border-color: rgba(56, 189, 248, 0.28);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.08), 0 8px 28px rgba(0, 0, 0, 0.18);
}

.problem-brief-head {
  margin-bottom: 0.85rem;
}

.problem-brief-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.problem-brief-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-mute);
}

.problem-brief-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (max-width: 900px) {
  .problem-brief-grid {
    grid-template-columns: 1fr;
  }
}

.problem-brief-block {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.45);
}

.problem-brief-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.problem-brief-block p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.problem-brief-warn {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.06);
}

.problem-brief-warn h3 {
  color: var(--warn);
}

.mission-status.loading {
  border-color: rgba(56, 189, 248, 0.35);
}

.mission-status .co-dots {
  display: inline-flex;
  gap: 0.25rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.mission-status .co-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s ease-in-out infinite;
}

.mission-status .co-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.mission-status .co-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.challenge-card .scenario-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  margin-left: 0.35rem;
}

.challenge-card .scenario-tag.curated {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.challenge-card .scenario-tag.generated {
  color: #7c9cff;
  border-color: rgba(124, 156, 255, 0.35);
}

.challenge-card .scenario-tag.solved-tag {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
}

.challenge-card.solved {
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.08);
}

.challenge-card.solved .cta {
  color: #6ee7b7;
}

.challenge-card .stakeholder-line {
  font-size: 0.8rem;
  color: var(--text-mute);
  margin: 0;
}

.theme-shelves {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.theme-shelf-title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.theme-shelf-blurb {
  margin: 0 0 0.85rem;
}

.theme-shelf-start {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* Quest hub — Themes / Sponsored / Learning / Library */
.quest-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.quest-hub-card {
  text-align: left;
  padding: 1.25rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(165deg, rgba(56, 189, 248, 0.06), transparent 45%),
    var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 200px;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
  cursor: pointer;
  color: inherit;
}
.quest-hub-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.quest-hub-card-meta {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 650;
}
.quest-hub-card h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.quest-hub-card p {
  margin: 0;
  flex: 1;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.45;
}
.quest-hub-card .cta {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--accent);
}
.catalog-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.catalog-intro-actions {
  flex-shrink: 0;
}
.quest-catalog-grid {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.quest-catalog-grid .catalog-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.quest-catalog-grid .catalog-remove {
  align-self: flex-end;
}
.catalog-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.catalog-section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}
.quest-module-card {
  min-height: 160px;
}

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

.challenge-card {
  text-align: left;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 220px;
  overflow: hidden;
}

.challenge-card-visual {
  padding: 0;
  min-height: 0;
}

.challenge-card-visual .card-visual {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
}

.challenge-card-visual .card-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s var(--ease);
}

.challenge-card-visual:hover .card-visual img {
  transform: scale(1.04);
}

.challenge-card-visual .card-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.95rem 1.15rem 1.15rem;
  flex: 1;
}

.challenge-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-3px);
  box-shadow: var(--glow);
}

.challenge-card .num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.challenge-card h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.challenge-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
  flex: 1;
}

.challenge-card .cta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.flag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.25rem;
}

.flag-problem {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.flag-prevention {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.flag-x {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.sixps-line {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.progress-strip-wrap {
  padding: 0.75rem 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.progress-strip-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 0.45rem;
}

.progress-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding-bottom: 0.75rem;
}

@media (max-width: 900px) {
  .progress-strip {
    grid-template-columns: 1fr;
  }
}

.progress-card {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-1);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 4.5rem;
}

.progress-card.matched {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.08);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15);
}

.progress-flag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.progress-card.matched .progress-flag {
  color: var(--accent-3);
}

.progress-card strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.progress-blurb {
  color: var(--text-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pathway-checks-wrap {
  margin-top: 0.25rem;
}

.pathway-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.pathway-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-dim);
  cursor: pointer;
  background: var(--bg-1);
}

.pathway-check.on {
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.08);
}

.pathway-check input {
  accent-color: #34d399;
}

.tech-card.realm-bits {
  box-shadow: inset 3px 0 0 #f87171;
}

.tech-card.realm-atoms {
  box-shadow: inset 3px 0 0 #38bdf8;
}

.tech-card.realm-both {
  box-shadow: inset 3px 0 0 #c4b5fd;
}

.tech-card.recommended:not(.selected) {
  box-shadow: inset 3px 0 0 var(--warn);
}

.tech-card.not-ready {
  opacity: 0.72;
}

.tech-card.not-ready .tech-domain {
  color: var(--warn);
}

.tech-chip.chip-wait {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.timing-box {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.timing-box strong {
  color: #fde68a;
}

.feasibility {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
}

.feasibility-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.feasibility-light {
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.15rem;
  box-shadow: 0 0 12px currentColor;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

/* Idle: solid traffic light (color = last / current level) */
.feasibility-light[data-level="red"] {
  background: #ef4444;
  color: rgba(239, 68, 68, 0.55);
  --feas-ring: #ef4444;
}

.feasibility-light[data-level="yellow"] {
  background: #eab308;
  color: rgba(234, 179, 8, 0.55);
  --feas-ring: #eab308;
}

.feasibility-light[data-level="green"] {
  background: #22c55e;
  color: rgba(34, 197, 94, 0.5);
  --feas-ring: #22c55e;
}

/*
 * Pending re-assess: hollow center; spinning ring in the last evaluated color.
 * No white frame — only the colored arc spins.
 */
.feasibility-light.is-pending {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none;
}

.feasibility-light.is-pending::before {
  /* Soft dim track in the level color (static) so the hole reads as a ring */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--feas-ring) 28%, transparent);
  box-sizing: border-box;
  pointer-events: none;
}

.feasibility-light.is-pending::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* Arc of last-evaluated color only — rest transparent */
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 200deg,
    color-mix(in srgb, var(--feas-ring) 15%, transparent) 240deg,
    color-mix(in srgb, var(--feas-ring) 70%, transparent) 300deg,
    var(--feas-ring) 335deg,
    color-mix(in srgb, var(--feas-ring) 90%, #fff) 350deg,
    transparent 360deg
  );
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3px),
    #000 calc(100% - 2.5px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 3px),
    #000 calc(100% - 2.5px)
  );
  animation: feasibility-light-sweep 0.9s linear infinite;
  pointer-events: none;
  box-sizing: border-box;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--feas-ring) 65%, transparent));
}

@keyframes feasibility-light-sweep {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .feasibility-light.is-pending::after {
    animation: none;
    /* Static arc in level color */
    background: conic-gradient(
      from 40deg,
      transparent 0deg,
      transparent 200deg,
      var(--feas-ring) 320deg,
      transparent 360deg
    );
  }
}

.feasibility-title {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.feasibility-title span {
  font-weight: 600;
  opacity: 0.85;
}

.feasibility-summary {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.feasibility-dims {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.feasibility-dims li {
  display: grid;
  grid-template-columns: auto 5.5rem 1fr;
  gap: 0.45rem;
  align-items: start;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.feasibility-dims .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-top: 0.35rem;
}

.feasibility-dims .dot.red {
  background: #ef4444;
}
.feasibility-dims .dot.yellow {
  background: #eab308;
}
.feasibility-dims .dot.green {
  background: #22c55e;
}

.feasibility-dims .dim-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.15rem;
}

.feasibility-foot {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.topbar-game {
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  /* Prefer a single row when the viewport has room; wrap only when cramped */
  row-gap: 0.4rem;
}

/* Center cluster: invent calendar + resources */
.hud-clock {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  flex: 1 1 18rem;
  min-width: 0;
  max-width: none;
}

.hud-year {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  background: linear-gradient(120deg, #e0f2fe, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

button.hud-year-btn {
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  background: linear-gradient(120deg, #e0f2fe, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

button.hud-year-btn:hover {
  filter: brightness(1.15);
  text-decoration: underline;
  text-decoration-color: rgba(165, 180, 252, 0.55);
  text-underline-offset: 0.15em;
}

button.hud-year-btn:focus-visible {
  outline: 2px solid rgba(129, 140, 248, 0.7);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Year advanced — chip flash (same energy as market banner pulse) */
.hud-year.hud-year-pulse,
button.hud-year-btn.hud-year-pulse {
  position: relative;
  z-index: 2;
  border-radius: 0.45rem;
  padding: 0.18rem 0.5rem;
  background: linear-gradient(120deg, rgba(14, 165, 233, 0.35), rgba(99, 102, 241, 0.4));
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #e0f2fe;
  -webkit-text-fill-color: #e0f2fe;
  animation: year-chip-pulse 1.1s ease-in-out 2;
  box-shadow:
    0 0 0 3px rgba(125, 211, 252, 0.55),
    0 8px 22px rgba(99, 102, 241, 0.35);
}

@keyframes year-chip-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(125, 211, 252, 0),
      0 0 0 rgba(99, 102, 241, 0);
  }
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 3px rgba(125, 211, 252, 0.65),
      0 10px 28px rgba(99, 102, 241, 0.4);
  }
}

.hud-resources {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Product mark: sits between resources and Crisis (Warmer Sun palette) */
.hud-product {
  --ws-sun: #ffe29a;
  --ws-gold: #ffb347;
  --ws-amber: #ff9f43;
  --ws-coral: #ff6b4a;
  --ws-cream: #fff4e6;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.15rem 0.35rem 0.15rem 0.2rem;
  line-height: 1.15;
}

/* Topbar brand slot: product logo replaces the old cyan brand-dot */
.brand .hud-product {
  padding-left: 0;
}

.hud-product-sun {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(
    circle at 35% 35%,
    #fff8e7 0%,
    var(--ws-sun) 28%,
    var(--ws-amber) 62%,
    var(--ws-coral) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 180, 100, 0.28),
    0 0 12px rgba(255, 159, 67, 0.45);
}

.hud-product-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.hud-product-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ws-cream);
  white-space: nowrap;
}

.hud-product-credit {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(247, 240, 230, 0.55);
  white-space: nowrap;
}

.hud-product-link {
  color: #ffd28a;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.hud-product-link:hover {
  color: var(--ws-cream);
  border-bottom-color: rgba(255, 210, 138, 0.55);
}

.hud-product-link:focus-visible {
  outline: 2px solid rgba(255, 159, 67, 0.7);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Left brand slot on game topbars: show active-player chip and/or product logo */
.topbar-game .brand:not(:has(.mp-active-player:not([hidden]))):not(:has(.hud-product)) {
  display: none;
}

.hud-turn {
  font-size: 0.68rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

/* Multiplayer: more chrome — keep year / invent / resources / crisis on one row */
body.mp-room .topbar-game,
body.mp-hotseat .topbar-game {
  flex-wrap: nowrap;
  gap: 0.35rem 0.5rem;
}

body.mp-room .topbar-game .brand .brand-name,
body.mp-hotseat .topbar-game .brand .brand-name {
  /* Active-player chip already identifies the session — free horizontal room */
  display: none;
}

body.mp-room .topbar-game .brand .brand-dot,
body.mp-hotseat .topbar-game .brand .brand-dot {
  display: none;
}

body.mp-room .topbar-game .progress-pills .pill,
body.mp-hotseat .topbar-game .progress-pills .pill {
  padding: 0.25rem 0.45rem;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

body.mp-room .hud-clock,
body.mp-hotseat .hud-clock {
  flex: 1 1 16rem;
  justify-content: flex-start;
}

body.mp-room .hud-crisis-wrap,
body.mp-hotseat .hud-crisis-wrap {
  flex: 0 1 auto;
  max-width: none;
  flex-wrap: nowrap;
}

body.mp-room .hud-product,
body.mp-hotseat .hud-product {
  flex-shrink: 0;
}

/* Narrow viewports: allow wrap again so nothing is clipped */
@media (max-width: 1100px) {
  body.mp-room .topbar-game,
  body.mp-hotseat .topbar-game {
    flex-wrap: wrap;
  }

  body.mp-room .topbar-game .brand .brand-name,
  body.mp-hotseat .topbar-game .brand .brand-name {
    display: inline;
  }

  .hud-clock {
    flex-wrap: wrap;
    flex-basis: 100%;
  }

  body.mp-room .hud-crisis-wrap,
  body.mp-hotseat .hud-crisis-wrap {
    flex-wrap: wrap;
  }

  .hud-product {
    order: 0;
  }
}

@media (max-width: 720px) {
  .hud-product-credit {
    display: none;
  }

  .hud-product-title {
    font-size: 0.75rem;
  }

  .hud-product-sun {
    width: 1rem;
    height: 1rem;
  }
}

.hud-pressure {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  justify-content: flex-end;
  align-items: center;
  max-width: none;
}

/* Crisis meters: color vs this Quest's winMax (see crisisMeterLevel).
   cool = at/under goal (green) · warm = above goal (yellow) · hot = danger 4–5 (red) */
.hud-pressure .meter {
  font-size: 0.68rem;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg-2);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.hud-pressure .meter b {
  margin-right: 0.25rem;
  font-weight: 600;
  letter-spacing: 0;
  color: inherit;
}

/* Best — low crisis (0–1 filled) */
.hud-pressure .meter.cool {
  border-color: rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
}

/* Getting better / still hot (2–3 filled) */
.hud-pressure .meter.warm {
  border-color: rgba(251, 191, 36, 0.55);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
}

/* Dangerous (4–5 filled) — collapse risk at 5 */
.hud-pressure .meter.hot {
  border-color: rgba(248, 113, 113, 0.65);
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
}

.mission-place {
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.35rem !important;
}

.lesson-progress-slot {
  margin: 0 0 0.55rem;
}

/* Force hide when attribute is set (author display rules elsewhere must not leak a bar) */
.lesson-progress-slot[hidden],
#ws-lesson-progress[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.lesson-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 0;
  max-width: 22rem;
}

.lesson-progress-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fdba74;
  line-height: 1.2;
}

.lesson-progress-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  width: 100%;
  max-width: 14rem;
}

.lesson-progress-seg {
  flex: 1 1 0;
  min-width: 1.1rem;
  height: 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: rgba(15, 23, 42, 0.45);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.15s ease;
}

.lesson-progress-seg.is-filled {
  border-color: rgba(251, 191, 36, 0.75);
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 55%, #fde68a 100%);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

.lesson-progress-seg.is-current {
  border-color: rgba(253, 186, 116, 0.9);
  background: linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.35) 0%,
    rgba(251, 191, 36, 0.55) 100%
  );
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
  transform: scaleY(1.15);
}

.lesson-progress.is-complete .lesson-progress-title {
  color: #fde68a;
}

.lesson-progress.is-complete .lesson-progress-seg.is-filled {
  box-shadow: 0 0 12px rgba(253, 224, 71, 0.4);
}

.lesson-progress--compact {
  max-width: 100%;
  gap: 0.28rem;
  margin-top: 0.35rem;
}

.lesson-progress--compact .lesson-progress-title {
  font-size: 0.78rem;
}

.lesson-progress--compact .lesson-progress-bar {
  max-width: 11rem;
}

.lesson-progress--compact .lesson-progress-seg {
  min-width: 0.85rem;
  height: 0.42rem;
}

.quest-module-card .lesson-progress {
  margin-top: 0.45rem;
}

.catalog-blurb-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-mute, #94a3b8);
}

#quest-catalog-blurb .lesson-progress {
  margin-bottom: 0.15rem;
}

.ws-sponsor {
  margin: 0 0 0.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}
.ws-sponsor-label {
  margin: 0 !important;
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
}
.ws-sponsor-banner {
  margin: 0.15rem 0 0 !important;
  font-size: 0.78rem;
}

.stakeholder {
  font-size: 0.85rem;
  color: var(--text-mute);
  font-style: italic;
  margin-top: 0.5rem !important;
}

.year-news {
  margin-top: 0.65rem !important;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 0.85rem;
  color: #bae6fd;
}

.hint-inline {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-mute);
  font-size: 0.75rem;
}

.foot-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-mute);
}

.challenge-ready-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.challenge-ready-hint.blocked {
  color: #fde68a;
}

.challenge-ready-hint.ready {
  color: #6ee7b7;
}

.game-actions {
  flex-wrap: wrap;
}

.story-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

/* display:flex beats UA [hidden] — Spark hides Focus / dual-face chrome via hidden */
.story-mode[hidden],
.story-mode-hint[hidden],
.story-face-field[hidden] {
  display: none !important;
}

.story-mode-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-right: 0.25rem;
}

.story-mode-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg-1);
}

.story-mode-btn.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.16);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.story-mode-hint {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-mute);
  line-height: 1.4;
}

.story-face-field {
  position: relative;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: transparent;
}

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

.story-face-header label {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
}

/* Selected focus — owns the Fill other side button */
.story-face-field.is-focus {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--bg-elevated, rgba(21, 31, 51, 0.55));
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.1);
}

.story-face-field.is-focus .story-face-header label {
  color: var(--accent, #38bdf8);
}

/* Non-focus face — still fully editable */
.story-face-field.is-other {
  border-color: var(--border);
  background: rgba(7, 11, 20, 0.25);
}

.story-face-field.is-other .story-face-header label {
  color: var(--text-mute);
}

.story-face-note {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--text-mute);
}

.hud-crisis-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem 0.5rem;
  max-width: none;
  flex: 0 1 auto;
  min-width: 0;
  cursor: help;
}

.hud-crisis-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.hud-ap,
.hud-budget,
.hud-will {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  margin-left: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-ap {
  color: var(--accent-2, #a78bfa);
  border: 1px solid rgba(167, 139, 250, 0.35);
}

.hud-budget {
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.hud-will {
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

/* Pulse resource when an action fails for that currency */
.hud-ap.hud-pulse,
.hud-budget.hud-pulse,
.hud-will.hud-pulse {
  animation: hudPulse 0.7s ease 2;
}

@keyframes hudPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: none;
  }
  40% {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.35);
    border-color: rgba(248, 113, 113, 0.7);
  }
}

/* Toasts sit under the top bar, next to resource counters */
#toast {
  position: fixed;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 10000;
  max-width: min(36rem, 92vw);
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: center;
  color: var(--text);
  background: var(--bg-elevated, #151f33);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

#toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: none;
}

#toast.is-resource-ap {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(167, 139, 250, 0.2);
}

#toast.is-resource-budget {
  border-color: rgba(251, 191, 36, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(251, 191, 36, 0.2);
}

#toast.is-resource-will {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(52, 211, 153, 0.2);
}

/* Stay top-aligned even on narrow screens so messages sit by the resource HUD */

.wait-preview {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.wait-preview .bad {
  color: var(--danger, #f87171);
}

.deploy-drop-preview {
  margin-top: 0.4rem;
  font-size: 0.78rem;
}

/* Multiplayer: spend/act locked until “Let's go” on the turn popup */
body.mp-turn-gate #btn-challenge-submit,
body.mp-turn-gate #btn-challenge-apply-fix,
body.mp-turn-gate #btn-challenge-confirm-sidestep,
body.mp-turn-gate #btn-challenge-end-turn,
body.mp-turn-gate #btn-end-turn,
body.mp-turn-gate #btn-to-challenge,
body.mp-turn-gate #btn-wait,
body.mp-turn-gate #btn-lobby,
body.mp-turn-gate #btn-deploy-stage-primary,
body.mp-turn-gate .scrutiny-move-btn,
body.mp-turn-gate #btn-challenge-coach,
body.mp-turn-gate #btn-challenge-draft {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* Multiplayer: "your turn" overlay (div, not <dialog> — showModal trapped clicks) */
.mp-turn-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  color: var(--text, #e2e8f0);
  pointer-events: auto;
}

.mp-turn-modal[hidden] {
  display: none !important;
}

.mp-turn-dialog {
  width: min(26rem, calc(100vw - 2rem));
  max-width: 26rem;
  padding: 1.35rem 1.4rem 1.2rem;
  border-radius: var(--radius, 12px);
  background: var(--bg-elevated, #151f33);
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(52, 211, 153, 0.12);
  text-align: center;
  pointer-events: auto;
}

.mp-turn-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #94a3b8);
}

.mp-turn-dialog h3 {
  margin: 0 0 0.55rem;
  font-size: 1.45rem;
  color: #7dd3fc;
}

.mp-turn-body {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text, #e2e8f0);
}

.mp-turn-dialog .btn {
  width: 100%;
}

/* Challenge UI locked while AI poses the critic */
body.challenge-pose-pending #scrutiny-moves.is-pose-pending {
  opacity: 0.55;
  pointer-events: none;
}

body.challenge-pose-pending #mode-panel-defend,
body.challenge-pose-pending #mode-panel-fix,
body.challenge-pose-pending #mode-panel-sidestep {
  opacity: 0.55;
  pointer-events: none;
}

body.challenge-pose-pending .challenge-side-actions,
body.challenge-pose-pending #challenge-help-form {
  opacity: 0.55;
  pointer-events: none;
}

.outcome-stars {
  margin: 0.5rem 0 0.75rem;
}

/* Full win / partial / collapse — unmissable result strip */
.outcome-result-banner {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem 1.05rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85);
  text-align: left;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
}

.outcome-result-banner[hidden] {
  display: none !important;
}

.outcome-result-banner[data-kind="win"] {
  border-color: rgba(52, 211, 153, 0.55);
  background: linear-gradient(
    135deg,
    rgba(52, 211, 153, 0.16),
    rgba(15, 23, 42, 0.9)
  );
}

.outcome-result-banner[data-kind="partial"] {
  border-color: rgba(251, 191, 36, 0.6);
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.18),
    rgba(15, 23, 42, 0.92)
  );
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(251, 191, 36, 0.12);
}

.outcome-result-banner[data-kind="collapse"] {
  border-color: rgba(248, 113, 113, 0.55);
  background: linear-gradient(
    135deg,
    rgba(248, 113, 113, 0.14),
    rgba(15, 23, 42, 0.92)
  );
}

.outcome-result-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #94a3b8);
  margin: 0 0 0.35rem;
}

.outcome-result-banner[data-kind="win"] .outcome-result-kicker {
  color: #6ee7b7;
}

.outcome-result-banner[data-kind="partial"] .outcome-result-kicker {
  color: #fbbf24;
}

.outcome-result-banner[data-kind="collapse"] .outcome-result-kicker {
  color: #fca5a5;
}

.outcome-result-title {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.4rem;
  color: #f8fafc;
}

.outcome-result-banner[data-kind="partial"] .outcome-result-title {
  color: #fde68a;
}

/* Solo tutorial win — Workshop unlock explainer */
.outcome-workshop-unlock {
  margin: 1.35rem 0 1.5rem;
  padding: 1.15rem 1.25rem 1.2rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(
    145deg,
    rgba(56, 189, 248, 0.1),
    rgba(15, 23, 42, 0.88)
  );
}

.outcome-workshop-unlock[hidden] {
  display: none !important;
}

.outcome-workshop-unlock-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.outcome-workshop-unlock-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  color: #f8fafc;
}

.outcome-workshop-unlock-lead {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-dim, #cbd5e1);
}

.outcome-workshop-unlock-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text, #e2e8f0);
}

.outcome-workshop-unlock-list li strong {
  color: #f1f5f9;
}

.outcome-workshop-unlock-actions {
  justify-content: flex-start;
  margin: 0;
}

.outcome-result-sub {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.outcome-meter-gaps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.outcome-meter-gaps[hidden] {
  display: none !important;
}

.outcome-meter-gap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
}

.outcome-meter-gap.is-ok {
  border-color: rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.outcome-meter-gap.is-hot {
  border-color: rgba(251, 191, 36, 0.5);
  color: #fde68a;
}

.outcome-meter-gap.is-fail {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.outcome-actions-hint {
  width: 100%;
  margin: 0 0 0.35rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted, #94a3b8);
}

/* Multiplayer / hotseat end standings */
.outcome-mp {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem 1.1rem;
}

.outcome-mp-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.outcome-mp-lead {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.outcome-mp-standings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.outcome-mp-row {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  grid-template-areas:
    "medal name score"
    "medal detail detail"
    "medal badges badges";
  gap: 0.15rem 0.55rem;
  align-items: baseline;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--border);
  background: var(--bg-1, #0c1220);
}

.outcome-mp-row.is-winner {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.12), var(--bg-1, #0c1220));
}

.outcome-mp-row.is-collapse {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "name"
    "detail";
}

.outcome-mp-medal {
  grid-area: medal;
  font-size: 1.1rem;
}

.outcome-mp-name {
  grid-area: name;
  font-weight: 700;
}

.outcome-mp-score {
  grid-area: score;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
}

.outcome-mp-detail {
  grid-area: detail;
  font-size: 0.78rem;
}

.outcome-mp-badges {
  grid-area: badges;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.outcome-mp-badges .tag-win {
  border-color: rgba(52, 211, 153, 0.5);
  color: #6ee7b7;
}

.outcome-mp-legend {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
}

.outcome-mp-winner-line {
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: #fbbf24;
}

.run-stars {
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  color: #fbbf24;
}

.run-scores {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.run-highlights {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.btn-help {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.btn-help:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.18);
  transform: scale(1.05);
}

/* Help modal — stacked blocks + equal tile grids (panel size: .modal.help-modal) */

.help-header {
  flex-shrink: 0;
  margin: 0 0 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.help-header h3 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.help-intro {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 46rem;
}

.help-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.help-block {
  margin: 0;
  min-width: 0;
}

.help-more {
  margin-top: 0.35rem;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
}

.help-more-summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--text);
  list-style: none;
}

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

.help-more-summary::before {
  content: "▸ ";
  color: var(--accent);
  font-weight: 700;
}

.help-more[open] > .help-more-summary::before {
  content: "▾ ";
}

.help-more-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.help-block-last {
  margin-bottom: 0.15rem;
}

.help-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  margin-bottom: 0.65rem;
}

.help-block-head .help-block-title {
  margin: 0;
}

.help-block-head .help-note {
  margin: 0;
  flex: 1 1 14rem;
}

.help-block-title {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
}

.help-note {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--text-mute);
  line-height: 1.45;
}

/* Loop steps as a connected path */
.help-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 720px) {
  .help-steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .help-steps {
    grid-template-columns: 1fr;
  }
}

.help-steps > li {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.1), rgba(7, 11, 20, 0.35));
  min-width: 0;
}

.help-step-num {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--bg-0);
  background: var(--accent);
  line-height: 1;
}

.help-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.help-step-body strong {
  font-size: 0.86rem;
  color: var(--text);
  font-weight: 700;
}

.help-step-body span {
  font-size: 0.78rem;
  color: var(--text-mute);
  line-height: 1.35;
}

/* Equal-height content tiles */
.help-tiles {
  display: grid;
  gap: 0.65rem;
  align-items: stretch;
}

.help-tiles-2 {
  grid-template-columns: 1fr 1fr;
}

.help-tiles-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.help-tiles-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .help-tiles-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .help-tiles-2,
  .help-tiles-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .help-tiles-4 {
    grid-template-columns: 1fr;
  }
}

.help-tile {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.4);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.help-tile h5 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.help-tile-meta {
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.help-tile > p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.help-tile-accent {
  border-color: rgba(56, 189, 248, 0.28);
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.08), rgba(7, 11, 20, 0.4));
}

.help-tile-warn {
  border-color: rgba(251, 191, 36, 0.28);
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.07), rgba(7, 11, 20, 0.4));
}

.help-tile-move {
  border-color: rgba(167, 139, 250, 0.28);
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.08), rgba(7, 11, 20, 0.4));
}

.help-cost {
  margin: 0 !important;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-2);
  letter-spacing: 0.02em;
}

.help-list {
  margin: 0;
  padding-left: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.help-list li {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.help-list li strong {
  color: var(--text);
}

.help-footer {
  flex-shrink: 0;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* legacy under-banner crisis line removed from layout */
.crisis-help {
  display: none;
}

/* Permanent invent-screen Wait blurb removed — explanation is in the confirm dialog */
.wait-help,
.wait-preview {
  display: none !important;
}

.wait-confirm-modal {
  width: min(32rem, 100%);
}

.wait-confirm-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.wait-confirm-body p {
  margin: 0 0 0.55rem;
}

.wait-confirm-body p strong {
  color: var(--text);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.wait-confirm-list {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
  color: var(--text-dim);
}

.wait-confirm-list li {
  margin: 0.3rem 0;
}

.wait-confirm-list .bad {
  color: #fca5a5;
}

.wait-report {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.wait-report .ok {
  color: var(--accent-3);
}
.wait-report .bad {
  color: #fca5a5;
}
.wait-report .muted {
  color: var(--text-mute);
}

/* —— Round market news (bulletin + cost shift) —— */
body.market-news-open {
  overflow: hidden;
}

.market-news-banner {
  margin-top: 0.75rem;
  scroll-margin-top: 5rem;
}

.market-news-banner[hidden] {
  display: none !important;
}

.market-news-banner.is-fly-in {
  animation: market-banner-fly-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.market-news-banner.is-pulse .market-news-banner-btn {
  animation: market-banner-pulse 1.1s ease-in-out 2;
}

@keyframes market-banner-fly-in {
  0% {
    opacity: 0;
    transform: translateY(-1.25rem) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes market-banner-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(251, 191, 36, 0.55),
      0 10px 28px rgba(251, 191, 36, 0.25);
  }
}

/* —— Year advance flash (same fly-in + ring pulse as market; auto-hides) —— */
.year-advance-banner {
  margin-top: 0.65rem;
  scroll-margin-top: 5rem;
}

.year-advance-banner[hidden] {
  display: none !important;
}

.year-advance-banner.is-fly-in {
  animation: market-banner-fly-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.year-advance-banner.is-pulse .year-advance-banner-btn {
  animation: year-banner-pulse 1.1s ease-in-out 2;
}

.year-advance-banner.is-fading {
  animation: year-banner-fade-out 0.45s ease forwards;
}

@keyframes year-banner-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(125, 211, 252, 0);
  }
  50% {
    box-shadow:
      0 0 0 3px rgba(125, 211, 252, 0.55),
      0 10px 28px rgba(99, 102, 241, 0.3);
  }
}

@keyframes year-banner-fade-out {
  to {
    opacity: 0;
    transform: translateY(-0.4rem) scale(0.98);
  }
}

.year-advance-banner-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  appearance: none;
  cursor: pointer;
  border: 1px solid rgba(125, 211, 252, 0.45);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(
    135deg,
    rgba(14, 165, 233, 0.18),
    rgba(99, 102, 241, 0.22) 55%,
    rgba(15, 23, 42, 0.55)
  );
  color: inherit;
  font: inherit;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.35);
  transition: border-color 0.15s ease, filter 0.15s ease;
}

.year-advance-banner-btn:hover {
  border-color: rgba(165, 180, 252, 0.75);
  filter: brightness(1.06);
}

.year-advance-banner-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.55rem;
  font-size: 1.35rem;
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid rgba(125, 211, 252, 0.35);
}

.year-advance-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.year-advance-banner-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.year-advance-banner-text strong {
  font-size: 0.98rem;
  font-weight: 700;
  color: #e0f2fe;
  line-height: 1.25;
}

.year-advance-banner-hint {
  font-size: 0.8rem;
  color: rgba(186, 230, 253, 0.85);
  line-height: 1.3;
}

.market-news-banner-btn {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-sm, 10px);
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.12),
    rgba(56, 189, 248, 0.08)
  );
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.market-news-banner-btn:hover {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.market-news-banner[data-tone="bad"] .market-news-banner-btn {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(
    135deg,
    rgba(248, 113, 113, 0.12),
    rgba(251, 191, 36, 0.06)
  );
}

.market-news-banner[data-tone="good"] .market-news-banner-btn {
  border-color: rgba(52, 211, 153, 0.4);
  background: linear-gradient(
    135deg,
    rgba(52, 211, 153, 0.12),
    rgba(56, 189, 248, 0.06)
  );
}

.market-news-banner-thumb {
  flex: 0 0 4.5rem;
  width: 4.5rem;
  min-height: 4.5rem;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.market-news-banner-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.market-news-banner-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.market-news-banner-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.55rem 0.75rem 0.55rem 0;
  min-width: 0;
}

.market-news-banner-kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #94a3b8);
}

.market-news-banner-text strong {
  font-size: 0.92rem;
  line-height: 1.3;
  color: #fde68a;
}

.market-news-banner[data-tone="good"] .market-news-banner-text strong {
  color: #6ee7b7;
}

.market-news-banner[data-tone="bad"] .market-news-banner-text strong {
  color: #fca5a5;
}

.market-news-banner-effects {
  font-size: 0.78rem;
  color: var(--text-dim, #cbd5e1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Year foresight bulletin — reuses market-news-modal shell */
.year-bulletin-modal {
  z-index: 10090;
}

.year-bulletin-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(40vh, 18rem);
  overflow: auto;
}

.year-bulletin-item {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.year-bulletin-item[data-kind="prediction"] {
  border-color: rgba(167, 139, 250, 0.4);
}

.year-bulletin-item[data-kind="milestone"] {
  border-color: rgba(52, 211, 153, 0.35);
}

.year-bulletin-kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.year-bulletin-item strong {
  font-size: 0.92rem;
  color: #f1f5f9;
}

.year-bulletin-detail {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #cbd5e1;
}

body.year-bulletin-open {
  overflow: hidden;
}

/* Match .mp-turn-modal reliability — always fully opaque when displayed */
.market-news-modal {
  position: fixed;
  inset: 0;
  z-index: 10100; /* above .mp-turn-modal (10050) */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  border: none;
  background: rgba(2, 6, 18, 0.78);
  backdrop-filter: blur(6px);
  color: var(--text, #e2e8f0);
  pointer-events: auto;
}

.market-news-modal[hidden] {
  display: none !important;
}

.market-news-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: min(92vh, 40rem);
  overflow: auto;
  border-radius: 16px;
  background: linear-gradient(180deg, #152038 0%, #0f172a 100%);
  border: 1px solid rgba(251, 191, 36, 0.5);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(56, 189, 248, 0.1),
    0 0 48px rgba(251, 191, 36, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform-origin: 50% 60%;
}

.market-news-dialog.market-news-dialog-enter {
  animation: market-modal-card-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes market-modal-card-in {
  0% {
    opacity: 0;
    transform: translateY(2.25rem) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateY(-0.12rem) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.market-news-modal[data-tone="bad"] .market-news-dialog {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(248, 113, 113, 0.15);
}

.market-news-modal[data-tone="good"] .market-news-dialog {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(52, 211, 153, 0.15);
}

.market-news-art {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(251, 191, 36, 0.18), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(56, 189, 248, 0.14), transparent 50%),
    #0b1220;
  overflow: hidden;
}

.market-news-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.market-news-art-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 4rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(251, 191, 36, 0.2), transparent 55%),
    linear-gradient(160deg, #1e293b, #0f172a);
}

.market-news-art-fallback[hidden] {
  display: none !important;
}

.market-news-art-loading {
  position: absolute;
  right: 0.65rem;
  bottom: 0.55rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.market-news-art-loading[hidden] {
  display: none !important;
}

.market-news-copy {
  padding: 1.15rem 1.25rem 1.2rem;
}

.market-news-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fbbf24;
}

.market-news-modal[data-tone="good"] .market-news-kicker {
  color: #34d399;
}

.market-news-modal[data-tone="bad"] .market-news-kicker {
  color: #f87171;
}

.market-news-dialog h3 {
  margin: 0 0 0.55rem;
  font-size: 1.35rem;
  line-height: 1.25;
  color: #f8fafc;
}

.market-news-body {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.market-news-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 0.75rem;
}

.market-effect-scope {
  font-size: 0.78rem;
  color: #94a3b8;
  margin-right: 0.15rem;
}

.market-effect-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

.market-effect-chip.up {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.market-effect-chip.down {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
}

.market-news-note {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.market-news-dialog .btn {
  width: 100%;
}

.tech-cost-chip.tech-cost-up {
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.tech-cost-chip.tech-cost-down {
  box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.55);
  color: #a7f3d0;
}

/* Challenge = 1:1 left challenge · right co-inventor (like invent center + side) */
.challenge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  height: calc(100vh - 57px);
  margin-inline: var(--page-gutter);
  width: calc(100% - 2 * var(--page-gutter));
  gap: 0;
}

@media (max-width: 960px) {
  .challenge-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: auto;
  }
}

.challenge-main {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--border);
  padding: 1rem 1.1rem 1.5rem;
}

.challenge-side {
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-1, rgba(7, 11, 20, 0.4));
}

.challenge-side .side-tabs {
  flex-shrink: 0;
}

.challenge-side .side-pane {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.75rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.challenge-side .side-pane[hidden] {
  display: none !important;
}

.challenge-side #side-challenge-vision {
  /* Match invent vision pane: canvas grows, less scroll thrash */
  overflow: hidden;
}

.challenge-side #challenge-vision-root {
  flex: 1;
  min-height: 14rem;
}

.challenge-vision-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.challenge-side .co-inventor-root {
  flex: 1;
  min-height: 12rem;
}

.challenge-side-hint {
  font-size: 0.78rem;
  line-height: 1.4;
}

.challenge-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.challenge-step-content {
  max-width: 1280px;
  width: 100%;
}

.challenge-step-card {
  padding: 1.25rem 1.35rem 1.5rem;
  max-width: none;
  border: none;
  background: transparent;
  box-shadow: none;
}

.mode-panel {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(7, 11, 20, 0.4);
}

.mode-panel-lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.mode-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0.5rem 0 0.75rem;
  cursor: pointer;
}

.scrutiny-move-btn.is-selected {
  border-color: rgba(56, 189, 248, 0.7) !important;
  background: rgba(56, 189, 248, 0.14) !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.scrutiny-move-btn.is-selected .scrutiny-move-title {
  color: var(--accent, #38bdf8);
}

/* —— Challenger horizontal carousel (runs while AI pose loads) —— */
.challenger-draw {
  margin: 0 0 1.25rem;
  padding: 0.85rem 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background:
    radial-gradient(ellipse 80% 70% at 50% 0%, rgba(167, 139, 250, 0.12), transparent 55%),
    rgba(7, 11, 20, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.challenger-draw[hidden] {
  display: none !important;
}

/* .challenger-banner { display:grid } beats the UA [hidden] rule — force it */
.challenger-banner[hidden] {
  display: none !important;
}

/* While the carousel runs, never show the final challenger / speech underneath */
body.challenge-reveal-pending #challenger-visual,
body.challenge-reveal-pending #challenge-speech,
body.challenge-reveal-pending #challenge-question,
body.challenge-reveal-pending #challenger-resolve,
body.challenge-reveal-pending #challenge-feedback {
  display: none !important;
}
body.challenge-reveal-pending #scrutiny-moves,
body.challenge-reveal-pending #mode-panel-defend,
body.challenge-reveal-pending #mode-panel-fix,
body.challenge-reveal-pending #mode-panel-sidestep,
body.challenge-reveal-pending #deploy-bay {
  display: none !important;
}

.challenger-draw-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  text-align: center;
}

.challenger-draw-status {
  margin: 0.3rem 0 0.75rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-mute, #94a3b8);
  min-height: 1.35em;
}

.challenger-draw-status.is-landed {
  color: #c4b5fd;
  font-weight: 700;
  text-shadow: 0 0 20px rgba(167, 139, 250, 0.4);
}

.challenger-draw-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  border-radius: 14px;
}

.challenger-draw-track {
  display: flex;
  flex-direction: row;
  width: 100%;
  will-change: transform;
  transition: transform 0.48s cubic-bezier(0.33, 0.9, 0.32, 1);
}

.challenger-draw-track.is-snap {
  transition: none;
}

.challenger-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  box-sizing: border-box;
  padding: 0.15rem;
}

.challenger-slide-panel {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border, #1e293b);
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.challenger-slide-panel[data-challenger="moloch"] {
  border-color: rgba(248, 113, 113, 0.4);
}
.challenger-slide-panel[data-challenger="ethicist"] {
  border-color: rgba(167, 139, 250, 0.45);
}
.challenger-slide-panel[data-challenger="stakeholder"] {
  border-color: rgba(56, 189, 248, 0.45);
}
.challenger-slide-panel[data-challenger="nature"] {
  border-color: rgba(52, 211, 153, 0.45);
}

.challenger-slide-panel .challenger-portrait-wrap {
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-strong, #334155);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  background: #0f172a;
}

.challenger-slide-panel .challenger-portrait-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.challenger-slide-copy .label {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
}

.challenger-slide-copy h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--text, #f1f5f9);
}

.challenger-slide-copy .challenge-angle-sub {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--text-mute, #94a3b8);
}

.challenger-slide-resolve {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #e2e8f0);
}

.challenger-slide-resolve .challenger-resolve-hearts {
  letter-spacing: 0.12em;
  color: #f87171;
  margin-left: 0.35rem;
}

.challenger-slide.is-winner .challenger-slide-panel {
  box-shadow:
    0 0 0 2px rgba(167, 139, 250, 0.4),
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 0 36px rgba(167, 139, 250, 0.25);
  animation: challenger-slide-land 0.5s ease-out;
}

@keyframes challenger-slide-land {
  0% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 560px) {
  .challenger-slide-panel {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .challenger-draw-track {
    transition: none;
  }
  .challenger-slide.is-winner .challenger-slide-panel {
    animation: none;
  }
}

.challenger-banner {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 1.25rem 1.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.challenger-banner.is-revealing {
  animation: challenger-banner-in 0.45s ease-out;
}

@keyframes challenger-banner-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  .challenger-banner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

.challenger-portrait-wrap {
  width: 9rem;
  height: 9rem;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  background: #0f172a;
}

/* Speech / answer use the wide card; keep readable line length without shrinking the panel */
.challenge-step-card .challenge-speech,
.challenge-step-card .challenge-question,
.challenge-step-card .challenge-help,
.challenge-step-card .field {
  max-width: none;
}

.scrutiny-encounters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.scrutiny-enc {
  flex: 1 1 10rem;
  min-width: 9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  background: rgba(7, 11, 20, 0.35);
  font-size: 0.82rem;
}

.scrutiny-enc.is-active {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.2);
}

.scrutiny-enc.is-cleared {
  opacity: 0.55;
  border-color: rgba(52, 211, 153, 0.35);
}

.scrutiny-enc-label {
  font-weight: 700;
  color: var(--text);
}

.scrutiny-enc-hp {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text-mute);
}

.scrutiny-enc-hp-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.scrutiny-enc-hp-hearts {
  letter-spacing: 0.1em;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1;
}

.scrutiny-enc.is-cleared .scrutiny-enc-hp-hearts {
  color: var(--accent-3);
}

.scrutiny-enc.is-active .scrutiny-enc-hp-label {
  color: var(--text-dim);
}

.scrutiny-status {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.challenge-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* PR7 deploy bay */
.deploy-bay {
  margin: 1rem 0 0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: linear-gradient(160deg, rgba(52, 211, 153, 0.1), rgba(7, 11, 20, 0.4));
}

.deploy-bay-workshop {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
}

.deploy-bay-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0.55rem;
}

.deploy-bay-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-3);
  letter-spacing: 0.02em;
}

.deploy-stage-pills {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.deploy-stage-pill {
  margin: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  background: rgba(7, 11, 20, 0.35);
}

.deploy-stage-pill.is-active {
  border-color: rgba(52, 211, 153, 0.55);
  color: var(--text);
  background: rgba(52, 211, 153, 0.15);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2);
}

.deploy-stage-pill.is-done {
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--accent-3);
  opacity: 0.85;
}

.deploy-bay-status {
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-dim);
}

.deploy-bay-actions {
  margin: 0;
  flex-wrap: wrap;
}

.scrutiny-moves {
  margin: 0;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: var(--radius);
  background: rgba(167, 139, 250, 0.06);
}

.scrutiny-moves-lead {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.scrutiny-move-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 900px) {
  .scrutiny-move-grid {
    grid-template-columns: 1fr;
  }
}

.scrutiny-move-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  text-align: left;
  width: 100%;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(7, 11, 20, 0.55);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  font: inherit;
  min-height: 100%;
}

.scrutiny-move-btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.1);
  transform: translateY(-1px);
}

.scrutiny-move-btn:disabled,
.scrutiny-move-btn.is-spectator-locked,
body.challenge-spectator .scrutiny-move-btn,
body.challenge-pose-pending .scrutiny-move-btn {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  border-color: var(--border) !important;
  background: rgba(7, 11, 20, 0.28) !important;
  filter: grayscale(0.35);
  pointer-events: none;
}

.scrutiny-move-btn:disabled .scrutiny-move-title,
.scrutiny-move-btn:disabled .scrutiny-move-cost,
.scrutiny-move-btn:disabled .scrutiny-move-blurb,
.scrutiny-move-btn.is-spectator-locked .scrutiny-move-title,
.scrutiny-move-btn.is-spectator-locked .scrutiny-move-cost,
.scrutiny-move-btn.is-spectator-locked .scrutiny-move-blurb,
body.challenge-spectator .scrutiny-move-btn .scrutiny-move-title,
body.challenge-spectator .scrutiny-move-btn .scrutiny-move-cost,
body.challenge-spectator .scrutiny-move-btn .scrutiny-move-blurb {
  color: var(--text-mute);
}

/* Selected mode still visible while locked (spectator follow) — slightly less dim */
body.challenge-spectator .scrutiny-move-btn.is-selected:disabled,
body.challenge-spectator .scrutiny-move-btn.is-selected.is-spectator-locked {
  opacity: 0.72;
  filter: grayscale(0.15);
  border-color: rgba(56, 189, 248, 0.35) !important;
  background: rgba(56, 189, 248, 0.08) !important;
}

.scrutiny-move-btn:nth-child(1) {
  border-color: rgba(56, 189, 248, 0.4);
}

.scrutiny-move-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.scrutiny-move-cost {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-2, #a78bfa);
  letter-spacing: 0.02em;
}

.scrutiny-move-blurb {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-mute);
}

.challenge-footer-actions {
  margin-top: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.challenger-banner[data-challenger="moloch"] .challenger-portrait-wrap {
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.15), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.challenger-banner[data-challenger="ethicist"] .challenger-portrait-wrap {
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.15), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.challenger-banner[data-challenger="stakeholder"] .challenger-portrait-wrap {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.challenger-banner[data-challenger="nature"] .challenger-portrait-wrap {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.challenger-copy .label {
  margin-bottom: 0.2rem;
}

.challenge-step-card h1 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.65rem;
}

.challenge-angle-sub {
  color: var(--text-mute);
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.challenger-name-tag {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}

.challenger-name-tag span {
  color: var(--accent);
  font-weight: 700;
}

.challenger-resolve {
  margin: 0.55rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.challenger-resolve-label {
  font-weight: 600;
  color: var(--text-mute);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.challenger-resolve-hearts {
  letter-spacing: 0.12em;
  color: var(--danger);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1;
}

.challenge-speech {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
  color: var(--text-dim);
  margin-bottom: 0.85rem;
  line-height: 1.6;
}

.challenge-question {
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.challenge-help {
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.06);
}

.challenge-help-header {
  margin-bottom: 0.55rem;
}

.challenge-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.challenge-coach-panel {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.55;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(7, 11, 20, 0.45);
}

.challenge-coach-panel .draft-block {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
}

.challenge-coach-panel .draft-actions {
  margin-top: 0.5rem;
}

.challenge-help-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.challenge-help-form input {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 0.85rem;
  color: var(--text);
}

.challenge-feedback {
  margin: 0.75rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.challenge-feedback.pass {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.1);
  color: #a7f3d0;
}

.challenge-feedback.partial {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
}

.challenge-feedback.fail {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}

.foresight-grid {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.foresight-card {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.foresight-kind {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.foresight-prediction .foresight-kind {
  color: #c4b5fd;
}

.foresight-trend .foresight-kind {
  color: #6ee7b7;
}

.foresight-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.muted {
  color: var(--text-mute);
}

.challenge-card:disabled,
.challenge-card.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.mission-grid-loading {
  opacity: 0.95;
}

.mission-skeleton {
  pointer-events: none;
  cursor: default;
  min-height: 200px;
  gap: 0.55rem;
}

.mission-skeleton .skel {
  display: block;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.08) 0%,
    rgba(148, 163, 184, 0.16) 50%,
    rgba(148, 163, 184, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite;
}

.mission-skeleton .skel-line {
  height: 0.7rem;
  width: 100%;
}

.mission-skeleton .skel-short {
  width: 42%;
  height: 0.55rem;
}

.mission-skeleton .skel-title {
  width: 78%;
  height: 1.05rem;
  margin-top: 0.15rem;
}

.mission-skeleton .skel-mid {
  width: 62%;
}

.mission-skeleton .skel-cta {
  margin-top: auto;
  width: 5.5rem;
  height: 0.75rem;
  font-size: 0;
}

@keyframes skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* —— Workshop —— */
#screen-workshop {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.workshop-layout {
  display: grid;
  /* tech tray : invent form : vision/co-inventor = 1 : 3 : 3 */
  grid-template-columns: minmax(160px, 1fr) minmax(0, 3fr) minmax(0, 3fr);
  grid-template-rows: 1fr;
  grid-template-areas: "tech invent vision";
  flex: 1;
  min-height: 0;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
  /* Light inset only — avoid a heavy framed slab */
  margin-inline: var(--page-gutter);
  width: calc(100% - 2 * var(--page-gutter));
}

.workshop-layout > .tech-library {
  grid-area: tech;
}

.workshop-layout > .invent-center {
  grid-area: invent;
}

.workshop-layout > .vision-panel {
  grid-area: vision;
}

/* Backdrop is fixed (out of grid flow); only visible in compact drawer mode */
.tech-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(2, 6, 14, 0.55);
  cursor: pointer;
}

/* Stack field: label + Add tech on one row */
.stack-field-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.4rem;
}

.stack-field-header label {
  margin-bottom: 0;
}

.tech-drawer-open {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
}

.tech-drawer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent, #38bdf8);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.tech-drawer-count[hidden] {
  display: none !important;
}

.tech-library-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

/* Desktop: Add tech / Done are compact-mode controls */
.tech-drawer-open,
.tech-drawer-close {
  display: none;
}

/* Tech library */
.tech-library {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(7, 11, 20, 0.5);
}

.tech-library .panel-header {
  flex-shrink: 0;
}

/* —— Compact workshop: tablet (iPad) + phone ——
   Vision stays on stage; emTech slides in as a drawer/sheet. */
@media (max-width: 1199px) {
  #screen-workshop {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  #screen-workshop.active,
  #screen-hotseat.active,
  #screen-room-play.active {
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .workshop-layout {
    /* invent | vision — tech is an overlay */
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 1fr);
    grid-template-rows: 1fr;
    grid-template-areas: "invent vision";
    height: calc(100vh - 57px);
    height: calc(100dvh - 57px);
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
  }

  /* Multiplayer bar eats a little height when visible */
  body.mp-hotseat .workshop-layout,
  body.mp-room .workshop-layout,
  .mp-workshop.workshop-layout {
    height: calc(100vh - 57px);
    height: calc(100dvh - 57px);
  }

  .workshop-layout > .invent-center {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid var(--border);
  }

  .workshop-layout > .vision-panel {
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    border-right: none;
  }

  .workshop-layout > .vision-panel .side-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .workshop-layout > .vision-panel .vision-canvas-wrap {
    flex: 1 1 auto;
    min-height: min(38vh, 22rem);
    max-height: none;
  }

  .workshop-layout > .vision-panel .vision-narratives {
    max-height: 7rem;
    overflow: auto;
  }

  /* emTech drawer (left) */
  .workshop-layout > .tech-library {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(22rem, 90vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 120;
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    background: rgba(7, 11, 20, 0.97);
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .workshop-layout.is-tech-open > .tech-library {
    transform: translateX(0);
  }

  .workshop-layout.is-tech-open > .tech-drawer-backdrop {
    display: block;
    backdrop-filter: blur(2px);
  }

  .tech-drawer-backdrop[hidden] {
    display: none !important;
  }

  .tech-drawer-open {
    display: inline-flex;
  }

  .tech-drawer-close {
    display: inline-flex;
    min-height: 2.25rem;
  }

  body.tech-drawer-open {
    overflow: hidden;
  }

  /* Compact mission chrome: full quest text stays readable in a scroll area
     (no line-clamp ellipsis — invent left column needs the whole brief). */
  .challenge-banner .ws-mission-scene,
  .challenge-banner .mp-mission-scene,
  .challenge-banner .quest-brief {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
    max-height: min(42vh, 22rem);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-gutter: stable;
  }

  .mp-play-problem-brief .mp-play-brief-grid,
  .mp-scenario-brief.mp-play-problem-brief {
    font-size: 0.82rem;
  }

  .hs-open-table {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    max-height: 9.5rem;
    overflow: auto;
  }

  .filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .filter-chip {
    flex-shrink: 0;
  }
}

/* Phone / narrow portrait: vision on top, invent below, tech as bottom sheet */
@media (max-width: 719px) {
  .workshop-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "vision"
      "invent";
    height: calc(100vh - 57px);
    height: calc(100dvh - 57px);
  }

  .workshop-layout > .invent-center {
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .workshop-layout > .vision-panel {
    position: sticky;
    top: 0;
    z-index: 6;
    max-height: min(36vh, 16rem);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.92);
  }

  .workshop-layout > .vision-panel .side-tabs {
    min-height: 0;
  }

  .workshop-layout > .vision-panel .vision-stage-bar {
    padding: 0.35rem 0.65rem;
  }

  .workshop-layout > .vision-panel .vision-stage-blurb,
  .workshop-layout > .vision-panel .vision-narratives {
    display: none;
  }

  .workshop-layout > .vision-panel .vision-canvas-wrap {
    min-height: 0;
    flex: 1 1 auto;
    max-height: none;
  }

  .workshop-layout > .vision-panel .side-pane[hidden] {
    display: none !important;
  }

  /* Co-inventor on phone: allow more height when tab selected */
  .workshop-layout > .vision-panel:has(.side-pane.mp-side-coinventor:not([hidden])),
  .workshop-layout > .vision-panel:has(#side-coinventor:not([hidden])) {
    max-height: min(50vh, 22rem);
  }

  /* Bottom sheet for emTech */
  .workshop-layout > .tech-library {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: min(82dvh, 36rem);
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(105%);
  }

  .workshop-layout.is-tech-open > .tech-library {
    transform: translateY(0);
  }

  .workshop-layout > .tech-library::before {
    content: "";
    display: block;
    width: 2.5rem;
    height: 0.28rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.45);
    margin: 0.45rem auto 0.15rem;
    flex-shrink: 0;
  }

  .field textarea {
    min-height: 5.5rem;
  }

  .challenge-banner {
    padding: 0.75rem 0.9rem;
  }

  .challenge-banner h2 {
    font-size: 1.05rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workshop-layout > .tech-library {
    transition: none;
  }
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem 0.35rem;
  border-bottom: none;
}

.filter-domain-hint {
  margin: 0;
  padding: 0 0.85rem 0.65rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-mute);
}

.filter-domain-hint[hidden] {
  display: none !important;
}

.filter-domain-hint strong {
  color: var(--text-dim);
  font-weight: 600;
}

.filter-chip {
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-mute);
  background: transparent;
}

.filter-chip.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}

.tech-list {
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.tech-card {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  transition: border-color 0.15s, background 0.15s;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: start;
}

.tech-card:hover:not(.selected):not(:disabled) {
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.tech-card.selected {
  border-color: rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.08);
}

/* Cannot afford — never green / never checkmark */
.tech-card.unaffordable:not(.selected) {
  opacity: 0.62;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.04);
}

.tech-card.unaffordable:not(.selected) .tech-add {
  color: #fca5a5;
  font-weight: 700;
}

.tech-card.unaffordable:not(.selected):hover {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.08);
}

.tech-card.recommended:not(.selected) {
  box-shadow: inset 3px 0 0 var(--warn);
}

.tech-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.tech-meta h4 {
  margin: 0 0 0.15rem;
  font-size: 0.88rem;
}

.tech-meta p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-mute);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tech-domain {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--domain, var(--text-mute));
  font-weight: 600;
  display: block;
  margin-top: 0.2rem;
}

.tech-cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.4rem;
}

.tech-cost-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: rgba(7, 11, 20, 0.45);
  white-space: nowrap;
  text-transform: none;
}

.tech-cost-budget {
  /* Yellow chip, short label (e.g. 1$) — no "Budget" word */
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
}

.tech-cost-will {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
}

.tech-cost-ap {
  color: var(--accent-2, #a78bfa);
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.1);
}

.tech-cost-owned {
  color: var(--accent-3);
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
  font-weight: 600;
}

.tech-add {
  font-size: 1.1rem;
  color: var(--text-mute);
  width: 24px;
  text-align: center;
  line-height: 36px;
}

.tech-card.selected .tech-add {
  color: var(--accent-3);
}

/* Center: challenge + invention form */
.invent-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.challenge-banner {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08), transparent);
}

.challenge-banner .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.challenge-banner h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.challenge-banner p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.invent-form {
  padding: 1.1rem 1.2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(56, 189, 248, 0.55);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

/* Multiplayer: invent frozen (Challenge started / not your turn) */
.field input.is-locked,
.field textarea.is-locked,
#invention-name.is-locked,
#invention-how.is-locked,
#invention-impact.is-locked {
  opacity: 0.72;
  cursor: not-allowed;
  background: var(--bg-0, #0b1220);
  border-color: rgba(148, 163, 184, 0.25);
}

.selected-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 36px;
}

.tech-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.tech-chip button {
  color: var(--text-mute);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.tech-chip button:hover {
  color: var(--danger);
}

.empty-hint {
  color: var(--text-mute);
  font-size: 0.85rem;
  font-style: italic;
}

.empty-hint .linkish,
button.linkish {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-style: normal;
  font-weight: 600;
  color: var(--accent, #38bdf8);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  cursor: pointer;
}

.empty-hint .linkish:hover,
button.linkish:hover {
  color: var(--text);
}

.synergy-box {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.06);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.synergy-box strong {
  color: #c4b5fd;
}

.prompt-tip {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(167, 139, 250, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.ambition-meter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ambition-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-1);
  overflow: hidden;
  border: 1px solid var(--border);
}

.ambition-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #a78bfa, #34d399);
  transition: width 0.4s var(--ease);
}

.ambition-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-mute);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

/* Vision / side panel */
.vision-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-0);
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.side-tab {
  flex: 1;
  padding: 0.7rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.side-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.side-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.1), transparent);
}

.side-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.side-pane[hidden] {
  display: none !important;
}

/* Co-inventor */
.co-inventor-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.co-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.co-header-text {
  min-width: 0;
  flex: 1 1 auto;
}

.co-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.co-title {
  font-weight: 700;
  font-size: 0.92rem;
  background: linear-gradient(120deg, #e0f2fe, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.co-inventor-root.is-tutor-mode .co-title {
  background: linear-gradient(120deg, #fde68a, #fdba74 55%, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
}

.co-sub {
  font-size: 0.72rem;
  color: var(--text-mute);
  margin-top: 0.15rem;
}

.co-tutor-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, opacity 0.15s ease;
}

/* Active tutor session — lit gold */
.co-tutor-badge.is-active {
  color: #1c1917;
  background: linear-gradient(120deg, #fde68a 0%, #fbbf24 50%, #f59e0b 100%);
  border: 1px solid rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.28);
  opacity: 1;
}

/* Learning quest, tutoring ended — same label, quiet chrome */
.co-tutor-badge.is-idle {
  color: rgba(226, 232, 240, 0.55);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: none;
  opacity: 0.85;
  font-weight: 600;
}

.co-tutor-toggle {
  font-size: 0.72rem !important;
  white-space: nowrap;
}

#co-clear.is-tutor-locked,
#co-clear:disabled.is-tutor-locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.co-sub.co-offline {
  color: var(--warn);
}

.co-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.co-chip {
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.08);
  transition: background 0.15s, border-color 0.15s;
}

.co-chip:hover:not(:disabled) {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.55);
}

.co-chip:disabled {
  opacity: 0.45;
  color: var(--muted, #94a3b8);
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.06);
  cursor: not-allowed;
}

.co-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 160px;
}

.co-msg {
  display: flex;
  max-width: 100%;
}

.co-msg.user {
  justify-content: flex-end;
}

.co-bubble {
  font-size: 0.84rem;
  line-height: 1.5;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  max-width: 100%;
  color: var(--text-dim);
}

.co-msg.user .co-bubble {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.co-msg.assistant .co-bubble {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-bottom-left-radius: 4px;
}

/* Markdown in assistant / tutor bubbles (links, images, compact structure) */
.co-bubble-md {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.co-bubble-md a {
  color: #9ecbff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.co-bubble-md a:hover {
  color: #c5e3ff;
}
.co-bubble-md .md-img,
.co-bubble-md img.md-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 0.5rem 0;
  background: rgba(0, 0, 0, 0.2);
}
.co-bubble-md .md-img-wrap {
  margin: 0.35rem 0;
}
.co-bubble-md h1,
.co-bubble-md h2,
.co-bubble-md h3 {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0.55em 0 0.3em;
  color: var(--text, #e8eef9);
  line-height: 1.3;
}
.co-bubble-md p {
  margin: 0.35em 0;
}
.co-bubble-md ul,
.co-bubble-md ol {
  margin: 0.35em 0 0.35em 1.15em;
  padding: 0;
}
.co-bubble-md li {
  margin: 0.2em 0;
}
.co-bubble-md strong {
  color: var(--text, #e8eef9);
  font-weight: 650;
}

.co-msg.thinking .co-bubble {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-mute);
  font-style: italic;
}

.co-dots {
  display: inline-flex;
  gap: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.co-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  display: inline-block;
  animation: bounce 1.2s infinite ease-in-out;
}

.co-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.co-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

/* AI request in progress — rotating “snake” ring where text will appear */
.ai-pending {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-mute);
  font-style: italic;
  line-height: 1.4;
}

.ai-pending-label {
  min-width: 0;
}

.ai-snake {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(167, 139, 250, 0.22);
  border-top-color: var(--accent-2, #a78bfa);
  border-right-color: rgba(167, 139, 250, 0.65);
  animation: ai-snake-spin 0.75s linear infinite;
}

.ai-pending--field {
  margin: 0.4rem 0 0.15rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.07);
  font-style: normal;
}

.story-face-field.is-ai-pending textarea {
  opacity: 0.55;
  pointer-events: none;
}

.challenge-coach-panel .ai-pending,
.challenge-speech .ai-pending,
.challenge-feedback .ai-pending {
  margin: 0;
  font-style: normal;
}

.challenge-feedback.is-pending {
  border-color: rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.06);
  color: var(--text-mute);
}

.co-msg.thinking .ai-snake {
  width: 0.9rem;
  height: 0.9rem;
}

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

.co-teaching {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.co-teach-item {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.co-teach-item strong {
  color: var(--accent-3);
  font-weight: 600;
}

.co-proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}

.co-apply {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.1);
  color: #6ee7b7;
  transition: background 0.15s;
}

.co-apply:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.2);
}

.co-apply-all {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

.co-apply.applied {
  opacity: 0.55;
  border-color: var(--border);
  color: var(--text-mute);
  background: transparent;
}

/* Per-tech stack add (normal costs) */
.co-apply-tech {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
}

.co-apply-tech:hover:not(:disabled) {
  background: rgba(251, 191, 36, 0.2);
}

.co-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(7, 11, 20, 0.6);
}

.co-compose textarea {
  resize: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.84rem;
  outline: none;
  min-height: 44px;
}

.co-compose textarea:focus {
  border-color: rgba(167, 139, 250, 0.5);
}

.co-compose .btn {
  align-self: end;
}

.vision-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}

.vision-stage-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.vision-stage-blurb {
  font-size: 0.75rem;
  color: var(--text-mute);
}

.vision-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 240px;
  overflow: hidden;
  border-radius: var(--radius-sm, 8px);
  background:
    radial-gradient(ellipse at 50% 30%, rgba(56, 189, 248, 0.08), transparent 55%),
    var(--bg-0);
}

/* —— AI imagining: keep the current frame fully visible; signal work with a living frame —— */
.vision-canvas-wrap.is-imagining {
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.35),
    0 0 22px rgba(56, 189, 248, 0.18),
    inset 0 0 40px rgba(56, 189, 248, 0.06);
  animation: vision-glow-pulse 2.4s ease-in-out infinite;
}

@keyframes vision-glow-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(56, 189, 248, 0.3),
      0 0 16px rgba(56, 189, 248, 0.12),
      inset 0 0 28px rgba(56, 189, 248, 0.04);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(125, 211, 252, 0.55),
      0 0 28px rgba(56, 189, 248, 0.28),
      inset 0 0 48px rgba(56, 189, 248, 0.1);
  }
}

.vision-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.45s var(--ease), filter 0.5s var(--ease);
}

/* Keep the old frame readable while a new one generates (was ~0.35 + full blur) */
.vision-image.is-fading {
  opacity: 0.72;
}

.vision-canvas-wrap.is-imagining .vision-image:not([hidden]) {
  /* slight vitality — never hide the scene */
  filter: saturate(1.05) brightness(1.02);
}

.vision-image[hidden] {
  display: none;
}

.vision-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  color: var(--text-mute);
  font-size: 0.88rem;
  pointer-events: none;
}

.vision-image:not([hidden]) ~ .vision-placeholder {
  display: none;
}

/* Non-blocking loader: frame + chip only — no full-bleed dim/blur over the art */
.vision-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: transparent;
  backdrop-filter: none;
  display: block;
}

.vision-loading[hidden] {
  display: none;
}

/* Moving light that runs the border (rotating conic sweep, ring-masked) */
.vision-loading-frame {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  overflow: hidden;
  pointer-events: none;
  /* Punch out the center so only a 2px ring shows */
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.95;
}

.vision-loading-frame::before {
  content: "";
  position: absolute;
  /* Oversized so rotation never leaves the ring empty */
  inset: -60%;
  background: conic-gradient(
    from 0deg,
    rgba(56, 189, 248, 0.05) 0deg,
    rgba(56, 189, 248, 0.15) 60deg,
    rgba(56, 189, 248, 0.95) 110deg,
    rgba(167, 139, 250, 0.9) 150deg,
    rgba(56, 189, 248, 0.2) 200deg,
    rgba(56, 189, 248, 0.05) 360deg
  );
  animation: vision-frame-spin 2.1s linear infinite;
}

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

/* Steady secondary rim so the frame never disappears between sweeps */
.vision-loading-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(56, 189, 248, 0.28);
  pointer-events: none;
}

/* Small floating chip — does not cover the picture */
.vision-loading-inner {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(10, 16, 28, 0.72);
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  max-width: calc(100% - 1.25rem);
}

.vision-loading-inner .co-dots {
  flex-shrink: 0;
}

.vision-loading-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* First frame (no image yet): slightly stronger empty-state cue, still no heavy blur */
.vision-canvas-wrap.is-imagining-empty .vision-loading-inner {
  top: 50%;
  transform: translate(-50%, -50%);
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  white-space: normal;
  text-align: center;
  max-width: 85%;
}

.vision-canvas-wrap.is-imagining-empty .vision-placeholder {
  opacity: 0.35;
}

.vision-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.4rem 0.65rem;
  font-size: 0.68rem;
  color: var(--text-mute);
  background: linear-gradient(transparent, rgba(7, 11, 20, 0.85));
  z-index: 1;
}

/* Status line while imagining — extra cue without covering art */
.vision-canvas-wrap.is-imagining .vision-status {
  color: rgba(186, 230, 253, 0.95);
  background: linear-gradient(transparent, rgba(8, 20, 36, 0.9));
}

.reveal-vision-wrap .vision-image {
  min-height: 280px;
}

.vision-narratives {
  max-height: 38%;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.narrative-card {
  font-size: 0.8rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-dim);
  animation: slideIn 0.35s var(--ease);
}

.narrative-card .src {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Reveal / results —— */
#screen-reveal .content,
#screen-outcome .content {
  max-width: 960px;
}

.reveal-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}

.reveal-hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.reveal-hero .invention-name {
  font-size: 1.35rem;
  color: var(--accent);
  font-weight: 600;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.score-card {
  padding: 1rem;
  text-align: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.score-card .val {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #38bdf8, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.score-card .lbl {
  font-size: 0.75rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.future-story {
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(49, 46, 129, 0.35), rgba(12, 18, 32, 0.9));
}

.future-story h3 {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #c4b5fd;
}

.future-story p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.65;
}

.learn-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.learn-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.learn-card h4 {
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.learn-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.feedback-list {
  margin: 0 0 1.5rem;
  padding-left: 1.2rem;
  color: var(--text-dim);
}

.feedback-list li {
  margin-bottom: 0.4rem;
}

.feedback-list .good {
  color: var(--accent-3);
}

.feedback-list .grow {
  color: var(--warn);
}

/* Modal: tech detail */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem var(--page-gutter);
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(480px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.25s var(--ease);
}

/* Must beat .modal { width } — same stylesheet order used to win over the base rule */
.modal.help-modal {
  width: min(920px, 94vw);
  max-width: 94vw;
  max-height: 90vh;
  padding: 1.25rem 1.4rem 1.1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* scroll lives on .help-body */
}

.modal.help-modal .help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.35rem;
  margin-right: -0.1rem;
  scrollbar-gutter: stable;
}

.modal h3 {
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal.modal-learn {
  width: min(560px, 100%);
  max-height: 88vh;
}

.modal-lead {
  color: var(--text-mute);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(60vh, 28rem);
  overflow-y: auto;
  margin-bottom: 0.85rem;
  padding-right: 0.15rem;
}

.learn-tech-card {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.35);
}

.learn-tech-card.is-newest {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.06);
}

.learn-tech-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.learn-tech-head h4 {
  margin: 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.learn-tech-icon {
  font-size: 1.15rem;
}

.learn-newest {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.learn-tech-summary {
  margin: 0 0 0.75rem;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.learn-tech-meta {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.learn-sec {
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.learn-sec:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.learn-sec h5 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.learn-sec-body p {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.learn-sec-body p:last-child {
  margin-bottom: 0;
}

.learn-subhead {
  margin: 0.55rem 0 0.3rem !important;
  font-size: 0.78rem !important;
  font-weight: 600;
  color: var(--text) !important;
}

.learn-list {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.15rem;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.learn-list-warn li {
  color: #fde68a;
}

.learn-muted {
  font-size: 0.82rem !important;
  color: var(--text-mute) !important;
}

.learn-horizon {
  margin-top: 0.5rem !important;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  font-size: 0.84rem !important;
}

.modal p {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0 0 0.85rem;
}

.modal .learn-block {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  margin-bottom: 0.65rem;
  white-space: pre-wrap;
}

.modal .learn-block:last-child {
  margin-bottom: 0;
}

.modal .learn-block-timing {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
}

.modal .learn-block strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

/* —— External / hosted Quests (server quests/ folder) —— */
.theme-shelf-external {
  margin-bottom: 1.5rem;
  padding: 1rem 1rem 1.15rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 180, 100, 0.35);
  background: linear-gradient(
    145deg,
    rgba(255, 159, 67, 0.12),
    rgba(12, 18, 32, 0.55)
  );
  box-shadow: 0 0 0 1px rgba(255, 180, 100, 0.08), 0 12px 40px rgba(0, 0, 0, 0.2);
}
.theme-shelf-external .theme-shelf-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.theme-shelf-external-pill {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0b0a14;
  background: linear-gradient(120deg, #ffd28a, #ff9f43);
  vertical-align: middle;
}
.quest-card-external,
.challenge-card.quest-card-external {
  border: 1px solid rgba(255, 180, 100, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(255, 159, 67, 0.2), 0 0 24px rgba(255, 159, 67, 0.12);
  background: linear-gradient(160deg, rgba(255, 180, 100, 0.08), rgba(18, 26, 43, 0.95));
}
.quest-card-external.is-selected,
.challenge-card.quest-card-external.is-selected {
  box-shadow: 0 0 0 2px rgba(255, 180, 100, 0.7), 0 0 28px rgba(255, 159, 67, 0.2);
}
.scenario-tag.external-tag,
.scenario-tag.external {
  background: linear-gradient(120deg, #ffd28a, #ff9f43);
  color: #0b0a14;
  font-weight: 700;
}
.scenario-tag.spotlight-tag {
  background: rgba(255, 210, 138, 0.2);
  color: #ffd28a;
  border: 1px solid rgba(255, 180, 100, 0.4);
}
.scenario-tag.resources-tag {
  background: rgba(94, 184, 196, 0.18);
  color: #9fd8e0;
  border: 1px solid rgba(94, 184, 196, 0.4);
  font-weight: 600;
}
.scenario-tag.crisis-tag {
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.45);
  font-weight: 600;
}
/* Learning chips: amber — distinct from resources teal and crisis purple */
.scenario-tag.learning-tag {
  background: rgba(251, 146, 60, 0.16);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.45);
  font-weight: 600;
}
/* Sponsor chips: slate — display-only attribution */
.scenario-tag.sponsor-tag {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-weight: 600;
}
.quest-lib-copy .scenario-tag.resources-tag,
.quest-lib-copy .scenario-tag.crisis-tag,
.quest-lib-copy .scenario-tag.learning-tag,
.quest-lib-copy .scenario-tag.sponsor-tag {
  display: inline-block;
  margin: 0.2rem 0.35rem 0.15rem 0;
  font-size: 0.72rem;
}
.scenario-tag.imported-tag,
.scenario-tag.imported {
  background: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}
.quest-external-badge {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #0b0a14;
  background: linear-gradient(120deg, #ffd28a, #ff9f43);
}
.quest-external-row {
  border-left: 3px solid #ff9f43;
  padding-left: 0.65rem;
  margin-left: -0.15rem;
}
.hosted-quests-panel .pins-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

/* —— Read out loud (long narrative text) —— */
/* Icon control sits under the host block, lower-right */
.read-aloud-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  margin: 0.15rem 0 0.4rem;
  min-height: 0;
  width: 100%;
}
.read-aloud-bar[hidden] {
  display: none !important;
}
.btn-read-aloud {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 180, 100, 0.22);
  border-radius: 999px;
  color: var(--text-dim, #a8b4c8);
  background: rgba(12, 18, 32, 0.45);
  line-height: 0;
}
.btn-read-aloud .read-aloud-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
  flex-shrink: 0;
}
.btn-read-aloud:hover:not(:disabled) {
  color: #fff4e6;
  border-color: rgba(255, 200, 120, 0.4);
  background: rgba(30, 24, 18, 0.55);
}
.btn-read-aloud[aria-pressed="true"] {
  color: #fff4e6;
  border-color: rgba(255, 180, 100, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 180, 100, 0.15);
}
.btn-read-aloud:disabled,
.btn-read-aloud.is-loading {
  opacity: 0.7;
  cursor: wait;
}
.btn-read-aloud.is-loading .read-aloud-icon {
  animation: read-aloud-pulse 0.9s ease-in-out infinite;
}
@keyframes read-aloud-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn-read-aloud.is-loading .read-aloud-icon {
    animation: none;
  }
}

/* —— Quest briefs (Markdown) & spotlight imports —— */
.quest-brief {
  text-align: left;
  max-height: min(42vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.35rem;
  border-radius: 12px;
  background: rgba(12, 18, 32, 0.55);
  border: 1px solid rgba(255, 180, 100, 0.14);
  line-height: 1.55;
  font-size: 0.95rem;
  color: var(--text, #e8eef9);
}
.quest-brief h1,
.quest-brief h2,
.quest-brief h3 {
  margin: 0.85em 0 0.35em;
  font-weight: 700;
  color: #fff4e6;
  line-height: 1.25;
}
.quest-brief h1 {
  font-size: 1.15rem;
}
.quest-brief h2 {
  font-size: 1.05rem;
}
.quest-brief h3 {
  font-size: 1rem;
}
.quest-brief p {
  margin: 0.45em 0;
}
.quest-brief ul,
.quest-brief ol {
  margin: 0.4em 0 0.6em 1.2em;
  padding: 0;
}
.quest-brief li {
  margin: 0.25em 0;
}
.quest-brief a {
  color: #ffd28a;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.quest-brief strong {
  color: #fff4e6;
  font-weight: 650;
}

/* Plain scene blurb (no markdown brief): still full text, scroll when long */
.ws-mission-scene:not(.quest-brief),
.mp-mission-scene:not(.quest-brief) {
  display: block;
  margin: 0.35rem 0;
  max-height: min(42vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-gutter: stable;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Invent banner Spotlight chip — warm “lit” pill (glow + deep amber), not solid gold.
   Higher specificity so .challenge-banner p { color: var(--text-dim) } cannot wash the label out.
   Cream text on dark amber keeps contrast; outer glow sells the spotlight without glare. */
.challenge-banner .ws-spotlight-chip,
.ws-spotlight-chip {
  display: inline-block;
  margin: 0.4rem 0 0.2rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff4df;
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(255, 220, 150, 0.35), transparent 55%),
    linear-gradient(145deg, rgba(92, 58, 18, 0.95), rgba(42, 28, 10, 0.98));
  border: 1px solid rgba(255, 196, 110, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 170, 70, 0.12),
    0 0 16px rgba(255, 170, 60, 0.32),
    0 0 32px rgba(255, 140, 40, 0.14),
    inset 0 1px 0 rgba(255, 236, 190, 0.28);
  text-shadow: 0 0 14px rgba(255, 200, 110, 0.4);
}
/* .challenge-banner .ws-spotlight-chip { display:inline-block } beats UA [hidden]
   → empty gold pill leaked under place name on non-Spotlight theme quests */
.challenge-banner .ws-spotlight-chip[hidden],
.ws-spotlight-chip[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  border: none !important;
  box-shadow: none !important;
}
.ws-spotlight-encourage {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.88rem;
}
.ws-spotlight-encourage[hidden] {
  display: none !important;
}

.daily-spotlight {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  font-weight: 650;
  color: #ffd28a;
}

.quest-library-panel {
  margin-top: 1rem;
}
.quest-lib-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.quest-lib-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.quest-lib-excerpt {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
}
.quest-lib-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.tech-card.spotlight-tech:not(.selected) {
  box-shadow: 0 0 0 1px rgba(255, 180, 100, 0.45), 0 0 18px rgba(255, 159, 67, 0.12);
}
.tech-spotlight-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  color: #0b0a14;
  background: #ffb347;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
