/* =============================================================
   QR3D — styles.css
   1. Tokens  2. Reset  3. Utils  4. Header  5. Hero/Tool
   6. Controls  7. Preview  8. Downloads  9. Ads
   10. Sections/FAQ/Footer  11. Responsive  12. Reduced-motion
   ============================================================= */

/* 1. Tokens ---------------------------------------------------- */
:root {
  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #eef1f8;
  --ink:       #171a26;
  --ink-soft:  #565c72;
  --line:      #e2e6f0;
  --line-2:    #d3d9e8;
  --accent:    #4f46e5;
  --accent-2:  #7c3aed;
  --accent-ink:#ffffff;
  --ok:        #0f9d58;
  --warn:      #c2410c;
  --warn-bg:   #fff2e8;
  --danger:    #dc2626;
  --danger-bg: #fdecec;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(20,24,45,.04), 0 12px 34px -18px rgba(20,24,45,.28);
  --shadow-sm: 0 1px 2px rgba(20,24,45,.05), 0 6px 16px -12px rgba(20,24,45,.3);
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", var(--sans);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0c0e17;
    --surface:   #151824;
    --surface-2: #1c2030;
    --ink:       #eef1f8;
    --ink-soft:  #a3aac2;
    --line:      #262b3d;
    --line-2:    #333a52;
    --accent:    #8b7dff;
    --accent-2:  #b191ff;
    --accent-ink:#0c0e17;
    --warn:      #fdba74;
    --warn-bg:   #2a1b0f;
    --danger:    #f87171;
    --danger-bg: #2a1414;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 18px 40px -20px rgba(0,0,0,.7);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 8px 20px -14px rgba(0,0,0,.7);
  }
}

/* 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
input, select { font: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; letter-spacing: -.02em; font-family: var(--display); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* 3. Utils ----------------------------------------------------- */
.wrap { width: min(1140px, 92vw); margin-inline: auto; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 9999;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* 4. Header ---------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; }
.brand b { color: var(--accent); }
.brand-mark { color: var(--accent); display: grid; place-items: center; }
.header-nav { display: flex; gap: 1.6rem; font-weight: 600; font-size: .95rem; color: var(--ink-soft); }
.header-nav a:hover { color: var(--ink); }

/* 5. Hero / Tool ---------------------------------------------- */
.hero { padding: clamp(1.8rem, 5vw, 3.4rem) 0 1.4rem; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5.4vw, 3.1rem); font-weight: 800; }
.hero-sub {
  max-width: 720px; margin: 1rem auto 0; color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
}
.hero-sub strong { color: var(--ink); }

.tool-card {
  margin-top: 1.8rem; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.7rem);
}
.tool-grid { display: grid; gap: clamp(1.2rem, 3vw, 2rem); grid-template-columns: 1fr; }

/* 6. Controls -------------------------------------------------- */
.controls { display: flex; flex-direction: column; gap: 1.35rem; min-width: 0; }
.field { display: flex; flex-direction: column; gap: .6rem; }
.field-label { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.mini-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-top: .5rem; }
.hint { font-size: .82rem; color: var(--ink-soft); }

.text-in {
  width: 100%; padding: .72rem .85rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.text-in::placeholder { color: color-mix(in srgb, var(--ink-soft) 75%, transparent); }
.text-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
select.text-in { appearance: none; cursor: pointer; }

.wifi-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-top: .3rem; }
.wifi-row > span { flex: 1 1 160px; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg { padding: .45rem 1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; color: var(--ink-soft); transition: all .2s var(--ease-out); }
.seg.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  padding: .5rem .95rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
  transition: all .18s var(--ease-out);
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.emoji-row .emoji-chip {
  width: 44px; height: 44px; font-size: 1.35rem; line-height: 1; display: grid; place-items: center;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  transition: all .18s var(--ease-out);
}
.emoji-chip:hover { border-color: var(--line-2); transform: translateY(-1px); }
.emoji-chip.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }

