:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --surface: #121518;
  --surface-raised: #171b1f;
  --surface-hover: #1d2227;
  --text: #e8ebed;
  --muted: #929ba3;
  --accent: #d6a451;
  --accent-soft: rgba(214, 164, 81, .12);
  --border: #272d32;
  --good: #74bd91;
  --bad: #d87979;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -25%, rgba(214, 164, 81, .075), transparent 55%),
    var(--bg);
  font: 15px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #edc47e; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.top, main, footer { position: relative; z-index: 1; }

.top {
  min-height: 76px;
  padding: 14px max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  background: rgba(15, 18, 20, .88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: -.045em;
}
.logo::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(214, 164, 81, .35);
  transform: rotate(45deg);
}
.logo:hover { color: #fff; text-decoration: none; }
.sub { color: var(--muted); font-size: 12px; }
.nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.language-switch { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.language-switch button { padding: 3px 6px; color: var(--muted); background: transparent; border: 0; border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: 650; }
.language-switch button.active { color: var(--accent); background: var(--accent-soft); }

.nav > a, .loginbtn, .linkbtn {
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.nav > a:hover, .linkbtn:hover { background: var(--surface-hover); border-color: #414950; color: #fff; text-decoration: none; }
.loginbtn {
  display: inline-block;
  color: #17130c;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 680;
}
.loginbtn:hover { background: #e5b76e; color: #17130c; text-decoration: none; }
.userbox { display: flex; gap: 10px; align-items: center; }
.who { color: var(--muted); font-size: 13px; }
.who .profile-link { color: var(--text); font-weight: 650; text-decoration: underline; text-decoration-color: #65717a; text-underline-offset: 3px; }
.who .profile-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

main { width: min(100% - 40px, 980px); margin: 0 auto; padding: 38px 0 72px; }
footer { width: min(100% - 40px, 980px); margin: 0 auto; padding: 20px 0 34px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

.search { position: relative; width: min(100%, 740px); margin: 6px auto 30px; }
input[type=search], input[type=text], textarea {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: #111416;
  border: 1px solid #30373c;
  border-radius: 12px;
  font: inherit;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input[type=search] { min-height: 54px; font-size: 16px; }
input::placeholder, textarea::placeholder { color: #707a82; }
input:focus, textarea:focus { outline: none; background: #14181b; border-color: rgba(214, 164, 81, .72); box-shadow: 0 0 0 4px rgba(214, 164, 81, .1); }
.results {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #15191c;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.results li a { display: block; padding: 10px 12px; color: var(--text); border-radius: 8px; }
.results li a:hover, .results li a:focus { background: var(--surface-hover); color: var(--accent); text-decoration: none; }
.results .empty { padding: 10px 12px; color: var(--muted); }

.card {
  margin-bottom: 16px;
  padding: 22px;
  background: linear-gradient(145deg, rgba(22, 26, 29, .98), rgba(17, 20, 22, .98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 16px; color: var(--text); font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.card h2::after { content: none; }
.name { margin: 0; color: #f2f3f4; font-size: clamp(26px, 4vw, 34px); font-weight: 720; letter-spacing: -.045em; line-height: 1.2; }
.clan { margin-left: 8px; color: var(--accent); font-size: .62em; font-weight: 650; letter-spacing: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; margin-top: 20px; }
.stat { min-height: 82px; padding: 13px 15px; background: #111416; border: 1px solid var(--border); border-radius: 11px; }
.stat b { display: block; color: var(--text); font-size: 21px; font-weight: 680; letter-spacing: -.035em; }
.stat span { color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 9px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.tagcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.taggroup { min-width: 0; padding: 15px; background: #111416; border: 1px solid var(--border); border-radius: 12px; }
.taggroup.good { border-top: 2px solid rgba(116, 189, 145, .65); }
.taggroup.bad { border-top: 2px solid rgba(216, 121, 121, .65); }
.taggroup h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--text); font-size: 13px; font-weight: 620; }
.taggroup.good h3 { color: var(--good); }
.taggroup.bad h3 { color: var(--bad); }
.gcount { padding: 2px 8px; color: var(--muted); background: var(--surface-hover); border: 1px solid var(--border); border-radius: 999px; font-size: 11px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-entry { display: grid; justify-items: start; gap: 3px; }
.tag-entry .linkbtn { padding: 2px 6px; color: var(--muted); background: transparent; border-color: transparent; font-size: 11px; }
.tag { padding: 7px 10px; color: #cbd0d4; background: #181c1f; border: 1px solid #30373c; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; transition: .16s ease; }
.tag:hover { color: #fff; background: var(--surface-hover); border-color: #596168; transform: translateY(-1px); }
.tag.selected { color: #f2d6a7; background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px rgba(214, 164, 81, .09); }
.tag.neg:hover { border-color: var(--bad); }
.tag.pos:hover { border-color: var(--good); }
.tag.neg.has { color: #f0b4b4; background: rgba(216, 121, 121, .1); border-color: rgba(216, 121, 121, .48); }
.tag.pos.has { color: #a8d5b8; background: rgba(116, 189, 145, .1); border-color: rgba(116, 189, 145, .45); }
.tag .n { margin-left: 7px; font-weight: 700; opacity: .9; }

.captcha { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 0; color: var(--muted); }
.captcha #captcha-msg { flex-basis: 100%; }
.captcha input { width: 90px; }
.captcha button { padding: 4px 0; color: var(--accent); background: none; border: 0; cursor: pointer; font: inherit; }
button.primary { padding: 10px 16px; color: #17130c; background: var(--accent); border: 1px solid var(--accent); border-radius: 9px; cursor: pointer; font: inherit; font-weight: 680; transition: background .16s ease, transform .16s ease; }
button.primary:hover { background: #e5b76e; transform: translateY(-1px); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
textarea { min-height: 110px; margin-bottom: 10px; resize: vertical; }
.hint, .muted { color: var(--muted); }
.hint { font-size: 12px; }
.loginbox { padding: 16px; background: #111416; border: 1px solid var(--border); border-radius: 11px; }
.loginbox p { margin: 0 0 10px; }
.sep { margin: 18px 0; border: 0; border-top: 1px solid var(--border); }
.comment { padding: 13px 0; overflow-wrap: anywhere; white-space: pre-wrap; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: 0; }
.comment time { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.toast { position: fixed; z-index: 10; bottom: 22px; left: 50%; max-width: min(90vw, 560px); padding: 11px 16px; color: var(--text); background: #191e21; border: 1px solid #414a50; border-radius: 11px; box-shadow: var(--shadow); transform: translateX(-50%); }
.toast.err { border-color: var(--bad); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; padding: 5px 0 16px 42px; counter-increment: step; }
.steps li::before { position: absolute; top: 2px; left: 0; display: grid; width: 28px; height: 28px; place-items: center; content: counter(step); color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(214, 164, 81, .25); border-radius: 9px; font-size: 12px; font-weight: 700; }
.steps b { display: block; margin-bottom: 2px; font-size: 15px; }
.page p { margin: 0 0 12px; }
.rules { margin: 0; padding-left: 20px; }

.admin-item { margin-bottom: 10px; padding: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.admin-item .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.admin-item button, .tabs button { padding: 7px 11px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: .16s ease; }
.admin-item button:hover, .tabs button:hover { background: var(--surface-hover); border-color: #485158; }
.admin-item button.ok { color: var(--good); border-color: rgba(116, 189, 145, .35); }
.admin-item button.no { color: var(--bad); border-color: rgba(216, 121, 121, .35); }
.catalog-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 9px; align-items: center; }
.catalog-form h2 { grid-column: 1 / -1; margin: 0; }
.catalog-row { display: grid; grid-template-columns: minmax(80px, .55fr) repeat(3, minmax(140px, 1fr)) auto auto; gap: 9px; align-items: center; }
.catalog-form select, .catalog-row select { min-height: 42px; padding: 8px 10px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tabs button.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(214, 164, 81, .4); }
.wn8-stat b { font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  .top { padding: 14px 18px; gap: 9px 14px; }
  .sub { flex-basis: 100%; order: 3; }
  .nav { margin-left: auto; }
  main { width: min(100% - 28px, 980px); padding-top: 26px; }
  footer { width: min(100% - 28px, 980px); }
  .card { padding: 17px; border-radius: 12px; }
  .tagcols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { min-height: 74px; padding: 11px; }
  .catalog-row { grid-template-columns: 1fr 1fr; }
  .catalog-row code { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
