:root {
  --bg: #ffffff;
  --text: #171717;
  --muted: #4d4d4d;
  --faint: #808080;
  --line: rgba(0, 0, 0, 0.08);
  --line-light: rgb(235, 235, 235);
  --surface: #fafafa;
  --accent: #0a72ef;
  --focus: hsla(212, 100%, 48%, 1);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-card: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, #fafafa 0px 0px 0px 1px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: var(--line) 0px 0px 0px 1px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--text);
  box-shadow: var(--line-light) 0px 0px 0px 1px;
}

.header-nav { display: flex; gap: 20px; }
.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.header-nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 64px 0 40px; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  background: #ebf5ff;
  color: #0068d6;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 16px;
}

.hero .accent { color: var(--accent); }

.hero-sub {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Tool ---------- */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding-bottom: 64px;
}

.tool-form { padding-top: 8px; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.input-row {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-md);
  box-shadow: var(--line) 0px 0px 0px 1px;
  background: var(--bg);
}

.input-row:focus-within {
  box-shadow: 0 0 0 2px var(--focus), var(--line) 0px 0px 0px 1px;
}

#qr-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 12px 14px;
  min-width: 0;
}

#qr-input::placeholder { color: var(--faint); }

.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.btn-ghost:hover { color: var(--text); background: var(--surface); }

.options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 0;
  border-radius: var(--radius-md);
  padding: 9px 10px;
  box-shadow: var(--line) 0px 0px 0px 1px;
  cursor: pointer;
}
select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

.hint { font-size: 12px; color: var(--faint); margin: 10px 0 0; }

.error {
  font-size: 13px;
  color: #c02626;
  background: #fff2f2;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin: 12px 0 0;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--text);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s ease;
}
.btn-primary:hover { opacity: 0.88; }

/* ---------- Result ---------- */
.tool-result { text-align: center; }

.qr-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  background: var(--bg);
  overflow: hidden;
}

#qr-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.qr-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--faint);
  background: var(--surface);
}
.qr-empty p { margin: 0; font-size: 14px; }

.payload-preview {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  max-height: 2.8em;
  overflow: hidden;
  margin: 14px auto 0;
  max-width: 380px;
}

.download-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-secondary {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--line-light) 0px 0px 0px 1px;
}
.btn-secondary:hover { background: var(--surface); }
.btn-secondary[href="#"] { opacity: .55; }

.share-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}
#share-url {
  width: 100%;
  margin-top: 8px;
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  box-shadow: var(--line) 0px 0px 0px 1px;
  border: 0;
  text-overflow: ellipsis;
}

/* ---------- Sections ---------- */
.section { padding: 24px 0 40px; }
.section h2 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ebf5ff;
  color: #0068d6;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

code {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

.faq-list details { padding: 0 20px; margin-bottom: 10px; }
.faq-list summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  padding: 14px 0;
  list-style: none;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '+';
  float: right;
  color: var(--faint);
  font-weight: 400;
}
.faq-list details[open] summary::after { content: '–'; }
.faq-list details p { margin: 0 0 14px; }

/* ---------- Footer ---------- */
.site-footer {
  box-shadow: var(--line) 0px 0px 0px 1px;
  padding: 22px 0;
  margin-top: 24px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--faint);
}
.footer-inner p { margin: 0; }
.mono {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tool { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .container { padding: 0 16px; }
  .hero { padding: 40px 0 28px; }
  .options { grid-template-columns: 1fr; }
  .header-nav { display: none; }
}
