/* Colours come from one set of variables. The visitor may leave the choice to
   their system, pick light or dark themselves, or switch on a high-contrast
   scheme; each level below overrides the one above it. */
:root {
  --bg: #f4f1ea;
  --card-bg: #ffffff;
  --card-border: #2b2b2b;
  --text: #1f1f1f;
  --accent: #c0392b;
  --shadow: rgba(0, 0, 0, 0.15);
  --text-scale: 1;
}

/* the system preference applies unless the visitor asked for light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17171a;
    --card-bg: #232327;
    --card-border: #e8e6df;
    --text: #f0efe9;
    --accent: #e0574a;
    --shadow: rgba(0, 0, 0, 0.5);
  }
}

/* an explicit choice wins in both directions */
:root[data-theme="dark"] {
  --bg: #17171a;
  --card-bg: #232327;
  --card-border: #e8e6df;
  --text: #f0efe9;
  --accent: #e0574a;
  --shadow: rgba(0, 0, 0, 0.5);
}

/* high-contrast schemes for low vision; these override the theme entirely */
:root[data-contrast="high"] {
  --bg: #ffffff;
  --card-bg: #ffffff;
  --card-border: #000000;
  --text: #000000;
  --accent: #0000cc;
  --shadow: rgba(0, 0, 0, 0.4);
}

:root[data-contrast="inverted"] {
  --bg: #000000;
  --card-bg: #000000;
  --card-border: #ffffff;
  --text: #ffffff;
  --accent: #ffffff;
  --shadow: rgba(255, 255, 255, 0.25);
}

:root[data-contrast="yellow"] {
  --bg: #000000;
  --card-bg: #000000;
  --card-border: #ffdd00;
  --text: #ffdd00;
  --accent: #ffdd00;
  --shadow: rgba(255, 221, 0, 0.25);
}

/* larger text for anyone who needs it; rem-based sizes follow the root */
:root[data-textsize="l"] { --text-scale: 1.2; }
:root[data-textsize="xl"] { --text-scale: 1.45; }

html {
  font-size: calc(100% * var(--text-scale));
}

/* a high-contrast scheme means solid edges, not faint ones */
:root[data-contrast] .card,
:root[data-contrast] .ad-banner {
  opacity: 1;
}

* {
  box-sizing: border-box;
}

:root {
  --container: min(1300px, 92vw);
  --gap: clamp(1.2rem, 1.5vw, 2rem);
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.5rem, 3vw, 3rem) 1rem clamp(2rem, 5vw, 4rem);
}

/* Free text above the advertising banner. Size, typeface and the frame are
   chosen in the admin; each choice is rendered as a class, so the stored value
   can never be anything but one of the whitelisted names. */
.header-text {
  width: 100%;
  max-width: var(--container);
  margin-bottom: clamp(1rem, 2vw, 1.6rem);
  text-align: center;
  color: var(--text);
  font-weight: 700;
  line-height: 1.25;
  white-space: pre-line;  /* the line breaks typed in the textarea survive */
}

.header-text.has-border {
  border: 2px solid var(--card-border);
  border-radius: 10px;
  padding: clamp(0.6rem, 1.5vw, 1.1rem) clamp(0.8rem, 2vw, 1.4rem);
}

/* the admin picks an exact pixel size; 12vw keeps a large headline from
   swallowing a narrow phone screen, and only ever bites below ~1000px wide */
.header-text {
  font-size: min(calc(var(--header-px, 34) * 1px * var(--text-scale, 1)), 12vw);
}

/* every stack ends in a generic family, so no font has to be downloaded */
.header-text.font-system { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }
.header-text.font-serif { font-family: Georgia, "Times New Roman", Times, serif; }
.header-text.font-mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.header-text.font-condensed { font-family: "Arial Narrow", "Helvetica Neue Condensed", Impact, sans-serif; }
.header-text.font-rounded { font-family: "Century Gothic", "Avenir Next", "Trebuchet MS", sans-serif; }

.ad-banner {
  width: 100%;
  max-width: var(--container);
  min-height: clamp(90px, 9vw, 140px);
  border: 2px dashed var(--card-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.6;
  font-size: calc(clamp(0.9rem, 1vw, 1.15rem) * var(--text-scale, 1));
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: clamp(2rem, 3vw, 3rem);
}

.grid {
  width: 100%;
  max-width: var(--container);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.grid.secondary {
  grid-template-columns: repeat(3, 1fr);
  max-width: calc((3 * var(--container) - var(--gap)) / 4);
}

.prostovoljci-wrap {
  position: relative;
}

.prostovoljci-wrap .card {
  width: 100%;
  height: 100%;
}

.social-icons {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  margin-left: var(--gap);
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) / 2);
}

