@font-face {
  font-family: "Rahavõluri pealkiri";
  src: url("assets/pealkiri-ExtraBold.woff") format("woff");
  font-weight: 700 900;
  font-display: swap;
}
:root {
  --navy: #32152f;
  --ink: #38253a;
  --paper: #28132e;
  --white: #fff9eb;
  --line: #e6d2df;
  --yellow: #ffc83f;
  --lime: #d6fa62;
  --pink: #ff82b9;
  --display: "Rahavõluri pealkiri", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
}
body {
  background:
    radial-gradient(circle, #fff1e221 1px, transparent 1.5px) 0 0 / 19px 19px,
    linear-gradient(150deg, #231327 30%, #421a45 73%, #57214e);
}
.topbar { background: #fff3da; border-bottom: 3px solid var(--pink); }
.brand { font-size: 1.15rem; letter-spacing: -.045em; }
.brand-coin {
  flex: none;
  width: 66px;
  height: auto;
  filter: drop-shadow(0 2px 1px #76371255);
}
@media (max-width: 760px) {
  .brand-coin { width: 54px; }
}
nav a { padding: 7px 0; }
nav a:hover { color: #8a205c; }
.hero { background: #3c183b; }
.hero::after {
  background: linear-gradient(90deg, #28112e 0%, #3b173dfc 24%, #3c173fdd 39%, #4b1b4929 71%, transparent 100%);
}
.hero h1 {
  font-size: clamp(3.35rem, 6.7vw, 7.15rem);
  letter-spacing: -.06em;
  line-height: .98;
  text-shadow: 0 4px #28112e, 0 8px 18px #28112ec0;
}
.hero h1 strong {
  color: #ffdc45;
  text-shadow: 1px 2px #743211, 2px 5px #743211, 3px 8px #743211, 0 11px 20px #271328a0;
  -webkit-text-stroke: 1px #743211;
  letter-spacing: -.06em;
}
.eyebrow { color: var(--lime); }
.lede { font-weight: 550; }
.primary {
  background: var(--lime);
  border-color: #32152f;
  box-shadow: 0 4px #32152f;
  border-radius: 14px;
}
.primary:hover:not(:disabled) { background: #ecff9f; }
.hero .primary { border-color: #a4c135; box-shadow: 0 4px #718522; }
.secondary { background: #fff4e3; border-color: #caa6bf; }
.secondary:hover { background: #ffdeec; }
.summary { background: #ffd15a; border-block: 3px solid #30152e; }
.summary-inner > div + div { border-color: #9a5b3180; }
.summary small { color: #543446; }
.sticker {
  display: block;
  flex: none;
  width: var(--sticker-size, 56px);
  aspect-ratio: 1;
  background: url("assets/viktoriini-ikoonid.webp") 0 0 / 200% 200% no-repeat;
}
.sticker-time { background-position: 100% 0; }
.sticker-trophy { background-position: 0 100%; }
.sticker-question { background-position: 100% 100%; }
.rules h2, .book h2 { letter-spacing: -.04em; }
.rules h2, .rankings h1, .overview h2 { color: #fff4e5; }
.rule-grid article {
  background: #fff9eb;
  border: 2px solid #28132e;
  border-top: 7px solid #bfe847;
  box-shadow: 0 5px #140a17a8;
}
.rule-grid article:nth-child(2) { border-top-color: var(--pink); }
.rule-grid article:nth-child(3) { border-top-color: #ffb044; }
.rule-grid .sticker {
  --sticker-size: 68px;
  margin: -3px 0 5px;
  border-radius: 17px;
  background-color: #ecffab;
}
.rule-grid .sticker-time { background-color: #ffd4e7; }
.rule-grid .sticker-trophy { background-color: #ffdfa0; }
.rule-grid p, .book p { color: #51404e; }
.book { background: #f6d5ed; border: 2px solid #28132e; }
.book img { box-shadow: 3px 5px #703963; }
.text-link { color: #752653; }
.rankings > .text-link, .overview > .text-link { color: var(--lime); }
footer { background: #1d101e; border-top: 4px solid var(--pink); }
.play, .result { position: relative; }
.question-card, .result-card {
  border-color: #dcb7ca;
  border-top: 6px solid var(--pink);
  box-shadow: 0 6px #190d1aa0;
}
.result-card { border-top-color: #ffa93f; }
.result-sticker { --sticker-size: 76px; margin: 0 auto 12px; }
.timer { background: #ffe3ee; border-color: #c078a0; color: var(--ink); }
.timer .sticker { --sticker-size: 39px; }
.overline, .play .notice, #rank-status { color: #fff4e5; }
progress { background: #78446d; }
progress::-webkit-progress-bar { background: #78446d; }
progress::-webkit-progress-value { background: var(--lime); }
progress::-moz-progress-bar { background: var(--lime); }
.topic { background: #c4f96e; }
.answer { background: #fff4f7; border-color: #e7cfdd; }
.answer b { background: #f8cae2; color: var(--ink); }
.answer:has(input:checked) { background: #edfbc5; border-color: #567033; }
.answer:has(input:checked) b { background: #415b2b; color: #fff; }
.jump[aria-current=true] { background: #fff2bd; border-color: #926519; }
.score-detail > div { background: #eaf5dd; }
.score-detail > div:last-child { background: #fff0b8; }
@media (max-width: 760px) {
  .hero h1 { font-size: clamp(3.05rem, 11.5vw, 5.6rem); }
  .hero::after { background: linear-gradient(180deg, #2d1331 0%, #3d173c 39%, #421a43f5 50%, #4b1b4931 73%, transparent 88%); }
  .hero-art { background-position: 74% center; }
  .summary .sticker { --sticker-size: 40px; }
  .rule-grid article {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    column-gap: 13px;
  }
  .rule-grid .sticker {
    --sticker-size: 54px;
    grid-row: span 2;
    margin: 1px 0 0;
  }
  .rule-grid p { grid-column: 2; }
}
@media (max-width: 370px) {
  .hero h1 { font-size: clamp(2.65rem, 11.5vw, 3.4rem); }
  .brand { font-size: 1rem; }
}
@font-face {
  font-family: "Rahavõluri pealkiri";
  src: url("assets/pealkiri-ExtraBoldItalic.woff") format("woff");
  font-style: italic;
  font-weight: 800 900;
  font-display: swap;
}
.hero h1 strong { font-style: italic; }
.start-status { color: #fff1b5; margin: .7rem 0 0; }
.start-status:empty, .notice:empty { display: none; }
.notice { color: #8b321c; font-weight: 700; }
.result-actions a { text-decoration: none; }
.entry-form {
  margin: 26px 0 0;
  padding: clamp(16px, 4vw, 25px);
  border: 1px solid #d0e3a9;
  border-radius: 16px;
  background: #f0f8dc;
  text-align: left;
}
.entry-form h2 { margin: 0; font-size: 1.45rem; }
.entry-fields {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .8fr);
  align-items: start; gap: 14px; margin: 16px 0;
}
.entry-fields label { display: grid; min-width: 0; gap: 4px; font-weight: 750; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#entry-status:empty { display: none; }
.entry-fields input {
  width: 100%; min-width: 0; padding: 10px 12px; min-height: 46px;
  border: 1px solid #6d977c; border-radius: 8px; color: var(--ink); background: white; font: inherit;
}
.rankings { width: min(1100px, calc(100% - 38px)); padding: clamp(24px, 5vw, 43px) 0 60px; }
.rank-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 12px clamp(12px, 4vw, 40px);
  border: 2px solid var(--pink);
  border-radius: 22px;
  background:
    radial-gradient(circle, #fff1e230 1px, transparent 1.5px) 0 0 / 14px 14px,
    linear-gradient(115deg, #56174b 30%, #86215f 100%);
  box-shadow: 0 5px #190d1aa0;
}
.rankings h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 5rem);
  font-style: italic;
  letter-spacing: -.055em;
  text-shadow: 2px 4px #34112d;
}
.rank-hero .sticker { --sticker-size: clamp(70px, 21vw, 156px); transform: rotate(8deg); }
.rank-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 2vw, 14px);
  margin-top: 18px;
}
.rank-switch .button {
  justify-content: center;
  gap: clamp(8px, 2vw, 20px);
  padding: 12px clamp(10px, 2.5vw, 24px);
  min-height: 76px;
  border: 2px solid #dcabd0;
  border-radius: 17px;
  background: #fae9f4;
  color: var(--navy);
  text-align: left;
  font: 900 clamp(1.05rem, 3.2vw, 1.9rem) / 1.15 var(--display);
  box-shadow: 0 4px #190d1aa0, inset 0 1px #ffffff90;
}
.rank-switch [data-board="schools"] { background: #f0f7d8; border-color: #c9da95; }
.rank-switch [aria-pressed="true"] {
  background: linear-gradient(125deg, #ffe1ef, #ffadd2);
  border-color: var(--pink);
  box-shadow: 0 4px #a84c80, inset 0 1px #fffc;
}
.rank-switch [data-board="schools"][aria-pressed="true"] {
  background: linear-gradient(125deg, #f3fac7, #d5ef88);
  border-color: #bfe847;
  box-shadow: 0 4px #768a32, inset 0 1px #fffc;
}
.rank-sticker {
  --sticker-size: clamp(42px, 8vw, 68px);
  background: url("assets/edetabeli-ikoonid.webp") 0 50% / 200% 100% no-repeat;
}
.school-sticker { background-position: 100% 50%; }
#rank-status:empty { display: none; }
.rank-board {
  padding: clamp(12px, 3vw, 28px);
  background: var(--white);
  border: 1px solid #e6d2df;
  border-top: 7px solid var(--pink);
  border-radius: 17px;
  margin: 18px 0;
  box-shadow: 0 5px #190d1aa0;
}
#schools { border-top-color: #bfe847; }
.rank-explainer {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.5vw, 24px);
  padding: clamp(14px, 2.5vw, 25px);
  margin-bottom: 18px;
  border: 1px solid #e8acd0;
  border-radius: 14px;
  background: linear-gradient(115deg, #ffd8ef, #fff1f6);
  color: var(--navy);
}
#schools .rank-explainer {
  border-color: #c8dc86;
  background: linear-gradient(115deg, #e6f4b4, #f8fbe7);
}
.rank-explainer h2 {
  margin: 0;
  font: 900 clamp(1.25rem, 3.5vw, 2.1rem) / 1.12 var(--display);
}
.rank-board p { margin: .55em 0 .9em; }
.rank-explainer p { margin: .45em 0 0; line-height: 1.5; }
.rank-table { overflow-x: auto; border-radius: 10px; }
.rank-board table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.rank-board th, .rank-board td { padding: 9px 7px; text-align: left; overflow-wrap: anywhere; border-bottom: 1px solid #ead7e1; }
.rank-board th { background: #f8c8e0; color: var(--navy); }
#schools th { background: #d8f4a5; }
.rank-board th:first-child { width: 3.4em; }
.rank-board th:last-child { width: 5.7em; }
.rank-board th:last-child, .rank-board td:last-child { text-align: right; }
#schools th:nth-child(3) { width: 5.4em; }
.rank-board tbody tr[data-podium] td:first-child { color: #552842; background: #ffe08a; font-weight: 900; }
.rank-board tbody tr[data-podium]:nth-child(2) td:first-child { background: #eddaef; }
.rank-board tbody tr[data-podium]:nth-child(3) td:first-child { background: #ffd3ac; }
.rank-board tbody tr:nth-child(even) { background: #fff1eb; }
.rank-pagination, .rank-page-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-pagination { justify-content: space-between; margin: 0 0 10px; }
.rank-range, .rank-page-controls label { font-size: .9rem; font-weight: 750; }
.rank-page-controls select, .rank-page-controls button {
  min-height: 44px; padding: 5px 10px; border: 1px solid #c79eb8; border-radius: 8px;
  background: #fff1f6; font: inherit; color: var(--navy);
}
.rank-page-controls select { margin-inline-start: 3px; }
.rank-page-controls button { min-width: 44px; font-weight: 800; }
.rank-page-controls button:disabled { color: #675568; background: #f4ecee; }
@media (max-width: 510px) {
  .topbar-inner { gap: 8px; }
  .topbar nav { flex-wrap: wrap; justify-content: end; gap: 0 11px; font-size: .78rem; }
  .topbar .book-nav { display: none; }
  .rank-board th, .rank-board td { padding-inline: 4px; }
  #students th:nth-child(2) { width: 30%; }
}
@media (max-width: 410px) {
  .rank-switch { grid-template-columns: 1fr; }
  .rank-switch .button { min-height: 62px; }
  .rank-explainer { align-items: flex-start; }
}
.school-picker { min-width: 0; display: grid; gap: 9px; }
.entry-fields select {
  width: 100%; min-width: 0; min-height: 46px;
  border: 1px solid #6d977c; border-radius: 8px;
  appearance: none;
  background: white linear-gradient(45deg, transparent 52%, #246048 52%) calc(100% - 17px) center / 5px 5px no-repeat;
  background-image: linear-gradient(45deg, transparent 52%, #246048 52%), linear-gradient(135deg, #246048 52%, transparent 52%);
  background-position: calc(100% - 17px) center, calc(100% - 12px) center;
  color: var(--ink); font: inherit; text-overflow: ellipsis; padding: 9px 28px 9px 11px;
}
.school-picker [role="status"] { font-size: .9rem; margin: 0; }
.school-picker [role="status"]:empty { display: none; }
@media (max-width: 610px) { .entry-fields { grid-template-columns: 1fr; } }

:focus-visible { outline-color: #932864; }
.hero :focus-visible, .overview :focus-visible, .rank-switch :focus-visible,
.rankings > .text-link:focus-visible { outline-color: var(--pink); }
.answer:has(input:focus-visible) { outline-color: #932864; }
