:root {
  --bg: #f2efe8;
  --bg-accent: #dae7dc;
  --bg-top: #fbfaf6;
  --paper: #fffefb;
  --ink: #171c24;
  --muted: #5f6672;
  --line: #cfd5dd;
  --accent: #0d6d63;
  --accent-strong: #084f49;
  --accent-soft: #d1efe9;
  --nav-bar-height: 2.9rem;
  --warn-bg: #fff2dc;
  --warn-border: #e9bf6d;
  --ok-bg: #e7f6f2;
  --ok-border: #47c889;
  --ok-dot: #0fb467;
  --hero-grad-start: #fcfefc;
  --hero-grad-end: #f4f8f3;
  --surface-soft: #f4f8f7;
  --surface-soft-2: #f0f4f7;
  --surface-hover: #dfe8ee;
  --tab-bg: #eaf4f1;
  --tab-text: #204252;
  --tab-border: #bfd6ce;
  --finished-bg: #dff9ec;
  --finished-border: #1eb36f;
  --nav-finished-border: #14b26a;
  --danger-bg: #fff2f1;
  --danger-border: #e3b6b2;
  --danger-dot: #cc6d65;
}

:root[data-theme="dark"] {
  --bg: #0f1419;
  --bg-accent: #133026;
  --bg-top: #10161d;
  --paper: #151d26;
  --ink: #e5edf5;
  --muted: #9db0c2;
  --line: #2a3948;
  --accent: #2ac48c;
  --accent-strong: #7ae0b9;
  --accent-soft: #123b2f;
  --warn-bg: #40310d;
  --warn-border: #7d6327;
  --ok-bg: #0f2f23;
  --ok-border: #36da93;
  --ok-dot: #2ef19e;
  --hero-grad-start: #17212b;
  --hero-grad-end: #121a22;
  --surface-soft: #18232e;
  --surface-soft-2: #1d2a36;
  --surface-hover: #263848;
  --tab-bg: #173327;
  --tab-text: #c9efe1;
  --tab-border: #2f6a54;
  --finished-bg: #123426;
  --finished-border: #2ad085;
  --nav-finished-border: #27cd82;
  --danger-bg: #3b1d1f;
  --danger-border: #7a353b;
  --danger-dot: #ff8f8a;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0f1419;
    --bg-accent: #133026;
    --bg-top: #10161d;
    --paper: #151d26;
    --ink: #e5edf5;
    --muted: #9db0c2;
    --line: #2a3948;
    --accent: #2ac48c;
    --accent-strong: #7ae0b9;
    --accent-soft: #123b2f;
    --warn-bg: #40310d;
    --warn-border: #7d6327;
    --ok-bg: #0f2f23;
    --ok-border: #36da93;
    --ok-dot: #2ef19e;
    --hero-grad-start: #17212b;
    --hero-grad-end: #121a22;
    --surface-soft: #18232e;
    --surface-soft-2: #1d2a36;
    --surface-hover: #263848;
    --tab-bg: #173327;
    --tab-text: #c9efe1;
    --tab-border: #2f6a54;
    --finished-bg: #123426;
    --finished-border: #2ad085;
    --nav-finished-border: #27cd82;
    --danger-bg: #3b1d1f;
    --danger-border: #7a353b;
    --danger-dot: #ff8f8a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Segoe UI Variable Text", "Noto Sans", "Arial", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, var(--bg-accent) 0, transparent 34%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 70%);
}

.container {
  width: min(1100px, 92vw);
  margin: 2rem auto 4rem;
}

.hero {
  background: linear-gradient(145deg, var(--hero-grad-start), var(--hero-grad-end));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  padding-bottom: 2.6rem;
  position: relative;
  box-shadow: 0 10px 30px -24px rgba(17, 31, 35, 0.8);
}

