:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #fff;
  --surface-2: #e8eee9;
  --text: #15221a;
  --muted: #536259;
  --border: #cbd6ce;
  --accent: #826116;
  --accent-hover: #684b0d;
  --accent-soft: #f3ead1;
  --accent-border: #cbb16c;
  --focus-ring: #826116;
  --accent-text: #fff;
  --warm-accent: #a66f24;
  --warm-surface: #e8ede0;
  --danger: #a02222;
  --focus: #826116;
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s12: 3rem;
  --radius: .65rem;
  --shadow: 0 5px 14px rgba(20, 45, 28, .07);
  --shell-width: 72rem;
  --shell-gutter: clamp(1rem, 4vw, 2rem);
}

[data-role-theme="team"],
[data-role-theme="tester"] {
  --accent: #826116;
  --accent-hover: #684b0d;
  --accent-soft: #f3ead1;
  --accent-border: #cbb16c;
  --focus: #826116;
  --focus-ring: #826116;
  --warm-accent: #826116;
}

[data-role-theme="grader"] {
  --accent: #245a9a;
  --accent-hover: #194678;
  --accent-soft: #e3edf9;
  --accent-border: #8eb1da;
  --focus: #245a9a;
  --focus-ring: #245a9a;
  --warm-accent: #245a9a;
}

.team-shell .site-header form { margin: 0; }
.team-account { color: var(--text-muted); font-size: .9rem; max-width: 18rem; overflow: hidden; white-space: nowrap; }
.team-dashboard, .team-form-page { padding-block: clamp(2rem, 7vh, 5rem); }
.team-hero { max-width: 52rem; margin: 0 auto 1.5rem; text-align: center; }
.team-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
.team-edition-summary { max-width: 56rem; margin-inline: auto; }
.team-edition-summary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0; }
.team-edition-summary dt { color: var(--text-muted); font-size: .85rem; }
.team-edition-summary dd { margin: .3rem 0 0; font-weight: 650; }
.team-primary-action { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.team-form-page { max-width: 42rem; margin-inline: auto; }
.team-form-page .landing-card { margin-top: 1rem; }
.team-form-page form { display: grid; gap: .8rem; }
@media (max-width: 42rem) {
  .team-account { display: none; }
  .team-edition-summary dl { grid-template-columns: 1fr; text-align: center; }
}

* { box-sizing: border-box; }

html {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  line-height: 1.55;
  background: var(--bg);
}

.public-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.public-home-page {
  --shell-width: 78rem;
  background-color: #f6f2e9;
  background-image: linear-gradient(rgba(250, 248, 242, .2), rgba(250, 248, 242, .2)), url("/static/team-background-hungarian-christian.webp");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
}

a { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.shell-container {
  width: min(100% - (2 * var(--shell-gutter)), var(--shell-width));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: -5rem;
  left: var(--s4);
  padding: var(--s3);
  background: var(--surface);
}

.skip-link:focus { top: var(--s4); }

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  min-height: 4.125rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--s2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.brand-motif {
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  overflow: visible;
  fill: var(--warm-accent);
  stroke: none;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--s2);
}

.header-login-action {
  display: grid;
  justify-items: end;
  gap: .15rem;
}

.header-login-action small {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.role-badge {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: .25rem .65rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: .82rem;
  font-weight: 750;
}

.button.header-cta {
  min-height: 2.5rem;
  align-items: center;
  padding: .55rem .85rem;
  white-space: nowrap;
}

main.shell-container {
  flex: 1;
  padding-block: clamp(3rem, 9vh, 5.5rem) clamp(2rem, 6vw, 4.5rem);
}

.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.footer-inner {
  min-height: 3.75rem;
  padding-block: var(--s4);
}

.footer-inner p { margin: 0; overflow-wrap: anywhere; }

.footer-grid { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: var(--s4); }
.site-footer a { color: var(--muted); text-underline-offset: .2em; }
.site-footer a:hover { color: var(--text); }
.footer-school { justify-self: start; }
.footer-copyright { justify-self: center; text-align: center; }
.footer-privacy { justify-self: end; text-align: right; }

h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2.25rem, 4vw, 3rem);
  line-height: 1.08;
  text-wrap: balance;
}

h2 { font-size: 1.35rem; }

.hero {
  padding: clamp(1.6rem, 4vw, 2.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
}

.hero-content { max-width: 53rem; }

.empty-state {
  max-width: 53rem;
  margin-inline: auto;
  padding-block: clamp(1.6rem, 4vw, 2.75rem);
}

.empty-state .hero-content {
  width: 100%;
  max-width: 53rem;
  margin-inline: auto;
  text-align: center;
}

.empty-state .hero-content > h1,
.empty-state .hero-content > .lead {
  text-align: center;
}

.empty-state .hero-content > .lead {
  margin-inline: auto;
}

.lead {
  max-width: 55ch;
  margin: var(--s4) 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.125rem);
}