.social-icon {
  display: block;
  width: clamp(36px, 4vw, 56px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  box-shadow: 0 4px 10px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.social-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.social-icon:hover,
.social-icon:focus-visible {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 8px 16px var(--shadow);
}

@media (max-width: 640px) {
  .prostovoljci-wrap .card {
    height: auto;
  }
  .social-icons {
    position: static;
    transform: none;
    justify-content: center;
    flex-direction: row;
    margin-left: 0;
    margin-top: calc(var(--gap) / 2);
  }
}

.card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  aspect-ratio: 1 / 1;
  border: 3px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  font-size: calc(clamp(1.05rem, 1.5vw, 1.6rem) * var(--text-scale, 1));
  letter-spacing: 0.03em;
  padding: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px var(--shadow);
  background-color: var(--accent);
  color: #fff;
}

/* an uploaded card picture fills the whole card, edge to edge inside the border,
   and the title sits in black over it -- by default across the lower part, but the
   admin can slide it anywhere between the top and the bottom (--label-pos, 0..100).
   0 and 100 sit flush against the border, with no gap left over. */
.card.has-photo {
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  position: relative;
  align-items: flex-end;
  padding: 0 0 0.7rem;
}

.card.has-photo .label {
  background: none;
  color: #000;
  padding: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  /* taken out of the flex flow so the position is exact at either end */
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  top: calc(var(--label-pos, 100) * 1%);
  transform: translateY(calc(var(--label-pos, 100) * -1%));
}

.card.has-photo:hover,
.card.has-photo:focus-visible {
  background-color: transparent;
}

.card.has-photo:hover .label,
.card.has-photo:focus-visible .label {
  background: none;
  color: #000;
}

/* the same treatment for the Prijava kluba / Info tiles on a sport page */
.action-btn.has-photo {
  /* the drawn icon used to give the tile its height; the picture does now */
  aspect-ratio: 1 / 1;
  /* this tile is a COLUMN flex, so justify-content is vertical and align-items
     is horizontal -- the opposite of .card above, which is a row */
  justify-content: flex-end;
  align-items: center;
  padding: 0 0 0.7rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.action-btn.has-photo {
  position: relative;
}

.action-btn.has-photo .tile-label {
  color: #000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  top: calc(var(--label-pos, 100) * 1%);
  transform: translateY(calc(var(--label-pos, 100) * -1%));
}

.action-btn.has-photo:hover .tile-label,
.action-btn.has-photo:focus-visible .tile-label {
  color: #000;
}

.card-kosarka,
.card-nogomet,
.card-pikado,
.card-orientacija {
  background-repeat: no-repeat;
  background-position: center;
  background-size: 68%;
}

.card-kosarka {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='47' fill='%23e8732c' stroke='%231f1f1f' stroke-width='3'/><line x1='3' y1='50' x2='97' y2='50' stroke='%231f1f1f' stroke-width='3'/><line x1='50' y1='3' x2='50' y2='97' stroke='%231f1f1f' stroke-width='3'/><path d='M17 17 Q50 50 17 83' fill='none' stroke='%231f1f1f' stroke-width='3'/><path d='M83 17 Q50 50 83 83' fill='none' stroke='%231f1f1f' stroke-width='3'/></svg>");
}

.card-nogomet {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='47' fill='%23fafaf7' stroke='%231f1f1f' stroke-width='3'/><polygon points='50,35 64.3,45.4 58.8,62.1 41.2,62.1 35.7,45.4' fill='%231f1f1f'/><polygon points='77.6,12 82.4,26.5 70,35.5 57.6,26.5 62.4,12' fill='%231f1f1f'/><polygon points='90,50 94.7,64.5 82.3,73.5 70,64.5 74.7,50' fill='%231f1f1f'/><polygon points='57.6,73.5 62.4,88 50,97 37.6,88 42.4,73.5' fill='%231f1f1f'/><polygon points='25.3,50 30,64.5 17.7,73.5 5.3,64.5 10,50' fill='%231f1f1f'/><polygon points='37.6,12 42.4,26.5 30,35.5 17.6,26.5 22.4,12' fill='%231f1f1f'/></svg>");
}

.card-pikado {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='47' fill='%23fafaf0' stroke='%231f1f1f' stroke-width='3'/><path d='M50,50 L97,50 A47,47 0 0,1 95,64.5 Z' fill='%231f1f1f'/><path d='M50,50 L88,77.6 A47,47 0 0,1 78,88 Z' fill='%231f1f1f'/><path d='M50,50 L64.5,95 A47,47 0 0,1 50,97 Z' fill='%231f1f1f'/><path d='M50,50 L35.5,95 A47,47 0 0,1 22,88 Z' fill='%231f1f1f'/><path d='M50,50 L12,78 A47,47 0 0,1 5,64.5 Z' fill='%231f1f1f'/><path d='M50,50 L3,50 A47,47 0 0,1 5,35.5 Z' fill='%231f1f1f'/><path d='M50,50 L12,22 A47,47 0 0,1 22,12 Z' fill='%231f1f1f'/><path d='M50,50 L35.5,5 A47,47 0 0,1 50,3 Z' fill='%231f1f1f'/><path d='M50,50 L64.5,5 A47,47 0 0,1 78,12 Z' fill='%231f1f1f'/><path d='M50,50 L88,22 A47,47 0 0,1 95,35.5 Z' fill='%231f1f1f'/><circle cx='50' cy='50' r='40' fill='none' stroke='%23c0392b' stroke-width='4'/><circle cx='50' cy='50' r='28' fill='none' stroke='%232f8f46' stroke-width='4'/><circle cx='50' cy='50' r='9' fill='%232f8f46'/><circle cx='50' cy='50' r='4' fill='%23c0392b'/></svg>");
}

.card-orientacija {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><circle cx='50' cy='50' r='47' fill='%23fafaf7' stroke='%231f1f1f' stroke-width='3'/><line x1='90' y1='50' x2='96' y2='50' stroke='%231f1f1f' stroke-width='1.5'/><line x1='84.6' y1='70' x2='89.8' y2='73' stroke='%231f1f1f' stroke-width='1.5'/><line x1='70' y1='84.6' x2='73' y2='89.8' stroke='%231f1f1f' stroke-width='1.5'/><line x1='50' y1='90' x2='50' y2='96' stroke='%231f1f1f' stroke-width='1.5'/><line x1='30' y1='84.6' x2='27' y2='89.8' stroke='%231f1f1f' stroke-width='1.5'/><line x1='15.4' y1='70' x2='10.2' y2='73' stroke='%231f1f1f' stroke-width='1.5'/><line x1='10' y1='50' x2='4' y2='50' stroke='%231f1f1f' stroke-width='1.5'/><line x1='15.4' y1='30' x2='10.2' y2='27' stroke='%231f1f1f' stroke-width='1.5'/><line x1='30' y1='15.4' x2='27' y2='10.2' stroke='%231f1f1f' stroke-width='1.5'/><line x1='50' y1='10' x2='50' y2='4' stroke='%231f1f1f' stroke-width='1.5'/><line x1='70' y1='15.4' x2='73' y2='10.2' stroke='%231f1f1f' stroke-width='1.5'/><line x1='84.6' y1='30' x2='89.8' y2='27' stroke='%231f1f1f' stroke-width='1.5'/><polygon points='71.2,28.8 52.83,52.83 47.17,47.17' fill='%231f1f1f'/><polygon points='71.2,71.2 52.83,47.17 47.17,52.83' fill='%231f1f1f'/><polygon points='28.8,71.2 52.83,52.83 47.17,47.17' fill='%231f1f1f'/><polygon points='28.8,28.8 52.83,47.17 47.17,52.83' fill='%231f1f1f'/><polygon points='88,50 50,46 50,54' fill='%231f1f1f'/><polygon points='50,88 46,50 54,50' fill='%231f1f1f'/><polygon points='12,50 50,54 50,46' fill='%231f1f1f'/><polygon points='50,12 46,50 54,50' fill='%23c0392b'/><circle cx='50' cy='50' r='4' fill='%231f1f1f'/></svg>");
}

.card-hotel {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect x='0' y='0' width='100' height='100' fill='%23bcdff0'/><polygon points='0,42 15,25 30,40 45,18 60,36 75,14 90,32 100,40 100,50 0,50' fill='%238fa088'/><rect x='0' y='84' width='100' height='16' fill='%236fa050'/><polygon points='8,58 50,18 92,50 92,58 50,26 8,66' fill='%233f3f42'/><polygon points='8,66 50,26 92,58 92,86 8,86' fill='%23f0e9da'/><rect x='8' y='68' width='84' height='4' fill='%23c9702f'/><rect x='24' y='74' width='6' height='8' fill='%232b3550'/><rect x='34' y='72' width='6' height='9' fill='%232b3550'/><rect x='46' y='70' width='6' height='10' fill='%232b3550'/><rect x='58' y='72' width='6' height='9' fill='%232b3550'/><rect x='70' y='74' width='6' height='8' fill='%232b3550'/><rect x='9' y='78' width='3' height='10' fill='%235b3a24'/><polygon points='10.5,55 3,80 18,80' fill='%232f5233'/><rect x='85' y='76' width='3' height='12' fill='%235b3a24'/><polygon points='86.5,50 78,80 95,80' fill='%232f5233'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.card-prostovoljci {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect x='0' y='0' width='100' height='100' fill='%23f4f2ef'/><defs><g id='h'><rect x='-4' y='0' width='8' height='26' rx='4'/><ellipse cx='0' cy='-2' rx='6.5' ry='8'/><rect x='-1.6' y='-19' width='3.2' height='17' rx='1.6' transform='rotate(-32 0 -2)'/><rect x='-1.6' y='-19' width='3.2' height='17' rx='1.6' transform='rotate(-16 0 -2)'/><rect x='-1.6' y='-19' width='3.2' height='17' rx='1.6' transform='rotate(0 0 -2)'/><rect x='-1.6' y='-19' width='3.2' height='17' rx='1.6' transform='rotate(16 0 -2)'/><rect x='-1.6' y='-19' width='3.2' height='17' rx='1.6' transform='rotate(32 0 -2)'/></g></defs><use href='%23h' transform='translate(8,65.5) scale(1.44)' fill='%23e8b93a'/><use href='%23h' transform='translate(24,60.8) scale(1.62)' fill='%23e2622f'/><use href='%23h' transform='translate(40,63.7) scale(1.51)' fill='%23c0392b'/><use href='%23h' transform='translate(56,58.5) scale(1.71)' fill='%23c23a7a'/><use href='%23h' transform='translate(72,62) scale(1.58)' fill='%236a3fa0'/><use href='%23h' transform='translate(88,64.9) scale(1.47)' fill='%232f8f7a'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.card-info {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><defs><radialGradient id='infoGrad' cx='35%25' cy='30%25' r='75%25'><stop offset='0%25' stop-color='%237b86e8'/><stop offset='55%25' stop-color='%233f4bb8'/><stop offset='100%25' stop-color='%23181c5e'/></radialGradient></defs><circle cx='50' cy='50' r='47' fill='url(%23infoGrad)' stroke='%231f1f1f' stroke-width='2'/><ellipse cx='38' cy='24' rx='30' ry='14' fill='%23ffffff' opacity='0.18'/><circle cx='50' cy='50' r='20' fill='none' stroke='%23ffffff' stroke-width='5'/><circle cx='50' cy='38' r='3.2' fill='%23ffffff'/><rect x='46.5' y='45' width='7' height='18' rx='3' fill='%23ffffff'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 88%;
}

.card-kosarka .label,
.card-nogomet .label,
.card-pikado .label,
.card-orientacija .label,
.card-hotel .label,
.card-prostovoljci .label,
.card-info .label {
  background: var(--card-bg);
  padding: 0.15em 0.5em;
  border-radius: 8px;
}

.card-kosarka:hover .label,
.card-kosarka:focus-visible .label,
.card-nogomet:hover .label,
.card-nogomet:focus-visible .label,
.card-pikado:hover .label,
.card-pikado:focus-visible .label,
.card-orientacija:hover .label,
.card-orientacija:focus-visible .label,
.card-hotel:hover .label,
.card-hotel:focus-visible .label,
.card-prostovoljci:hover .label,
.card-prostovoljci:focus-visible .label,
.card-info:hover .label,
.card-info:focus-visible .label {
  background: var(--accent);
}

@media (max-width: 640px) {
  :root {
    --container: 100%;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.secondary {
    grid-template-columns: 1fr;
    max-width: calc((100% - var(--gap)) / 2);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  color: var(--text);
  border: 3px solid var(--card-border);
  border-radius: 14px;
  padding: 2rem 1.75rem 1.75rem;
  box-shadow: 0 12px 30px var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}



.modal-main {
  flex: 1 1 260px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--bg);
}

.modal-title {
  margin: 0 0 1.25rem;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-form input {
  font: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.modal-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.modal-submit {
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal-submit:hover,
.modal-submit:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--shadow);
}

.modal-list-panel {
  flex: 1 1 220px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg);
  padding: 0.75rem;
}

.modal-list-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: center;
}

.list-scroll-btn {
  flex: 0 0 auto;
  width: 100%;
  padding: 0.25rem;
  border: 2px solid var(--card-border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.list-scroll-btn:hover,
.list-scroll-btn:focus-visible {
  background: var(--accent);
  color: #fff;
}

.modal-list {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scroll-behavior: smooth;
}

.modal-list li {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--card-bg);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 640px) {
  .modal {
    max-width: 92vw;
  }
  .modal-body {
    flex-direction: column;
  }
  .modal-list-panel {
    height: 200px;
  }
}

/* --- public pages ------------------------------------------------------- */

.title {
  font-size: calc(clamp(1.6rem, 3vw, 2.4rem) * var(--text-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 1.5rem;
  text-align: center;
}

.action-row {
  width: 100%;
  max-width: var(--container);
  display: flex;
  flex-wrap: nowrap;          /* buttons and video stay on one line */
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  margin-bottom: 2rem;
}

/* .action-btn rides on .card, so it looks exactly like the Nazaj button */
.action-btn {
  flex: 0 0 auto;
  width: clamp(120px, 14vw, 175px);
  aspect-ratio: auto;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 0.8rem;
  font-family: inherit;
  font-size: calc(clamp(0.8rem, 1vw, 1rem) * var(--text-scale, 1));
  cursor: pointer;
}

.tile-icon {
  width: clamp(40px, 4.5vw, 62px);
  height: clamp(40px, 4.5vw, 62px);
  color: inherit;
}

.tile-label {
  text-align: center;
  line-height: 1.2;
}

.video-frame {
  flex: 1 1 auto;
  min-width: 0;               /* lets the video shrink instead of pushing a wrap */
  aspect-ratio: 16 / 9;
  border: 3px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 6px 16px var(--shadow);
}

.video-frame.standalone {
  flex: none;
  width: 100%;
  max-width: 760px;
  margin-top: 1.5rem;
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* videos 2-5: a simple grid below whatever the page already shows */
.video-gallery {
  width: 100%;
  max-width: var(--container);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 1.5rem;
}

.video-frame.gallery-item {
  flex: none;
  width: 100%;
  margin-top: 0;
}

.gallery-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* narrow screens: let it wrap, video underneath the two buttons */
@media (max-width: 700px) {
  .action-row {
    flex-wrap: wrap;
  }
  .action-btn {
    flex: 1 1 130px;
  }
  .video-frame {
    flex: 1 1 100%;
  }
}

.detail-box {
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
  padding: clamp(1rem, 2.5vw, 1.75rem);
  line-height: 1.65;
}

.detail-box > :first-child { margin-top: 0; }
.detail-box > :last-child { margin-bottom: 0; }

/* the discipline's Info text on its own page: a touch wider than a text column */
.detail-box.info-page {
  max-width: 820px;
}

.video-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  background: #ff0000;
  color: #fff;
  font-size: 1.3em;
  padding-left: 0.15em;
}

.page-content {
  width: 100%;
  max-width: 760px;
  line-height: 1.65;
}

.detail-box h2,
.detail-box h3,
.page-content h2,
.page-content h3 {
  margin: 1.6rem 0 0.6rem;
}

.detail-box img,
.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.page-content table {
  width: 100%;
  border-collapse: collapse;
}

.page-content th,
.page-content td {
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.page-clubs {
  width: 100%;
  max-width: 760px;
  margin-top: 2.5rem;
}

.page-clubs h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.club-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap);
  align-items: start;
}

.club-column h3 {
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--card-border);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.club-column ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.club-empty {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.55;
  font-style: italic;
}

.page-clubs ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}

.page-clubs li {
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--card-bg);
  padding: 0.45rem 0.7rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.muted {
  opacity: 0.65;
  font-weight: 400;
}

.back-link {
  width: 200px;
  aspect-ratio: auto;
  padding: 0.8rem;
  margin-top: 2rem;
}

.ad-banner.has-image {
  border-style: solid;
  opacity: 1;
  padding: 0;
  overflow: hidden;
  /* every slide sits in the same grid cell, so the banner is as tall as the
     tallest picture and swapping slides never moves the page */
  display: grid;
}

.ad-banner.has-image img {
  width: 100%;
  height: 100%;
  max-height: clamp(90px, 14vw, 200px);
  object-fit: contain;
}

/* the frame is optional; the banner keeps the width of the page either way */
.ad-banner.no-frame {
  border: 0;
  border-radius: 0;
}

.ad-slide {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-decoration: none;
}

/* one slide showing at a time; the rest are faded out and unclickable */
.ad-banner.sliding .ad-slide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.ad-banner.sliding .ad-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .ad-banner.sliding .ad-slide {
    transition: none;
  }
}

a.ad-banner {
  text-decoration: none;
}

.site-footer {
  margin-top: auto;
  padding-top: 2.5rem;
  font-size: 0.8rem;
  opacity: 0.55;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.site-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}

.player-fields {
  border: 2px solid var(--card-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem 0.75rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.player-fields legend {
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 0.3rem;
}

/* `.modal-form label` sets a column layout, so this needs equal specificity */
.modal-form label.player-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.player-num {
  flex: 0 0 1.6em;
  text-align: right;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.6;
}

.modal-form label.player-row input { flex: 1 1 auto; padding: 0.4rem 0.55rem; }

.field-label {
  display: block;
}

.counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.5rem;
  margin: -0.4rem 0 1.2rem;
}

.counter {
  border: 2px solid var(--card-border);
  border-radius: 8px;
  padding: 0.45rem 0.3rem;
  text-align: center;
  background: var(--bg);
}

.counter-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.counter-value {
  display: block;
  font-weight: 800;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.counter.is-full { border-color: var(--accent); }
.counter.is-full .counter-value { color: var(--accent); }

.signup-counter {
  margin: -0.7rem 0 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
  text-transform: none;
  letter-spacing: normal;
}

.signup-counter strong { font-variant-numeric: tabular-nums; }
.signup-counter.is-full { color: var(--accent); opacity: 1; }

.modal-form select {
  font: inherit;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.modal-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.req {
  color: var(--accent);
  margin-left: 0.25em;
  font-weight: 700;
}

.req-note {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.65;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.modal-message {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.modal-message.is-ok {
  color: #2f8f46;
}

.modal-message.is-error {
  color: var(--accent);
}

.modal-list li.is-empty {
  opacity: 0.6;
  font-weight: 400;
  font-style: italic;
}

/* --- sign-up as a full page ("Prijava kluba") -------------------------- */

.signup-page {
  width: 100%;
  max-width: var(--container);
  border: 3px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  box-shadow: 0 6px 16px var(--shadow);
}

.signup-page-sport {
  margin: 0 0 1.5rem;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.75;
}

.signup-page .counters {
  margin-bottom: 1.5rem;
}

/* the fields flow into as many columns as the width allows */
.signup-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.5rem;
  align-items: start;
}

.signup-form > .full,
.signup-form .player-fields,
.signup-form .req-note,
.signup-form .modal-message,
.signup-form .modal-submit {
  grid-column: 1 / -1;
}

.signup-form .modal-submit {
  justify-self: center;
  min-width: min(320px, 100%);
}

/* --- language selector --------------------------------------------------- */

/* the accessibility control stands to the left of the language selector; the
   panel hangs from the right edge of this bar, so it is always on screen */
.topbar {
  position: relative;
  width: 100%;
  max-width: var(--container);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 0.9rem;
  margin-bottom: 1rem;
}

.langbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.langbar-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  opacity: 0.7;
}

.langbar select {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.langbar select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* --- volunteers board ---------------------------------------------------- */

.board-toolbar {
  width: 100%;
  max-width: var(--container);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.btn-edit-layout {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn-edit-layout:hover { background: var(--accent); color: #fff; }

.board-hint { font-size: 0.8rem; opacity: 0.7; }

.board {
  position: relative;
  width: 100%;
  max-width: var(--container);
  min-height: 100px;
  overflow: hidden;
  /* no frame for visitors -- the buttons stand on the page background */
  border: 3px solid transparent;
  border-radius: 14px;
  background: transparent;
}

/* drag handle for resizing the canvas -- admins only, in edit mode */
.board-resize {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  width: 84px;
  height: 16px;
  border-radius: 8px;
  background: var(--card-border);
  opacity: 0;
  pointer-events: none;
  cursor: ns-resize;
  touch-action: none;
  z-index: 6;
}

.board-resize::after {
  content: "";
  position: absolute;
  inset: 6px 22px;
  border-top: 2px solid var(--card-bg);
  border-bottom: 2px solid var(--card-bg);
}

.board.is-editing .board-resize { opacity: 0.85; pointer-events: auto; }
.board.is-editing .board-resize:hover { opacity: 1; background: var(--accent); }
.board.is-resizing { user-select: none; }
.board.is-saving { outline: 2px dashed var(--accent); outline-offset: 3px; }
.board.is-error { outline: 3px solid #c0392b; outline-offset: 3px; }

/* the canvas edge is only shown while an admin is arranging the buttons */
.board.is-editing {
  border-color: var(--card-border);
  border-style: dashed;
  background-color: var(--card-bg);
  background-image:
    linear-gradient(var(--bg) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg) 1px, transparent 1px);
  background-size: 40px 40px;
  cursor: grab;
}

.board-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  opacity: 0.6;
  text-align: center;
  padding: 1rem;
}

.board-btn {
  position: absolute;
  width: clamp(110px, 13vw, 165px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 3px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  text-align: center;
  box-shadow: 0 4px 10px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.board-btn:hover,
.board-btn:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px var(--shadow);
  background: var(--accent);
  color: #fff;
  z-index: 2;
}

.board-btn img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.board-btn-placeholder {
  font-size: 2.6rem;
  line-height: 1.2;
}

.board-btn-name {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.board-btn-desc {
  font-size: 0.75rem;
  opacity: 0.75;
  line-height: 1.25;
}

.board.is-editing .board-btn { cursor: grab; }
.board-btn.is-dragging { cursor: grabbing; opacity: 0.85; z-index: 5; transition: none; }
.board-btn.is-saving { outline: 2px dashed var(--accent); outline-offset: 2px; }
.board-btn.is-error { outline: 3px solid #c0392b; outline-offset: 2px; }

/* --- discipline page: freely placed tiles and video -------------------- */
/* --- and the same free placement for the Info page's own board --------- */

/* until an admin arranges it, .disc-board is just the plain .action-row;
   .info-board starts out as its ordinary stacked text-box-then-gallery */
.disc-board.is-arranged,
.info-board.is-arranged,
.gallery-board.is-arranged {
  display: block;
  position: relative;
  flex-wrap: nowrap;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  min-height: 140px;
  overflow: visible;
}

.disc-board.is-arranged > .board-item,
.info-board.is-arranged > .board-item,
.gallery-board.is-arranged > .board-item {
  position: absolute;
  margin: 0;
}

.disc-board.is-arranged > .video-frame.board-item,
.info-board.is-arranged > .video-frame.board-item {
  flex: none;
  aspect-ratio: auto;
  min-width: 0;
}

/* the Info text box can be resized like a video, but the text itself never
   scales: a taller box just adds empty space below, a shorter one scrolls
   instead of the text spilling out past its border */
.info-board.is-arranged > .detail-box.board-item {
  overflow-y: auto;
}

.disc-board.is-editing,
.info-board.is-editing,
.gallery-board.is-editing {
  border: 3px dashed var(--card-border);
  border-radius: 14px;
  background-color: var(--card-bg);
  background-image:
    linear-gradient(var(--bg) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg) 1px, transparent 1px);
  background-size: 40px 40px;
  cursor: grab;
}

.disc-board.is-editing .board-resize,
.info-board.is-editing .board-resize,
.gallery-board.is-editing .board-resize { opacity: 0.85; pointer-events: auto; }
.disc-board.is-editing .board-resize:hover,
.info-board.is-editing .board-resize:hover,
.gallery-board.is-editing .board-resize:hover { opacity: 1; background: var(--accent); }
.disc-board.is-resizing,
.info-board.is-resizing,
.gallery-board.is-resizing { user-select: none; }
.disc-board.is-saving,
.info-board.is-saving,
.gallery-board.is-saving { outline: 2px dashed var(--accent); outline-offset: 3px; }
.disc-board.is-error,
.info-board.is-error,
.gallery-board.is-error { outline: 3px solid #c0392b; outline-offset: 3px; }
.disc-board.is-editing .board-item,
.info-board.is-editing .board-item,
.gallery-board.is-editing .board-item { cursor: grab; }
.disc-board .board-item.is-dragging,
.info-board .board-item.is-dragging,
.gallery-board .board-item.is-dragging { cursor: grabbing; opacity: 0.85; z-index: 8; transition: none; }

.board-item-resize {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--card-border);
  touch-action: none;
  display: none;
  z-index: 9;
}

.board-item-resize.tl { left: 3px; top: 3px; cursor: nwse-resize; }
.board-item-resize.tr { right: 3px; top: 3px; cursor: nesw-resize; }
.board-item-resize.bl { left: 3px; bottom: 3px; cursor: nesw-resize; }
.board-item-resize.br { right: 3px; bottom: 3px; cursor: nwse-resize; }

.disc-board.is-editing .board-item-resize,
.info-board.is-editing .board-item-resize { display: block; }

/* let a drag start over the video instead of the iframe swallowing it */
.disc-board.is-editing .video-frame.board-item iframe,
.info-board.is-editing .video-frame.board-item iframe { pointer-events: none; }

/* Free placement is a desktop layout. On a phone the arranged board falls
   back to the ordinary wrapping row: tiles flow, the video fits the width. */
@media (max-width: 700px) {
  .disc-toolbar { display: none; }

  .disc-board.is-arranged,
  .info-board.is-arranged,
  .gallery-board.is-arranged {
    display: flex;
    position: static;
    flex-wrap: wrap;
    min-height: 0;
    aspect-ratio: auto !important;
  }

  .disc-board.is-arranged > .board-item,
  .info-board.is-arranged > .board-item,
  .gallery-board.is-arranged > .board-item {
    position: static !important;
    left: auto !important;
    top: auto !important;
    margin: 0;
  }

  .disc-board.is-arranged > .video-frame.board-item,
  .info-board.is-arranged > .video-frame.board-item {
    flex: 1 1 100%;
    width: auto !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
  }

  /* any other resized item (the Info text box) also drops its fixed size,
     same reasoning as the position reset above */
  .info-board.is-arranged > .detail-box.board-item {
    width: auto !important;
    height: auto !important;
    overflow-y: visible;
  }

  .disc-board .board-resize,
  .disc-board .board-item-resize,
  .info-board .board-resize,
  .info-board .board-item-resize,
  .gallery-board .board-resize,
  .gallery-board .board-item-resize { display: none !important; }

  /* a photo keeps its natural place in the wrapping row -- no fixed size
     carried over from the free-placement canvas */
  .gallery-board.is-arranged > .gallery-photo.board-item {
    flex: 1 1 160px;
    width: auto !important;
    height: auto !important;
  }
}

/* --- photo gallery -------------------------------------------------------- */

.gallery-heading { margin-top: 2.2rem; }

/* until an admin arranges it, a plain wrapping row -- like .action-row, but
   this board's default shape is its own (a grid of photos, not tiles) */
.gallery-board {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
  width: 100%;
  max-width: var(--container);
}

.gallery-photo {
  width: clamp(140px, 16vw, 220px);
  margin: 0;
  border: 3px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 4px 10px var(--shadow);
}

.gallery-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--bg);
}

.gallery-photo figcaption {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  text-align: center;
  opacity: 0.85;
}

.gallery-board.is-editing .gallery-photo.board-item { cursor: grab; }

/* --- volunteer detail ---------------------------------------------------- */

.volunteer-row { align-items: stretch; flex-wrap: wrap; }

.gallery,
.bio-box {
  flex: 1 1 300px;
  min-width: 0;
  border: 3px solid var(--card-border);
  border-radius: 14px;
  background: var(--card-bg);
  padding: 0.9rem;
}

.volunteer-row .video-frame { flex: 1 1 340px; align-self: flex-start; }

.gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}

.gallery-main img { width: 100%; height: 100%; object-fit: contain; display: block; }

.gallery-caption {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  opacity: 0.75;
  text-align: center;
  min-height: 1.2em;
}

.gallery-thumbs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-top: 0.6rem;
}

.gallery-thumb {
  flex: 0 0 62px;
  height: 62px;
  padding: 0;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  background: none;
  cursor: pointer;
}

.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-thumb.is-active { border-color: var(--accent); }

.gallery-empty { margin: 0; opacity: 0.6; text-align: center; padding: 2rem 0; }

.bio-box { line-height: 1.6; overflow-y: auto; max-height: 420px; }

.bio-box h2 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

@media (max-width: 700px) {
  /* free placement is a desktop feature everywhere it appears (the
     volunteer board here, the discipline and Info layout boards in
     disc-board's own rule below) -- on a phone it is not just fixed in
     place, it is dropped: the saved x/y positions would not mean anything
     on a much narrower canvas, so the board falls back to an ordinary
     wrapping row instead, same as the other boards. */
  .board {
    aspect-ratio: auto !important;
    height: auto;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
  }

  .board-btn {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: clamp(110px, 40vw, 165px);
  }

  .board-empty {
    position: static;
    width: 100%;
  }

  .volunteer-row .video-frame,
  .gallery,
  .bio-box { flex: 1 1 100%; }

  #layout-toggle,
  #layout-hint,
  #board-resize {
    display: none !important;
  }
}

/* An icon caption can be one or two lines; the second sits under the first
   and the pair is positioned as a block, so --label-pos still lands it right. */
.label-line {
  display: block;
  line-height: 1.15;
}

/* --- Accessibility panel ------------------------------------------------ */

.a11y-wrap {
  display: flex;
  align-items: center;
}

.a11y-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}

.a11y-btn:hover,
.a11y-btn[aria-expanded="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* on the black schemes white-on-accent would disappear */
:root[data-contrast="yellow"] .a11y-btn:hover,
:root[data-contrast="yellow"] .a11y-btn[aria-expanded="true"],
:root[data-contrast="inverted"] .a11y-btn:hover,
:root[data-contrast="inverted"] .a11y-btn[aria-expanded="true"] {
  color: #000;
}

.a11y-btn svg {
  width: 1.35em;
  height: 1.35em;
  flex: none;
  display: block;
}

.a11y-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 60;
  width: min(19rem, calc(100vw - 2rem));
  max-height: min(30rem, calc(100vh - 8rem));
  overflow-y: auto;
  padding: 1rem;
  border: 2px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 8px 24px var(--shadow);
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-head {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.a11y-group {
  margin: 0 0 0.9rem;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.a11y-group legend {
  width: 100%;
  padding: 0;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.75;
}

.a11y-opt,
.a11y-reset {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--card-border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.a11y-opt.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* on the yellow-on-black scheme white text on yellow would vanish */
:root[data-contrast="yellow"] .a11y-opt.is-on,
:root[data-contrast="inverted"] .a11y-opt.is-on {
  color: #000;
}

.a11y-reset {
  width: 100%;
  margin-top: 0.2rem;
}

.a11y-opt:focus-visible,
.a11y-reset:focus-visible,
.a11y-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media print {
  .a11y-wrap {
    display: none;
  }
}

/* on a narrow screen the label would crowd the language selector out */
@media (max-width: 460px) {
  .a11y-btn-label {
    display: none;
  }
}

/* --- results ------------------------------------------------------------- */

.results-group,
.results-panel {
  width: 100%;
  max-width: var(--container);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.results-sport {
  font-size: calc(clamp(1.1rem, 1.8vw, 1.5rem) * var(--text-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.8rem;
}

.results-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}

.results-links .action-btn {
  flex: 0 1 14rem;
}

/* the table scrolls inside itself rather than pushing the page sideways */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: clamp(1.2rem, 2.5vw, 2rem);
  font-size: calc(clamp(0.85rem, 1.1vw, 1rem) * var(--text-scale, 1));
}

.results-table th,
.results-table td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--card-border);
}

.results-table th {
  text-transform: uppercase;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* the narrow first column is the placing; a knockout tie has no such column */
.results-table td:first-child,
.results-table th:first-child {
  width: 3rem;
}

.results-table.ko td:first-child {
  width: auto;
}

.results-table.ko td:nth-child(2) {
  width: 6rem;
  text-align: center;
  white-space: nowrap;
}

.results-round {
  font-size: calc(clamp(0.95rem, 1.4vw, 1.2rem) * var(--text-scale, 1));
  margin: 1rem 0 0.5rem;
  opacity: 0.85;
}

.champion {
  width: 100%;
  max-width: var(--container);
  font-weight: 700;
  font-size: calc(clamp(1.1rem, 2vw, 1.5rem) * var(--text-scale, 1));
  margin: 0 0 1rem;
}

.results-table tbody tr:hover {
  background: var(--card-bg);
}

.results-table .is-out {
  opacity: 0.6;
}

.results-empty {
  width: 100%;
  max-width: var(--container);
  opacity: 0.75;
}

.back-link {
  width: 100%;
  max-width: var(--container);
}

.back-link .action-btn {
  max-width: 11rem;
  aspect-ratio: auto;
  padding: 0.7rem 1rem;
}

/* --- countdown to the next event ---------------------------------------- */

.countdown {
  width: 100%;
  max-width: var(--container);
  margin-bottom: clamp(1.2rem, 2.5vw, 2rem);
  text-align: center;
}

.countdown-label {
  margin: 0 0 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: calc(clamp(0.8rem, 1.2vw, 1rem) * var(--text-scale, 1));
  opacity: 0.8;
}

.countdown-clock {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.5rem, 1.5vw, 1.2rem);
}

.countdown-clock[hidden] {
  display: none;
}

.countdown-unit {
  min-width: clamp(4rem, 9vw, 6.5rem);
  padding: clamp(0.5rem, 1.2vw, 0.9rem) clamp(0.4rem, 1vw, 0.8rem);
  border: 2px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
}

.countdown-number {
  display: block;
  font-weight: 700;
  line-height: 1.05;
  font-size: calc(clamp(1.6rem, 4.5vw, 3rem) * var(--text-scale, 1));
  /* the digits must not jiggle as the seconds tick over */
  font-variant-numeric: tabular-nums;
}

.countdown-name {
  display: block;
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: calc(clamp(0.62rem, 0.9vw, 0.8rem) * var(--text-scale, 1));
  opacity: 0.7;
}

.countdown-over {
  margin: 0;
  font-weight: 700;
  font-size: calc(clamp(1.1rem, 2.6vw, 1.8rem) * var(--text-scale, 1));
}

.countdown-over[hidden] {
  display: none;
}

.countdown-when {
  margin: 0.6rem 0 0;
  font-size: calc(clamp(0.75rem, 1vw, 0.9rem) * var(--text-scale, 1));
  opacity: 0.7;
}