.hero a {
  color: var(--accent-strong);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.hero-top p {
  margin: 0;
}

.hero-index-link {
  white-space: nowrap;
}

.hero-ws-status {
  position: absolute;
  right: 1rem;
  bottom: 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.26rem 0.48rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #2a414f;
  font-size: 0.78rem;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0.01em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.lead {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.notice {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  background: #f9fbfd;
  margin: 1rem 0;
}

.notice-warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.speaker-panel {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 0.9rem 1rem;
}

.speaker-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.speaker-note-help {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.speaker-login-form,
.speaker-editor {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.speaker-login-form label,
.speaker-editor label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
}

.speaker-login-form input,
.speaker-editor textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft-2);
  color: var(--ink);
  padding: 0.5rem 0.6rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.speaker-note-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft-2);
  color: var(--ink);
  padding: 0.46rem 0.56rem;
  font-family: inherit;
  font-size: 0.9rem;
}

.speaker-editor textarea {
  resize: vertical;
  min-height: 110px;
}

.speaker-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.speaker-share-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  user-select: none;
}

.speaker-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.speaker-btn {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.38rem 0.7rem;
  cursor: pointer;
}

.speaker-btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.speaker-btn-secondary {
  background: var(--surface-soft-2);
  color: var(--ink);
  border-color: var(--line);
}

.speaker-btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--line);
}

.speaker-status {
  color: var(--muted);
  font-size: 0.8rem;
}

.speaker-athlete-target-wrap {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0.45rem 0.55rem;
}

.speaker-athlete-target-wrap strong {
  display: block;
  font-size: 0.87rem;
}

.speaker-shared-wrap h3 {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.speaker-shared-list {
  display: grid;
  gap: 0.45rem;
}

.speaker-shared-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.5rem 0.6rem;
}

.speaker-shared-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.speaker-shared-item header span {
  color: var(--muted);
  font-size: 0.74rem;
}

.speaker-shared-item p {
  margin: 0;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.speaker-shared-empty {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

.athlete-note-btn {
  margin-left: 0.35rem;
  border: 1px solid #bfd0dc;
  background: var(--surface-soft-2);
  color: #27475b;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.34rem;
  cursor: pointer;
}

.athlete-note-btn:hover {
  background: var(--surface-hover);
}

.athlete-note-btn-has {
  border-color: #5aa685;
  color: #1e5f45;
  background: #e7f5ee;
}

.athlete-note-editor-row td {
  background: #f7fbff;
  border-top: 0;
  position: relative;
  z-index: 3;
}

.athlete-note-inline {
  border: 1px solid #d5e2eb;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.45rem 0.55rem;
  display: grid;
  gap: 0.42rem;
}

.athlete-note-inline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.athlete-note-inline-updated {
  color: var(--muted);
  font-size: 0.75rem;
}

.athlete-note-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft-2);
  color: var(--ink);
  padding: 0.45rem 0.55rem;
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
}

.athlete-note-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.athlete-note-inline-actions button {
  border: 1px solid #bfd0dc;
  background: var(--surface-soft-2);
  color: #27475b;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.14rem 0.46rem;
  cursor: pointer;
}

.athlete-note-inline-actions button:hover {
  background: var(--surface-hover);
}

.athlete-note-inline-status {
  color: var(--muted);
  font-size: 0.76rem;
}

.athlete-note-inline-shared {
  color: #31506a;
  font-size: 0.78rem;
}

.notice-muted {
  color: var(--muted);
}

#ws-status,
#ws-updated {
  margin-top: 0.35rem;
}

.year-block {
  margin-top: 2rem;
}

