/* ─── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3250;
  --accent:    #7c6af7;
  --accent2:   #f97316;
  --text:      #e8eaf0;
  --muted:     #8b90a8;
  --radius:    14px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  height: 60px;
  background: rgba(15,17,23,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 1.2rem; font-weight: 800;
  text-decoration: none; color: var(--text);
  display: flex; align-items: center; gap: .4rem;
  cursor: pointer;
}
.nav-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }

.nav-links { display: flex; gap: .4rem; flex-wrap: wrap; }

.nav-pill {
  background: none; border: 1px solid var(--border);
  color: var(--muted); border-radius: 99px;
  padding: .3rem .85rem; font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: all .2s;
  text-decoration: none; display: inline-block;
}
.nav-pill:hover, .nav-pill.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

/* ─── Pages ─────────────────────────────────────────────────────────────── */
.page { display: none; flex: 1; }
.page.active { display: block; }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.15; }
.gradient-text {
  background: linear-gradient(135deg, var(--accent), #e879f9);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--muted); margin-top: .75rem; font-size: 1.1rem; }

/* ─── Tools Grid ─────────────────────────────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  cursor: pointer;
  text-decoration: none; color: inherit;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  display: flex; flex-direction: column; gap: .75rem;
}
.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(124,106,247,.2);
}

.tool-card .icon {
  font-size: 2.4rem;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border-radius: 12px;
}
.tool-card h3 { font-size: 1.05rem; font-weight: 700; }
.tool-card p  { color: var(--muted); font-size: .88rem; line-height: 1.55; }

.btn-open {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-size: .82rem; font-weight: 600; border: none; cursor: pointer;
  align-self: flex-start; transition: opacity .2s;
}
.btn-open:hover { opacity: .85; }

/* ─── Tool Pages ─────────────────────────────────────────────────────────── */
.tool-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.tool-header {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 2rem;
}
.tool-header .icon { font-size: 2rem; }
.tool-header h2 { font-size: 1.7rem; font-weight: 800; }
.tool-header p   { color: var(--muted); font-size: .92rem; margin-top: .2rem; }

.back-btn {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); padding: .4rem .9rem; border-radius: 8px;
  font-size: .82rem; cursor: pointer; margin-bottom: 2rem;
  display: inline-block;
  transition: color .2s, border-color .2s;
}
.back-btn:hover { color: var(--text); border-color: var(--muted); }

/* ─── Card Container ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ─── Inputs / Buttons ───────────────────────────────────────────────────── */
input[type="text"], input[type="date"], textarea, select {
  width: 100%; padding: .7rem 1rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-size: .95rem;
  font-family: inherit; transition: border-color .2s;
}
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus { outline: none; border-color: var(--accent); }

textarea { resize: vertical; }

.btn {
  padding: .65rem 1.4rem; border-radius: 9px;
  font-weight: 600; font-size: .92rem; cursor: pointer;
  border: none; transition: opacity .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--surface2); border: 1px solid var(--border); color: var(--text); }
.btn:hover { opacity: .85; }

.btn-group { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }

/* ─── ═══ PICKER WHEEL ═══ ──────────────────────────────────────────────── */
#wheelWrap {
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
}

#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--surface2), 0 0 0 8px var(--border), var(--shadow);
  cursor: pointer;
  max-width: 100%;
  touch-action: none;
}

.wheel-pointer {
  width: 0; height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 28px solid #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}

.wheel-result {
  text-align: center;
  font-size: 1.5rem; font-weight: 700;
  min-height: 2.2rem;
  color: var(--accent);
}

.entries-area { width: 100%; }
.entries-area label { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; display: block; }
.entries-area textarea { min-height: 130px; }
.entries-chips {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem;
}
.chip {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; padding: .25rem .75rem;
  font-size: .8rem; display: flex; align-items: center; gap: .4rem;
}
.chip button {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: .9rem; padding: 0; line-height: 1;
}
.chip button:hover { color: #f87171; }

/* ─── ═══ FONT GENERATOR ═══ ─────────────────────────────────────────────── */
.font-output-list { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }

.font-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: .65rem 1rem;
}
.font-row .label { font-size: .72rem; color: var(--muted); min-width: 100px; }
.font-row .preview { font-size: 1.1rem; flex: 1; word-break: break-all; }
.copy-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); padding: .3rem .7rem; border-radius: 7px;
  font-size: .75rem; cursor: pointer; white-space: nowrap; transition: all .2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.copied { border-color: #4ade80; color: #4ade80; }

/* ─── ═══ WORD COUNTER ═══ ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .8rem; margin-top: 1.2rem;
}
.stat-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 1rem;
  text-align: center;
}
.stat-box .val { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat-box .lbl { font-size: .78rem; color: var(--muted); margin-top: .2rem; }

.reading-time { color: var(--muted); font-size: .88rem; margin-top: .8rem; }

/* ─── ═══ QR CODE ═══ ──────────────────────────────────────────────────── */
#qrOutput {
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
  margin-top: 1.2rem;
}
#qrcode canvas, #qrcode img {
  border-radius: 10px;
  padding: 16px; background: #fff;
}

