:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f1f7;
  --text: #16161d;
  --muted: #6b6b7b;
  --border: #e4e4ee;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --green: #0f8a4f;
  --green-soft: #e3f6ec;
  --red: #c0392b;
  --red-soft: #fdeceb;
  --amber: #a3620a;
  --amber-soft: #fdf3e1;
  --gray-soft: #eeeef3;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f14;
    --surface: #17171f;
    --surface-2: #1f1f29;
    --text: #ececf3;
    --muted: #9a9aab;
    --border: #2a2a36;
    --accent: #8b85ff;
    --accent-soft: #23234a;
    --green: #4cd08b;
    --green-soft: #12301f;
    --red: #ff7b6e;
    --red-soft: #3a1714;
    --amber: #f2b046;
    --amber-soft: #382a10;
    --gray-soft: #262631;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; gap: 24px; min-height: 58px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 800; line-height: 1; padding-bottom: 6px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tabs a.active { background: var(--accent-soft); color: var(--accent); }

/* Hero + search */
.hero { padding: 40px 0 20px; }
.hero.compact { padding-bottom: 8px; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.searchbar { display: flex; gap: 8px; max-width: 720px; }
.searchbar input { flex: 1; min-width: 0; }
input[type='search'], input:not([type]), select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbar input { font-size: 17px; padding: 13px 16px; }
button {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 10px;
  background: var(--accent); color: #fff; padding: 0 22px;
}
button:hover { filter: brightness(1.08); }
button.ghost { background: transparent; color: var(--accent); padding: 6px 10px; font-weight: 500; }
button.ghost:hover { background: var(--accent-soft); filter: none; }
.ghost-btn { display: inline-block; color: var(--accent); padding: 6px 10px; border-radius: 10px; font-weight: 500; }
.ghost-btn:hover { background: var(--accent-soft); text-decoration: none; }
.linkish { background: none; color: var(--muted); padding: 0; font-weight: 400; text-decoration: underline; }

.tld-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; max-width: 900px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 3px 4px 3px 10px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.chip button { background: none; color: var(--muted); padding: 0 6px; font-weight: 400; line-height: 1; }
.chip button:hover { color: var(--red); }
.tld-add input { width: 110px; padding: 4px 10px; font-size: 13px; border-radius: 999px; }

/* Results */
.summary {
  margin: 8px 0 14px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text);
}
.results { display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.row-main { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.3fr) auto; gap: 16px; align-items: center; padding: 14px 16px; }
.dom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.dname { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.dname .t { color: var(--muted); font-weight: 500; }
.row.available .dname .t { color: var(--green); }
.price-line { font-size: 14px; }
.price-line b { font-size: 17px; }
.actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.details { border-top: 1px solid var(--border); padding: 12px 16px 16px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.available { background: var(--green-soft); color: var(--green); }
.pill.taken { background: var(--red-soft); color: var(--red); }
.pill.likely_available { background: var(--amber-soft); color: var(--amber); }
.pill.unknown, .pill.invalid, .pill.checking { background: var(--gray-soft); color: var(--muted); }
.pill.exact { background: var(--accent-soft); color: var(--accent); }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.tag.best { background: var(--green-soft); color: var(--green); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.cheapest { color: var(--green); font-weight: 700; }
.offers td:first-child { font-weight: 600; }

/* WHOIS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.code { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); cursor: help; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); font-weight: 500; }
pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  overflow: auto; max-height: 480px; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.error { padding: 14px 16px; border-radius: var(--radius); background: var(--red-soft); color: var(--red); }
.notice { padding: 14px 16px; border-radius: var(--radius); background: var(--green-soft); color: var(--green); }

/* TLD table */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 8px; }
.toolbar input[type='search'] { flex: 1; min-width: 200px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; margin-top: 8px; box-shadow: var(--shadow); }
.tld-table td { white-space: nowrap; }
.tld-table td.tldname a { font-weight: 600; }
.tld-table tbody tr:hover { background: var(--surface-2); }
.pair { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.pair small { color: var(--muted); font-size: 11.5px; }
#tld-more { text-align: center; margin: 14px 0; }
#tld-more button { padding: 10px 18px; }

.sources { margin: 28px 0 8px; font-size: 13px; color: var(--muted); }
.sources ul { margin: 6px 0 0; padding-left: 18px; }
.sources .bad { color: var(--red); }
.foot { color: var(--muted); font-size: 12.5px; padding-top: 12px; padding-bottom: 40px; border-top: 1px solid var(--border); margin-top: 20px; }
.back { font-size: 14px; }
.hero + .card, #whois-result, #tld-detail { margin-top: 8px; }

.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { color: var(--muted); padding: 24px 0; }

@media (max-width: 720px) {
  .hero { padding-top: 24px; }
  h1 { font-size: 24px; }
  .row-main { grid-template-columns: 1fr; gap: 6px; }
  .actions { justify-content: flex-start; margin-left: -10px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .searchbar button { padding: 0 16px; }
}
