/* 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);
  /* Taller lockup: keep the bar short, and size the account chip to this band */
  --topbar-pad-y: 0.4rem;
  --hud-logo-h: 2.65rem;
  /* Clerk Sign in / UserButton — match the workshop, not Clerk's light inputs */
  --clerk-color-primary: #a78bfa;
  --clerk-color-primary-foreground: #0c1220;
  --clerk-color-background: #121a2b;
  --clerk-color-foreground: #e8eef9;
  --clerk-color-muted: #1a2438;
  --clerk-color-muted-foreground: #94a3b8;
  --clerk-color-input: #1a2438;
  --clerk-color-input-foreground: #e8eef9;
  --clerk-color-border: #2a3a58;
  --clerk-color-modal-backdrop: rgba(7, 11, 20, 0.78);
}

html {
  color-scheme: dark;
}

*,
*::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;
}

/* Optional Clerk account chip — hidden unless portal Clerk is on.
   Fixed, so it does not ride the topbar's flex centering. Match the bar
   height (padding + logo) and center inside it. */
#ff-account {
  position: fixed;
  top: 0;
  right: var(--page-gutter);
  z-index: 90;
  display: flex;
  align-items: center;
  height: calc(var(--topbar-pad-y) * 2 + var(--hud-logo-h));
  gap: 0.4rem;
}

#ff-account[hidden] {
  display: none !important;
}

#ff-account-who {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ff-account-who[hidden],
#ff-account-signout[hidden],
#ff-account-signin[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  #ff-account {
    right: 0.5rem;
  }
}

/* Fullscreen board covers the topbar. Pin the chip to the top corner
   so it clears the restore control, instead of centering in the bar. */
body.hex-board-expanded.ff-accounts #ff-account {
  top: 0;
  height: auto;
  align-items: flex-start;
  right: calc(var(--page-gutter) + 2.75rem);
}

@media (max-width: 640px) {
  body.hex-board-expanded.ff-accounts #ff-account {
    top: 0;
    right: 3.25rem;
  }
}

/* Leave room so Sign in / name / Sign out does not cover topbar actions */
body.ff-accounts .topbar,
body.ff-accounts .topbar-game {
  padding-right: 12.5rem;
}

.outcome-publish {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.75rem auto;
  max-width: 28rem;
  font-size: 0.88rem;
  color: var(--text-dim, #cbd5e1);
}

.cloud-profile-header {
  margin-bottom: 0.75rem;
}

.cloud-profile-intro {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.45;
}

.cloud-profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.cloud-profile-login {
  width: 100%;
  margin: 0 0 0.85rem;
  word-break: break-word;
}

.cloud-profile-form .field {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.cloud-profile-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.35;
}

.cloud-profile-check input {
  margin: 0.15rem 0 0;
  flex: 0 0 auto;
}

.cloud-profile-form .modal-actions {
  margin-top: 0.25rem;
}

.cloud-profile-form #cloud-profile-status {
  margin: 0;
  min-height: 1.2em;
}

.cloud-portfolio {
  --hex-w: 4.55rem;
  width: 100%;
  margin: 0 0 1.15rem;
  padding: 1rem 0.75rem 1.1rem;
  border: 1px solid rgba(232, 161, 42, 0.18);
  border-radius: 16px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232, 161, 42, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(12, 18, 32, 0.92), rgba(8, 12, 22, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 210, 138, 0.08);
}

.cloud-portfolio-hero {
  text-align: center;
  margin: 0 0 0.35rem;
}

.cloud-portfolio-seal {
  display: none;
  width: 3.1rem;
  height: 3.1rem;
  margin: 0 auto 0.55rem;
  border-radius: 0.55rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 210, 138, 0.35), transparent 62%),
    #0b141b;
  box-shadow: 0 0 22px rgba(232, 161, 42, 0.45);
}

.cloud-portfolio-seal-mark {
  display: block;
  width: 100%;
  height: 100%;
  background: url("../assets/brand/ff-mark-hex.png") center / 190% no-repeat;
}

.cloud-portfolio.is-complete .cloud-portfolio-seal {
  display: block;
  animation: forge-seal 2.8s var(--ease) infinite;
}

@keyframes forge-seal {
  0%,
  100% {
    box-shadow: 0 0 16px rgba(232, 161, 42, 0.35);
  }
  50% {
    box-shadow: 0 0 28px rgba(255, 210, 138, 0.7);
  }
}

.cloud-portfolio-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.cloud-portfolio.is-complete .cloud-portfolio-title {
  font-size: 1.28rem;
  letter-spacing: 0.08em;
  text-transform: none;
  font-weight: 750;
  color: #ffd28a;
  text-shadow: 0 0 18px rgba(232, 161, 42, 0.35);
}

.cloud-portfolio-lede {
  margin: 0.35rem auto 0;
  max-width: 22rem;
  line-height: 1.4;
}

.cloud-portfolio-progress {
  margin: 0.45rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: #ffd28a;
}

.cloud-portfolio-meter {
  width: min(14rem, 70%);
  height: 3px;
  margin: 0 auto 0.85rem;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.cloud-portfolio-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb347, #ffe29a);
  box-shadow: 0 0 8px rgba(255, 210, 138, 0.6);
}

.cloud-portfolio-badge {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0.15rem 0 0.55rem;
  color: rgba(255, 244, 230, 0.72);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.35;
}

.cloud-portfolio-badge strong {
  display: none;
}

.cloud-portfolio-grid {
  list-style: none;
  margin: 0.15rem auto 0;
  padding: 0 0 1.35rem;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, var(--hex-w)));
  justify-content: center;
  justify-items: center;
  max-width: calc(var(--hex-w) * 5.15);
}

.cloud-portfolio-hex {
  width: var(--hex-w);
  margin-bottom: calc(var(--hex-w) * -0.36);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}

.cloud-portfolio-hex:nth-child(1) {
  grid-column: 3 / 5;
}
.cloud-portfolio-hex:nth-child(2) {
  grid-column: 5 / 7;
}
.cloud-portfolio-hex:nth-child(3) {
  grid-column: 7 / 9;
}
.cloud-portfolio-hex:nth-child(4) {
  grid-column: 2 / 4;
}
.cloud-portfolio-hex:nth-child(5) {
  grid-column: 4 / 6;
}
.cloud-portfolio-hex:nth-child(6) {
  grid-column: 6 / 8;
}
.cloud-portfolio-hex:nth-child(7) {
  grid-column: 8 / 10;
}
.cloud-portfolio-hex:nth-child(8) {
  grid-column: 3 / 5;
}
.cloud-portfolio-hex:nth-child(9) {
  grid-column: 5 / 7;
}
.cloud-portfolio-hex:nth-child(10) {
  grid-column: 7 / 9;
}
.cloud-portfolio-hex:nth-child(11) {
  grid-column: 5 / 7;
}

.cloud-portfolio-hex-face {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  width: 100%;
  aspect-ratio: 1 / 1.12;
  padding: 0.78rem 0.32rem 0.62rem;
  color: var(--text-mute);
  background: rgba(15, 22, 36, 0.88);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
}

.cloud-portfolio-hex.is-used .cloud-portfolio-hex-face {
  color: var(--text);
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--chip) 38%, #0b141b), #0b141b 72%);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--chip) 75%, #fff 8%),
    inset 0 -10px 18px color-mix(in srgb, var(--chip) 18%, transparent);
}

.cloud-portfolio-hex.is-used {
  filter:
    drop-shadow(0 0 8px color-mix(in srgb, var(--chip) 42%, transparent))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}

.cloud-portfolio.is-complete .cloud-portfolio-hex.is-used {
  filter:
    drop-shadow(0 0 10px color-mix(in srgb, var(--chip) 55%, transparent))
    drop-shadow(0 0 16px rgba(232, 161, 42, 0.22));
}

.cloud-portfolio-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
}

.cloud-portfolio-icon svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}

.cloud-portfolio-name {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  max-width: 3.6rem;
}

.cloud-portfolio-dev {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.85rem 0 0;
}

/* display:flex / block on these beats the UA [hidden] rule */
.cloud-portfolio-dev[hidden],
.cloud-portfolio-badge[hidden],
.cloud-portfolio-meter[hidden],
.cloud-portfolio-lede[hidden],
.cloud-portfolio-progress[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  .cloud-portfolio {
    --hex-w: 3.85rem;
    padding-inline: 0.4rem;
  }
  .cloud-portfolio-name {
    font-size: 0.52rem;
  }
}

.catalog-board-pick {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.outcome-pathway-text {
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.45;
}

.quest-board-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.quest-board-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}

.quest-board-still {
  max-width: 100%;
  height: auto;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
}

.quest-board-writeup {
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: var(--text-dim, #cbd5e1);
  margin: 0;
}

.btn-forge {
  background: linear-gradient(165deg, #3a3120 0%, #1a150c 100%);
  color: #f6e7b8;
  border: 1px solid rgba(228, 197, 106, 0.7);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.12),
    0 8px 28px rgba(228, 197, 106, 0.16);
}

.btn-forge:hover:not(:disabled) {
  border-color: #f6e7b8;
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.2),
    0 12px 32px rgba(228, 197, 106, 0.28);
}

.quest-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.quest-log-filters .chip {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: var(--text-dim, #cbd5e1);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.quest-log-filters .chip.is-on {
  border-color: #e4c56a;
  background: #e4c56a;
  color: #0c1220;
}

.quest-log-list,
.ff-board-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quest-log-item-title {
  margin: 0 0 0.2rem;
  font-weight: 700;
  color: #fff;
}

.quest-log-item-meta {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: #f6e7b8;
}

/* 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%;
}


/* 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.hex-create-busy #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;
}

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

#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: 0;
  max-height: none;
}

.mp-side-panel .co-inventor-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.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: product lockup (art includes the words) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.title-logo-sun {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(
    circle at 35% 35%,
    #fff8e7 0%,
    #ffe29a 28%,
    #ff9f43 62%,
    #ff6b4a 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 {
  display: block;
  margin: 0 auto 1.1rem;
  max-width: min(440px, 88vw);
  line-height: 0;
}

.title-logo img {
  display: block;
  width: 100%;
  height: auto;
}

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

/* 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);
}

/* Look Ahead — foresight CTA (opens Wait overlay; confirm still Wait +2 years).
   Violet (accent-2): not RYG traffic meaning, not primary blue. */
.btn-look-ahead {
  background: linear-gradient(160deg, #5b21b6 0%, #7c3aed 55%, #6d28d9 100%);
  border: 1px solid rgba(196, 181, 253, 0.45);
  color: #f5f3ff;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.35);
}

.btn-look-ahead:hover:not(:disabled) {
  border-color: rgba(221, 214, 254, 0.7);
  color: #ffffff;
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.45);
}

.btn-look-ahead:focus-visible {
  outline: 2px solid #c4b5fd;
  outline-offset: 2px;
}

.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: var(--topbar-pad-y) 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 .scenario-tag.next-lesson-tag {
  color: #fde68a;
  border-color: rgba(253, 230, 138, 0.55);
  background: rgba(253, 230, 138, 0.12);
}

.challenge-card.is-suggested-lesson {
  border-color: rgba(253, 230, 138, 0.55);
  box-shadow: inset 0 0 0 1px rgba(253, 230, 138, 0.12);
}

.challenge-card.is-suggested-lesson .cta {
  color: #fde68a;
}

.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 {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.35rem;
}
.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-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
}
.quest-catalog-grid .catalog-dev,
.quest-catalog-grid .catalog-board,
.quest-catalog-grid .catalog-copy,
.quest-catalog-grid .catalog-remove {
  align-self: auto;
}

