/* Сленгопедия — карточки с рамками, чёрное и белое, две темы. */

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --fg: #000000;
  --muted: #4f4f4f;
  --desc: #333333;
  --line: #e2e2e2;
  --mark: #fdf1a5;
  --mark-fg: #000000;
  --radius: 18px;
  --pad: 22px;
  --col: 760px;
}

html[data-theme="dark"] {
  --bg: #060606;
  --surface: #101010;
  --fg: #f4f4f4;
  --muted: #a3a3a3;
  --desc: #d8d8d8;
  --line: #262626;
  --mark: #3a3410;
  --mark-fg: #f4f4f4;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--fg); color: var(--bg); }

a { color: inherit; }

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 24px; }

main { flex: 1 0 auto; }

/* ---------- шапка ---------- */

.top { border-bottom: 1px solid var(--line); background: var(--bg); }

.top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 68px;
}

.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; }

.nav { display: flex; align-items: center; gap: 18px; font-size: 14px; color: var(--muted); }

.nav a { text-decoration: none; }
.nav a:not(.nav__cta):hover { color: var(--fg); }

.nav__cta {
  background: var(--fg);
  color: var(--bg) !important;
  border: 1px solid var(--fg);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: opacity .15s;
}

.nav__cta:hover { opacity: .8; }

