/* ==========================================================================
   FantaOrtogonale — design system
   Palette ELICSIR: arancione e bianco, con il blu come colore di appoggio.
   Mobile first: la webapp si usa soprattutto dal telefono durante le lezioni.
   ========================================================================== */

:root {
  /* Colori ELICSIR presi dal sito ufficiale: arancione #ff8400 (fascia di
     testata), blu #3381bd / #1b4f77, navy #232f59, bianco. */
  --brand-orange: #ff8400;
  --brand-orange-deep: #e07100;
  --brand-amber: #f8ae35;
  --brand-blue: #3381bd;
  --brand-blue-deep: #1b4f77;
  --brand-navy: #232f59;

  --bg: #f5f8fb;
  --bg-elevated: #ffffff;
  --bg-sunken: #eaf0f6;
  --border: #dfe7ef;
  --border-strong: #c3d1de;
  --text: #1c2540;
  --text-muted: #5b6b82;
  --accent: var(--brand-orange);
  --accent-strong: #b85f00; /* variante scura: l'arancione pieno non ha contrasto sufficiente sul bianco */
  --accent-soft: #fff2e0;
  --secondary: var(--brand-blue-deep);
  --secondary-soft: #e8f1f8;
  --positive: #1a7a45;
  --positive-soft: #e3f4ea;
  --negative: #c02626;
  --negative-soft: #fdeaea;
  --roulette-black: #1a1a1a;
  --gold: #d9a327;
  --silver: #8fa3b5;
  --bronze: #bd7940;
  --header-bg: var(--brand-orange);
  --header-text: #14203f;
  --header-text-muted: rgba(20, 32, 63, 0.78);
  --header-active-bg: #ffffff;
  --header-active-text: #b85f00;
  --header-hover-bg: rgba(255, 255, 255, 0.4);
  --header-border: rgba(0, 0, 0, 0.12);
  --shadow: 0 1px 2px rgba(28, 37, 64, 0.06), 0 8px 24px -12px rgba(28, 37, 64, 0.22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --brand-orange: #ff8400;
    --brand-orange-deep: #e07100;
    --brand-amber: #f8ae35;
    --brand-blue: #3381bd;
    --brand-blue-deep: #1b4f77;
    --brand-navy: #232f59;

    --bg: #10162b;
    --bg-elevated: #1a2340;
    --bg-sunken: #0b1020;
    --border: #2a3557;
    --border-strong: #3e4b74;
    --text: #eef2fa;
    --text-muted: #9aa8c4;
    --accent: #ff9b33;
    --accent-strong: #ffb15c;
    --accent-soft: #3a2a12;
    --secondary: #7fb3dd;
    --secondary-soft: #16294099;
    --positive: #4ade80;
    --positive-soft: #14301f;
    --negative: #f87171;
    --negative-soft: #331a1a;
    --roulette-black: #2a2a2a;
    --gold: #f8ae35;
    --silver: #b9c7d6;
    --bronze: #d08a4e;
    --header-bg: #171f3a;
    --header-text: #ffffff;
    --header-text-muted: rgba(255, 255, 255, 0.72);
    --header-active-bg: rgba(255, 132, 0, 0.24);
    --header-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.8);
  }
}