/* Developer inspect (catalog → modal) — near full-screen */
.modal-backdrop.quest-dev-modal-open {
  padding: 0.75rem clamp(0.5rem, 1.5vw, 1.25rem);
  align-items: stretch;
  justify-content: center;
}
.modal-backdrop.quest-dev-modal-open .modal {
  width: 100%;
  max-width: none;
  height: calc(100vh - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  padding: 1.35rem 1.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-backdrop.quest-dev-modal-open #modal-title {
  flex: 0 0 auto;
  margin-bottom: 0.35rem;
}
.modal-backdrop.quest-dev-modal-open #modal-lead {
  flex: 0 0 auto;
}
.modal-backdrop.quest-dev-modal-open .modal-actions {
  flex: 0 0 auto;
  margin-top: 0.25rem;
}
.modal-body.quest-dev-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  gap: 1.35rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.45rem;
  scrollbar-gutter: stable;
}
.quest-dev-section {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.28);
}
.quest-dev-section > h4,
.quest-dev-json-head h4 {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.quest-dev-section > h4 .muted {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 500;
  color: var(--text-mute);
  font-size: 0.85em;
}
.quest-dev-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.quest-dev-dl > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
}
.quest-dev-dl dt {
  margin: 0;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 0.8rem;
}
.quest-dev-dl dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.quest-dev-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  color: var(--text);
}
.quest-dev-scene {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.quest-dev-md {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.quest-dev-md .md-img,
.quest-dev-md img.md-img {
  display: block;
  max-width: min(100%, 28rem);
  max-height: 16rem;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin: 0.5rem 0;
  background: rgba(0, 0, 0, 0.2);
}
.quest-dev-md .md-img-wrap {
  margin: 0.35rem 0;
}
.quest-dev-md h2,
.quest-dev-md h3 {
  margin: 0.85rem 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}
.quest-dev-md h2:first-child,
.quest-dev-md h3:first-child {
  margin-top: 0;
}
.quest-dev-md p {
  margin: 0 0 0.55rem;
  color: var(--text-dim);
}
.quest-dev-md strong {
  color: var(--text);
}
.quest-dev-md a {
  color: var(--accent);
}
.quest-dev-json-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}
.quest-dev-json-head h4 {
  margin: 0;
}
.quest-dev-json {
  margin: 0;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(2, 6, 14, 0.65);
  overflow: auto;
  font-size: 0.8rem;
  line-height: 1.45;
  max-height: min(50vh, 28rem);
  color: var(--text-dim);
}
.quest-dev-json code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
  color: inherit;
}
.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;
}

.quest-module-summary {
  display: grid;
  grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.28);
}
.quest-module-cover {
  display: block;
  width: 100%;
  max-height: 12rem;
  object-fit: cover;
  border-radius: 8px;
  background: #0f172a;
}
.quest-module-summary-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.quest-module-lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text);
}
.quest-module-overview {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-dim);
}
.quest-module-overview p {
  margin: 0 0 0.5rem;
}
.quest-module-overview h2,
.quest-module-overview h3 {
  margin: 0.4rem 0 0.35rem;
  font-size: 1.02rem;
  color: var(--text);
}
@media (max-width: 720px) {
  .quest-module-summary {
    grid-template-columns: 1fr;
  }
}

.quest-dev-job-line {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--text);
}
.quest-dev-beats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.quest-dev-beat {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
  padding: 0.65rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 14, 0.4);
}
.quest-dev-beat-still {
  display: block;
  width: 100%;
  max-height: 8.5rem;
  object-fit: cover;
  border-radius: 6px;
  background: #0f172a;
}
.quest-dev-beat-copy h5 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  color: var(--text);
}
.quest-dev-beat-meta {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.quest-dev-beat-prompt {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}
@media (max-width: 720px) {
  .quest-dev-beat {
    grid-template-columns: 1fr;
  }
}

.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;
}

.pathway-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.65);
}

.feasibility {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.hex-island-how {
  margin: 0.7rem 0 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pathway-panel .prompt-tip {
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.15rem 0.1rem 0.75rem;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 0;
  background: transparent;
}

.hex-island-how[hidden] {
  display: none !important;
}

.hex-island-how-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

.hex-island-how-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
}

.hex-island-how-text {
  flex: 1 1 auto;
  width: 100%;
  min-height: 4.2rem;
  resize: vertical;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.hex-island-how-save {
  flex: 0 0 auto;
  align-self: flex-end;
}

@media (max-width: 520px) {
  .hex-island-how-row {
    flex-wrap: wrap;
  }

  .hex-island-how-save {
    margin-left: auto;
  }
}

.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
    );
  }
}

/*
 * Hex tile pending re-eval: snake arc along the rim in the last RYG color.
 * Matches feasibility-light sweep timing (~0.9s).
 */
.hex-eval-snake {
  animation: hex-eval-snake-spin 0.9s linear infinite;
  pointer-events: none;
}

@keyframes hex-eval-snake-spin {
  to {
    stroke-dashoffset: -100;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hex-eval-snake {
    animation: none;
  }
}

.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 lockup: Future Forge by Warmer Sun (art includes the words) */
.hud-product {
  display: block;
  flex: 0 0 auto;
  height: var(--hud-logo-h);
  width: auto;
  padding: 0;
  line-height: 0;
  text-decoration: none;
}

.hud-product img {
  display: block;
  height: 100%;
  width: auto;
}

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

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

/* 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) {
  :root {
    --hud-logo-h: 2.15rem;
  }
}

.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);
}

.hud-pressure .meter.is-pending {
  animation: hud-meter-pending 0.9s ease-in-out infinite;
}

@keyframes hud-meter-pending {
  50% {
    opacity: 0.55;
  }
}

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

.mission-summary {
  margin: 0 0 0.45rem !important;
  max-width: 38rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.challenge-banner .mission-summary {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}

.mission-summary.is-loading {
  font-weight: 500;
  color: var(--text-mute);
  animation: mission-summary-pulse 1.1s ease-in-out infinite;
}

.mission-summary[hidden] {
  display: none !important;
  margin: 0 !important;
}

@keyframes mission-summary-pulse {
  50% {
    opacity: 0.45;
  }
}

.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,
body.mp-turn-gate #btn-ask-ideas,
body.mp-turn-gate #btn-refresh-ideas,
body.mp-turn-gate #btn-mint-custom,
body.mp-turn-gate #btn-mint-rd,
body.mp-turn-gate #hex-idea-cards .hex-idea-card,
body.mp-turn-gate #hex-discard {
  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-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;
  white-space: nowrap;
}

.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-cloud-save {
  width: 100%;
  max-width: 28rem;
  margin: 1.1rem auto 0.85rem;
  padding: 1rem 1.15rem 1.1rem;
  text-align: center;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: linear-gradient(
    145deg,
    rgba(167, 139, 250, 0.12),
    rgba(15, 23, 42, 0.9)
  );
}

.outcome-cloud-save[hidden] {
  display: none !important;
}

.outcome-cloud-save-kicker {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.outcome-cloud-save-copy {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text, #e8eef9);
}

.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);
}

/* Guided tour — next-step coach-mark (on-demand from ?) */
#tour-root {
  position: fixed;
  inset: 0;
  z-index: 125;
  pointer-events: none;
}

#tour-root:not(.is-open) {
  display: none;
}

#tour-root.is-open {
  display: block;
}

.tour-panes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tour-panes[hidden] {
  display: none !important;
}

.tour-pane {
  position: absolute;
  background: rgba(2, 6, 14, 0.52);
  pointer-events: auto;
}

.tour-ring {
  position: fixed;
  z-index: 126;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.35),
    0 0 24px rgba(56, 189, 248, 0.35);
  animation: tour-ring-in 0.22s var(--ease);
}

.tour-ring[hidden] {
  display: none !important;
}

@keyframes tour-ring-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tour-card {
  position: fixed;
  z-index: 126;
  pointer-events: auto;
  width: min(340px, calc(100vw - 24px));
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.9rem 1rem 0.85rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  outline: none;
}

.tour-card[hidden] {
  display: none !important;
}

.tour-card[data-edge="bottom-sheet"] {
  width: auto;
}

/* Hand-holding tutorial — same card and ring as ?, with a locked dimmer. */
#tutorial-root {
  position: fixed;
  inset: 0;
  z-index: 10250;
  pointer-events: none;
}

#tutorial-root:not(.is-open) {
  display: none;
}

#tutorial-root.is-open {
  display: block;
}

.tutorial-dim {
  position: absolute;
  inset: 0;
  z-index: 10250;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tutorial-dim-path {
  /* Clicks are gated in script. Leaving the path transparent to the pointer
     lets the page scroll under the dimmer. */
  pointer-events: none;
}

.tutorial-rings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tutorial-ring {
  position: fixed;
  z-index: 10251;
  animation: none;
}

.tutorial-ring.tutorial-ring-in {
  animation: tour-ring-in 0.22s var(--ease, ease);
}

/* On body, above the tile popup (10255) and the home pitch (backdrop-filter). */
body:not(.tutorial-open) > .tour-card.is-tutorial {
  display: none;
}

.tour-card.is-tutorial {
  z-index: 10270;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
}

.tutorial-type {
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--accent);
  background: rgba(56, 189, 248, 0.08);
  color: var(--text, #e2e8f0);
  font-size: 0.92rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.tutorial-type em {
  font-style: italic;
}

.tutorial-type[hidden],
.tutorial-type-hint[hidden] {
  display: none !important;
}

.tutorial-type-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--accent);
}

.tour-card.is-tutorial.tutorial-nudge {
  animation: tutorial-nudge 0.35s var(--ease, ease);
}

@keyframes tutorial-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-6px);
  }
  60% {
    transform: translateX(6px);
  }
}

.outcome-tutorial-done {
  margin: 0 0 1.25rem;
}

.outcome-tutorial-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.outcome-tutorial-done h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.outcome-tutorial-done ul {
  margin: 0.4rem 0 0;
  padding-left: 1.15rem;
}

.outcome-tutorial-done li {
  margin: 0.28rem 0;
}

.tour-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.tour-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.25;
}

.tour-card-body {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.tour-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

#help-backdrop {
  z-index: 140;
}

