:root {
  color-scheme: dark;
  --bg: #130d1d;
  --panel: rgba(35, 24, 49, 0.78);
  --panel-strong: rgba(50, 34, 68, 0.92);
  --line: rgba(234, 219, 255, 0.15);
  --text: #f7efff;
  --muted: #c9b7dd;
  --soft: #f0d7ff;
  --accent: #d9a8ff;
  --accent2: #ffc7e8;
  --good: #c5ffd8;
  --danger: #ffb7c8;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
  --radius: 24px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(217,168,255,.22), transparent 34rem),
    radial-gradient(circle at 85% 18%, rgba(255,199,232,.14), transparent 30rem),
    linear-gradient(135deg, #100a18, #1c1228 52%, #120a1e);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.gb-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 22px 0 32px; }
.gb-hero { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 16px; }
.gb-back { display: inline-flex; align-items: center; gap: 6px; color: var(--soft); text-decoration: none; margin-bottom: 14px; }
.gb-back:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(217,168,255,.58); outline-offset: 3px; }
.gb-kicker { margin: 0 0 7px; color: var(--accent2); letter-spacing: .08em; text-transform: uppercase; font-size: .76rem; font-weight: 800; }
h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 4.4rem); line-height: .92; letter-spacing: -.05em; }
.gb-lede { color: var(--muted); font-size: 1.04rem; max-width: 62ch; line-height: 1.58; }
.gb-orb { width: 84px; height: 84px; border-radius: 32px; display: grid; place-items: center; font-size: 2.25rem; background: linear-gradient(145deg, rgba(217,168,255,.24), rgba(255,199,232,.12)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.gb-status, .gb-card { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.gb-status { border-radius: 18px; padding: 12px 14px; margin-bottom: 16px; }
.gb-status-row { display:flex; justify-content:space-between; gap:12px; color: var(--muted); font-weight: 700; font-size: .92rem; }
.gb-progress { height: 8px; background: rgba(255,255,255,.08); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.gb-progress span { display:block; height:100%; width: 20%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: inherit; transition: width .25s ease; }
.gb-layout { display:grid; grid-template-columns: minmax(0, .9fr) minmax(360px, .7fr); gap: 16px; align-items:start; }
.gb-card { border-radius: var(--radius); padding: 18px; }
.gb-step { display:none; min-height: 480px; }
.gb-step.is-active { display:block; animation: gbFade .16s ease-out; }
@keyframes gbFade { from { opacity:.65; transform: translateY(4px);} to { opacity:1; transform:none;} }
h2 { margin: 0 0 8px; letter-spacing: -.025em; }
.gb-help { margin: 0 0 16px; color: var(--muted); line-height: 1.55; }
.gb-pill-grid, .gb-check-grid { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
.gb-pill, .gb-choice, .gb-tool {
  border: 1px solid var(--line); background: rgba(255,255,255,.055); color: var(--text); border-radius: 18px; padding: 12px; text-align:left; min-height: 58px;
}
.gb-pill strong, .gb-choice strong { display:block; margin-bottom: 3px; }
.gb-pill span, .gb-choice span, .gb-tool span { color: var(--muted); font-size:.86rem; line-height:1.35; }
.gb-pill[aria-pressed="true"], .gb-choice[aria-pressed="true"], .gb-tool input:checked + span { border-color: rgba(217,168,255,.62); background: rgba(217,168,255,.15); }
.gb-tool { display:flex; gap: 10px; align-items:flex-start; }
.gb-tool input { margin-top: 2px; accent-color: #d9a8ff; }
.gb-tool span { color: var(--text); font-size: .96rem; }
.gb-choice-stack { display:grid; gap: 10px; margin: 12px 0 16px; }
.gb-field { display:grid; gap: 8px; margin-top: 12px; }
.gb-field span { color: var(--soft); font-weight: 800; font-size:.9rem; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 12px 13px; color: var(--text); background: rgba(0,0,0,.18);
}
textarea { resize: vertical; }
.gb-nav { display:flex; gap: 10px; justify-content:space-between; margin-top: 18px; }
.gb-button, .gb-primary {
  border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; color: var(--text); background: rgba(255,255,255,.07); font-weight: 800;
}
.gb-primary { border-color: rgba(217,168,255,.36); background: linear-gradient(135deg, rgba(217,168,255,.34), rgba(255,199,232,.22)); }
.gb-wide { width: 100%; justify-content:center; border-radius: 18px; margin-top: 14px; }
.gb-small { padding: 8px 12px; font-size: .88rem; }
.gb-preview { position: sticky; top: 14px; }
.gb-preview-head { display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
.gb-output { border: 1px solid var(--line); border-radius: 20px; background: rgba(0,0,0,.16); padding: 14px; max-height: 62vh; overflow:auto; line-height: 1.58; }
.gb-empty { color: var(--muted); }
.gb-output h3 { margin: 16px 0 6px; color: var(--soft); }
.gb-output h3:first-child { margin-top: 0; }
.gb-output ul, .gb-output ol { padding-left: 1.35rem; }
.gb-output li { margin: 4px 0; }
.gb-actions { display:flex; gap: 10px; flex-wrap:wrap; margin-top: 14px; }
.gb-actions button { flex: 1 1 auto; }
.gb-save-note { color: var(--muted); font-size: .9rem; line-height:1.45; }
.gb-summary { border: 1px solid var(--line); border-radius: 18px; padding: 12px; background: rgba(255,255,255,.055); color: var(--muted); line-height:1.6; }
.gb-summary b { color: var(--text); }
.gb-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: rgba(30,20,43,.96); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; box-shadow: var(--shadow); transition: .22s ease; max-width: min(520px, calc(100vw - 28px)); text-align:center; }
.gb-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 860px) {
  .gb-shell { width: min(100% - 18px, 620px); padding-top: 12px; }
  .gb-hero { align-items:flex-start; }
  .gb-orb { display:none; }
  .gb-layout { grid-template-columns: 1fr; }
  .gb-preview { position: static; }
  .gb-step { min-height: auto; }
  .gb-pill-grid, .gb-check-grid { grid-template-columns: 1fr; }
  .gb-output { max-height: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }


/* v56 quiet readability */
body { font-size: 16px; line-height: 1.6; }
.gb-shell { width: min(980px, calc(100% - 28px)); }
.gb-hero { align-items: flex-start; margin-bottom: 12px; }
.gb-kicker, .gb-orb { display: none; }
h1 { font-size: clamp(2rem, 6vw, 3.6rem); line-height: 1; }
.gb-lede { max-width: 32ch; font-size: 1.05rem; line-height: 1.45; }
.gb-status { padding: 10px 12px; }
.gb-layout { grid-template-columns: minmax(0, 1fr); }
.gb-preview { position: static; }
.gb-card { padding: clamp(15px, 2.3vw, 22px); }
.gb-step { min-height: 340px; }
.gb-help { margin-bottom: 12px; }
.gb-pill-grid, .gb-check-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gb-choice-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); display: grid; }
.gb-pill, .gb-choice, .gb-tool { min-height: 56px; padding: 12px; border-radius: 18px; }
.gb-pill span, .gb-choice span { display: none; }
.gb-pill strong, .gb-choice strong { margin: 0; font-size: 1rem; }
.gb-tool span { font-size: .98rem; }
.gb-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.gb-summary span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: rgba(255,255,255,.06); }
.gb-output { line-height: 1.6; }
.gb-output h3 { margin-top: 14px; }
.gb-output details { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-top: 10px; background: rgba(255,255,255,.045); }
.gb-output summary { cursor: pointer; font-weight: 850; color: var(--soft); }
.gb-save-note { font-size: .9rem; }
@media (max-width: 820px) {
  .gb-pill-grid, .gb-check-grid, .gb-choice-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .gb-shell { width: min(100% - 20px, 980px); padding-top: 16px; }
  .gb-pill-grid, .gb-check-grid, .gb-choice-stack { grid-template-columns: 1fr 1fr; }
  .gb-card { border-radius: 20px; }
}


/* v57 cohesive shape cleanup: match the main Grimoire button/card language. */
:root {
  --gb-radius-sm: 12px;
  --gb-radius: 16px;
  --gb-radius-lg: 22px;
}
.gb-status,
.gb-card,
.gb-orb {
  border-radius: var(--gb-radius-lg) !important;
}
.gb-pill,
.gb-choice,
.gb-tool,
.gb-button,
.gb-primary,
input,
textarea,
select,
.gb-toast {
  border-radius: var(--gb-radius) !important;
}
.gb-button,
.gb-primary,
.gb-pill,
.gb-choice {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.gb-pill,
.gb-choice,
.gb-tool {
  text-align: left;
  justify-content: flex-start;
}
.gb-layout {
  gap: 14px;
}
.gb-pill-grid,
.gb-check-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.gb-step {
  min-height: auto;
}
.gb-preview {
  top: 14px;
}
@media (max-width: 860px) {
  .gb-layout { grid-template-columns: 1fr; }
  .gb-preview { position: static; }
}


/* v58 usability: calm proportions + one shared shape language */
:root {
  --gb-control: 46px;
  --gb-radius: 16px;
  --gb-radius-lg: 22px;
}
.gb-shell { width: min(940px, calc(100% - 28px)); }
.gb-hero { margin-bottom: 10px; }
.gb-lede { display: none; }
.gb-status, .gb-card { border-radius: var(--gb-radius-lg) !important; }
.gb-button, .gb-primary, .gb-pill, .gb-choice, .gb-tool, input, textarea, select {
  border-radius: var(--gb-radius) !important;
}
.gb-button, .gb-primary, .gb-pill, .gb-choice {
  min-height: var(--gb-control);
}
.gb-layout { grid-template-columns: 1fr; }
.gb-preview { position: static; }
.gb-step { min-height: auto; }
.gb-pill-grid, .gb-check-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.gb-choice-stack { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.gb-pill span, .gb-choice span { display: none; }
.gb-output details { border-radius: var(--gb-radius) !important; }


/* v59: match main app shape language. */
:root {
  --builder-radius: 18px;
  --builder-radius-lg: 24px;
}
button, .btn, input, select, textarea, .choice, .card, .panel, .step-card {
  border-radius: var(--builder-radius) !important;
}
.hero, .builder-shell, .result-card {
  border-radius: var(--builder-radius-lg) !important;
}
button, .btn {
  min-height: 46px;
  font-weight: 750;
}

/* v60 cohesive flow polish: match the main app's calmer shape language. */
:root {
  --radius: 24px;
}
.gb-shell {
  width: min(980px, calc(100% - 28px));
}
.gb-hero {
  max-width: 760px;
  margin-inline: auto;
}
.gb-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  margin-inline: auto;
}
.gb-card,
.gb-status,
.gb-pill,
.gb-choice,
.gb-tool,
.gb-output,
.gb-mini-card,
.gb-bottom-bar {
  border-radius: 24px;
}
.gb-pill,
.gb-choice,
.gb-tool,
.gb-actions button,
.gb-bottom-bar button,
.gb-output-actions button,
.gb-back {
  min-height: 46px;
}
.gb-pill-grid,
.gb-check-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 560px) {
  .gb-pill-grid,
  .gb-check-grid {
    grid-template-columns: 1fr;
  }
}
