:root {
  --paper: #f1faff;
  --ink: #092b58;
  --muted: #415b79;
  --accent: #09c9ee;
  --line: #b8d6e9;
  --white: #ffffff;
  --yellow: #ffe02c;
  --green: #a1ec35;
  --red: #d91b43;
  --magenta: #b813c2;
  --button-top: #72e7fb;
  --button-bottom: #13c7ee;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
#screen-game, #turn-game { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#screen-game input, #screen-game textarea, #turn-game input, #turn-game textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
#screen-game button, #turn-game button, #turn-listening, #screen-quiz-status { touch-action: manipulation; }
#screen-canvas, #turn-canvas { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; touch-action: none; }
.player-handoff { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 18px; background: var(--paper) url('assets/sfondo.jpg') repeat 0 0; background-size: auto; }
.player-handoff section { width: min(520px, 100%); max-height: 100%; overflow: auto; padding: 30px 24px; border: 3px solid var(--ink); border-radius: 24px; background: linear-gradient(145deg, white, #eaf8ff); box-shadow: 6px 8px 0 #092b5820; text-align: center; }
.player-handoff h2 { margin: 0 0 26px; font-size: clamp(26px, 5vw, 38px); line-height: 1.25; overflow-wrap: anywhere; }
.player-handoff button { max-width: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper) url('assets/sfondo.jpg') repeat 0 0;
  background-size: auto;
}
button, input, select { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #ae18c2;
  outline-offset: 4px;
}
main, footer { width: 100%; max-width: 1220px; margin: auto; }
main { padding: 44px 40px 0; }
.setup-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; max-width: 740px; margin: auto; align-items: start; }
.intro { min-width: 0; }
.eyebrow { font-size: 11px; letter-spacing: 1.5px; font-weight: 800; line-height: 1.6; }
.intro > .eyebrow { display: inline-block; background: #ffffffda; padding: 9px 14px; border-radius: 24px; margin: 0; }
.intro h1.intro-logo { width: 100%; max-width: 100%; margin: 0 auto; line-height: 0; }
.intro-logo img { display: block; width: 100%; height: auto; }
.intro-copy { max-width: 430px; color: var(--muted); font-size: 16px; line-height: 1.65; margin: 22px 0 12px; }
.paper-note { max-width: 430px; font-size: 13px; font-style: italic; line-height: 1.6; }
.doodle-scene { display: none; }
.setup-card {
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 28px 30px 32px;
  background: linear-gradient(145deg, #ffffffef, #eaf8fff2);
  box-shadow: 6px 8px 0 #092b581b, inset 0 2px 0 #fff;
}
.section-top { display: flex; align-items: center; gap: 14px; }
.step { background: var(--ink); color: white; padding: 8px 10px; border-radius: 24px; font-size: 11px; font-weight: 800; }
.corner-star { color: #f0b500; margin-left: auto; font-size: 34px; line-height: 1; text-shadow: 1px 1px 0 var(--ink); }
h2 { font-size: 32px; line-height: 1.2; letter-spacing: -1px; margin: 24px 0 10px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.small { font-size: 11px; }
.field-title, legend { font-size: 12px; font-weight: 750; }
.field-title { display: block; margin-top: 24px; }
.count-control { display: flex; align-items: center; margin: 10px 0 24px; }
.count-control button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border: 2px solid var(--ink);
  background: linear-gradient(#c2f4ff, #82e1f5);
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
}
.count-control #minus, .count-control #plus { border-radius: 24px; }
.count-control input {
  flex: 0 0 54px;
  width: 54px;
  height: 46px;
  border: 2px solid var(--ink);
  background: #fff;
  border-radius: 24px;
  margin: 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.count-control input::-webkit-inner-spin-button { appearance: none; }
#player-count-choices { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; gap: 8px; }
#player-count-choices button { width: 100%; height: 46px; border-radius: 24px; font-size: 18px; }
#player-count-choices button[aria-pressed="true"] { background: linear-gradient(#fff384, #ffdc24); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 #ffffffb3; }
@media (max-width: 380px) { #player-count-choices { gap: 5px; } }
.count-control > span { font-size: 11px; color: var(--muted); margin-left: 14px; }
.names-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px; }
.name-field { min-width: 0; }
.name-field label { display: block; font-size: 10px; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin-bottom: 7px; }
.name-field input, .answer-row input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 2px solid #9bbfdc;
  border-radius: 24px;
  background: #ffffffed;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 16px;
  box-shadow: inset 0 2px 2px #092b5807;
}
.name-field input::placeholder, .answer-row input::placeholder { color: #526c87; opacity: 1; }
fieldset { border: 0; border-radius: 24px; padding: 0; margin: 26px 0 0; }
legend { padding: 0; margin-bottom: 12px; }
.difficulty-options { display: flex; gap: 8px; flex-wrap: wrap; }
.difficulty-options label { position: relative; flex: 1; min-width: 65px; text-align: center; }
.difficulty-options input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.difficulty-options span { display: flex; justify-content: center; align-items: center; min-height: 44px; border: 2px solid #9bbfdc; border-radius: 24px; font-size: 12px; font-weight: 750; padding: 9px 6px; background: #fff; }
.difficulty-options input:checked + span { background: linear-gradient(#7ceafd, #27cfed); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.difficulty-options input[value="easy"]:checked + span { background: linear-gradient(#c5fa77, #a1ec35); }
.difficulty-options input[value="medium"]:checked + span { background: linear-gradient(#fff28a, #ffe02c); }
.difficulty-options input[value="hard"]:checked + span { background: linear-gradient(#ce2049, #a70d31); color: white; }
.difficulty-options input:focus-visible + span { outline: 3px solid var(--magenta); outline-offset: 4px; }
.data-status { color: var(--muted); font-size: 11px; min-height: 16px; margin: 22px 0 18px; line-height: 1.5; }

/* The logo's rounded, glossy letters become a small family of tactile buttons. */
.primary, .secondary, .text-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 48px;
  max-width: 100%;
  padding: 13px 20px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff42 0%, #ffffff0a 46%, #00000005 100%), linear-gradient(var(--button-top), var(--button-bottom));
  box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 #ffffffb3;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.primary { width: 100%; --button-top: #fff384; --button-bottom: #ffdc24; }
.primary span:last-child:not(:first-child) { margin-left: auto; font-size: 23px; line-height: 1; }
.text-button { font-size: 12px; padding: 11px 16px; min-height: 44px; }
.primary:hover:not(:disabled), .secondary:hover:not(:disabled), .text-button:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.primary:active:not(:disabled), .secondary:active:not(:disabled), .text-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink), inset 0 2px 0 #ffffffb3; }
.primary:disabled, .secondary:disabled, .text-button:disabled { transform: none; }
#next-round, #quiz-accept { --button-top: #c7fb79; --button-bottom: #9be42f; }
#end-game, #back, #stop-voice { --button-top: #ce2248; --button-bottom: #ac1234; color: white; }
#voice-test { --button-top: #a315b1; --button-bottom: #821495; color: white; }
#end-game, #back, #stop-voice, #voice-test { background: linear-gradient(180deg, #ffffff14, transparent 50%), linear-gradient(var(--button-top), var(--button-bottom)); }
#pause-session { --button-top: #fff18a; --button-bottom: #ffdc24; }
.download-sheets { display: inline-flex; min-height: 54px; margin-top: 14px; font-size: 14px; }

.voice-panel { margin-top: 48px; padding: 18px 24px; border: 2px solid #7fa9cb; border-radius: 24px; background: #f4fbfff0; box-shadow: 0 4px 0 #092b580c; }
.voice-panel summary { cursor: pointer; font-size: 13px; font-weight: 750; min-height: 44px; align-content: center; border-radius: 24px; }
.voice-label { font-size: 9px; letter-spacing: .8px; background: #dbf1fb; padding: 5px 9px; margin-left: 12px; border-radius: 24px; }
.voice-content { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 10px 0 4px; }
.voice-content h2 { font-size: 24px; }
.voice-content p { font-size: 13px; line-height: 1.6; }
.voice-content .small { font-size: 11px; }
.voice-controls { padding-top: 24px; min-width: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.button-row .secondary, .button-row .text-button { min-height: 44px; font-size: 12px; padding: 10px 14px; }
.transcript { border-left: 4px solid var(--accent); border-radius: 24px; background: #e5f8ff; padding: 12px 16px; font-weight: 650; overflow-wrap: anywhere; }
.transcript:empty { display: none; }
footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; padding: 28px 40px; font-size: 10px; color: var(--muted); letter-spacing: .4px; }
footer a { display: flex; align-items: center; min-height: 44px; color: var(--muted); text-underline-offset: 3px; border-radius: 24px; }
.language { display: flex; align-items: center; gap: 10px; font-size: 12px; }
footer .language { order: -1; flex: 0 0 auto; justify-content: flex-start; }
.language label { color: var(--muted); }
.language select { min-height: 44px; border: 2px solid #9bbfdc; border-radius: 24px; background: #ffffffed; color: var(--ink); font-size: 16px; padding: 8px 10px; }

.game-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.session-title { font-size: clamp(32px, 4.3vw, 56px); line-height: 1.1; letter-spacing: -2px; margin: 10px 0 22px; }
.reset-note { font-size: 10px; color: var(--muted); margin: -6px 0 18px; }
.roster { display: flex; flex-wrap: wrap; gap: 9px; list-style: none; margin: 0 0 26px; padding: 0; }
.roster li { border: 2px solid #a5c6dd; border-radius: 24px; background: #fffffff0; padding: 8px 14px; font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.roster li.active { background: #bbef66; color: var(--ink); border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.session-console { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 10px; border: 3px solid var(--ink); border-radius: 24px; padding: 10px; background: #fffffff2; box-shadow: 5px 6px 0 #092b581a; }
.current-prompt { min-height: 210px; padding: 22px; align-content: center; border-radius: 24px; }
.current-prompt h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1.15; margin: 16px 0; overflow-wrap: anywhere; }
.current-prompt .error { font-size: 12px; line-height: 1.5; max-width: 450px; }
.current-prompt .error:empty { display: none; }
.session-clock { padding: 18px 20px; text-align: center; border: 2px solid #9bc8e1; border-radius: 24px; background: linear-gradient(#ecfbff, #d4f3fd); }
.session-clock output { display: block; font-size: 78px; font-weight: 900; letter-spacing: -5px; line-height: 1.1; }
.session-clock > span { font-size: 10px; letter-spacing: .5px; }
.session-clock > p { font-size: 12px; color: var(--muted); margin: 12px 0; }
.session-clock button { width: 100%; min-height: 44px; padding: 10px; }
#session-progress { display: block; width: 100%; height: 12px; border: 2px solid #9bc8e1; border-radius: 24px; overflow: hidden; margin: 20px 0 28px; background: #e5f5ff; accent-color: #0dc8eb; }
#session-progress::-webkit-progress-bar { background: #e5f5ff; border-radius: 24px; }
#session-progress::-webkit-progress-value { background: linear-gradient(90deg, #42daf2, #a1ec35); border-radius: 24px; }
#session-progress::-moz-progress-bar { background: #0dc8eb; border-radius: 24px; }
.list-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 14px; }
.list-heading h2 { visibility: hidden; font-size: 20px; letter-spacing: -.5px; margin: 0; }
.list-heading p { margin: 0; text-align: right; font-size: 11px; }
.subject-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 18px; list-style: none; margin: 0; padding: 0; }
.subject-list li { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 46px; border: 2px solid #c2ddeb; border-radius: 24px; padding: 9px 12px; background: #fffffff0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.subject-number { min-width: 24px; font-size: 11px; color: var(--muted); font-weight: 750; font-variant-numeric: tabular-nums; }
.subject-list li.current { background: linear-gradient(#fff490, #ffe042); border-color: var(--ink); font-weight: 800; box-shadow: 0 2px 0 var(--ink); }
.subject-list li.current .subject-number { color: var(--ink); }
.subject-list li.read .subject-number::before { content: '✓ '; font-size: 9px; }
.subject-list li.read .subject-number { min-width: 36px; }
.game-footnote { margin: 26px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.error { color: #a11936 !important; }

.quiz-console { display: flex; justify-content: flex-end; background: #eaf8ffdf; border: 2px solid #a5c6dd; box-shadow: none; padding: 0; }
.quiz-console .session-clock { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 18px; width: 100%; border: 0; background: transparent; padding: 12px 18px; }
.quiz-console .session-clock output { font-size: 32px; letter-spacing: -1px; }
.quiz-console .session-clock > span { display: none; }
.quiz-console .session-clock > p { margin: 0; }
.quiz-console .session-clock button { width: auto; min-width: 110px; }
#quiz-panel { max-width: 720px; margin: 28px auto; border: 3px solid var(--ink); border-radius: 24px; padding: 30px; background: linear-gradient(145deg, #ffffffef, #eaf8fff2); box-shadow: 5px 6px 0 #092b581a; }
#quiz-title { font-size: clamp(28px, 4vw, 43px); line-height: 1.2; margin: 14px 0; }
#quiz-player { display: inline-block; padding: 10px 16px; background: #d6f7ff; border-radius: 24px; font-size: 17px; font-weight: 900; letter-spacing: .04em; }
#quiz-status { min-height: 46px; font-size: 16px; font-weight: 800; padding: 12px 0; }
#quiz-voice-warning { font-size: 12px; line-height: 1.5; }
#quiz-voice-warning:empty { display: none; }
#answer-form { border-radius: 24px; }
#answer-form label { display: block; font-size: 12px; font-weight: 750; margin: 20px 0 10px; }
.answer-row { display: flex; gap: 12px; }
.answer-row input { flex: 1; }
.answer-row button { width: auto; min-width: 120px; }
.quiz-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; margin: 22px 0 14px; }
#quiz-panel > .small { font-size: 11px; line-height: 1.55; }
#results-panel { max-width: 720px; margin: 35px auto; background: #fffffff0; border: 3px solid var(--ink); border-radius: 24px; padding: 26px 30px 32px; box-shadow: 5px 6px 0 #092b581a; }
#results-title { margin-top: 0; }
.score-scroll { overflow: auto; border: 2px solid #a5c6dd; border-radius: 24px; margin: 24px 0 28px; background: white; }
#score-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0; text-align: left; }
#score-table th { padding: 12px; background: #e6f7ff; border-bottom: 1px solid #a5c6dd; color: var(--muted); font-size: 11px; }
#score-table td { padding: 16px 12px; border-bottom: 1px solid #d2e5f0; font-size: 15px; overflow-wrap: anywhere; }
#score-table tbody tr:last-child td { border-bottom: 0; }
#score-table td:last-child { font-weight: 850; }
#score-table tbody tr:first-child td { background: #fff09a; }
#score-table thead th:first-child { border-top-left-radius: 17px; }
#score-table thead th:last-child { border-top-right-radius: 17px; }
#score-table tbody tr:last-child td:first-child { border-bottom-left-radius: 17px; }
#score-table tbody tr:last-child td:last-child { border-bottom-right-radius: 17px; }
#score-table th:nth-child(3), #score-table th:nth-child(4), #score-table td:nth-child(3), #score-table td:nth-child(4) { text-align: right; }
.round-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.round-actions button { width: 100%; min-height: 76px; font-size: 20px; padding: 18px; border-radius: 24px; }

@media (max-width: 900px) {
  .setup-layout { gap: 35px; }
  .setup-card { padding: 25px; }
  .voice-content { gap: 28px; }
}
@media (max-width: 650px) {
  main { padding: 28px 18px 0; }
  .setup-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .intro > .eyebrow { font-size: 9px; letter-spacing: .8px; padding: 8px 10px; }
  .intro h1.intro-logo { margin: 20px 0; }
  .intro-logo img { max-width: 460px; margin: auto; }
  .intro-copy { font-size: 14px; max-width: 100%; }
  .paper-note { font-size: 12px; }
  .download-sheets { width: 100%; text-align: center; }
  .setup-card { padding: 22px 20px 26px; border-radius: 24px; }
  .setup-card h2 { margin-top: 20px; }
  .count-control > span { margin-left: 10px; font-size: 10px; }
  .names-grid { gap: 14px 10px; }
  .name-field input { padding: 10px; }
  .voice-panel { margin-top: 36px; padding: 14px 18px; border-radius: 24px; }
  .voice-content { grid-template-columns: 1fr; gap: 0; }
  .voice-controls { padding-top: 8px; }
  .voice-label { margin-left: 6px; font-size: 8px; padding: 4px 7px; }
  footer { gap: 14px; padding: 26px 18px; }
  footer .language { flex-basis: 100%; }
  .game-top { align-items: flex-start; gap: 12px; }
  .game-top .text-button { flex-shrink: 0; max-width: 105px; padding: 10px 12px; font-size: 11px; }
  .session-title { font-size: 32px; letter-spacing: -1.3px; }
  .reset-note { font-size: 9px; margin-top: 0; line-height: 1.5; }
  .session-console { grid-template-columns: minmax(0, 1fr) 108px; gap: 6px; padding: 6px; border-radius: 24px; }
  .current-prompt { padding: 14px 9px; min-height: 180px; }
  .current-prompt h2 { font-size: 26px; letter-spacing: -1px; }
  .current-prompt .eyebrow { font-size: 9px; letter-spacing: .7px; }
  .current-prompt .error { font-size: 10px; }
  .session-clock { padding: 14px 10px; border-radius: 24px; }
  .session-clock output { font-size: 56px; letter-spacing: -3px; }
  .session-clock > span { font-size: 9px; }
  .session-clock button { font-size: 12px; padding: 10px 7px; }
  .list-heading { display: block; }
  .list-heading p { text-align: left; margin-top: 6px; }
  .subject-list { gap: 7px 8px; }
  .subject-list li { padding: 8px; gap: 7px; font-size: 12px; border-radius: 24px; }
  .subject-number { min-width: 17px; font-size: 10px; }
  .subject-list li.read .subject-number { min-width: 17px; }
  .subject-list li.read .subject-number::before { content: none; }
  .game-footnote { font-size: 11px; }
  .quiz-console .session-clock { padding: 10px 14px; }
  #quiz-panel { padding: 22px 20px; margin: 22px 0; border-radius: 24px; }
  #quiz-title { font-size: 28px; }
  .answer-row { flex-wrap: wrap; }
  .answer-row input { flex-basis: 100%; }
  .answer-row button { width: 100%; }
  .quiz-actions { gap: 12px; }
  #results-panel { padding: 24px 18px; border-radius: 24px; }
  #score-table td { padding: 12px 8px; font-size: 13px; }
  #score-table th { padding: 10px 8px; }
  .round-actions { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .round-actions button { min-height: 72px; font-size: 20px; }
}

@media (min-width: 651px) {
  body:has(#game-screen:not([hidden])) { position: fixed; inset: 0; width: 100%; height: 100vh; overflow: hidden; }
  body:has(#game-screen:not([hidden])) main { height: 100vh; padding: 24px 40px 0; }
  body:has(#game-screen:not([hidden])) footer,
  body:has(#game-screen:not([hidden])) .game-top,
  body:has(#game-screen:not([hidden])) .reset-note,
  body:has(#game-screen:not([hidden])) .game-footnote { display: none; }
  body:has(#game-screen:not([hidden])) .game-layout { height: 100%; display: flex; flex-direction: column; }
  body:has(#game-screen:not([hidden])) .roster { flex-shrink: 0; margin: 0 0 12px; }
  body:has(#game-screen:not([hidden])) .session-console { flex-shrink: 0; }
  body:has(#game-screen:not([hidden])) .current-prompt { min-height: 180px; }
  body:has(#game-screen:not([hidden])) #session-progress { flex-shrink: 0; margin: 12px 0; }
  body:has(#game-screen:not([hidden])) .list-heading { flex-shrink: 0; margin-bottom: 8px; }
  body:has(#game-screen:not([hidden])) .subject-list { flex: 1; min-height: 0; grid-template-rows: repeat(10, minmax(0, 1fr)); gap: 7px 18px; }
  body:has(#game-screen:not([hidden])) .subject-list li { min-height: 0; padding: 6px 12px; }
}

#turn-game { position: fixed; inset: 0; z-index: 21; overflow: hidden; color: var(--ink); background: var(--paper) url('assets/sfondo.jpg') repeat 0 0; background-size: auto; }
#turn-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#turn-choice, #turn-winner, #turn-results { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(780px, calc(100% - 36px)); max-height: calc(100% - 36px); overflow: auto; padding: 30px; border: 3px solid var(--ink); border-radius: 24px; background: linear-gradient(145deg, #ffffff, #eaf8ff); box-shadow: 6px 8px 0 #092b5820; }
#turn-choice .eyebrow { display: inline-block; margin: 0; padding: 10px 16px; border-radius: 24px; background: #d6f7ff; font-size: 17px; font-weight: 900; }
#turn-choice h1 { margin: 16px 0 8px; font-size: clamp(28px, 5vw, 48px); line-height: 1.15; }
#turn-note { margin: 0 0 24px; color: var(--muted); }
#turn-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.turn-option.proverbs { background: linear-gradient(#a315b1, #821495); color: white; }
.turn-option { min-height: 170px; padding: 16px 10px; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 4px 0 var(--ink), inset 0 2px #ffffff9c; color: var(--ink); font: inherit; cursor: pointer; }
.turn-option strong, .turn-option span, .turn-option small { display: block; }.turn-option strong { font-size: 18px; }.turn-option span { margin: 14px 0; font-size: 21px; font-weight: 900; overflow-wrap: anywhere; }.turn-option small { font-weight: 800; }
.turn-option.easy { background: linear-gradient(#c7fb79, #a1ec35); }.turn-option.medium { background: linear-gradient(#fff384, #ffdc24); }.turn-option.hard { background: linear-gradient(#eb4168, #c7133d); color: white; }
#turn-hud { position: absolute; top: 18px; left: 18px; right: 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; pointer-events: none; }
#turn-hud p { margin: 0; padding: 9px 13px; border: 2px solid var(--ink); border-radius: 24px; background: #ffffffed; font-size: 20px; font-weight: 800; }
#turn-hud #turn-hud-drawer { background: #d6f7ff; font-size: 22px; letter-spacing: .03em; } #turn-listening { flex: 1; min-width: 170px; }
#turn-hud button { pointer-events: auto; margin-left: auto; min-height: 42px; }
#turn-hud #turn-pause { margin-left: 0; width: auto; }
#turn-hud #turn-guessed { margin-left: 0; width: auto; --button-top: #c7fb79; --button-bottom: #9be42f; }
#turn-hud #turn-listening { pointer-events: auto; cursor: pointer; }
#turn-listening:focus-visible { outline: 3px solid var(--magenta); outline-offset: 3px; }
#turn-winner-actions { display: flex; justify-content: center; align-items: stretch; gap: 12px; margin-top: 12px; }
#turn-winner-actions button { flex: 1; max-width: 260px; margin: 0; padding: 12px; }
#turn-nobody { --button-top: #ce2248; --button-bottom: #ac1234; color: white; background: linear-gradient(180deg, #ffffff14, transparent 50%), linear-gradient(var(--button-top), var(--button-bottom)); }
#turn-hud #turn-retry { margin-left: 0; }
#turn-winner { text-align: center; }#turn-winner h2 { margin-top: 0; }#turn-winner-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 22px 0; }#turn-winner-buttons .primary { width: 100%; }
#turn-results h2 { margin-top: 0; }#turn-score-list { margin: 22px 0; padding: 0; list-style: none; border: 2px solid #9bbfdc; border-radius: 24px; overflow: hidden; }#turn-score-list li { padding: 14px 16px; border-bottom: 1px solid #c8dce9; font-weight: 800; }#turn-score-list li:last-child { border-bottom: 0; }#turn-results > div { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }#turn-back { grid-column: 1 / -1; }
@media (max-width: 650px) { #turn-choice, #turn-winner, #turn-results { width: calc(100% - 24px); padding: 22px 16px; border-radius: 24px; } #turn-options { grid-template-columns: 1fr; } .turn-option { min-height: 92px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border-radius: 24px; }.turn-option span { margin: 0; font-size: 18px; }.turn-option strong, .turn-option small { font-size: 12px; }#turn-hud { top: 10px; left: 10px; right: 10px; gap: 6px; }#turn-hud p { padding: 8px 10px; font-size: 18px; line-height: 1.4; }#turn-hud #turn-listening { flex-basis: 100%; order: 3; }#turn-hud button { min-height: 40px; padding: 8px 12px; }#turn-results > div { grid-template-columns: 1fr; }#turn-back { grid-column: auto; } }
@media (max-width: 380px) {
  .difficulty-options { display: grid; grid-template-columns: 1fr 1fr; }
  .voice-panel summary { font-size: 12px; }
  .voice-label { display: inline-block; margin-top: 4px; }
  .session-title { font-size: 28px; }
  .session-console { grid-template-columns: minmax(0, 1fr) 100px; }
  .current-prompt h2 { font-size: 23px; }
  .session-clock output { font-size: 50px; }
}
@keyframes texture-drift { from { background-position: 0 0; } to { background-position: -1200px 800px; } }
@media (prefers-reduced-motion: no-preference) {
  body { animation: texture-drift 45s linear infinite; }
  .player-handoff, #turn-game { animation: texture-drift 45s linear infinite; }
  .primary, .secondary, .text-button { transition: transform .15s ease, filter .15s ease, box-shadow .15s ease; }
}
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  .primary:hover:not(:disabled), .secondary:hover:not(:disabled), .text-button:hover:not(:disabled), .primary:active:not(:disabled), .secondary:active:not(:disabled), .text-button:active:not(:disabled) { transform: none; }
}

.drawing-cursor { position: fixed; z-index: 30; width: 28px; height: 28px; transform: translate(-50%, -50%); pointer-events: none; }
.drawing-cursor::before, .drawing-cursor::after { content: ''; position: absolute; background: #092b58; border-radius: 2px; box-shadow: 0 0 0 2px white; }
.drawing-cursor::before { width: 28px; height: 3px; left: 0; top: 12.5px; }
.drawing-cursor::after { width: 3px; height: 28px; left: 12.5px; top: 0; }
.setup-layout .mode-picker { margin: 0; min-width: 0; }
.mode-picker legend { width: 100%; text-align: center; font-size: 22px; font-weight: 850; margin-bottom: 18px; }
.mode-picker .mode-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-options label { min-width: 0; }
.mode-picker .mode-options input + span { display: flex; flex-direction: column; min-height: 144px; padding: 20px 8px; border: 3px solid var(--ink); border-radius: 24px; color: var(--ink); box-shadow: 0 5px 0 var(--ink), inset 0 3px 0 #ffffff8a; transition: transform .15s, box-shadow .15s; pointer-events: none; }
.mode-picker .mode-screen input + span { background: linear-gradient(#a0f1ff, #22cbee); }
.mode-picker .mode-turn input + span { background: linear-gradient(#fff5a6, #ffe02c); }
.mode-picker .mode-paper input + span { background: linear-gradient(#dcffaf, #a1ec35); }
.mode-options strong { display: flex; align-items: center; gap: 8px; font-size: 46px; line-height: 1; letter-spacing: -2px; }
.mode-options strong svg { display: block; width: 1.1em; height: 1.1em; }
.mode-picker .mode-options strong span { display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; font-size: 28px; box-shadow: none; }
.mode-options b { display: block; margin-top: 12px; font-size: 17px; line-height: 1.2; }
.mode-picker .mode-options input:checked + span { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 0 0 3px white; }
.mode-options label:hover input:not(:checked) + span { transform: translateY(-2px); }
.mode-picker .mode-description { font-size: 15px; line-height: 1.6; color: var(--ink); background: #ffffffe8; border-radius: 24px; padding: 16px 20px; margin: 22px 0 0; text-align: center; }
.setup-card > h2 { margin-top: 0; }
.setup-card .download-sheets { margin: 20px 0 20px; width: 100%; }
main > .voice-panel { max-width: 740px; margin: 24px auto 0; }
@media (max-width: 650px) {
  .setup-layout { gap: 22px; }
  .intro h1.intro-logo { width: 100%; margin: 0 auto; }
  .mode-picker legend { font-size: 20px; }
  .mode-picker .mode-options { gap: 8px; }
  .mode-picker .mode-options input + span { min-height: 112px; padding: 16px 4px; }
  .mode-options strong { font-size: 36px; }
  .mode-picker .mode-options strong span { font-size: 23px; }
  .mode-options b { font-size: 13px; margin-top: 9px; }
  .mode-picker .mode-description { font-size: 14px; padding: 14px 16px; }
}
/* A full-width logo and clear mode introductions form the opening screen. */
body:has(#setup-screen:not([hidden])) main { padding-top: 24px; padding-bottom: 72px; }
#setup-screen { gap: 18px; }
#setup-screen:not(.has-mode) { min-height: calc(100svh - 96px); align-content: center; }
#setup-screen .intro h1.intro-logo { width: 100%; margin: 0 auto; }
#setup-screen .intro-logo img { max-width: none; width: 100%; }
.mode-picker .mode-description { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 22px; padding: 0; background: none; text-align: left; }
.mode-summary { min-width: 0; padding: 15px 16px; border: 2px solid transparent; border-radius: 24px; background: #ffffffdf; font-size: 14px; line-height: 1.5; }
.mode-summary strong { display: none; }
.mode-summary-screen strong { color: #006a88; }
.mode-summary-turn strong { color: #805500; }
.mode-summary-paper strong { color: #376600; }
.mode-summary.selected { border-color: transparent; background: white; }
#setup-screen.has-mode .mode-description { grid-template-columns: 1fr; }
footer.language-footer { position: fixed; left: max(18px,env(safe-area-inset-left)); right: max(18px,env(safe-area-inset-right)); bottom: max(22px,env(safe-area-inset-bottom)); z-index: 10; display: flex; align-items: center; justify-content: space-between; flex-wrap: nowrap; width: auto; max-width: none; margin: 0; padding: 0; }
footer.language-footer .quoz-home { min-height: 0; display: block; line-height: 0; }
footer.language-footer .quoz-home img { display: block; width: 64px; height: auto; }
#language-buttons { display: flex; gap: 4px; }
#language-buttons button { min-width: 26px; min-height: 24px; padding: 3px 6px; font-size: 11px; line-height: 16px; font-weight: bold; color: #000; background: #fff; border: 1px solid #000; border-radius: 2px; opacity: .7; transition: background .2s,color .2s; }
#language-buttons button:hover,#language-buttons button[aria-pressed="true"] { color: white; background: black; opacity: 1; }
body:has(#game-screen:not([hidden])) footer.language-footer,body:has(#screen-game:not([hidden])) footer.language-footer,body:has(#turn-game:not([hidden])) footer.language-footer { display: none; }
@media (max-width: 650px) {
  body:has(#setup-screen:not([hidden])) main { padding: 16px 18px 64px; }
  #setup-screen:not(.has-mode) { min-height: calc(100svh - 80px); }
  #setup-screen { gap: 14px; }
  .mode-picker legend { margin-bottom: 14px; }
  .mode-picker .mode-description { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 12px; padding: 0; }
  .mode-summary { display: block; padding: 8px 6px; font-size: 13px; line-height: 1.4; }
  .mode-summary strong { margin: 0; font-size: 13px; line-height: 1.35; }
}
#screen-game { position: fixed; inset: 0; z-index: 20; background: #fff; color: var(--ink); overflow: hidden; }
#screen-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='8' fill='%23ffe02c' stroke='%23092b58' stroke-width='2'/%3E%3Cpath d='M16 2v10M16 20v10M2 16h10M20 16h10' stroke='%23092b58' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") 16 16, crosshair; }
.screen-hud { position: absolute; top: 18px; left: 18px; right: 18px; display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; pointer-events: none; }
.screen-hud .eyebrow { grid-column: 1; display: inline-flex; justify-self: start; background: #d6f7ffef; border: 2px solid var(--ink); border-radius: 24px; padding: 8px 12px; margin: 0; }
#screen-subject { grid-column: 1; margin: 0; font-size: clamp(28px, 5vw, 60px); text-shadow: 2px 2px #fff; overflow-wrap: anywhere; }
#screen-status { grid-column: 1; margin: 0; font-weight: 800; text-shadow: 1px 1px #fff; }
.screen-meter { grid-column: 2; grid-row: 1 / span 3; align-self: start; min-width: 110px; padding: 12px 16px; text-align: center; border: 3px solid var(--ink); border-radius: 24px; background: #ffffffed; box-shadow: 4px 4px 0 #092b5820; font-weight: 850; }
.screen-meter span { display: block; font-size: 12px; }
.screen-meter output { display: block; font-size: 38px; line-height: 1; letter-spacing: -2px; }
#screen-item-clock { position: absolute; top: calc(50% + 30px); left: 50%; transform: translate(-50%, -50%); width: min(calc(100vw - 32px), calc(100dvh - 220px)); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#e8e8e8 var(--clock-fill, 0deg), transparent 0); pointer-events: none; }
#screen-item-clock::before { content: ''; position: absolute; inset: 18px; border-radius: 50%; background: white; }
#screen-canvas { position: relative; z-index: 1; }
#screen-drawing-flash { position: absolute; inset: 0; z-index: 4; background: #168cff; opacity: 0; pointer-events: none; }
:is(#screen-turn-countdown, #paper-turn-countdown) { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 18px; background: var(--paper) url('assets/sfondo.jpg') repeat 0 0; background-size: auto; }
@media (prefers-reduced-motion: no-preference) { :is(#screen-turn-countdown, #paper-turn-countdown) { animation: texture-drift 45s linear infinite; } }
:is(#screen-turn-countdown, #paper-turn-countdown) section { width: min(520px, 100%); padding: 30px 24px; border: 3px solid var(--ink); border-radius: 24px; background: linear-gradient(145deg, white, #eaf8ff); box-shadow: 6px 8px 0 #092b5820; text-align: center; }
:is(#screen-turn-countdown, #paper-turn-countdown) h2 { margin: 0 0 26px; font-size: clamp(26px, 5vw, 38px); line-height: 1.25; }
:is(#screen-turn-countdown-number, #paper-countdown-number) { display: grid; place-items: center; width: clamp(130px, 35vw, 190px); aspect-ratio: 1; margin: auto; padding: 0 0 .1em; border: 4px solid var(--ink); border-radius: 50%; background: linear-gradient(180deg, #ffffff42 0%, #ffffff0a 46%, #00000005 100%), linear-gradient(#fff384, #ffdc24); box-shadow: 0 6px 0 var(--ink), inset 0 3px 0 #ffffffb3, 0 10px 14px #092b5826; font-size: clamp(70px, 18vw, 110px); font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 0; line-height: 1; text-align: center; }
.screen-hud, #screen-controls { z-index: 2; }
#screen-quiz, #screen-results { z-index: 3; }
#screen-controls { position: absolute; display: flex; gap: 14px; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(480px, calc(100% - 36px)); }
#screen-controls button { flex: 1; }
#screen-quiz, #screen-results { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(720px, calc(100% - 36px)); max-height: calc(100% - 36px); overflow: auto; border: 3px solid var(--ink); border-radius: 24px; padding: 28px; background: linear-gradient(145deg, #ffffff, #eaf8ff); box-shadow: 6px 8px 0 #092b5820; }
#screen-quiz-player { display: inline-block; margin: 0; padding: 10px 16px; border-radius: 24px; background: #d6f7ff; font-size: 17px; font-weight: 900; }
#screen-quiz h2 { font-size: clamp(28px, 5vw, 46px); }
#screen-quiz-status { min-height: 26px; font-weight: 850; }
#screen-own-drawing { margin: 20px 0; padding: 0; border: 0; background: transparent; }
#screen-own-drawing p { margin: 0 0 10px; font-size: 12px; font-weight: 850; }
#screen-own-image { display: block; width: 100%; max-height: 250px; object-fit: contain; border: 0; border-radius: 24px; background: white; }
#screen-help { margin: 20px 0; padding: 16px; border: 2px solid #9bbfdc; border-radius: 24px; background: #f7fcff; }
#screen-help label, #screen-answer-form label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 750; }
#screen-help-note { margin: 0 0 16px; font-size: 15px; font-weight: 750; line-height: 1.45; }
#screen-helper { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#screen-helper button { min-width: 0; min-height: 48px; padding: 10px; overflow-wrap: anywhere; }
#screen-helper button[aria-pressed="true"] { opacity: 1; background: linear-gradient(#dcffaf, #a1ec35); }
#screen-help-image { display: block; width: 100%; max-height: 250px; object-fit: contain; margin-top: 14px; border: 2px solid #9bbfdc; border-radius: 24px; background: white; }
#screen-answer-form > div { display: flex; gap: 12px; }
#screen-answer { min-width: 0; flex: 1; min-height: 50px; border: 2px solid #9bbfdc; border-radius: 24px; padding: 10px 12px; font-size: 16px; }
#screen-answer-form button { width: auto; min-width: 130px; }
#screen-results h2 { margin-top: 0; }
#screen-score-list { margin: 22px 0; padding: 0; list-style: none; border: 2px solid #9bbfdc; border-radius: 24px; overflow: hidden; }
#screen-score-list li { padding: 14px 16px; border-bottom: 1px solid #c8dce9; font-weight: 800; }
#screen-score-list li:last-child { border-bottom: 0; }
#screen-results > div { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#screen-back { grid-column: 1 / -1; }
#screen-help-dialog { width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 24px); border: 3px solid var(--ink); border-radius: 24px; padding: 20px; color: var(--ink); background: #f4fbff; }
#screen-help-dialog::backdrop { background: #092b5890; }
#screen-game:has(#screen-quiz:not([hidden])) .screen-hud { display: none; }
#screen-help-dialog h2 { margin: 0 0 16px; font-size: 24px; }
#screen-help-dialog #screen-help { margin-bottom: 0; }
#screen-help-button { min-width: 70px; }
#screen-give-up { margin-top: 12px; margin-left: auto; background: #fff; box-shadow: none; }
@media (max-width: 650px) {
  .screen-hud { top: 10px; left: 10px; right: 10px; gap: 2px 10px; }
  .screen-hud .eyebrow { padding: 6px 9px; font-size: 9px; }
  #screen-subject { font-size: 28px; padding-right: 86px; }
  .screen-meter { min-width: 78px; padding: 8px; border-radius: 24px; }
  .screen-meter span { font-size: 9px; }.screen-meter output { font-size: 28px; }
  #screen-controls { bottom: 14px; gap: 8px; } #screen-controls button { min-height: 46px; padding: 9px; }
  #screen-quiz, #screen-results { width: calc(100% - 24px); padding: 20px 16px; border-radius: 24px; }
  #screen-quiz { display: flex; flex-direction: column; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; padding: 14px; }
  #screen-quiz-player { align-self: flex-start; padding: 6px 12px; font-size: 16px; }
  #screen-quiz h2 { margin: 10px 0 4px; font-size: clamp(20px, 5.8vw, 28px); line-height: 1.15; }
  #screen-quiz-position { margin: 4px 0; font-size: 11px; }
  #screen-quiz-status { margin: 4px 0; min-height: 24px; font-size: 14px; }
  #screen-own-drawing { flex: 1; min-height: 50px; display: flex; flex-direction: column; margin: 8px 0; padding: 0; }
  #screen-own-drawing p { margin-bottom: 6px; }
  #screen-own-image { flex: 1; min-height: 0; height: 0; max-height: none; object-fit: contain; }
  #screen-answer-form { flex-shrink: 0; }
  #screen-answer-form > div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  #screen-answer { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  #screen-answer-form button { min-width: 0; min-height: 44px; padding: 8px 14px; width: auto; }
  #screen-answer-form label { margin-bottom: 5px; }
  #screen-give-up { margin-top: 8px; font-size: 12px; }
  #screen-results > div { grid-template-columns: 1fr; } #screen-back { grid-column: auto; }
}

#screen-quiz { inset: 0; transform: none; width: 100%; height: 100%; max-height: 100%; border: 0; border-radius: 0; box-shadow: none; display: flex; flex-direction: column; overflow: hidden; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
#screen-quiz-player { align-self: flex-start; }
#screen-quiz h2 { margin: 12px 0 4px; }
#screen-quiz-position, #screen-quiz-status { margin: 4px 0; }
#screen-own-drawing { flex: 1; min-height: 40px; display: flex; flex-direction: column; margin: 10px 0; padding: 0; }
#screen-own-image { flex: 1; min-height: 0; height: 0; max-height: none; }
#screen-answer-form { flex-shrink: 0; }
#screen-answer-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
#screen-answer { grid-column: 1 / -1; width: 100%; }
#screen-answer-form button { min-width: 0; width: auto; min-height: 44px; padding: 10px 14px; }
#screen-answer-form #screen-give-up { margin: 0; font-size: 14px; }
@media (max-width: 380px) { #screen-answer-form > div { gap: 6px; } #screen-answer-form button { font-size: 12px; padding: 8px; } #screen-answer-form #screen-give-up { font-size: 12px; } }

#game-pause-menu { width: min(420px, calc(100% - 32px)); border: 3px solid var(--ink); border-radius: 24px; padding: 28px; color: var(--ink); background: linear-gradient(145deg, #ffffff, #eaf8ff); box-shadow: 6px 8px 0 #092b5820; }
#game-pause-menu::backdrop { background: #092b58a8; }
#game-pause-menu .eyebrow { margin: 0; }
#game-pause-menu h2 { margin: 12px 0 8px; }
#game-pause-menu p:not(.eyebrow) { margin: 0 0 22px; color: var(--muted); }
#game-pause-menu > div { display: grid; gap: 14px; }
#paper-turn-countdown { position: fixed; z-index: 25; }

/* Race board overlays. The illustrated board stays visible behind its compact controls. */
.race-board { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: center / min(100vw, 177.78dvh) min(56.25vw, 100dvh) no-repeat url('assets/mappa1h.jpg'); }
.race-board { background-color: #0f92e6; }
.race-pawns::before { content: ''; position: absolute; inset: 0; pointer-events: none; }
@media (max-aspect-ratio: 16/9) { .race-pawns::before { background: linear-gradient(to bottom, #0f92e6 0, #0f92e600 14%, #0f92e600 86%, #0f92e6 100%); } }
@media (min-aspect-ratio: 16/9) { .race-pawns::before { background: linear-gradient(to right, #0f92e6 0, #0f92e600 8%, #0f92e600 92%, #0f92e6 100%); } }
@media (max-width: 650px) and (max-aspect-ratio: 5628/10000) { .race-pawns::before { background: linear-gradient(to bottom, #0f92e6 0, #0f92e600 10%, #0f92e600 90%, #0f92e6 100%); } }
@media (max-width: 650px) and (min-aspect-ratio: 5628/10000) { .race-pawns::before { background: linear-gradient(to right, #0f92e6 0, #0f92e600 12%, #0f92e600 88%, #0f92e6 100%); } }
.race-pawns { position: absolute; width: min(100vw, 177.78dvh); height: min(56.25vw, 100dvh); top: 50%; left: 50%; transform: translate(-50%,-50%); }
.race-pawn { --pw: 28px; position: absolute; left: calc(var(--x) + var(--dx, 0) * (var(--pw) + 4px)); top: calc(var(--y) + var(--dy, 0) * 38px); transform: translate(-50%, -50%); transition: left .38s ease-in-out, top .38s ease-in-out; display: block; width: var(--pw); height: var(--pw); border: 2px solid #092b58; border-radius: 50% 50% 48% 48%; background: radial-gradient(circle at 34% 28%, #ffffffd9 0 11%, #fff0 24%), radial-gradient(circle at 65% 75%, #0003, #0000 55%), var(--player-color); box-shadow: inset 0 3px 0 #ffffffa8, 0 0 0 2px #fff, 0 2px 0 2px #092b58, 0 6px 8px 1px #000a; }
.race-pawn::before { content: ''; position: absolute; z-index: -1; left: 50%; bottom: -13px; width: 130%; height: 34%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(#0009, #0000 70%); }
.race-board.race-blink .race-pawn { animation: race-blink .5s ease-in-out 5; }
@keyframes race-blink { 0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 50% { opacity: .25; transform: translate(-50%, -62%) scale(1.35); } }
.race-pawn::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg); background: var(--player-color); border-right: 2px solid #092b58; border-bottom: 2px solid #092b58; }
.race-pawn b { position: absolute; left: 50%; bottom: calc(100% + 5px); width: 72px; transform: translateX(-50%); color: #000; font-size: 9px; font-weight: 900; line-height: 1.05; text-align: center; white-space: nowrap; -webkit-text-stroke: 2px #fff; paint-order: stroke fill; text-shadow: 0 1px #fff, 1px 0 #fff, -1px 0 #fff, 0 -1px #fff; }
.player-chip { display: inline-block; flex: 0 0 auto; width: .78em; height: .78em; margin-right: .42em; border: 1.5px solid #092b58; border-radius: 50%; background: var(--player-color); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #092b58; vertical-align: -.04em; }
.player-name { display: inline; }
.roster li, #quiz-player, #screen-quiz-player, #screen-player, #turn-hud-drawer, #screen-score-list li, #turn-score-list li, #screen-helper button, #turn-winner-buttons button { align-items: center; }
#paper-turn-countdown, #screen-turn-countdown, .player-handoff { background: #eaf8ff; }
#paper-turn-countdown > section, #screen-turn-countdown > section, .player-handoff > section { position: relative; z-index: 1; background: #f5fcffef; }
#screen-turn-countdown > .race-board, .player-handoff > .race-board, #paper-turn-countdown > .race-board { position: absolute; }
@media (min-width: 651px) {
  #paper-turn-countdown, #screen-turn-countdown, .player-handoff { place-items: end center; padding-bottom: 0; }
  #paper-turn-countdown > section, #screen-turn-countdown > section, .player-handoff > section { align-self: end; margin-bottom: max(22px, env(safe-area-inset-bottom)); width: min(300px, 100%); padding: 14px 16px; border-width: 2px; border-radius: 18px; }
  #paper-turn-countdown h2, #screen-turn-countdown h2, .player-handoff h2 { margin: 0 0 12px; font-size: clamp(16px, 1.6vw, 20px); }
  #screen-ready-note { margin: 0 0 12px; font-size: 13px; }
  #paper-turn-countdown button, #screen-turn-countdown button, .player-handoff button { font-size: 15px; padding: 8px 18px; }
}
#paper-results-race-board { position: fixed; z-index: 18; }
#game-screen:has(#results-panel:not([hidden])) { position: relative; z-index: 19; }
#game-screen:has(#results-panel:not([hidden])) #results-panel { position: relative; z-index: 1; background: #fffffff2; }
#screen-results-race-board, #turn-results-race-board { position: absolute; z-index: 0; }
#screen-results, #turn-results { z-index: 1; background: #f5fcfff2; }
#screen-score-list li, #turn-score-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#screen-score-list li > span:last-child, #turn-score-list li > span:last-child { white-space: nowrap; }
@media (max-width: 650px) {
  .race-board { background-image: url('assets/mappa1v.jpg'); background-size: min(100vw, 56.28dvh) min(177.68vw, 100dvh); background-position: center center; }
  .race-pawns { width: min(100vw, 56.28dvh); height: min(177.68vw, 100dvh); }
  .race-pawn { --pw: 20px; left: calc(var(--x-mobile) + var(--dx, 0) * (var(--pw) + 3px)); top: calc(var(--y-mobile) + var(--dy, 0) * 28px); border-width: 1.5px; }
  .race-pawn::after { bottom: -5px; width: 6px; height: 6px; border-width: 1.5px; }
  .race-pawn b { bottom: calc(100% + 4px); width: 54px; font-size: 7px; -webkit-text-stroke: 1.5px #fff; }
        #paper-turn-countdown > section, #screen-turn-countdown > section, .player-handoff > section { align-self: end; margin-bottom: max(22px, env(safe-area-inset-bottom)); padding: 20px 16px; background: #f5fcfff0; }
  #paper-results-race-board { z-index: 18; }
  #game-screen:has(#results-panel:not([hidden])) #results-panel { position: fixed; z-index: 19; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); margin: 0; max-height: 55dvh; overflow: auto; background: #f5fcfff0; }
  #screen-results, #turn-results { position: absolute; inset: auto 12px max(12px, env(safe-area-inset-bottom)); transform: none; width: auto; max-height: 56dvh; overflow: auto; background: #f5fcfff0; }
}

#turn-hud { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: stretch; }
#turn-hud #turn-hud-drawer { grid-column: 1; grid-row: 1; max-width: none; font-size: 20px; letter-spacing: 0; padding: 10px; overflow-wrap: anywhere; }
#turn-hud #turn-listening { grid-column: 1 / -1; grid-row: 2; position: relative; display: grid; align-items: center; min-width: 0; min-height: 48px; flex-basis: auto; order: 0; overflow: hidden; }
#turn-mic-message { margin: 0; padding: 0; font-size: 16px; line-height: 1.3; text-align: center; }
#turn-hud #turn-hud-difficulty { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 10px; border: 2px solid var(--ink); border-radius: 24px; background: #fff28a; font-size: 20px; line-height: 1.3; }
.turn-level-label, .turn-points-label { text-align: center; white-space: nowrap; }
.turn-points-label::before { content: '·'; margin-right: 8px; }
@keyframes turn-info-swap { 0% { opacity: 1; } 50% { opacity: 0; } }
#turn-controls { grid-column: 3; grid-row: 1; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; pointer-events: auto; }
#turn-controls button, #turn-controls #turn-pause, #turn-controls #turn-guessed { width: auto; min-height: 46px; margin: 0; padding: 10px 16px; }
@media (max-width: 650px) {
  #turn-hud { grid-template-columns: minmax(0, 1fr) auto; }
  #turn-controls { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); left: 10px; right: 10px; gap: 8px; }
  #turn-controls button, #turn-controls #turn-pause, #turn-controls #turn-guessed { flex: 1; min-width: 0; min-height: 52px; padding: 12px 8px; }
  #turn-controls #turn-retry { flex-basis: 100%; }
}
@media (max-width: 380px) { #turn-hud #turn-hud-drawer, #turn-hud #turn-hud-difficulty { font-size: 18px; padding: 8px; } #turn-hud #turn-listening { padding: 8px; } #turn-controls { gap: 7px; } #turn-controls button { font-size: 13px; padding: 10px 12px; } }

@media (max-width: 650px) {
  body:has(#game-screen:not([hidden])) { position: fixed; inset: 0; width: 100%; height: 100dvh; overflow: hidden; }
  body:has(#game-screen:not([hidden])) main { height: 100dvh; padding: 8px 12px max(10px, env(safe-area-inset-bottom)); }
  body:has(#game-screen:not([hidden])) footer,
  body:has(#game-screen:not([hidden])) .game-top,
  body:has(#game-screen:not([hidden])) .reset-note,
  body:has(#game-screen:not([hidden])) .game-footnote { display: none; }
  body:has(#game-screen:not([hidden])) .game-layout { height: 100%; display: flex; flex-direction: column; }
  body:has(#game-screen:not([hidden])) .roster { margin: 0 0 clamp(8px, 1.2dvh, 16px); gap: 6px; flex-shrink: 0; }
  body:has(#game-screen:not([hidden])) .roster li { padding: 5px 10px; font-size: 11px; }
  body:has(#game-screen:not([hidden])) .session-console { flex-shrink: 0; grid-template-columns: minmax(0, 1fr) 88px; border-radius: 24px; }
  body:has(#game-screen:not([hidden])) .current-prompt { min-height: 126px; padding: 12px 8px; }
  body:has(#game-screen:not([hidden])) .current-prompt h2 { margin: 9px 0; font-size: 25px; }
  body:has(#game-screen:not([hidden])) .session-clock { padding: 10px 6px; }
  body:has(#game-screen:not([hidden])) .session-clock output { font-size: 48px; }
  body:has(#game-screen:not([hidden])) .session-clock > p { margin: 6px 0; }
  body:has(#game-screen:not([hidden])) #session-progress { flex-shrink: 0; height: 28px; margin: clamp(10px, 1.5dvh, 18px) 0 0; }
  body:has(#game-screen:not([hidden])) .list-heading { flex-shrink: 0; margin: clamp(8px, 1.2dvh, 16px) 0 clamp(6px, 1dvh, 12px); }
  body:has(#game-screen:not([hidden])) .list-heading h2 { font-size: 16px; }
  body:has(#game-screen:not([hidden])) .list-heading p { display: none; }
  body:has(#game-screen:not([hidden])) .subject-list { flex: 1; min-height: 0; grid-template-rows: repeat(10, minmax(0, 1fr)); gap: clamp(4px, .9dvh, 12px) 8px; }
  body:has(#game-screen:not([hidden])) .subject-list li { min-height: 0; padding: 2px 6px; gap: 5px; border-radius: 24px; font-size: 11px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body:has(#game-screen:not([hidden])) .subject-number { flex: 0 0 18px; min-width: 18px; font-size: 9px; }
  body:has(#game-screen:not([hidden])) .subject-list li > span:not(.subject-number) { font-size: 13px; }
  body:has(#game-screen:not([hidden])) .subject-list li.read .subject-number { min-width: 18px; }
}

/* Paper mode: scoreboard chips above the ready box */
#paper-turn-countdown { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; }
#paper-turn-countdown > section { align-self: center; flex: 0 1 auto; }
#paper-turn-countdown > .race-board { position: absolute; }
#paper-roster { position: relative; z-index: 1; justify-content: center; margin: 0; max-width: min(720px, 100%); }
#paper-roster li { font-size: 14px; font-weight: 850; box-shadow: 0 2px 0 #092b5833; }
@media (max-width: 650px) { #paper-roster { gap: 6px; } #paper-roster li { padding: 5px 10px; font-size: 12px; } }
.roster-score { font-weight: 850; }
/* Paper mode questions: only the question popup over the animated background */
#game-screen:has(#quiz-panel:not([hidden])) > :not(#quiz-panel) { display: none !important; }
#game-screen:has(#quiz-panel:not([hidden])) { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
#game-screen:has(#quiz-panel:not([hidden])) #quiz-panel { width: 100%; box-sizing: border-box; margin-top: 0; margin-bottom: 0; }
/* Paper results: small box with the round buttons, player chips with scores above it */
#game-screen:has(#results-panel:not([hidden])) > :not(#results-panel) { display: none !important; }
#game-screen:has(#results-panel:not([hidden])) #results-panel { position: fixed; z-index: 19; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); top: auto; margin: 0 auto; padding: 0 12px; max-width: none; max-height: none; overflow: visible; background: none; border: 0; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#results-panel > h2, #results-panel > .score-scroll { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#results-roster { justify-content: center; margin: 0; max-width: min(720px, 100%); }
#results-roster li { font-size: 14px; font-weight: 850; box-shadow: 0 2px 0 #092b5833; }
#results-box { width: min(400px, 100%); box-sizing: border-box; padding: 14px 16px; border: 2px solid var(--ink); border-radius: 18px; background: #f5fcffef; box-shadow: 5px 6px 0 #092b581a; text-align: center; }
#results-box .round-actions { gap: 10px; }
#results-box .round-actions button, #results-new-game { min-height: 48px; font-size: 16px; padding: 8px 12px; border-radius: 18px; }
#results-new-game { width: 100%; }
#results-note { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
#results-panel:not([data-ended="true"]) #results-note { display: none; }
@media (max-width: 650px) { #results-roster li { padding: 5px 10px; font-size: 12px; } #results-box .round-actions { grid-template-columns: 1fr 1fr; } }
@media (max-width: 650px) {
  #paper-turn-countdown > section, #screen-turn-countdown > section, .player-handoff > section { width: min(290px, calc(100% - 48px)); padding: 12px 14px; border-width: 2px; border-radius: 16px; margin-bottom: max(16px, env(safe-area-inset-bottom)); }
  #paper-turn-countdown h2, #screen-turn-countdown h2, .player-handoff h2 { margin: 0 0 10px; font-size: 16px; line-height: 1.25; }
  #screen-ready-note { margin: 0 0 10px; font-size: 12px; }
  #paper-turn-countdown button, #screen-turn-countdown button, .player-handoff button { font-size: 14px; padding: 8px 14px; min-height: 0; }
  #results-box { width: min(290px, calc(100% - 24px)); padding: 10px 12px; border-radius: 16px; }
  #results-box .round-actions button, #results-new-game { min-height: 40px; font-size: 14px; padding: 6px 8px; }
  #results-note { font-size: 12px; }
}
/* Paper countdown: just the round counter, centered over the map */
#paper-turn-countdown[data-phase="ready"] { justify-content: center; }
#paper-turn-countdown[data-phase="ready"] > #paper-roster, #paper-turn-countdown[data-phase="ready"] h2 { display: none; }
#paper-turn-countdown[data-phase="ready"] > section { width: auto; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
/* Screen/turn modes: player chips with scores above the handoff boxes */
#screen-turn-countdown, .player-handoff { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; }
#screen-turn-countdown > section, .player-handoff > section { align-self: center; flex: 0 1 auto; }
.overlay-roster { position: relative; z-index: 1; justify-content: center; margin: 0; max-width: min(720px, 100%); }
.overlay-roster li { font-size: 14px; font-weight: 850; box-shadow: 0 2px 0 #092b5833; }
@media (max-width: 650px) { .overlay-roster { gap: 6px; } .overlay-roster li { padding: 5px 10px; font-size: 12px; } }
.mode-picker .mode-options strong .mode-badge { font-style: normal; font-size: .62em; letter-spacing: 0; margin-right: -2px; }
/* Mode buttons: image only (label text kept for screen readers) */
.mode-picker .mode-options strong { justify-content: center; }
.mode-picker .mode-options strong { width: 100%; }
.mode-picker .mode-options strong img { display: block; width: 90%; max-width: none; height: auto; margin: 0 auto; opacity: 0.6; mix-blend-mode: color-burn; }
.mode-picker .mode-options input + span { justify-content: center; align-items: center; }
.mode-picker .mode-options b { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Answer handoff (screen mode): centered, animated texture background, larger text */
#screen-answer-handoff { background: var(--paper) url('assets/sfondo.jpg') repeat 0 0; background-size: auto; justify-content: center; }
#screen-answer-handoff > section { width: min(560px, calc(100% - 32px)); margin: 0; padding: 32px 28px; border: 3px solid var(--ink); border-radius: 24px; background: #f5fcffef; }
#screen-answer-handoff h2 { margin: 0 0 24px; font-size: clamp(30px, 6vw, 46px); line-height: 1.2; }
#screen-answer-handoff button { font-size: clamp(20px, 4vw, 26px); padding: 14px 24px; min-height: 64px; }
#screen-answer-handoff .overlay-roster li { font-size: clamp(14px, 2.4vw, 18px); }
/* Screen/turn results: chips with scores above a small box with the round buttons */
#screen-results, #turn-results { position: absolute; inset: auto 0 max(22px, env(safe-area-inset-bottom)) 0; transform: none; width: auto; max-height: none; overflow: visible; padding: 0 12px; border: 0; border-radius: 0; background: none; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#screen-results > p, #turn-results > p, #screen-score-list, #turn-score-list { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.res-roster li { font-size: 14px; font-weight: 850; box-shadow: 0 2px 0 #092b5833; }
#screen-results > .res-box, #turn-results > .res-box { display: block; width: min(420px, 100%); box-sizing: border-box; padding: 14px 16px; border: 2px solid var(--ink); border-radius: 18px; background: #f5fcffef; box-shadow: 5px 6px 0 #092b581a; text-align: center; }
.res-box h2 { margin: 0 0 10px; font-size: 16px; }
#screen-results:not([data-ended="true"]) .res-box h2, #turn-results:not([data-ended="true"]) .res-box h2 { display: none; }
.res-box > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-box button { min-height: 44px; font-size: 15px; padding: 6px 10px; }
.res-box #screen-back, .res-box #turn-back { grid-column: 1 / -1; min-height: 34px; font-size: 13px; }
@media (max-width: 650px) { .res-roster li { padding: 5px 10px; font-size: 12px; } #screen-results > .res-box, #turn-results > .res-box { width: min(300px, calc(100% - 24px)); padding: 10px 12px; } .res-box button { min-height: 40px; font-size: 14px; } }
/* Game start: the numberless map (mappa0) covers the board, then dissolves from the center outwards revealing mappa1 */
@property --reveal { syntax: '<percentage>'; inherits: false; initial-value: -30%; }
.race-intro { display: none; position: absolute; width: min(100vw, 177.78dvh); height: min(56.25vw, 100dvh); top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 0; pointer-events: none; background: center / 100% 100% no-repeat url('assets/mappa0h.jpg'); -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent var(--reveal), #000 calc(var(--reveal) + 30%)); mask-image: radial-gradient(circle at 50% 50%, transparent var(--reveal), #000 calc(var(--reveal) + 30%)); }
.race-board.intro .race-intro { display: block; animation: race-reveal 2s ease-in-out forwards; }
.race-board.intro-fade .race-intro { display: block; -webkit-mask-image: none; mask-image: none; animation: race-intro-fade 2s ease-in-out forwards; }
@keyframes race-reveal { from { --reveal: -30%; } to { --reveal: 110%; } }
@keyframes race-intro-fade { from { opacity: 1; } to { opacity: 0; } }
@media (max-width: 650px) { .race-intro { width: min(100vw, 56.28dvh); height: min(177.68vw, 100dvh); background-image: url('assets/mappa0v.jpg'); } }
.turn-timer-label { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 900; }
.turn-timer-label.low { color: #c0392b; }
/* Turn mode: large clock filling up behind the canvas, like the 20-drawings screen mode */
#turn-clock-wrap { position: absolute; inset: 0; background: #fff; pointer-events: none; }
#turn-item-clock { position: absolute; top: calc(50% + 30px); left: 50%; transform: translate(-50%, -50%); width: min(calc(100vw - 32px), calc(100dvh - 220px)); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#e8e8e8 var(--clock-fill, 0deg), transparent 0); }
#turn-item-clock::before { content: ''; position: absolute; inset: 18px; border-radius: 50%; background: white; }
#turn-canvas { position: relative; z-index: 1; }
#turn-hud { z-index: 2; }
#turn-choice, #turn-winner, #turn-results { z-index: 3; }
@media (max-width: 650px) {
  #turn-hud #turn-hud-drawer { font-size: 15px; padding: 7px 10px; }
  #turn-hud #turn-hud-difficulty { font-size: 15px; padding: 7px 10px; gap: 6px; }
  #turn-winner h2 { font-size: 22px; line-height: 1.2; }
  #turn-winner p { font-size: 13px; }
  #turn-winner-buttons { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
  #turn-winner-buttons button { font-size: 15px; padding: 10px 8px; min-height: 0; white-space: nowrap; }
}
.turn-option.mixed { background: linear-gradient(#ffc27a, #ff9a3c); }
@media (min-width: 651px) { .turn-option.proverbs { grid-column: 1 / -1; } }
@media (min-width: 651px) { .turn-option { min-height: 128px; padding: 12px 10px; } .turn-option span { margin: 8px 0; } }
#turn-winner-buttons button { font-size: 16px; justify-content: center; }
#turn-winner-buttons button .player-name { font-size: inherit; margin-left: 0; line-height: 1.2; }
@media (max-width: 650px) { #turn-winner-buttons button { font-size: 15px; } }
.turn-option.hard { background: linear-gradient(#ffc27a, #ff9a3c); color: var(--ink); }
.turn-option.mixed { background: linear-gradient(#eb4168, #c7133d); color: white; }
/* Mini introduzione: sfondo mappa0 + logo che arriva al centro, poi appaiono le modalita' */
#intro-bg { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: -1; pointer-events: none; background-color: #0f92e6; background-image: url('assets/mappa0h.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center; opacity: 1; transition: opacity .8s ease; }
html.intro-bg-on #intro-bg { display: block; }
#intro-bg.hide { opacity: 0; }
@media (max-width: 650px) { #intro-bg { background-image: url('assets/mappa0v.jpg'); } }
html.intro-pending { overflow: hidden; }
html.intro-pending #setup-screen .mode-picker { opacity: 0; pointer-events: none; }
#setup-screen .mode-picker { transition: opacity .8s ease; }
.intro-logo img { will-change: transform, opacity; }
.mode-picker legend { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html.intro-bg-on #intro-bg { animation: intro-bg-in 1.4s ease-out; }
#intro-bg.hide { animation: none; }
@keyframes intro-bg-in { from { opacity: 0; } to { opacity: 1; } }
html.intro-pending .intro-logo img { opacity: 0; }
