:root {
  --blue-900: #061f4f;
  --blue-800: #082a66;
  --blue-700: #0c3f95;
  --yellow: #ffc400;
  --white: #ffffff;
  --ink: #10203b;
  --muted: #64748b;
  --page: #f4f7fb;
  --card: #ffffff;
  --shadow: 0 18px 45px rgba(6, 31, 79, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
body { min-height: 100dvh; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app { min-height: 100dvh; }
.screen { display: none; width: min(100%, 520px); min-height: 100dvh; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); }
.screen.is-active { display: flex; flex-direction: column; }

.screen-start { align-items: center; text-align: center; justify-content: center; gap: 14px; }
.brand-chip { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 999px; background: var(--blue-900); color: white; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.brand-chip strong { color: var(--yellow); }
h1, h2, p { margin: 0; }
h1 { max-width: 380px; color: var(--blue-900); font-size: clamp(28px, 7vw, 40px); line-height: .98; letter-spacing: -.035em; }
.lead { max-width: 410px; color: var(--muted); line-height: 1.45; font-size: 15px; }

.frame-sample { width: min(58vw, 260px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #eaf0f8 0 55%, transparent 56%); }
.frame-sample img { width: 100%; height: 100%; object-fit: contain; }

.action-stack { width: 100%; display: grid; gap: 10px; margin-top: 4px; }
.btn { width: 100%; min-height: 54px; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 900; cursor: pointer; }
.btn-primary { background: linear-gradient(180deg, #0c469f, #082a66); color: white; box-shadow: 0 12px 28px rgba(8,42,102,.25); }
.btn-secondary { background: white; color: var(--blue-900); border: 1px solid #dbe4f0; }
.btn-ghost { background: transparent; color: var(--blue-800); border: 1px solid #cbd6e5; }
.btn:active { transform: translateY(1px); }
.privacy-note { color: #7a879a; font-size: 12px; line-height: 1.4; max-width: 390px; }

.screen-editor { overflow: hidden; padding-bottom: 0; }
.editor-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.editor-head h2, .result-head h2 { color: var(--blue-900); font-size: 21px; line-height: 1; }
.editor-head p, .result-head p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.text-button { border: 0; background: transparent; color: var(--blue-800); font-weight: 800; padding: 0 4px 0 0; min-height: 38px; }

.canvas-wrap { width: min(88vw, 390px); max-height: min(56dvh, 390px); aspect-ratio: 1; margin: 14px auto 12px; border-radius: 50%; overflow: hidden; background: transparent; box-shadow: none; position: relative; flex: 0 1 auto; }
.canvas-wrap::after { content: none; }
#editorCanvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }

.controls-card { margin-top: auto; background: white; border: 1px solid #e1e8f2; border-radius: 18px; padding: 14px; box-shadow: 0 10px 30px rgba(15,35,70,.08); }
.zoom-row { display: grid; grid-template-columns: 22px 1fr 22px; align-items: center; gap: 8px; color: var(--blue-800); font-weight: 900; }
.zoom-row input { width: 100%; accent-color: var(--blue-700); }
.small-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-mini { min-height: 42px; border: 1px solid #dbe4f0; background: #f8fafc; color: var(--blue-800); border-radius: 12px; font-size: 13px; font-weight: 800; }
.bottom-safe-space { height: 88px; flex: 0 0 88px; }
.fixed-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(244,247,251,1) 70%, rgba(244,247,251,.94)); }
.fixed-cta .btn { max-width: 488px; display: block; margin: 0 auto; }

.screen-result { align-items: center; justify-content: center; gap: 16px; text-align: center; }
.result-head { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; }
.success-dot { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: var(--blue-900); font-weight: 1000; font-size: 22px; }
.result-image-wrap { width: min(76vw, 360px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: transparent; box-shadow: none; }
.result-image-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.result-actions { width: 100%; display: grid; gap: 9px; }
.ios-tip { color: var(--muted); font-size: 12px; line-height: 1.4; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #101828; color: #fff; padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; transition: .2s ease; z-index: 99; max-width: calc(100vw - 32px); text-align: center; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 700px) {
  .screen-editor { padding-top: max(12px, env(safe-area-inset-top)); }
  .editor-head p { display: none; }
  .canvas-wrap { width: min(72vw, 315px); margin-top: 8px; margin-bottom: 8px; }
  .controls-card { padding: 10px 12px; }
  .small-actions { margin-top: 8px; }
}
