:root {
  --page-max: 1220px;
  --page-gutter: clamp(1rem, 4vw, 3.5rem);
  --bg: #f7f1e5;
  --bg-soft: #efe7d6;
  --card: rgba(255, 252, 244, 0.94);
  --card-strong: #fffdf8;
  --green: #173f34;
  --green-2: #276b55;
  --wine: #8f3440;
  --line: rgba(23, 63, 52, 0.16);
  --muted: #5d6d64;
  --good: #17714f;
  --bad: #b43f45;
  --shadow: 0 18px 46px rgba(42, 58, 46, 0.1);
  --shadow-soft: 0 12px 34px rgba(42, 58, 46, 0.08);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Manrope", Arial, sans-serif;
  color: var(--green);
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.76), rgba(247, 241, 229, 0.96)),
    var(--bg);
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(143, 52, 64, 0.38);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.62rem max(var(--page-gutter), calc((100vw - var(--page-max)) / 2));
  background: rgba(255, 252, 244, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  font-weight: 800;
  font-size: clamp(0.78rem, 1.5vw, 0.96rem);
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand span,
.crumb {
  overflow-wrap: anywhere;
}

.brand img {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.7rem, 2vw, 1.2rem);
  color: #315d4f;
  font-weight: 700;
}

.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--green);
  border-color: rgba(143, 52, 64, 0.5);
}

.nav-toggle {
  display: none;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green);
  background: #fffdf8;
  padding: 0 1rem;
  font-weight: 800;
}

#app {
  flex: 1 0 auto;
  display: grid;
  align-content: start;
  min-height: 0;
}

.hero,
.levels-section,
.selection-shell,
.about-section,
.registration-shell,
.quiz-shell,
.result-shell,
.rating-shell,
.legal-page,
.admin-shell {
  width: min(var(--page-max), calc(100% - (var(--page-gutter) * 2)));
  margin: 0 auto;
}

.hero {
  position: relative;
  display: grid;
  align-items: start;
  width: min(var(--page-max), calc(100% - (var(--page-gutter) * 2)));
  min-height: clamp(520px, 70vh, 720px);
  margin-top: clamp(0.75rem, 2vh, 1.25rem);
  overflow: hidden;
  border-radius: 24px;
  isolation: isolate;
  background-image: linear-gradient(90deg, rgba(247, 241, 229, 0.98) 0%, rgba(247, 241, 229, 0.82) 40%, rgba(247, 241, 229, 0.24) 70%);
  box-shadow: 0 18px 52px rgba(42, 58, 46, 0.08);
  --hero-x: 0px;
  --hero-y: 0px;
  --hero-scroll: 0px;
  animation: hero-reveal 900ms ease both;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -3%;
  z-index: 0;
  background-image: url("/assets/fon.png");
  background-size: cover;
  background-position: center right;
  transform: translate3d(
      calc(var(--hero-x) * -0.012),
      calc(var(--hero-y) * -0.012 + var(--hero-scroll) * -0.04),
      0
    )
    scale(1.02);
  opacity: 0.82;
  filter: saturate(0.96) contrast(1.02);
  will-change: transform;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(63, 74, 68, 0.06) 0,
      rgba(63, 74, 68, 0.06) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.18), transparent 28%),
    radial-gradient(circle at 78% 72%, rgba(91, 76, 58, 0.08), transparent 24%);
  animation: grain-drift 16s linear infinite;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-content {
  width: min(620px, 100%);
  padding: clamp(1.35rem, 4vw, 2.6rem) clamp(1.5rem, 5vw, 4rem) clamp(2rem, 4vw, 3.2rem);
}

.selection-shell {
  width: min(var(--page-max), calc(100% - (var(--page-gutter) * 2)));
  margin: 0 auto;
  min-height: calc(100dvh - 154px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

.selection-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(1rem, 2.4vw, 1.4rem);
  margin-bottom: clamp(1.1rem, 3vw, 1.8rem);
}

.selection-head .section-heading {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--wine);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Prata", Georgia, serif;
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.7rem, 7vw, 6rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.16;
}

h3 {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.25;
}

.hero-text,
.section-heading p,
.inline-note,
.small,
.result-message,
.legal-text p,
.form-head p {
  color: var(--muted);
  line-height: 1.65;
}

