:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f0f0f7;
  --text: #16162a;
  --muted: #5d5d78;
  --border: #e2e2ee;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-soft: #eceafd;
  --tile: #f5b942;
  --tile-ink: #3b2a00;
  --shadow: 0 1px 2px rgba(22, 22, 42, .05), 0 8px 24px rgba(22, 22, 42, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f1a;
    --surface: #181826;
    --surface-2: #20202f;
    --text: #ececf7;
    --muted: #a2a2bd;
    --border: #2c2c40;
    --accent: #8b85ff;
    --accent-ink: #12122a;
    --accent-soft: #25244a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f1a;
  --surface: #181826;
  --surface-2: #20202f;
  --text: #ececf7;
  --muted: #a2a2bd;
  --border: #2c2c40;
  --accent: #8b85ff;
  --accent-ink: #12122a;
  --accent-soft: #25244a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.brand svg { width: 34px; height: 34px; flex: none; }
.nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.header-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn, .lang summary {
  list-style: none; cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: .9rem; line-height: 1.3;
}
.icon-btn:hover, .lang summary:hover { background: var(--surface-2); }
.lang { position: relative; }
.lang summary::-webkit-details-marker { display: none; }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; min-width: 160px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 10; }
.lang li a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.lang li a:hover { background: var(--surface-2); }
.lang li a[aria-current="true"] { color: var(--accent); font-weight: 600; }

/* Suggest banner */
.suggest { background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: .92rem; }
.suggest .wrap { display: flex; gap: 12px; align-items: center; padding-top: 8px; padding-bottom: 8px; }
.suggest button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }

/* Hero */
.hero { padding: 40px 0 8px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 4.5vw, 2.6rem); line-height: 1.15; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.05rem; }

/* Tool card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 24px 0; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
input[type="text"], input[type="number"], input[type="email"], input[type="tel"], textarea {
  width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 44px;
}
input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input:focus { border-color: var(--accent); }
.main-input { font-size: 1.4rem; letter-spacing: .08em; padding: 14px 16px; min-height: 58px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 16px; }
.filters { margin-top: 14px; }
.filters summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 16px 0 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Results */
.status { color: var(--muted); font-size: .95rem; margin: 0 0 12px; min-height: 1.6em; }
.status strong { color: var(--text); }
.group { margin: 18px 0 0; }
.group h3 { margin: 0 0 8px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.group h3 .n { background: var(--surface-2); border-radius: 99px; padding: 0 8px; font-size: .78rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 10px; font-size: 1rem; }
.chips li.rare { background: #fdecec; border-color: #f0b8b8; color: #7a1f1f; }
.rare-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; margin: -4px 0 12px; }
.rare-note .swatch { width: 14px; height: 14px; border-radius: 4px; background: #fdecec; border: 1px solid #f0b8b8; flex: none; }
:root[data-theme="dark"] .chips li.rare, :root[data-theme="dark"] .rare-note .swatch { background: #3a1d22; border-color: #6b2f37; }
:root[data-theme="dark"] .chips li.rare { color: #ffb4b4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chips li.rare, :root:not([data-theme="light"]) .rare-note .swatch { background: #3a1d22; border-color: #6b2f37; }
  :root:not([data-theme="light"]) .chips li.rare { color: #ffb4b4; }
}
.chips li.tile { background: var(--tile); color: var(--tile-ink); border-color: transparent; font-weight: 600; }
.more { margin-top: 10px; background: none; border: 1px dashed var(--border); color: var(--accent); border-radius: 8px; padding: 6px 12px; cursor: pointer; font: inherit; }

/* Content */
.content { margin: 8px 0 40px; }
.content section { margin: 28px 0; }
.content h2 { font-size: 1.3rem; margin: 0 0 10px; letter-spacing: -.01em; }
.content p { margin: 0 0 12px; max-width: 70ch; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin: 8px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.example { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.small { color: var(--muted); font-size: .85rem; }

/* Root language chooser */
.choose { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 28px 0; }
.choose a { display: block; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.choose a:hover, .choose a.suggested { border-color: var(--accent); }
.choose strong { display: block; font-size: 1.2rem; }
.choose span { color: var(--muted); font-size: .92rem; }

/* Ad slots (only rendered when an AdSense client id is configured) */
.ad { margin: 24px 0; min-height: 90px; text-align: center; }

/* Footer */
.site-footer { margin-top: auto; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 20px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.site-footer a { color: var(--muted); }

@media (max-width: 560px) {
  .nav { margin-left: 0; width: 100%; order: 3; }
  .hero { padding-top: 24px; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .chips li, .choose a, .icon-btn { transition: background-color .15s, border-color .15s; }
}

/* Contact form */
.contact-form .grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .contact-form .grid2 { grid-template-columns: 1fr; } }
.contact-form .row { margin-top: 14px; }
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form .opt { font-weight: 400; color: var(--muted); }
.contact-form .hint { margin: 14px 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.form-status { margin: 14px 0 0; min-height: 1.4em; font-weight: 500; }
.form-status.ok { color: #137a3a; }
.form-status.err { color: #b3261e; }
:root[data-theme="dark"] .form-status.ok { color: #5fd38a; }
:root[data-theme="dark"] .form-status.err { color: #ff8a80; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-status.ok { color: #5fd38a; }
  :root:not([data-theme="light"]) .form-status.err { color: #ff8a80; }
}
.site-footer .legal { flex-basis: 100%; margin: 0; font-size: .8rem; }

/* Cookie banner */
[hidden] { display: none !important; }
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(22, 22, 42, .12); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: center; }
.consent p { margin: 0; max-width: 70ch; font-size: .95rem; }
.consent-actions { display: flex; gap: 10px; }
.btn-alt { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
@media (max-width: 640px) { .consent-actions { width: 100%; } .consent-actions .btn { flex: 1; } }
