:root {
  --navy-950: #061a38;
  --navy-900: #071f43;
  --navy-800: #0d315f;
  --navy-700: #174a83;
  --gold-500: #f7b817;
  --gold-300: #ffd86a;
  --red-600: #d51f2d;
  --cream: #fffdf8;
  --ink: #10243f;
  --muted: #63748b;
  --line: #dce4ed;
  --surface: #ffffff;
  --shadow: 0 20px 60px rgba(7, 31, 67, .12);
  --radius-lg: 24px;
  --radius-md: 14px;
  --focus: #116dff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif; font-size: 16px; line-height: 1.5; }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site-header { background: var(--navy-950); color: #fff; border-bottom: 3px solid var(--gold-500); }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: #fff; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; letter-spacing: .06em; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.5); border-radius: 12px; color: var(--gold-300); }
.brand-mark svg { width: 26px; height: 26px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .82rem; }
.brand small { color: #b9c9de; letter-spacing: .02em; font-size: .75rem; margin-top: 2px; }
.header-badge { color: var(--gold-300); font-size: .75rem; letter-spacing: .14em; font-weight: 800; }

.hero { display: flex; justify-content: space-between; align-items: end; gap: 40px; padding: 74px 0 48px; }
.hero-copy { max-width: 720px; }
.eyebrow { margin: 0 0 9px; color: var(--navy-700); font-size: .72rem; line-height: 1.2; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; }
.site-header .eyebrow { color: var(--gold-300); }
.hero .eyebrow { display: flex; align-items: center; gap: 9px; }
.hero .eyebrow span { display: block; width: 28px; height: 4px; background: var(--red-600); border-radius: 99px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(2.6rem, 6vw, 5.2rem); line-height: .98; letter-spacing: -.055em; color: var(--navy-950); }
h1 em { color: var(--red-600); font-style: normal; }
.hero-text { max-width: 580px; color: var(--muted); font-size: 1.1rem; }
.hero-meta { display: grid; gap: 5px; max-width: 250px; padding: 16px 0 2px 22px; border-left: 3px solid var(--gold-500); color: var(--navy-800); }
.hero-meta strong { font-size: .95rem; letter-spacing: .08em; }
.hero-meta span { color: var(--muted); font-size: .86rem; }

.editor { display: grid; grid-template-columns: minmax(0, 1.14fr) minmax(330px, .86fr); gap: 24px; align-items: start; padding-bottom: 80px; }
.preview-panel, .controls-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.preview-panel { padding: 24px; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
h2 { color: var(--navy-950); font-size: 1.55rem; line-height: 1.1; margin-bottom: 0; }
.live-dot { color: var(--navy-700); font-size: .75rem; white-space: nowrap; }
.live-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #2aa36b; box-shadow: 0 0 0 4px #e4f6ec; }
.canvas-wrap { position: relative; width: 100%; max-width: 650px; margin: 0 auto; overflow: hidden; border-radius: 16px; background-color: #f8fafc; background-image: linear-gradient(45deg, #e7ecf2 25%, transparent 25%), linear-gradient(-45deg, #e7ecf2 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e7ecf2 75%), linear-gradient(-45deg, transparent 75%, #e7ecf2 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  touch-action: none; }
#previewCanvas { display: block; width: 100%; height: auto; cursor: grab; }
#previewCanvas.is-dragging { cursor: grabbing; }
.canvas-hint { pointer-events: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; gap: 8px; color: #56718e; text-align: center; font-weight: 700; font-size: .85rem; opacity: .8; }
.canvas-hint svg { width: 32px; height: 32px; }
.canvas-hint.is-hidden { display: none; }
.drag-tip { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 15px 0 0; color: var(--muted); font-size: .82rem; text-align: center; }
.drag-tip svg { width: 17px; height: 17px; flex: none; color: var(--navy-700); }

.controls-panel { padding: 28px; }
.step-block { padding: 0 0 25px; margin-bottom: 25px; border-bottom: 1px solid var(--line); }
.step-block:last-of-type { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.upload-drop { display: flex; align-items: center; gap: 13px; min-height: 76px; padding: 13px 15px; border: 1px dashed #a7bbd2; border-radius: var(--radius-md); color: var(--navy-900); background: #f7faff; transition: border-color .2s ease, background .2s ease, transform .2s ease; cursor: pointer; }
.upload-drop:hover, .upload-drop.is-dragover { border-color: var(--gold-500); background: #fffaf0; transform: translateY(-1px); }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--navy-900); color: var(--gold-300); flex: none; }
.upload-icon svg { width: 23px; height: 23px; }
.upload-drop strong, .upload-drop small { display: block; }
.upload-drop strong { font-size: .95rem; }
.upload-drop small { color: var(--muted); font-size: .77rem; margin-top: 2px; }
.file-name { min-height: 20px; margin: 9px 0 0; color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.control-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
h3 { margin: 0; color: var(--navy-950); font-size: 1.16rem; }
.text-button { min-height: 44px; padding: 5px 4px; border: 0; color: var(--red-600); background: transparent; font-size: .83rem; font-weight: 800; }
.range-row { margin-top: 18px; }
.range-row label { display: flex; justify-content: space-between; gap: 10px; color: var(--navy-800); font-size: .83rem; font-weight: 700; }
.range-row output { color: var(--muted); font-weight: 500; }
input[type="range"] { display: block; width: 100%; height: 6px; margin: 11px 0 0; accent-color: var(--navy-700); cursor: pointer; }
.download-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--red-600); color: #fff; font-weight: 800; box-shadow: 0 10px 20px rgba(213,31,45,.18); transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.download-button svg { width: 21px; height: 21px; }
.download-button:hover:not(:disabled) { background: #b61927; transform: translateY(-2px); box-shadow: 0 13px 24px rgba(213,31,45,.24); }
.download-button:disabled { background: #b7c1ce; color: #eef2f6; box-shadow: none; cursor: not-allowed; }
.privacy-note { display: flex; align-items: flex-start; gap: 7px; margin: 14px 0 0; color: var(--muted); font-size: .76rem; }
.privacy-note svg { width: 16px; height: 16px; flex: none; color: #2a8c64; }
.status { margin: 20px 0 0; padding: 11px 13px; border-radius: 10px; background: #f2f6fa; color: var(--muted); font-size: .8rem; }
.status.is-success { background: #eaf8f0; color: #1e714f; }
.status.is-error { background: #fff0f1; color: #a21825; }

.site-footer { background: var(--navy-950); color: #b8c6d6; font-size: .78rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding: 22px 0; }

@media (max-width: 860px) {
  .hero { align-items: start; flex-direction: column; gap: 22px; padding-top: 52px; }
  .hero-meta { max-width: none; width: 100%; }
  .editor { grid-template-columns: 1fr; }
  .controls-panel { order: -1; }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 28px, 1180px); }
  .header-inner { min-height: 68px; }
  .header-badge { font-size: .65rem; }
  .hero { padding: 42px 0 30px; }
  h1 { font-size: clamp(2.45rem, 14vw, 4rem); }
  .hero-text { font-size: 1rem; }
  .preview-panel { padding: 13px; border-radius: 18px; }
  .controls-panel { padding: 22px 18px; border-radius: 18px; }
  .panel-heading { padding: 4px 4px 0; }
  .live-dot { font-size: .68rem; }
  .drag-tip { font-size: .75rem; }
  .footer-inner { flex-direction: column; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
