:root {
  --bg: #080811;
  --surface: #10101c;
  --surface-2: #171726;
  --ink: #f5f5fb;
  --muted: #9a9caf;
  --line: #ffffff16;
  --primary: #7c5cff;
  --accent: #22d3ee;
  --pink: #f472b6;
  --success: #4ade80;
  --danger: #fb7185;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 10% 20%, #6d4cff18, transparent 32%), var(--bg); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: -9999px; top: 1rem; z-index: 200; padding: .7rem 1rem; border-radius: 8px; background: #fff; color: #111; }
.skip-link:focus { left: 1rem; }
#studio-canvas, .page-noise { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#studio-canvas { z-index: -3; opacity: .7; }
.page-noise { z-index: -2; opacity: .07; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.topbar { position: sticky; top: 0; z-index: 60; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem clamp(1rem, 3vw, 2.8rem); border-bottom: 1px solid var(--line); background: #080811cc; backdrop-filter: blur(24px); }
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.brand-glyph { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #ffffff22; border-radius: 13px; background: linear-gradient(145deg, var(--primary), #4d3ac4); box-shadow: 0 0 36px #7c5cff55; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .11em; }
.system-status { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .72rem; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 14px var(--success); }
.top-actions, .editor-tools { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.button { appearance: none; border: 1px solid var(--line); border-radius: 10px; background: #ffffff08; padding: .68rem .9rem; font-size: .78rem; font-weight: 750; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; transition: .22s; }
.button:hover { transform: translateY(-1px); border-color: #ffffff34; background: #ffffff11; }
.button.primary { color: #111; border: 0; background: linear-gradient(100deg, #fff, #d9faff); box-shadow: 0 12px 34px #0005; }
.button.glow { border-color: #8b72ff66; background: linear-gradient(125deg, #7c5cff28, #22d3ee13); box-shadow: inset 0 0 30px #7c5cff0c; }
.button:disabled { opacity: .48; cursor: wait; transform: none; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.welcome-view { width: min(1500px, 100%); min-height: calc(100vh - 72px); margin: auto; padding: clamp(2.5rem, 7vw, 7rem) clamp(1rem, 4vw, 4rem); }
.hero-copy { max-width: 1150px; margin-bottom: clamp(3rem, 7vw, 6rem); }
.eyebrow, .micro-label { color: var(--accent); font-size: .67rem; text-transform: uppercase; letter-spacing: .17em; font-weight: 850; }
.eyebrow { display: flex; align-items: center; gap: .65rem; }
.eyebrow span { width: 28px; height: 1px; background: var(--accent); }
.hero-copy h1 { margin: 1rem 0 1.7rem; font-size: clamp(3.5rem, 8.8vw, 9rem); line-height: .88; letter-spacing: -.07em; max-width: 1350px; }
.hero-copy h1 em { font-style: normal; color: transparent; -webkit-text-stroke: 1px #ffffff65; }
.lead { max-width: 770px; color: #c3c4d1; font-size: clamp(1rem, 1.6vw, 1.25rem); line-height: 1.75; }
.capability-rail { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2.2rem; }
.capability-rail div { min-width: 125px; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 13px; background: #ffffff06; backdrop-filter: blur(14px); }
.capability-rail strong, .capability-rail span { display: block; }
.capability-rail strong { font-size: .82rem; color: #fff; }
.capability-rail span { font-size: .65rem; color: var(--muted); margin-top: .15rem; }
.composer-shell { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1rem; align-items: start; }
.composer, .ai-copilot { border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #151522ec, #0d0d17e8); box-shadow: 0 35px 100px #0007; backdrop-filter: blur(28px); }
.composer { padding: clamp(1.25rem, 3vw, 2.4rem); }
.composer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.composer-head h2 { margin: .35rem 0 0; font-size: clamp(1.55rem, 3vw, 2.3rem); letter-spacing: -.04em; }
.step-counter { display: flex; align-items: baseline; color: var(--muted); }
.step-counter strong { color: #fff; font-size: 2.5rem; line-height: 1; }
.step-progress { height: 2px; margin: 1.5rem 0 2rem; border-radius: 9px; background: #ffffff12; overflow: hidden; }
.step-progress span { display: block; width: 25%; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); box-shadow: 0 0 18px var(--accent); transition: width .4s ease; }
.wizard-step { display: none; min-height: 430px; }
.wizard-step.active { display: block; }
.step-intro { max-width: 680px; color: var(--muted); margin: 0 0 1.8rem; }
.field { margin-bottom: 1.15rem; }
.field label, .interaction-picker legend { display: block; margin: 0 0 .48rem; color: #d9d9e6; font-size: .76rem; font-weight: 750; }
.field input, .field textarea, .field select, .section-meta-editor input, .block-editor input, .block-editor textarea, .block-editor select { width: 100%; border: 1px solid #ffffff1c; border-radius: 11px; background: #05050c99; color: #fff; padding: .8rem .9rem; outline: 0; transition: .2s; }
.field textarea, .block-editor textarea { resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus, .field select:focus, .block-editor input:focus, .block-editor textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #22d3ee13; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dropzone { min-height: 140px; display: grid !important; place-items: center; align-content: center; text-align: center; border: 1px dashed #ffffff32 !important; border-radius: 16px; background: linear-gradient(135deg, #7c5cff0d, #22d3ee08); cursor: pointer; }
.dropzone.dragging { border-color: var(--accent) !important; background: #22d3ee10; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong, .dropzone small { display: block; }
.dropzone small { color: var(--muted); font-size: .68rem; }
.drop-orb { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: .4rem; border: 1px solid #ffffff22; border-radius: 50%; background: #ffffff0b; color: var(--accent); }
.file-list { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; }
.file-list li { padding: .32rem .55rem; border: 1px solid var(--line); border-radius: 99px; background: #ffffff08; color: var(--muted); font-size: .67rem; }
.interaction-picker { border: 0; padding: 0; margin: .5rem 0 1.2rem; display: flex; flex-wrap: wrap; gap: .45rem; }
.interaction-picker legend { width: 100%; }
.interaction-picker label { cursor: pointer; }
.interaction-picker input { position: absolute; opacity: 0; }
.interaction-picker span { display: block; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 99px; background: #ffffff06; color: var(--muted); font-size: .7rem; }
.interaction-picker input:checked + span { border-color: #8b72ff77; color: #fff; background: #7c5cff22; box-shadow: inset 0 0 20px #7c5cff12; }
.theme-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin: 0 0 1.3rem; }
.theme-card { position: relative; display: grid; padding: .65rem; border: 1px solid var(--line); border-radius: 14px; background: #ffffff05; cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; }
.theme-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px #22d3ee12; }
.theme-preview { height: 82px; margin-bottom: .6rem; border-radius: 9px; background: linear-gradient(135deg, #7c5cff, #22d3ee); }
.theme-card.cosmic .theme-preview { background: radial-gradient(circle at 30% 20%, #f472b6, transparent 22%), radial-gradient(circle at 70% 70%, #22d3ee, transparent 22%), #070717; }
.theme-card.republique .theme-preview { background: linear-gradient(120deg, #000091 0 48%, #fff 48% 53%, #e1000f 53%); }
.theme-card.contrast .theme-preview { background: linear-gradient(135deg, #000 50%, #ffe600 50%); }
.theme-card strong, .theme-card small { display: block; }
.theme-card strong { font-size: .73rem; }
.theme-card small { color: var(--muted); font-size: .6rem; }
.image-toggle { display: grid; grid-template-columns: 22px 1fr; gap: .7rem; align-items: start; padding: .8rem; border: 1px solid var(--line); border-radius: 13px; background: #ffffff05; }
.image-toggle input { margin-top: .25rem; accent-color: var(--primary); }
.image-toggle strong, .image-toggle small { display: block; }
.image-toggle strong { font-size: .76rem; }
.image-toggle small { color: var(--muted); font-size: .66rem; margin-top: .2rem; }
.wizard-actions { display: flex; justify-content: flex-end; gap: .6rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.message { min-height: 1.3rem; color: var(--muted); font-size: .72rem; }
.message.error { color: var(--danger); }
.ai-copilot { position: sticky; top: 90px; overflow: hidden; }
.copilot-head { display: flex; align-items: center; gap: .7rem; padding: 1rem; border-bottom: 1px solid var(--line); }
.ai-orb { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(145deg, var(--primary), var(--accent)); box-shadow: 0 0 30px #7c5cff55; }
.copilot-head strong, .copilot-head small { display: block; }
.copilot-head strong { font-size: .76rem; }
.copilot-head small { color: var(--muted); font-size: .62rem; }
.copilot-content { padding: 1rem; color: var(--muted); font-size: .73rem; line-height: 1.6; }
.copilot-content h3 { color: #fff; font-size: .76rem; margin: 1rem 0 .45rem; }
.suggestion-chip { width: 100%; text-align: left; margin: .25rem 0; padding: .6rem; border: 1px solid var(--line); border-radius: 10px; background: #ffffff06; color: #ddd; cursor: pointer; font-size: .68rem; }
.suggestion-chip:hover { border-color: var(--accent); color: #fff; }
.copilot-loading { display: grid; gap: .5rem; }
.copilot-loading span { height: 40px; border-radius: 9px; background: linear-gradient(90deg, #ffffff06, #ffffff12, #ffffff06); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.editor-view { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.outline-panel { position: sticky; top: 72px; height: calc(100vh - 72px); display: flex; flex-direction: column; padding: 1.3rem; border-right: 1px solid var(--line); background: #0a0a14dd; backdrop-filter: blur(24px); }
.panel-title { position: relative; }
.panel-title h2 { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: .4rem 0 1rem; font-size: 1.05rem; }
.round-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: #ffffff08; cursor: pointer; }
.panel-title .round-button { position: absolute; right: 0; top: 0; }
.section-list { display: grid; gap: .3rem; overflow: auto; list-style: none; counter-reset: item; padding: 0; }
.section-list li { counter-increment: item; }
.section-list button { width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: .4rem; padding: .72rem .55rem; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: .72rem; }
.section-list button:before { content: counter(item, decimal-leading-zero); color: #ffffff42; font-size: .62rem; }
.section-list button:hover, .section-list button.active { color: #fff; border-color: var(--line); background: #ffffff08; }
.duration-card { margin-top: auto; padding: .85rem; border: 1px solid var(--line); border-radius: 13px; background: #ffffff06; }
.duration-card>div:first-child { display: flex; justify-content: space-between; align-items: baseline; }
.duration-card span, .duration-card small { color: var(--muted); font-size: .62rem; }
.duration-card strong { font-size: 1.2rem; }
.duration-track { height: 4px; margin: .6rem 0; border-radius: 9px; background: #ffffff13; overflow: hidden; }
.duration-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.local-status { display: flex; align-items: center; gap: .45rem; padding-top: .8rem; color: var(--muted); font-size: .62rem; }
.editing-panel { min-width: 0; width: min(1080px, 100%); margin: auto; padding: clamp(1.2rem, 3vw, 3rem); }
.editor-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 2rem; }
.editor-toolbar h1 { margin: .35rem 0 0; font-size: clamp(1.7rem, 4vw, 3.4rem); letter-spacing: -.05em; line-height: 1; }
.ai-edit-panel { display: grid; grid-template-columns: minmax(220px, .65fr) minmax(280px, 1.35fr); gap: .8rem 1rem; align-items: center; margin: 0 0 1rem; padding: 1rem; border: 1px solid #7357ff55; border-radius: 18px; background: radial-gradient(circle at 0 0, #7357ff20, transparent 42%), #ffffff05; box-shadow: inset 0 1px #ffffff12; }
.ai-edit-copy { display: flex; align-items: center; gap: .7rem; }
.ai-edit-spark { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; background: linear-gradient(145deg, var(--primary), var(--accent)); box-shadow: 0 0 25px #7357ff55; }
.ai-edit-copy strong, .ai-edit-copy small { display: block; }
.ai-edit-copy strong { font-size: .78rem; }
.ai-edit-copy small { margin-top: .15rem; color: var(--muted); font-size: .65rem; line-height: 1.4; }
.ai-edit-panel textarea { min-height: 68px; resize: vertical; }
.ai-edit-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: .5rem; }
.ai-edit-actions select { width: auto; min-width: 150px; }
.ai-edit-panel .message { grid-column: 2; margin: 0; }
.section-meta-editor { display: grid; grid-template-columns: minmax(0, 1fr) 105px auto 40px; gap: .6rem; align-items: end; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #ffffff05; }
.section-meta-editor .field { margin: 0; }
.icon-danger { width: 40px; height: 40px; border: 1px solid #fb718544; border-radius: 10px; background: #fb718510; color: var(--danger); cursor: pointer; }
.section-visual-editor { position: relative; aspect-ratio: 16 / 6; margin: 1rem 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; }
.section-visual-editor img { width: 100%; height: 100%; object-fit: cover; }
.section-visual-editor button { position: absolute; right: .7rem; bottom: .7rem; }
.block-list { display: grid; gap: .8rem; margin: 1rem 0; }
.block-editor { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, #ffffff0b, #ffffff04); }
.block-head { display: flex; justify-content: space-between; align-items: center; padding: .65rem .8rem; border-bottom: 1px solid var(--line); background: #ffffff05; }
.block-type { color: var(--accent); font-size: .63rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 850; }
.block-tools { display: flex; gap: .2rem; }
.block-tools button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.block-fields { display: grid; gap: .7rem; padding: 1rem; }
.block-fields label { font-size: .68rem; color: var(--muted); }
.repeat-heading { display: flex; justify-content: space-between; align-items: center; margin: .3rem 0; font-size: .68rem; }
.repeat-item { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: .5rem; margin: .4rem 0; padding: .6rem; border-radius: 10px; background: #05050c88; }
.repeat-item.option-item { grid-template-columns: 32px 1fr auto; }
.repeat-item input[type="radio"] { width: auto; }
.mini-button { border: 1px solid var(--line); border-radius: 7px; background: #ffffff08; color: var(--muted); cursor: pointer; }
.json-note { padding: .7rem; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: .68rem; }
.add-block { padding: 1rem; border: 1px dashed #ffffff2a; border-radius: 16px; color: var(--muted); text-align: center; }
.add-block>div { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin-top: .65rem; }
.add-block button { padding: .43rem .6rem; border: 1px solid var(--line); border-radius: 99px; background: #ffffff06; color: #ccc; cursor: pointer; font-size: .65rem; }
.add-block button:hover { border-color: var(--accent); color: #fff; }
.preview-canvas { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #0d0d18; }
.preview-hero { padding: 3rem; background: linear-gradient(135deg, var(--primary), #111827); }
.preview-hero h2 { font-size: 2.5rem; margin: .5rem 0; }
.preview-body { max-width: 760px; margin: auto; padding: 2rem; }
.preview-section { margin: 0 0 2.5rem; }
.preview-section h3 { font-size: 1.6rem; }
.preview-block { padding: 1rem; margin: .7rem 0; border: 1px solid var(--line); border-radius: 12px; background: #ffffff07; }
.preview-image { width: 100%; aspect-ratio: 16/7; object-fit: cover; border-radius: 12px; }
.player-dialog { width: min(1500px, 96vw); height: 94vh; max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid #ffffff24; border-radius: 22px; background: #080811; color: #fff; box-shadow: 0 50px 150px #000; }
.player-dialog::backdrop { background: #000c; backdrop-filter: blur(12px); }
.player-head { min-height: 72px; display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; align-items: center; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.player-head h2 { margin: .2rem 0 0; font-size: 1rem; }
.player-telemetry { display: flex; gap: .5rem; }
.player-telemetry span { display: grid; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: .58rem; }
.player-telemetry strong { color: #fff; font-size: .7rem; }
#scorm-player-frame { width: 100%; height: calc(94vh - 72px); border: 0; background: #fff; }
.player-loading { position: absolute; inset: 72px 0 0; z-index: 2; display: grid; place-items: center; align-content: center; gap: .8rem; background: #080811; }
.loader-orb { width: 50px; height: 50px; border: 2px solid #ffffff16; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; max-width: 420px; padding: .8rem 1rem; border: 1px solid #ffffff22; border-radius: 13px; background: #171725ed; box-shadow: 0 20px 70px #0008; transform: translateY(150%); opacity: 0; }
.toast.show { transform: none; opacity: 1; }

@media (max-width: 1100px) {
  .composer-shell { grid-template-columns: 1fr; }
  .ai-copilot { position: static; }
  .editor-view { grid-template-columns: 220px minmax(0, 1fr); }
  .system-status { display: none; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .top-actions { justify-content: flex-end; }
  .top-actions .button { padding: .45rem; font-size: .65rem; }
  .hero-copy h1 { font-size: 3.8rem; }
  .field-grid, .field-grid.three, .theme-picker { grid-template-columns: 1fr 1fr; }
  .editor-view { display: block; }
  .outline-panel { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .section-list { display: flex; }
  .section-list li { min-width: 180px; }
  .duration-card, .local-status { display: none; }
  .section-meta-editor { grid-template-columns: 1fr 90px; }
  .section-meta-editor .button, .section-meta-editor .icon-danger { grid-row: 2; }
  .editor-toolbar { display: block; }
  .editor-tools { margin-top: 1rem; }
  .ai-edit-panel { grid-template-columns: 1fr; }
  .ai-edit-actions, .ai-edit-panel .message { grid-column: 1; }
  .player-telemetry { display: none; }
  .player-head { grid-template-columns: 1fr 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #studio-canvas { display: none; }
}