/* 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.45rem;
  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.45rem;
  font-size: 0.72rem;
  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: 900px) {
  .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;
}

body.wait-confirm-open {
  overflow: hidden;
}

.wait-confirm-backdrop.modal-backdrop.open {
  align-items: stretch;
  justify-content: stretch;
  padding: 0.75rem var(--page-gutter);
}

.modal.wait-confirm-modal {
  width: 100%;
  max-width: none;
  height: calc(100vh - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1rem 1.15rem 0.85rem;
}

.wait-confirm-header {
  flex: 0 0 auto;
  margin-bottom: 0.35rem;
}

.wait-confirm-header h3 {
  margin: 0;
}

.wait-confirm-sub {
  margin: 0.2rem 0 0;
  font-variant-numeric: tabular-nums;
}

.modal.wait-confirm-modal .wait-confirm-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.wait-confirm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem);
  gap: 1rem;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.wait-trends-pane {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.25rem;
  scrollbar-gutter: stable;
}

.wait-implications-pane {
  min-height: 0;
  overflow-y: auto;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.45);
}

.wait-trends-heading {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--text);
}

.wait-trends-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.25rem;
}

.wait-trends-head .wait-trends-heading {
  margin: 0;
}

.wait-trends-lede {
  margin: 0 0 0.75rem;
}

.wait-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 0.85rem;
}

.wait-trend-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(7, 11, 20, 0.4);
  padding: 0.75rem 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wait-trend-card.is-spotlight {
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.12);
}

.wait-trend-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
}

.wait-trend-dev {
  margin-left: auto;
}

.wait-trend-tech {
  margin: 0;
}

.wait-trend-tech code {
  font-size: 0.85em;
  opacity: 0.85;
}

.trend-dev-player-preview {
  margin-top: 0.75rem;
}

.trend-dev-player-preview .wait-trend-card {
  margin: 0;
}

.wait-trend-name {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  flex: 1 1 auto;
}

.wait-trend-spotlight {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

.wait-trend-chip {
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

.wait-trend-summary,
.wait-trend-meta {
  margin: 0;
}

.wait-trend-canvas-wrap {
  position: relative;
  width: 100%;
  height: 11.5rem;
  margin-top: 0.25rem;
}

.wait-trend-canvas {
  width: 100% !important;
  height: 100% !important;
}

.wait-trend-milestones {
  margin: 0.35rem 0 0;
  padding-left: 1.05rem;
  font-size: 0.78rem;
  color: var(--text-mute);
}

.wait-trend-milestones li {
  margin: 0.15rem 0;
}

.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-confirm-modal .modal-actions {
  flex: 0 0 auto;
  margin-top: 0;
}

@media (max-width: 860px) {
  .wait-confirm-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow-y: auto;
  }

  .wait-trends-pane,
  .wait-implications-pane {
    overflow: visible;
  }

  .wait-confirm-body {
    overflow-y: auto;
  }

  .wait-implications-pane {
    max-height: none;
  }
}

.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;
}

.year-bulletin-attribution,
.foresight-attribution {
  font-size: 0.76rem;
  font-style: italic;
  color: #94a3b8;
}

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: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-1, rgba(7, 11, 20, 0.4));
}

.challenge-side .vision-co-stack {
  flex: 1;
  min-height: 0;
}

.challenge-side .vision-stack-top,
.challenge-side .vision-stack-bottom {
  padding: 0.35rem 0.55rem 0.55rem;
}

.challenge-side .vision-stack-bottom {
  overflow: auto;
  gap: 0.45rem;
}

.challenge-side #challenge-vision-root,
.challenge-side #deploy-vision-root {
  flex: 1;
  min-height: 0;
}

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

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

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

.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;
  flex-shrink: 0;
}

.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;
}

.foresight-card p.foresight-attribution {
  margin-top: 0.35rem;
  font-size: 0.76rem;
}

.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));
  position: relative;
  transition: grid-template-columns 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Desktop dock tuck: invent|vision only. Catalog is abspos over the full grid
   so its containing block is the workshop (not a skinny track — that made
   max-width: calc(100% - …) collapse the panel to ~1px). */
.workshop-layout.is-tech-collapsed {
  grid-template-columns: minmax(0, 3fr) minmax(0, 3fr);
  grid-template-areas: "invent vision";
}

/* Clear the collapsed Emerging tech ear so it does not cover pathway text. */
.workshop-layout.is-tech-collapsed > .invent-center {
  padding-left: 1.75rem;
}

.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;
}

.hex-emtech-bar {
  display: none;
}

/* Tech library — desktop pinned: in-flow column */
.tech-library {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: rgba(7, 11, 20, 0.5);
}

.tech-library-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

/* Header pin/collapse chevron (desktop only) */
.tech-rail-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  color: var(--muted, #94a3b8);
}

.tech-rail-pin:hover,
.tech-rail-pin:focus-visible {
  color: var(--accent, #38bdf8);
}

.tech-rail-pin-chevron {
  display: block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg); /* points left = tuck away */
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.workshop-layout.is-tech-collapsed .tech-rail-pin-chevron {
  transform: rotate(-45deg); /* points right when tucked (shown on peek) */
}

/* Dock edge hit-zone + floating handle (tucked only) */
.tech-dock-edge,
.tech-dock-handle {
  display: none;
}

.workshop-layout.is-tech-collapsed > .tech-library {
  position: absolute;
  /* Span the whole workshop grid → containing block is full layout, not a 10px track */
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  top: 0;
  bottom: 0;
  left: 0;
  right: auto;
  width: min(22rem, 30vw);
  max-width: 22rem;
  height: auto;
  z-index: 50;
  border-right: 1px solid var(--border);
  background: rgba(7, 11, 20, 0.97);
  box-shadow: none;
  /* Keep the resting edge inside overflow:hidden ancestors */
  transform: translateX(calc(-100% + 10px));
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease;
  pointer-events: auto;
}

.workshop-layout.is-tech-collapsed.is-tech-peek > .tech-library {
  transform: translateX(0);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
  z-index: 60;
}

.workshop-layout.is-tech-collapsed .tech-library-body {
  opacity: 1;
  pointer-events: auto;
}

.workshop-layout.is-tech-collapsed > .tech-dock-edge {
  display: block;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 14px;
  z-index: 51;
  cursor: pointer;
}

/* Overlay open: edge must not steal clicks from tech cards */
.workshop-layout.is-tech-collapsed.is-tech-peek > .tech-dock-edge {
  pointer-events: none;
}

.workshop-layout.is-tech-collapsed > .tech-dock-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 62;
  transform: translate(0, -50%);
  min-width: 2rem;
  min-height: 2.75rem;
  padding: 0.45rem 0.4rem;
  margin: 0;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 0 999px 999px 0;
  background: rgba(12, 18, 32, 0.92);
  color: var(--accent, #38bdf8);
  box-shadow: 4px 0 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.workshop-layout.is-tech-collapsed > .tech-dock-handle:hover,
.workshop-layout.is-tech-collapsed > .tech-dock-handle:focus-visible {
  background: rgba(18, 28, 48, 0.98);
  border-color: rgba(56, 189, 248, 0.55);
  outline: none;
}

.workshop-layout.is-tech-collapsed.is-tech-peek > .tech-dock-handle {
  transform: translate(0, -50%);
  border-radius: 0 999px 999px 0;
}

/* Ear: “>” = slide in. When overlay open, show pin (click docks) — never “<”. */
.tech-dock-handle-chevron {
  display: block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); /* points right = slide in */
}

.tech-dock-handle-pin {
  display: none;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid currentColor;
  border-radius: 0.15rem 0.15rem 0.35rem 0.35rem;
  position: relative;
  box-sizing: border-box;
}

.tech-dock-handle-pin::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.28rem;
  width: 2px;
  height: 0.28rem;
  background: currentColor;
  transform: translateX(-50%);
}

.workshop-layout.is-tech-collapsed.is-tech-peek .tech-dock-handle-chevron {
  display: none;
}

.workshop-layout.is-tech-collapsed.is-tech-peek .tech-dock-handle-pin {
  display: block;
}

.tech-dock-handle .tech-drawer-count {
  font-size: 0.65rem;
  min-width: 1.1rem;
  height: 1.1rem;
}

.tech-dock-edge[hidden],
.tech-dock-handle[hidden] {
  display: none !important;
}

/* —— Compact workshop: tablet (iPad) + phone ——
   Vision stays on stage; emTech slides in as a drawer/sheet.
   Keep in sync with COMPACT_MQ in js/tech-drawer.js. */
@media (max-width: 1199px), (max-width: 1399px) and (any-pointer: coarse) {
  #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);
  }

  /* Ear is hidden in the compact drawer; don't inset the invent column. */
  .workshop-layout.is-tech-collapsed > .invent-center {
    padding-left: 0;
  }

  .workshop-layout > .vision-panel {
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    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: 0;
    max-height: none;
  }

  /* 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);
    flex-direction: column;
  }

  /* Desktop dock tuck must not affect compact overlay geometry */
  .workshop-layout.is-tech-collapsed {
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 1fr);
    grid-template-areas: "invent vision";
  }

  .workshop-layout.is-tech-collapsed > .tech-library,
  .workshop-layout.is-tech-collapsed.is-tech-peek > .tech-library {
    position: fixed;
    grid-column: auto;
    grid-row: auto;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(22rem, 90vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 120;
    transform: translateX(-105%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
    transition: transform 0.22s ease;
  }

  .workshop-layout.is-tech-open > .tech-library,
  .workshop-layout.is-tech-collapsed.is-tech-open > .tech-library {
    transform: translateX(0);
  }

  .workshop-layout.is-tech-collapsed .tech-library-body {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    opacity: 1;
    overflow: hidden;
    pointer-events: auto;
  }

  .tech-rail-pin,
  .tech-dock-handle,
  .tech-dock-edge {
    display: none !important;
  }

  .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;
  }

  /* Solo invent: keep the selector in reach above the quest brief. */
  .hex-emtech-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 0.45rem 0.85rem;
    background: rgba(7, 11, 20, 0.96);
    border-bottom: 1px solid var(--border);
  }

  /* Toolbar copy stays hidden until the maximized board covers the invent column. */
  .hex-board-toolbar .tech-drawer-open {
    display: none;
  }

  .hex-board-wrap.is-expanded .hex-board-toolbar .tech-drawer-open {
    display: inline-flex;
    flex-shrink: 0;
    margin-right: 0.15rem;
  }

  .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(58vh, 28rem);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.92);
  }

  .workshop-layout > .vision-panel:has(.vision-canvas-wrap.is-briefing) {
    max-height: min(78vh, 36rem);
  }

  .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 {
    display: none;
  }

  .workshop-layout > .vision-panel .vision-canvas-wrap {
    min-height: 0;
    flex: 1 1 auto;
    max-height: none;
  }

  .workshop-layout > .vision-panel .vision-stack-bottom {
    min-height: 11rem;
  }

  .workshop-layout > .vision-panel .co-inventor-root {
    min-height: 0;
    overflow: hidden;
  }

  .workshop-layout > .vision-panel .co-messages {
    min-height: 0;
  }

  /* 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 {
    transition: none;
  }

  .workshop-layout > .tech-library,
  .tech-library-body,
  .tech-rail-pin-chevron,
  .tech-dock-handle,
  .tech-dock-handle-chevron {
    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: 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;
}

/* Problem-first tray: "For this place" shelf + collapsed full catalog */
.tech-group {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tech-group-title {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 700;
}

.tech-group-sub {
  margin: -0.35rem 0 0.1rem;
  font-size: 0.72rem;
  line-height: 1.35;
}

.tech-group-place .tech-group-title {
  color: var(--warn);
}

.tech-group-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  user-select: none;
}

.tech-group-summary::-webkit-details-marker {
  display: none;
}

