@font-face {
  font-family: "SF Pro";
  src: url("/static/assets/sf-pro.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #020817;
  --surface: #07111f;
  --surface-strong: #091525;
  --border: #1a2a40;
  --border-bright: #38536f;
  --text: #f8fbff;
  --muted: #9ca3af;
  --muted-blue: #a9bdd4;
  --blue: #075cd9;
  --blue-bright: #168cff;
  --cyan: #5ecbff;
  --radius-sm: 10px;
  --radius-md: 16px;
  --shadow-blue: 0 0 32px rgb(7 92 217 / 28%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgb(2 8 23 / 32%), var(--bg) 52%),
    var(--bg) url("/static/assets/a2k-network.webp") top right / min(1100px, 90vw) auto no-repeat;
  color: var(--text);
  font: 16px/1.5 "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgb(56 83 111 / 45%);
  background: rgb(2 8 23 / 78%);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand span { display: grid; gap: 2px; }
.brand b { font-size: 13px; letter-spacing: .16em; }
.brand small { color: var(--muted-blue); font-size: 9px; letter-spacing: .2em; }
.header-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-blue); font-size: 13px; }
.header-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-bright); box-shadow: 0 0 14px var(--blue-bright); }

.page-shell { width: min(1460px, 100%); margin: 0 auto; padding: 72px clamp(20px, 5vw, 72px) 100px; }
.intro { max-width: 850px; margin-bottom: 64px; }
.eyebrow { margin: 0 0 18px; color: var(--blue-bright); font-size: 12px; font-weight: 700; letter-spacing: .2em; }
h1 { max-width: 850px; margin: 0; font-size: clamp(48px, 7vw, 92px); font-weight: 650; line-height: .94; letter-spacing: -.055em; }
.intro-copy { max-width: 680px; margin: 28px 0; color: var(--muted-blue); font-size: clamp(17px, 2vw, 21px); }
.progress-meta { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 13px; }
.progress-track { width: min(360px, 55vw); height: 3px; overflow: hidden; background: var(--border); }
.progress-track i { display: block; width: 25%; height: 100%; background: var(--blue-bright); box-shadow: var(--shadow-blue); transition: width .28s ease; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(32px, 5vw, 72px); align-items: start; }
.editor-form { display: grid; gap: 16px; }
.step { min-width: 0; margin: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(7 17 31 / 78%); opacity: .42; transition: border-color .2s ease, opacity .2s ease, transform .2s ease; }
.step:not(:disabled) { opacity: 1; }
.step.is-active { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue), var(--shadow-blue); transform: translateX(2px); }
.step.is-complete { border-color: rgb(56 83 111 / 72%); }
.step legend { padding: 0 8px 0 0; color: var(--text); font-size: 19px; font-weight: 650; }
.step legend span { display: inline-block; min-width: 34px; color: var(--blue-bright); font-size: 12px; letter-spacing: .12em; }
.step > p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.layer-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.upload-zone { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 14px; min-height: 120px; padding: 20px; border: 1px dashed var(--border-bright); border-radius: var(--radius-sm); background: rgb(5 11 22 / 70%); cursor: pointer; }
.upload-zone.compact { min-height: 104px; padding: 16px; }
.upload-zone:hover { border-color: var(--blue-bright); }
.upload-zone:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.upload-zone:has(input:valid) { border-style: solid; border-color: var(--blue); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone .upload-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--border); border-radius: 50%; color: var(--blue-bright); font-size: 22px; }
.upload-zone b { align-self: end; font-size: 14px; }
.upload-zone small { align-self: start; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }

.toggle-control { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-strong); cursor: pointer; }
.toggle-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-control > i { position: relative; flex: 0 0 44px; height: 24px; border: 1px solid var(--border-bright); border-radius: 99px; background: #111d2d; }
.toggle-control > i::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); content: ""; transition: transform .15s ease, background .15s ease; }
.toggle-control:has(input:checked) > i { border-color: var(--blue-bright); background: var(--blue); }
.toggle-control:has(input:checked) > i::after { transform: translateX(20px); background: white; }
.toggle-control:has(input:focus-visible) { outline: 2px solid var(--cyan); outline-offset: 3px; }
.toggle-control span { display: grid; }
.toggle-control small { color: var(--muted); }
.select-control { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 12px; margin-top: 12px; color: var(--muted-blue); font-size: 14px; }
.select-control select { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--border-bright); border-radius: 8px; background: var(--surface-strong); color: var(--text); }
.select-control select:disabled { opacity: .45; }