.color-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.color-pick { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.color-pick input[type=color] {
  -webkit-appearance: none; appearance: none; width: 46px; height: 40px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 10px; background: none; cursor: pointer;
}
.color-pick input[type=color]::-webkit-color-swatch-wrapper { padding: 4px; }
.color-pick input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }
.palette { display: flex; gap: .5rem; flex-wrap: wrap; }
.pal {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2);
  background: linear-gradient(135deg, var(--a) 0 50%, var(--b) 50% 100%);
  transition: transform .16s var(--ease-out);
}
.pal:hover { transform: translateY(-2px) scale(1.05); }

.center-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .2rem; }
.btn-file {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem;
  border-radius: var(--radius-sm); border: 1px dashed var(--line-2); font-weight: 600; font-size: .88rem;
  color: var(--ink-soft); transition: all .18s var(--ease-out);
}
.btn-file:hover { border-color: var(--accent); color: var(--ink); }
.link-btn { font-size: .85rem; font-weight: 600; color: var(--accent); text-decoration: underline; }

.format-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.format {
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  padding: .8rem .4rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .82rem;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
  transition: all .18s var(--ease-out); line-height: 1.2;
}
.format:hover { border-color: var(--line-2); color: var(--ink); }
.format.is-active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: var(--accent); color: var(--ink); }
.format-ico { width: 30px; height: 30px; color: var(--accent); }
.format-ico svg { width: 100%; height: 100%; }

/* 7. Preview --------------------------------------------------- */
.preview-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.preview-block { display: flex; flex-direction: column; gap: .5rem; }
.preview-tag { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.qr-preview {
  display: grid; place-items: center; padding: 1rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 180px;
}
.qr-preview canvas, .qr-preview svg { width: min(260px, 60vw) !important; height: auto !important; border-radius: 8px; }
.viewer3d {
  position: relative; aspect-ratio: 4 / 3; width: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, var(--surface-2)), var(--surface-2));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: grid; place-items: center; touch-action: none;
}
.viewer3d canvas { width: 100% !important; height: 100% !important; }
.viewer-msg { color: var(--ink-soft); font-size: .9rem; font-weight: 600; text-align: center; padding: 1rem; }
.module-info { font-size: .82rem; color: var(--ink-soft); }
.module-info b { color: var(--ink); }

.warnings:empty { display: none; }
.warnings { display: flex; flex-direction: column; gap: .5rem; }
.warn-item {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .6rem .75rem; border-radius: var(--radius-sm); font-size: .85rem; line-height: 1.4;
}
.warn-item.is-warn { background: var(--warn-bg); color: var(--warn); }
.warn-item.is-danger { background: var(--danger-bg); color: var(--danger); }
.warn-item.is-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.warn-item svg { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }

/* 8. Downloads ------------------------------------------------- */
.downloads { display: flex; flex-direction: column; gap: .7rem; margin-top: .2rem; }
.dl {
  border-radius: var(--radius-sm); font-weight: 700; transition: all .18s var(--ease-out);
  border: 1px solid var(--line-2);
}
.dl:disabled { opacity: .5; cursor: not-allowed; }
.dl-primary {
  display: flex; flex-direction: column; gap: 2px; padding: .9rem 1rem; text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 90%, transparent);
}
.dl-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 30px -12px color-mix(in srgb, var(--accent) 90%, transparent); }
.dl-title { font-size: 1.02rem; }
.dl-sub { font-size: .78rem; font-weight: 500; opacity: .9; }
.dl-secondary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.dl-sec { padding: .7rem .5rem; background: var(--surface-2); color: var(--ink); font-size: .9rem; }
.dl-sec:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.dl-note { font-size: .78rem; color: var(--ink-soft); }
.tool-card[data-state="busy"] .dl { pointer-events: none; opacity: .6; }

.privacy-badge {
  text-align: center; margin: 1.2rem auto 0; max-width: 640px;
  font-size: .9rem; color: var(--ink-soft); font-weight: 600;
}

