/* =====================================================================
 *  Anime Name Generator styles
 *  Dark-mode aesthetic, mobile-first, matches the existing
 *  gethandlenames.com palette (dark backgrounds, muted accents).
 *
 *  Drop these class names into your existing CSS layer, or import
 *  this file as-is — both will work.
 * ===================================================================== */

/* Self-hosted Quicksand. font-display:swap means text is immediately
   visible in the fallback font, then re-renders in Quicksand when
   the woff2 finishes loading — eliminates the FOIT (flash of invisible
   text) and the 460ms render-blocking chain from fonts.gstatic.com
   that PageSpeed Insights flagged as the #1 mobile bottleneck. */
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/quicksand-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/quicksand-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/quicksand-700.woff2') format('woff2');
}

:root {
  --bg-page:     #0e1014;
  --bg-card:     #181b22;
  --bg-soft:     #1f232c;
  --bg-input:    #11141a;
  --border:      #262a33;
  --border-soft: #1d2027;
  --text:        #e6e8ee;
  --text-muted:  #8a92a1;
  --text-dim:    #5d6470;
  /* Shared style guide: pink-500 (Tailwind). Used for all primary accents
     on the page (active tab underline, primary button bg, sub-tab bg, top
     nav active underline). Matches Handle's brand family without being a
     1:1 copy of its #ff2d55 — keeps a slightly more kawaii feel. */
  --accent:      #ec4899;
  --accent-2:    #ec4899;        /* unified: same as --accent (cyan was redundant) */
  --accent-soft: rgba(236, 72, 153, 0.18);
  --accent-warn: #ffb86b;
  --danger:      #ff6b6b;
  --radius:      12px;
  --radius-sm:   12px;           /* was 8px — aligned with Handle's 12px */
  --shadow:      0 1px 0 rgba(255,255,255,0.02) inset, 0 4px 24px rgba(0,0,0,0.4);
  /* Font stack: friendly rounded sans for Latin (Quicksand → Poppins → Inter),
     then the system Japanese stack (Hiragino / Yu Gothic / Meiryo) for
     proper kanji + kana rendering, then generic system-ui as the final
     fallback. Same family as Handle, plus the Japanese fallback that
     Handle doesn't need. */
  --font:        'Quicksand', 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont,
                  "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo",
                  system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* =====================================================================
 *  Hide platform-injected MiniMax Agent floating badge.
 *  The space.minimax.io preview environment injects a "Created by MiniMax
 *  Agent" floating ball at runtime via its own script. We don't control
 *  the script — we just visually hide its rendered DOM. The script's
 *  own internal logic continues to run (it doesn't depend on visibility),
 *  and removing visibility doesn't throw console errors because we never
 *  touch the script or its bound element handles.
 * ===================================================================== */
#minimax-floating-ball,
[class*="minimax-"] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ---------- Topbar ---------- */
.topbar {
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-page);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar__inner {
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.topbar__brand {
  font-weight: 700; font-size: 16px; color: var(--text);
  letter-spacing: 0.2px;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__dot { color: var(--accent); }
/* Top nav links. Each link sits in its own slot so the pink underline
   of the .active link can be a precise 2px border that lines up with
   the .tab.is-active border-bottom used further down the page. */
.topbar__nav { display: flex; gap: 22px; margin-right: 28px; }
.topbar__nav a {
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
.topbar__nav a:hover { color: var(--text); text-decoration: none; }
/* Active page: bold text + pink underline — matches the .tab.is-active
   border-bottom-color: var(--accent) used further down the page. */
.topbar__nav a.active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--accent);
  text-decoration: none;
}
.topbar__nav a.muted { opacity: 0.6; }

@media (max-width: 540px) {
  .topbar__nav { gap: 14px; margin-right: 14px; font-size: 13px; }
  .topbar__nav a { font-size: 13px; }
}

/* ---------- Page layout ---------- */
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Hero ---------- */
.hero { text-align: center; margin: 16px 0 32px; }
.hero h1 {
  font-size: 36px; margin: 0 0 8px; font-weight: 700;
  letter-spacing: -0.5px;
}
.hero__sub {
  color: var(--text-muted);
  max-width: 560px; margin: 0 auto 20px;
  font-size: 15px;
}
.hero__pills {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
}
.hero__pills span {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-muted);
}
@media (max-width: 540px) {
  .hero h1 { font-size: 28px; }
}

/* ---------- Generator tabs ---------- */
.generator {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tabs {
  display: flex; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}
.tab {
  flex: 1 1 140px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 14px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.tab.is-active {
  color: var(--text);
  background: var(--bg-card);
  border-bottom-color: var(--accent);
}
@media (max-width: 540px) {
  .tab { font-size: 12.5px; padding: 12px 8px; }
}

/* ---------- Sub-tabs (used inside the Fusion panel for source languages) ----------
   These are visually a step below the main .tab — same dark-mode look, but
   smaller, with a pill shape and tighter spacing. They sit at the top of the
   Fusion panel as a sub-row, so the main top tab bar stays at 4 tabs. */
.subtabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 16px 0;
  padding: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.subtab {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
}
.subtab:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.subtab.is-active {
  background: var(--accent);
  color: #1a0d20;
  font-weight: 600;
}
@media (max-width: 540px) {
  .subtab { font-size: 12px; padding: 6px 10px; }
}

.tabpanel { display: none; padding: 24px; }
.tabpanel.is-active { display: block; }
.tabpanel__title { font-size: 18px; margin: 0 0 6px; font-weight: 600; }
.tabpanel__desc  { color: var(--text-muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Options row ---------- */
.opts {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.opts label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--text-muted);
}
.opts input[type="number"],
.opts select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  min-width: 120px;
}
.opts input[type="number"]:focus,
.opts select:focus {
  outline: none; border-color: var(--accent);
}
.opt-check {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 13px !important;
  color: var(--text) !important;
}
.opt-check input { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; cursor: pointer;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 120ms ease;
}
.btn--primary {
  background: var(--accent);
  color: #1a0d20;
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn--sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Results ---------- */
.results {
  padding: 20px 24px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  min-height: 120px;
}
.results__empty, .results__error {
  grid-column: 1 / -1;
  color: var(--text-muted);
  text-align: center;
  padding: 30px 0;
  font-size: 14px;
}
.results__error { color: var(--danger); }

/* ---------- Result card ---------- */
.card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 120ms ease;
}
.card:hover { border-color: #3a3f4b; }
.card__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card__romaji {
  font-size: 18px; font-weight: 700; color: var(--text);
  word-break: break-word;
  line-height: 1.25;
  /* Ensure consistent baseline spacing regardless of font descenders */
  margin-bottom: 2px;
}
.card__kanji  { font-size: 15px; color: var(--accent); line-height: 1.35; margin-bottom: 1px; }
.card__hira   { font-size: 13px; color: var(--text-muted); line-height: 1.35; }
.card__meaning { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }
.card__meaning.small, .small { font-size: 12px; }

/* Category tag pills: small kawaii-pink chips above the meaning, e.g.
   "fire", "shrine", "cute", "strong", etc. Limited to 4 per card so the
   card height stays predictable. */
.card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.14);
  color: var(--accent);
  border: 1px solid rgba(236, 72, 153, 0.28);
  line-height: 1.4;
  white-space: nowrap;
}
.card__actions {
  display: flex; align-items: center; gap: 4px;
  margin-top: auto; padding-top: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
  position: relative;
  flex-wrap: wrap;
}
.card--compact { padding: 10px 12px; gap: 4px; }
.card--compact .card__romaji { font-size: 15px; }

.iconbtn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 120ms ease;
  font-family: var(--font);
}
.iconbtn:hover { color: var(--text); border-color: var(--text-muted); }

/* Labeled action button (icon + small text). Used for the per-card actions so
   they're usable on mobile (no hover) and screen-reader friendly. */
.iconbtn--labeled {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  min-width: 0;
}
.iconbtn__icon  { font-size: 14px; line-height: 1; }
.iconbtn__label { white-space: nowrap; }

/* ---------- Saved panel ---------- */
.saved {
  margin-top: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.saved__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.saved__head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.saved__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.saved__empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.muted { color: var(--text-muted); }

/* ---------- FAQ ---------- */
.faq {
  margin-top: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.faq h2 { font-size: 16px; margin: 0 0 12px; }
.faq details {
  border-top: 1px solid var(--border-soft);
  padding: 12px 0;
}
.faq details:first-of-type { border-top: 0; padding-top: 0; }
.faq summary {
  cursor: pointer; font-weight: 500; color: var(--text);
  list-style: none;
}
.faq summary::before { content: "▸ "; color: var(--text-muted); }
.faq details[open] summary::before { content: "▾ "; color: var(--accent); }
.faq p { color: var(--text-muted); margin: 8px 0 0; font-size: 14px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
  padding: 20px;
}
.footer__inner {
  max-width: 980px; margin: 0 auto;
  text-align: center; color: var(--text-muted); font-size: 13px;
}
.footer p { margin: 4px 0; }
/* Footer links: underline for a11y (no color-only differentiation) */
.footer a { text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { text-decoration-thickness: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg-page);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 200ms ease;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Share modal ---------- */
.share-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.share-modal[hidden] { display: none; }
.share-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.share-modal__panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 760px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.share-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.share-modal__head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.share-modal__preview {
  background: #000;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1200 / 630;
  display: flex; align-items: center; justify-content: center;
}
.share-modal__preview canvas {
  width: 100%; height: 100%;
  display: block;
}
.share-modal__caption {
  margin: 0;
  text-align: center;
  font-size: 13px;
  word-break: break-word;
}
.share-modal__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center;
}
.share-modal__actions .btn { flex: 1 1 140px; justify-content: center; }
.share-modal__note {
  margin: 0;
  text-align: center;
}
body.modal-open { overflow: hidden; }

@media (max-width: 540px) {
  .share-modal__panel { padding: 14px; }
  .share-modal__actions .btn { flex: 1 1 100%; }
}

/* =====================================================================
 *  Language switcher (topbar dropdown)
 *  Renders an inline <select> with the 6 supported locales + English.
 *  Inherits dark-mode palette from :root variables above.
 * ===================================================================== */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
}
.lang-switcher__label {
  display: none; /* keep visual compact; aria-label still provides the field name */
}
.lang-switcher__select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.lang-switcher__select:hover { border-color: var(--accent); }
.lang-switcher__select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (max-width: 700px) {
  /* Drop the label and shrink the dropdown on narrow screens */
  .lang-switcher { margin-left: 6px; }
  .lang-switcher__select { padding: 4px 6px; font-size: 12px; }
}

/* =====================================================================
 *  Mobile responsiveness — tuned for ~375px (iPhone SE) up to ~640px
 *  The goal: nothing should overflow horizontally; touch targets should
 *  be at least ~40px; controls should stack into a comfortable column.
 * ===================================================================== */
@media (max-width: 640px) {
  /* Header: stack into 2 rows on narrow screens.
     Row 1: brand + switcher.
     Row 2: nav links (smaller font, wrap-friendly). */
  .topbar__inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .topbar__brand { font-size: 15px; }
  .lang-switcher { margin-left: auto; }
  .topbar__nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 14px;
    padding-top: 6px;
    border-top: 1px solid var(--border-soft);
    margin-top: 2px;
  }
  .topbar__nav a { font-size: 13px; }

  /* Page padding tighter */
  .page { padding: 18px 14px 40px; }

  /* Hero: even smaller on phones */
  .hero h1 { font-size: 24px; line-height: 1.2; }
  .hero__sub { font-size: 13.5px; }

  /* Tabs: smaller padding/font, but still 44px-ish touch target */
  .tab { font-size: 12px; padding: 12px 6px; }

  /* Tabpanel: less padding so controls have room */
  .tabpanel { padding: 18px 14px; }
  .tabpanel__title { font-size: 17px; }
  .tabpanel__desc { font-size: 13px; }

  /* Options: stack into a comfortable column at full width */
  .opts {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 12px;
  }
  .opts label { width: 100%; }
  .opts input[type="number"],
  .opts input[type="text"],
  .opts select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-size: 16px;        /* iOS won't auto-zoom on 16px+ inputs */
    padding: 10px 12px;
  }
  .opts .btn { width: 100%; justify-content: center; padding: 12px 16px; }

  /* Results grid: 1 column on phones */
  .results { padding: 14px; grid-template-columns: 1fr; gap: 10px; }

  /* Result card: bigger touch targets for the icon buttons */
  .iconbtn {
    padding: 8px 10px;
    font-size: 15px;
    min-width: 38px;
    min-height: 38px;
  }
  .card__romaji { font-size: 17px; }
  .card__kanji  { font-size: 14px; }

  /* Saved + FAQ: less padding on phones */
  .saved, .faq { padding: 16px; }
  .faq h2 { font-size: 15px; }

  /* Footer: smaller text on phones */
  .footer__inner { font-size: 12px; }

  /* Share modal: edge-to-edge on phones */
  .share-modal { padding: 8px; }
  .share-modal__panel { padding: 14px; max-height: 96vh; }
}

@media (max-width: 400px) {
  /* Very narrow phones: even more compact */
  .hero h1 { font-size: 22px; }
  .tab { font-size: 11.5px; padding: 11px 4px; }
  .card__actions { gap: 6px; flex-wrap: wrap; }
}

/* =====================================================================
 *  Cookie consent banner (GDPR / EU user-consent compliance for AdSense)
 *  Wired up by js/cookie-consent.js on every page that includes the
 *  script. Body gets data-cc="accept|reject|custom" set so the rest
 *  of the page (e.g. ad slot placeholders) can react to consent.
 * ===================================================================== */

/* Hide all ad-slot placeholders until consent says ads are allowed. */
.ad-slot { display: none; }
body[data-cc-ads="1"] .ad-slot { display: flex; }

/* Show the banner only when no decision has been made yet.
   When body[data-cc] is set (accept|reject|custom), the banner stays hidden. */
#cc-banner { display: none; }
body:not([data-cc]) #cc-banner { display: block; }

#cc-banner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 1000;
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-family: var(--font);
  color: var(--text);
  animation: cc-slide-up 280ms cubic-bezier(.2,.7,.3,1);
}
@keyframes cc-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.cc-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  flex-wrap: wrap;
}
.cc-text  { flex: 1 1 280px; min-width: 0; }
.cc-title { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--text); }
.cc-body  { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); }
.cc-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center;
  flex: 0 0 auto;
}

