:root {
    --bg: #0f131a;
    --panel: #161b24;
    --panel-2: #1e2530;
    --ink: #11151d;
    --muted: #677080;
    --line: #dfe3e9;
    --soft: #f4f6f8;
    --white: #ffffff;
    --accent: #6552ff;
    --accent-2: #7a67ff;
    --danger: #d84040;
    --success: #1f9b68;
    --shadow: 0 18px 60px rgba(18, 25, 38, .16);
    --radius: 22px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* Marketing site */
.zd-site { min-height: 100vh; background: linear-gradient(180deg,#fff 0%,#f7f8fb 100%); }
.site-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 18px clamp(20px,4vw,64px); background: rgba(255,255,255,.9); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(17,21,29,.07); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; text-decoration: none; letter-spacing: -.04em; }
.brand-dot { color: var(--accent); }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--ink); font-size: 12px; letter-spacing: -.02em; }
.brand-mark.small { width: 32px; height: 32px; border-radius: 9px; font-size: 10px; background: var(--accent); }
.site-nav { display: flex; align-items: center; gap: 26px; font-size: 14px; font-weight: 650; }
.site-nav a { text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 22px; border-radius: 14px; background: var(--ink); color: #fff; text-decoration: none; font-weight: 760; border: 1px solid var(--ink); }
.btn:hover { transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #d9dde4; }
.btn-small { min-height: 40px; padding: 0 16px; border-radius: 11px; }
.hero-shell { display: grid; grid-template-columns: minmax(0,1fr) minmax(460px,.95fr); align-items: center; gap: clamp(40px,7vw,110px); max-width: 1500px; margin: 0 auto; padding: clamp(70px,9vw,130px) clamp(24px,5vw,80px); }
.hero-copy h1 { max-width: 760px; margin: 16px 0 24px; font-size: clamp(48px,6vw,86px); line-height: .98; letter-spacing: -.065em; }
.hero-copy p { max-width: 690px; margin: 0; color: #555e6b; font-size: clamp(18px,2vw,22px); line-height: 1.6; }
.eyebrow, .panel-kicker { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-note { margin-top: 18px; color: #7b8490; font-size: 13px; }
.hero-preview { overflow: hidden; border-radius: 26px; background: #fff; box-shadow: var(--shadow); border: 1px solid #e6e9ef; transform: rotate(1deg); }
.hero-preview img { display: block; width: 100%; background: #fff; }
.preview-top, .preview-tools { display: flex; align-items: center; gap: 16px; min-height: 54px; padding: 0 16px; background: #12161d; color: #fff; font-size: 12px; }
.preview-top strong { margin-right: auto; }
.preview-saved { color: #7ee0ad; }
.preview-tools { justify-content: center; background: #171c25; }
.preview-tools span { padding: 9px 12px; border-radius: 9px; background: #242b37; }
.content-section { max-width: 1400px; margin: 0 auto; padding: 90px clamp(24px,5vw,80px); }
.section-heading { max-width: 780px; margin-bottom: 42px; }
.section-heading h2, .split-section h2, .cta-section h2 { margin: 10px 0 0; font-size: clamp(36px,4.7vw,64px); letter-spacing: -.055em; line-height: 1.03; }
.feature-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.feature-grid article, .roadmap-grid article { padding: 28px; border: 1px solid #e4e7ec; border-radius: 20px; background: #fff; }
.feature-grid strong, .roadmap-grid strong { display: block; font-size: 18px; }
.feature-grid p, .roadmap-grid p, .split-section p, .cta-section p { color: #68717e; line-height: 1.65; }
.split-section { display: grid; grid-template-columns: .9fr 1.1fr; gap: 70px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; gap: 16px; align-items: center; padding: 18px; background: #fff; border: 1px solid #e4e7ec; border-radius: 16px; }
.steps li > span { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 12px; background: #eeeaff; color: var(--accent); font-weight: 800; }
.steps strong, .steps small { display: block; }
.steps small { margin-top: 4px; color: #7b8490; }
.roadmap-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.roadmap-grid article span { display: inline-grid; place-items: center; width: 42px; height: 42px; margin-bottom: 32px; border-radius: 12px; background: #f0f1f4; font-size: 12px; font-weight: 800; }
.roadmap-grid article.is-now { border-color: rgba(101,82,255,.35); box-shadow: 0 12px 38px rgba(101,82,255,.08); }
.roadmap-grid article.is-now span { background: var(--accent); color: #fff; }
.cta-section { max-width: 1250px; margin: 40px auto 100px; padding: 70px clamp(28px,6vw,90px); border-radius: 30px; background: var(--ink); color: #fff; text-align: center; }
.cta-section p { color: #b4bcc8; max-width: 650px; margin: 18px auto 28px; }
.cta-section .btn { background: #fff; color: var(--ink); border-color: #fff; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding: 30px clamp(24px,5vw,80px); color: #7b8490; font-size: 13px; border-top: 1px solid #e4e7ec; }

/* Full-screen app */
.zd-app { overflow: hidden; height: 100vh; height: 100dvh; background: #0d1117; color: #fff; overscroll-behavior: none; }
.app-header { position: fixed; z-index: 40; top: 0; left: 0; right: 0; height: calc(64px + var(--safe-top)); padding: var(--safe-top) 12px 0; display: grid; grid-template-columns: 44px auto minmax(180px,1fr) auto 44px; align-items: center; gap: 10px; background: #11161e; border-bottom: 1px solid rgba(255,255,255,.08); }
.app-exit, .icon-btn, .panel-close { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: #202733; color: #fff; text-decoration: none; font-size: 28px; line-height: 1; }
.app-brand { display: flex; align-items: center; gap: 9px; font-size: 15px; }
.app-project { min-width: 0; }
.app-project strong, .app-project small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-project strong { font-size: 13px; }
.app-project small { margin-top: 2px; color: #8993a2; font-size: 11px; }
.app-status { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mode-pill, .save-status { white-space: nowrap; font-size: 11px; }
.mode-pill { padding: 8px 10px; border-radius: 10px; background: #222a36; color: #d9deea; }
.save-status { color: #8edeb3; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.app-stage { position: fixed; z-index: 1; inset: calc(64px + var(--safe-top)) 0 calc(72px + var(--safe-bottom)); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 14px; background: #0b0f14; touch-action: none; }
.app-stage::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at center, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 24px 24px; opacity: .35; pointer-events: none; }
.app-loading { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #aab3bf; }
.loading-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(101,82,255,.5); animation: pulse 1.5s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(101,82,255,0); } 100% { box-shadow: 0 0 0 0 rgba(101,82,255,0); } }
.fpz-viewport { position: relative; z-index: 2; flex: 0 0 auto; background: #fff; box-shadow: 0 20px 80px rgba(0,0,0,.48); user-select: none; -webkit-user-select: none; }
.fpz-viewport canvas, .fpz-viewport svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.fpz-viewport svg { z-index: 2; touch-action: none; }
.fpz-zone-shape { cursor: pointer; }
.fpz-zone-shape-active { filter: drop-shadow(0 0 2px rgba(0,0,0,.2)); }
.fpz-corner-handle, .fpz-edge-tab, .fpz-zone-label, .fpz-marker { cursor: grab; }
.fpz-corner-handle:active, .fpz-edge-tab:active, .fpz-zone-label:active, .fpz-marker:active { cursor: grabbing; }
.app-dock { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; height: calc(72px + var(--safe-bottom)); padding: 8px 10px var(--safe-bottom); display: grid; grid-template-columns: repeat(5, minmax(68px, 1fr)); gap: 8px; background: #11161e; border-top: 1px solid rgba(255,255,255,.08); }
.dock-btn { min-width: 0; border: 0; border-radius: 13px; background: transparent; color: #8f99a8; display: grid; place-items: center; align-content: center; gap: 2px; }
.dock-btn span { font-size: 20px; line-height: 1; }
.dock-btn small { font-size: 10px; font-weight: 700; }
.dock-btn.is-active, .dock-btn:hover { background: #202733; color: #fff; }
.dock-btn:disabled { opacity: .35; cursor: not-allowed; }
.panel-backdrop { position: fixed; z-index: 55; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.tool-panel { position: fixed; z-index: 60; top: calc(64px + var(--safe-top)); right: 0; bottom: calc(72px + var(--safe-bottom)); width: min(420px, 88vw); padding: 20px; overflow-y: auto; background: #161c25; color: #fff; border-left: 1px solid rgba(255,255,255,.08); box-shadow: -20px 0 70px rgba(0,0,0,.4); transform: translateX(105%); transition: transform .22s ease; }
.tool-panel.is-open { transform: translateX(0); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel-head h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: -.04em; }
.panel-close { flex: 0 0 auto; }
.panel-view { display: grid; gap: 18px; }
.panel-copy { margin: 0; color: #a6afbc; line-height: 1.55; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid .span-2 { grid-column: 1 / -1; }
.field-grid label, .setting-block label { display: grid; gap: 7px; color: #c5ccd6; font-size: 12px; font-weight: 700; }
.field-grid input:not([type=color]), .setting-block select, .setting-block input:not([type=range]) { width: 100%; min-height: 44px; padding: 0 12px; color: #fff; background: #222a36; border: 1px solid #343e4e; border-radius: 11px; outline: none; }
.field-grid input[type=color] { width: 100%; min-height: 44px; padding: 4px; background: #222a36; border: 1px solid #343e4e; border-radius: 11px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.switch-list { display: grid; gap: 8px; }
.switch-list label { display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: #1e2530; border-radius: 12px; }
.switch-list input { margin-top: 3px; accent-color: var(--accent); }
.switch-list span, .switch-list strong, .switch-list small { display: block; }
.switch-list small { margin-top: 3px; color: #919baa; line-height: 1.4; }
.panel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.panel-actions.stacked { grid-template-columns: 1fr; }
.action { min-height: 44px; border: 0; border-radius: 11px; padding: 0 12px; font-weight: 760; }
.action.primary { background: var(--accent); color: #fff; }
.action.secondary { background: #2a3240; color: #fff; }
.action.danger { background: rgba(216,64,64,.13); color: #ff9b9b; border: 1px solid rgba(216,64,64,.22); }
.action.full { width: 100%; }
.action:disabled, .fpz-marker-btn:disabled { opacity: .35; cursor: not-allowed; }
.zone-list-head { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.zone-list-head span { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: #272f3b; font-size: 11px; }
.fpz-zone-list { display: grid; gap: 7px; }
.fpz-zone-list-empty { margin: 0; padding: 14px; color: #8791a0; background: #1e2530; border-radius: 11px; font-size: 12px; }
.fpz-zone-list-item { width: 100%; display: grid; grid-template-columns: 12px 1fr 28px; gap: 10px; align-items: center; padding: 11px; border: 1px solid transparent; border-radius: 11px; background: #1e2530; color: #fff; text-align: left; }
.fpz-zone-list-item.is-selected { border-color: var(--accent); background: #242a42; }
.fpz-zone-list-colour { width: 12px; height: 32px; border-radius: 5px; }
.fpz-zone-list-copy strong, .fpz-zone-list-copy small { display: block; }
.fpz-zone-list-copy small { margin-top: 2px; color: #929cab; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fpz-zone-list-count { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #303846; font-size: 11px; }
.marker-actions { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.fpz-marker-btn { min-height: 78px; padding: 10px 6px; display: grid; place-items: center; align-content: center; gap: 4px; border: 1px solid #323b49; border-radius: 12px; background: #202733; color: #fff; }
.fpz-marker-btn.is-active { outline: 2px solid var(--accent); background: #282b4a; }
.fpz-marker-btn span { font-weight: 850; }
.fpz-marker-btn small { color: #97a1af; font-size: 10px; }
.setting-block { display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: #1e2530; }
.setting-block h3 { margin: 0; font-size: 14px; }
.range-row { display: flex; justify-content: space-between; gap: 12px; }
.drawing-actions { position: fixed; z-index: 50; right: 18px; bottom: calc(88px + var(--safe-bottom)); display: flex; gap: 8px; }
.drawing-actions button { min-height: 42px; padding: 0 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; background: #1a202a; color: #fff; font-weight: 750; box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.drawing-actions button:disabled { display: none; }
.engine-hidden { display: none !important; }
.portrait-guard { display: none; }

@media (max-width: 900px) {
    .site-nav a:not(.btn) { display: none; }
    .hero-shell { grid-template-columns: 1fr; }
    .hero-preview { transform: none; }
    .feature-grid, .roadmap-grid { grid-template-columns: 1fr 1fr; }
    .split-section { grid-template-columns: 1fr; gap: 35px; }
    .app-header { grid-template-columns: 40px auto minmax(110px,1fr) 40px; }
    .app-status { display: none; }
    .app-project small { display: none; }
}

@media (max-width: 640px) {
    .hero-copy h1 { font-size: 46px; }
    .feature-grid, .roadmap-grid { grid-template-columns: 1fr; }
    .site-footer { flex-direction: column; }
}

/* The editor itself is landscape-first on touch devices. Desktop portrait remains usable. */
@media (orientation: portrait) and (pointer: coarse) {
    .zd-app .portrait-guard { position: fixed; z-index: 999; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 34px; background: #0f141c; color: #fff; text-align: center; }
    .portrait-guard .rotate-icon { display: grid; place-items: center; width: 82px; height: 82px; border-radius: 24px; background: #202735; color: #8b7dff; font-size: 46px; }
    .portrait-guard strong { margin-top: 8px; font-size: 28px; letter-spacing: -.04em; }
    .portrait-guard span { max-width: 320px; color: #a4adba; line-height: 1.5; }
}

@media (max-height: 520px) {
    .app-header { height: calc(54px + var(--safe-top)); grid-template-columns: 40px auto minmax(100px,1fr) auto 40px; }
    .app-stage { inset: calc(54px + var(--safe-top)) 0 calc(62px + var(--safe-bottom)); padding: 8px; }
    .app-dock { height: calc(62px + var(--safe-bottom)); padding-top: 5px; }
    .tool-panel { top: calc(54px + var(--safe-top)); bottom: calc(62px + var(--safe-bottom)); }
    .drawing-actions { bottom: calc(74px + var(--safe-bottom)); }
    .dock-btn span { font-size: 18px; }
    .dock-btn small { font-size: 9px; }
}