.theme {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  width: 30px;
  height: 30px;
  line-height: 1;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.theme:hover { border-color: var(--muted); }

/* ---------- заголовки ---------- */

.hero { padding: 56px 0 26px; }

.hero__title,
.page__title {
  margin: 0;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.03;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.page__title {
  margin-top: 44px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
}

.hero__sub,
.page__sub { margin: 16px 0 0; color: var(--muted); font-size: 17px; max-width: 46ch; }

/* ---------- поиск ---------- */

.search { position: relative; margin: 28px 0 0; }

.search__input {
  width: 100%;
  padding: 15px 46px 15px 18px;
  font: inherit;
  font-size: 17px;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color .15s;
}

.search__input::placeholder { color: var(--muted); }
.search__input:focus { border-color: var(--fg); }
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.search__clear:hover { color: var(--fg); }

/* ---------- карточки ---------- */

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  margin-bottom: 12px;
  text-decoration: none;
  transition: border-color .15s;
}

a.card:hover { border-color: var(--fg); }

.card--row { padding: 15px 20px; margin-bottom: 10px; }
.card:last-child { margin-bottom: 0; }

.item__word { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }

a.card:hover .item__word { text-decoration: underline; text-underline-offset: 3px; }

.item__desc {
  margin-top: 4px;
  color: var(--desc);
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reasons { margin-top: 10px; font-size: 13px; color: var(--muted); }

.reasons span {
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 4px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

mark {
  background: var(--mark);
  color: var(--mark-fg);
  padding: 0 2px;
  border-radius: 3px;
}

.empty {
  margin: 0 0 12px;
  padding: 26px 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty a { color: var(--fg); }

/* ---------- страница слова ---------- */

.page-top { padding-top: 36px; }

.word__head { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }

.word__title {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.word__meta { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.word__meta a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
.word__meta a:hover { border-color: var(--fg); }

.meaning + .meaning { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }

.meaning__num {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meaning__text { margin: 0; font-size: 19px; line-height: 1.5; }

.examples { list-style: none; margin: 14px 0 0; padding: 0; }

.examples li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 16px;
}

.examples li::before { content: "—"; position: absolute; left: 0; }

.history {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 15px;
}

.actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-block;
  padding: 11px 20px;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { opacity: .85; }

.btn--ghost { background: var(--surface); color: var(--fg); }
.btn--ghost:hover { opacity: 1; border-color: var(--muted); }

.btn--small { padding: 7px 14px; font-size: 14px; }

/* ---------- похожие ---------- */

.similar { margin-top: 30px; }

.similar h2 {
  margin: 0 0 12px;
  padding-left: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- страница слова: простая версия ---------- */

.word {
  margin: 40px 0 0;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.word__head { margin: 0 0 26px; }

.word__title {
  margin: 0;
  font-size: clamp(36px, 7vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 600;
}

.word__pos { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.wsec { margin: 0 0 26px; }

.wsec__label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.wsec__text { margin: 0; font-size: 19px; line-height: 1.5; }
.wsec__text--small { font-size: 16px; color: var(--desc); }
.wsec__quote { margin: 0 0 6px; font-size: 17px; line-height: 1.5; color: var(--desc); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

.chip {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  color: var(--fg);
}

a.chip:hover { border-color: var(--fg); }

.word .actions { margin-top: 34px; }

.similar {
  margin: 12px 0 0;
  padding: 22px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.similar .chips { margin-top: 10px; }


/* ---------- статистика в админке ---------- */

.stats-toggle { margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.stats-toggle a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
.stats-toggle a:hover { border-color: var(--fg); }
.stats-toggle .is-active { color: var(--fg); font-weight: 500; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.stats--small { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.stat__value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.stat__value--bad { color: #c92a2a; }
.stat__unit { font-size: 15px; font-weight: 400; color: var(--muted); }
.stat__label { margin-top: 6px; font-size: 13px; color: var(--muted); }

.panel {
  margin-top: 14px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel__title {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; }

.bar { flex: 1 1 0; max-width: 56px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar__value { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.bar__track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.bar__fill { width: 100%; background: var(--fg); border-radius: 8px 8px 0 0; min-height: 2px; }
.bar__day { font-size: 11px; color: var(--muted); margin-top: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 10px 8px 0;
}
.table td { padding: 8px 10px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.table__path { overflow-wrap: anywhere; }
.table__bad { color: #c92a2a; }

.badge--ok { color: #2b8a3e; border-color: #b2f2bb; }
.badge--bad { color: #c92a2a; border-color: #ffc9c9; }

@media (max-width: 900px) {
  .stats, .stats--small { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .stat { padding: 14px; }
  .stat__value { font-size: 24px; }
  .stat__label { font-size: 12px; }
  .panel { padding: 18px 16px; }
  .bars { height: 130px; gap: 5px; }
  .bar__day { font-size: 10px; }
  .table { font-size: 13px; }
}

/* ---------- формы ---------- */

/* ловушка для ботов: скрытое поле, человек его не видит и не заполняет */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form {
  max-width: 620px;
  margin: 28px 0 0;
  padding: var(--pad);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field { margin-bottom: 20px; }
.field:last-of-type { margin-bottom: 24px; }

.field label { display: block; margin-bottom: 7px; font-size: 13px; color: var(--muted); }

.input,
.textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s;
}

.input:focus,
.textarea:focus { border-color: var(--fg); }

.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.hint { margin: 7px 0 0; font-size: 13px; color: var(--muted); }

fieldset.meaning-block {
  margin: 0 0 22px;
  padding: 18px 18px 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

fieldset.meaning-block .input,
fieldset.meaning-block .textarea { background: var(--surface); }

#add-meaning { margin-bottom: 4px; }

/* ---------- служебное ---------- */

.flash {
  margin: 22px 0;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
}

.flash--error { border-color: #d33; color: #d33; }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 44px;
}

.admin-head .page__title { margin-top: 0; }

.admin-nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); padding-bottom: 6px; }
.admin-nav a { text-decoration: none; }
.admin-nav a:hover { color: var(--fg); }

.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* левая часть строки не должна раздувать карточку длинным словом или описанием */
.admin-row > div:first-child { flex: 1 1 auto; min-width: 0; }

.admin-row .item__word { overflow-wrap: anywhere; }

.admin-row .item__desc {
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.admin-row__actions { display: flex; align-items: center; gap: 14px; font-size: 14px; flex: 0 0 auto; }
.admin-row__actions form { margin: 0; }

.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:hover { color: var(--fg); }
.link--danger:hover { color: #d33; }

.suggestion__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.suggestion__word { margin: 0; font-size: 20px; font-weight: 600; }

.badge {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 14px; }

.kv { margin: 0 0 14px; display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv .pre { white-space: pre-line; }

.foot {
  flex: 0 0 auto;
  margin-top: 64px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.foot__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }

.foot__brand {
  display: inline-block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

.foot__brand:hover { text-decoration: underline; text-underline-offset: 3px; }

.foot__note { margin: 5px 0 0; font-size: 13px; color: var(--muted); }

.foot__nav { display: flex; gap: 18px; font-size: 13px; }
.foot__nav a { color: var(--muted); text-decoration: none; }
.foot__nav a:hover { color: var(--fg); }

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  :root { --pad: 19px; --radius: 16px; }
  .wrap { padding: 0 20px; }
  .hero { padding: 44px 0 22px; }
}

@media (max-width: 620px) {
  :root { --pad: 16px; --radius: 14px; }
  body { font-size: 16px; }
  .wrap { padding: 0 14px; }
  .top__row { height: 56px; }
  .brand { font-size: 16px; }
  .nav { gap: 12px; }
  .nav__cta { padding: 7px 12px; font-size: 13px; }
  .hero { padding: 32px 0 18px; }
  .hero__sub, .page__sub { font-size: 16px; margin-top: 12px; }
  .search { margin-top: 22px; }
  .search__input { font-size: 16px; padding: 13px 42px 13px 15px; }
  .page-top { padding-top: 24px; }
  .word__head { padding-bottom: 16px; margin-bottom: 16px; }
  .meaning__text { font-size: 17px; }
  .card--row { padding: 13px 16px; }
  .item__word { font-size: 18px; }
  .item__desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .examples li { font-size: 15px; }
  .history { font-size: 14px; padding: 12px 14px; }
  .form { padding: 16px; margin-top: 22px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
  .admin-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .word { margin-top: 22px; padding: 20px; }
  .word__title { font-size: clamp(30px, 9vw, 40px); }
  .wsec { margin-bottom: 22px; }
  .wsec__text { font-size: 17px; }
  .wsec__text--small, .wsec__quote { font-size: 16px; }
  .similar { padding: 18px 20px; }
  .foot { margin-top: 44px; padding: 22px 0 28px; }
  .foot__row { flex-direction: column; align-items: flex-start; gap: 14px; }
}
