:root {
  --bg: #0b0d12;
  --bg-2: #12151d;
  --card: rgba(255, 255, 255, 0.04);
  --fg: #f4f4f5;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #f97316;
  --accent-2: #a855f7;
  --accent-3: #06b6d4;
  --danger: #f87171;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: radial-gradient(60vw 40vw at 0% 0%, rgba(249, 115, 22, 0.16), transparent 60%),
              radial-gradient(50vw 40vw at 100% 100%, rgba(168, 85, 247, 0.16), transparent 60%),
              var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.tiny { font-size: 0.85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: inline-block; vertical-align: bottom; }
.inline { display: inline; }
.danger { color: var(--danger); }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.main { flex: 1; padding: 2rem 1.25rem 4rem; }

.nav { border-bottom: 1px solid var(--border); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10; background: rgba(11, 13, 18, 0.7); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; text-decoration: none; font-size: 1.1rem; }
.brand-mark { width: 22px; height: 22px; background: url('/assets/img/mark.svg') center / contain no-repeat; }
.nav-links { display: flex; align-items: center; gap: 1.1rem; font-size: 0.95rem; }
.nav-links a, .nav-links .btn, .nav-links .link { white-space: nowrap; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--fg); }
.nav-links a.btn-primary, .nav-links a.btn-primary:hover { color: #111; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: var(--fg); }

.footer { border-top: 1px solid var(--border); padding: 1.25rem 0; font-size: 0.85rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.footer a { color: var(--muted); text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.1rem; border-radius: 10px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06); color: var(--fg); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: transform 0.1s, background 0.15s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #fb923c); border-color: transparent; color: #111; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), #fb923c); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-lg { padding: 0.85rem 1.6rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; margin: 0.75rem 0; }

.pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; }
.pill-pro { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.eyebrow { display: inline-block; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 0.75rem; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.alert { padding: 0.8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.05); }
.alert-success { border-color: rgba(34, 197, 94, 0.5); background: rgba(34, 197, 94, 0.12); }
.alert-error { border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.12); }
.alert-info { border-color: rgba(6, 182, 212, 0.5); background: rgba(6, 182, 212, 0.12); }

.hero { text-align: center; padding: 2.5rem 0 2rem; }
.hero-sm { padding: 1.5rem 0 1rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 44rem; margin: 0 auto 1rem; }

/* Forms */
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.9rem; }
label > input, label > textarea, label > select, .prefixed {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.6rem 0.75rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--fg); font: inherit; font-weight: 400;
}
label > input:focus, label > textarea:focus, label > select:focus { outline: 2px solid rgba(249, 115, 22, 0.5); border-color: var(--accent); }