.tech-group-summary::before {
  content: "▸";
  font-size: 0.8rem;
  transition: transform 0.15s;
}

.tech-group-all[open] > .tech-group-summary::before {
  transform: rotate(90deg);
}

.tech-group-summary:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.tech-group-count {
  font-weight: 500;
  color: var(--text-mute);
  text-transform: none;
  letter-spacing: 0;
}

.tech-group-empty {
  font-size: 0.75rem;
  margin: 0.2rem 0;
}

.tech-can {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text);
  line-height: 1.3;
}

.tech-why {
  margin: 0.22rem 0 0;
  font-size: 0.72rem;
  line-height: 1.32;
  color: var(--warn);
  opacity: 0.92;
}

.achievement-chip {
  cursor: help;
}

.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);
}

.tech-card-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  width: 100%;
  text-align: left;
  background: none;
  padding: 0;
}

.tech-add-btn {
  align-self: start;
  padding: 0;
  background: none;
  line-height: 0;
}

.tech-card.is-focused {
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.tech-card.is-focused.selected {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

/* 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;
  cursor: pointer;
}

.tech-chip.is-focused {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.tech-chip button {
  color: var(--text-mute);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
}

.tech-chip button:hover {
  color: var(--danger);
}

.idea-panel {
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(15, 23, 42, 0.45);
}

.idea-focus {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.idea-focus-id {
  font-size: 0.88rem;
}

.idea-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.idea-focus-instack {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-3);
}

.idea-focus-busy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-mute);
  font-style: italic;
}

.idea-deck {
  margin: 0.55rem 0 0;
  padding: 0;
  border: none;
  background: none;
}

.idea-deck-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.idea-deck-head-text {
  min-width: 0;
}

.idea-deck-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.idea-deck-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
}

.idea-deck-head-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex: 0 0 auto;
}

.idea-deck-kicker {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

.idea-deck-close {
  flex: 0 0 auto;
  font-size: 1.2rem;
  line-height: 1;
}

.idea-deck-empty {
  margin: 0;
  font-size: 0.85rem;
}

.idea-deck-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding-bottom: 0.15rem;
}

.idea-card {
  position: relative;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
  scroll-snap-align: start;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}

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

.idea-card.is-selected {
  border-color: rgba(52, 211, 153, 0.7);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.35), var(--glow);
  transform: none;
}

.idea-card.is-selected:hover {
  border-color: rgba(52, 211, 153, 0.85);
  transform: none;
}

.idea-card-check {
  display: none;
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  width: 1.55rem;
  height: 1.55rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.95);
  color: #06281c;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(6, 40, 28, 0.35);
}

.idea-card.is-selected .idea-card-check {
  display: flex;
}

.idea-card.is-selected .idea-card-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px rgba(52, 211, 153, 0.85);
}

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

.idea-card-visual {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0f172a;
  position: relative;
}

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

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

.idea-card-fallback {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(80% 70% at 30% 20%, rgba(56, 189, 248, 0.28), transparent 60%),
    radial-gradient(70% 80% at 80% 80%, rgba(167, 139, 250, 0.22), transparent 55%),
    #0f172a;
}

.idea-card-skel {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.08) 0%,
    rgba(148, 163, 184, 0.18) 45%,
    rgba(148, 163, 184, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite;
}

.idea-card-skel-line {
  height: 0.7rem;
  border-radius: 6px;
  margin: 0.15rem 0;
}

.idea-card-skel-short {
  width: 62%;
}

.idea-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.7rem 0.75rem;
  flex: 1;
}

.idea-card-body h4 {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: -0.01em;
}

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

.idea-card-cta {
  align-self: flex-start;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}

.idea-card-cta:hover {
  text-decoration: underline;
}

@media (max-width: 719px) {
  .idea-deck-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .idea-card {
    flex: 0 0 78%;
    width: auto;
  }
}

.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;
  overflow: hidden;
  background: var(--bg-0);
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.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;
}

.vision-co-stack {
  --vision-co-pct: 50%;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.vision-co-stack[hidden] {
  display: none !important;
}

.vision-stack-top {
  flex: 1 1 0;
  min-height: 120px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vision-stack-top .vision-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.vision-split-handle {
  flex: 0 0 7px;
  width: 100%;
  padding: 0;
  border: 0;
  cursor: ns-resize;
  touch-action: none;
  background: var(--border);
  position: relative;
}

.vision-split-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.5rem;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.55);
}

.vision-split-handle:hover,
.vision-split-handle:focus-visible,
.vision-co-stack.is-splitting .vision-split-handle {
  background: rgba(167, 139, 250, 0.35);
}

.vision-co-stack.is-splitting {
  user-select: none;
}

.vision-split-handle:focus-visible {
  outline: 2px solid var(--accent-2, #a78bfa);
  outline-offset: -2px;
}

.vision-stack-bottom {
  flex: 0 0 var(--vision-co-pct, 50%);
  min-height: 220px;
  max-height: calc(100% - 127px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header and compose stay put; the transcript scrolls inside the pane. */
.vision-stack-bottom .co-inventor-root {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.vision-stack-bottom .co-messages,
.mp-side-panel .vision-stack-bottom .co-messages {
  flex: 1 1 auto;
  min-height: 0;
}

.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-split-handle,
.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-stack-bottom,
.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-stage-bar,
.vision-panel:has(.vision-canvas-wrap.is-briefing) .side-tabs {
  display: none !important;
}

.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-co-stack,
.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-stack-top,
.vision-panel:has(.vision-canvas-wrap.is-briefing) .vision-canvas-wrap {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
}

/* Quest beat walk is the only thing on screen until Start inventing. */
body.is-quest-briefing .topbar,
body.is-quest-briefing .mp-workshop-bar,
body.is-quest-briefing .tech-library,
body.is-quest-briefing .invent-center,
body.is-quest-briefing .tech-dock-handle,
body.is-quest-briefing .tech-dock-edge,
body.is-quest-briefing .tech-drawer-backdrop,
body.is-quest-briefing #ff-account {
  display: none !important;
}

body.is-quest-briefing .workshop-layout,
body.is-quest-briefing .workshop-layout.is-tech-collapsed,
body.is-quest-briefing #screen-hotseat .workshop-layout,
body.is-quest-briefing #screen-room-play .mp-workshop.workshop-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "vision";
  height: 100dvh;
  width: 100%;
  margin-inline: 0;
}

body.is-quest-briefing .workshop-layout > .vision-panel,
body.is-quest-briefing .workshop-layout > .vision-panel:has(.vision-canvas-wrap.is-briefing) {
  position: relative;
  top: auto;
  z-index: auto;
  max-height: none;
  height: 100%;
  border: none;
  overflow: hidden;
}

.side-tab-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.22);
  color: var(--text);
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.side-tab-badge[hidden] {
  display: none !important;
}

.ai-trace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.6rem 0.7rem 0.8rem;
  gap: 0.5rem;
}

.ai-trace-lead {
  margin: 0;
  flex-shrink: 0;
}

.ai-trace-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex-shrink: 0;
}

.ai-trace-filter {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted, #94a3b8);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.68rem;
  cursor: pointer;
}

.ai-trace-filter:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ai-trace-filter.is-active,
.captain-log-filter.is-active {
  background: rgba(167, 139, 250, 0.18);
  color: var(--text);
  border-color: rgba(167, 139, 250, 0.45);
}

.captain-log {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.6rem 0.7rem 0.8rem;
  gap: 0.5rem;
}

.captain-log-lead {
  margin: 0;
  flex-shrink: 0;
}

.captain-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex-shrink: 0;
}

.captain-log-filter {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted, #94a3b8);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.68rem;
  cursor: pointer;
}

.captain-log-filter:hover {
  background: rgba(255, 255, 255, 0.04);
}

