*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
  scrollbar-color: var(--line-strong) var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--gold);
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

a {
  color: var(--gold);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--gold-hover);
}

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

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.numeric {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- App shell ---------- */

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--topbar-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--space-4) 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--team-tint);
  border-bottom: 2px solid var(--team-color);
}

.topbar .icon {
  width: 18px;
  height: 18px;
}

.countdown {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.countdown.is-urgent {
  color: var(--danger);
}

.offline-pill {
  font-size: var(--text-base);
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--ink);
}

.offline-pill[hidden] {
  display: none;
}

.jury-button {
  margin-left: auto;
  height: var(--tap);
  padding: 0 12px 0 9px;
  border: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.jury-button .icon {
  width: 16px;
  height: 16px;
}

.topbar-points {
  margin-left: 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.topbar-points-label {
  font-size: var(--text-base);
  color: var(--text-warm);
}

.live {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: var(--space-4);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  justify-content: center;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

.tabbar-inner {
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap);
  color: var(--text-muted);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
}

.tab .icon {
  width: 24px;
  height: 24px;
}

.tab[aria-current='page'] {
  color: var(--text);
}

.tab[aria-current='page'] .icon {
  color: var(--team-color);
}

.tab:hover {
  color: var(--text);
}

/* ---------- Buttons ---------- */

.button {
  height: var(--button-height);
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius);
  background: var(--team-color);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--text-lg);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms var(--ease-out), filter 120ms var(--ease-out);
}

.button:hover {
  color: var(--ink);
  filter: brightness(1.08);
}

.button:active {
  transform: scale(0.98);
}

.button:disabled,
.button[aria-busy='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.button-block {
  width: 100%;
}

.button-gold {
  background: var(--gold);
}

.button-ghost {
  height: 52px;
  background: transparent;
  border: 2px solid var(--line);
  color: var(--text);
  font-size: var(--text-base);
  font-weight: 600;
}

.button-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  filter: none;
}

.button-danger {
  background: var(--danger);
}

.button-danger-ghost {
  height: 52px;
  background: transparent;
  border: 2px solid var(--danger-tint);
  color: var(--danger);
  font-size: var(--text-base);
  font-weight: 600;
}

.button-danger-ghost:hover {
  color: var(--danger);
  border-color: var(--danger);
  filter: none;
}

.button-row {
  display: flex;
  gap: var(--space-4);
}

.button-row > .button {
  flex: 1;
}

.button-row > .button-ghost,
.button-row > .button-danger-ghost {
  flex: 0 0 auto;
}

.icon-button {
  width: var(--tap);
  height: var(--tap);
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
}

.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--gold);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Pills, chips, badges ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-base);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.pill-gold {
  background: var(--gold);
  color: var(--ink);
}

.pill .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.pill-waiting {
  background: var(--info-tint);
  color: var(--info);
}

.pill-secret {
  background: var(--secret-tint);
  color: var(--secret);
}

.pill-success {
  background: var(--success-tint);
  color: var(--success);
}

.pill-danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.pill-quiet {
  background: var(--surface-2);
  color: var(--text-muted);
}

.team-badge {
  --badge-color: var(--team-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  font-size: var(--text-base);
  font-weight: 600;
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--badge-color) 14%, var(--surface));
  color: color-mix(in srgb, var(--badge-color) 55%, #FFFFFF);
}

.team-badge-dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--badge-color);
}

.team-badge-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.members {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--text-base);
}

.member-chip .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}

.member-chip-leader {
  background: var(--team-color);
  color: var(--ink);
  font-weight: 700;
}

/* ---------- Team hero ---------- */

.team-photo {
  position: relative;
  height: 148px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: color-mix(in srgb, var(--team-color) 22%, var(--bg));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--team-soft);
  font-size: var(--text-base);
  flex-shrink: 0;
}

.team-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-photo::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: var(--team-color);
}

.team-name {
  font-size: 26px;
  margin-top: -4px;
}