/* Visible keyboard focus for everything else: links, buttons, tabs, summary. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; padding: 0.6rem 1rem; background: var(--bg-2); color: var(--fg); border: 1px solid var(--accent); border-radius: 0 0 8px 0; text-decoration: none; }
.skip-link:focus { left: 0; }
main:focus { outline: none; }
label > input[type="color"] { height: 42px; padding: 0.2rem; cursor: pointer; }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0.75rem; }
/* Let wide inputs (datetime-local) shrink instead of pushing the grid past the screen. */
.row2 > *, .row3 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 0.35rem; }
/* Space between a form's button and whatever follows the form, a button and text below it, and stacked buttons. */
form.stack:not(:last-child) { margin-bottom: 1.25rem; }
.btn + p { margin-top: 0.75rem; }
.stack .btn + .btn { margin-top: 0.4rem; }
.prefixed { display: flex; align-items: center; padding: 0; overflow: hidden; }
.prefixed span { padding: 0.6rem 0 0.6rem 0.75rem; color: var(--muted); white-space: nowrap; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.prefixed input { border: 0; background: transparent; color: var(--fg); font: inherit; padding: 0.6rem 0.75rem 0.6rem 0.1rem; flex: 1; min-width: 0; }
.prefixed input:focus { outline: none; }
.prefixed:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* Generator */
.gen-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: start; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.tab { padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer; }
.tab.active { background: var(--fg); color: #111; border-color: var(--fg); font-weight: 600; }
.options { margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.gen-preview { text-align: center; position: sticky; top: 80px; }
.qr-frame { display: inline-block; background: #fff; padding: 12px; border-radius: 12px; line-height: 0; margin: 0 auto 0.5rem; }
.qr-frame canvas { max-width: 100%; height: auto; display: block; }
.qr-empty { width: 256px; max-width: 100%; height: 256px; display: flex; align-items: center; justify-content: center; color: #666; font-size: 14px; line-height: 1.4; text-align: center; padding: 1rem; }
.gen-note { margin: -0.25rem 0 0.9rem; color: var(--muted); overflow-wrap: anywhere; }
.gen-note-error { color: var(--danger); }
.gen-note-warn { color: #fbbf24; }

/* Features / FAQ */
.features { padding: 3.5rem 0 1rem; }
.section-head { text-align: center; margin-bottom: 2rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.feature p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.faq { max-width: 44rem; margin: 2rem auto 0; }
.faq h2 { text-align: center; margin-bottom: 1rem; }
details { border-bottom: 1px solid var(--border); padding: 0.75rem 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 0.5rem 0 0; }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); justify-content: center; gap: 1.25rem; margin: 1.5rem 0; }
.plan { position: relative; }
.plan-pro { border-color: rgba(249, 115, 22, 0.6); box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25), 0 20px 60px -30px rgba(249, 115, 22, 0.6); }
.plan .pill { position: absolute; top: -0.7rem; right: 1rem; }
.price { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.03em; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 500; }
.price-alt { color: var(--muted); font-size: 0.9rem; margin-top: -0.25rem; }
.checks { list-style: none; padding: 0; margin: 1.25rem 0; }
.checks li { padding: 0.35rem 0 0.35rem 1.6rem; position: relative; color: #d4d4d8; }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* Auth / small forms */
.auth { max-width: 440px; margin: 1.5rem auto; }
.auth.wide { max-width: 640px; }
.auth h1 { font-size: 1.75rem; }

/* Dashboard */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.9rem; }
.page-head .muted { margin: 0; }
.empty { text-align: center; padding: 3rem 1.5rem; }
.code-list { display: grid; gap: 0.75rem; }
.code-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1.25rem; align-items: center; text-decoration: none; padding: 1rem 1.25rem; transition: border-color 0.15s; }
.code-card:hover { border-color: rgba(255, 255, 255, 0.25); }
.code-thumb { background: #fff; border-radius: 8px; padding: 4px; line-height: 0; }
.code-thumb canvas { width: 88px; height: 88px; }
.code-meta { min-width: 0; }
.code-meta h3 { margin-bottom: 0.2rem; }
.code-meta .ellipsis { max-width: 100%; }
.code-stats { display: flex; gap: 1.5rem; text-align: right; }
.code-stats strong { display: block; font-size: 1.4rem; }
.code-stats span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Code show */
.grid-show { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1rem; margin-bottom: 1rem; }
.stats-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1rem; }
.stat-row { display: flex; gap: 2rem; }
.stat strong { display: block; font-size: 1.8rem; line-height: 1; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; margin: 1.25rem 0 1.5rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border); }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; min-width: 0; }
.bar span { display: block; background: linear-gradient(180deg, var(--accent), var(--accent-2)); border-radius: 3px 3px 0 0; min-height: 2px; }
.bar em { position: absolute; bottom: -1.2rem; left: 0; right: 0; text-align: center; font-size: 0.65rem; color: var(--muted); font-style: normal; }
.breakdowns { margin: 1rem 0; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table td, .table th { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.upsell { grid-column: span 2; background: rgba(249, 115, 22, 0.08); border: 1px dashed rgba(249, 115, 22, 0.5); border-radius: 10px; padding: 1rem; }

.prose { max-width: 44rem; margin: 0 auto; }
.prose h2 { font-size: 1.2rem; margin-top: 1.5rem; }
.prose p { color: #d4d4d8; }
.prose ul, .prose ol { color: #d4d4d8; padding-left: 1.25rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose strong { color: var(--fg); }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: rgba(255, 255, 255, 0.06); padding: 0.1rem 0.35rem; border-radius: 5px; overflow-wrap: anywhere; }
.prose pre { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 1rem; margin: 0 0 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose .table-wrap { margin: 0 0 1rem; }
.prose .table td { color: #d4d4d8; }

/* Guides */
.guide { margin-top: 2.5rem; }
.callout { background: rgba(249, 115, 22, 0.08); border: 1px dashed rgba(249, 115, 22, 0.5); border-radius: 10px; padding: 1rem 1.25rem; margin: 1.5rem 0; }
.callout p { margin-bottom: 0.75rem; }
.callout .btn-row { justify-content: flex-start; margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 2rem; }
.guide-links a.feature { display: block; text-decoration: none; transition: border-color 0.15s; }
.guide-links a.feature:hover { border-color: rgba(255, 255, 255, 0.25); }

/* Tools inside guide pages: print size calculator and QR scanner */
.tool { margin: 0 0 2rem; }
.tool h2:first-child { margin-top: 0; }
.calc-result { margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.calc-label { margin: 0; }
.calc-size { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.tool ul { margin-bottom: 0; }
.scan-drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; transition: border-color 0.15s, background 0.15s; }
.scan-drop.dragging { border-color: var(--accent); background: rgba(249, 115, 22, 0.06); }
.scan-drop p { margin: 0.75rem 0 0; }
.scan-drop .btn-row { margin: 0; }
.scan-drop label.btn { font-size: 1rem; margin: 0; }
.scan-drop label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.scan-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.scan-camera { margin-top: 1rem; text-align: center; }
.scan-camera video { width: 100%; max-width: 480px; border-radius: 10px; background: #000; display: block; margin: 0 auto 0.5rem; }
.scan-status { margin: 1rem 0 0; }
.scan-result { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.scan-type { font-weight: 700; color: var(--fg); }
.scan-fields th { width: 35%; text-transform: none; letter-spacing: 0; font-size: 0.85rem; vertical-align: top; }
.scan-fields td { overflow-wrap: anywhere; white-space: pre-wrap; }
.scan-raw-label { margin: 0.75rem 0 0.35rem; }
.prose pre.scan-raw { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 16rem; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88rem; color: var(--fg); margin-bottom: 0; }
.scan-result .btn-row { justify-content: flex-start; }

@media (max-width: 800px) {
  .gen-grid, .grid-show, .plans, .grid3, .grid2 { grid-template-columns: 1fr; }
  .gen-preview { position: static; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .code-card { grid-template-columns: auto 1fr; }
  .code-stats { grid-column: span 2; justify-content: flex-start; text-align: left; }
  .upsell { grid-column: auto; }
  .nav-links { gap: 0.75rem; font-size: 0.85rem; }
  .bar em { display: none; }
  .bar:nth-child(5n+1) em { display: block; }
}

@media (max-width: 560px) {
  .nav-inner { gap: 0.6rem; }
  .nav-links { gap: 0.7rem; font-size: 0.85rem; }
  .nav-links .nav-home { display: none; }
  .nav-links .btn-sm { padding: 0.4rem 0.7rem; }
  .row2-stack { grid-template-columns: 1fr; gap: 0; }
}

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