:root {
  color-scheme: light;
  --page: #f3f6fb; --surface: #fff; --soft: #eef4ff; --ink: #11203a;
  --muted: #51617a; --border: #dbe4f1; --blue: #145de1; --blue-text: #134db3;
  --success: #0c775f; --warning: #6d460b; --warning-bg: #fff4d8; --shadow: 0 14px 40px #213e7110;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; --page: #0b1426; --surface: #142138; --soft: #192e51; --ink: #f2f6ff; --muted: #aabbda; --border: #2c3d58; --blue: #2065e3; --blue-text: #a2c5ff; --success: #63d8b4; --warning: #ffdc91; --warning-bg: #372b17; --shadow: 0 14px 40px #0003; }
}
:root[data-theme=dark] { color-scheme: dark; --page: #0b1426; --surface: #142138; --soft: #192e51; --ink: #f2f6ff; --muted: #aabbda; --border: #2c3d58; --blue: #2065e3; --blue-text: #a2c5ff; --success: #63d8b4; --warning: #ffdc91; --warning-bg: #372b17; --shadow: 0 14px 40px #0003; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, .viewport:focus-visible { outline: 3px solid #59a1ff; outline-offset: 3px; }
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); padding-top: env(safe-area-inset-top); }
.header-inner { max-width: 1000px; margin: auto; padding: 14px max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.07rem; font-weight: 750; letter-spacing: -.025em; }
.brand img { border-radius: 10px; }
.icon-button { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; font-size: 1.35rem; line-height: 1; }
.theme { background: var(--page); color: var(--blue-text); }
main { max-width: 1000px; margin: auto; padding: 32px max(22px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); }
.hero { position: relative; display: flex; overflow: hidden; min-height: 280px; border-radius: 27px; color: #fff; background: linear-gradient(120deg,#122956 0%,#183c82 65%,#1c4d9e 100%); box-shadow: var(--shadow); }
.hero-content { position: relative; z-index: 1; padding: 36px 0 36px 36px; width: 60%; }
.hero-kicker { font-size: .8rem; color: #d2e2ff; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.hero-kicker span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #75e2c1; box-shadow: 0 0 0 4px #75e2c124; }
h1, h2, p { margin: 0; }
.hero h1 { margin: 13px 0; font-size: clamp(2.1rem,5vw,3.85rem); line-height: .98; letter-spacing: -.059em; font-weight: 780; }
.hero p { font-size: 1rem; line-height: 1.5; color: #dbe7ff; max-width: 365px; }
.illustration { position: absolute; right: 0; top: 0; bottom: 0; width: 43%; }
.illustration-grid { position: absolute; inset: 0; background: repeating-linear-gradient(0deg,transparent 0 26px,#a8c6ff25 27px 28px), repeating-linear-gradient(90deg,transparent 0 26px,#a8c6ff25 27px 28px); mask-image: linear-gradient(90deg,transparent,#000); }
.sheet { width: 143px; height: 188px; border-radius: 13px; position: absolute; top: 48%; right: 30%; transform: translateY(-50%) rotate(-12deg); box-shadow: 0 20px 35px #061b4e57; }
.sheet-back { background: #85b4fd; transform: translate(25%, -43%) rotate(16deg); opacity: .7; }
.sheet-front { padding: 23px 16px; background: #edf4ff; }
.sheet-label { width: 64%; height: 9px; border-radius: 3px; background: #3c6bc1; margin-bottom: 8px; }
.sheet-line { height: 5px; background: #b4c8e9; border-radius: 3px; }
.short { width: 42%; }
.sheet-rule { height: 1px; margin: 14px 0; background: #c2d2ea; }
.sheet-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 11px; align-items: center; margin-bottom: 10px; }
.sheet-row i,.sheet-row b { height: 6px; border-radius: 2px; background: #a8bbdb; }
.sheet-row b { height: 10px; background: #13203b; }
.illustration-lock { position: absolute; top: 59%; right: 21%; width: 55px; height: 55px; border: 1px solid #7ab0ff; border-radius: 17px; display: grid; place-items: center; box-shadow: 0 9px 28px #0a2465a0; color: #fff; background: #2368df; transform: rotate(8deg); }
.start-section { margin-top: 30px; }
.start-section h2 { font-size: 1.2rem; letter-spacing: -.025em; margin-bottom: 11px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.action, .button { border: 1px solid var(--border); background: var(--surface); border-radius: 16px; font-weight: 700; min-height: 53px; padding: 12px 14px; }
.action { display: flex; align-items: center; text-align: left; min-height: 66px; font-size: .99rem; gap: 11px; box-shadow: var(--shadow); }
.primary { background: var(--blue); color: white; border-color: transparent; }
.arrow { margin-left: auto; color: var(--muted); font-size: 1.35rem; line-height: 1; }
.primary .arrow { color: #d4e3ff; }
.action-icon { flex: 0 0 23px; color: var(--blue-text); }
.primary .action-icon { color: #fff; }
.glyph { display: inline-block; position: relative; width: 23px; height: 22px; }
.glyph::before, .glyph::after { content: ''; position: absolute; }
.glyph-camera::before { inset: 4px 0 2px; border: 2px solid currentColor; border-radius: 5px; }
.glyph-camera::after { width: 6px; height: 6px; left: 7px; top: 7px; border: 2px solid currentColor; border-radius: 50%; }
.glyph-image::before { inset: 2px 0; border: 2px solid currentColor; border-radius: 4px; }
.glyph-image::after { left: 5px; top: 10px; width: 12px; height: 6px; background: currentColor; clip-path: polygon(0 100%, 39% 0, 63% 65%, 80% 35%, 100% 100%); }
.glyph-stack::before, .glyph-stack::after { width: 13px; height: 13px; border: 2px solid currentColor; border-radius: 4px; }
.glyph-stack::before { top: 1px; left: 6px; }
.glyph-stack::after { left: 1px; top: 6px; background: var(--surface); }
.glyph-lock::before { width: 10px; height: 10px; left: 5px; top: 0; border: 2px solid currentColor; border-radius: 7px 7px 0 0; }
.glyph-lock::after { width: 19px; height: 13px; left: 2px; top: 8px; border-radius: 3px; background: currentColor; }
.offline { margin-top: 17px; display: flex; align-items: center; gap: 13px; background: var(--surface); padding: 12px 15px; border-radius: 16px; border: 1px solid var(--border); }
.offline strong, .offline small { display: block; }
.offline strong { font-size: .87rem; }
.offline strong[data-state=ready] { color: var(--success); }
.offline small { color: var(--muted); font-size: .78rem; margin-top: 3px; }
.offline-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--muted); }
.offline:has([data-state=ready]) .offline-dot { background: var(--success); }
.offline:has([data-state=error]) .offline-dot { background: #e18a2b; }
.offline .text-button { margin-left: auto; flex-shrink: 0; }
.text-button { min-height: 44px; color: var(--blue-text); font-weight: 700; background: transparent; border: 0; padding: 0 4px; }
.work-top,.editor-heading,.toolbar,.pager,.zoom { display: flex; align-items: center; gap: 8px; }
.work-top,.editor-heading { justify-content: space-between; }
.work-top { margin-bottom: 10px; color: var(--muted); }
.editor-heading { align-items: flex-start; margin-bottom: 14px; }
.editor-heading h1,.processing h1 { font-size: clamp(1.45rem,4vw,2rem); letter-spacing: -.035em; }
.editor-heading p,.processing p,.review p,.tool-help { color: var(--muted); font-size: .9rem; line-height: 1.45; margin-top: 5px; }
.panel { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); padding: 16px; }
.processing progress { width: 100%; height: 14px; margin-top: 12px; accent-color: var(--blue); }
.toolbar { margin-bottom: 9px; display: grid; grid-template-columns: repeat(3, 1fr); }
.toolbar button,.zoom button { min-height: 44px; border: 1px solid var(--border); background: var(--surface); padding: 4px 8px; border-radius: 12px; font-weight: 650; }
.toolbar button[aria-pressed=true] { background: var(--soft); border-color: var(--blue-text); color: var(--blue-text); }
.viewport-wrap { position: relative; }
.viewport { overflow: auto; width: 100%; height: clamp(240px,54svh,620px); background: #202c40; border-radius: 14px; overscroll-behavior: contain; scrollbar-color: #8599b7 #202c40; }
.viewport canvas { display: block; margin: 0 auto; max-width: none; background: white; }
.viewport canvas.draw { touch-action: none; cursor: crosshair; }
.zoom { justify-content: flex-end; margin-top: 8px; }
.zoom button { min-width: 44px; }
.tool-help { margin-top: -2px; }
.warnings { margin-top: 13px; padding: 12px 14px; background: var(--warning-bg); color: var(--warning); border-radius: 13px; }
.warnings ul { padding-left: 20px; margin: 5px 0 0; }
.warnings li + li { margin-top: 4px; }
.warnings button { min-height: 44px; background: transparent; border: 0; padding: 2px 0; text-align: left; text-decoration: underline; }
.review,.editor-footer { margin-top: 14px; }
.review h2 { font-size: 1.14rem; }
.review-check { display: flex; align-items: center; gap: 9px; min-height: 49px; font-weight: 650; }
.review-check input { width: 20px; height: 20px; accent-color: var(--blue); }
.editor-footer .button,.review > .button { width: 100%; }
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-actions .primary,.export-actions #export-zip { grid-column: 1 / -1; }
.notice { margin-top: 12px; padding: 12px 14px; background: var(--warning-bg); color: var(--warning); border-radius: 13px; }
@media (max-width: 650px) {
  .header-inner { padding-top: 9px; padding-bottom: 9px; }
  main { padding-top: 19px; }
  .hero { min-height: 218px; border-radius: 22px; }
  .hero-content { padding: 23px 0 23px 20px; width: 71%; }
  .hero h1 { font-size: clamp(1.68rem,7.4vw,2.6rem); }
  .hero p { font-size: .84rem; max-width: 235px; }
  .hero-kicker { font-size: .71rem; }
  .illustration { width: 31%; }
  .sheet { scale: .61; right: 7%; transform-origin: right top; }
  .illustration-lock { scale: .65; right: 2%; top: 53%; }
  .actions { grid-template-columns: 1fr; gap: 8px; }
  .action { min-height: 54px; }
  .start-section { margin-top: 20px; }
}