.page-title {
  font-size: var(--text-2xl);
}

.lead {
  font-size: var(--text-base);
  color: var(--text-soft);
  line-height: 1.45;
}

/* ---------- Cards ---------- */

.card {
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-waiting {
  border: 2px solid var(--info);
}

.card-team {
  border: 2px solid var(--team-color);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--team-soft);
}

.card-points {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.card-text {
  font-size: var(--text-base);
  color: var(--text-soft);
}

.rolled {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  color: var(--text-warm);
}

.rolled strong {
  color: var(--text);
}

.rolled .link-button {
  margin-left: auto;
  font-size: var(--text-base);
}

.secret-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
}

.secret-line .icon {
  width: 26px;
  height: 26px;
}

.secret-line span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text);
}

.notice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.notice p {
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text-soft);
}

.notice .pill {
  flex-shrink: 0;
  margin-top: 1px;
  font-weight: 800;
}

.notice > .icon {
  margin-top: 1px;
  color: var(--text-muted);
}

/* ---------- Sections and lists ---------- */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-muted);
}

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-2);
}

.group-header h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
}

.group-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.history-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 44px;
  justify-content: center;
}

.history-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.history-title {
  flex: 1 1 100%;
  min-width: 0;
  font-size: var(--text-lg);
  font-weight: 600;
}

.history-note {
  font-size: var(--text-base);
  color: var(--text-muted);
}

.empty {
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius-card);
  border: 2px dashed var(--line);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-base);
}

/* ---------- Task options ---------- */

.task-option {
  position: relative;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 2px solid var(--surface);
}

button.task-option {
  cursor: pointer;
  padding-right: 52px;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

button.task-option:active {
  transform: scale(0.99);
}

.task-option[aria-pressed='true'] {
  border-color: var(--team-color);
  background: var(--team-tint);
}

.task-option > .pill {
  align-self: flex-start;
}

/* An empty ring that fills with the team colour once it is your pick, so the choice reads at a glance. */
.task-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.task-check .icon {
  width: 18px;
  height: 18px;
  stroke-width: 3;
}

.task-option[aria-pressed='true'] .task-check {
  background: var(--team-color);
  border-color: var(--team-color);
  color: var(--ink);
}

.task-vote-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.task-votes {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.task-option[aria-pressed='true'] .task-votes {
  color: var(--team-soft);
}

/* While voting, long descriptions shrink to two lines. The task you pick opens up in full. */
button.task-option[aria-pressed='false'] .task-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.task-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.task-description {
  font-size: var(--text-base);
  color: var(--text-muted);
}

.task-secret {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
}

.task-secret .icon {
  width: 26px;
  height: 26px;
}

.task-secret span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--text);
}

/* ---------- Bottom action bar ---------- */

.action-bar {
  position: sticky;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom));
  margin-top: auto;
  padding: 12px var(--space-4) var(--space-4);
  background: var(--bg);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}

.progress-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-base);
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--team-color);
  transition: width 400ms var(--ease-out);
}

.progress-label {
  color: var(--text-warm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.my-vote {
  min-height: 52px;
  border-radius: var(--radius);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: 10px;
  font-size: var(--text-base);
}

.my-vote .icon {
  color: var(--team-color);
  stroke-width: 2.4;
}

.my-vote span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint {
  font-size: var(--text-base);
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Task round countdown ---------- */

.round-timer {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--space-3);
  row-gap: var(--space-2);
}

.round-timer-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.round-timer-seconds {
  font-weight: 800;
  font-size: var(--text-3xl);
  line-height: 1;
  color: var(--team-soft);
}

.round-timer-unit {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.round-timer-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.35;
}

.round-timer-text strong {
  color: var(--text);
  font-weight: 700;
}

.round-timer-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-timer-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.round-timer-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--team-color);
  transform-origin: left center;
  transition: transform 1s linear, background-color 300ms var(--ease-out);
}