.captain-log-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.captain-log-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.captain-log-latest {
  position: absolute;
  right: 0.7rem;
  bottom: 0.55rem;
  z-index: 1;
  border: 1px solid var(--border);
  background: var(--bg-1, #121826);
  color: var(--text);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.captain-log-latest:hover {
  background: rgba(167, 139, 250, 0.18);
}

.captain-log-latest[hidden] {
  display: none !important;
}

.captain-log-entry {
  display: grid;
  grid-template-columns: 0.55rem 1fr;
  gap: 0.15rem 0.45rem;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.74rem;
}

.captain-log-lamp {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.28rem;
  border-radius: 50%;
  background: var(--muted, #94a3b8);
}

.captain-log-entry.is-green .captain-log-lamp {
  background: #34d399;
}

.captain-log-entry.is-yellow .captain-log-lamp {
  background: #fbbf24;
}

.captain-log-entry.is-red .captain-log-lamp {
  background: #f87171;
}

.captain-log-title {
  min-width: 0;
  font-weight: 650;
  overflow-wrap: break-word;
}

.captain-log-when {
  font-weight: 500;
}

.captain-log-idea {
  grid-column: 2;
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.captain-log-emtech {
  display: block;
  margin-bottom: 0.12rem;
  color: #6ee7b7;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.captain-log-idea-text {
  color: #ddd6fe;
  font-weight: 650;
}

.captain-log-pathway,
.captain-log-partof {
  grid-column: 2;
  margin: 0.3rem 0 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.captain-log-pathway {
  color: #7dd3fc;
  font-weight: 600;
}

.captain-log-partof {
  color: var(--text-mute, #94a3b8);
  font-weight: 500;
}

.captain-log-pathway-text {
  color: #7dd3fc;
  font-weight: 600;
}

.captain-log-concern {
  grid-column: 2;
  margin: 0.35rem 0 0;
  color: #fbbf24;
  white-space: pre-wrap;
  line-height: 1.45;
}

.captain-log-reply {
  grid-column: 2;
  margin: 0.35rem 0 0;
  color: #e7e5e4;
  white-space: pre-wrap;
  line-height: 1.45;
}

.captain-log-detail {
  grid-column: 2;
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
  color: var(--text-mute, #94a3b8);
}

.ai-trace-preview {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ai-trace-split {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.5rem;
}

.ai-trace-list {
  flex: 0 0 auto;
  max-height: 28%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ai-trace-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  font-size: 0.72rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.ai-trace-item:last-child {
  border-bottom: 0;
}

.ai-trace-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ai-trace-item.is-active {
  background: rgba(167, 139, 250, 0.12);
}

.ai-trace-item .muted {
  display: block;
  font-size: 0.65rem;
}

.ai-trace-detail {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ai-trace-block {
  margin: 0;
}

.ai-trace-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.ai-trace-pre {
  margin: 0;
  padding: 0.5rem 0.55rem;
  max-height: 40vh;
  overflow: auto;
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.ai-trace-sec {
  margin: 0;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.ai-trace-sec > summary {
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  list-style: none;
}

.ai-trace-sec > summary::-webkit-details-marker {
  display: none;
}

.ai-trace-sec > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--text-dim);
}

.ai-trace-sec[open] > summary::before {
  content: "▾";
}

.ai-trace-sec-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.4rem;
}

.ai-trace-sec > .ai-trace-pre {
  margin: 0 0.4rem 0.4rem;
  border-left-width: 1px;
}

.ai-trace-sec-role,
.ai-trace-sec-preamble {
  border-left-color: var(--accent);
}

.ai-trace-sec-warn {
  border-left-color: var(--warn);
}

.ai-trace-sec-contract,
.ai-trace-sec-instruction {
  border-left-color: var(--accent-2);
}

.ai-trace-sec-state,
.ai-trace-sec-search {
  border-left-color: var(--accent-3);
}

.ai-trace-sec-response {
  border-left-color: var(--danger);
}

.ai-trace-sec-meta,
.ai-trace-sec-folded {
  border-left-color: var(--text-mute);
}

.ai-trace-sec-director {
  border-left-color: var(--accent-2);
  padding-bottom: 0.35rem;
}

.ai-trace-director {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0 0.45rem 0.35rem;
}

/* 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;
}

/* display:inline-flex beats UA [hidden] — only learning modules show this badge */
.co-tutor-badge[hidden] {
  display: none !important;
}

/* 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 {
  flex-direction: column;
  align-items: flex-start;
}

.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;
}

.co-msg.assistant .read-aloud-bar {
  width: auto;
  align-self: flex-end;
  margin: 0.15rem 0 0.1rem;
}

/* 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%;
  max-height: 16rem;
  width: auto;
  height: auto;
  object-fit: contain;
  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 .co-lesson-figure {
  margin: 0.45rem 0 0.15rem;
}
.co-bubble-md .co-lesson-cap {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--text-mute);
}
.co-bubble-md .co-lesson-links {
  margin: 0.35rem 0 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-how-draft {
  margin: 0.55rem 0 0.15rem;
  padding: 0.45rem 0.65rem;
  border-left: 3px solid rgba(52, 211, 153, 0.55);
  background: rgba(52, 211, 153, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text, #e8eef9);
  white-space: pre-wrap;
}

.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: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  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 {
  flex: 1 1 12rem;
  min-width: min(100%, 12rem);
  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;
}

.co-voice-btn {
  --co-voice-wave: #3b82f6;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  border: none;
  border-radius: 999px;
  background: #0b0f19;
  color: var(--co-voice-wave);
  cursor: pointer;
  flex-shrink: 0;
}

.co-voice-btn:hover:not(:disabled) {
  background: #151b2c;
}

.co-voice-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.co-voice-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.co-voice-bar {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
}

.co-voice-btn.is-connecting {
  opacity: 0.7;
}

.co-voice-dock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  align-self: end;
}

.co-voice-dock [hidden] {
  display: none !important;
}

.co-voice-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.co-voice-icon-btn:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.co-voice-icon-btn.is-muted {
  color: #f87171;
}

.co-voice-glyph {
  width: 18px;
  height: 18px;
  display: block;
}

.co-voice-icon-btn .co-voice-glyph-off {
  display: none;
}

.co-voice-icon-btn.is-muted .co-voice-glyph-on {
  display: none;
}

.co-voice-icon-btn.is-muted .co-voice-glyph-off {
  display: block;
}

.co-voice-mic-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  height: 36px;
  padding: 0 0.1rem 0 0.45rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(11, 15, 25, 0.85);
}

.co-voice-activity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 18px;
  color: #3b82f6;
  flex-shrink: 0;
}

.co-voice-activity .co-voice-icon {
  width: 22px;
  height: 18px;
}

.co-voice-activity.is-live .co-voice-bar {
  animation: co-voice-bar 0.9s ease-in-out infinite;
}

.co-voice-activity.is-live .co-voice-bar:nth-child(1) {
  animation-delay: 0s;
}
.co-voice-activity.is-live .co-voice-bar:nth-child(2) {
  animation-delay: 0.12s;
}
.co-voice-activity.is-live .co-voice-bar:nth-child(3) {
  animation-delay: 0.24s;
}
.co-voice-activity.is-live .co-voice-bar:nth-child(4) {
  animation-delay: 0.08s;
}

.co-voice-activity.is-hearing,
.co-voice-activity.is-speaking {
  color: #93c5fd;
}

.co-voice-activity.is-hearing .co-voice-bar,
.co-voice-activity.is-speaking .co-voice-bar {
  animation-duration: 0.45s;
}

.co-voice-activity.is-connecting {
  opacity: 0.7;
}

.co-voice-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.co-voice-pick select {
  appearance: none;
  background-color: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  height: 36px;
  padding: 0 1.55rem 0 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  color-scheme: dark;
}

/* The native popup inherits the light text color and paints a white sheet. */
.co-voice-pick select option,
.co-voice-pick select optgroup {
  background-color: var(--bg-1);
  color: var(--text);
}

.co-voice-pick select option:checked {
  background-color: #1e3a5f;
  color: var(--text);
}

.co-voice-pick select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.co-voice-pick::after {
  content: "";
  position: absolute;
  right: 0.65rem;
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.co-voice-stop {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.co-voice-stop:hover {
  background: #e2e8f0;
}

.co-voice-stop-mark {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #0b0f19;
}

@keyframes co-voice-bar {
  0%,
  100% {
    transform: scaleY(0.45);
  }
  50% {
    transform: scaleY(1);
  }
}

.co-voice-caption {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.35rem 0.75rem 0.15rem;
  font-size: 0.75rem;
  color: var(--text-mute);
  flex-shrink: 0;
  min-height: 1.4rem;
}

.co-voice-caption[hidden] {
  display: none !important;
}

.co-voice-who {
  font-weight: 700;
  color: #c4b5fd;
  white-space: nowrap;
}

.co-inventor-root.co-voice-live .co-voice-caption:not([hidden]) {
  color: #e2e8f0;
}

@media (max-width: 640px) {
  .co-compose textarea {
    flex-basis: 100%;
  }
}

.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);
}

.vision-canvas-wrap.is-briefing .vision-placeholder,
.vision-canvas-wrap.is-briefing .vision-loading {
  display: none;
}
.vision-canvas-wrap > .quest-briefing-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0;
  padding: 3.2rem 1.2rem 0.85rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(6, 10, 18, 0.35) 18%,
    rgba(6, 10, 18, 0.88) 100%
  );
  pointer-events: none;
  line-height: 1.35;
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-job {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: #ffd28a;
  line-height: 1.3;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-kicker {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7dd3fc;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-nav,
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-arrow,
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-dot,
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-full,
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-invent,
.vision-canvas-wrap > .quest-briefing-overlay .read-aloud-bar,
.vision-canvas-wrap > .quest-briefing-overlay .btn,
.vision-canvas-wrap > .quest-briefing-overlay .btn-read-aloud {
  pointer-events: auto;
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-speak {
  width: 100%;
  max-width: none;
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-body,
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-body p {
  font-size: clamp(1.2rem, 2.2vw, 1.65rem);
  font-weight: 650;
  line-height: 1.35;
  color: #fff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 16px rgba(0, 0, 0, 0.9);
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-body p {
  margin: 0 0 0.4em;
}
.vision-canvas-wrap > .quest-briefing-overlay .quest-briefing-body p:last-child {
  margin-bottom: 0.15rem;
}
.vision-stage-bar .quest-briefing-replay {
  margin-left: auto;
}

/* —— 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-briefing .vision-image.is-briefing-fade {
  opacity: 0.28;
  filter: saturate(0.7) blur(1.5px);
}

.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;
}

/* —— 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;
}

.reveal-hero .invention-name[hidden] {
  display: none;
}

.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;
}

.outcome-log {
  margin: 0 0 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(12, 18, 32, 0.65);
}

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

.outcome-log summary {
  cursor: pointer;
  padding: 0.85rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.outcome-log-lead {
  margin: 0 1.1rem 0.55rem;
}

.outcome-log-list {
  flex: none;
  max-height: 28rem;
  margin: 0 0.75rem 0.85rem;
}

.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;
}

.policy-weather {
  margin: 0.65rem 0 0.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
}
.policy-weather-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.policy-weather-head #btn-lobby {
  font-weight: 600;
}
.policy-weather-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.policy-weather-item {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}
.policy-weather-item.is-suspended {
  opacity: 0.55;
}
.policy-weather-pill {
  appearance: none;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.18rem 0.4rem 0.18rem 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.policy-weather-pill:hover,
.policy-weather-pill:focus-visible {
  color: var(--accent-2);
}
.policy-weather-x {
  appearance: none;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.42rem 0.05rem;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
}
.policy-weather-x:hover,
.policy-weather-x:focus-visible {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}
.policy-weather-kind {
  color: var(--accent-2);
  font-weight: 600;
}
.policy-weather-empty {
  margin: 0;
}
.lobby-sub {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.85rem;
}
.lobby-rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.lobby-rule-row {
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
}
.lobby-rule-row.is-suspended {
  opacity: 0.65;
}
.lobby-rule-open {
  appearance: none;
  display: block;
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.lobby-rule-kicker {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.2rem;
}
.lobby-rule-name {
  display: block;
  font-size: 0.95rem;
}
.lobby-rule-body {
  margin: 0.35rem 0 0;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.45;
}
.lobby-read[hidden],
.lobby-compose[hidden] {
  display: none !important;
}
.lobby-read {
  padding: 0.15rem 0 0.35rem;
}
.lobby-read-meta {
  margin: 0 0 0.45rem;
}
.lobby-read-title {
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  line-height: 1.3;
}
.lobby-read-body {
  margin: 0 0 1rem;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text);
}
.lobby-read-actions {
  align-items: flex-start;
}
.lobby-remove-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}
.lobby-read-cost {
  margin: 0;
  white-space: nowrap;
  text-align: right;
  line-height: 1.3;
}
.lobby-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.3rem 0;
}
.lobby-field input,
.lobby-field select,
.lobby-field textarea {
  width: 100%;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  font: inherit;
}

.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.lobby-modal {
  width: min(840px, 94vw);
  max-height: none;
  overflow: visible;
}

.modal.cloud-profile-modal {
  width: min(38rem, 94vw);
  max-height: 90vh;
  overflow: auto;
}

.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(720px, 100%);
  max-height: 88vh;
}

.modal-backdrop.is-closing,
.modal-backdrop.is-docking-to-learn {
  display: flex;
}

.modal-backdrop.is-docking-to-learn {
  z-index: 130;
  pointer-events: none;
  animation: learn-dock-backdrop 0.45s ease forwards;
}

.modal-backdrop.is-docking-to-learn .modal.modal-learn {
  animation: learn-dock-modal 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: center center;
  will-change: transform, opacity;
}

@keyframes learn-dock-backdrop {
  to {
    opacity: 0;
  }
}

@keyframes learn-dock-modal {
  to {
    transform: translate(var(--learn-dock-dx, 0px), var(--learn-dock-dy, 0px))
      scale(var(--learn-dock-scale, 0.12));
    opacity: 0;
  }
}

#btn-learn-tech.is-learn-hint {
  color: var(--accent, #38bdf8);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.55);
  animation: learn-hint-pulse 0.55s ease 3;
}

@keyframes learn-hint-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop.is-docking-to-learn,
  .modal-backdrop.is-docking-to-learn .modal.modal-learn {
    animation-duration: 0.01ms;
  }
  #btn-learn-tech.is-learn-hint {
    animation: none;
  }
}

/* Quest Developer inspect — beat .modal.modal-learn width/height */
.modal-backdrop.quest-dev-modal-open .modal.modal-learn {
  width: 100%;
  max-width: none;
  height: calc(100vh - 1.5rem);
  max-height: calc(100vh - 1.5rem);
  padding: 1.35rem 1.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-backdrop.quest-dev-modal-open .modal-body.quest-dev-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.modal-lead {
  color: var(--text-mute);
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

.modal.modal-learn .modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(72vh, 40rem);
  overflow-y: auto;
  margin-bottom: 0.85rem;
  padding-right: 0.15rem;
}

.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 {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.75rem 0.85rem;
  align-items: start;
  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-art {
  margin: 0;
  width: 9.5rem;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm, 0.45rem);
  overflow: hidden;
  background: #0b1220;
  border: 1px solid var(--border);
}

.learn-sec-art[hidden] {
  display: none !important;
}

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

.learn-sec-copy {
  min-width: 0;
}

.learn-sec h5 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

@media (max-width: 520px) {
  .learn-sec {
    grid-template-columns: 1fr;
  }

  .learn-sec-art {
    width: 100%;
  }
}

.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;
}

/* Stepped quest briefing — captions overlay Future Vision */
.quest-briefing-job {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: #ffd28a;
  line-height: 1.3;
}
.quest-briefing-kicker {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
}
.quest-briefing-step {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
  flex: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.quest-briefing-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff4e6;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.challenge-banner .quest-briefing-body,
.challenge-banner .quest-briefing-body p,
.quest-briefing-body,
.quest-briefing-body p {
  font-size: clamp(1.28rem, 2.6vw, 1.7rem);
  font-weight: 650;
  line-height: 1.35;
  color: #ffffff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 16px rgba(0, 0, 0, 0.9);
}
.quest-briefing-overlay .quest-briefing-speak {
  max-width: none;
  width: 100%;
}
.quest-briefing-overlay .quest-briefing-body {
  overflow: visible;
  max-height: none;
}
.quest-briefing-overlay .quest-briefing-body p {
  margin: 0 0 0.4em;
}
.quest-briefing-overlay .quest-briefing-body p:last-child {
  margin-bottom: 0.15rem;
}
.quest-briefing-body p:first-child {
  margin-top: 0;
}
.quest-briefing-body ul,
.quest-briefing-body ol {
  margin: 0.2em 0 0.2em 1.1em;
  padding: 0;
}
.quest-briefing-body li {
  margin: 0.1em 0;
}
.quest-briefing-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.quest-briefing-pager {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.quest-briefing-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: center;
}
.quest-briefing-dot {
  width: 0.62rem;
  height: 0.62rem;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: transparent;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}
.quest-briefing-dot.is-active {
  width: 0.82rem;
  height: 0.82rem;
  background: #fff;
  border-color: #fff;
}
.quest-briefing-arrow {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(8, 12, 22, 0.45);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}
.quest-briefing-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}
.quest-briefing-full,
.quest-briefing-invent {
  grid-column: 3;
  justify-self: end;
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
  padding: 0.2rem 0.15rem;
}
.quest-briefing-invent {
  color: #ffd28a;
}
.quest-briefing-invent-spacer {
  grid-column: 3;
}

.quest-job-line {
  margin: 0.35rem 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: #ffe7c2;
}
.quest-job-kicker {
  display: inline-block;
  margin-right: 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
  vertical-align: middle;
}
.quest-job-line[hidden] {
  display: none !important;
}

/* Walk owns the story on the right: hide the instance lede and stakeholder. */
.challenge-banner.is-briefing-walk .mission-summary,
.challenge-banner.is-briefing-walk .stakeholder,
.challenge-banner.is-briefing-recap .mission-summary {
  display: none !important;
}

.quest-brief-recap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.quest-brief-recap-item {
  margin: 0;
}
.quest-brief .quest-brief-recap-title {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
}
.quest-brief-recap-item p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 500;
  color: #e8eef8;
}
.quest-brief-recap:has(.quest-brief-full[open]) .quest-brief-recap-speak,
.quest-brief-recap:has(.quest-brief-full[open]) > .quest-brief-recap-speak + .read-aloud-bar {
  display: none;
}
.quest-brief-full {
  margin: 0.15rem 0 0;
}
.quest-brief-full summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  color: #cbd5e1;
}
.quest-brief-full-body {
  margin-top: 0.45rem;
}

@media (prefers-reduced-motion: reduce) {
  .quest-briefing-body {
    transition: none;
  }
}

/* Plain scene blurb (no markdown brief): still full text, scroll when long */
.ws-mission-scene[hidden],
.mp-mission-scene[hidden] {
  display: none !important;
}

.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;
  }
}

/* —— Hex invent board —— */
:root {
  --hex-bits: #38bdf8;
  --hex-atoms: #f472b6;
  --hex-ryg-red: #ef4444;
  --hex-ryg-yellow: #eab308;
  --hex-ryg-green: #22c55e;
}

.invent-form-hex {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hex-board-wrap {
  position: relative;
  background: #0c1220;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  overflow: hidden;
}

.hex-board-toolbar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.hex-board-status {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.hex-board-status.is-bad {
  color: #fca5a5;
}

.hex-board-expand {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  margin: 0 0.4rem 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.hex-board-expand-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.hex-board-wrap.is-expanded .hex-board-expand-icon-max,
.hex-board-wrap:not(.is-expanded) .hex-board-expand-icon-restore {
  display: none;
}

.hex-board-lift {
  display: none;
}

.hex-board-lift-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}

.hex-board-wrap.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 70;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.hex-board-wrap.is-expanded .hex-board-lift {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 5.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.45);
}

.hex-board-wrap.is-expanded .hex-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.hex-board-wrap.is-expanded .hex-board svg {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}

body.hex-board-expanded {
  overflow: hidden;
}

body.hex-board-expanded.ff-accounts .hex-board-wrap.is-expanded .hex-board-status {
  padding-right: 10rem;
}

.hex-board-pending {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.85);
}

.hex-board-pending[hidden] {
  display: none !important;
}

.hex-challenger-draw {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.hex-board-wrap.is-ai-wait .hex-board-pending {
  display: none !important;
}

.hex-board-wrap.is-ai-wait .hex-challenger-draw:not([hidden]) {
  position: relative;
  z-index: 2;
}

.hex-board-wrap.is-ai-wait .hex-board {
  pointer-events: none;
  opacity: 0.35;
}

.hex-board-wrap.is-ai-wait .hex-board svg {
  cursor: wait;
}

.hex-board-wrap.is-invent-wait .hex-board {
  pointer-events: none;
  opacity: 0.55;
}

.hex-board-wrap.is-invent-wait .hex-board svg {
  cursor: wait;
}

.hex-tile-create.is-summon-wait #hex-idea-cards,
.hex-tile-create.is-summon-wait #hex-idea-tray,
.hex-tile-create.is-summon-wait .hex-tile-create-body {
  pointer-events: none;
  opacity: 0.55;
}

.hex-board {
  width: 100%;
  min-height: 280px;
}

.hex-board svg {
  display: block;
  width: 100%;
  height: min(62vh, 640px);
}

.hex-tile-create {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hex-tile-create-title {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 600;
}

.hex-tile-create-tech {
  color: var(--hex-bits, #38bdf8);
  font-weight: 700;
}

.hex-tile-create-hint {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
}

.hex-tile-create .hex-invent-stack.selected-techs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  min-height: 1.6rem;
}

.hex-tile-create .hex-invent-stack .empty-hint {
  font-size: 0.75rem;
  color: var(--text-mute, #94a3b8);
}

.hex-tile-create .hex-invent-stack .tech-chip {
  font-size: 0.75rem;
  padding: 0.15rem 0.35rem 0.15rem 0.45rem;
}

.hex-tile-create .hex-invent-stack .tech-chip.is-considering {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.06);
}

.tech-chip-status {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-left: 0.15rem;
}

.tech-chip-status.is-instack {
  color: var(--accent-3, #34d399);
}

.tech-chip-status.is-considering {
  color: rgba(56, 189, 248, 0.95);
}

.hex-tile-create-body[hidden] {
  display: none !important;
}

.hex-tile-create-actions {
  margin: 0;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.hex-tile-create-body #field-hex-how {
  margin-top: 0.9rem;
  padding-top: 0.15rem;
}

.hex-create-pending {
  margin: 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.55);
}

.hex-create-pending[hidden] {
  display: none !important;
}

.hex-tile-create.is-busy #selected-techs,
.hex-tile-create.is-busy #hex-idea-cards,
.hex-tile-create.is-busy #hex-idea-tray,
.hex-tile-create.is-busy .hex-tile-create-body {
  pointer-events: none;
  opacity: 0.55;
}

.hex-idea-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 0.65rem;
  margin-top: 0.85rem;
  min-height: 0;
}

.hex-idea-cards:empty {
  display: none;
}

.hex-idea-cards.is-drop-armed {
  border-radius: 10px;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.45);
  pointer-events: auto;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.hex-idea-cards.is-drop-armed:empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.7rem 0.85rem;
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hex-idea-cards.is-drop-armed:empty::before {
  content: "Ideas";
  pointer-events: none;
}

.hex-idea-cards.is-hot {
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.9);
  background: rgba(12, 74, 110, 0.62);
  color: #e0f2fe;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
}

.hex-discard {
  margin-top: 0.85rem;
  min-height: 3.25rem;
  padding: 0.7rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.45);
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: auto;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.hex-discard-icon,
.hex-discard-label {
  pointer-events: none;
}

.hex-discard-icon {
  flex: 0 0 auto;
  display: block;
}

.hex-discard.is-hot {
  border-style: solid;
  border-color: rgba(251, 113, 133, 0.9);
  background: rgba(127, 29, 29, 0.62);
  color: #fecdd3;
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.35);
}

.hex-idea-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
  background: var(--bg-elevated, rgba(15, 23, 42, 0.85));
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color 0.2s, transform 0.2s var(--ease, ease), box-shadow 0.2s;
}

.hex-idea-card.is-instack {
  border-color: rgba(52, 211, 153, 0.35);
}

.hex-idea-card.is-considering {
  border-color: rgba(56, 189, 248, 0.4);
}

.hex-idea-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--glow, 0 0 20px rgba(56, 189, 248, 0.15));
}

.hex-idea-card.is-instack:hover {
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.12);
}

.hex-idea-card.is-dragging {
  opacity: 0;
  pointer-events: none;
  transform: none;
}

.hex-idea-card.is-loading {
  min-height: 12rem;
  cursor: default;
  pointer-events: none;
}

.hex-idea-card-visual {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
  position: relative;
  flex: 0 0 auto;
}

.hex-idea-card-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hex-idea-card-fallback {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(80% 70% at 30% 20%, rgba(56, 189, 248, 0.28), transparent 60%),
    radial-gradient(70% 80% at 80% 80%, rgba(251, 146, 60, 0.2), transparent 55%),
    #0f172a;
}

.hex-idea-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.8rem 0.85rem 0.95rem;
  flex: 1;
  min-height: 0;
}

.hex-idea-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.45rem;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.25;
}

.hex-idea-card-tech {
  color: var(--text, #e8eef9);
  font-weight: 600;
}

.hex-idea-card-meta .tech-chip-status {
  margin-left: 0;
}

.hex-idea-card-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text, #e8eef9);
}

.hex-idea-card-how {
  margin: 0;
  flex: 1;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.45;
}

.hex-idea-card-badge {
  position: absolute;
  left: 0.4rem;
  bottom: 0.4rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.85rem;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.hex-idea-card-badge .hex-tray-tile {
  width: 100% !important;
  height: 100% !important;
  cursor: inherit;
}

.hex-idea-card-discard {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  color: #cbd5e1;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.hex-idea-card-discard:hover,
.hex-idea-card-discard:focus-visible {
  border-color: rgba(251, 113, 133, 0.7);
  background: rgba(127, 29, 29, 0.72);
  color: #fecdd3;
}

.hex-idea-card .idea-card-skel {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.08) 0%,
    rgba(148, 163, 184, 0.18) 45%,
    rgba(148, 163, 184, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite;
}

.hex-idea-card .idea-card-skel-line {
  height: 0.7rem;
  border-radius: 6px;
  margin: 0.15rem 0;
}

.hex-idea-card .idea-card-skel-short {
  width: 62%;
}

@media (max-width: 719px) {
  .hex-idea-cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    gap: 0.55rem;
  }

  .hex-idea-card {
    flex: 0 0 78%;
    width: auto;
    scroll-snap-align: start;
  }
}

/* Floating drag ghost: card ↔ hex morph */
.hex-drag-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  will-change: transform, width, height, opacity;
  overflow: visible;
}

.hex-drag-ghost-layers {
  position: relative;
  width: 100%;
  height: 100%;
}

.hex-drag-ghost-card,
.hex-drag-ghost-hex {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.hex-drag-ghost.is-card .hex-drag-ghost-card {
  opacity: 1;
  transform: scale(1);
}

.hex-drag-ghost.is-card .hex-drag-ghost-hex {
  opacity: 0;
  transform: scale(0.72);
}

.hex-drag-ghost.is-hex .hex-drag-ghost-card {
  opacity: 0;
  transform: scale(1.12);
}

.hex-drag-ghost.is-hex .hex-drag-ghost-hex {
  opacity: 1;
  transform: scale(1);
}

.hex-drag-ghost-card-inner {
  width: min(11rem, 42vw);
  border-radius: var(--radius-sm, 8px);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #0f172a;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.hex-drag-ghost-card-inner .hex-idea-card-visual {
  aspect-ratio: 4 / 3;
}

.hex-drag-ghost-card-inner .hex-idea-card-title {
  padding: 0.45rem 0.55rem 0.55rem;
  font-size: 0.78rem;
  margin: 0;
}

.hex-drag-ghost-hex .hex-tray-tile {
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}

.hex-drag-ghost.is-discard {
  opacity: 0.72;
  filter: saturate(0.55);
}

.hex-drag-ghost.is-ideas {
  filter: drop-shadow(0 0 16px rgba(56, 189, 248, 0.5));
}

.hex-idea-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.45rem;
  min-height: 4.5rem;
  align-items: flex-start;
}

.hex-idea-tray[hidden] {
  display: none !important;
}

.hex-tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fff;
  color: #0f172a;
  border: 1px solid #64748b;
  border-radius: 999px;
  padding: 0.2rem 0.55rem 0.2rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: grab;
}

.hex-tray-chip img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.hex-tray-chip:hover {
  border-color: var(--hex-bits);
}

/* Tray tiles: same SVG paint + display size as board hexes (inline width/height) */
.hex-tray-tile {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: grab;
  flex: 0 0 auto;
  line-height: 0;
}

.hex-tray-tile svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hex-tray-tile:active {
  cursor: grabbing;
}

.hex-tray-tile:hover {
  filter: brightness(1.06);
}

body.tutorial-popup-front #hex-tile-popup {
  z-index: 10255;
}

