/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #fdf7fb;
  --bg-alt: #f4ecf9;
  --card: #ffffff;
  --text: #362b40;
  --text-soft: #6f6079;
  --border: #ecdff2;

  --aesthetic: #b8a4e3;
  --aesthetic-bg: #f1ecfa;
  --cute: #f6a3c1;
  --cute-bg: #fdecf3;
  --cool: #5fd0c6;
  --cool-bg: #e6f9f6;

  --accent: #c79ce0;
  --accent-dark: #9b6fc4;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  --sans: "Nunito", system-ui, sans-serif;
  --display: "Quicksand", var(--sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #241b2c;
    --bg-alt: #2c2136;
    --card: #322640;
    --text: #f3ecfa;
    --text-soft: #c6b6d6;
    --border: #43334f;
    --aesthetic-bg: #3a2f4d;
    --cute-bg: #452f3d;
    --cool-bg: #263f3c;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; text-wrap: balance; line-height: 1.15; color: var(--text); }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--card); color: var(--text);
  z-index: 9999; border-radius: 8px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 960px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* =============================================================
   4. Header
   ============================================================= */
.site-header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--display); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .4rem; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--aesthetic), var(--cute), var(--cool)); display: inline-block; }
.header-tag { font-size: .85rem; color: var(--text-soft); display: none; }
@media (min-width: 720px) { .header-tag { display: block; } }

/* =============================================================
   5. Hero + tool card
   ============================================================= */
.hero { padding: 2rem 0 1rem; text-align: center; }
.hero h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); margin-bottom: .6rem; }
.hero p.subtitle { color: var(--text-soft); max-width: 46ch; margin-inline: auto; font-size: 1.02rem; }

.tool-section { padding-block: 1.25rem 2rem; }
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 12px 40px -20px rgba(120, 80, 160, .35);
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .4rem; }
.form-row input[type="text"] {
  width: 100%; padding: .8rem 1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg); font-size: 1rem; color: var(--text);
  transition: border-color .2s var(--ease-out);
}
.form-row input[type="text"]:focus { border-color: var(--accent-dark); outline: none; }
.hint { color: var(--text-soft); font-size: .82rem; margin-top: .35rem; }

.style-options { display: flex; flex-wrap: wrap; gap: .6rem; }
.style-check-wrap {
  position: relative;
}
.style-check { position: absolute; opacity: 0; width: 1px; height: 1px; }
.style-check-label {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--bg); font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: all .18s var(--ease-out);
}
.style-check:checked + .style-check-label { color: #fff; border-color: transparent; }
.style-check-wrap.aesthetic .style-check:checked + .style-check-label { background: var(--aesthetic); }
.style-check-wrap.cute .style-check:checked + .style-check-label { background: var(--cute); }
.style-check-wrap.cool .style-check:checked + .style-check-label { background: var(--cool); }
.style-check:focus-visible + .style-check-label { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.style-check-wrap.aesthetic .swatch { background: var(--aesthetic); }
.style-check-wrap.cute .swatch { background: var(--cute); }
.style-check-wrap.cool .swatch { background: var(--cool); }

.select-inline {
  padding: .6rem .9rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); font-size: .92rem; color: var(--text);
}

.tool-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.6rem; border-radius: 999px; font-weight: 700; font-size: 1rem;
  transition: transform .15s var(--ease-bounce), box-shadow .2s var(--ease-out), opacity .2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--aesthetic), var(--cute));
  color: #fff; box-shadow: 0 10px 24px -10px rgba(180, 120, 200, .6);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-secondary {
  background: var(--bg-alt); color: var(--text); border: 1.5px solid var(--border);
}
.btn-secondary:hover { transform: translateY(-2px); }

/* =============================================================
   6. Results grid
   ============================================================= */
.results-section { margin-top: 1.5rem; }
.results-empty, .favorites-empty { color: var(--text-soft); font-size: .92rem; padding: 1rem 0; }
.results-error {
  color: #a13b3b; background: #fdecec; border: 1.5px solid #f3c6c6;
  border-radius: var(--radius-sm); padding: .8rem 1rem; font-weight: 600;
}

.results-grid {
  display: grid; grid-template-columns: 1fr; gap: .7rem;
  margin-top: .5rem;
}
@media (min-width: 720px) { .results-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .results-grid { grid-template-columns: 1fr 1fr 1fr; } }

.results-grid.pop-in .uname-card { animation: cardIn .35s var(--ease-out) both; }
.results-grid.pop-in .uname-card:nth-child(2n) { animation-delay: .02s; }
.results-grid.pop-in .uname-card:nth-child(3n) { animation-delay: .04s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.uname-card {
  position: relative;
  display: flex; align-items: center; gap: .55rem;
  padding: .75rem .9rem; border-radius: var(--radius);
  background: var(--bg-alt); border: 1.5px solid var(--border);
}
.uname-card.style-aesthetic { background: var(--aesthetic-bg); }
.uname-card.style-cute { background: var(--cute-bg); }
.uname-card.style-cool { background: var(--cool-bg); }

.style-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.style-aesthetic .style-dot { background: var(--aesthetic); }
.style-cute .style-dot { background: var(--cute); }
.style-cool .style-dot { background: var(--cool); }

.uname-text { font-weight: 700; font-family: var(--display); flex: 1; overflow-wrap: anywhere; }
.style-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); display: none; }
@media (min-width: 540px) { .style-tag { display: inline; } }