.primary-button, .secondary-button { border: 0; border-radius: var(--radius-sm); color: white; font-weight: 700; cursor: pointer; }
.primary-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 60px; margin-top: 14px; padding: 0 20px; background: var(--blue); box-shadow: var(--shadow-blue); }
.primary-button:hover:not(:disabled) { background: var(--blue-bright); }
.primary-button:focus-visible, .secondary-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.primary-button:disabled { background: #17243a; color: #6f7c8f; cursor: not-allowed; box-shadow: none; }
.secondary-button { min-height: 40px; margin-top: 12px; padding: 0 14px; background: #17243a; }
.submit-status { min-height: 24px; margin-top: 10px; color: var(--muted-blue); font-size: 14px; }

.preview-panel { position: sticky; top: 24px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(7 17 31 / 86%); backdrop-filter: blur(16px); }
.preview-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.preview-heading small { color: var(--blue-bright); font-size: 10px; letter-spacing: .15em; }
.preview-heading h2 { margin: 2px 0 0; font-size: 18px; }
.preview-heading > span { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); font-size: 12px; }
.preview-panel > p { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

.phone-frame { position: relative; isolation: isolate; aspect-ratio: 9 / 16; overflow: hidden; border: 1px solid var(--border-bright); border-radius: 12px; background: #07111f; user-select: none; }
.background-preview { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.preview-placeholder { position: absolute; z-index: 5; inset: 0; display: grid; place-content: center; gap: 4px; text-align: center; pointer-events: none; }
.preview-placeholder b { color: var(--blue-bright); font-size: 30px; letter-spacing: .1em; }
.preview-placeholder span { color: var(--muted); font-size: 12px; }
.phone-frame:has(.source-layer:not([hidden])) .preview-placeholder { display: none; }

.editor-layer { position: absolute; touch-action: none; cursor: grab; outline: none; }
.editor-layer:active { cursor: grabbing; }
.editor-layer:focus-visible { filter: drop-shadow(0 0 5px var(--cyan)); }
.source-layer { z-index: 10; background: #000; }
.source-layer video, .banner-layer img { display: block; width: 100%; height: 100%; pointer-events: none; }
.source-layer video { object-fit: fill; }
.banner-layer { z-index: 20; background: white; }
.banner-layer img { object-fit: fill; }
.subtitle-preview { z-index: 30; display: grid; place-items: center; min-height: 8%; padding: 4px 6px; color: white; font-size: clamp(9px, 3.2cqi, 16px); font-weight: 700; line-height: 1.15; text-align: center; text-shadow: 0 1px 2px black, 0 0 4px black; container-type: inline-size; }

.safe-overlays { position: absolute; z-index: 50; inset: 0; pointer-events: none; }
.unsafe { position: absolute; background: rgb(2 8 23 / 58%); color: rgb(248 251 255 / 52%); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.unsafe-top { inset: 0 0 auto; height: 9.375%; text-align: center; padding-top: 10px; }
.unsafe-right { inset: 9.375% 0 21.875% auto; width: 16.666%; display: grid; overflow: hidden; align-items: center; padding-inline: 2px; text-align: center; line-height: 1.7; overflow-wrap: anywhere; }
.unsafe-bottom { inset: auto 0 0; height: 21.875%; display: grid; align-items: end; padding: 0 10px 16px; }
.safe-outline { position: absolute; inset: 9.375% 16.666% 21.875% 5.555%; border: 1px dashed rgb(94 203 255 / 78%); }
.safe-outline span { position: absolute; top: 5px; left: 6px; color: rgb(94 203 255 / 90%); font-size: 8px; letter-spacing: .12em; }

.selection-box { position: absolute; z-index: 60; border: 1px solid var(--cyan); box-shadow: 0 0 0 1px rgb(2 8 23 / 55%), 0 0 12px rgb(94 203 255 / 34%); pointer-events: none; }
.selection-box button { position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px; padding: 0; border: 2px solid white; border-radius: 50%; background: var(--blue-bright); box-shadow: 0 0 10px rgb(22 140 255 / 70%); cursor: nwse-resize; pointer-events: auto; touch-action: none; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
  .layer-tools { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-header { padding-inline: 16px; }
  .header-status { font-size: 0; }
  .page-shell { padding: 44px 16px 80px; }
  .intro { margin-bottom: 36px; }
  .workspace { display: flex; flex-direction: column-reverse; }
  .editor-form, .preview-panel { width: 100%; }
  .preview-panel { position: relative; top: auto; display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 18px; align-items: start; }
  .preview-heading, .preview-panel > p { grid-column: 2; }
  .phone-frame { grid-row: 1 / 3; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  h1 { font-size: 48px; }
  .preview-panel { display: block; }
  .phone-frame { width: min(300px, 100%); margin: 0 auto; }
  .preview-heading, .preview-panel > p { margin-top: 12px; }
  .step { padding: 18px 14px; }
  .select-control { grid-template-columns: 1fr; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