.hex-tile-popup {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.hex-tile-popup.is-inspect {
  background: transparent;
  pointer-events: none;
}

.hex-tile-popup[hidden] {
  display: none !important;
}

.hex-tile-popup-card {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  max-width: min(22rem, calc(100vw - 1.5rem));
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.25rem);
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 0.85rem 1rem 1rem;
  color: #e8eef9;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  z-index: 1;
  pointer-events: auto;
}

.hex-tile-popup-card.is-concern {
  width: min(44rem, calc(100vw - 1.5rem));
  max-width: min(44rem, calc(100vw - 1.5rem));
}

.hex-board svg.has-pathway-highlight g[data-id].hex-pathway-origin {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.55));
}

.hex-tile-popup-art {
  display: block;
  flex-shrink: 0;
  width: calc(100% + 0.3rem);
  max-height: 12rem;
  margin: 0 -0.15rem 0.65rem;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
}

.hex-tile-popup-art[hidden] {
  display: none !important;
}

.hex-tile-popup-title {
  flex-shrink: 0;
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.hex-tile-popup-meta {
  flex-shrink: 0;
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
}

.hex-tile-popup-body {
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #cbd5e1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-inline: 0.75rem;
}

.hex-tile-popup-body p {
  margin: 0 0 0.45rem;
}

.hex-tile-popup-scene {
  margin: 0.55rem 0 0.75rem;
  padding: 0.35rem 0 0.35rem 0.7rem;
  border-left: 3px solid rgba(251, 191, 36, 0.75);
  color: #f8fafc;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.5;
}

.hex-tile-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hex-tile-popup-card .read-aloud-bar {
  margin: 0.35rem 0 0;
}

.hex-tile-popup-meter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.hex-tile-popup-meter.cool {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.hex-tile-popup-meter.warm {
  color: #fde047;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.hex-tile-popup-meter.hot {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.hex-tile-popup-lamp {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: -1px;
}

.hex-tile-popup-lamp.red { background: var(--hex-ryg-red); }
.hex-tile-popup-lamp.yellow { background: var(--hex-ryg-yellow); }
.hex-tile-popup-lamp.green { background: var(--hex-ryg-green); }

.hex-tile-popup-answer-label {
  display: block;
  margin: 0.55rem 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: #e2e8f0;
}

.hex-tile-popup-answer {
  display: block;
  width: 100%;
  min-height: 5.5rem;
  margin: 0 0 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0b1220;
  color: #e2e8f0;
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}

.hex-tile-popup-answer:disabled {
  opacity: 0.65;
}

.hex-tile-popup-answer-actions {
  margin: 0 0 0.45rem;
}

.hex-idea-card.is-rd {
  border-color: rgba(167, 139, 250, 0.45);
}

.hex-idea-card-visual-rd {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2e1065;
  color: #ddd6fe;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.hex-score-chips {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
}

.hex-score-chips[hidden] {
  display: none !important;
}

.hex-score-chip {
  position: fixed;
  z-index: 5;
  pointer-events: auto;
  display: block;
  max-width: min(18rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.45rem 0.65rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: #0f172a;
  color: #e8eef9;
  text-align: left;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  font: inherit;
}

.hex-score-chip:hover,
.hex-score-chip:focus-visible {
  border-color: rgba(125, 211, 252, 0.85);
  outline: none;
}

.hex-score-chip-kicker {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.hex-score-chip-reason {
  display: block;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #cbd5e1;
}

.hex-score-chip-sub {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
}

.hex-tile-popup-why {
  margin: 0.55rem 0 0.15rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.hex-convergence-dialog {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 20, 0.55);
  pointer-events: auto;
}

.hex-convergence-dialog[hidden] {
  display: none !important;
}

.hex-convergence-card {
  max-width: min(26rem, calc(100% - 1.5rem));
  padding: 1rem 1.1rem 1.1rem;
  border-radius: 12px;
  background: #0f172a;
  border: 1px solid rgba(167, 139, 250, 0.45);
  color: #e8eef9;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.hex-convergence-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.hex-convergence-meta,
.hex-convergence-reason,
.hex-convergence-pct {
  margin: 0 0 0.55rem;
  line-height: 1.4;
}

.hex-bond-pulse {
  animation: hex-bond-pulse 0.9s ease-in-out 2;
}

.hex-tile-pulse {
  animation: hex-tile-pulse 0.9s ease-in-out 2;
}

.hex-tile-evaluating {
  animation: hex-tile-evaluating 1.6s ease-in-out infinite;
}

.hex-bond-evaluating {
  stroke: #22d3ee;
  stroke-dasharray: 8 6;
  animation: hex-bond-evaluating 1.2s linear infinite;
}

@keyframes hex-bond-pulse {
  0%,
  100% {
    stroke-opacity: 0.4;
  }
  50% {
    stroke-opacity: 1;
    filter: drop-shadow(0 0 6px #c4b5fd);
  }
}

@keyframes hex-tile-pulse {
  0%,
  100% {
    filter: none;
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.8));
  }
}

@keyframes hex-tile-evaluating {
  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.9));
  }
}

@keyframes hex-bond-evaluating {
  to {
    stroke-dashoffset: -28;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hex-bond-pulse,
  .hex-tile-pulse {
    animation: none;
  }
  .hex-tile-evaluating {
    animation: none;
    filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.75));
  }
  .hex-bond-evaluating {
    animation: none;
    stroke-dasharray: none;
    stroke: #22d3ee;
    stroke-opacity: 1;
  }
}