.uname-actions { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }
.icon-btn {
  padding: .4rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 700;
  background: var(--card); border: 1.5px solid var(--border); transition: transform .15s var(--ease-bounce);
}
.icon-btn:hover { transform: translateY(-1px); }
.star-btn { font-size: 1.05rem; padding: .35rem .55rem; color: var(--text-soft); }
.star-btn.is-fav { color: #e0a52b; border-color: #f0d38a; background: #fff8e6; }

/* =============================================================
   7. Favorites panel
   ============================================================= */
.favorites-section {
  margin-top: 2rem; padding: 1.25rem; background: var(--card);
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
}
.favorites-title { display: flex; align-items: center; gap: .5rem; font-size: 1.1rem; margin-bottom: .75rem; }
.favorites-title .star-ico { color: #e0a52b; }
#favorites-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.fav-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .6rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--bg-alt);
  font-weight: 700; font-size: .88rem;
}
.fav-chip.style-aesthetic { background: var(--aesthetic-bg); }
.fav-chip.style-cute { background: var(--cute-bg); }
.fav-chip.style-cool { background: var(--cool-bg); }

/* =============================================================
   8. Privacy badge
   ============================================================= */
.privacy-badge {
  display: flex; align-items: center; gap: .5rem; margin-top: 1.25rem;
  font-size: .85rem; color: var(--text-soft);
}

/* =============================================================
   9. Ad slots (placeholders only)
   ============================================================= */
.ad-slot {
  border: 2px dashed #d8c6e6; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-weight: 700; letter-spacing: .06em; font-size: .85rem;
  background: repeating-linear-gradient(45deg, var(--bg-alt), var(--bg-alt) 10px, var(--bg) 10px, var(--bg) 20px);
}
.ad-slot--leaderboard { min-height: 90px; margin: 2rem auto; max-width: 960px; }
.ad-slot--incontent { min-height: 250px; margin: 2rem auto; max-width: 728px; }

.ad-popup {
  border: none; border-radius: var(--radius-lg); padding: 0; max-width: 380px; width: 90vw;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.4);
}
.ad-popup::backdrop { background: rgba(40, 25, 50, .45); backdrop-filter: blur(2px); }
.ad-popup-inner { padding: 1.5rem; text-align: center; }
.ad-popup-close {
  position: absolute; top: .6rem; right: .6rem; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-alt); font-size: 1.1rem; line-height: 1;
}
.ad-popup .ad-slot { min-height: 220px; margin: 1rem 0 0; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 40;
  background: var(--card); border: 2px dashed #d8c6e6; border-radius: var(--radius);
  padding: .7rem 2.2rem .7rem 1rem; max-width: 240px; font-size: .8rem; color: var(--text-soft);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.corner-ad.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.corner-ad strong { display: block; font-weight: 800; color: var(--text); margin-bottom: .15rem; }
.corner-ad-close {
  position: absolute; top: .4rem; right: .4rem; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-alt); font-size: .85rem; line-height: 1;
}

/* =============================================================
   10. Content sections (below the fold)
   ============================================================= */
.content-section { padding-block: 2rem; }
.content-section h2 { font-size: clamp(1.3rem, 3.5vw, 1.8rem); margin-bottom: 1rem; }
.content-section > p { color: var(--text-soft); max-width: 68ch; margin-bottom: 1rem; }
.content-section > p.center-text { max-width: none; margin-inline: 0; text-align: justify; text-align-last: left; }

.steps { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem;
}
.step .step-num {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--aesthetic), var(--cute)); color: #fff; font-weight: 800; margin-bottom: .75rem;
}
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-soft); font-size: .92rem; }

.usecases { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .usecases { grid-template-columns: repeat(5, 1fr); } }
.usecase {
  background: var(--bg-alt); border-radius: var(--radius); padding: 1rem .75rem; text-align: center;
  border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center;
}
.usecase .emoji, .usecase-icon {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin: 0 auto .4rem; font-size: 1.6rem; line-height: 1; flex-shrink: 0;
}
.usecase-icon svg { display: block; }
.usecase h3 { font-size: .92rem; margin-top: auto; }

.faq { max-width: 68ch; }
.faq details {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .9rem 1.1rem; margin-bottom: .6rem;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { color: var(--text-soft); margin-top: .6rem; font-size: .94rem; }

.more-tools-note { color: var(--text-soft); font-size: .9rem; }

/* =============================================================
   11. Footer
   ============================================================= */
.site-footer {
  border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: 1rem;
  color: var(--text-soft); font-size: .85rem;
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* =============================================================
   12. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .results-grid.pop-in .uname-card { animation: none; }
  .corner-ad { transition: none; }
}
