:root {
  color-scheme: dark;
  --bg: #0b0d0c;
  --panel: #111412;
  --panel-2: #171a18;
  --line: #2a2f2b;
  --line-soft: #202421;
  --text: #f2f4ef;
  --muted: #8e968f;
  --accent: #c8ff3d;
  --accent-dark: #161d08;
  --danger: #ff755d;
  --radius: 6px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 16%, rgba(200, 255, 61, .045), transparent 32rem),
    var(--bg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

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

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .018;
  z-index: 99;
  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)' opacity='.5'/%3E%3C/svg%3E");
}

.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 12, .88);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .06em;
}

.brand > span:last-child span { color: var(--accent); }
.brand-mark { display: flex; align-items: flex-end; gap: 2px; height: 19px; }
.brand-mark i { display: block; width: 4px; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 13px; }

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.meta-divider { width: 1px; height: 13px; background: var(--line); margin: 0 6px; }

.icon-button, .nav-button {
  border: 1px solid var(--line);
  background: var(--panel);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button { width: 34px; height: 34px; border-radius: var(--radius); }
.icon-button:hover, .nav-button:hover { border-color: #4c554d; background: var(--panel-2); }
.icon-button svg, .nav-button svg, .text-button svg, .primary-button svg, .check-badge svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(350px, 440px) minmax(410px, 1fr) minmax(310px, 370px);
}

.panel { background: rgba(17, 20, 18, .72); padding: 28px; }
.editor-panel { border-right: 1px solid var(--line); }
.export-panel { border-left: 1px solid var(--line); }

.panel-heading, .stage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font: 700 9px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .16em;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2 { margin-bottom: 0; font-size: 20px; line-height: 1.15; letter-spacing: -.025em; }
h3 { font-size: 13px; }
.save-state { color: var(--muted); font: 10px/1.2 var(--font-mono); white-space: nowrap; padding-top: 18px; }
.save-state.saving { color: var(--accent); }

.field-label, legend {
  color: #bbc1bb;
  font: 700 10px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.input-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d100e;
  margin: 8px 0 20px;
  transition: border-color .15s, box-shadow .15s;
}

.input-shell:focus-within, .textarea-shell:focus-within { border-color: #697369; box-shadow: 0 0 0 3px rgba(200, 255, 61, .06); }
.input-shell input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 12px 13px; color: var(--text); background: transparent; font-weight: 650; }
.title-shell span { margin-right: 12px; color: #6f776f; font: 9px var(--font-mono); }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.editor-actions { display: flex; gap: 12px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 10px; cursor: pointer; }
.text-button:hover { color: var(--text); }
.text-button svg { width: 13px; }

.textarea-shell { position: relative; height: 300px; border: 1px solid var(--line); border-radius: var(--radius); background: #0d100e; overflow: hidden; }
.textarea-shell textarea { width: 100%; height: 100%; resize: none; border: 0; outline: 0; padding: 14px; color: #dde2dc; background: transparent; font: 12px/1.62 var(--font-mono); caret-color: var(--accent); }
.drop-overlay { position: absolute; inset: 8px; display: none; place-items: center; border: 1px dashed var(--accent); background: rgba(12, 16, 10, .94); color: var(--accent); font: 700 11px var(--font-mono); pointer-events: none; }
.textarea-shell.dragging .drop-overlay { display: grid; }

.syntax-hint { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 9px 0 23px; color: #747c75; font: 9px/1.5 var(--font-mono); }
.syntax-hint b { color: var(--accent); font-weight: 600; }

.settings-grid { display: grid; grid-template-columns: 1fr .72fr; gap: 16px; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
legend { margin-bottom: 8px; }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: #0d100e; }
.segmented button { flex: 1; min-width: 0; padding: 8px 5px; border: 0; border-radius: 3px; color: #798079; background: transparent; font-size: 9px; cursor: pointer; }
.segmented button:hover { color: #bbc2bb; }
.segmented button.active { color: #0b0d0c; background: var(--accent); font-weight: 750; }

.palette-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.palette-row p { margin: 4px 0 0; color: #6f776f; font-size: 10px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 25px; height: 25px; border: 6px solid #111412; outline: 1px solid #333933; border-radius: 50%; background: var(--swatch); cursor: pointer; }
.swatch.light { box-shadow: inset 0 0 0 1px #aaa; }
.swatch.active { outline: 2px solid var(--swatch); outline-offset: 2px; }

.preview-stage {
  min-width: 0;
  padding: 28px 30px;
  display: flex;
  flex-direction: column;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 24px 24px;
}

.page-count { padding: 6px 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; background: var(--panel); font: 9px var(--font-mono); text-transform: uppercase; }
.device-wrap { flex: 1; min-height: 390px; display: grid; place-items: center; perspective: 900px; }
.device { width: min(100%, 540px); aspect-ratio: 1.74; position: relative; padding: 11% 9% 9%; border: 1px solid #343833; border-radius: 15% / 26%; background: linear-gradient(145deg, #282b27 0%, #111310 48%, #090a09 100%); box-shadow: 0 32px 70px rgba(0,0,0,.52), inset 0 1px 1px rgba(255,255,255,.12), inset 0 -2px 4px #000; transform: rotateX(2deg); }
.device::before { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(255,255,255,.045); border-radius: inherit; pointer-events: none; }
.device-top { position: absolute; top: 8%; left: 11%; right: 11%; display: flex; justify-content: space-between; align-items: center; color: #555b54; font: 800 11px var(--font-sans); }
.device-top i { width: 8px; height: 8px; border-radius: 50%; background: #0a0b0a; box-shadow: inset 0 0 3px #000; }
.device-screen { width: 100%; aspect-ratio: 240 / 135; position: relative; overflow: hidden; border: 3px solid #050605; border-radius: 2px; background: #000; box-shadow: 0 0 0 1px #363a35, inset 0 0 12px #000; }
.device-screen canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.screen-glare { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(118deg, rgba(255,255,255,.04), transparent 30%, transparent 72%, rgba(255,255,255,.02)); }
.device-bottom { position: absolute; left: 11%; right: 11%; bottom: 6%; display: flex; align-items: center; gap: 9px; color: #404640; font: 700 7px var(--font-mono); letter-spacing: .13em; }
.device-bottom i { margin-left: auto; width: 18px; height: 5px; border-radius: 4px; background: #070807; box-shadow: inset 0 0 2px #000; }
.device-bottom i + i { margin-left: 0; width: 5px; border-radius: 50%; }

.page-navigation { width: min(100%, 540px); margin: 4px auto 22px; display: flex; align-items: center; gap: 10px; }
.nav-button { width: 30px; height: 30px; border-radius: var(--radius); }
.nav-button:disabled { opacity: .3; cursor: default; }
.page-navigation > span { margin-left: auto; color: var(--muted); font: 9px var(--font-mono); }
.page-dots { display: flex; gap: 5px; max-width: 190px; overflow: hidden; }
.page-dots button { width: 18px; height: 4px; padding: 0; border: 0; border-radius: 3px; background: #363c37; cursor: pointer; }
.page-dots button.active { background: var(--accent); }

.preview-facts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: rgba(13, 16, 14, .85); }
.preview-facts div { padding: 12px 14px; border-right: 1px solid var(--line); }
.preview-facts div:last-child { border: 0; }
.preview-facts span { display: block; margin-bottom: 4px; color: #6d756e; font: 8px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.preview-facts strong { font-size: 10px; font-weight: 650; }

.compact-heading { margin-bottom: 21px; }
.compatibility-card { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid #35431e; border-radius: var(--radius); background: linear-gradient(90deg, rgba(200,255,61,.08), rgba(200,255,61,.025)); }
.check-badge { width: 28px; height: 28px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #0d100e; background: var(--accent); }
.check-badge svg { width: 15px; stroke-width: 2.4; }
.compatibility-card strong { display: block; margin-bottom: 3px; font-size: 11px; }
.compatibility-card p { margin: 0; color: #899083; font: 8px/1.3 var(--font-mono); }

.primary-button { width: 100%; margin: 14px 0 10px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: var(--radius); color: #0b0d0c; background: var(--accent); cursor: pointer; text-align: left; transition: transform .15s, filter .15s; }
.primary-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-button small { display: block; margin-bottom: 2px; color: #3c4a13; font: 700 8px var(--font-mono); text-transform: uppercase; letter-spacing: .1em; }
.primary-button span { font-size: 12px; font-weight: 800; }
.primary-button svg { width: 20px; stroke-width: 2; }

.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-button { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #0e110f; cursor: pointer; text-align: left; }
.export-button:hover { border-color: #4a534b; background: #141814; }
.export-button.wide { grid-column: 1 / -1; }
.file-icon { width: 30px; height: 34px; display: grid; place-items: center; flex: none; border: 1px solid #394039; color: var(--accent); background: #151915; font: 700 7px var(--font-mono); clip-path: polygon(0 0, 75% 0, 100% 25%, 100% 100%, 0 100%); }
.export-button strong, .export-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-button strong { margin-bottom: 3px; font-size: 9px; }
.export-button small { color: #737b74; font: 8px var(--font-mono); }

.install-steps { margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line); }
.steps-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.steps-heading h3 { margin-bottom: 0; }
.steps-heading a { color: var(--accent); font: 8px var(--font-mono); text-decoration: none; }
.install-steps ol { list-style: none; padding: 0; margin: 17px 0 0; }
.install-steps li { display: grid; grid-template-columns: 23px 1fr; gap: 9px; position: relative; padding-bottom: 14px; }
.install-steps li:not(:last-child)::after { content: ""; position: absolute; left: 11px; top: 21px; bottom: 0; width: 1px; background: var(--line); }
.install-steps li span { width: 23px; height: 23px; display: grid; place-items: center; position: relative; z-index: 1; border: 1px solid #3b433b; border-radius: 50%; color: var(--accent); background: var(--panel); font: 8px var(--font-mono); }
.install-steps li p { margin: 3px 0 0; color: #969e97; font-size: 9px; line-height: 1.45; }
.install-steps li strong { color: #d3d8d3; font-weight: 650; }
.use-note { margin: 8px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line-soft); color: #666e67; font: 8px/1.55 var(--font-mono); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; padding: 9px 13px; border: 1px solid #4b5842; border-radius: var(--radius); color: var(--text); background: #171c16; box-shadow: 0 10px 35px #000; font: 10px var(--font-mono); opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(340px, 420px) 1fr; }
  .export-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
  .export-panel > .panel-heading, .export-panel > .compatibility-card, .export-panel > .primary-button, .export-panel > .export-grid { grid-column: 1; }
  .export-panel > .install-steps, .export-panel > .use-note { grid-column: 2; }
  .export-panel > .install-steps { grid-row: 1 / span 4; margin-top: 0; padding: 0 0 0 28px; border-top: 0; border-left: 1px solid var(--line); }
  .export-panel > .use-note { padding-left: 28px; border: 0; }
}

@media (max-width: 780px) {
  .topbar { height: 58px; padding: 0 16px; }
  .topbar-meta { display: none; }
  .icon-button { margin-left: auto; }
  .workspace { display: block; }
  .panel, .preview-stage { padding: 24px 18px; }
  .editor-panel, .export-panel { border: 0; }
  .preview-stage { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .device-wrap { min-height: 310px; }
  .export-panel { display: block; }
  .export-panel > .install-steps { margin-top: 24px; padding: 21px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .export-panel > .use-note { padding-left: 0; }
}

@media (max-width: 460px) {
  .settings-grid { grid-template-columns: 1fr; }
  .textarea-shell { height: 280px; }
  .palette-row { align-items: flex-end; }
  .preview-stage { padding-left: 14px; padding-right: 14px; }
  .device-wrap { min-height: 250px; }
  .preview-facts div { padding: 10px 8px; }
  .preview-facts strong { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