/* ---- Problem-first invent: crisis hex → "What could help here?" ---- */
.hex-crisis-help {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
}

.hex-crisis-help-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hex-crisis-help-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  align-items: flex-start;
}

.hex-crisis-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hex-crisis-help-icon {
  font-size: 0.95rem;
}

.hex-crisis-help-why {
  font-size: 0.74rem;
  line-height: 1.35;
}

/* Idea card: which crisis meter this spark aims at */
.hex-idea-card-eases {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--warn);
}

/* ---- Plain-words glossary: tap-to-define ---- */
dfn.term {
  font-style: inherit;
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 0.18em;
  border-radius: 3px;
}

dfn.term:hover,
dfn.term:focus-visible {
  text-decoration-style: solid;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
}

.term-plain {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--text-dim);
}

.tech-library-plain {
  padding: 0 0.75rem 0.35rem;
}

.term-pop {
  position: absolute;
  z-index: 1200;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 0.7rem 2rem 0.7rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.term-pop-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.term-pop-plain {
  margin: 0;
}

.term-pop-analogy {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-style: italic;
}

.term-pop-close {
  position: absolute;
  top: 0.35rem;
  right: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

/* ---- How it works: scarce → abundant scaffold ---- */
.hex-how-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.btn-link {
  border: 0;
  background: transparent;
  color: var(--accent, #7c9cff);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

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

.hex-scaffold {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem 0.65rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.hex-scaffold[hidden] {
  display: none;
}

.hex-scaffold-lead {
  margin: 0;
  font-size: 0.74rem;
}

.hex-scaffold-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hex-scaffold-q {
  font-size: 0.78rem;
  font-weight: 600;
}

.hex-scaffold-field input,
.hex-scaffold-field textarea {
  width: 100%;
  box-sizing: border-box;
}

.hex-scaffold-preview {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  min-height: 1.2em;
}

.hex-scaffold-preview:empty {
  display: none;
}

/* Scaffold questions read as questions, not shouted field labels */
.hex-scaffold .hex-scaffold-field,
.hex-scaffold .hex-scaffold-q {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 0;
}

/* Shelf lines wrap instead of truncating — the reason is the point */
.tech-meta .tech-can,
.tech-meta .tech-why {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: block;
  -webkit-line-clamp: unset;
}

/* ---- Friend's-seven concept cards on the coach-mark card ---- */
.tour-card.is-concept .tour-kicker {
  color: var(--warn);
}

.tour-foot {
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.74rem;
}

.tour-mute {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  cursor: pointer;
}

.tour-mute[hidden] {
  display: none;
}

.tour-mute input {
  margin: 0;
}

.tour-concepts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.tour-concepts-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-right: 0.15rem;
}

.tour-concept-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.tour-concept-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tour-concept-chip.is-active {
  border-color: var(--warn);
  color: var(--warn);
}

.idea-card-eases {
  margin: 0.25rem 0 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--warn);
}

/* Second display — one side pane at a time. Icon stays on the pane title. */
.vision-panel .side-tab-item {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.vision-panel .side-tab-item:has(> .side-tab.active) {
  border-bottom-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.1), transparent);
}

.vision-panel .side-tab-item:has(> .side-tab[hidden]) {
  display: none;
}

.vision-panel .side-tab-item > .side-tab {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  padding-right: 0.1rem;
  border-bottom-color: transparent;
  background: none;
}

.btn-second-screen {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.7rem;
  margin: 0 0.15rem 0 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
}

.btn-second-screen svg {
  width: 15px;
  height: 15px;
  display: block;
}

.btn-second-screen .icon-back {
  display: none;
}

.btn-second-screen[aria-pressed="true"] .icon-send {
  display: none;
}

.btn-second-screen[aria-pressed="true"] .icon-back {
  display: block;
}

body.has-second-screen .btn-second-screen,
body.ff-second-pane .btn-second-screen {
  display: inline-flex;
}

.btn-second-screen:hover,
.btn-second-screen[aria-pressed="true"] {
  color: var(--accent-2);
  background: rgba(167, 139, 250, 0.14);
}

.co-title-line {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-width: 0;
}

.co-title-line .co-title {
  min-width: 0;
}

.co-title-line .btn-second-screen {
  width: 1.45rem;
  height: 1.45rem;
  margin: 0;
}

.vision-panel .side-tab-item.is-pane-away,
.vision-panel.is-single-tab > .side-tabs,
.vision-panel .side-tab-coinventor {
  display: none;
}

.vision-panel.is-vision-away .side-tab-coinventor {
  display: flex;
}

.vision-panel.is-vision-away .vision-split-handle {
  display: none !important;
}

.vision-panel.is-vision-away .vision-stack-bottom {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

.vision-panel.is-vision-away .co-title-line .btn-second-screen {
  display: none !important;
}

.pane-title-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 0.7rem 0.85rem 0.15rem;
  flex-shrink: 0;
}

.pane-title-line[hidden] {
  display: none !important;
}

.pane-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pane-title-line .btn-second-screen {
  margin: 0;
}

#screen-workshop .vision-panel.is-co-away .vision-split-handle {
  display: none !important;
}

#screen-workshop .vision-panel.is-co-away .vision-stack-top {
  flex: 1 1 auto;
  max-height: none;
}