.year-block h2 {
  margin: 0 0 0.8rem;
  font-size: 1.3rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.card:hover {
  transform: translateY(-2px) scale(1.003);
  border-color: #a8b8c8;
  box-shadow: 0 12px 24px -24px rgba(16, 34, 40, 0.7);
}

.card-live {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 1rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.card-top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.pill {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.version-marker {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 500;
  background: #173446;
  color: #f3f8fc;
  border: 1px solid #2f546a;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 18px -12px rgba(14, 24, 30, 0.9);
}

.theme-picker-wrap {
  position: fixed;
  right: 12px;
  bottom: 46px;
  z-index: 520;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.54rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 8px 20px -16px rgba(0, 0, 0, 0.45);
}

.theme-picker-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.theme-picker-select {
  border: 1px solid var(--line);
  background: var(--surface-soft-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
}

.theme-picker-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* hero-links: multiple links in top-right of hero */
.hero-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  white-space: nowrap;
}

/* Green check shown after athlete name when starter has checked in athlete */
.checkin-tick {
  color: #1d9c86;
  font-size: 0.9em;
  font-weight: 700;
  vertical-align: baseline;
  margin-right: 0.18rem;
}

.checkin-cross {
  color: #b6453f;
  font-size: 0.9em;
  font-weight: 700;
  vertical-align: baseline;
  margin-right: 0.18rem;
}

.withdrawn-name {
  text-decoration: line-through;
  opacity: 0.72;
}

/* ===================== Starter page ===================== */
.sl-heat-block {
  margin-top: 0.7rem;
}

.starter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.6rem 0 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.starter-control-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  user-select: none;
}

.starter-reset-btn {
  border: 1px solid #c4d0da;
  background: var(--surface-soft-2);
  color: #2f4b5c;
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.starter-reset-btn:hover {
  background: var(--surface-hover);
}

.sl-heat-header {
  padding: 0.32rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #325163;
  background: #eef4f8;
  border-bottom: 1px solid var(--line);
  border-top: 1px solid #c8dde9;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sl-heat-has-result {
  font-size: 0.72rem;
  padding: 0.08rem 0.32rem;
  border-radius: 999px;
  background: #fff2dc;
  color: #8a5f11;
  border: 1px solid #e9bf6d;
}

.sl-hide-event-btn,
.sl-hide-heat-btn {
  margin-left: auto;
  border: 1px solid #c4d0da;
  background: var(--surface-soft-2);
  color: #2f4b5c;
  border-radius: 6px;
  padding: 0.2rem 0.45rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
}

.sl-hide-event-btn:hover,
.sl-hide-heat-btn:hover {
  background: var(--surface-hover);
}

.sl-table {
  width: 100%;
}

.sl-row {
  transition: background 250ms ease;
}

.sl-check-cell {
  width: 3.2rem;
  text-align: center;
  padding: 0.25rem 0.3rem !important;
}

.sl-checkin-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 2px solid #b0c4d0;
  background: #f5f8fa;
  color: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  box-sizing: border-box;
}

.sl-checkin-btn:hover {
  border-color: #1d9c86;
  background: #e8f8f4;
}

.sl-checkin-btn-on {
  background: #14b26a;
  border-color: #10965a;
  color: #fff;
}

.sl-checkin-btn-on:hover {
  background: #10965a;
}

.sl-checkin-btn-no {
  background: #b6453f;
  border-color: #8f342f;
  color: #fff;
}

.sl-checkin-btn-no:hover {
  background: #8f342f;
}

.sl-row-withdrawn .sl-name {
  text-decoration: line-through;
  opacity: 0.72;
}

.sl-lane {
  width: 3rem;
  font-weight: 700;
  color: var(--muted);
}

.sl-bib {
  width: 4rem;
  font-weight: 700;
}

.sl-name {
  font-weight: 600;
}

/* ===================== Premiering page ===================== */
.pr-table {
  width: 100%;
}

.pr-row {
  transition: background 250ms ease;
}

.pr-row-done td {
  opacity: 0.45;
}

.pr-prize-cell {
  width: 3.2rem;
  text-align: center;
  padding: 0.25rem 0.3rem !important;
}

.pr-prize-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 2px solid #b0c4d0;
  background: #f5f8fa;
  color: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 180ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  box-sizing: border-box;
}

.pr-prize-btn:hover {
  border-color: #c8971a;
  background: #fdf5dc;
}

.pr-prize-btn-on {
  background: #c8971a;
  border-color: #a37812;
  color: #fff;
}

.pr-prize-btn-on:hover {
  background: #a37812;
}

.pr-place {
  width: 3rem;
  font-weight: 700;
  color: var(--muted);
}

.pr-bib {
  width: 4rem;
  font-weight: 700;
}

.pr-name {
  font-weight: 600;
}

.pr-result {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.pr-table thead th:last-child {
  text-align: right;
}

/* Stevnekode access gate (starter / premiering) */
.access-card {
  max-width: 26rem;
  margin: 1.5rem auto 0;
}

.access-card form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.access-label {
  font-weight: 600;
  font-size: 0.92rem;
}

.access-input {
  padding: 0.7rem 0.8rem;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}

.access-input:focus {
  outline: none;
  border-color: var(--accent);
}

.access-btn {
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.access-btn:hover {
  background: var(--accent-strong);
}

.access-error {
  margin: 0 0 0.4rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  background: #fdecea;
  color: #b3261e;
  font-weight: 600;
}

.access-hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta strong {
  color: var(--ink);
}

.meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.day-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0;
}

.live-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: -0.2rem 0 1rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: #2a414f;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.live-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #8aa2ab;
  box-shadow: 0 0 0 0 rgba(76, 124, 136, 0.35);
}

.live-sep {
  color: #90a0ab;
}

.live-online {
  border-color: var(--ok-border);
  background: var(--ok-bg);
}

.live-online .live-dot {
  background: var(--ok-dot);
}

.live-connecting {
  border-color: #bfd5db;
}

.live-offline {
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.live-offline .live-dot {
  background: var(--danger-dot);
}

.live-pulse {
  animation: livePulse 650ms ease;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(22, 116, 101, 0.2);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(22, 116, 101, 0);
  }
}

.tab {
  text-decoration: none;
  color: var(--tab-text);
  border: 1px solid var(--tab-border);
  background: var(--tab-bg);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
}

.tab-active {
  background: linear-gradient(145deg, var(--accent), #0a5d54);
  border-color: #0a5d54;
  color: #fff;
}

.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table-wrap td a {
  color: var(--accent-strong);
  text-decoration: none;
}

.table-wrap td a:hover {
  text-decoration: underline;
}

.event-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.event-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 8px 20px -24px rgba(20, 31, 39, 0.7);
  min-width: 0;
  /* Leave room for the sticky "☰ Meny" bar so nav-link jumps don't hide the
     event header underneath it. */
  scroll-margin-top: calc(var(--nav-bar-height) + 0.75rem);
}

.event-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.event-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.8rem;
}