/* ─── ═══ AGE CALCULATOR ═══ ─────────────────────────────────────────────── */
.age-result {
  display: flex; flex-direction: column; gap: .8rem; margin-top: 1.2rem;
}
.age-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: .75rem 1.1rem;
}
.age-row .age-lbl { color: var(--muted); font-size: .9rem; }
.age-row .age-val { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

.birthday-msg {
  text-align: center; font-size: 1.1rem; font-weight: 600;
  color: #f97316; margin-top: .5rem;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer {
  text-align: center; padding: 1.5rem;
  color: var(--muted); font-size: .8rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ─── Word Counter Layout ────────────────────────────────────────────────── */
.wc-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.platform-limits {
  width: 220px;
  flex-shrink: 0;
  padding: 1.1rem 1rem;
}

.limit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.limit-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  padding: .35rem .6rem;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: background .2s, border-color .2s;
}

.limit-list li.limit-warn {
  background: rgba(249,115,22,.12);
  border-color: #f97316;
}

.limit-list li.limit-over {
  background: rgba(239,68,68,.15);
  border-color: #ef4444;
}

.plat-name { color: var(--muted); }
.plat-limit { font-weight: 600; color: var(--text); white-space: nowrap; }
.plat-used { color: var(--accent); }

.limit-list li.limit-warn .plat-used { color: #f97316; }
.limit-list li.limit-over  .plat-used { color: #ef4444; }

@media (max-width: 700px) {
  .wc-layout { flex-direction: column; }
  .platform-limits { width: 100%; }
}

/* ─── FAQ Section ────────────────────────────────────────────────────────── */
.faq-section {
  margin-top: 1.5rem;
}

.faq-item {
  padding: .9rem 0;
  border-bottom: 1px solid var(--border);
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .4rem;
  color: var(--text);
}

.faq-item p {
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── Footer cross-links ─────────────────────────────────────────────────── */
.footer a {
  color: var(--accent);
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ─── Ad Slots ───────────────────────────────────────────────────────────── */
.ad-slot {
  display: block;
  width: 100%;
  max-width: 728px;
  margin: 1.5rem auto;
  text-align: center;
  overflow: hidden;
  min-height: 0;        /* never reserves space before AdSense fills it */
}
.ad-slot ins {
  display: block;
  min-height: 0;
}
/* Only show the slot once AdSense has written content */
.ad-slot:empty,
.ad-slot ins:not([data-ad-status="filled"]) {
  min-height: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}
@media (max-width: 640px) {
  .ad-slot {
    max-width: 100%;
    margin: 1rem auto;
  }
}

/* ─── Use-Case Grid (Picker Wheel) ──────────────────────────────────────── */
.use-case-section {
  margin-top: 1.25rem;
}

.use-case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}

.use-case-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.use-case-item span { font-size: 1.3rem; line-height: 1; }
.use-case-item strong { font-size: .85rem; font-weight: 700; color: var(--text); }
.use-case-item p { font-size: .78rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* ─── Use-Case Chips (Font Generator / QR Code) ──────────────────────────── */
.use-case-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1rem 0 .5rem;
}

.use-case-chips span {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .3rem .75rem;
  font-size: .78rem;
  color: var(--muted);
  cursor: default;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}

.use-case-chips span[onclick] { cursor: pointer; }
.use-case-chips span:hover { border-color: var(--accent); color: var(--text); }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.mt-1 { margin-top: .4rem; }
.mt-2 { margin-top: .8rem; }
.mt-3 { margin-top: 1.2rem; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .85rem; }

/* ─── Hamburger Menu ─────────────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  z-index: 200;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Navbar */
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    background: rgba(15,17,23,.97);
    backdrop-filter: blur(16px);
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 1.25rem 1.5rem;
    gap: .5rem;
    border-bottom: 1px solid var(--border);
    z-index: 150;
  }
  .nav-links.open { display: flex; }

  .nav-pill {
    text-align: center;
    padding: .7rem 1rem;
    font-size: .9rem;
  }

  /* Hero */
  .hero { padding: 1.75rem 1.25rem .75rem; }
  .hero h1 { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .hero-sub { font-size: .95rem; }

  /* Tools grid — single column on very small, 2-col on normal mobile */
  .tools-grid {
    grid-template-columns: 1fr;
    gap: .75rem;
    padding: .75rem 1rem 3rem;
  }

  /* Tool cards — full info visible, just more compact */
  .tool-card {
    padding: 1rem 1.1rem;
    flex-direction: row;
    align-items: center;
    gap: .9rem;
  }
  .tool-card .icon {
    font-size: 1.8rem;
    width: 46px; height: 46px;
    flex-shrink: 0;
  }
  .tool-card h3 { font-size: .95rem; }
  .tool-card p  { display: block; font-size: .8rem; color: var(--muted); }
  .btn-open { font-size: .75rem; padding: .35rem .7rem; align-self: flex-start; }

  /* Tool pages */
  .tool-page { padding: 1.5rem 1rem 4rem; }
  .tool-header { flex-wrap: wrap; gap: .6rem; margin-bottom: 1.25rem; }
  .tool-header h2, .tool-header h1 { font-size: 1.35rem; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Footer */
  .footer { font-size: .75rem; padding: 1.25rem 1rem; line-height: 1.8; }
  .footer p:first-child { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem .6rem; }
  .footer a { white-space: nowrap; }
}
