* {
  box-sizing: border-box;
}

:root {
  --bg: #050816;
  --panel: rgba(12, 18, 36, 0.78);
  --panel-strong: rgba(16, 24, 48, 0.94);
  --border: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(126, 231, 135, 0.34);
  --text: #f2f7ff;
  --muted: #9fb0c7;
  --green: #32d583;
  --cyan: #42c5d8;
  --blue: #5b8cff;
  --violet: #9b7cff;
  --yellow: #ffd166;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(91, 140, 255, 0.34), transparent 28%),
    radial-gradient(circle at 82% 8%, rgba(155, 124, 255, 0.26), transparent 30%),
    radial-gradient(circle at 62% 88%, rgba(50, 213, 131, 0.16), transparent 34%),
    linear-gradient(135deg, #050816 0%, #08111f 48%, #050816 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at top, black, transparent 72%);
}

.page {
  width: min(1440px, 100%);
  margin: auto;
  padding: 56px 44px 72px;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 34px;
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), transparent 38%),
    linear-gradient(145deg, rgba(12, 18, 36, 0.92), rgba(12, 27, 42, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(66, 197, 216, 0.28), transparent 68%);
}

.back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin-bottom: 26px;
  padding: 12px 18px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  font-weight: 900;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.back:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: rgba(66, 197, 216, 0.12);
}

.eyebrow {
  position: relative;
  z-index: 1;
  display: inline-flex;
  margin: 0 0 14px;
  padding: 8px 13px;
  border: 1px solid rgba(50, 213, 131, 0.28);
  border-radius: 999px;
  color: #b7ffcf;
  background: rgba(50, 213, 131, 0.1);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0;
  font-size: clamp(52px, 5.8vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.hero p:not(.eyebrow) {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.75;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 28px;
  align-items: center;
  margin-bottom: 34px;
  padding: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(50, 213, 131, 0.11), rgba(66, 197, 216, 0.08)), var(--panel);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
}

.search-panel h2,
.results-heading h2,
.empty-search h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  letter-spacing: -0.055em;
}

.search-panel p:not(.eyebrow),
.empty-search p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.search-form {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(5, 8, 22, 0.72);
}

.search-form input {
  width: 100%;
  min-width: 0;
  padding: 15px 16px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
}

.search-form input::placeholder {
  color: var(--muted);
}

.search-form:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(66, 197, 216, 0.12);
}

.search-form button {
  padding: 13px 22px;
  border: 0;
  border-radius: 16px;
  color: #041013;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  font-weight: 950;
  cursor: pointer;
}

.search-form-large {
  max-width: 820px;
  margin-top: 30px;
}

.search-results {
  margin-top: 34px;
}

.results-heading {
  margin-bottom: 20px;
}

.search-result-list {
  display: grid;
  gap: 16px;
}

.search-result-card {
  display: block;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  background: var(--panel);
  text-decoration: none;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.24);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.search-result-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
}

.search-result-card span {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  color: #b7ffcf;
  background: rgba(50, 213, 131, 0.1);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-result-card h2,
.search-result-card h3 {
  margin: 0;
  letter-spacing: -0.045em;
}

.search-result-card h3 {
  margin-top: 7px;
  color: #dffcff;
  font-size: 18px;
}

.search-result-card p {
  margin: 14px 0;
  color: var(--muted);
  line-height: 1.65;
}

.search-result-card strong {
  color: var(--green);
}

.empty-search {
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--panel);
}

.subject-grid,
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.subject-card,
.lesson-card {
  position: relative;
  min-height: 285px;
  overflow: hidden;
  padding: 30px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.045)),
    rgba(10, 16, 32, 0.76);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.subject-card::before,
.lesson-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(66, 197, 216, 0.23), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(50, 213, 131, 0.18), transparent 30%);
  transition: opacity 0.22s ease;
}

.subject-card::after,
.lesson-card::after {
  content: "→";
  position: absolute;
  right: 24px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #061019;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  font-size: 24px;
  font-weight: 950;
  transform: translateX(-4px);
  opacity: 0.88;
}

.subject-card:hover,
.lesson-card:hover {
  transform: translateY(-9px) scale(1.012);
  border-color: rgba(66, 197, 216, 0.56);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.48);
}

.subject-card:hover::before,
.lesson-card:hover::before {
  opacity: 1;
}

.subject-card span,
.lesson-card span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  height: 66px;
  margin-bottom: 26px;
  padding: 0 14px;
  border-radius: 22px;
  color: #051018;
  background: linear-gradient(135deg, var(--green), var(--cyan));
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -0.04em;
  box-shadow: 0 18px 44px rgba(50, 213, 131, 0.18);
}

.subject-card h2,
.lesson-card h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  font-size: clamp(26px, 2.1vw, 36px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.subject-card p,
.lesson-card p {
  position: relative;
  z-index: 1;
  max-width: 92%;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.subject-card code,
.lesson-card code {
  color: #dffcff;
}

.subject-card-disabled,
.lesson-card-disabled {
  opacity: 0.66;
  cursor: default;
}

.subject-card-disabled:hover,
.lesson-card-disabled:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.28);
}

@media (min-width: 1500px) {
  .subject-grid,
  .lesson-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .subject-grid,
  .lesson-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .page {
    padding: 22px 14px 42px;
  }

  .hero {
    padding: 28px 22px;
    border-radius: 24px;
  }

  h1 {
    font-size: clamp(42px, 14vw, 62px);
  }

  .hero p:not(.eyebrow) {
    font-size: 17px;
  }

  .search-panel {
    grid-template-columns: 1fr;
    padding: 22px;
    border-radius: 24px;
  }

  .search-form {
    flex-direction: column;
  }

  .search-form button {
    min-height: 50px;
  }

  .subject-grid,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .subject-card,
  .lesson-card {
    min-height: 240px;
    padding: 24px;
    border-radius: 24px;
  }
}