.event-head-top h3 {
  flex: 1 1 auto;
  min-width: 0;
}

.event-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  margin-left: auto;
}

.event-time {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  display: inline-block;
}

.event-head .meta {
  margin-top: 0.35rem;
}

.event-stats {
  margin-top: 0.65rem;
}

.event-head-finished {
  background: var(--finished-bg);
  border: 1px solid var(--finished-border);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.55rem;
}

.detail-wrap {
  margin-top: 0.7rem;
  width: min(94%, 980px);
  margin-left: auto;
  margin-right: auto;
}

.detail-wrap th,
.detail-wrap td {
  padding: 0.2rem 0.32rem;
  font-size: 0.78rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.42rem 0.62rem;
  font-size: 0.92rem;
}

th {
  background: #edf4f8;
  color: #2c4153;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfdfd;
}

.heat-spacer td {
  border: 0;
  height: 10px;
  padding: 0;
  background: #f8fbff;
}

.heat-header-row td {
  background: #eef4f8;
  color: #325163;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.heat-repeat-head-row td {
  background: #eef4f8;
  color: #325163;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.attempt-wind-row td {
  background: #f4f8fb;
  color: #456274;
  font-style: italic;
}

.no-callroom-row td {
  background: #ffe3e3;
}

.new-data-row td {
  background: #fffbe6;
  transition: background 2s ease-out;
}

.res-mark {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.04rem 0.32rem;
  border-radius: 999px;
  background: #e5f7ef;
  color: #0f6b4e;
  font-weight: 700;
  font-size: 0.72rem;
}

.prev-round-res {
  color: var(--muted);
  font-size: 0.82em;
  margin-left: 0.28rem;
  white-space: nowrap;
}

/* Right-align the numeric result columns (SB, PB, wind, Res) so values line up. */
#event-groups .table-wrap:not(.detail-wrap) > table th:nth-child(n+5):not(:last-child),
#event-groups .table-wrap:not(.detail-wrap) > table td:nth-child(n+5):not(:last-child) {
  text-align: right;
}

/* Technical-event detail table: right-align the attempt/height value columns
   (F1, F2 ... or the height columns) and the per-attempt wind row so values
   like 9,xx and 10,xx line up neatly. First four columns (place, Startnr,
   Navn, Klubb) stay left-aligned. */
.detail-wrap.tech-wrap th:nth-child(n+5),
.detail-wrap.tech-wrap td:nth-child(n+5) {
  text-align: right;
}
.detail-wrap.tech-wrap .attempt-wind-row td {
  text-align: right;
}

/* Keep the result number pinned to the right edge with the PB/SB badge to its
   left, so the numbers stay aligned whether or not a badge is present. */