body.ff-second-pane {
  margin: 0;
  height: 100vh;
  background: var(--bg-0, #070b14);
  color: var(--text, #e8eef9);
  display: flex;
  flex-direction: column;
}

body.ff-second-pane > #side-vision,
body.ff-second-pane > #side-log,
body.ff-second-pane > #side-aitrace,
body.ff-second-pane > #side-coinventor {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
}

.hex-tile-create-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.hex-tile-create-head-row .hex-tile-create-title {
  margin: 0;
}

.collector-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 2rem));
  padding: 0;
  border: 1px solid #2a3a58;
  border-radius: 14px;
  background: #0c1220;
  color: #e8eef9;
}

.collector-dialog::backdrop {
  background: rgba(7, 11, 20, 0.72);
}

.collector-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem 0.4rem;
}

.collector-dialog-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.collector-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.2rem 1rem 0.6rem;
}

.collector-filters button {
  font: inherit;
  font-size: 0.75rem;
  border-radius: 999px;
  border: 1px solid #2a3a58;
  background: transparent;
  color: #94a3b8;
  padding: 0.2rem 0.65rem;
  cursor: pointer;
}

.collector-filters button.is-on {
  color: #0c1220;
  background: #a78bfa;
  border-color: #a78bfa;
}

.collector-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0 1rem 1rem;
  overflow: auto;
  max-height: 24rem;
}

.collector-pick {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.65rem;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #121a2b;
  border: 1px solid #2a3a58;
  border-radius: 12px;
  padding: 0.45rem;
  cursor: pointer;
}

.collector-pick img {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 8px;
  background: #070b14;
}

.collector-pick strong {
  display: block;
  font-size: 0.92rem;
}

.collector-pick span {
  display: block;
  color: #a78bfa;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.collector-empty {
  padding: 0 1rem 1rem;
  line-height: 1.45;
}

.hex-idea-card.is-collector-pick {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* Signed-in Forge — collector-card plate language */
.cloud-forge {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  max-width: 52rem;
  margin-inline: auto;
}

.cloud-forge::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -6% -8% auto;
  height: 26rem;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 20%, rgba(228, 197, 106, 0.16), transparent 62%),
    radial-gradient(ellipse at 84% 0%, rgba(167, 139, 250, 0.14), transparent 58%);
}

.cloud-forge > * {
  position: relative;
  z-index: 1;
}

.ff-plate {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(165deg, #191d27 0%, #0c0e14 42%, #08090d 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.14),
    0 0 0 1px rgba(228, 197, 106, 0.5),
    0 24px 60px -28px rgba(0, 0, 0, 0.85);
}

.ff-plate.is-locked {
  background: linear-gradient(165deg, #141820 0%, #0a0c12 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(148, 163, 184, 0.28);
}

.ff-plate.is-empty {
  padding: 1.35rem 1.1rem;
  color: #f6e7b8;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.ff-plate.is-you {
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.22),
    0 0 0 1px rgba(228, 197, 106, 0.85),
    0 24px 60px -28px rgba(228, 197, 106, 0.35);
}

.ff-plate > :not(.ff-tick):not(.ff-sheen) {
  position: relative;
  z-index: 2;
}

.ff-tick {
  position: absolute;
  z-index: 2;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.ff-tick.tl { top: 8px; left: 8px; border-top: 1.5px solid #e4c56a; border-left: 1.5px solid #e4c56a; }
.ff-tick.tr { top: 8px; right: 8px; border-top: 1.5px solid #e4c56a; border-right: 1.5px solid #e4c56a; }
.ff-tick.bl { bottom: 8px; left: 8px; border-bottom: 1.5px solid #e4c56a; border-left: 1.5px solid #e4c56a; }
.ff-tick.br { bottom: 8px; right: 8px; border-bottom: 1.5px solid #e4c56a; border-right: 1.5px solid #e4c56a; }

.ff-plate.is-locked .ff-tick.tl,
.ff-plate.is-locked .ff-tick.tr,
.ff-plate.is-locked .ff-tick.bl,
.ff-plate.is-locked .ff-tick.br {
  border-color: rgba(148, 163, 184, 0.45);
}

.ff-sheen {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    108deg,
    transparent 40%,
    rgba(255, 248, 230, 0.06) 47%,
    rgba(255, 248, 230, 0.22) 50%,
    rgba(255, 248, 230, 0.06) 53%,
    transparent 60%
  );
  transform: translateX(-90%);
  mix-blend-mode: soft-light;
  animation: ff-plate-sheen 16s ease-in-out infinite;
}

@keyframes ff-plate-sheen {
  0%,
  62% { transform: translateX(-90%); }
  100% { transform: translateX(90%); }
}

.ff-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
  color: #f6e7b8;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ff-pip {
  width: 0.62rem;
  height: 0.72rem;
  flex: none;
  background: #e4c56a;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  filter: drop-shadow(0 0 6px rgba(228, 197, 106, 0.9));
}

.ff-pip.is-partial { background: #fbbf24; filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7)); }
.ff-pip.is-dim { background: #64748b; filter: none; }

.ff-edition {
  margin: 0;
  color: #f6e7b8;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
}

.cloud-forge-hero {
  padding: 1.35rem 1.4rem 1.2rem;
}

.cloud-forge-name {
  margin: 0 0 0.35rem;
  color: #fff;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.cloud-forge-best,
.cloud-forge-rank {
  margin: 0.35rem 0 0;
  color: #f4f7fb;
  font-size: 0.92rem;
}

.cloud-forge-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.ff-streak-rail {
  display: flex;
  gap: 0.45rem;
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.ff-streak-rail li {
  width: 0.72rem;
  height: 0.84rem;
  background: rgba(148, 163, 184, 0.28);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.ff-streak-rail li.is-on {
  background: #e4c56a;
  filter: drop-shadow(0 0 6px rgba(228, 197, 106, 0.85));
}

.cloud-forge-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.7rem;
}

.cloud-forge-block-head h2 {
  margin: 0;
  color: #f6e7b8;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ff-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ff-badge {
  min-height: 7.4rem;
  padding: 1.05rem 1rem 0.95rem;
}

.ff-badge h3 {
  margin: 0.35rem 0 0.3rem;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.ff-badge p {
  margin: 0;
  color: #f4f7fb;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ff-badge.is-locked h3,
.ff-badge.is-locked p,
.ff-badge.is-locked .ff-eyebrow {
  color: #94a3b8;
}

.ff-log-row,
.ff-board-row {
  padding: 0.95rem 1rem 0.9rem;
}

.ff-board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 0.8rem;
}

.ff-board-head strong {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
}

.ff-board-score {
  margin-left: auto;
  color: #f6e7b8;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.ff-mat {
  margin-top: 0.75rem;
  border-radius: 3px;
  overflow: hidden;
  background: #0b0d12;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.ff-mat img,
.quest-board-still {
  display: block;
  width: 100%;
  height: auto;
  max-height: 16rem;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

.ff-writeup {
  margin: 0.7rem 0 0;
  color: #f4f7fb;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ff-log-meta {
  margin: 0.25rem 0 0;
  color: #f6e7b8;
  font-size: 0.85rem;
}

#screen-daily-board .section-intro h1,
#screen-quest-log .section-intro h1 {
  color: #fff;
}

#screen-cloud .cloud-portfolio {
  margin: 0;
  border: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(228, 197, 106, 0.1), transparent 55%),
    linear-gradient(165deg, #191d27 0%, #0c0e14 42%, #08090d 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 200, 0.14),
    0 0 0 1px rgba(228, 197, 106, 0.5),
    0 24px 60px -28px rgba(0, 0, 0, 0.85);
}

#screen-cloud .pill.active {
  color: #0c1220;
  border-color: #e4c56a;
  background: #e4c56a;
}

@media (max-width: 640px) {
  .ff-plate { border-radius: 16px; }
  .ff-badge-grid { grid-template-columns: 1fr; }
  .cloud-forge-hero { padding: 1.1rem 1rem 1rem; }
  .ff-board-score { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ff-sheen {
    animation: none;
    transform: none;
    opacity: 0.35;
  }
}
