:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eaf0e7;
  --ink: #18211c;
  --muted: #637064;
  --line: #d8ded5;
  --accent: #2f6b4f;
  --accent-strong: #1f5139;
  --accent-soft: #dcebe1;
  --league: #144f70;
  --warning: #c07a2d;
  --danger: #a6403b;
  --shadow: 0 18px 50px rgba(32, 53, 39, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  line-height: 1.8;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 56px);
  background: rgba(246, 247, 244, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.25;
}

.brand small {
  color: var(--muted);
  font-size: 0.8rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #324137;
  font-weight: 700;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.main-nav .league-link {
  background: var(--ink);
  color: #fff;
}

.main-nav .league-link:hover,
.main-nav .league-link.active {
  background: var(--league);
  color: #fff;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  font-weight: 800;
}

.hero,
.page,
.league-shell {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.hero {
  min-height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  padding: 48px 0;
}

.hero-copy h1,
.page-hero h1,
.about-hero h1,
.league-hero h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.5rem, 6vw, 5.8rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-kicker {
  width: fit-content;
  margin: 0 0 18px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.hero-copy p:not(.section-kicker),
.page-hero p,
.about-hero p,
.league-hero p,
.section-heading p {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-actions,
.big-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.btn:active,
button:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.btn.secondary:hover {
  border-color: var(--accent);
}

.btn.disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.hero-media {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface-soft);
}

.hero-media img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
}

.section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0;
}

.section-heading {
  margin-bottom: 26px;
}

.section-heading h2,
.split-section h2,
.side-panel h2,
.values-section h2,
.tool-panel h2,
.question-bank h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.25;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.feature-card {
  min-height: 230px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(32, 53, 39, 0.06);
}

.feature-wide {
  grid-row: span 2;
  background: linear-gradient(135deg, #ffffff, #e9f0ec);
}

.feature-card.tinted {
  background: var(--accent-soft);
}

.feature-card.dark {
  background: var(--ink);
  color: #fff;
}

.feature-card h3,
.file-card h2,
.lesson-card h2,
.value-list h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.feature-card p {
  color: inherit;
  opacity: 0.82;
}

.feature-card a {
  display: inline-block;
  margin-top: 18px;
  font-weight: 900;
  color: var(--accent-strong);
}

.feature-card.dark a {
  color: #dcebe1;
}

.split-section {
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 72px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
  padding: 36px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.check-list,
.value-list {
  display: grid;
  gap: 12px;
}

.check-list span,
.value-list article {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-weight: 800;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1180px, calc(100% - 32px));
  margin: 48px auto 0;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 900;
}

.page {
  padding: 54px 0 24px;
}

.page-hero.compact {
  padding: 36px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.page-hero.compact h1 {
  max-width: none;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
}

.lesson-layout,
.contact-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-top: 24px;
  align-items: start;
}

.side-panel,
.contact-note,
.tool-panel {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 22px;
}

.side-panel {
  position: sticky;
  top: 92px;
}

.side-panel a {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-weight: 800;
}

.lesson-list {
  display: grid;
  gap: 18px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.lesson-card img {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border-radius: var(--radius);
  object-fit: cover;
}

.lesson-card span,
.file-type {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-weight: 900;
}

.lesson-card ul {
  margin: 12px 0 0;
  padding-inline-start: 20px;
}

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

.content-status,
.form-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 800;
}

.form-message {
  margin: 0;
  min-height: 48px;
}

.content-status.success,
.form-message.success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.content-status.info,
.form-message.info {
  background: #edf5f8;
  color: #17384c;
}

.content-status.error,
.form-message.error {
  background: #f9e3e1;
  color: #7f2824;
  border-color: #edb8b4;
}

.empty-state {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.empty-state h2 {
  margin: 0 0 8px;
}

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

.file-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.file-type {
  width: 58px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.file-unit {
  color: var(--accent-strong);
  font-weight: 900;
}

.about-hero {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 28px;
  align-items: center;
}

.about-hero img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.values-section {
  margin-top: 36px;
}

.value-list {
  grid-template-columns: repeat(3, 1fr);
}

.contact-form {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.admin-page {
  padding-bottom: 10px;
}

.admin-login {
  display: grid;
  place-items: center;
  margin-top: 24px;
}

.admin-panel {
  margin-top: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  align-items: start;
}

.admin-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 32px rgba(32, 53, 39, 0.07);
}

.admin-login .admin-card {
  max-width: 560px;
}

.admin-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

.admin-card p {
  margin: 0;
  color: var(--muted);
}

.api-help {
  margin-top: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 1px solid #bac5bb;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #6d786e;
}

input:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(47, 107, 79, 0.32);
  outline-offset: 2px;
}

.league-body {
  background:
    linear-gradient(135deg, rgba(20, 79, 112, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(47, 107, 79, 0.12), transparent 42%),
    var(--bg);
}

.league-header .brand-mark {
  background: var(--league);
}

.league-shell {
  padding: 30px 0 60px;
}

.league-hero {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 420px);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}

.league-hero > div:first-child,
.league-result {
  border-radius: var(--radius);
  border: 1px solid rgba(20, 79, 112, 0.22);
  background: rgba(255, 255, 255, 0.86);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: var(--shadow);
}

.league-hero h1 {
  color: var(--league);
  max-width: none;
}

.league-result {
  display: grid;
  place-items: center;
  min-height: 190px;
  text-align: center;
  color: var(--league);
  font-size: clamp(2rem, 4vw, 3.8rem);
  font-weight: 900;
  line-height: 1.25;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.team-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid rgba(20, 79, 112, 0.18);
  box-shadow: 0 14px 36px rgba(20, 79, 112, 0.1);
}

.team-card h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
}

.score {
  display: grid;
  place-items: center;
  min-height: 112px;
  border-radius: var(--radius);
  background: #edf5f8;
  color: var(--league);
  font-size: clamp(3.2rem, 7vw, 5.6rem);
  font-weight: 900;
  line-height: 1;
}

.score-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.score-actions button,
.random-tools button {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  background: var(--league);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.score-actions button[data-delta="-3"] {
  background: var(--danger);
}

.score-actions button[data-reset] {
  background: #6b7280;
}

.league-tools {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  margin-top: 14px;
}

.points-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.points-grid span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: #edf5f8;
  color: #17384c;
  font-weight: 800;
}

.points-grid strong {
  color: var(--league);
}

.random-tools .btn.primary {
  background: var(--league);
}

.student-picker {
  margin: 18px 0 12px;
}

.question-bank {
  margin-top: 30px;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.question-card {
  padding: 20px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(20, 79, 112, 0.18);
}

.question-card h3 {
  margin: 0 0 8px;
  color: var(--league);
}

.question-card p {
  margin: 7px 0;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.option-list span {
  padding: 6px 10px;
  border-radius: var(--radius);
  background: #edf5f8;
  color: #17384c;
  font-weight: 800;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121812;
    --surface: #1b241d;
    --surface-soft: #243227;
    --ink: #edf4ee;
    --muted: #b8c5ba;
    --line: #334137;
    --accent: #6db58c;
    --accent-strong: #bce3c9;
    --accent-soft: #253b2d;
    --league: #7cc3e1;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  }

  .site-header {
    background: rgba(18, 24, 18, 0.92);
  }

  .main-nav a {
    color: #dce7de;
  }

  input,
  textarea {
    background: #121812;
    color: var(--ink);
    border-color: #4a5a4e;
  }

  input::placeholder,
  textarea::placeholder {
    color: #a9b8ab;
  }

  .league-body {
    background:
      linear-gradient(135deg, rgba(124, 195, 225, 0.12), transparent 36%),
      linear-gradient(315deg, rgba(109, 181, 140, 0.13), transparent 42%),
      var(--bg);
  }

  .league-hero > div:first-child,
  .league-result,
  .question-card {
    background: rgba(27, 36, 29, 0.9);
  }

  .score,
  .points-grid span,
  .option-list span {
    background: #182d38;
    color: #d8f1fb;
  }

  .content-status.info,
  .form-message.info {
    background: #182d38;
    color: #d8f1fb;
  }

  .content-status.error,
  .form-message.error {
    background: #3d211f;
    color: #ffd5d2;
    border-color: #71423e;
  }
}

@media (max-width: 1024px) {
  .hero,
  .about-hero,
  .league-hero,
  .league-tools,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .scoreboard,
  .file-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .side-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    min-height: 64px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 72px;
    inset-inline: 16px;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .main-nav.open {
    display: flex;
  }

  .hero,
  .page,
  .league-shell,
  .section,
  .split-section,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  .hero {
    min-height: auto;
    padding: 30px 0;
  }

  .hero-copy h1,
  .page-hero h1,
  .about-hero h1,
  .league-hero h1 {
    max-width: none;
    font-size: clamp(2.1rem, 13vw, 3.5rem);
  }

  .feature-grid,
  .split-section,
  .lesson-card,
  .value-list,
  .question-grid,
  .scoreboard,
  .file-grid,
  .points-grid {
    grid-template-columns: 1fr;
  }

  .split-section,
  .page-hero.compact {
    padding: 22px;
  }

  .lesson-card img {
    min-height: 190px;
  }

  .site-footer {
    flex-direction: column;
  }

  .league-result {
    min-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
