:root {
  --void: #07080c;
  --ink: #f2efe6;
  --muted: #9a9488;
  --line: rgba(242, 239, 230, 0.12);
  --signal: var(--sanctum-family-accent, #e8a838);
  --signal-ink: var(--sanctum-family-accent-ink, #1a1206);
  --cool: #7eb8c9;
  --ok: #8fbf9f;
  --err: #d98989;
  --display: "Syne", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--void);
}

.app { min-height: 100vh; }

/* —— Hero / gate (first viewport = one composition) —— */
.gate-hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: end;
  padding: clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 60% at 70% 20%, var(--sanctum-family-accent-glow, rgba(232, 168, 56, 0.22)) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 10% 80%, rgba(126, 184, 201, 0.12) 0%, transparent 50%),
    linear-gradient(165deg, #0c0e14 0%, var(--void) 45%, #0a0c10 100%);
  animation: drift 18s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}
@keyframes drift {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.04) translate(-1%, 1%); }
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 36rem;
  animation: rise 0.9s ease-out both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.brand-mark {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.2rem, 12vw, 6.5rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--ink);
}
.brand-mark.sm {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.hero-line {
  margin: 1.1rem 0 0.55rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  line-height: 1.25;
  max-width: 22ch;
}
.hero-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 34ch;
}
.hero-form {
  display: grid;
  gap: 0.55rem;
  max-width: 22rem;
  animation: rise 1.1s ease-out 0.15s both;
}
.hero-form input {
  width: 100%;
  background: rgba(7, 8, 12, 0.65);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  font: inherit;
  border-radius: 0;
}
.hero-form button {
  appearance: none;
  border: 0;
  background: var(--signal);
  color: var(--signal-ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.hero-form button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.err { color: var(--err); font-size: 0.85rem; margin-top: 0.5rem; }

.gate-hero[hidden],
.shell[hidden],
.session-meta[hidden] {
  display: none !important;
}

/* —— Play shell —— */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(800px 400px at 100% 0%, rgba(232, 165, 75, 0.08), transparent 50%),
    var(--void);
}
.play-mast {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.play-brand { display: flex; align-items: baseline; gap: 0.65rem; }
.play-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.session-meta { font-size: 0.8rem; color: var(--muted); }

.play-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}
.side {
  border-right: 1px solid var(--line);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.side-block h2 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.side-value { margin: 0; font-size: 0.9rem; line-height: 1.35; }
.plain-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.plain-list button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--cool);
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.side-help { margin-top: auto; font-size: 0.72rem; color: var(--muted); line-height: 1.4; }
.side-help code { color: var(--signal); }

.main {
  display: flex;
  flex-direction: column;
  min-height: 55vh;
}
.log {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  font-size: 0.88rem;
  line-height: 1.5;
}
.line { margin: 0 0 0.45rem; white-space: pre-wrap; word-break: break-word; }
.line.sys { color: var(--cool); }
.line.err { color: var(--err); }
.line.ok { color: var(--ok); }
.line.chat .who { color: var(--signal); font-weight: 500; }
.line.meta { color: var(--muted); font-size: 0.78rem; }

.cmd-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0.7rem 0.85rem;
}
.cmd-form .prompt { color: var(--signal); font-weight: 600; }
.cmd-form input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  padding: 0.4rem 0;
  outline: none;
}
.cmd-form button {
  appearance: none;
  border: 0;
  background: var(--signal);
  color: var(--signal-ink);
  font-family: var(--display);
  font-weight: 700;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

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

@media (max-width: 760px) {
  .play-grid { grid-template-columns: 1fr; }
  .side { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .main { order: 1; }
}