/* The last ten seconds: the one moment in the round that is allowed to shout. */
.round-timer.is-urgent .round-timer-seconds {
  color: var(--danger);
  animation: round-tick 1s var(--ease-out) infinite;
}

.round-timer.is-urgent .round-timer-fill {
  background: var(--danger);
}

@keyframes round-tick {
  from {
    transform: scale(1.18);
  }

  to {
    transform: scale(1);
  }
}

/* ---------- Member vote ---------- */

.member-option {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  border-radius: 18px;
  border: 2px solid var(--surface);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.member-option[aria-pressed='true'] {
  border-color: var(--team-color);
}

.member-option .icon {
  margin-left: auto;
  color: var(--team-color);
  opacity: 0;
}

.member-option[aria-pressed='true'] .icon {
  opacity: 1;
}

.member-option small {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- Final score ---------- */

.final-score {
  align-items: flex-start;
  gap: 4px;
}

.final-score-points {
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ---------- Sheets and modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--scrim);
  animation: fade-in 200ms var(--ease-out);
}

.sheet {
  width: calc(100% - 24px);
  max-width: 456px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin-bottom: calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--radius-sheet);
  background: var(--surface-raised);
  padding: var(--space-6) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sheet);
  animation: sheet-in 320ms var(--ease-out);
}

.sheet-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-2xl);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.sheet-text {
  white-space: pre-line;
  font-size: var(--text-base);
  line-height: 1.45;
  color: var(--text-soft);
}

.sheet .button {
  margin-top: 6px;
}

.sheet-chip {
  --badge-color: var(--team-color);
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 12px 0 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--badge-color) 14%, var(--surface));
  color: color-mix(in srgb, var(--badge-color) 55%, #FFFFFF);
  font-size: var(--text-base);
  font-weight: 700;
}

.sheet-chip .team-badge-dot {
  width: 16px;
  height: 16px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.contact-row {
  min-height: 60px;
  padding: 0 var(--space-4);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.contact-row:hover {
  color: var(--text);
}

.contact-name {
  flex: 1;
  font-weight: 700;
}

.contact-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: var(--text-base);
  font-weight: 600;
}

.input {
  height: 52px;
  border-radius: 14px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  padding: 0 14px;
  font-family: inherit;
  width: 100%;
}

.input::placeholder {
  color: var(--placeholder);
}

.input:focus {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

select.input {
  appearance: none;
}

textarea.input {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
}

.form-error {
  font-size: var(--text-base);
  color: var(--danger);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.form-error::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  flex-shrink: 0;
}

.form-error:empty {
  display: none;
}

.picker {
  min-height: 120px;
  border-radius: var(--radius-card);
  border: 2px dashed var(--line-strong);
  background: var(--surface);
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.picker .icon {
  width: 28px;
  height: 28px;
  color: var(--team-color);
}

.picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.previews {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.previews:empty {
  display: none;
}

.previews img,
.previews video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.upload-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-progress[hidden] {
  display: none;
}

/* ---------- Draw overlay ---------- */

.draw {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  justify-content: center;
  animation: fade-in 200ms var(--ease-out);
}

.draw-inner {
  position: relative;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  padding: calc(20px + env(safe-area-inset-top)) var(--space-4) calc(28px + env(safe-area-inset-bottom));
}

.draw-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--gold);
  font-size: var(--text-base);
  font-weight: 600;
  position: relative;
  z-index: 2;
}

.draw-top .icon-button {
  margin-left: auto;
}

.draw-title {
  margin-top: 56px;
  font-size: 30px;
  position: relative;
  z-index: 2;
}

.reel {
  --row: 64px;
  margin-top: 28px;
  height: calc(var(--row) * 4 + 8px);
  border-radius: 24px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.reel-window {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(50% - 36px);
  height: 72px;
  border-radius: var(--radius);
  background: var(--team-color);
  transition: box-shadow 300ms var(--ease-out);
}

.reel.is-landed .reel-window {
  box-shadow: 0 8px 28px color-mix(in srgb, var(--team-color) 45%, transparent);
}

.reel-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.reel-item {
  height: var(--row);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
}

/* Long task titles wrap to two lines instead of running off both edges of the centred row. */
.reel-item span {
  min-width: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
  line-height: 1.1;
}

.reel-item .icon {
  color: var(--gold);
}

.reel-item img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.reel-item.is-winner {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.reel-item.is-winner .icon {
  color: var(--ink);
}

.reel-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 64px;
  pointer-events: none;
  z-index: 1;
}

.reel-fade-top {
  top: 0;
  background: linear-gradient(var(--surface), transparent);
}

.reel-fade-bottom {
  bottom: 0;
  background: linear-gradient(transparent, var(--surface));
}

.draw-result {
  margin-top: var(--space-5);
  font-size: var(--text-base);
  line-height: 1.4;
  color: var(--text-soft);
  text-align: center;
  min-height: 1.4em;
  position: relative;
  z-index: 2;
}

.draw-actions {
  margin-top: auto;
  position: relative;
  z-index: 2;
}

.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + 16px + env(safe-area-inset-bottom));
  z-index: 70;
  width: calc(100% - 32px);
  max-width: 448px;
  transform: translateX(-50%);
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--text-base);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: sheet-in 260ms var(--ease-out);
}