.hero-text {
  width: min(520px, 100%);
  margin: 1.15rem 0 0;
  font-size: clamp(1rem, 2vw, 1.22rem);
}

.organizer {
  color: #315d4f;
  font-weight: 800;
}

.timeline {
  position: absolute;
  right: clamp(1.4rem, 5vw, 4rem);
  bottom: clamp(1.2rem, 4vw, 3rem);
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  padding-top: 0.8rem;
  color: rgba(23, 63, 52, 0.76);
  font-size: 0.9rem;
  font-weight: 800;
  border-top: 1px solid rgba(23, 63, 52, 0.18);
  animation:
    timeline-in 700ms ease both,
    timeline-breathe 6s ease-in-out 0.9s infinite alternate;
  will-change: transform;
}

@keyframes timeline-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-reveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes grain-drift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  25% {
    transform: translate3d(-0.4%, 0.25%, 0);
  }
  50% {
    transform: translate3d(0.25%, -0.35%, 0);
  }
  75% {
    transform: translate3d(0.5%, 0.15%, 0);
  }
  100% {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes timeline-breathe {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-2px);
  }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.button-primary {
  color: #ffffff;
  background: linear-gradient(135deg, var(--green), var(--green-2));
  box-shadow: 0 14px 26px rgba(23, 63, 52, 0.22);
}

.button-secondary {
  color: var(--green);
  background: #fffdf8;
  border: 1px solid var(--line);
}

.button-back {
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  color: #315d4f;
  background: rgba(255, 253, 248, 0.45);
  box-shadow: none;
}

.button-back:hover {
  border-color: rgba(39, 107, 85, 0.3);
  background: rgba(255, 253, 248, 0.75);
}

.levels-section,
.about-section,
.registration-shell,
.quiz-shell,
.result-shell,
.rating-shell,
.legal-page {
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 1.4rem;
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.level-card,
.registration-panel,
.question-card,
.result-summary,
.diploma-wrapper,
.legal-text,
.admin-panel,
.admin-login,
.stat-card,
.consent-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.level-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 300px;
  padding: clamp(1.35rem, 3vw, 1.8rem);
  box-shadow: var(--shadow-soft);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.level-card:hover {
  border-color: rgba(39, 107, 85, 0.42);
  box-shadow: 0 18px 42px rgba(42, 58, 46, 0.13);
  transform: translateY(-3px);
}

.level-card h3 {
  margin-top: 1rem;
}

.level-card p:not(.small) {
  color: var(--green);
  line-height: 1.6;
}

.level-card .small {
  margin-top: 1.15rem;
}

.level-card .hero-actions {
  margin-top: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  color: var(--green);
  background: rgba(39, 107, 85, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.about-section {
  padding-top: 0;
}

.registration-panel {
  width: min(780px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 2rem);
}

.form-head {
  min-width: 0;
  margin-bottom: 1.3rem;
}

.form-head h1 {
  margin-top: 0.8rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.crumb {
  color: #315d4f;
  font-weight: 800;
}

.form-grid,
.filters-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

label span,
.label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--green);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(23, 63, 52, 0.22);
  border-radius: 12px;
  background: #ffffff;
  color: var(--green);
  padding: 0.9rem 1rem;
}

input,
select {
  font-size: max(16px, 1rem);
}

textarea {
  min-height: 340px;
  resize: vertical;
}

.field-error {
  display: block;
  min-height: 1.35rem;
  margin-top: 0.35rem;
  color: var(--bad);
  font-weight: 700;
}

.consent-card {
  margin-top: 1rem;
  padding: 1rem;
  box-shadow: none;
}

.consent-row {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.consent-row input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.consent-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1rem;
  margin-top: 0.8rem;
  color: var(--green-2);
  font-weight: 800;
}

.link-button {
  min-height: 44px;
  border: 0;
  color: var(--green-2);
  background: transparent;
  padding: 0;
  cursor: pointer;
  font-weight: 800;
  text-decoration: underline;
}

.consent-modal {
  width: min(760px, calc(100% - 2rem));
  max-height: min(80vh, 760px);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--green);
  background: #fffdf8;
  padding: 0;
  box-shadow: 0 30px 80px rgba(23, 63, 52, 0.28);
}

.consent-modal::backdrop {
  background: rgba(23, 63, 52, 0.42);
}

.modal-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  background: #ffffff;
  cursor: pointer;
  font-size: 1.6rem;
}