/* 9. Ads ------------------------------------------------------- */
.ad-slot {
  display: grid; place-items: center; position: relative;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, color-mix(in srgb, var(--ink-soft) 5%, transparent) 12px, color-mix(in srgb, var(--ink-soft) 5%, transparent) 24px);
  color: var(--ink-soft);
}
.ad-slot > span { font-size: .72rem; font-weight: 800; letter-spacing: .18em; opacity: .55; }
.ad-leaderboard { min-height: 96px; margin: 1.4rem 0; }
.ad-incontent { min-height: 250px; margin: .5rem 0 1.5rem; }
.ad-rectangle { width: 100%; min-height: 250px; margin: .6rem 0; }

.ad-modal {
  border: none; border-radius: var(--radius); padding: 1.3rem; max-width: 360px; width: 92vw;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); position: fixed; inset: 0; margin: auto;
}
.ad-modal::backdrop { background: rgba(10,12,22,.55); backdrop-filter: blur(2px); }
.ad-modal-head { font-weight: 700; text-align: center; margin-bottom: .3rem; }
.ad-modal-close {
  position: absolute; top: .5rem; right: .6rem; width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.4rem; line-height: 1; color: var(--ink-soft); display: grid; place-items: center;
  background: var(--surface-2);
}
.ad-modal-close:hover { color: var(--ink); }
.ad-modal-continue {
  width: 100%; margin-top: .6rem; padding: .7rem; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}

.ad-toast {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 50; width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem .8rem .8rem; animation: toastIn .4s var(--ease-out);
}
.ad-toast-slot { min-height: 120px; width: 100%; }
.ad-toast-close {
  position: absolute; top: .35rem; right: .45rem; width: 26px; height: 26px; border-radius: 50%;
  font-size: 1.2rem; line-height: 1; color: var(--ink-soft); display: grid; place-items: center; background: var(--surface-2);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 10. Sections / FAQ / Footer --------------------------------- */
.section { padding: clamp(2.2rem, 6vw, 3.6rem) 0; }
.section h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; }
.section-lead { color: var(--ink-soft); margin-top: .5rem; max-width: 640px; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.6rem; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-sm);
}
.step-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); margin-bottom: .8rem; }
.step-ico svg { width: 24px; height: 24px; }
.step h3 { font-size: 1.1rem; font-family: var(--sans); font-weight: 700; }
.step p { color: var(--ink-soft); font-size: .95rem; margin-top: .35rem; }

.uses { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.6rem; }
.use {
  display: flex; gap: .9rem; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem;
}
.use-ico { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.use-ico svg { width: 22px; height: 22px; }
.use h3 { font-size: 1rem; font-family: var(--sans); font-weight: 700; }
.use p { color: var(--ink-soft); font-size: .9rem; margin-top: .2rem; }

.prose { max-width: 780px; }
.prose h2 { margin-bottom: 1rem; }
.prose p { margin-top: .9rem; color: var(--ink-soft); }
.prose strong { color: var(--ink); }

.faq { margin-top: 1.4rem; display: flex; flex-direction: column; gap: .6rem; }
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 1.1rem; overflow: hidden;
}
.faq summary {
  list-style: none; cursor: pointer; padding: 1rem 0; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--accent); transition: transform .2s var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 1.1rem; color: var(--ink-soft); font-size: .95rem; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; padding: 2.4rem 0 1.4rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1.6rem; flex-wrap: wrap; }
.footer-brand span { font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.footer-brand b { color: var(--accent); }
.footer-brand p { color: var(--ink-soft); font-size: .9rem; margin-top: .3rem; max-width: 320px; }
.footer-links { display: flex; gap: 1.4rem; font-weight: 600; color: var(--ink-soft); align-items: center; }
.footer-links a:hover { color: var(--ink); }
.footer-legal { color: var(--ink-soft); font-size: .78rem; margin-top: 1.6rem; opacity: .8; }

/* 11. Responsive ---------------------------------------------- */
@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .uses { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1.05fr 1fr; align-items: start; }
  .preview-col { position: sticky; top: 78px; }
  .uses { grid-template-columns: repeat(3, 1fr); }
}

/* 12. Reduced-motion ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ad-toast { animation: none; }
}