.toast-error {
  background: var(--danger);
}

/* ---------- Login ---------- */

.login {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 var(--space-5) calc(28px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.garland {
  display: block;
  width: calc(100% + 40px);
  height: auto;
  margin: 0 -20px;
}

.login-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 40px;
}

.login-kicker {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--gold);
}

.login-title {
  font-size: 46px;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.login form {
  margin-top: auto;
  padding-top: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-links {
  display: flex;
  justify-content: center;
  padding-top: var(--space-4);
}

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

/* ---------- Location: jury sharing strip and task maps ---------- */

.location-strip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.location-strip[hidden] {
  display: none;
}

.location-strip .icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.location-strip .link-button {
  margin-left: auto;
  font-size: var(--text-sm);
}

.location-strip.is-sharing {
  color: var(--success);
}

.sheet-list {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-md);
  line-height: 1.45;
  color: var(--text-soft);
}

.task-place {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.task-map {
  height: 200px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  isolation: isolate;
}

.task-map .leaflet-control-attribution {
  background: rgba(14, 23, 20, 0.8);
  color: var(--text-muted);
}

.task-map .leaflet-control-attribution a {
  color: var(--text-soft);
}

.task-place-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--text-warm);
}

.task-place-row .icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.task-place-row .link-button {
  margin-left: auto;
}

/* ---------- Kjøp poeng: just for fun, the jury adds paid points by hand ---------- */

.buy-points {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: -2px;
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

.buy-points .icon {
  width: 16px;
  height: 16px;
}

.buy-points:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.buy-page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: calc(var(--space-6) + env(safe-area-inset-top)) var(--space-5) calc(28px + env(safe-area-inset-bottom));
}

.buy-back {
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.buy-title {
  margin-top: var(--space-4);
  font-size: var(--text-3xl);
}

.buy-lead {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--text-lg);
}

.buy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  border-radius: var(--radius-card);
  background: var(--gold-tint);
  color: var(--gold);
  text-align: center;
}

.buy-label {
  font-size: var(--text-sm);
  font-weight: 700;
}

.buy-number {
  font-size: 44px;
  color: var(--text);
  user-select: all;
}

.buy-rate {
  font-size: var(--text-lg);
}

.buy-steps {
  margin: 0;
  padding-left: 1.2em;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: var(--text-soft);
  line-height: 1.45;
}

/* ---------- Logged in, but not on any team ---------- */

.no-team {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: var(--space-4);
}

.no-team-card,
.no-team-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.no-team-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.45;
}

.no-team-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--gold);
}

.no-team-winner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
}

.no-team-winner .icon {
  width: 22px;
  height: 22px;
  color: var(--team-color);
}