.legal-text {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.legal-text h3 {
  margin-top: 1.2rem;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.quiz-topbar h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.progress-box {
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.progress-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 63, 52, 0.12);
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--wine));
  transition: width 0.25s ease;
}

.question-card {
  min-height: 340px;
  padding: clamp(1.1rem, 3vw, 1.7rem);
}

.question-card h2 {
  max-width: 980px;
  margin-bottom: 1.2rem;
}

.answer-grid,
.match-grid {
  display: grid;
  gap: 0.85rem;
}

.answer-option {
  min-height: 52px;
  border: 1px solid rgba(23, 63, 52, 0.16);
  border-radius: 12px;
  color: var(--green);
  background: #ffffff;
  padding: 1rem;
  text-align: left;
  cursor: pointer;
}

.answer-option.correct,
.match-row.correct {
  border-color: rgba(23, 113, 79, 0.72);
  background: rgba(23, 113, 79, 0.1);
}

.answer-option.wrong,
.match-row.wrong {
  border-color: rgba(180, 63, 69, 0.7);
  background: rgba(180, 63, 69, 0.09);
}

.question-explanation {
  margin-top: 1rem;
  padding: 1rem;
  color: var(--green);
  background: rgba(143, 52, 64, 0.08);
  border: 1px solid rgba(143, 52, 64, 0.18);
  border-radius: 12px;
  line-height: 1.6;
}

.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1rem;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 1rem;
  align-items: center;
  padding: 0.9rem;
  border: 1px solid rgba(23, 63, 52, 0.14);
  border-radius: 12px;
  background: #ffffff;
}

.result-shell {
  display: grid;
  gap: 1rem;
}

.result-summary,
.diploma-wrapper {
  padding: clamp(1.2rem, 4vw, 2rem);
}

.result-summary h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.result-score {
  margin: 0.8rem 0;
  color: var(--wine);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800;
}

.participant-number {
  display: inline-flex;
  margin: 0;
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  color: var(--green);
  background: rgba(39, 107, 85, 0.1);
  font-weight: 800;
}

.diploma-card {
  position: relative;
  width: min(100%, 980px);
  aspect-ratio: 1.414 / 1;
  margin: 0 auto;
  display: grid;
  align-content: center;
  overflow: hidden;
  padding: clamp(1rem, 4vw, 3rem);
  color: var(--green);
  background:
    linear-gradient(135deg, rgba(143, 52, 64, 0.08), transparent 32%),
    linear-gradient(180deg, #fff8e8, #efe2c9);
  border: 1px solid rgba(23, 63, 52, 0.22);
  border-radius: 16px;
}

.diploma-card::before,
.diploma-card::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(23, 63, 52, 0.24);
  pointer-events: none;
}

.diploma-card::after {
  inset: 28px;
  border-color: rgba(143, 52, 64, 0.18);
}

.diploma-org,
.diploma-mark,
.diploma-subtitle,
.diploma-issued,
.diploma-name,
.diploma-quiz,
.diploma-result,
.diploma-date,
.diploma-footer {
  position: relative;
  z-index: 1;
  text-align: center;
}

.diploma-org {
  max-width: 760px;
  margin: 0 auto 1rem;
  font-weight: 800;
  line-height: 1.45;
}

.diploma-mark {
  margin: 0;
  color: var(--wine);
  font-family: "Prata", Georgia, serif;
  font-size: clamp(2.2rem, 7vw, 5.8rem);
  line-height: 1;
  text-transform: uppercase;
}

.diploma-subtitle,
.diploma-issued {
  margin: 0.6rem 0 0;
  font-weight: 800;
  text-transform: uppercase;
}

.diploma-name {
  max-width: 760px;
  margin: 1rem auto 0.8rem;
  font-family: "Prata", Georgia, serif;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.diploma-quiz,
.diploma-result,
.diploma-date {
  margin: 0.35rem 0;
  font-weight: 700;
}

.commemorative-emblem {
  position: absolute;
  right: clamp(1.5rem, 6vw, 4rem);
  bottom: clamp(1.5rem, 5vw, 3rem);
  width: clamp(68px, 12vw, 112px);
  height: clamp(68px, 12vw, 112px);
  display: grid;
  place-items: center;
  border: 2px solid rgba(143, 52, 64, 0.66);
  border-radius: 50%;
  color: var(--wine);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
}

.diploma-footer {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.3rem;
  font-weight: 800;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.segmented button,
.admin-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--green);
  background: #fffdf8;
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 800;
}

