:root {
  --primary: #155eef;
  --primary-dark: #0b4dd8;
  --primary-soft: #eff4ff;
  --ink: #101828;
  --text: #344054;
  --muted: #667085;
  --border: #dfe4ec;
  --border-light: #eaecf0;
  --surface: #ffffff;
  --background: #f7f9fc;
  --success: #12a150;
  --success-soft: #ecfdf3;
  --warning: #d97706;
  --warning-soft: #fff7e8;
  --danger: #d92d20;
  --danger-soft: #fff1f0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 12px 32px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 70px rgba(16, 24, 40, 0.12);
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--surface); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { display: block; fill: currentColor; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 999; transform: translateY(-150%); padding: 10px 16px; border-radius: 10px; color: #fff; background: var(--ink); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; min-height: 76px; padding: 0 clamp(20px, 4vw, 68px); border-bottom: 1px solid rgba(223, 228, 236, .82); background: rgba(255,255,255,.92); backdrop-filter: blur(18px); box-shadow: var(--shadow-sm); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 25px; font-weight: 800; letter-spacing: -.04em; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; color: var(--primary); fill: currentColor; }
.brand-mark .brand-mark-cut { fill: #fff; }
.primary-nav { display: flex; align-items: center; gap: 34px; margin-left: auto; margin-right: 32px; font-weight: 600; color: #344054; }
.primary-nav a { padding: 10px 0; transition: color .2s ease; }
.primary-nav a:hover { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 12px; }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 700; line-height: 1.1; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:focus-visible, .input-tab:focus-visible, .icon-button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(21, 94, 239, .2); outline-offset: 2px; }
.button svg { width: 20px; height: 20px; }
.button-primary { color: #fff; background: var(--primary); box-shadow: 0 8px 20px rgba(21, 94, 239, .22); }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 10px 24px rgba(21, 94, 239, .28); }
.button-secondary { color: var(--ink); border-color: #cfd6e2; background: #fff; box-shadow: var(--shadow-sm); }
.button-secondary:hover:not(:disabled) { border-color: #98a2b3; background: #f9fafb; }
.button-ghost { color: var(--ink); border-color: var(--border); background: #fff; }
.button-large { min-height: 54px; padding: 14px 24px; border-radius: 12px; font-size: 16px; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.github-button svg { width: 21px; height: 21px; }

.section-shell { width: min(1440px, calc(100% - 48px)); margin-inline: auto; }
.hero { display: grid; grid-template-columns: minmax(380px, .86fr) minmax(540px, 1.14fr); gap: clamp(38px, 5vw, 78px); align-items: center; padding-block: clamp(62px, 8vw, 112px) 56px; }
.hero-copy { max-width: 650px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow span { width: 28px; height: 2px; background: currentColor; }
h1 { max-width: 700px; margin: 0; color: var(--ink); font-size: clamp(46px, 5.6vw, 78px); line-height: .98; letter-spacing: -.055em; }
.hero-description { max-width: 620px; margin: 26px 0 30px; color: var(--muted); font-size: clamp(17px, 1.6vw, 21px); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.trust-row span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--border-light); border-radius: 9px; color: #475467; background: #fff; font-size: 13px; font-weight: 650; box-shadow: var(--shadow-sm); }
.trust-row svg { width: 17px; height: 17px; color: var(--primary); }

.preview-card { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); box-shadow: var(--shadow-lg); overflow: hidden; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--border-light); }
.preview-tab { display: inline-flex; align-items: center; gap: 8px; color: var(--primary); font-weight: 750; }
.preview-tab svg { width: 20px; height: 20px; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border-light); border-radius: 9px; color: var(--muted); background: #fff; cursor: pointer; }
.icon-button:hover { color: var(--primary); border-color: #b7c7ef; }
.icon-button svg { width: 20px; height: 20px; }
.canvas-wrap { position: relative; min-height: 510px; background: radial-gradient(circle at 50% 28%, #fff 0 26%, #f5f7fb 70%, #eef1f6 100%); overflow: hidden; }
#preview-canvas { display: block; width: 100%; height: 100%; min-height: 510px; touch-action: none; cursor: grab; }
#preview-canvas:active { cursor: grabbing; }
.preview-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; color: var(--muted); pointer-events: none; }
.preview-empty svg { width: 72px; height: 72px; color: #c4cbd7; }
.preview-empty strong { color: var(--text); font-size: 17px; }
.preview-empty span { font-size: 14px; }
.preview-dimension { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 9px 16px; border: 1px solid rgba(152, 162, 179, .35); border-radius: 999px; background: rgba(255,255,255,.88); box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); color: #475467; font-size: 14px; font-weight: 750; }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border-light); background: #fff; }
.preview-stats > div { display: flex; align-items: center; gap: 10px; min-height: 82px; padding: 16px 18px; border-right: 1px solid var(--border-light); }
.preview-stats > div:last-child { border-right: 0; }
.preview-stats span:last-child { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; }
.preview-stats strong { color: var(--ink); font-size: 14px; }
.stat-icon { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 9px; }
.stat-icon svg { width: 19px; height: 19px; }
.stat-icon.blue { color: #155eef; background: #eff4ff; }
.stat-icon.purple { color: #7f56d9; background: #f4f0ff; }
.stat-icon.green { color: #039855; background: #ecfdf3; }

.generator-section { padding-block: 76px; }
.section-heading { max-width: 700px; margin-bottom: 32px; }
.section-heading h2 { margin: 0 0 12px; color: var(--ink); font-size: clamp(32px, 4vw, 48px); letter-spacing: -.04em; }
.section-heading > p:last-child { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }
.section-heading.centered { margin-inline: auto; text-align: center; }
.section-heading.centered .eyebrow { justify-content: center; }
.generator-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 28px; align-items: start; }
.generator-card, .print-guide { border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-md); }
.generator-card { padding: 0 28px 28px; overflow: hidden; }
.input-tabs { display: flex; gap: 4px; margin-inline: -28px; margin-bottom: 26px; padding: 0 22px; border-bottom: 1px solid var(--border-light); overflow-x: auto; }
.input-tab { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 58px; padding: 0 15px; border: 0; color: var(--muted); background: transparent; font-weight: 750; cursor: pointer; }
.input-tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: transparent; }
.input-tab.is-active { color: var(--primary); }
.input-tab.is-active::after { background: var(--primary); }
.input-tab svg { width: 19px; height: 19px; }
.tab-panel label, .field-grid label { display: block; margin-bottom: 7px; color: #344054; font-size: 13px; font-weight: 750; }
input, select { width: 100%; height: 44px; border: 1px solid #cfd6e2; border-radius: 9px; padding: 0 12px; color: var(--ink); background: #fff; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .03); transition: border-color .18s ease, box-shadow .18s ease; }
input:hover, select:hover { border-color: #98a2b3; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(21, 94, 239, .1); outline: 0; }
.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 42px; }
.input-with-icon svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--muted); pointer-events: none; }
.field-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; gap: 18px; }
.field-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid .full-width { grid-column: 1 / -1; }
.checkbox-field { display: flex !important; align-items: center; gap: 9px; margin: 0 !important; cursor: pointer; }
.checkbox-field input { width: 18px; height: 18px; margin: 0; }
.upload-zone { display: flex !important; min-height: 190px; flex-direction: column; align-items: center; justify-content: center; gap: 8px; margin: 0 !important; border: 1.5px dashed #b9c2d0; border-radius: 13px; color: var(--muted) !important; background: #fafbfc; cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--primary); background: var(--primary-soft); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-zone svg { width: 42px; height: 42px; color: var(--primary); }
.upload-zone strong { color: var(--ink); font-size: 15px; }
.upload-zone span { font-size: 12px; }
.uploaded-file { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 11px 13px; border-radius: 9px; background: var(--primary-soft); font-size: 13px; }
.uploaded-file button { border: 0; color: var(--primary); background: transparent; font-weight: 750; cursor: pointer; }
.form-divider { height: 1px; margin: 26px 0; background: var(--border-light); }
.settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.number-field { position: relative; }
.number-field input { padding-right: 45px; }
.number-field span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.status-message { display: flex; align-items: flex-start; gap: 10px; margin-top: 22px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.status-message svg { flex: 0 0 auto; width: 19px; height: 19px; }
.status-message.info { color: #175cd3; background: #eff8ff; }
.status-message.success { color: #027a48; background: var(--success-soft); }
.status-message.warning { color: #b54708; background: var(--warning-soft); }
.status-message.error { color: #b42318; background: var(--danger-soft); }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; border: 1px solid var(--border-light); border-radius: 10px; background: #f9fafb; overflow: hidden; }
.metric-strip span { display: flex; flex-direction: column; gap: 3px; padding: 11px 13px; border-right: 1px solid var(--border-light); color: var(--muted); font-size: 11px; }
.metric-strip span:last-child { border-right: 0; }
.metric-strip strong { color: var(--ink); font-size: 13px; }
.metric-strip strong.good { color: var(--success); }
.metric-strip strong.warning { color: var(--warning); }
.metric-strip strong.poor { color: var(--danger); }
.generator-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.generator-actions .button-primary { margin-right: auto; }

.print-guide { position: sticky; top: 96px; padding: 24px; }
.guide-header { display: flex; align-items: center; gap: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.guide-header > span { display: grid; flex: 0 0 auto; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--primary); background: var(--primary-soft); }
.guide-header svg { width: 24px; height: 24px; }
.guide-header h3 { margin: 0 0 4px; color: var(--ink); font-size: 17px; }
.guide-header p { margin: 0; color: var(--muted); font-size: 12px; }
.print-guide dl { margin: 8px 0 0; }
.print-guide dl > div { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--border-light); }
.print-guide dt { color: var(--muted); font-size: 13px; }
.print-guide dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 750; text-align: right; }
.guide-tip { display: flex; gap: 10px; margin-top: 18px; padding: 13px; border-radius: 10px; color: #6941c6; background: #f4f0ff; }
.guide-tip svg { flex: 0 0 auto; width: 20px; height: 20px; }
.guide-tip p { margin: 0; font-size: 12px; line-height: 1.5; }

.feature-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-block: 18px 72px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-md); }
.feature-strip article { display: flex; align-items: flex-start; gap: 16px; min-height: 148px; padding: 29px; border-right: 1px solid var(--border-light); }
.feature-strip article:last-child { border-right: 0; }
.feature-strip h2 { margin: 2px 0 8px; color: var(--ink); font-size: 18px; }
.feature-strip p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.feature-icon { display: grid; flex: 0 0 auto; place-items: center; width: 48px; height: 48px; border-radius: 13px; }
.feature-icon svg { width: 28px; height: 28px; }
.feature-icon.blue { color: #155eef; background: #eff4ff; }
.feature-icon.cyan { color: #0086c9; background: #e9f8ff; }
.feature-icon.purple { color: #7f56d9; background: #f4f0ff; }

.content-section { padding-block: 76px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.steps-grid article { padding: 28px; border: 1px solid var(--border-light); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.steps-grid article > span { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 22px; border-radius: 11px; color: #fff; background: var(--primary); font-weight: 800; }
.steps-grid h3 { margin: 0 0 8px; color: var(--ink); font-size: 19px; }
.steps-grid p { margin: 0; color: var(--muted); line-height: 1.6; }
.faq-section { padding-bottom: 110px; }
.faq-list { max-width: 850px; margin-inline: auto; border-top: 1px solid var(--border); }
.faq-list details { border-bottom: 1px solid var(--border); }
.faq-list summary { position: relative; padding: 22px 42px 22px 0; color: var(--ink); font-weight: 750; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--primary); font-size: 24px; font-weight: 400; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details p { margin: -6px 50px 22px 0; color: var(--muted); line-height: 1.65; }
.site-footer { display: grid; min-height: 84px; place-items: center; border-top: 1px solid var(--border-light); color: var(--muted); background: #fbfcfe; font-size: 13px; }

.app-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 18px; box-shadow: var(--shadow-lg); }
.app-dialog::backdrop { background: rgba(16, 24, 40, .48); backdrop-filter: blur(3px); }
.dialog-content { display: flex; flex-direction: column; align-items: center; padding: 30px; text-align: center; }
.dialog-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: var(--danger); background: var(--danger-soft); }
.dialog-icon svg { width: 28px; height: 28px; }
.dialog-content h2 { margin: 17px 0 8px; color: var(--ink); font-size: 21px; }
.dialog-content p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }

@media (max-width: 1120px) {
  .primary-nav { display: none; }
  .header-actions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { max-width: 820px; }
  .preview-card { max-width: 900px; width: 100%; }
  .generator-layout { grid-template-columns: minmax(0, 1fr) 310px; }
  .preview-stats > div { padding-inline: 13px; }
}

@media (max-width: 860px) {
  .section-shell { width: min(100% - 32px, 760px); }
  .site-header { min-height: 68px; padding-inline: 16px; }
  .brand { font-size: 21px; }
  .brand-mark { width: 30px; height: 30px; }
  .github-button span { display: none; }
  .github-button { width: 42px; padding: 9px; }
  .header-cta { padding-inline: 14px; font-size: 13px; }
  .hero { padding-top: 58px; }
  .generator-layout { grid-template-columns: 1fr; }
  .print-guide { position: static; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature-strip article { min-height: auto; border-right: 0; border-bottom: 1px solid var(--border-light); }
  .feature-strip article:last-child { border-bottom: 0; }
  .steps-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .section-shell { width: min(100% - 24px, 560px); }
  .site-header { min-height: 62px; }
  .brand { gap: 8px; font-size: 19px; }
  .brand-mark { width: 28px; height: 28px; }
  .header-actions { gap: 7px; }
  .header-cta { min-height: 39px; padding: 9px 11px; font-size: 12px; }
  .github-button { min-height: 39px; width: 39px; }
  h1 { font-size: clamp(42px, 14vw, 60px); }
  .hero-description { margin-block: 20px 24px; font-size: 17px; }
  .hero-actions .button { width: 100%; }
  .trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .trust-row span { justify-content: center; padding-inline: 5px; font-size: 10px; white-space: nowrap; }
  .trust-row svg { width: 14px; height: 14px; }
  .canvas-wrap, #preview-canvas { min-height: 390px; }
  .preview-stats { grid-template-columns: 1fr; }
  .preview-stats > div { min-height: 58px; border-right: 0; border-bottom: 1px solid var(--border-light); }
  .preview-stats > div:last-child { border-bottom: 0; }
  .generator-section { padding-block: 58px; }
  .generator-card { padding: 0 16px 20px; }
  .input-tabs { margin-inline: -16px; padding-inline: 8px; }
  .input-tab { padding-inline: 10px; font-size: 13px; }
  .field-grid.two-columns, .settings-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid > div:nth-child(4) { grid-column: 1 / -1; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric-strip span:nth-child(2) { border-right: 0; }
  .metric-strip span:nth-child(-n+2) { border-bottom: 1px solid var(--border-light); }
  .generator-actions .button { flex: 1 1 calc(50% - 5px); }
  .generator-actions .button-primary { flex-basis: 100%; margin: 0; }
  .feature-strip article { padding: 22px 18px; }
  .content-section { padding-block: 58px; }
  .faq-section { padding-bottom: 76px; }
}

@media (max-width: 390px) {
  .header-cta { display: none; }
  .field-grid.two-columns, .settings-grid { grid-template-columns: 1fr; }
  .settings-grid > div:nth-child(4) { grid-column: auto; }
  .trust-row { grid-template-columns: 1fr; }
  .generator-actions .button { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
