* {
  box-sizing: border-box;
}

:root {
  --bg: #12141d;
  --surface: #1b1e2b;
  --surface-2: #232737;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eceef6;
  --muted: #9aa1b8;
  --accent: #c8ff00;
  --accent-ink: #14170a;
  --violet: #8b7cff;
  --pink: #ff6ac2;
  --radius: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "SN Pro", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(60, 63, 82, 0.5) 1px, transparent 1px);
  background-size: 22px 22px;
}

button {
  font-family: inherit;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(18, 20, 29, 0.85);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
}

.logo__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.1rem;
  box-shadow: 0 0 18px rgba(200, 255, 0, 0.35);
}

.logo__accent {
  color: var(--accent);
}

.topbar__nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.btn--ghost:hover {
  background: #2c3147;
}

.btn--accent {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 22px rgba(200, 255, 0, 0.28);
}

.btn--accent:hover {
  box-shadow: 0 8px 28px rgba(200, 255, 0, 0.45);
}

/* ---------- hero ---------- */
.hero {
  max-width: 780px;
  margin: 0 auto;
  padding: 54px 20px 10px;
  text-align: center;
}

.hero__title {
  margin: 0;
  font-size: clamp(1.9rem, 5vw, 3rem);
  line-height: 1.15;
}

.hero__accent {
  color: var(--accent);
  text-shadow: 0 0 26px rgba(200, 255, 0, 0.4);
}

.hero__lead {
  margin: 14px auto 26px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 34rem;
}

/* ---------- search ---------- */
.search {
  position: relative;
}

.search__input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(200, 255, 0, 0.15);
}

.search__icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ---------- filters ---------- */
.filters {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.chips,
.grades {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chip--grade.is-active {
  background: var(--violet);
  border-color: var(--violet);
  color: #14122b;
}

/* ---------- main ---------- */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 20px 60px;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.sort select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: inherit;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: pop 0.35s ease backwards;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(200, 255, 0, 0.55);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.card__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(139, 124, 255, 0.18);
  color: #bcb3ff;
  border: 1px solid rgba(139, 124, 255, 0.4);
}

.badge--num {
  background: rgba(255, 106, 194, 0.15);
  color: #ff9ad6;
  border-color: rgba(255, 106, 194, 0.35);
}

.badge--own {
  background: rgba(200, 255, 0, 0.14);
  color: var(--accent);
  border-color: rgba(200, 255, 0, 0.45);
}

.card__question {
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.5;
  flex: 1;
}

.card__hint {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 700;
}

.card.is-fav::after {
  content: "⭐";
  position: absolute;
  top: 12px;
  right: 14px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 1.05rem;
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 12, 0.75);
  backdrop-filter: blur(4px);
}

.modal__card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  animation: pop 0.25s ease;
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.modal__head {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.modal__question {
  margin: 0 0 20px;
  font-size: 1.22rem;
  line-height: 1.5;
}

.modal__answer {
  margin-top: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  animation: pop 0.3s ease;
}

.answer__label {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.answer__label:not(:first-child) {
  margin-top: 16px;
}

.answer__value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
}

.answer__solution {
  margin: 0;
  line-height: 1.65;
  color: #d6d9e6;
}

.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ---------- форма добавления ---------- */
.modal__title {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

.modal__sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.14);
}

.form__error {
  margin: 0;
  color: #ff8a8a;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  animation: pop 0.3s ease;
}

/* ---------- блок «Об авторе» ---------- */
.author {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px 30px;
}

.author__card {
  display: flex;
  gap: 22px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}

.author__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 84px;
  height: 84px;
  font-size: 2.6rem;
  border-radius: 22px;
  background: linear-gradient(140deg, rgba(139, 124, 255, 0.35), rgba(255, 106, 194, 0.28));
  border: 1px solid rgba(139, 124, 255, 0.45);
}

.author__body {
  flex: 1;
  min-width: 0;
}

.author__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.author__name {
  margin: 0;
  font-size: 1.4rem;
}

.author__role {
  margin: 4px 0 0;
  color: var(--violet);
  font-weight: 700;
  font-size: 0.92rem;
}

.author__about {
  margin: 14px 0 0;
  line-height: 1.65;
  color: #d6d9e6;
}

.author__facts {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.author__facts li {
  padding: 7px 14px;
  font-size: 0.87rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}

.author__facts li::before {
  content: "✨ ";
}

.author__links {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.author__links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.author__links a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(200, 255, 0, 0.35);
}

@media (max-width: 620px) {
  .author__card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .author__head {
    justify-content: center;
  }
}

/* ---------- footer ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 26px 16px 40px;
  border-top: 1px solid var(--line);
}

@media (max-width: 560px) {
  .form__row {
    grid-template-columns: 1fr;
  }
  .topbar__nav {
    gap: 6px;
  }
  .btn {
    padding: 9px 13px;
    font-size: 0.84rem;
  }
  .hero {
    padding-top: 36px;
  }
}