.res-cell {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: baseline;
  gap: 0.3rem;
}

.res-better-sb {
  color: #0f6b4e;
  font-weight: 700;
}

.res-better-pb {
  color: #0b5aa3;
  font-weight: 700;
}

.qual-status {
  color: #2f5d7a;
  font-size: 0.82em;
  white-space: nowrap;
}

.best-attempt-cell {
  color: #0f6b4e;
  font-weight: 700;
  background: #eefcf5;
}

.relay-wrap {
  border-color: #c8d7e4;
}

.relay-runners-cell {
  min-width: 260px;
}

.relay-runner {
  line-height: 1.35;
}

.relay-runner + .relay-runner {
  margin-top: 0.1rem;
}

.name-club {
  display: none;
}

@media (max-width: 680px) {
  .container {
    margin-top: 1rem;
  }

  .hero {
    padding: 0.9rem;
    padding-bottom: 0.9rem;
  }

  .hero-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .hero h1 {
    font-size: 1.45rem;
    line-height: 1.2;
  }

  .hero-links {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-self: stretch;
    gap: 0.4rem;
    white-space: normal;
  }

  .hero-ws-status {
    position: static;
    margin-top: 0.55rem;
    width: fit-content;
  }

  .card-link {
    padding: 0.9rem;
  }

  .live-strip {
    gap: 0.3rem;
    font-size: 0.86rem;
  }

  th,
  td {
    font-size: 0.84rem;
    padding: 0.34rem 0.45rem;
  }

  .detail-wrap th,
  .detail-wrap td {
    font-size: 0.74rem;
    padding: 0.18rem 0.26rem;
  }

  .detail-wrap {
    width: 100%;
  }

  .col-klubb {
    display: none;
  }

  .name-club {
    display: block;
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Tighten the Startnr column so it sits closer to Navn */
  #event-groups .table-wrap:not(.detail-wrap) > table th:nth-child(2),
  #event-groups .table-wrap:not(.detail-wrap) > table td:nth-child(2) {
    width: 1%;
    white-space: nowrap;
  }

  #event-groups .table-wrap:not(.detail-wrap) > table th,
  #event-groups .table-wrap:not(.detail-wrap) > table td {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
  }
}

/* Page layout */
.page-layout {
  display: block;
}

.content-side {
  width: 100%;
  min-width: 0;
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 15, 20, 0.45);
}

.event-nav:not(.collapsed) ~ .nav-backdrop {
  display: block;
}

/* Event Navigation Menu — off-canvas overlay drawer at all widths */
.event-nav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(75vw, 320px);
  z-index: 200;
  transform: translateX(0);
  transition: transform 250ms ease;
  background: var(--paper);
  border-right: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.event-nav.collapsed {
  transform: translateX(-100%);
}

.nav-toggle {
  display: flex;
  align-items: center;
  height: var(--nav-bar-height);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--accent);
  color: #fff;
  border: none;
  border-bottom: 2px solid var(--accent-strong);
  padding: 0 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 150ms ease;
}

.nav-toggle:hover {
  background: var(--accent-strong);
}

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-bar-height);
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.nav-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-sort-toggle {
  display: flex;
  gap: 0.25rem;
  margin-left: 0.4rem;
}

.nav-sort-btn {
  background: #f0f4f7;
  color: #2f4b5c;
  border: 1px solid #c4d0da;
  border-radius: 5px;
  padding: 0.22rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  line-height: 1.3;
}

.nav-sort-btn:hover {
  background: #dfe8ee;
}

.nav-sort-btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-strong);
}

.nav-sort-btn-active:hover {
  background: var(--accent-strong);
}

.nav-group-header {
  padding: 0.35rem 1rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-strong);
  background: #eef5f3;
  border-bottom: 1px solid var(--line);
  border-top: 2px solid #b8ddd6;
  margin-top: 0.2rem;
}

.nav-toggle-close {
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 150ms ease;
  line-height: 1;
  white-space: nowrap;
}

.nav-toggle-close:hover {
  background: var(--bg-accent);
  color: var(--ink);
}