.cc-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: all 120ms ease;
}
.cc-btn:hover { border-color: var(--text-muted); }
.cc-btn--primary {
  background: var(--accent);
  color: #1a0d20;
  border-color: var(--accent);
}
.cc-btn--primary:hover { filter: brightness(1.06); }
.cc-btn--ghost  { background: var(--bg-soft); }
.cc-btn--link   { border-color: transparent; color: var(--text-muted); text-decoration: underline; padding-left: 8px; padding-right: 8px; }
.cc-btn--link:hover { color: var(--text); }

.cc-details {
  border-top: 1px solid var(--border-soft);
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.cc-details[hidden] { display: none; }
.cc-row {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; line-height: 1.5;
  cursor: pointer;
}
.cc-row input[type="checkbox"] {
  margin-top: 2px;
  width: 16px; height: 16px;
  accent-color: var(--accent);
}
.cc-row strong { color: var(--text); font-weight: 600; }
.cc-row__desc { color: var(--text-muted); font-size: 12px; }
.cc-row input[disabled] + span { opacity: 0.6; }
.cc-details__actions { display: flex; justify-content: flex-end; }

@media (max-width: 640px) {
  #cc-banner { left: 6px; right: 6px; bottom: 6px; }
  .cc-inner { padding: 12px 14px; gap: 12px; }
  .cc-text  { flex: 1 1 100%; }
  .cc-actions { flex: 1 1 100%; justify-content: stretch; }
  .cc-btn { flex: 1 1 auto; text-align: center; }
}

/* =====================================================================
 *  Ad slot placeholders
 *  Visually clearly labeled (using the word "Advertisement") so we
 *  comply with AdSense "ads must be distinguishable from content"
 *  rules. Hidden by default until cookie consent allows ads. Sized
 *  to common responsive ad dimensions; layout reserves the space
 *  so the page doesn't jump when real ads are inserted.
 * ===================================================================== */
.ad-slot {
  margin: 28px auto;
  max-width: 728px;
  min-height: 90px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: none;            /* shown only when consent allows ads */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  /* Reserve the layout space even when consent says no, so the
     page doesn't reflow later when an ad script is added. */
  visibility: hidden;
}
body[data-cc-ads="1"] .ad-slot {
  display: flex;
  visibility: visible;
}
.ad-slot--leaderboard { max-width: 728px; min-height: 90px; }
.ad-slot--rectangle   { max-width: 336px; min-height: 280px; }
.ad-slot--mobile      { max-width: 320px; min-height: 100px; }

/* AdSense <ins> containers need explicit width, not just max-width, or
   they trigger "No slot size for availableWidth=0" on first paint. The inline
   style="width:728px;height:90px" handles the common case; the rule below
   makes the rule responsive on small viewports. */
.ad-slot__ins {
  display: inline-block;
  background: transparent;
}

.ad-slot__label {
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 10.5px;
}
.ad-slot__note {
  font-size: 11.5px;
  color: var(--text-dim);
  max-width: 480px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .ad-slot { max-width: 100%; }
}

/* =====================================================================
 *  RTL (right-to-left) adjustments for Arabic (ar) and Urdu (ur) locales.
 *  Activated by <html dir="rtl"> on the page.
 *
 *  Strategy:
 *  - Most of the layout uses flexbox with `gap`, which already mirrors
 *    correctly when dir=rtl is set on the root.
 *  - These overrides fix the small set of hard-coded left/right offsets
 *    (absolute positioning, margins, borders) that don't flip on their own.
 *  - The Japanese text inside the result cards (kanji, hiragana) stays
 *    LTR; we don't try to "fix" that, because mixed-direction content
 *    is the correct behavior for a multilingual generator.
 * =====================================================================*/

html[dir="rtl"] .topbar__nav { margin-right: 0; margin-left: 28px; }
@media (max-width: 760px) {
  html[dir="rtl"] .topbar__nav { margin-right: 0; margin-left: 14px; }
}

/* Result card icon buttons: keep on the right side of the card so they
   don't get pushed into the Arabic/Hindi text on the left. */
html[dir="rtl"] .results__card .iconbtn { left: 8px; right: auto; }

/* Saved-names section: small "empty" hint stays centered. */

/* Footer: text alignment flips naturally; center-aligned paragraphs OK. */

/* Saved row: clear-all button on the right in LTR \u2192 left in RTL. */
html[dir="rtl"] .saved__header .btn { margin-left: 0; }

/* Cookie banner: inner padding stays symmetric, button order reverses
   automatically via flex reverse. */
html[dir="rtl"] .cc-btn--link { padding-left: 0; padding-right: 8px; }

/* Mobile-only: the topbar gets the same flex-order flip so the brand
   moves to the right edge. */
@media (max-width: 600px) {
  html[dir="rtl"] .topbar { flex-direction: row-reverse; }
}