.button,
button {
  display: inline-flex;
  padding: .7rem 1rem;
  border: 0;
  border-radius: .45rem;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.button:hover,
button:hover { background: var(--accent-hover); }

.button.secondary,
button.secondary {
  border: 1px solid var(--accent-border);
  background: var(--surface);
  color: var(--accent-hover);
}

.button.secondary:hover,
button.secondary:hover { background: var(--accent-soft); }

.public-grid {
  display: grid;
  margin-top: var(--s6);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--s4);
}

.competition-hero {
  display: flow-root;
  padding-block: clamp(2rem, 3.5vw, 2.8rem);
}
.competition-hero .hero-content { max-width: none; }
.hero-eyebrow { margin: 0 0 var(--s2); color: var(--warm-accent); font-size: .82rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hero-visual {
  float: right;
  width: min(38%, 28rem);
  margin: var(--s4) 0 var(--s4) clamp(1.5rem, 3vw, 2rem);
}
.hero-visual img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: calc(var(--radius) - .1rem);
}
.hero-intro { max-width: none; overflow: visible; line-height: 1.68; }
.hero-intro p { margin-block: var(--s4) var(--s3); }
.hero-intro > p:first-child { color: var(--text); font-size: 1.06rem; font-weight: 650; }
.hero-intro blockquote,
.hero-intro p:has(> em:only-child) { margin: var(--s6) 0 var(--s3); padding: var(--s3) var(--s4); border-left: 3px solid color-mix(in srgb, var(--warm-accent) 72%, var(--border)); border-radius: 0 .35rem .35rem 0; background: color-mix(in srgb, var(--warm-surface) 55%, transparent); color: var(--muted); }
.quick-facts { display: grid; margin: var(--s4) 0 0; padding: var(--s4) 0; border-block: 1px solid var(--border); grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); }
.quick-facts > div { display: grid; min-width: 0; padding: var(--s3) var(--s4); place-content: center; text-align: center; border-inline-start: 1px solid var(--border); }
.quick-facts > div:first-child { border-inline-start: 0; }
.quick-facts dt { color: var(--warm-accent); font-size: .875rem; font-weight: 800; line-height: 1.35; letter-spacing: .045em; text-transform: uppercase; }
.quick-facts dd { max-width: 24ch; margin: var(--s1) auto 0; color: var(--text); font-size: 1.02rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.competition-flow { margin-top: 2.5rem; }
.competition-flow > h2 { font-size: clamp(1.65rem, 3vw, 2.1rem); }
.competition-flow ol { position: relative; display: grid; margin: var(--s6) 0 0; padding: 0; gap: var(--s6); list-style: none; }
.flow-steps-1 { grid-template-columns: minmax(0, 1fr); }
.flow-steps-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flow-steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.flow-steps-2::before, .flow-steps-3::before { position: absolute; z-index: 0; top: 1rem; height: 1px; background: var(--border); content: ""; }
.flow-steps-2::before { right: calc((100% - var(--s6)) / 4); left: calc((100% - var(--s6)) / 4); }
.flow-steps-3::before { right: calc((100% - (2 * var(--s6))) / 6); left: calc((100% - (2 * var(--s6))) / 6); }
.competition-flow li { position: relative; display: grid; min-width: 0; grid-template-rows: 2rem auto; justify-items: center; gap: var(--s3); }
.competition-flow .step-content { min-width: 0; width: 100%; padding: var(--s4); border: 1px solid color-mix(in srgb, var(--border) 72%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 82%, transparent); text-align: center; }
.competition-flow h3 { margin: 0 0 var(--s3); font-size: 1.25rem; }
.step-metadata { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
.step-metadata > div { display: grid; gap: var(--s1); }
.step-metadata dt { color: var(--muted); font-size: .95rem; font-weight: 650; }
.step-metadata dd, .step-value { color: var(--text); font-size: 1.02rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.step-number { position: relative; z-index: 2; display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: var(--warm-accent); color: #17120b; font-weight: 800; }
.final-location { display: grid; max-width: 58rem; margin: var(--s8) auto 0; padding-top: var(--s4); border-top: 1px solid var(--border); grid-template-columns: 1fr; justify-items: center; gap: var(--s2); text-align: center; }
.final-location > svg { width: 1.5rem; fill: none; stroke: var(--warm-accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.final-location dl { display: grid; max-width: 50rem; margin: 0 auto; grid-template-columns: 1fr; justify-items: center; gap: var(--s1); text-align: center; }
.final-location dt { color: var(--muted); font-size: .95rem; font-weight: 650; }
.final-location dd { font-size: 1.05rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.closing-section { width: 100%; margin-top: 2.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid color-mix(in srgb, var(--warm-accent) 55%, var(--border)); border-radius: var(--radius); background: var(--warm-surface); }
.closing-section.has-patron:not(.patron-only) { display: grid; grid-template-columns: minmax(0, 3fr) minmax(12rem, 1fr); gap: clamp(1.5rem, 4vw, 3rem); }
.closing-section.no-patron,
.closing-section.patron-only { display: block; }
.closing-prizes { display: grid; min-width: 0; grid-template-columns: 3rem minmax(0, 1fr); align-items: start; gap: var(--s6); }
.closing-prizes > svg { width: 2.6rem; margin-top: .15rem; fill: none; stroke: var(--warm-accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.closing-prizes .rich-content { max-width: 78ch; }
.closing-section.no-patron .closing-prizes { width: 100%; }
.closing-section.no-patron .closing-prizes .rich-content { max-width: none; }
.closing-section h2 { margin: 0 0 var(--s3); }
.closing-patron { min-width: 0; padding-left: clamp(1rem, 3vw, 2rem); border-left: 1px solid color-mix(in srgb, var(--warm-accent) 45%, var(--border)); }
.closing-section.patron-only .closing-patron { padding-left: 0; border-left: 0; }
.closing-patron h2 { color: var(--muted); font-size: 1rem; font-weight: 700; }
.closing-patron p { margin: 0; font-size: clamp(1.05rem, 1.7vw, 1.2rem); font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.open-days { margin-top: var(--s12); border-top: 1px solid var(--border); padding-top: var(--s6); }
.open-days-card { display: flex; width: min(70%, 56rem); max-width: 100%; margin-inline: auto; padding: var(--s3) var(--s4); border: 1px solid color-mix(in srgb, var(--warm-accent) 42%, var(--border)); border-radius: var(--radius); flex-wrap: wrap; align-items: center; column-gap: 1.75rem; row-gap: .75rem; background: color-mix(in srgb, var(--warm-surface) 55%, var(--surface)); color: var(--text); text-decoration: none; }
.open-days-card:hover { border-color: var(--warm-accent); background: var(--warm-surface); }
.open-days-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.open-days-inner { display: flex; width: 100%; min-width: 0; flex-wrap: wrap; align-items: center; column-gap: 1.75rem; row-gap: .75rem; }
.open-days-title { display: inline-flex; margin: 0; flex: 0 0 auto; align-items: center; gap: .6rem; font-size: 1rem; font-weight: 750; white-space: nowrap; }
.open-days-icon { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; fill: none; stroke: var(--warm-accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.open-days-dates { display: inline-flex; min-width: 0; margin: 0; padding: 0; flex: 0 1 auto; flex-wrap: nowrap; align-items: baseline; gap: .75rem; list-style: none; }
.open-day-item { display: inline-flex; align-items: baseline; gap: .75rem; white-space: nowrap; }
.open-day-item:not(:last-child)::after { color: var(--warm-accent); content: "·"; font-weight: 800; }
.open-day-item time { display: inline-flex; align-items: baseline; gap: .35rem; color: var(--text); font-size: .88rem; font-weight: 700; }
.open-day-date { color: var(--muted); letter-spacing: .025em; text-transform: uppercase; }
.open-days-cta { margin-left: auto; flex: 0 0 auto; color: var(--accent); font-size: .92rem; font-weight: 750; white-space: nowrap; }
.rich-content p:first-child { margin-top: 0; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content a { overflow-wrap: anywhere; }

.card,
.auth-card,
.error-card {
  padding: var(--s6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.span-all { grid-column: 1 / -1; }

.auth-card,
.error-card {
  max-width: 38rem;
  margin: 5vh auto;
}

.auth-card form {
  display: grid;
  gap: var(--s4);
}

.test-access-page main.shell-container { display: grid; align-content: start; }
.test-access-card { max-width: 32rem; margin-top: clamp(2rem, 8vh, 5rem); }
.test-access-card h1 { font-size: clamp(2rem, 5vw, 2.6rem); }
.test-access-card .eyebrow { margin: 0 0 var(--s2); color: var(--warm-accent); font-size: .82rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.test-access-card input[name="code"] { font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: .35em; text-align: center; }
.test-access-card button { justify-content: center; }

.admin-login-card {
  max-width: 30rem;
  margin: clamp(2.5rem, 7vh, 5rem) auto 0;
  padding: 1.35rem;
}

.admin-login-card h1 { font-size: clamp(2rem, 4vw, 2.5rem); }

.admin-login-card .auth-helper {
  margin: var(--s2) 0 var(--s4);
  color: var(--muted);
}

.admin-login-card form { gap: var(--s3); }

.admin-login-card input,
.admin-login-card button { min-height: 2.65rem; }

.admin-login-card button { justify-content: center; }

.admin-login-page :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: var(--s2);
  font-weight: 650;
}

input,
select,
textarea {
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s2) var(--s4);
}

dd { margin: 0; }

@media (max-width: 52rem) {
  .competition-hero, .competition-flow ol { grid-template-columns: 1fr; }
  .hero-visual {
    float: none;
    width: 100%;
    max-width: 32rem;
    margin: var(--s4) 0;
  }
  .quick-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-facts > div:nth-child(odd) { border-inline-start: 0; }
  .quick-facts > div:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .flow-steps-2::before, .flow-steps-3::before { display: none; }
  .competition-flow li { grid-template-columns: 2.25rem minmax(0, 1fr); grid-template-rows: auto; justify-items: start; }
  .competition-flow li:not(:last-child)::after { position: absolute; z-index: 0; top: 1rem; bottom: calc(-1 * var(--s6)); left: 1rem; width: 1px; background: var(--border); content: ""; }
  .competition-flow .step-content { text-align: left; }
  .closing-section.has-patron:not(.patron-only) { grid-template-columns: 1fr; }
  .closing-patron { padding-top: var(--s6); padding-left: 0; border-top: 1px solid color-mix(in srgb, var(--warm-accent) 45%, var(--border)); border-left: 0; }
  .open-days-title { order: 1; }
  .open-days-card { width: 100%; }
  .open-days-dates { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .open-days-cta { order: 2; margin-left: auto; }
  .footer-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .footer-school, .footer-copyright, .footer-privacy { justify-self: center; text-align: center; }
}

@media (max-width: 48rem) {
  .public-home-page {
    background-position: 88% top;
    background-attachment: scroll;
    background-size: auto 100svh;
  }
}

@media (max-width: 34rem) {
  :root { --shell-gutter: .75rem; }

  .header-inner {
    min-height: 4rem;
    gap: var(--s2);
  }

  .brand {
    gap: var(--s1);
    font-size: clamp(.84rem, 4vw, 1rem);
  }

  .brand-motif {
    width: 1.3rem;
    height: 1.3rem;
  }

  .header-actions { gap: var(--s1); }
  .header-login-action small { max-width: 7.5rem; font-size: .66rem; white-space: normal; text-align: right; }
  .header-cta { padding-inline: .7rem; }

  main.shell-container { padding-block: var(--s8) var(--s6); }

  h1 { font-size: clamp(2rem, 10vw, 2.75rem); }

  .hero,
  .empty-state { padding: 1.25rem; }

  .hero-visual { max-width: 100%; }
  .quick-facts { grid-template-columns: 1fr; }
  .quick-facts > div { border-top: 1px solid var(--border); border-inline-start: 0; }
  .quick-facts > div:first-child { border-top: 0; }
  .closing-prizes { grid-template-columns: 1fr; }
  .open-days { margin-top: var(--s8); padding-top: var(--s4); }
  .open-days-card { padding: var(--s4); }
  .open-days-inner { display: grid; width: fit-content; max-width: 100%; margin-inline: auto; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: var(--s4); }
  .open-days-title { justify-self: center; flex-basis: auto; white-space: normal; }
  .open-days-dates { display: grid; width: fit-content; max-width: 100%; grid-template-columns: max-content max-content; justify-content: center; column-gap: 2rem; row-gap: .75rem; }
  .open-day-item, .open-day-item time { display: contents; }
  .open-day-item:not(:last-child)::after { display: none; }
  .open-day-time::before { display: none; content: none; }
  .open-days-cta { width: auto; margin-left: 0; justify-self: center; order: 4; text-align: center; }

  .admin-login-card {
    width: 100%;
    margin-top: var(--s6);
    padding: 1.25rem;
  }
}

@media (max-width: 22rem) {
  .brand { font-size: .72rem; }
  .brand-motif {
    width: 1.25rem;
    height: 1.25rem;
  }
  .header-cta { padding-inline: .55rem; }
}

@media print {
  .public-home-page {
    background-color: #fff;
    background-image: none;
  }
}

.role-notice { padding: 1rem; border: 2px solid var(--accent); background: var(--surface-2); border-radius: .65rem; }
