:root {
  color-scheme: light;
  --ink: #25211e;
  --muted: #625a52;
  --line: #ded5c6;
  --paper: #f7f0df;
  --surface: #fffaf0;
  --surface-2: #f1f7f2;
  --charcoal: #342e2a;
  --teal: #247b7b;
  --green: #35605a;
  --gold: #f2b84b;
  --clay: #b45f2a;
  --rose: #c44f6f;
  --blue: #2f80ed;
  --shadow: 0 18px 44px rgba(52, 46, 42, 0.13);
  --focus: rgba(242, 184, 75, 0.62);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(36, 123, 123, 0.12), rgba(242, 184, 75, 0.16) 46%, rgba(196, 79, 111, 0.1)),
    var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark svg {
  width: 38px;
  height: 38px;
}

.mark-column {
  fill: rgba(242, 184, 75, 0.26);
  stroke: var(--charcoal);
  stroke-width: 3;
  stroke-linejoin: round;
}

.mark-spark {
  fill: none;
  stroke: var(--teal);
  stroke-width: 4;
  stroke-linecap: round;
}

.eyebrow {
  display: block;
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-title {
  display: block;
  color: var(--charcoal);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill,
.voice-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.9);
  color: var(--charcoal);
  font-weight: 850;
  white-space: nowrap;
}

.stat-pill span:first-child {
  color: var(--rose);
  font-size: 1.15rem;
}

.ghost-button,
.guide-top-button,
.secondary-button,
.primary-button,
.guide-action,
.guide-role-button,
.move-button,
.tab-button,
.voice-card,
.pick-chip,
.starter-card,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.76);
  color: var(--muted);
  font-weight: 800;
}

.guide-top-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(36, 123, 123, 0.3);
  background: rgba(36, 123, 123, 0.12);
  color: var(--teal);
  font-weight: 900;
}

.guide-top-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 18px;
  align-items: start;
}

.play-stage {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  align-items: start;
}

.scene-panel,
.chat-card,
.codex-panel {
  border: 1px solid rgba(222, 213, 198, 0.98);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: var(--shadow);
}

.scene-panel {
  overflow: hidden;
}

.character-stage {
  position: relative;
  width: 100%;
  height: clamp(420px, 58vh, 620px);
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.9), rgba(255, 250, 240, 0) 34%),
    linear-gradient(145deg, #edf7f4, #f8edcf 52%, #dce6f7);
}

.character-stage canvas,
.agora-scene {
  display: block;
  width: 100%;
  height: 100%;
}

.character-stage canvas {
  position: absolute;
  inset: 0;
}

.stage-fallback {
  position: absolute;
  inset: 0;
}

.character-stage.ready .stage-fallback {
  display: none;
}

.character-stage.kid-episode canvas {
  opacity: 0;
  pointer-events: none;
}

.character-stage.kid-episode .stage-fallback {
  display: block;
}

.model-caption {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.94);
}

.model-caption div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.model-caption strong {
  color: var(--charcoal);
  font-size: 1.2rem;
}

.model-caption p,
.model-caption small {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.model-caption p {
  color: var(--ink);
  font-weight: 800;
}

.model-caption small {
  font-weight: 750;
}

.scene-columns path {
  fill: none;
  stroke: rgba(52, 46, 42, 0.62);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-label text:first-of-type,
#sceneVoice {
  fill: var(--charcoal);
  font-size: 26px;
  font-weight: 900;
}

#sceneEra {
  fill: var(--muted);
  font-size: 15px;
  font-weight: 750;
}

.scene-idea {
  fill: #fffaf0;
  font-size: 20px;
  font-weight: 850;
}

