:root {
  --bg: #f6f6f6;
  --surface: #fff;
  --surface-2: #eee;
  --ink: #161616;
  --muted: #666;
  --line: #ddd;
  --primary: #000091;
  --accent: #e1000f;
  --pink: #a558a0;
  --success: #18753c;
  --danger: #ce0500;
  font-family: Marianne, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

[hidden] { display: none !important; }

html { background: var(--bg); scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); }
#studio-canvas { opacity: .12; mask-image: linear-gradient(to bottom, #000, transparent 72vh); }
:focus-visible { outline: 3px solid #0a76f6 !important; outline-offset: 3px; }

.topbar {
  min-height: 80px;
  padding: .75rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid #ddd;
  background: #fffffff2;
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 8px #0000000c;
}
.brand { color: var(--ink); }
.brand-glyph {
  width: 54px;
  height: 42px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: linear-gradient(90deg, #000091 0 48%, #fff 48% 52%, #e1000f 52%);
  box-shadow: none;
  font-size: .58rem;
  text-shadow: 0 1px 3px #000;
}
.brand strong { color: var(--ink); font-size: 1rem; }
.brand small { color: #666; letter-spacing: .04em; text-transform: none; }
.system-status { color: #666; }
.live-dot { background: #18753c; box-shadow: none; }
.button {
  min-height: 40px;
  padding: .65rem 1rem;
  border: 1px solid #000091;
  border-radius: 0;
  background: transparent;
  color: #000091;
  font-weight: 700;
  transition: background-color .15s, color .15s, transform .15s;
}
.button:hover { transform: translateY(-1px); border-color: #000091; background: #ececfe; }
.button.primary, .button.glow { border: 1px solid #000091; background: #000091; color: #fff; box-shadow: none; }
.button.primary:hover, .button.glow:hover { background: #1212ff; color: #fff; }
.button.subtle { border-color: transparent; box-shadow: inset 0 -2px #000091; }

.welcome-view { width: min(1240px, 100%); padding: clamp(2.5rem, 6vw, 5.5rem) clamp(1rem, 4vw, 3rem) 6rem; }
.hero-copy { max-width: 980px; margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.eyebrow, .micro-label { color: #000091; letter-spacing: .08em; }
.eyebrow span { background: #e1000f; }
.hero-copy h1 {
  max-width: 1020px;
  margin: 1rem 0 1.5rem;
  font-size: clamp(2.6rem, 6.8vw, 6.2rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.hero-copy h1 em { color: #000091; -webkit-text-stroke: 0; }
.lead { max-width: 800px; color: #3a3a3a; font-size: clamp(1rem, 1.5vw, 1.22rem); line-height: 1.65; }
.capability-rail { gap: 0; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }
.capability-rail div { flex: 1 1 190px; min-width: 0; padding: 1rem 1.1rem; border: 0; border-right: 1px solid #ddd; border-radius: 0; background: transparent; backdrop-filter: none; }
.capability-rail div:last-child { border-right: 0; }
.capability-rail strong { color: #000091; }
.capability-rail span { color: #666; }

.composer-shell { display: block; max-width: 980px; margin: auto; }
.composer {
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid #ddd;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 16px 50px #00000012;
  backdrop-filter: none;
}
.composer-head h2, .step-counter strong { color: var(--ink); }
.step-progress { height: 4px; background: #eee; }
.step-progress span { background: #000091; box-shadow: none; }
.step-intro { color: #666; font-size: 1rem; line-height: 1.6; }
.field label, .interaction-picker legend { color: #3a3a3a; font-size: .82rem; }
.field input, .field textarea, .field select,
.section-meta-editor input, .block-editor input, .block-editor textarea, .block-editor select,
.ai-edit-panel textarea, .ai-edit-panel select, .library-controls input {
  border: 0;
  border-bottom: 2px solid #000091;
  border-radius: 0;
  background: #eee;
  color: #161616;
}
.field input:focus, .field textarea:focus, .field select:focus,
.block-editor input:focus, .block-editor textarea:focus { border-color: #000091; box-shadow: none; }
.dropzone { border: 1px dashed #000091 !important; border-radius: 0; background: #f5f5fe; }
.drop-orb { border: 0; border-radius: 0; background: #000091; color: #fff; }
.dropzone small, .file-list li { color: #666; }
.file-list li { border-color: #ddd; background: #eee; }
.interaction-picker span { border-color: #ddd; border-radius: 0; background: #fff; color: #3a3a3a; }
.interaction-picker input:checked + span { border-color: #000091; background: #ececfe; color: #000091; box-shadow: inset 0 -3px #000091; }
.theme-card { border-color: #ddd; border-radius: 0; background: #fff; }
.theme-card:has(input:checked) { border-color: #000091; box-shadow: inset 0 -4px #000091; }
.theme-preview { border-radius: 0; }
.theme-card.editorial .theme-preview { background: linear-gradient(135deg, #f5f5fe 0 55%, #a558a0 55% 72%, #000091 72%); }
.theme-card.rnspf .theme-preview { background: linear-gradient(135deg, #0063cb 0 52%, #fff 52% 58%, #18753c 58%); }
.theme-card strong { color: #161616; }
.theme-card small { color: #666; }
.image-toggle { border-color: #ddd; border-radius: 0; background: #f6f6f6; }
.image-toggle strong { color: #161616; }
.image-toggle small { color: #666; }
.sound-options { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-top: .65rem; }
.wizard-actions { border-color: #ddd; }
.message { color: #666; }

.inline-suggestions {
  margin: 1.5rem 0;
  padding: 1.15rem;
  border-left: 4px solid #000091;
  background: #f5f5fe;
}
.inline-suggestions-head { display: flex; gap: .8rem; align-items: flex-start; }
.inline-suggestions-head > span { color: #000091; font-size: 1.2rem; }
.inline-suggestions-head strong, .inline-suggestions-head small { display: block; }
.inline-suggestions-head small { margin-top: .18rem; color: #666; }
.copilot-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .9rem 0 0; color: #3a3a3a; font-size: .8rem; }
.copilot-content > p:first-child, .copilot-content h3 { grid-column: 1 / -1; }
.copilot-content h3 { margin: .65rem 0 0; color: #161616; }
.suggestion-chip { width: 100%; margin: 0; padding: .7rem; border: 1px solid #cacafb; border-radius: 0; background: #fff; color: #000091; }
.suggestion-chip:hover { border-color: #000091; background: #ececfe; color: #000091; }
.copilot-loading { grid-column: 1 / -1; }
.copilot-loading span { background: linear-gradient(90deg, #eee, #fff, #eee); }

.editor-view { grid-template-columns: 280px minmax(0, 1fr); }
.outline-panel { top: 80px; height: calc(100vh - 80px); border-color: #ddd; background: #fff; backdrop-filter: none; }
.panel-title h2, .duration-card strong { color: #161616; }
.round-button { border-color: #000091; border-radius: 0; background: #fff; color: #000091; }
.section-list button { border-radius: 0; color: #666; }
.section-list button:before { color: #929292; }
.section-list button:hover, .section-list button.active { border-color: #cacafb; background: #ececfe; color: #000091; box-shadow: inset 4px 0 #000091; }
.duration-card { border-color: #ddd; border-radius: 0; background: #f6f6f6; }
.duration-track { background: #ddd; }
.local-status { color: #666; }
.editing-panel { width: min(1120px, 100%); }
.editor-toolbar h1 { color: #161616; font-size: clamp(1.8rem, 4vw, 3rem); }
.ai-edit-panel { border-color: #cacafb; border-radius: 0; background: #f5f5fe; box-shadow: none; }
.ai-edit-spark { border-radius: 0; background: #000091; box-shadow: none; color: #fff; }
.ai-edit-copy strong { color: #161616; }
.ai-edit-copy small { color: #666; }
.section-meta-editor { border-color: #ddd; border-radius: 0; background: #fff; box-shadow: 0 8px 30px #0000000a; }
.icon-danger { border-radius: 0; }
.section-visual-editor { border-radius: 0; border-color: #ddd; }
.block-list { gap: 1rem; }
.block-editor { border-color: #ddd; border-radius: 0; background: #fff; box-shadow: 0 7px 24px #0000000a; }
.block-head { border-color: #ddd; background: #f6f6f6; }
.block-type { color: #000091; }
.block-tools button { color: #666; }
.block-fields label { color: #3a3a3a; }
.repeat-item { border-radius: 0; background: #f6f6f6; }
.mini-button { border-color: #000091; border-radius: 0; background: #fff; color: #000091; }
.json-note { border-color: #ddd; border-radius: 0; color: #666; }
.add-block { border-color: #929292; border-radius: 0; color: #666; background: #fff; }
.add-block button { border-color: #cacafb; border-radius: 0; background: #f5f5fe; color: #000091; }
.add-block button:hover { border-color: #000091; background: #ececfe; color: #000091; }
.preview-canvas { border-color: #ddd; border-radius: 0; background: #fff; }
.preview-hero { background: #000091; color: #fff; }
.preview-block { border-radius: 0 !important; border-color: #ddd !important; background: #fff !important; color: #161616 !important; }

.library-dialog {
  width: min(1180px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 0;
  background: #f6f6f6;
  color: #161616;
  box-shadow: 0 25px 100px #0004;
}
.library-dialog::backdrop { background: #161616b8; }
.library-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 1rem; padding: 1.4rem 1.6rem; border-bottom: 1px solid #ddd; background: #fff; }
.library-head h2 { margin: .3rem 0; font-size: clamp(1.5rem, 3vw, 2.4rem); }
.library-head p { margin: 0; color: #666; }
.library-controls { padding: 1.2rem 1.6rem 0; }
.library-controls label { display: block; margin-bottom: .4rem; font-size: .8rem; font-weight: 700; }
.library-controls input { width: min(480px, 100%); padding: .75rem; }
.library-filters { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; }
.library-filters button { padding: .5rem .7rem; border: 1px solid #cacafb; background: #fff; color: #000091; cursor: pointer; }
.library-filters button.active { border-color: #000091; background: #000091; color: #fff; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 1.2rem 1.6rem 2rem; }
.library-card { display: flex; flex-direction: column; min-height: 260px; padding: 1.1rem; border: 1px solid #ddd; background: #fff; }
.library-family { color: #000091; font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.library-card h3 { margin: .55rem 0 .45rem; font-size: 1.15rem; }
.library-card p { margin: 0; color: #666; line-height: 1.55; }
.library-meta { display: flex; justify-content: space-between; gap: .5rem; margin: auto 0 .9rem; padding-top: 1rem; color: #666; font-size: .7rem; }
.library-card .button { width: 100%; }
.library-empty { grid-column: 1 / -1; }

.player-dialog { border-radius: 0 !important; background: #fff !important; }
.player-head { background: #fff !important; border-color: #ddd !important; color: #161616 !important; }
.player-loading { background: #f6f6f6 !important; color: #161616 !important; }
.loader-orb { border-color: #ddd !important; border-top-color: #000091 !important; }
.toast { border-radius: 0 !important; background: #161616 !important; color: #fff !important; }

@media (max-width: 960px) {
  .system-status { display: none; }
  .editor-view { grid-template-columns: 1fr; }
  .outline-panel { position: static; width: 100%; height: auto; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .top-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .hero-copy h1 { font-size: 2.6rem; }
  .field-grid, .field-grid.three, .sound-options, .copilot-content { grid-template-columns: 1fr; }
  .theme-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-meta-editor { grid-template-columns: 1fr 90px; }
  .section-meta-editor .button, .section-meta-editor .icon-danger { grid-column: auto; }
  .ai-edit-panel { grid-template-columns: 1fr; }
  .ai-edit-actions, .ai-edit-panel .message { grid-column: 1; }
  .library-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #studio-canvas { display: none; }
}