:root[data-theme='dark'] {
  --brand-orange: #ff8400;
  --brand-orange-deep: #e07100;
  --brand-amber: #f8ae35;
  --brand-blue: #3381bd;
  --brand-blue-deep: #1b4f77;
  --brand-navy: #232f59;

  --bg: #10162b;
  --bg-elevated: #1a2340;
  --bg-sunken: #0b1020;
  --border: #2a3557;
  --border-strong: #3e4b74;
  --text: #eef2fa;
  --text-muted: #9aa8c4;
  --accent: #ff9b33;
  --accent-strong: #ffb15c;
  --accent-soft: #3a2a12;
  --secondary: #7fb3dd;
  --secondary-soft: #16294099;
  --positive: #4ade80;
  --positive-soft: #14301f;
  --negative: #f87171;
  --negative-soft: #331a1a;
  --roulette-black: #2a2a2a;
  --gold: #f8ae35;
  --silver: #b9c7d6;
  --bronze: #d08a4e;
  --header-bg: #171f3a;
  --header-text: #ffffff;
  --header-text-muted: rgba(255, 255, 255, 0.72);
  --header-active-bg: rgba(255, 155, 51, 0.22);
  --header-active-text: #ffb15c;
  --header-hover-bg: rgba(255, 255, 255, 0.1);
  --header-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px -12px rgba(0, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.015em;
}

a {
  color: var(--secondary);
}

/* --- layout --------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
}

.app-header__inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--header-text);
  margin-right: auto;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #fff;
  color: var(--brand-orange);
  font-size: 1rem;
}

.nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav a {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--header-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav a:hover {
  background: var(--header-hover-bg);
  color: var(--header-text);
}

.nav a[aria-current='page'] {
  background: var(--header-active-bg);
  color: var(--header-active-text);
  font-weight: 600;
}

.icon-button {
  border: 1px solid var(--header-border);
  background: var(--header-hover-bg);
  color: var(--header-text);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
}

.icon-button:hover {
  background: var(--header-active-bg);
  color: var(--header-active-text);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.page-head {
  margin-bottom: 1.25rem;
}

.page-head h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.page-head p {
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1rem;
}

.card__title {
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
}

.muted {
  color: var(--text-muted);
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 1rem;
}

/* --- podio ---------------------------------------------------------------- */

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  align-items: end;
  margin-bottom: 1.25rem;
}

.podium__slot {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.6rem;
  text-align: center;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
}

.podium__slot:hover {
  border-color: var(--border-strong);
}

.podium__slot[data-place='1'] {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--border));
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--brand-orange) 16%, transparent);
  padding-block: 1.4rem;
}

.podium__slot[data-place='2'] {
  border-color: color-mix(in srgb, var(--silver) 45%, var(--border));
}

.podium__slot[data-place='3'] {
  border-color: color-mix(in srgb, var(--bronze) 45%, var(--border));
}

.podium__medal {
  font-size: 1.5rem;
  line-height: 1;
}

.podium__name {
  font-weight: 650;
  font-size: 0.92rem;
  margin-top: 0.45rem;
  overflow-wrap: anywhere;
}

.podium__nick {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.podium__score {
  margin-top: 0.4rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-strong);
}

/* --- classifica ----------------------------------------------------------- */

.search {
  width: 100%;
  margin-bottom: 0.9rem;
}

.board {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.board__row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--border);
}

.board__row:first-child {
  border-top: none;
}

.board__row:hover {
  background: var(--bg-sunken);
}

.board__row.is-highlighted {
  background: var(--accent-soft);
}

.board__rank {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--secondary);
  text-align: center;
}