.segmented button.active,
.admin-tab.active {
  color: #ffffff;
  background: var(--green);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--green);
  background: rgba(39, 107, 85, 0.08);
}

tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
}

.site-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1rem max(var(--page-gutter), calc((100vw - var(--page-max)) / 2));
  color: #315d4f;
  background: #fffdf8;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.45;
}

.site-footer div,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.site-footer nav {
  justify-content: flex-end;
}

.site-footer a {
  color: var(--green-2);
  font-weight: 700;
}

.admin-shell {
  padding: clamp(1rem, 4vw, 2rem) 0 4rem;
}

.admin-panel,
.admin-login {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.admin-login {
  width: min(460px, 100%);
  margin-top: 10vh;
}

.admin-login-form,
.admin-editor {
  display: grid;
  gap: 1rem;
}

.stats-grid,
.table-grid {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stat-card {
  padding: 1rem;
  box-shadow: none;
}

.stat-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 2rem;
}

.admin-actions,
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.admin-tabs {
  justify-content: flex-start;
}

.status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(39, 107, 85, 0.1);
  color: var(--green);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: var(--page-gutter);
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: min(280px, calc(100vw - 2rem));
    padding: 0.75rem;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }

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

  .hero {
    min-height: clamp(520px, 72vh, 620px);
    background-image: linear-gradient(180deg, rgba(247, 241, 229, 0.98) 0%, rgba(247, 241, 229, 0.9) 48%, rgba(247, 241, 229, 0.36) 100%);
  }

  .hero::before {
    inset: -2%;
    opacity: 0.88;
    transform: none;
  }

  .hero::after {
    opacity: 0.08;
    animation: none;
  }

  .hero-content {
    transform: none;
  }

  .timeline {
    left: clamp(1.4rem, 5vw, 3rem);
    right: auto;
    animation: timeline-in 600ms ease both;
  }

  .levels-grid,
  .quiz-topbar {
    grid-template-columns: 1fr;
  }

  .selection-shell {
    min-height: auto;
    justify-content: flex-start;
    padding-top: clamp(1.2rem, 5vw, 2rem);
  }
}

@media (max-width: 640px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 0.65rem 0.75rem;
    gap: 0.5rem;
  }

  .brand img {
    width: 38px;
    height: 38px;
  }

  .brand {
    gap: 0.55rem;
    font-size: 0.72rem;
  }

  .nav-toggle {
    flex: 0 0 auto;
    padding-inline: 0.75rem;
  }

  .form-grid,
  .filters-row,
  .match-row {
    grid-template-columns: 1fr;
  }

  .hero,
  .levels-section,
  .about-section,
  .registration-shell,
  .quiz-shell,
  .result-shell,
  .rating-shell,
  .legal-page,
  .admin-shell {
    width: calc(100% - 1rem);
    min-width: 0;
  }

  .site-nav {
    right: 0.5rem;
  }

  .registration-panel {
    padding: 0.95rem;
    overflow-wrap: anywhere;
  }

  .hero {
    border-radius: 16px;
  }

  .hero-content {
    padding: clamp(1.2rem, 7vw, 1.8rem) clamp(1rem, 6vw, 1.4rem) 2rem;
  }

  .hero-actions .button {
    width: 100%;
  }

  .timeline {
    width: calc(100% - 2rem);
    justify-content: space-between;
    font-size: 0.9rem;
  }

  .diploma-card {
    aspect-ratio: auto;
    min-height: 560px;
  }

  .commemorative-emblem {
    position: relative;
    right: auto;
    bottom: auto;
    margin: 1rem auto 0;
  }

  .site-footer {
    flex-direction: column;
    padding-inline: 1rem;
  }

  .site-footer nav {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .hero,
  .hero::before,
  .hero::after,
  .hero-content,
  .timeline {
    animation: none !important;
    transform: none !important;
  }

  .hero::after {
    content: none !important;
  }
}

@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  body {
    background: #ffffff;
  }

  body * {
    visibility: hidden;
  }

  #diploma-card,
  #diploma-card * {
    visibility: visible;
  }

  #diploma-card {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: auto;
    box-shadow: none;
    border-radius: 0;
  }

  .no-print {
    display: none !important;
  }
}