.lantern {
  transform-origin: center;
  animation: rise 420ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-card {
  display: flex;
  min-height: min(680px, calc(100vh - 112px));
  max-height: calc(100vh - 112px);
  flex-direction: column;
  overflow: auto;
  padding: 16px;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.episode-hero {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.episode-title-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.episode-title-row .voice-badge {
  min-height: 36px;
  justify-self: start;
}

.episode-claim {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(47, 128, 237, 0.22);
  border-radius: 8px;
  background: rgba(47, 128, 237, 0.09);
  color: var(--charcoal);
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
  font-weight: 900;
  line-height: 1.3;
}

.episode-path {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.path-step {
  display: grid;
  min-height: 54px;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.path-step b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(52, 46, 42, 0.08);
  color: var(--charcoal);
}

.path-step.current {
  border-color: rgba(47, 128, 237, 0.42);
  background: rgba(47, 128, 237, 0.09);
  color: var(--blue);
}

.path-step.done {
  border-color: rgba(36, 123, 123, 0.34);
  background: rgba(36, 123, 123, 0.12);
  color: var(--teal);
}

.episode-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.episode-meter-card {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.episode-meter-card span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.episode-meter-card strong {
  color: var(--rose);
  font-size: 1.25rem;
  font-weight: 950;
}

.story-card {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  padding: 13px;
  border: 1px solid rgba(180, 95, 42, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(242, 184, 75, 0.16), rgba(241, 247, 242, 0.74)),
    #ffffff;
}

.story-card p {
  margin: 0;
  color: var(--ink);
  font-weight: 820;
  line-height: 1.42;
}

.philosopher-reveal {
  padding-top: 8px;
  border-top: 1px solid rgba(180, 95, 42, 0.22);
}

.voice-lens {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 12px;
}

.agora-promise {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
}

.agora-promise span {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid rgba(36, 123, 123, 0.18);
  border-radius: 8px;
  background: rgba(241, 247, 242, 0.72);
  color: var(--charcoal);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.2;
}

.guide-panel {
  display: grid;
  gap: 6px;
  margin: 0 0 8px;
  padding: 6px;
  border: 1px solid rgba(47, 128, 237, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 128, 237, 0.08), rgba(36, 123, 123, 0.1)),
    rgba(255, 255, 255, 0.74);
}

.guide-actions {
  display: grid;
  gap: 7px;
}

.guide-main-actions {
  grid-template-columns: repeat(3, minmax(64px, 1fr));
}

.guide-move-actions {
  grid-template-columns: repeat(4, minmax(54px, 1fr));
}

.guide-action {
  display: grid;
  min-width: 0;
  min-height: 42px;
  place-items: center;
  gap: 3px;
  padding: 6px 5px;
  border: 1px solid rgba(36, 123, 123, 0.22);
  background: rgba(255, 250, 240, 0.86);
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
}

.guide-action.primary-guide {
  border-color: rgba(47, 128, 237, 0.34);
  background: rgba(47, 128, 237, 0.12);
  color: var(--blue);
}

.guide-action svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guide-action.primary-guide svg {
  fill: currentColor;
  stroke: none;
}

.guide-status {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.25;
}

.badge-shelf {
  display: flex;
  min-height: 34px;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.badge-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.badge-chip {
  display: inline-grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(242, 184, 75, 0.56);
  border-radius: 8px;
  background: rgba(242, 184, 75, 0.2);
}

.badge-chip b {
  color: var(--charcoal);
  font-weight: 950;
}

.badge-chip small {
  color: var(--muted);
  font-weight: 800;
}

.wisdom-guide-panel {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.guide-role-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.guide-role-button {
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.guide-role-button.active {
  border-color: rgba(36, 123, 123, 0.34);
  background: rgba(36, 123, 123, 0.12);
  color: var(--teal);
}

.guide-role-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.guide-role-card h2,
.guide-role-card p {
  margin: 0;
}

.guide-role-card h2 {
  font-size: 1rem;
}

.guide-role-card p {
  color: var(--ink);
  font-weight: 820;
  line-height: 1.38;
}

.guide-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-action-list span {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(52, 46, 42, 0.06);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 850;
}

.guide-role-card small {
  color: var(--muted);
  font-weight: 820;
  line-height: 1.35;
}

.guide-highlight {
  position: relative;
  z-index: 2;
  outline: 4px solid rgba(47, 128, 237, 0.72);
  outline-offset: 4px;
  box-shadow: 0 0 0 10px rgba(47, 128, 237, 0.16);
}

.voice-lens div {
  display: grid;
  min-height: 46px;
  align-content: start;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.voice-lens span {
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.voice-lens strong {
  color: var(--charcoal);
  font-size: clamp(0.78rem, 1.1vw, 0.9rem);
  line-height: 1.18;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--charcoal);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(1.75rem, 3vw, 2.7rem);
  line-height: 1.04;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.25rem;
}

.idea-form {
  display: grid;
  gap: 7px;
  margin: 3px 0 7px;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 82px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.4;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    #ffffff;
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%,
    0 0;
  background-repeat: no-repeat;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  padding-right: 34px;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 72px;
  max-height: min(180px, 19vh);
  flex: 1 1 82px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
    repeating-linear-gradient(0deg, rgba(52, 46, 42, 0.045) 0 1px, transparent 1px 34px);
}

.chat-message {
  width: min(88%, 640px);
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.chat-message.philosopher {
  border-left: 5px solid var(--voice-color, var(--teal));
}

.chat-message.player {
  justify-self: end;
  background: #eef7f5;
  border-color: rgba(36, 123, 123, 0.28);
}

.chat-message.system {
  justify-self: center;
  width: min(96%, 520px);
  background: rgba(242, 184, 75, 0.18);
  border-color: rgba(180, 95, 42, 0.22);
}

.chat-message.guide {
  justify-self: start;
  border-left: 5px solid var(--teal);
  background: rgba(241, 247, 242, 0.92);
}

.message-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.message-meta strong {
  color: var(--charcoal);
}

.message-meta span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.message-lens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
}

.message-lens span {
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(52, 46, 42, 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.message-lens b {
  color: var(--teal);
  font-weight: 950;
}

.chat-message p {
  margin: 0;
  color: var(--ink);
  line-height: 1.48;
  white-space: pre-line;
}

.move-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.move-button {
  display: grid;
  position: relative;
  min-height: 70px;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 54px 10px 10px;
  border: 1px solid rgba(36, 123, 123, 0.22);
  background: rgba(36, 123, 123, 0.1);
  color: var(--teal);
  font-weight: 850;
  text-align: left;
}

.episode-move.done {
  border-color: rgba(242, 184, 75, 0.48);
  background: rgba(242, 184, 75, 0.16);
  color: var(--charcoal);
}

.move-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal);
  font-weight: 950;
}

.move-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.move-copy strong {
  color: var(--charcoal);
  font-size: 1rem;
}

.move-copy small,
.move-status {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 820;
  line-height: 1.25;
}

.move-status {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.advanced-dialogue {
  margin-top: 4px;
}

.advanced-dialogue summary {
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.advanced-dialogue[open] summary {
  margin-bottom: 8px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-button,
.secondary-button {
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  background: var(--charcoal);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(52, 46, 42, 0.18);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--charcoal);
}

.codex-panel {
  min-height: min(680px, calc(100vh - 112px));
  overflow: hidden;
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(241, 247, 242, 0.82);
}

.tab-button {
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.tab-button.active {
  background: #ffffff;
  color: var(--charcoal);
  box-shadow: 0 8px 18px rgba(52, 46, 42, 0.08);
}

.panel-view {
  display: none;
  padding: 16px;
}

.panel-view.active {
  display: block;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--charcoal);
}

.icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-list,
.journal-list,
.starter-grid,
.metric-grid,
.studio-result {
  display: grid;
  gap: 10px;
}

.voice-list {
  max-height: 578px;
  overflow: auto;
  padding-right: 4px;
}

.learning-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.form-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(36, 123, 123, 0.26);
  border-radius: 999px;
  background: rgba(36, 123, 123, 0.1);
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 900;
}

.form-chip small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.form-chip.locked {
  border-color: var(--line);
  background: rgba(52, 46, 42, 0.04);
  color: var(--muted);
}

.voice-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 11px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.voice-card.active {
  border-color: var(--voice-color);
  box-shadow: inset 4px 0 0 var(--voice-color);
}

.voice-sigil {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--voice-color) 18%, white);
  color: var(--voice-color);
  font-weight: 950;
}

.voice-body {
  min-width: 0;
}

.voice-body strong,
.voice-body small {
  display: block;
}

.voice-body strong {
  color: var(--charcoal);
}

.voice-body small {
  margin-top: 2px;
  color: var(--muted);
  font-weight: 750;
}

.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.voice-tags span,
.pick-chip {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
}

.voice-tags span {
  background: rgba(52, 46, 42, 0.06);
  color: var(--muted);
}

.affinity-bar,
.meter {
  display: block;
  height: 6px;
  overflow: hidden;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(52, 46, 42, 0.08);
}

.affinity-bar span,
.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--voice-color, var(--teal));
}

.council-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pick-chip {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
}

.pick-chip.active {
  border-color: rgba(36, 123, 123, 0.32);
  background: rgba(36, 123, 123, 0.12);
  color: var(--teal);
}

.pick-chip[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
}

.starter-grid {
  grid-template-columns: 1fr;
}

.starter-card,
.journal-card,
.metric-card,
.principle-card,
.empty-state,
.studio-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.starter-card {
  padding: 13px;
  color: var(--ink);
  text-align: left;
  line-height: 1.35;
  font-weight: 800;
}

.journal-card,
.metric-card,
.principle-card,
.empty-state,
.studio-card {
  padding: 14px;
}

.journal-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.journal-card strong,
.principle-card strong {
  color: var(--charcoal);
}

.journal-card small {
  color: var(--muted);
  font-weight: 800;
}

.journal-card p,
.principle-card p,
.empty-state {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.studio-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.studio-form .primary-button {
  width: 100%;
}

.privacy-note {
  margin: 0;
  border: 1px solid rgba(196, 79, 111, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.86);
  font-size: 0.84rem;
  line-height: 1.45;
}

.safety-warning {
  margin: 0;
  border: 1px solid rgba(196, 79, 111, 0.36);
  border-radius: 8px;
  padding: 10px 12px;
  color: #8a314b;
  background: rgba(255, 241, 244, 0.9);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.45;
}

.studio-result {
  margin-bottom: 10px;
}

.studio-card {
  display: grid;
  gap: 8px;
}

.studio-card.primary {
  border-color: rgba(47, 128, 237, 0.22);
  background: rgba(241, 247, 242, 0.82);
}

.studio-card.love-note {
  border-color: rgba(196, 79, 111, 0.22);
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(241, 247, 242, 0.92));
}

.studio-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.studio-card strong {
  color: var(--charcoal);
  line-height: 1.25;
}

.studio-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.studio-meter {
  display: grid;
  gap: 6px;
}

.studio-meter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.studio-meter-top span {
  color: var(--rose);
  font-size: 1.7rem;
  font-weight: 950;
  line-height: 1;
}

.studio-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-chip {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(52, 46, 42, 0.06);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.studio-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 12px;
}

.metric-card span {
  display: block;
  color: var(--rose);
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 850;
}

.meter span {
  background: var(--teal);
}

.ghost-button:hover,
.guide-top-button:hover,
.secondary-button:hover,
.primary-button:hover,
.guide-action:hover,
.guide-role-button:hover,
.move-button:hover,
.tab-button:hover,
.voice-card:hover,
.pick-chip:hover,
.starter-card:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.ghost-button:focus-visible,
.guide-top-button:focus-visible,
.secondary-button:focus-visible,
.primary-button:focus-visible,
.guide-action:focus-visible,
.guide-role-button:focus-visible,
.move-button:focus-visible,
.tab-button:focus-visible,
.voice-card:focus-visible,
.pick-chip:focus-visible,
.starter-card:focus-visible,
.icon-button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1220px) {
  .game-grid,
  .play-stage {
    grid-template-columns: 1fr;
  }

  .chat-card,
  .codex-panel {
    min-height: auto;
    max-height: none;
  }

  .character-stage {
    height: clamp(360px, 54vh, 540px);
    min-height: 360px;
  }

  .voice-list {
    max-height: 420px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .top-actions,
  .episode-title-row,
  .chat-head,
  .model-caption div {
    align-items: stretch;
    flex-direction: column;
  }

  .stat-pill,
  .ghost-button,
  .guide-top-button,
  .voice-badge,
  .primary-button,
  .secondary-button {
    justify-content: center;
    width: 100%;
  }

  .brand-title {
    font-size: 1.22rem;
  }

  .input-row,
  .chat-form,
  .move-bar,
  .episode-meters,
  .guide-actions,
  .guide-role-tabs,
  .panel-tabs,
  .agora-promise,
  .voice-lens,
  .metric-grid,
  .studio-actions {
    grid-template-columns: 1fr;
  }

  .episode-path {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .move-button {
    grid-template-columns: auto 1fr;
  }

  .move-status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .voice-lens div {
    min-height: auto;
  }

  .chat-message {
    width: 100%;
  }

  .voice-card {
    grid-template-columns: 40px 1fr;
  }

  .voice-sigil {
    width: 40px;
    height: 40px;
  }

  .character-stage {
    height: 330px;
    min-height: 330px;
  }
}