.nav-filter-row {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-day-picker {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.nav-day-label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

.nav-day-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.36rem 0.5rem;
  font-size: 0.84rem;
  background: var(--surface-soft-2);
  color: var(--ink);
  font-family: inherit;
}

.nav-day-select:focus {
  outline: none;
  border-color: var(--accent);
}

.nav-day-empty {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.35rem 0.45rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

#nav-filter-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.42rem 0.65rem;
  font-size: 0.88rem;
  background: #f7f9fa;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease;
  font-family: inherit;
}

#nav-filter-input:focus {
  border-color: var(--accent);
}

.nav-filter-toggle {
  font-size: 0.8rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.nav-type-filter {
  display: flex;
  gap: 0.3rem;
}

.nav-type-btn {
  flex: 1;
  background: #f0f4f7;
  color: #2f4b5c;
  border: 1px solid #c4d0da;
  border-radius: 6px;
  padding: 0.3rem 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.nav-type-btn:hover {
  background: #dfe8ee;
}

.nav-type-btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-strong);
}

.nav-type-btn-active:hover {
  background: var(--accent-strong);
}

.nav-multi-filters {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-multi {
  position: relative;
}

.nav-multi-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0f4f7;
  color: #2f4b5c;
  border: 1px solid #c4d0da;
  border-radius: 6px;
  padding: 0.34rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
}

.nav-multi-btn:hover {
  background: #dfe8ee;
}

.nav-multi-label {
  flex: 1;
  text-align: left;
}

.nav-multi-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.nav-multi-count[hidden] {
  display: none;
}

.nav-multi-caret {
  font-size: 0.7rem;
  transition: transform 150ms ease;
}

.nav-multi-btn.nav-multi-open .nav-multi-caret {
  transform: rotate(180deg);
}

.nav-multi-btn-active {
  border-color: var(--accent);
  background: var(--bg-accent);
}

.nav-multi-panel {
  margin-top: 0.3rem;
  max-height: 38vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft-2);
  padding: 0.25rem;
}

.nav-multi-head {
  display: flex;
  justify-content: flex-end;
  padding: 0.1rem 0.2rem 0.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.2rem;
}

.nav-multi-clear {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  font-family: inherit;
}

.nav-multi-clear:hover {
  text-decoration: underline;
}

.nav-multi-opt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.35rem;
  font-size: 0.82rem;
  color: var(--ink);
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
}

.nav-multi-opt:hover {
  background: var(--bg-accent);
}

.nav-multi-opt input {
  flex-shrink: 0;
  margin: 0;
}

.nav-multi-empty {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.3rem 0.35rem;
}

.nav-reset-hidden-btn {
  background: #fff4e0;
  color: #7a4a00;
  border: 1px solid #e8c97a;
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms ease;
  font-family: inherit;
  white-space: nowrap;
}

.nav-reset-hidden-btn:hover {
  background: #ffe5a0;
  border-color: #c89c30;
}

.nav-events {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 150ms ease;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
}

.nav-item:hover {
  background: #e6eef7;
}

.nav-item-finished {
  background: var(--finished-bg);
  border-left: 4px solid var(--nav-finished-border);
}

.nav-item-finished:hover {
  background: var(--surface-hover);
}

.nav-item-link {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-hidden {
  opacity: 0.72;
}

.nav-item-time {
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 0.2rem;
}

.nav-visibility-btn {
  background: #f0f4f7;
  color: #2f4b5c;
  border: 1px solid #c4d0da;
  border-radius: 4px;
  padding: 0.28rem 0.38rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: all 150ms ease;
  flex-shrink: 0;
  margin-left: 0.4rem;
  min-width: 1.8rem;
  text-align: center;
}

.nav-visibility-btn:hover {
  background: #dfe8ee;
  border-color: #9fb2c2;
}

.nav-popup-btn {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.28rem 0.38rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: all 150ms ease;
  flex-shrink: 0;
  margin-left: 0.4rem;
  min-width: 1.8rem;
  text-align: center;
}

.nav-popup-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-strong);
}

body.popup-mode .event-nav,
body.popup-mode .nav-toggle {
  display: none !important;
}

body.popup-mode .theme-picker-wrap {
  display: none;
}

body.popup-mode .content-side {
  flex: none;
  width: 100%;
}

body.popup-mode .container {
  width: min(1400px, 98vw);
  margin: 0.5rem auto 1rem;
}

