@font-face {
  font-family: "Barlow Condensed";
  src: url("/indovino/fonts/600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/indovino/fonts/700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #100b20;
  --pane: #1e1532;
  --ink: #f9f5ff;
  --muted: #c6b9d9;
  --pink: #fcd0fa;
  --border: #564268;
  --accent: #f2acf2;
  --accent-text: #2a1231;
  --head: "Barlow Condensed", "Arial Narrow", sans-serif;
  font: 16px/1.45 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink);
  background: radial-gradient(ellipse at 58% -10%, #372452 0, transparent 55%), var(--bg);
}
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, .brand, .slot-name, .score, .buzzer, .player-name { font-family: var(--head); }
h1 { max-width: 100%; font-size: clamp(3.8rem, 9vw, 8.5rem); font-weight: 700; line-height: .85; letter-spacing: -.025em; }
h2 { font-size: clamp(2.1rem, 5vw, 3.5rem); font-weight: 700; line-height: .94; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 4px; }
:disabled { opacity: .52; cursor: default; }

.bar {
  min-height: 74px; padding: 12px max(18px, 4vw);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border-bottom: 1px solid #48335d; background: #140e24;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; font-size: 1.5rem; font-weight: 700;
  letter-spacing: .09em; text-decoration: none; flex-shrink: 0;
}
.brand img { border-radius: 9px; }
.bar-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.layout { width: min(1220px, 100%); padding: clamp(26px, 4.4vw, 68px) max(18px, 3.5vw) 40px; margin: auto; }
.feedback {
  margin: 20px 0 0; padding: 13px 16px; border-radius: 10px;
  color: #ffebed; border: 1px solid #b4617b; background: #402235;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 17px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--ink); background: #2a1d42; text-decoration: none; font-weight: 650;
  line-height: 1.2; touch-action: manipulation;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.subtle { background: transparent; }
.btn.small { min-height: 39px; padding: 8px 12px; font-size: .87rem; }
.btn.correct { background: #b3efc8; color: #0a291d; border-color: #b3efc8; }
.btn.incorrect { background: #ffc0ca; color: #391126; border-color: #ffc0ca; }
.label { color: var(--muted); font-weight: 650; }
.status { color: var(--muted); font-size: 1.06rem; }
.actions { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }

.landing { display: grid; align-content: center; min-height: min(700px, 72dvh); }
.landing h1 { max-width: 7.2em; }
.landing h1 span { color: var(--accent); }
.landing .actions { margin-top: 33px; }
.landing .actions .btn { min-width: 132px; min-height: 54px; }
.compact-title { font: 700 clamp(2.4rem, 5vw, 4.5rem)/.9 var(--head); color: var(--pink); }
.intro-card, .host-card, .public-idle {
  border: 1px solid var(--border); border-radius: 20px; padding: clamp(20px, 4vw, 44px);
  background: linear-gradient(145deg, #251836, var(--pane));
}
.intro-card { max-width: 530px; margin: 6vh auto 0; display: grid; gap: 20px; }
.intro-card form { display: grid; gap: 13px; }
.intro-card input, .host-card select {
  width: 100%; min-height: 50px; padding: 10px 13px;
  border: 1px solid #8b75a3; border-radius: 9px; background: #151022; color: var(--ink);
}
.center { text-align: center; }
.poster-title { text-align: center; margin-bottom: clamp(18px, 3.8vh, 48px); }
.poster-title h1 { color: var(--pink); font-size: clamp(3.3rem, 8vw, 7.3rem); }
.poster-title .status { margin-top: .85rem; }
.public-idle { text-align: center; max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 1.1rem; }

.qr-stage {
  --accent: #f2acf2;
  display: grid; align-items: center; justify-items: center; gap: 16px; text-align: center;
}
.qr-card {
  display: grid; justify-items: center; gap: clamp(10px, 2vh, 23px);
  padding: clamp(10px, 2.3vw, 22px) clamp(15px, 2.4vw, 28px);
  border: 1px solid color-mix(in srgb, var(--accent), #371d53 35%);
  background: color-mix(in srgb, var(--accent) 10%, #211332);
  border-radius: 25px;
}
.qr-card img { display: block; border-radius: 12px; width: min(65vw, 44vh, 480px); height: auto; aspect-ratio: 1; background: #fff; }
.qr-stage h2, .qr-label { color: var(--accent); }
.qr-label { font: 700 clamp(1.6rem, 4.5vw, 3.4rem)/1 var(--head); }
.qr-stage .status { font-size: clamp(1rem, 2vw, 1.35rem); }

.team-giallo { --accent: #fdcd4f; --accent-text: #2a1c00; }
.team-rosso { --accent: #ff667d; --accent-text: #320914; }
.team-blu { --accent: #67a0ff; --accent-text: #081940; }
.team-verde { --accent: #64e4a8; --accent-text: #092c1e; }
.team-viola { --accent: #be92ff; --accent-text: #241039; }

.board {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(16px, 2.7vw, 34px); align-items: start;
}
.callout {
  align-self: stretch; display: grid; align-content: center; gap: 12px; min-height: 200px;
  padding: clamp(18px, 4vw, 52px); border: 1px solid var(--border); border-radius: 19px;
  background: #241838; text-align: center;
}
.callout .status { color: inherit; font-size: clamp(1rem, 2.35vw, 1.55rem); }
.callout.active { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.callout.active h2 { font-size: clamp(2.65rem, 7vw, 6.8rem); overflow-wrap: anywhere; }
.callout.final { border-color: var(--accent); }
.rank { min-width: 0; }
.rank h2 { margin-bottom: 14px; }
.rank ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; max-height: 66vh; overflow: auto; }
.rank li {
  display: grid; grid-template-columns: 2.15rem minmax(0, 1fr) auto; align-items: center; gap: 11px;
  min-height: 57px; padding: 8px 15px; border: 1px solid #483956; border-radius: 10px; background: #1d142e;
}
.rank li.first { border-color: color-mix(in srgb, var(--accent), #3b2850 35%); background: #302041; }
.position { color: #c1afcf; font: 600 1.45rem/1 var(--head); }
.slot-name { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: clamp(1.45rem, 3vw, 2.35rem); line-height: .98; overflow-wrap: anywhere; }
.slot-name.dot::before { content: ""; flex: 0 0 .5em; height: .5em; border-radius: 50%; background: var(--accent); }
.score { color: var(--accent); font-size: clamp(1.9rem, 4vw, 3.4rem); font-weight: 700; line-height: .87; min-width: 1.1ch; text-align: right; }

.host-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(260px, .92fr); gap: 20px; align-items: start; }
.host-card { display: grid; gap: 18px; }
.host-card legend { padding: 0; font-weight: 650; color: var(--muted); }
.host-card fieldset { padding: 0; margin: 0; border: 0; display: grid; gap: 9px; }
.host-card form { display: grid; gap: 15px; }
.mode-buttons { display: flex; gap: 10px; }
.mode-option { flex: 1; cursor: pointer; }
.mode-option span { width: 100%; }
.mode-option input { position: absolute; opacity: 0; }
.mode-option input:focus-visible + span { outline: 3px solid var(--pink); outline-offset: 4px; }
.mode-option input:checked + span { background: var(--pink); color: #260e2a; border-color: var(--pink); }
.host-card .actions .btn { flex: 1 1 auto; }
.host-card .qr-preview { width: 128px; height: 128px; border-radius: 8px; }
.host-title { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.host-section .callout { min-height: 110px; padding: 24px; }
.host-section .callout h2 { font-size: clamp(2rem, 5vw, 4rem); }

.player { display: grid; gap: 14px; max-width: 620px; margin: 0 auto; }
.player-heading { min-width: 0; text-align: center; }
.player-kicker { color: var(--muted); font-weight: 650; }
.player-name { color: var(--accent); font-weight: 700; font-size: clamp(2.8rem, 9vw, 5.4rem); line-height: .9; overflow-wrap: anywhere; }
.buzzer {
  min-height: min(53dvh, 420px); width: 100%; padding: 24px 16px; margin: 1vh 0;
  display: grid; align-content: center; justify-items: center; gap: 13px;
  border: 1px solid color-mix(in srgb, var(--accent), white 30%); border-radius: 27px;
  color: var(--accent-text); background: var(--accent); box-shadow: 0 8px 0 color-mix(in srgb, var(--accent) 44%, #120c20);
  font-size: clamp(2.9rem, 10.4vw, 6.5rem); font-weight: 700; line-height: .92;
  touch-action: manipulation; user-select: none;
}
.buzzer:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 44%, #120c20); }
.buzzer:disabled { opacity: 1; background: color-mix(in srgb, var(--accent) 26%, #231531); color: #fcf6ff; box-shadow: none; }
.buzzer.is-mine { background: var(--accent); color: var(--accent-text); }
.buzzer .subtext { font: 650 .99rem/1.45 system-ui, sans-serif; }
.buzzer .pulse {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid currentColor;
  box-shadow: inset 0 0 0 6px var(--accent), inset 0 0 0 8px currentColor;
}
.player-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; color: var(--muted); }
@media (max-width: 680px) {
  .bar { min-height: 61px; padding-block: 8px; }
  .brand { font-size: 1.17rem; gap: 6px; }
  .brand img { width: 30px; height: 30px; }
  .bar-actions { gap: 4px; }
  .btn.small { padding-inline: 8px; }
  .board, .host-grid { grid-template-columns: 1fr; }
  .callout { min-height: 126px; }
  .poster-title { margin-bottom: 24px; }
  .poster-title h1 { font-size: clamp(3.15rem, 12vw, 4.7rem); }
  .rank ol { max-height: none; }
  .landing { min-height: 62dvh; }
  .landing .actions .btn { flex: 1; min-width: 95px; }
  .qr-card img { width: min(67vw, 44vh, 360px); }
  .host-title { margin-bottom: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