.board__player {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  /* Anello sottile: sul fondo navy del tema scuro gli avatar blu si perderebbero. */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.board__name {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board__nick {
  display: block;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board__count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.board__score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 3.2rem;
  text-align: right;
}

@media (max-width: 560px) {
  .board__count {
    display: none;
  }
}

/* --- badge punti ---------------------------------------------------------- */

.points {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.points--positive {
  background: var(--positive-soft);
  color: var(--positive);
}

.points--negative {
  background: var(--negative-soft);
  color: var(--negative);
}

/* --- catalogo bonus ------------------------------------------------------- */

.bonus-group {
  margin-bottom: 1.5rem;
}

.bonus-group h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.bonus-list {
  display: grid;
  gap: 0.6rem;
}

.bonus-item {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.bonus-item__label {
  font-weight: 600;
}

.bonus-item__desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.bonus-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* --- profilo -------------------------------------------------------------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-head .avatar {
  width: 56px;
  height: 56px;
  font-size: 1.15rem;
}

.stats {
  display: flex;
  gap: 0.6rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.stat {
  background: var(--secondary-soft);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  text-align: center;
  min-width: 5rem;
}

.stat__value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}

.timeline li:first-child {
  border-top: none;
}

.timeline__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.timeline__note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --- form ----------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: 0.9rem;
}

.field > span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='search'],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

select[multiple] {
  min-height: 11rem;
}

input[type='file'] {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  background: var(--accent);
  color: #14203f;
}

.button:hover {
  background: var(--brand-orange-deep);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.button--ghost:hover {
  background: var(--bg-sunken);
}

.button--danger {
  background: transparent;
  color: var(--negative);
  border-color: color-mix(in srgb, var(--negative) 40%, var(--border));
}

.button--danger:hover {
  background: var(--negative-soft);
}

.button--small {
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.form-error {
  color: var(--negative);
  font-size: 0.88rem;
  margin: 0 0 0.8rem;
}

.form-error:empty {
  display: none;
}

.grid-2 {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* --- admin ---------------------------------------------------------------- */

.login-wrap {
  max-width: 380px;
  margin: 12vh auto 0;
}

.admin-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.admin-bar .muted {
  margin-right: auto;
  font-size: 0.88rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow-x: auto;
}

.tabs button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.tabs button[aria-selected='true'] {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.row-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row-list li {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.row-list li:first-child {
  border-top: none;
}

.row-list__main {
  min-width: 12rem;
  flex: 1;
}

.row-list__title {
  font-weight: 600;
}

.row-list__sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.bonus-edit-form {
  width: 100%;
}

.notice {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.86rem;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.notice--frozen {
  background: var(--secondary-soft);
  border-color: color-mix(in srgb, var(--secondary) 35%, var(--border));
  font-weight: 600;
}

/* --- richieste di punti --------------------------------------------------- */

/* Elenco di caselle al posto della select multipla: sul telefono il Cmd/Ctrl
   non esiste, e i destinatari si scelgono con il pollice. */
.picker {
  border: none;
  margin: 0 0 0.9rem;
  padding: 0;
}

.picker legend {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.3rem;
}

.picker legend small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.25rem;
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}

.picker__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  padding: 0.3rem 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.picker__item:hover {
  background: var(--bg-sunken);
}

.picker__item input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.picker__item em {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.evidence-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.evidence-thumb {
  position: relative;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  overflow: hidden;
  cursor: pointer;
}

.evidence-thumb img {
  display: block;
  width: 7.5rem;
  height: 7.5rem;
  object-fit: cover;
}

.evidence-thumb figcaption {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.15rem 0;
}

.evidence-thumb__remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.6rem;
  height: 1.6rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #14203f;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.status {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.status--pending {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status--approved {
  background: var(--positive-soft);
  color: var(--positive);
}

.status--rejected {
  background: var(--negative-soft);
  color: var(--negative);
}

/* Treasure hunt task states: todo (not attempted) and sealed (decided, but
   the team hasn't opened the letter yet) reuse the same badge component. */
.status--todo {
  background: var(--bg-sunken);
  color: var(--text-muted);
}

.status--sealed {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.letter {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  font-style: italic;
  white-space: pre-wrap;
  line-height: 1.5;
}

.gambling-live {
  text-align: center;
}

.gambling-multiplier {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0.5rem 0;
  font-variant-numeric: tabular-nums;
}

.gambling-between {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.aviator-stage {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.aviator-svg {
  width: 100%;
  height: 160px;
  display: block;
}

.aviator-axis {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.aviator-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}

.aviator-path.is-crashed {
  stroke: var(--negative);
}

.aviator-plane {
  font-size: 1.3rem;
  transition: opacity 0.4s ease-out, transform 0.2s linear;
  transform-box: fill-box;
  transform-origin: center;
}

.aviator-plane.is-crashed {
  opacity: 0;
  transition: opacity 0.4s ease-out, transform 0.4s ease-in;
  transform: translate(20px, -14px) scale(1.1);
}

.roulette-stage {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  position: relative;
}

.roulette-wheel {
  width: 180px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--border-strong);
  transform-origin: center;
}

.roulette-wheel__pointer {
  position: absolute;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid var(--accent);
}

.tab-badge {
  display: inline-block;
  min-width: 1.25rem;
  margin-left: 0.35rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #14203f;
  font-size: 0.72rem;
  line-height: 1.25rem;
  text-align: center;
}

.request {
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
}

.request:first-of-type {
  border-top: none;
}

.request__head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.request__title {
  font-weight: 600;
}

.request__meta,
.request__targets {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.request__targets {
  margin-top: 0.35rem;
}

.request__message,
.row-list__note {
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  margin: 0.55rem 0 0;
}

.request__reject {
  margin-top: 0.75rem;
}

/* --- toast ---------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translate(-50%, 140%);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
  z-index: 50;
  max-width: min(90vw, 26rem);
  text-align: center;
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

.toast[data-kind='error'] {
  background: var(--negative);
  color: #fff;
}

.toast[data-kind='success'] {
  background: var(--positive);
  color: #fff;
}

.app-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* --- schermi stretti ------------------------------------------------------ */

@media (max-width: 560px) {
  /* Header su due righe: brand + tema sopra, navigazione sotto a tutta larghezza. */
  .brand {
    order: 1;
  }

  #theme-toggle {
    order: 2;
  }

  .nav {
    order: 3;
    width: 100%;
    /* Cinque voci non stanno in riga su un telefono stretto: meglio centrarle
       e lasciarle andare a capo che schiacciarle. */
    justify-content: center;
    gap: 0.1rem;
  }

  .nav a {
    padding: 0.3rem 0.55rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 420px) {
  .podium {
    gap: 0.4rem;
  }

  .podium__slot {
    padding-inline: 0.35rem;
  }

  .podium__name {
    font-size: 0.82rem;
  }

  .podium__nick {
    font-size: 0.68rem;
  }

  .podium__score {
    font-size: 1.1rem;
  }
}

/* --- serial murder mistery ---------------------------------------------------
   La storia vive dentro la sua scheda della caccia al tesoro: le pagine sono
   card come le altre, con un corpo di testo più largo e più arioso da leggere. */

.mystery-page__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.mystery-page__section {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
}

.mystery-page__body p {
  margin: 0 0 0.9rem;
  line-height: 1.7;
  max-width: 68ch;
}

.mystery-page__body p:last-child {
  margin-bottom: 0;
}

.mystery-photo {
  margin: 0.4rem 0 0.2rem;
}

.mystery-questions {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.mystery-questions__title {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mystery-question {
  padding: 0.9rem 0;
  border-bottom: 1px dashed var(--border);
}

.mystery-question:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mystery-question__prompt {
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.mystery-question__points,
.mystery-points {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.mystery-question__points {
  margin: 0 0 0.5rem;
}

.mystery-question__hint {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.mystery-status {
  margin: 0.4rem 0;
  font-size: 0.9rem;
}

.mystery-status.is-pending {
  color: var(--muted);
}

.mystery-status.is-accepted {
  color: var(--accent-strong);
  font-weight: 600;
}

.mystery-status.is-refused {
  color: var(--danger, #b3261e);
}

.mystery-more {
  margin: 0.4rem 0 1.2rem;
}

/* Il finale: il valore residuo si legge in cifre e a colpo d'occhio. */
.mystery-queen.is-locked {
  opacity: 0.75;
}

.mystery-quote {
  margin: 0 0 0.9rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--muted);
  line-height: 1.6;
}

.mystery-meter {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin: 0.9rem 0 0.4rem;
}

.mystery-meter__fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.5s ease;
}

.mystery-meter__label {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.mystery-guided {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.mystery-guided.is-sealed p {
  max-width: 62ch;
  line-height: 1.6;
}

/* Tabella del pannello admin: la usa il quadro squadre della mistery, e scrolla
   in orizzontale sui telefoni invece di allargare la pagina. */

.table-wrap {
  overflow-x: auto;
  margin-top: 0.6rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  padding: 0.5rem 0.7rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Nota che precede un blocco di domande: dice che bloccano la storia e quanto
   costa sbagliare, prima che qualcuno risponda a caso. */

.mystery-questions__note {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 62ch;
}

/* Pannello della caccia in homepage: si deve notare senza rubare la scena alla
   classifica, quindi bordo d'accento e nient'altro di appariscente. */

.treasure-panel {
  border-left: 4px solid var(--accent);
}

.treasure-panel p {
  max-width: 60ch;
  line-height: 1.6;
}

.treasure-panel.is-closed {
  opacity: 0.8;
}

/* --- arcade ------------------------------------------------------------- */

.arcade {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.arcade-round.is-preview {
  opacity: 0.75;
}

.arcade-badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--bg-sunken);
  color: var(--text-muted);
}

.arcade-badge--1 {
  background: color-mix(in srgb, var(--gold) 25%, var(--bg-sunken));
  color: var(--accent-strong);
}

.arcade-badge--2 {
  background: color-mix(in srgb, var(--silver) 30%, var(--bg-sunken));
  color: var(--text);
}

.arcade-badge--3 {
  background: color-mix(in srgb, var(--bronze) 30%, var(--bg-sunken));
  color: var(--text);
}

.arcade-badge--placed {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.arcade-leaderboard-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-top: 0.35rem;
}

.arcade-leaderboard-cell {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