body.popup-mode .hero,
body.popup-mode .day-tabs,
body.popup-mode .live-strip,
body.popup-mode .notice {
  display: none;
}

body.popup-mode .event-popup-btn,
body.popup-mode .nav-popup-btn,
body.popup-mode .nav-visibility-btn {
  display: none;
}

/* Event card pop-out button */
.event-card {
  position: relative;
}

.event-popup-btn {
  position: static;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  border-radius: 5px;
  padding: 0.14rem 0.42rem;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  font-weight: 600;
  transition: all 150ms ease;
}

.event-popup-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-strong);
}

:root[data-theme-effective="dark"] .notice {
  background: #16222d;
}

:root[data-theme-effective="dark"] .hero-ws-status,
:root[data-theme-effective="dark"] .live-strip {
  color: #c7d8e6;
}

:root[data-theme-effective="dark"] th {
  background: #1c2a36;
  color: #bcd0e2;
}

:root[data-theme-effective="dark"] tbody tr:hover td {
  background: #1b2b37;
}

:root[data-theme-effective="dark"] .heat-header-row td,
:root[data-theme-effective="dark"] .heat-repeat-head-row td,
:root[data-theme-effective="dark"] .sl-heat-header {
  background: #1c2f3d;
  color: #b7cede;
}

:root[data-theme-effective="dark"] .attempt-wind-row td {
  background: #1a2935;
  color: #9ab4c6;
}

:root[data-theme-effective="dark"] .no-callroom-row td {
  background: #412126;
}

:root[data-theme-effective="dark"] .new-data-row td {
  background: #453c1a;
}

:root[data-theme-effective="dark"] .starter-reset-btn,
:root[data-theme-effective="dark"] .sl-hide-event-btn,
:root[data-theme-effective="dark"] .sl-hide-heat-btn,
:root[data-theme-effective="dark"] .nav-sort-btn,
:root[data-theme-effective="dark"] .nav-type-btn,
:root[data-theme-effective="dark"] .nav-multi-btn,
:root[data-theme-effective="dark"] .nav-visibility-btn {
  border-color: #3a4d5f;
  color: #c2d4e2;
}

:root[data-theme-effective="dark"] .nav-multi-btn {
  background: var(--surface-soft-2);
}

:root[data-theme-effective="dark"] .nav-multi-btn:hover,
:root[data-theme-effective="dark"] .nav-multi-opt:hover {
  background: #21303d;
}

:root[data-theme-effective="dark"] .nav-item:hover {
  background: #21303d;
}

:root[data-theme-effective="dark"] .theme-picker-wrap {
  box-shadow: 0 8px 20px -16px rgba(0, 0, 0, 0.8);
}

@media (max-width: 800px) {
  .container {
    width: 100%;
    margin: 1rem 0 3rem;
  }

  .hero {
    padding: 0.9rem;
  }

  .card-link {
    padding: 0.9rem;
  }

  .live-strip {
    gap: 0.3rem;
    font-size: 0.86rem;
  }

  th,
  td {
    font-size: 0.84rem;
    padding: 0.34rem 0.45rem;
  }

  .detail-wrap th,
  .detail-wrap td {
    font-size: 0.74rem;
    padding: 0.18rem 0.26rem;
  }

  .detail-wrap {
    width: 100%;
  }

  .theme-picker-wrap {
    right: 8px;
    bottom: 40px;
  }
}

/* Wide screens: dock the menu beside the content so it can be pinned open.
   Threshold = content max-width (1100px) + menu width (320px) + slack. */
@media (min-width: 1440px) {
  .page-layout {
    display: flex;
    align-items: flex-start;
  }

  .event-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    transform: none;
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: min(75vw, 320px);
    width: min(75vw, 320px);
    box-shadow: none;
    transition: flex-basis 220ms ease, width 220ms ease;
  }

  .event-nav.collapsed {
    transform: none;
    flex-basis: 0;
    width: 0;
    border-right-width: 0;
  }

  .content-side {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* No dimming overlay when the menu is docked. */
  .nav-backdrop,
  .event-nav:not(.collapsed) ~ .nav-backdrop {
    display: none !important;
  }

  /* Hide the "Meny" bar while the docked menu is open (it has its own "Skjul"). */
  .event-nav:not(.collapsed) ~ .content-side .nav-toggle {
    display: none;
  }
}
