:root {
  --red: #c51f2c;
  --red-dark: #8c1220;
  --red-soft: #fff0f2;
  --yellow: #f6c744;
  --ink: #17212b;
  --muted: #6c7580;
  --line: #dce4ec;
  --paper: #ffffff;
  --cream: #edf3f9;
  --green: #16845b;
  --green-soft: #e9f7f1;
  --blue: #175a9b;
  --blue-dark: #0b315c;
  --blue-soft: #e8f2fc;
  --orange: #d16c19;
  --shadow: 0 18px 50px rgba(16, 55, 94, .11);
  --radius: 22px;
}

/* Incroci animati -------------------------------------------------------- */
.intersection-home-card {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 116px minmax(0,1fr) auto;
  align-items: center; gap: 24px; margin-top: 18px; padding: 24px 27px; border: 1px solid #dacfc4;
  border-radius: 22px; background: linear-gradient(115deg,#fff 0,#fff9ee 62%,#f7e8c0 100%); box-shadow: var(--shadow);
}
.intersection-home-card::after { content:""; position:absolute; right:-70px; bottom:-110px; width:250px; height:250px; border:32px solid rgba(181,29,38,.055); border-radius:50%; }
.intersection-home-card > * { position: relative; z-index: 1; }
.intersection-home-card h2 { margin: 2px 0 7px; font: 750 28px/1.05 Georgia,serif; }
.intersection-home-card p:not(.eyebrow) { max-width: 770px; margin:0 0 9px; color:var(--muted); line-height:1.55; }
.intersection-home-card > div > small { color:var(--green); font-weight:850; }
.intersection-home-card.locked > div > small { color:var(--orange); }
.intersection-home-card > button { min-height:49px; white-space:nowrap; }
.intersection-home-visual { width:104px; height:104px; display:grid; place-items:center; border-radius:24px; background:#242a31; box-shadow:inset 0 0 0 8px #555b61,0 12px 25px rgba(0,0,0,.18); color:white; }
.intersection-home-visual::before,.intersection-home-visual::after { content:""; position:absolute; background:#ece9dc; }
.intersection-home-visual::before { width:100%; height:28px; }
.intersection-home-visual::after { width:28px; height:100%; }
.intersection-home-visual span { z-index:1; color:var(--yellow); font-size:32px; text-shadow:0 2px 4px #000; }
.intersection-home-visual b { position:absolute; z-index:2; right:-6px; bottom:-7px; width:38px; height:38px; display:grid; place-items:center; border:3px solid #fff; border-radius:50%; background:var(--red); font-size:14px; }

.intersection-header-card { display:grid; grid-template-columns:1fr auto; align-items:center; gap:24px; padding:24px 27px; border:1px solid var(--line); border-radius:22px; background:#fff; box-shadow:var(--shadow); }
.intersection-header-card h2 { margin:2px 0 8px; font:750 31px/1.08 Georgia,serif; }
.intersection-header-card p:not(.eyebrow) { max-width:850px; margin:0; color:var(--muted); line-height:1.55; }
.intersection-score { min-width:195px; display:grid; gap:5px; padding:15px 18px; border-radius:16px; background:var(--ink); color:#fff; text-align:right; }
.intersection-score b { color:var(--yellow); font-size:15px; }
.intersection-score span { font-weight:850; }
.intersection-score small { color:#cbd0d5; }
.intersection-progress { height:7px; margin:13px 6px 18px; overflow:hidden; border-radius:999px; background:#ded8d0; }
.intersection-progress i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--red),#e05a32,var(--yellow)); transition:width .35s ease; }
.intersection-game-grid { display:grid; grid-template-columns:minmax(420px,1.08fr) minmax(390px,.92fr); gap:18px; align-items:start; }
.intersection-board-card,.intersection-play-card { border:1px solid var(--line); border-radius:22px; background:#fff; box-shadow:var(--shadow); }
.intersection-board-card { padding:18px; }
.intersection-board-label { display:flex; justify-content:space-between; gap:16px; padding:1px 2px 12px; color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.intersection-board-label span { color:var(--red); }
.ministerial-board { position:relative; width:100%; max-height:650px; overflow:hidden; border:10px solid #f3eee8; border-radius:16px; background:#d2d0ca; box-shadow:inset 0 0 0 1px #bab6ae; }
.ministerial-board > img { position:absolute; inset:0; width:100%; height:100%; object-fit:fill; image-rendering:auto; }
.intersection-vehicle-layer { position:absolute; inset:0; overflow:hidden; }
.intersection-car { position:absolute; left:var(--sx); top:var(--sy); z-index:3; width:50px; height:28px; display:grid; place-items:center; border:3px solid #171b20; border-radius:8px; background:var(--car); color:#fff; transform:translate(-50%,-50%) rotate(var(--rotation)); box-shadow:0 3px 7px rgba(0,0,0,.42),inset 0 0 0 2px rgba(255,255,255,.23); font-weight:950; text-shadow:0 1px 2px #000; }
.intersection-car::before,.intersection-car::after { content:""; position:absolute; top:4px; width:9px; height:14px; border-radius:2px; background:rgba(226,240,248,.88); border:1px solid rgba(0,0,0,.45); }
.intersection-car::before { left:7px; } .intersection-car::after { right:7px; }
.intersection-car span { position:relative; z-index:2; display:grid; place-items:center; width:19px; height:19px; border-radius:50%; background:rgba(0,0,0,.72); font-size:12px; }
.intersection-car.car-light { color:#111820; text-shadow:none; border-color:#1a2027; }
.intersection-car.car-light span { color:#111820; background:rgba(255,255,255,.84); text-shadow:none; box-shadow:0 0 0 1px rgba(0,0,0,.28); }
.intersection-car i::before,.intersection-car i::after { content:""; position:absolute; left:6px; width:10px; height:4px; border-radius:3px; background:#111; }
.intersection-car i::before { top:-5px; box-shadow:27px 0 #111; } .intersection-car i::after { bottom:-5px; box-shadow:27px 0 #111; }
.ministerial-board.correct .intersection-car { animation:intersection-cross 1.12s cubic-bezier(.35,.05,.32,1) var(--delay) both; }
.ministerial-board.correct .intersection-car.pause-center { z-index:5; animation:intersection-pause-center 4.15s linear var(--delay) both; }
.ministerial-board.crash { animation:intersection-board-shake .45s ease .54s both; }
.ministerial-board.crash .intersection-car { animation:intersection-crash .72s cubic-bezier(.55,.02,.85,.32) both; }
.intersection-explosion { position:absolute; left:50%; top:50%; z-index:8; display:none; color:#ffce17; font-size:132px; line-height:1; text-shadow:0 0 0 #ef2d22,0 0 18px #e5241d,0 0 40px #ff9d00; transform:translate(-50%,-50%) scale(.1); }
.ministerial-board.crash .intersection-explosion { display:block; animation:intersection-explode .72s ease .48s both; }
@keyframes intersection-cross {
  0% { left:var(--p0x); top:var(--p0y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r0)) scale(1); }
  16% { left:var(--p1x); top:var(--p1y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r1)) scale(1.02); }
  33% { left:var(--p2x); top:var(--p2y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r2)) scale(1.04); }
  50% { left:var(--p3x); top:var(--p3y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r3)) scale(1.06); }
  67% { left:var(--p4x); top:var(--p4y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r4)) scale(1.04); }
  84% { left:var(--p5x); top:var(--p5y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r5)) scale(1.02); }
  100% { left:var(--p6x); top:var(--p6y); opacity:0; transform:translate(-50%,-50%) rotate(var(--r6)) scale(.92); }
}
@keyframes intersection-pause-center {
  0% { left:var(--p0x); top:var(--p0y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r0)) scale(1); }
  10% { left:var(--p1x); top:var(--p1y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r1)) scale(1.02); }
  20% { left:var(--p2x); top:var(--p2y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r2)) scale(1.04); }
  28%,82% { left:var(--p3x); top:var(--p3y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r3)) scale(1.06); }
  88% { left:var(--p4x); top:var(--p4y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r4)) scale(1.04); }
  94% { left:var(--p5x); top:var(--p5y); opacity:1; transform:translate(-50%,-50%) rotate(var(--r5)) scale(1.02); }
  100% { left:var(--p6x); top:var(--p6y); opacity:0; transform:translate(-50%,-50%) rotate(var(--r6)) scale(.92); }
}
@keyframes intersection-crash { 0% { left:var(--sx); top:var(--sy); } 78%,100% { left:50%; top:50%; transform:translate(-50%,-50%) rotate(calc(var(--rotation) + 18deg)); } }
@keyframes intersection-explode { 0% { opacity:0; transform:translate(-50%,-50%) scale(.1) rotate(-25deg); } 38% { opacity:1; transform:translate(-50%,-50%) scale(1.15) rotate(7deg); } 100% { opacity:.82; transform:translate(-50%,-50%) scale(.9) rotate(0); } }
@keyframes intersection-board-shake { 20%,60% { transform:translateX(-7px); } 40%,80% { transform:translateX(7px); } }

.intersection-play-card { padding:23px; }
.intersection-play-card > h3 { margin:0 0 16px; font-size:20px; line-height:1.35; }
.intersection-vehicle-buttons { display:grid; grid-template-columns:repeat(auto-fit,minmax(86px,1fr)); gap:9px; }
.intersection-vehicle-buttons button { min-height:70px; display:grid; grid-template-columns:34px 1fr; align-items:center; gap:8px; padding:9px 11px; border:2px solid #ded7cf; border-radius:13px; background:#fff; color:var(--ink); text-align:left; }
.intersection-vehicle-buttons button:hover:not(:disabled),.intersection-vehicle-buttons button:focus-visible { border-color:var(--red); background:var(--red-soft); outline:0; transform:translateY(-1px); }
.intersection-vehicle-buttons button:disabled { opacity:.36; cursor:default; }
.intersection-vehicle-buttons button span { width:34px; height:34px; display:grid; place-items:center; border-radius:50%; background:var(--ink); color:#fff; font-size:18px; font-weight:950; }
.intersection-vehicle-buttons button small { color:var(--muted); font-size:10px; font-weight:800; }
.intersection-order-box { margin-top:16px; padding:14px; border:1px solid #ded6ce; border-radius:14px; background:#f8f5f1; }
.intersection-order-box > small,.intersection-correct-order > small { display:block; margin-bottom:9px; color:var(--muted); font-size:10px; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
.intersection-order-box > div { min-height:39px; display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.intersection-order-box em { color:#93999f; font-size:13px; }
.intersection-order-box span { display:inline-flex; align-items:center; gap:7px; padding:6px 11px 6px 6px; border-radius:999px; background:#fff; box-shadow:0 2px 7px rgba(0,0,0,.08); color:var(--ink); font-weight:950; }
.intersection-order-box span b { width:24px; height:24px; display:grid; place-items:center; border-radius:50%; background:var(--red); color:#fff; font-size:11px; }
.intersection-result { margin-top:14px; padding:14px 15px; border-radius:14px; }
.intersection-result.good { background:var(--green-soft); color:#0b6543; border:1px solid #b8e4d1; }
.intersection-result.bad { background:#fff0ef; color:#a51c25; border:1px solid #f0c6c3; }
.intersection-result b { font-size:17px; } .intersection-result p { margin:4px 0 0; font-size:13px; }
.intersection-correct-order { margin-top:12px; padding:15px; border-radius:14px; background:var(--ink); color:#fff; }
.intersection-correct-order b { display:block; color:var(--yellow); font-size:21px; letter-spacing:.07em; }
.intersection-correct-order .completion-label { margin-top:14px; color:#a9cdec; }
.intersection-correct-order .completion-order { color:#fff; font-size:18px; }
.intersection-correct-order p { margin:8px 0 0; color:#ced2d6; font-size:11px; line-height:1.45; }
.intersection-special-note { margin:11px 0 0; padding:12px 14px; border-left:4px solid var(--orange); border-radius:8px; background:#fff7df; color:#6a4c0a; font-size:12px; line-height:1.5; }
.intersection-controls { display:grid; grid-template-columns:auto auto minmax(170px,1fr); gap:9px; margin-top:16px; }
.intersection-controls button { min-height:45px; }
.intersection-go { background:linear-gradient(135deg,var(--red),#d23928); box-shadow:0 7px 16px rgba(181,29,38,.22); }

.intersection-lock-panel { max-width:920px; margin:30px auto; padding:34px; border:1px solid var(--line); border-radius:24px; background:#fff; box-shadow:var(--shadow); text-align:center; }
.intersection-lock-icon { width:76px; height:76px; display:grid; place-items:center; margin:0 auto 15px; border-radius:50%; background:var(--red-soft); font-size:34px; }
.intersection-lock-panel h2 { margin:3px 0 9px; font:750 31px/1.1 Georgia,serif; }
.intersection-lock-panel > p:not(.eyebrow) { max-width:700px; margin:0 auto 24px; color:var(--muted); line-height:1.55; }
.intersection-lock-panel h3 { margin:0 0 12px; font-size:14px; }
.intersection-unlock-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.intersection-unlock-choice { min-height:84px; display:grid; grid-template-columns:42px 1fr; align-items:center; column-gap:10px; padding:12px; border:2px solid var(--line); border-radius:14px; background:#fff; text-align:left; }
.intersection-unlock-choice:hover { border-color:var(--red); background:var(--red-soft); }
.intersection-unlock-choice span { grid-row:1 / 3; width:42px; height:42px; display:grid; place-items:center; border-radius:12px; background:var(--ink); color:#fff; font-weight:950; }
.intersection-unlock-choice b { align-self:end; } .intersection-unlock-choice small { align-self:start; color:var(--muted); }

@media (max-width:1050px) {
  .intersection-home-card { grid-template-columns:96px 1fr; }
  .intersection-home-card > button { grid-column:1 / -1; }
  .intersection-home-visual { width:88px; height:88px; }
  .intersection-game-grid { grid-template-columns:1fr; }
  .ministerial-board { max-height:none; }
}

@media (max-width:780px) {
  .intersection-home-card { grid-template-columns:1fr; padding:21px; }
  .intersection-home-visual { display:none; }
  .intersection-header-card { grid-template-columns:1fr; padding:21px; }
  .intersection-header-card h2 { font-size:27px; }
  .intersection-score { min-width:0; text-align:left; }
  .intersection-game-grid { display:block; }
  .intersection-board-card { padding:10px; margin-bottom:13px; }
  .intersection-board-label { display:grid; gap:3px; }
  .ministerial-board { border-width:6px; }
  .intersection-car { width:39px; height:23px; border-width:2px; }
  .intersection-car::before,.intersection-car::after { width:7px; height:11px; top:4px; }
  .intersection-car::before { left:5px; } .intersection-car::after { right:5px; }
  .intersection-car span { width:16px; height:16px; font-size:10px; }
  .intersection-car i { display:none; }
  .intersection-play-card { padding:18px 15px; }
  .intersection-vehicle-buttons { grid-template-columns:repeat(2,1fr); }
  .intersection-controls { grid-template-columns:1fr 1fr; }
  .intersection-controls .intersection-go,.intersection-controls button:last-child { grid-column:1 / -1; }
  .intersection-unlock-grid { grid-template-columns:1fr; }
  .intersection-lock-panel { padding:24px 18px; }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 20%, #fff 0, #eef5fb 52%, #f9e9ec 100%);
}
.loading-screen img { width: 180px; border-radius: 18px; mix-blend-mode: multiply; }
.loading-screen p { color: var(--muted); font-weight: 700; }
.loader { width: 42px; height: 42px; border: 4px solid #eaded9; border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.startup-screen, .auth-screen, .language-screen {
  position: fixed; inset: 0; z-index: 200; min-height: 100vh;
  display: grid; place-content: center; justify-items: center;
  overflow: hidden; background: radial-gradient(circle at 50% 30%, #fff 0, #eef6fd 50%, #fae8ec 100%);
}
.startup-glow { position: absolute; width: 540px; height: 540px; border: 1px solid rgba(181,29,38,.08); border-radius: 50%; box-shadow: 0 0 0 55px rgba(181,29,38,.035), 0 0 0 110px rgba(181,29,38,.018); }
.animated-mascot { position: relative; z-index: 1; width: 370px; height: 338px; filter: drop-shadow(0 20px 26px rgba(78,34,22,.16)); }
.mascot-sprite { background-repeat: no-repeat; background-position: 0 50%; background-size: 400% 100%; }
.mascot-wave { background-image: url('/mascot-wave-strip.png'); animation: mascot-arrive .8s cubic-bezier(.2,.8,.2,1) both, mascot-wave-frames 1.12s steps(1,end) .72s 2; }
.startup-screen.welcome .mascot-wave { animation: mascot-arrive .45s cubic-bezier(.2,.8,.2,1) both, mascot-wave-frames .88s steps(1,end) .15s 3; }
.startup-title { position: relative; z-index: 1; margin-top: 8px; text-align: center; line-height: .95; }
.startup-title span { display: block; color: var(--blue); font-size: 16px; font-weight: 950; letter-spacing: .28em; }
.startup-title strong { display: block; margin-top: 8px; color: var(--red); font: 900 46px/1 "Segoe UI", sans-serif; letter-spacing: .08em; }
.startup-screen > p { position: relative; z-index: 1; margin: 18px 0 0; color: var(--muted); font-weight: 750; }
.startup-version { position: relative; z-index: 1; margin-top: 12px; padding: 6px 10px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; font-weight: 950; letter-spacing: .12em; }
@keyframes mascot-arrive { from { opacity: 0; transform: translateY(35px) scale(.88); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes mascot-wave-frames {
  0%,24% { background-position: 0 50%; }
  25%,49% { background-position: 33.333% 50%; }
  50%,74% { background-position: 66.667% 50%; }
  75%,100% { background-position: 100% 50%; }
}

.auth-screen { z-index: 190; padding: 24px; background: linear-gradient(135deg, #f4ede7, #fff 47%, #f8e9e8); }
.auth-card { width: min(440px, calc(100vw - 32px)); padding: 30px 34px; border: 1px solid rgba(181,29,38,.14); border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: 0 32px 90px rgba(65,31,20,.18); text-align: center; }
.auth-card > img { width: 132px; height: 112px; object-fit: contain; mix-blend-mode: multiply; }
.auth-card .eyebrow { margin-top: 8px; }
.auth-card h1 { margin: 3px 0 8px; font: 700 31px/1.1 Georgia, serif; }
.auth-version { display: inline-block; margin: 0 0 12px; padding: 5px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 900; letter-spacing: .05em; }
.auth-card > p:not(.eyebrow):not(.auth-error) { margin: 0 0 21px; color: var(--muted); }
.auth-card label { display: block; margin-bottom: 7px; color: var(--ink); text-align: left; font-size: 12px; font-weight: 900; }
.auth-card input { width: 100%; height: 51px; padding: 0 15px; border: 2px solid #ded5cd; border-radius: 13px; outline: 0; font-size: 21px; letter-spacing: .16em; }
.auth-card input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(181,29,38,.1); }
.auth-card input::-ms-reveal, .auth-card input::-ms-clear, .auth-card input::-webkit-credentials-auto-fill-button { display: none !important; visibility: hidden; pointer-events: none; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 4px; }
.auth-card > small { display: block; margin-top: 15px; color: #8a8f95; font-size: 11px; }
.auth-error { min-height: 20px; margin: 7px 0 0; color: var(--red); font-size: 12px; font-weight: 850; text-align: left; }
.auth-card.shake { animation: auth-shake .38s ease-in-out; }
@keyframes auth-shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

.language-screen { z-index: 195; padding: 24px; background: linear-gradient(135deg, #e8f2fc, #fff 47%, #fbe8eb); }
.language-card { width: min(780px, calc(100vw - 32px)); padding: 30px 34px 34px; border: 1px solid rgba(181,29,38,.14); border-radius: 27px; background: rgba(255,255,255,.97); box-shadow: 0 32px 90px rgba(65,31,20,.18); text-align: center; }
.language-card > img { width: 118px; height: 102px; object-fit: contain; mix-blend-mode: multiply; }
.language-card h1 { margin: 3px 0 8px; font: 700 32px/1.1 Georgia, serif; }
.language-card > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); }
.language-choice-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 13px; }
.language-choice-grid button { min-height: 142px; display: grid; place-items: center; align-content: center; gap: 4px; padding: 16px; border: 2px solid var(--line); border-radius: 17px; background: #fff; color: var(--ink); }
.language-choice-grid button:hover, .language-choice-grid button:focus-visible { border-color: var(--red); background: var(--red-soft); outline: 0; transform: translateY(-2px); }
.language-choice-grid span { font-size: 38px; line-height: 1; }
.language-choice-grid b { font-size: 18px; }
.language-choice-grid small { color: var(--muted); font-size: 11px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20;
  display: flex; flex-direction: column; padding: 22px 16px;
  background: linear-gradient(180deg,#fff 0,#f8fbff 68%,#fff3f5 100%); border-right: 1px solid #cbd9e7;
}
.brand { display: flex; align-items: center; gap: 12px; width: 100%; padding: 4px 8px 22px; border: 0; background: none; text-align: left; color: var(--ink); }
.brand img { width: 68px; height: 68px; object-fit: contain; border-radius: 14px; mix-blend-mode: multiply; }
.brand span { line-height: 1; }
.brand strong { display: block; font-size: 11px; letter-spacing: .15em; color: var(--blue); }
.brand b { display: block; margin-top: 5px; font-size: 22px; color: var(--red); letter-spacing: .04em; }
.main-nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 13px; padding: 13px 14px; border: 0; border-radius: 13px; background: transparent; color: #59636e; text-align: left; font-weight: 700; }
.nav-item span { width: 22px; font-size: 20px; line-height: 1; text-align: center; }
.nav-item:hover { background: #f7f3ef; color: var(--ink); }
.nav-item.active { background: linear-gradient(90deg,var(--blue-soft),var(--red-soft)); color: var(--blue-dark); box-shadow:inset 4px 0 var(--red); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 3px 0; }
.app-version { margin-bottom: 10px; color: var(--red); font-size: 10px; font-weight: 950; letter-spacing: .12em; text-align: center; }
.profile-label, .eyebrow { margin: 0 0 7px; font-size: 11px; font-weight: 900; letter-spacing: .14em; color: var(--red); }
.profile-button { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); text-align: left; }
.profile-button b, .profile-button small { display: block; }
.profile-button small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.avatar { width: 38px; height: 38px; display: grid; place-content: center; border-radius: 50%; background: var(--red); color: #fff; font-weight: 900; }

.main-content { grid-column: 2; min-width: 0; padding: 28px 38px 60px; }
.topbar { max-width: 1280px; margin: 0 auto 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 3vw, 44px); letter-spacing: -.03em; }
.data-badge { display: flex; gap: 6px; align-items: center; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; box-shadow: 0 7px 20px rgba(0,0,0,.03); }
.data-badge b { color: var(--ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #dff3ea; }
.view { display: none; max-width: 1280px; margin: 0 auto; }
.view.active { display: block; }

.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.35fr .65fr; gap: 30px;
  min-height: 240px; padding: 36px; border-radius: 28px; color: #fff;
  background: linear-gradient(125deg, var(--red-dark) 0%, var(--red) 45%, var(--blue) 45.3%, var(--blue-dark) 100%);
  box-shadow: var(--shadow);
}
.hero::before { content: ""; position: absolute; width: 360px; height: 360px; right: -90px; top: -150px; border: 60px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero::after { content: ""; position: absolute; width: 170px; height: 170px; right: 170px; bottom: -120px; border: 35px solid rgba(255,255,255,.13); border-radius: 50%; }
.hero-copy { position: relative; z-index: 2; align-self: center; }
.hero-kicker { display: inline-flex; padding: 6px 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: rgba(255,255,255,.15); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.hero h2 { max-width: 700px; margin: 12px 0 10px; font: 700 clamp(29px, 4vw, 48px)/1.04 Georgia, serif; }
.hero p { max-width: 650px; margin: 0; color: rgba(255,255,255,.78); line-height: 1.55; }
.hero-mark { position: relative; z-index: 2; align-self: center; justify-self: center; width: 150px; height: 150px; display: grid; place-content: center; border: 10px solid #fff; outline: 5px solid rgba(255,255,255,.2); border-radius: 30px; transform: rotate(7deg); background: linear-gradient(145deg,var(--red) 0 58%,var(--blue) 59%); box-shadow: 0 15px 30px rgba(4,28,56,.28); color: #fff; font-size: 34px; font-weight: 1000; letter-spacing: .03em; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font: 700 27px/1.1 Georgia, serif; }
.section-head p { margin: 7px 0 0; color: var(--muted); }
.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.module-card { position: relative; overflow: hidden; min-height: 220px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 10px 30px rgba(45,30,20,.05); transition: transform .18s ease, box-shadow .18s ease; }
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.module-icon { width: 48px; height: 48px; display: grid; place-content: center; border-radius: 14px; background: var(--red-soft); color: var(--red); font-size: 22px; font-weight: 900; }
.module-card[data-color="blue"] .module-icon { background: var(--blue-soft); color: var(--blue); }
.module-card[data-color="green"] .module-icon { background: var(--green-soft); color: var(--green); }
.module-card[data-color="yellow"] .module-icon { background: #fff8dc; color: #9a6a00; }
.module-card[data-color="orange"] .module-icon { background: #fff0e4; color: var(--orange); }
.module-card h3 { margin: 17px 0 7px; font-size: 20px; }
.module-card p { min-height: 42px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.module-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.pill { padding: 5px 8px; border-radius: 8px; background: #f2eee9; color: #5e646b; font-size: 11px; font-weight: 800; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.access-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 14px 0; }
.access-status { min-height: 43px; display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #e3ddd6; border-radius: 10px; background: #f7f3ef; }
.access-status span { width: 22px; height: 22px; display: grid; place-content: center; border-radius: 50%; font-size: 11px; }
.access-status small { color: var(--muted); font-size: 9px; font-weight: 800; line-height: 1.25; }
.access-status.active { border-color: #b7ddcb; background: var(--green-soft); }
.access-status.active span { background: var(--green); color: #fff; }
.access-status.active small { color: #28624d; }
.access-status.active.manual { border-color: #ead59e; background: #fff6dc; }
.access-status.active.manual span { background: #a66b00; }
.access-status.active.manual small { color: #765514; }
.locked-action { filter: saturate(.72); }
.primary-button, .secondary-button, .text-button, .classroom-button, .manual-button { border: 0; border-radius: 11px; padding: 10px 14px; font-weight: 850; }
.primary-button { background: var(--red); color: #fff; box-shadow: 0 7px 14px rgba(181,29,38,.2); }
.primary-button:hover { background: var(--red-dark); }
.secondary-button { background: var(--blue-soft); color: var(--blue-dark); }
.classroom-button { background: #e5f2fb; color: #185f8d; }
.classroom-button:hover { background: #d2eafb; }
.manual-button { background: #fff3d7; color: #79530d; }
.manual-button:hover { background: #f9e5b7; }
.text-button { padding-inline: 6px; background: transparent; color: var(--red); }
.primary-button:disabled, .secondary-button:disabled { opacity: .45; cursor: not-allowed; }

.dashboard-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.metric { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.metric small { display: block; color: var(--muted); font-weight: 700; }
.metric b { display: block; margin-top: 6px; font: 700 28px Georgia, serif; }

.panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 10px 30px rgba(45,30,20,.04); }
.filter-bar { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.field input, .field select, .search-input { width: 100%; padding: 12px 13px; border: 1px solid #dcd5cd; border-radius: 11px; background: #fff; color: var(--ink); outline: none; }
.field input:focus, .field select:focus, .search-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(181,29,38,.10); }
.topic-list, .review-list, .search-results { display: grid; gap: 10px; }
.topic-row, .review-row, .search-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.topic-row h3, .review-row h3, .search-row h3 { margin: 0 0 5px; font-size: 15px; }
.topic-row p, .review-row p, .search-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.topic-count { min-width: 65px; text-align: center; padding: 7px 9px; border-radius: 9px; background: #f1ede8; font-size: 12px; font-weight: 900; }

.quiz-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 18px; }
.quiz-card { min-height: 580px; display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.quiz-brand-ribbon { display: flex; align-items: center; gap: 10px; width: fit-content; margin: -10px 0 16px -8px; padding: 6px 12px 6px 7px; border-radius: 15px; background: var(--red-soft); color: var(--red); }
.quiz-brand-ribbon img { width: 54px; height: 48px; object-fit: contain; border-radius: 10px; mix-blend-mode: multiply; }
.quiz-brand-ribbon b, .quiz-brand-ribbon small { display: block; }
.quiz-brand-ribbon b { font-size: 14px; }
.quiz-brand-ribbon small { margin-top: 2px; color: #8e5659; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.quiz-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.quiz-head-tools { display: flex; align-items: center; gap: 8px; }
.quiz-counter { font-weight: 900; }
.quiz-counter span { color: var(--red); }
.timer { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 10px; background: #f5f1ed; font-variant-numeric: tabular-nums; font-weight: 900; }
.timer.warning { background: #fff0e4; color: #ae4f00; }
.question-area { display: grid; grid-template-columns: minmax(0,1fr) minmax(180px, 290px); gap: 24px; align-items: center; flex: 1; padding: 25px 0; }
.question-area.no-image { grid-template-columns: 1fr; }
.question-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.question-topic { margin: 0 0 12px; color: var(--red); font-size: 12px; font-weight: 850; }
.question-text { margin: 0; font: 600 clamp(23px, 2.4vw, 34px)/1.33 Georgia, serif; }
.question-id { margin-top: 16px; color: var(--muted); font-size: 12px; }
.question-image { max-width: 100%; max-height: 300px; justify-self: center; object-fit: contain; image-rendering: auto; border-radius: 12px; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; }
.answer-button { min-height: 70px; border: 2px solid var(--line); border-radius: 16px; background: #fff; font-size: 19px; font-weight: 950; letter-spacing: .05em; }
.answer-button.true { color: var(--green); }
.answer-button.false { color: var(--red); }
.answer-button:hover, .answer-button.selected { border-color: currentColor; background: #fafafa; }
.answer-button.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.answer-button.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.feedback { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; font-weight: 800; }
.feedback > span { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; }
.feedback.good { background: var(--green-soft); color: var(--green); }
.feedback.bad { background: var(--red-soft); color: var(--red); }
.explanation-box { padding: 16px; color: #65252a; font-weight: 500; }
.explanation-title { display: flex; align-items: center; gap: 10px; }
.explanation-title > span { width: 29px; height: 29px; display: grid; place-content: center; flex: 0 0 auto; border-radius: 50%; background: var(--red); color: #fff; font-weight: 950; }
.explanation-title b, .explanation-title small { display: block; }
.explanation-title small { margin-top: 2px; color: #7c484c; font-weight: 650; }
.explanation-box p { margin: 12px 0 0; line-height: 1.5; }
.explanation-box q { font-weight: 700; }
.memory-note { margin-top: 11px; padding: 11px 12px; border-left: 4px solid var(--green); border-radius: 8px; background: #fff; color: #254b3d; line-height: 1.45; }
.speaker-button { min-height: 38px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #cad5df; border-radius: 10px; background: #f5f9fc; color: #235b86; font-size: 12px; font-weight: 850; }
.speaker-button svg { width: 21px; height: 21px; fill: currentColor; }
.speaker-button:hover, .speaker-button.speaking { border-color: #3c87ba; background: #e6f3fb; }
.speaker-button.speaking svg { animation: speaker-pulse .65s ease-in-out infinite alternate; }
@keyframes speaker-pulse { to { transform: scale(1.18); } }
.question-languages { display: inline-flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid #d7d2cc; border-radius: 11px; background: #f6f3ef; }
.question-languages button { min-width: 44px; height: 35px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 3px 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #727980; }
.question-languages button:hover { background: #fff; }
.question-languages button.active { border-color: var(--red); background: #fff; color: var(--red); box-shadow: 0 3px 8px rgba(0,0,0,.07); }
.question-languages span { font-size: 20px; line-height: 1; }
.question-languages small { font-size: 9px; font-weight: 900; }
.question-languages.compact { padding: 3px; border-color: #b7c4cc; background: #eef6f6; }
.question-languages.compact button { min-width: 39px; height: 31px; padding: 2px 5px; }
.quiz-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.classroom-feedback { display: grid; grid-template-columns: 155px minmax(0,1fr); gap: 14px; align-items: center; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: #fffdf9; }
.classroom-feedback .feedback { margin: 0; }
.classroom-mascot { width: 150px; height: 137px; background-size: 400% 100%; background-repeat: no-repeat; filter: drop-shadow(0 8px 10px rgba(44,28,20,.12)); }
.classroom-mascot.happy { background-image: url('/mascot-wave-strip.png'); animation: mascot-wave-frames .82s steps(1,end) infinite, result-jump .68s ease-in-out infinite; }
.classroom-mascot.sad { width: 145px; height: 145px; background-image: url('/mascot-sad-strip.png'); animation: mascot-sad-frames 2.35s steps(1,end) 1 forwards, result-sob .58s ease-in-out 2.3s infinite alternate; }
.favorite-button { border: 0; background: transparent; color: #9a9188; font-size: 25px; }
.favorite-button.active { color: #e5a900; }

.quiz-panel { display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.quiz-panel h3 { margin: 2px 0 13px; }
.question-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; max-height: 390px; overflow: auto; padding-right: 3px; }
.map-pagination { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 6px; margin-bottom: 9px; }
.map-pagination button { height: 31px; border: 1px solid var(--line); border-radius: 8px; background: #f3efea; color: var(--ink); font-weight: 900; }
.map-pagination button:disabled { opacity: .35; }
.map-pagination span { color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; }
.map-button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: #f8f5f1; color: var(--muted); font-size: 11px; font-weight: 850; }
.map-button.current { outline: 2px solid var(--red); outline-offset: 1px; }
.map-button.answered { background: var(--blue-soft); border-color: #bad5e8; color: var(--blue); }
.map-button.correct { background: var(--green-soft); border-color: #a8d8c4; color: var(--green); }
.map-button.wrong { background: var(--red-soft); border-color: #efb3b6; color: var(--red); }
.finish-button { width: 100%; margin-top: auto; padding: 13px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 900; }

body.exam-mode { background: #dce4ed; }
body.exam-mode .app-shell { display: block; min-height: 100vh; }
body.exam-mode .sidebar, body.exam-mode .topbar { display: none; }
body.exam-mode .main-content { padding: 16px; }
body.exam-mode .view { max-width: 1540px; }
.exam-stage { min-height: calc(100vh - 32px); display: flex; flex-direction: column; justify-content: center; }
.exam-console { overflow: hidden; border: 1px solid #8fa0b2; border-radius: 8px; background: #f6f8fa; box-shadow: 0 18px 55px rgba(20,43,68,.22); }
.exam-toolbar { min-height: 86px; display: grid; grid-template-columns: 1fr auto auto; align-items: stretch; color: #fff; background: linear-gradient(180deg, #174c7d, #0c385f); border-bottom: 4px solid #efc225; }
.exam-brand { display: flex; align-items: center; gap: 13px; padding: 10px 18px; }
.exam-brand img { width: 74px; height: 63px; object-fit: contain; border-radius: 7px; background: #fff; }
.exam-brand b, .exam-brand small { display: block; }
.exam-brand b { font-size: 18px; letter-spacing: .07em; }
.exam-brand small { margin-top: 4px; color: #d6e8f6; font-size: 11px; }
.exam-question-position, .exam-timer { min-width: 150px; display: grid; place-content: center; padding: 10px 22px; border-left: 1px solid rgba(255,255,255,.22); text-align: center; }
.exam-question-position small, .exam-timer small { color: #cce1f1; font-size: 10px; font-weight: 850; letter-spacing: .1em; }
.exam-question-position b, .exam-timer b { display: block; margin-top: 3px; font-size: 28px; font-variant-numeric: tabular-nums; }
.exam-question-position b span { margin-left: 4px; color: #bcd2e3; font-size: 14px; }
.exam-timer.warning { background: #9b311e; }
.exam-progress { display: grid; grid-template-columns: repeat(auto-fit, minmax(34px, 1fr)); gap: 5px; padding: 10px 12px; border-bottom: 1px solid #b8c3ce; background: #e6ebf0; }
.exam-progress .map-button { min-height: 34px; aspect-ratio: auto; border: 1px solid #8e9baa; border-radius: 3px; background: #fff; color: #31475c; font-size: 12px; }
.exam-progress .map-button.current { outline: 3px solid #f2bd15; outline-offset: 0; background: #fff8d2; }
.exam-progress .map-button.answered { border-color: #1e688d; background: #267eaa; color: #fff; }
.exam-progress .map-button.current.answered { background: #267eaa; }
.exam-workarea { min-height: 365px; display: grid; grid-template-columns: 1fr; gap: 28px; align-items: center; padding: 30px 38px; background: #fff; }
.exam-workarea.has-image { grid-template-columns: minmax(0, 1fr) minmax(260px, 38%); }
.exam-copy-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.exam-copy-head > span { padding: 7px 12px; border-radius: 4px; background: #e5edf4; color: #244762; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.exam-question-copy h2 { max-width: 900px; margin: 0; color: #101820; font: 650 clamp(25px, 2.7vw, 40px)/1.3 "Segoe UI", sans-serif; }
.exam-question-copy > small { display: block; margin-top: 18px; color: #72808d; }
.exam-question-image { max-width: 100%; max-height: 320px; justify-self: center; object-fit: contain; border: 1px solid #c6cdd3; background: #fff; }
.exam-answer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 18px 38px; border-block: 1px solid #b4c0ca; background: #e8edf1; }
.exam-answer { min-height: 76px; display: flex; align-items: center; justify-content: center; gap: 16px; border: 2px solid #8f9ba6; border-radius: 5px; background: #fff; color: #243646; }
.exam-answer > span { width: 46px; height: 46px; display: grid; place-content: center; border: 3px solid currentColor; border-radius: 50%; font-size: 24px; font-weight: 950; }
.exam-answer b { font-size: 22px; letter-spacing: .08em; }
.exam-answer.true:hover, .exam-answer.true.selected { border-color: #16764f; background: #dcf4e8; color: #0d6d47; }
.exam-answer.false:hover, .exam-answer.false.selected { border-color: #ae242d; background: #ffe1e3; color: #a81822; }
.exam-footer { min-height: 68px; display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 9px 14px; background: #f8fafb; }
.exam-nav-button, .exam-summary-button, .exam-confirm-button { min-height: 46px; padding: 8px 16px; border: 1px solid #8b9aaa; border-radius: 4px; background: linear-gradient(#fff, #e4e9ed); color: #20394e; font-weight: 850; }
.exam-nav-button span { font-size: 22px; vertical-align: -2px; }
.exam-nav-button.next { color: #fff; background: linear-gradient(#2977a7, #15577f); border-color: #0d4c75; }
.exam-summary-button { color: #5a4711; background: linear-gradient(#fff9cf, #f3d662); border-color: #c7a321; }
.exam-nav-button:disabled { opacity: .42; cursor: not-allowed; }
.exam-watermark { display: flex; align-items: center; gap: 8px; min-width: 0; color: #8b959e; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.exam-watermark img { width: 48px; height: 43px; object-fit: contain; mix-blend-mode: multiply; }
.exam-disclaimer { margin: 8px 0 0; color: #64717d; font-size: 10px; text-align: center; }
.exam-summary-body { min-height: 480px; padding: 28px 36px; background: #fff; }
.exam-summary-body h2 { margin: 0; color: #173f63; font-size: 28px; }
.exam-summary-body > p { margin: 7px 0 20px; color: #60707e; }
.exam-summary-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 9px; }
.exam-summary-item { min-height: 72px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 8px; padding: 8px; border: 1px solid #9eacb9; border-radius: 4px; background: #f8fafb; text-align: left; }
.exam-summary-item b { width: 27px; height: 27px; display: grid; place-content: center; border-radius: 3px; background: #dce5ec; color: #284760; }
.exam-summary-item span { justify-self: end; color: #15658d; font-size: 22px; font-weight: 950; }
.exam-summary-item small { grid-column: 1 / -1; color: #6a7782; font-size: 9px; }
.exam-summary-item.answered { border-color: #287598; background: #edf8fc; }
.exam-summary-item.unanswered { border-color: #d0a424; background: #fff9db; }
.exam-summary-footer { min-height: 72px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 10px 16px; border-top: 1px solid #aab6c1; background: #edf1f4; }
.exam-summary-footer > div { text-align: center; color: #576673; }
.exam-confirm-button { color: #fff; background: linear-gradient(#248257, #126542); border-color: #0b5234; }

/* Postazione d'esame: disposizione ripresa dalla schermata ministeriale fornita. */
body.exam-mode { background: #cfeef0; }
.official-exam { border: 1px solid #7f9fa1; border-radius: 3px; background: #d8f1f2; box-shadow: 0 12px 36px rgba(26,68,72,.20); }
.official-exam-header { min-height: 106px; display: grid; grid-template-columns: 1fr 1.3fr 1fr; align-items: center; gap: 18px; padding: 10px 18px; border-bottom: 1px solid #8daeb0; background: #fff; }
.official-logo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.official-logo img { width: 78px; height: 75px; object-fit: contain; mix-blend-mode: multiply; }
.official-logo b, .official-logo strong { display: block; line-height: 1; }
.official-logo b { color: #6f7880; font-size: 11px; letter-spacing: .13em; }
.official-logo strong { margin-top: 5px; color: var(--red); font-size: 22px; letter-spacing: .04em; }
.official-title { justify-self: center; min-width: 280px; padding: 13px 34px; border: 1px solid #7d9da0; border-radius: 4px; background: linear-gradient(#e8f7f8,#ccebed); color: #183e43; text-align: center; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.official-title b, .official-title small { display: block; }
.official-title b { font-size: 21px; letter-spacing: .05em; }
.official-title small { margin-top: 4px; color: #55777a; font-size: 11px; }
.official-ministry { justify-self: end; display: flex; align-items: center; gap: 10px; color: #214d51; text-align: right; }
.official-ministry > span { width: 60px; height: 60px; display: grid; place-content: center; border: 3px double #557b7d; border-radius: 50%; font: 900 17px Georgia,serif; }
.official-ministry small { color: #557477; font-size: 10px; line-height: 1.3; }
.exam-group-tabs { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 2px; padding: 10px 12px 0; background: #d8f1f2; }
.exam-group-tabs button { min-height: 38px; border: 1px solid #7e9fa1; border-bottom-color: #5f8689; border-radius: 5px 5px 0 0; background: linear-gradient(#f9ffff,#c9e7e9); color: #31585c; font-size: 12px; font-weight: 800; }
.exam-group-tabs button.active { border-color: #305e77; background: linear-gradient(#33708d,#1f5874); color: #fff; }
.official-exam .exam-progress { grid-template-columns: repeat(10,minmax(38px,1fr)); gap: 4px; padding: 7px 12px 10px; border-bottom: 0; background: #d8f1f2; }
.official-exam .exam-progress .map-button { min-height: 36px; border-color: #8ba6a8; background: linear-gradient(#fff,#e7eeee); color: #234b50; }
.official-exam .exam-progress .map-button.current { outline: 2px solid #1f5d79; background: #d8edf6; }
.official-exam .exam-progress .map-button.answered { border-color: #456e72; background: #b8d9db; color: #183f43; }
.official-exam .exam-workarea { min-height: 410px; margin: 0 12px; padding: 18px 22px 16px; border: 1px solid #9ab1b3; border-radius: 3px; background: #fff; }
.official-exam .exam-workarea.has-image { grid-template-columns: minmax(0,1fr) minmax(240px,34%); }
.official-exam .exam-question-copy { align-self: stretch; }
.official-exam .exam-copy-head { min-height: 50px; margin-bottom: 14px; }
.exam-live-tools { display: flex; align-items: center; gap: 8px; }
.official-exam .exam-copy-head > span { width: 48px; height: 48px; display: grid; place-content: center; padding: 0; border: 2px solid #7b989a; border-radius: 50%; background: #f6fbfb; color: #234e52; font-size: 18px; }
.official-exam .exam-question-copy h2 { color: #0c2225; font: 650 clamp(24px,2.6vw,39px)/1.3 "Segoe UI",sans-serif; }
.official-exam .exam-question-image { max-height: 285px; border: 0; }
.official-exam .exam-answer-row { grid-column: 1 / -1; justify-self: center; display: flex; gap: 30px; width: min(520px,100%); padding: 12px 0 0; border: 0; background: transparent; }
.official-exam .exam-answer { flex: 1; min-height: 70px; border: 1px solid #86a1a3; border-radius: 4px; background: linear-gradient(#fff,#edf3f3); color: #244c50; }
.official-exam .exam-answer > span { width: 44px; height: 44px; border-width: 2px; }
.official-exam .exam-answer.true.selected { border-color: #17724f; background: #dff4e9; color: #116543; }
.official-exam .exam-answer.false.selected { border-color: #a6252e; background: #fce3e5; color: #96202a; }
.official-footer { grid-template-columns: 150px repeat(5,minmax(0,1fr)); gap: 7px; min-height: 78px; padding: 10px 12px; border-top: 0; background: #d8f1f2; }
.official-footer .exam-timer { min-width: 0; min-height: 54px; display: grid; place-content: center; padding: 6px 12px; border: 1px solid #78999b; border-radius: 4px; background: #fff; color: #213e42; }
.official-footer .exam-timer small { color: #617b7d; }
.official-footer .exam-timer b { color: #133f52; font-size: 22px; }
.official-footer .exam-nav-button, .official-footer .exam-summary-button { min-width: 0; min-height: 54px; padding: 7px 9px; border-color: #78999b; background: linear-gradient(#fff,#d9e7e8); color: #264e52; font-size: 11px; }
.official-footer .exam-summary-button { background: linear-gradient(#fff6cd,#e9ca64); color: #624d13; }
.official-footer .exam-nav-button.next { border-color: #315f75; background: linear-gradient(#39738e,#245970); color: #fff; }

.result-hero { display: grid; grid-template-columns: 240px auto 1fr auto; gap: 22px; align-items: center; padding: 24px 28px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.result-reaction { position: relative; width: 240px; height: 280px; display: flex; align-items: flex-end; justify-content: center; overflow: visible; }
.mascot-speech-bubble { position: absolute; z-index: 5; left: 50%; top: 0; width: 280px; max-width: min(280px, calc(100vw - 54px)); padding: 13px 16px; transform: translateX(-50%); border: 2px solid #d4cbc3; border-radius: 20px; background: #fff; color: var(--ink); box-shadow: 0 10px 25px rgba(38,25,17,.15); font: 900 15px/1.3 "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive; letter-spacing: .02em; text-align: center; animation: bubble-pop .34s ease-out both; }
.mascot-speech-bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; width: 17px; height: 17px; margin-left: -8px; border-right: 2px solid #d4cbc3; border-bottom: 2px solid #d4cbc3; background: #fff; transform: rotate(45deg); }
.mascot-speech-bubble.positive { border-color: #8ec9ad; color: #246148; }
.mascot-speech-bubble.negative { border-color: #e1aaa9; color: #8d282d; }
.mascot-speech-bubble.positive::after { border-color: #8ec9ad; }
.mascot-speech-bubble.negative::after { border-color: #e1aaa9; }
@keyframes bubble-pop { from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(.88); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }
.result-mascot { width: 205px; height: 187px; background-size: 400% 100%; background-repeat: no-repeat; filter: drop-shadow(0 12px 14px rgba(44,28,20,.14)); }
.result-mascot.happy { background-image: url('/mascot-wave-strip.png'); animation: mascot-wave-frames .9s steps(1,end) infinite, result-jump .72s ease-in-out infinite; }
.result-mascot.sad { width: 205px; height: 205px; background-image: url('/mascot-sad-strip.png'); animation: mascot-sad-frames 2.4s steps(1,end) 1 forwards, result-sob .58s ease-in-out 2.35s infinite alternate; }
@keyframes mascot-sad-frames {
  0%,24% { background-position: 0 50%; }
  25%,49% { background-position: 33.333% 50%; }
  50%,74% { background-position: 66.667% 50%; }
  75%,100% { background-position: 100% 50%; }
}
@keyframes result-jump { 0%,100% { transform: translateY(0) rotate(-1deg); } 45% { transform: translateY(-15px) rotate(1deg); } }
@keyframes result-sob { from { transform: translateY(0) rotate(-.8deg); } to { transform: translateY(3px) rotate(.8deg); } }
.result-badge { width: 110px; height: 110px; display: grid; place-content: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 38px; font-weight: 1000; border: 8px solid #d5f0e4; }
.result-badge.failed { background: var(--red-soft); color: var(--red); border-color: #f7d6d7; }
.result-hero h2 { margin: 0 0 7px; font: 700 34px Georgia, serif; }
.result-hero p { margin: 0; color: var(--muted); }
.result-numbers { display: flex; gap: 22px; }
.result-numbers div { text-align: center; }
.result-numbers b { display: block; font: 700 29px Georgia, serif; }
.result-numbers small { color: var(--muted); }
.answer-chip { display: inline-flex; margin-top: 7px; padding: 5px 8px; border-radius: 8px; font-size: 11px; font-weight: 900; }
.answer-chip.good { background: var(--green-soft); color: var(--green); }
.answer-chip.bad { background: var(--red-soft); color: var(--red); }
.result-review-row { align-items: start; }
.result-review-row .explanation-box { max-width: 980px; margin-top: 12px; }

#view-manual { width: 100%; max-width: none; }
.manual-shell { --manual-toc-width:260px; display: grid; grid-template-columns: var(--manual-toc-width) 18px minmax(0,1fr); gap: 0; align-items: start; }
.manual-shell-figure { --manual-toc-width:250px; grid-template-columns: var(--manual-toc-width) 16px minmax(0,1fr); }
.manual-column-resizer { position:relative; align-self:stretch; min-width:0; min-height:90px; cursor:col-resize; touch-action:none; outline:0; }
.manual-column-resizer::before { content:""; position:absolute; top:10px; bottom:10px; left:50%; width:2px; border-radius:999px; background:#ded6ce; transform:translateX(-50%); transition:background .16s ease,box-shadow .16s ease,width .16s ease; }
.manual-column-resizer::after { content:""; position:absolute; top:50%; left:50%; width:6px; height:42px; border:1px solid #d7cec5; border-radius:999px; background:#fffdfa; box-shadow:0 4px 12px rgba(55,38,25,.1); transform:translate(-50%,-50%); transition:border-color .16s ease,box-shadow .16s ease; }
.manual-column-resizer:hover::before,
.manual-column-resizer:focus-visible::before,
.manual-column-resizer.active::before { width:3px; background:var(--red); box-shadow:0 0 0 4px rgba(181,29,38,.1); }
.manual-column-resizer:hover::after,
.manual-column-resizer:focus-visible::after,
.manual-column-resizer.active::after { border-color:var(--red); box-shadow:0 4px 14px rgba(181,29,38,.22); }
body.manual-columns-resizing { cursor:col-resize; user-select:none; }
body.manual-columns-resizing * { cursor:col-resize !important; }
.manual-toc { position: sticky; top: 18px; max-height: calc(100vh - 36px); display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.manual-shell-figure .manual-toc { gap: 9px; padding: 14px; border-radius: 16px; }
.manual-shell-figure .manual-toc .field label { margin-bottom: 5px; font-size: 10px; }
.manual-shell-figure .manual-toc .field input,
.manual-shell-figure .manual-toc .field select { padding: 9px 10px; font-size: 12px; }
.manual-shell-figure .manual-progress { padding: 8px; }
.manual-shell-figure .manual-progress small { display: block; }
.manual-shell-figure .manual-chapter-count { padding: 7px; font-size: 10px; }
.manual-shell-figure .manual-topics button { grid-template-columns: 30px minmax(0,1fr); gap: 2px 8px; padding: 8px; }
.manual-shell-figure .manual-topics button > span { width: 29px; height: 29px; border-radius: 7px; font-size: 10px; }
.manual-shell-figure .manual-topics button b { white-space: normal; font-size:12px; }
.manual-shell-figure .manual-topics button small { display: block; }
.manual-chapter-count { padding: 9px 10px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 850; text-align: center; }
.manual-progress { display: grid; gap: 7px; padding: 10px; border: 1px solid #e4ddd5; border-radius: 11px; background: #fffdfa; }
.manual-progress > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.manual-progress b { color: var(--red); font-size: 16px; }
.manual-progress small { color: var(--muted); font-size: 9px; font-weight: 800; text-align: right; }
.manual-progress > span { height: 7px; overflow: hidden; border-radius: 999px; background: #ebe5de; }
.manual-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--red),#e3634c); transition: width .3s ease; }
.manual-topics { display: grid; gap: 6px; overflow: auto; padding-right: 3px; }
.manual-topics button { display: grid; grid-template-columns: 32px 1fr; gap: 2px 9px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fffdfa; color: var(--ink); text-align: left; }
.manual-topics button > span { grid-row: 1 / 3; width: 31px; height: 31px; display: grid; place-content: center; border-radius: 8px; background: #eee9e3; color: #6f7479; font-size: 10px; font-weight: 900; }
.manual-topics button b { overflow: hidden; font-size: 11px; line-height: 1.25; text-overflow: ellipsis; }
.manual-topics button small { color: var(--muted); font-size: 9px; }
.manual-topics button.active { border-color: var(--red); background: var(--red-soft); }
.manual-topics button.active > span { background: var(--red); color: #fff; }
.manual-topics button.completed { border-color: #add7c3; background: #f0f8f4; }
.manual-topics button.completed > span { background: var(--green); color: #fff; }
.manual-page { min-height: 900px; padding: 36px 42px 46px; border: 1px solid #ddd5cc; border-radius: 5px 20px 20px 5px; background: #fff; box-shadow: 0 20px 55px rgba(55,38,25,.09), inset 8px 0 18px rgba(80,56,35,.025); }
.manual-figure-page { min-height: 0; overflow: hidden; padding: 14px 16px 16px; }
.manual-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 22px; border-bottom: 2px solid var(--red); }
.manual-page-head h2 { max-width: 760px; margin: 0; font: 700 clamp(29px,3vw,43px)/1.08 Georgia,serif; color: #2b2520; }
.manual-figure-page .manual-page-head { align-items: center; gap: 12px; padding-bottom: 8px; }
.manual-figure-page .manual-page-head .eyebrow { margin-bottom: 4px; font-size: 9px; }
.manual-figure-page .manual-page-head h2 { font-size: clamp(25px,2vw,32px); }
.manual-page-subtitle { max-width: 780px; margin: 10px 0 0; color: #625950; font: 500 16px/1.5 Georgia,serif; }
.manual-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.manual-presentation-button { min-height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 0; border-radius: 11px; background: var(--ink); color: #fff; }
.manual-presentation-button span { font-size: 18px; line-height: 1; }
.manual-presentation-button b { font-size: 10px; }
.manual-presentation-button.active { background: var(--red); }
.manual-book-nav { display: grid; grid-template-columns: minmax(150px,1fr) minmax(150px,260px) minmax(150px,1fr); align-items: center; gap: 14px; margin: 22px 0; padding: 13px 14px; border: 1px solid #dfd7cf; border-radius: 14px; background: #faf6f1; }
.manual-figure-page .manual-book-nav.top { margin: 8px 0; padding: 7px 9px; }
.manual-figure-page .manual-book-nav.top button { padding-block: 8px; }
.manual-figure-page .manual-book-nav.bottom,
.manual-figure-page .manual-continue-note { display: none; }
.manual-book-nav.bottom { margin-top: 28px; }
.manual-book-nav button:first-child { justify-self: start; }
.manual-book-nav button:last-child { justify-self: end; }
.manual-book-nav button:disabled { opacity: .35; cursor: default; }
.manual-book-position { display: grid; gap: 7px; color: #50483f; font-size: 12px; text-align: center; }
.manual-book-position > span { height: 6px; overflow: hidden; border-radius: 999px; background: #e4ddd5; }
.manual-book-position i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--red),#e3634c); transition: width .25s ease; }
.manual-book-sheet { min-height: 560px; }
.manual-book-intro { display: grid; gap: 10px; margin: 26px 0 0; padding: 20px 22px; border: 1px solid #dfd5ca; border-radius: 15px; background: linear-gradient(135deg,#fffaf4,#f8f1e9); }
.manual-book-intro b { color: var(--red); font: 700 21px Georgia,serif; }
.manual-book-intro p { margin: 0; color: #403933; font-size: 14px; line-height: 1.65; }
.manual-book-intro small { color: var(--muted); font-size: 11px; font-weight: 750; line-height: 1.5; }
.manual-lead { margin: 28px 0; padding: 21px 23px; border-left: 6px solid var(--red); background: #faf5ef; color: #453d36; font: 500 18px/1.65 Georgia,serif; }
.manual-lead p { margin: 0; }
.manual-section { margin-top: 30px; }
.manual-section h3 { margin: 0 0 7px; font: 700 25px Georgia,serif; }
.manual-source-note { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.manual-explanation { padding: 24px; border: 1px solid #e1d9d1; border-radius: 16px; background: #fffdfa; }
.theory-section + .theory-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid #e8e1da; }
.theory-section h4 { margin: 0 0 7px; color: #342d27; font: 700 18px Georgia,serif; }
.theory-section p { margin: 0; color: #49423c; line-height: 1.7; }
.manual-principles { display: grid; gap: 9px; }
.manual-principles > div { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: start; padding: 12px 14px; border: 1px solid #e6ded5; border-radius: 12px; background: #fffdfa; }
.manual-principles span { width: 31px; height: 31px; display: grid; place-content: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 900; }
.manual-principles p { margin: 3px 0 0; color: #34302c; line-height: 1.5; }
.manual-callouts { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 32px; }
.manual-callouts > div { padding: 17px 18px; border-radius: 13px; background: #eef7f2; color: #285343; }
.manual-callouts > div:last-child { background: #edf5fa; color: #28526d; }
.manual-callouts b { font-size: 13px; }
.manual-callouts ul { margin: 9px 0 0; padding-left: 18px; }
.manual-callouts li { margin: 6px 0; font-size: 12px; line-height: 1.55; }
.manual-figure-layout { --manual-figure-share:72%; height: clamp(460px,calc(100vh - 258px),900px); display: grid; grid-template-columns:minmax(320px,calc(var(--manual-figure-share) - 7px)) 14px minmax(280px,1fr); gap: 0; align-items: stretch; overflow:hidden; padding-top: 0; }
.manual-signal-card { position: relative; top:0; height:100%; display:block; overflow: hidden; margin: 0; border: 1px solid #dcd3ca; border-radius: 17px; background: #fff; box-shadow: 0 14px 35px rgba(55,38,25,.08); }
.manual-card-label { padding: 10px 14px; background: #342d27; color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.manual-signal-card > .manual-card-label { position:absolute; top:10px; left:10px; z-index:2; padding:7px 10px; border-radius:9px; box-shadow:0 5px 15px rgba(0,0,0,.15); }
.manual-signal-card img { display:block; width: 100%; height:100%; min-height:0; padding: 5px; object-fit: contain; background: linear-gradient(#fff,#f7fbff); image-rendering:auto; }
.manual-signal-card figcaption { position:absolute; right:10px; bottom:10px; left:10px; display: grid; gap: 3px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.78); border-radius:11px; background:rgba(255,255,255,.91); box-shadow:0 6px 20px rgba(35,28,22,.12); backdrop-filter:blur(6px); }
.manual-signal-card figcaption b { overflow:hidden; color: #312b26; font: 700 13px/1.3 Georgia,serif; text-overflow:ellipsis; white-space:nowrap; }
.manual-signal-card figcaption small { color: var(--muted); font-size: 9px; font-weight: 750; line-height: 1.35; }
.manual-facts-scroll { height:100%; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 7px 12px 0; }
.manual-facts-scroll:focus-visible { outline:3px solid rgba(23,90,155,.22); outline-offset:3px; border-radius:15px; }
.manual-detail-layout { overflow: hidden; margin-top: 8px; border: 1px solid #ded5cc; border-radius: 17px; background: #fffdfa; }
.manual-detail-layout > .manual-facts { padding: 22px; }
.manual-facts { display: grid; gap: 20px; }
.manual-fact-block { overflow: hidden; border: 1px solid #dce8e1; border-radius: 15px; background: #f8fcfa; }
.manual-fact-block.wrong { border-color: #eadbd8; background: #fff9f8; }
.manual-fact-block h3 { margin: 0; padding: 13px 16px; background: #e4f2ea; color: #1f5b43; font: 700 19px Georgia,serif; }
.manual-fact-block.wrong h3 { background: #f8e8e5; color: #963b35; }
.manual-fact-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.manual-fact-list li { display: grid; grid-template-columns: 29px minmax(0,1fr); gap: 11px; padding: 14px 16px; align-items: start; }
.manual-fact-list li + li { border-top: 1px solid rgba(75,65,55,.1); }
.manual-fact-icon { width: 27px; height: 27px; display: grid; place-content: center; border-radius: 50%; background: var(--green); color: #fff; font-size: 12px; font-weight: 950; }
.manual-fact-block.wrong .manual-fact-icon { background: var(--red); }
.manual-fact-list p { margin: 2px 0 0; color: #38322d; font-size: 13px; line-height: 1.58; }
.manual-fact-list p b { color: #963b35; }
.manual-fact-list small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; font-weight: 800; }
.manual-continue-note { margin: 24px 0 0; color: var(--muted); font: italic 13px/1.5 Georgia,serif; text-align: center; }
.manual-completion { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 34px; padding: 18px 20px; border: 1px solid #dfd7cf; border-radius: 15px; background: #faf6f1; }
.manual-completion b { font: 700 18px Georgia,serif; }
.manual-completion p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

/* Modalità aula: l'intera finestra Windows diventa una lavagna 16:9. */
body.manual-presentation { height: 100vh; overflow: hidden; background: #e7eef5; }
body.manual-presentation .app-shell { display: block; min-height: 100vh; }
body.manual-presentation .sidebar,
body.manual-presentation .topbar,
body.manual-presentation .manual-toc,
body.manual-presentation .manual-toc-resizer { display: none; }
body.manual-presentation .main-content { height: 100vh; padding: 8px; }
body.manual-presentation .view,
body.manual-presentation #view-manual { max-width: none; height: 100%; }
body.manual-presentation .manual-shell { display: block; height: 100%; }
body.manual-presentation .manual-page { height: 100%; min-height: 0; overflow: hidden; padding: 9px 11px 10px; border-radius: 15px; }
body.manual-presentation .manual-page-head { min-height: 45px; padding-bottom: 5px; }
body.manual-presentation .manual-page-head .eyebrow { margin-bottom: 2px; font-size: 8px; }
body.manual-presentation .manual-page-head h2 { font-size: clamp(23px,2vw,30px); }
body.manual-presentation .manual-tools { flex-wrap: nowrap; }
body.manual-presentation .manual-tools .question-languages button { width: 35px; height: 35px; }
body.manual-presentation .manual-tools .speaker-button { min-height: 35px; padding: 6px 9px; }
body.manual-presentation .manual-tools .speaker-button span { display: none; }
body.manual-presentation .manual-presentation-button { min-height: 35px; }
body.manual-presentation .manual-book-nav.top { grid-template-columns: 1fr 190px 1fr; margin: 5px 0; padding: 5px 8px; }
body.manual-presentation .manual-book-nav.top button { padding-block: 7px; }
body.manual-presentation .manual-book-position { gap: 3px; }
body.manual-presentation .manual-figure-layout { height: calc(100vh - 116px); grid-template-columns:minmax(360px,calc(var(--manual-figure-share) - 5px)) 10px minmax(300px,1fr); gap: 0; }
body.manual-presentation .manual-signal-card { border-radius: 13px; }
body.manual-presentation .manual-facts-scroll { padding-right: 5px; }
body.manual-presentation .manual-facts { gap: 10px; }
body.manual-presentation .manual-fact-block h3 { padding: 9px 12px; font-size: 16px; }
body.manual-presentation .manual-fact-list li { grid-template-columns: 25px minmax(0,1fr); gap: 8px; padding: 9px 11px; }
body.manual-presentation .manual-fact-icon { width: 24px; height: 24px; }
body.manual-presentation .manual-fact-list p { font-size: 12px; line-height: 1.42; }
body.manual-presentation .manual-fact-list small { margin-top: 3px; }

.chart-bars { display: grid; gap: 12px; margin-top: 18px; }
.chart-row { display: grid; grid-template-columns: 150px 1fr 60px; align-items: center; gap: 12px; }
.chart-row span { font-size: 12px; font-weight: 750; }
.chart-track { height: 11px; overflow: hidden; border-radius: 999px; background: #eee9e3; }
.chart-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), #e55943); }
.empty-state { padding: 50px 20px; text-align: center; border: 1px dashed #d8d0c8; border-radius: 18px; background: rgba(255,255,255,.55); }
.empty-state .big-icon { font-size: 46px; color: #bbb0a6; }
.empty-state h3 { margin: 10px 0 5px; }
.empty-state p { margin: 0; color: var(--muted); }

.modal { width: min(620px, calc(100vw - 28px)); border: 0; border-radius: 22px; padding: 0; box-shadow: 0 35px 100px rgba(0,0,0,.27); }
.modal::backdrop { background: rgba(20,16,14,.55); backdrop-filter: blur(3px); }
.modal form { padding: 24px; }
.modal-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font: 700 28px Georgia, serif; }
.close-button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2eee9; font-size: 24px; }
.profile-list { display: grid; gap: 8px; margin: 18px 0; }
.profile-entry { display: grid; grid-template-columns: 40px 1fr auto; gap: 11px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 13px; }
.profile-entry.active { border-color: var(--red); background: var(--red-soft); }
.profile-entry button { border: 0; background: transparent; }
.new-profile-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.new-profile-row input { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.setup-option { padding: 17px; border: 2px solid var(--line); border-radius: 14px; background: #fff; text-align: left; }
.setup-option.active { border-color: var(--red); background: var(--red-soft); }
.setup-option b, .setup-option small { display: block; }
.setup-option small { margin-top: 5px; color: var(--muted); line-height: 1.35; }
.setup-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.access-gate-body { display: grid; gap: 10px; padding-top: 18px; }
.access-lock { width: 58px; height: 58px; display: grid; place-content: center; margin: 0 auto 3px; border-radius: 50%; background: var(--red-soft); font-size: 28px; }
.access-gate-body > p:not(.auth-error) { margin: 0 0 5px; color: var(--muted); line-height: 1.5; text-align: center; }
.access-gate-body label { color: var(--ink); font-size: 12px; font-weight: 900; }
.access-gate-body input { width: 100%; height: 50px; padding: 0 14px; border: 2px solid #dcd4cc; border-radius: 12px; outline: 0; font-size: 20px; letter-spacing: .15em; }
.access-gate-body input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(181,29,38,.1); }
.access-gate-body input::-ms-reveal, .access-gate-body input::-ms-clear, .access-gate-body input::-webkit-credentials-auto-fill-button { display: none !important; visibility: hidden; pointer-events: none; }
.access-submit { width: 100%; min-height: 47px; }
.access-gate-body > small { color: var(--muted); font-size: 10px; text-align: center; }
.access-modal.shake { animation: auth-shake .38s ease-in-out; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 120px); opacity: 0; padding: 12px 17px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: 0 12px 35px rgba(0,0,0,.25); font-weight: 750; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Accesso cloud --------------------------------------------------------- */
.cloud-access-screen {
  position: fixed; inset: 0; z-index: 1000; min-height: 100vh; overflow: auto; display: grid; place-items: center;
  padding: 28px; background: radial-gradient(circle at 18% 10%, rgba(23,90,155,.14), transparent 34%), linear-gradient(145deg,#edf4fa,#f8fafc 52%,#edf2f6);
}
.cloud-access-screen.hidden { display: none; }
.cloud-access-card { width: min(540px,100%); padding: 38px; border: 1px solid rgba(23,90,155,.15); border-radius: 26px; background: rgba(255,255,255,.97); box-shadow: 0 26px 80px rgba(11,49,92,.17); text-align: center; }
.cloud-access-card > img { width: 148px; height: 92px; object-fit: contain; margin-bottom: 15px; border-radius: 13px; }
.cloud-access-card h1 { margin: 4px 0 12px; font: 750 37px/1.08 Georgia,serif; color: var(--ink); }
.cloud-access-lead { margin: 0 auto 24px; color: var(--muted); font-size: 16px; line-height: 1.62; }
.cloud-request-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.cloud-request-form label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.cloud-request-form input { width: 100%; height: 52px; padding: 0 15px; border: 2px solid #dce4ec; border-radius: 13px; outline: 0; background: #fff; color: var(--ink); font: 700 16px/1 sans-serif; text-transform: none; letter-spacing: 0; }
.cloud-request-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(23,90,155,.1); }
.cloud-request-form button,.cloud-request-form .cloud-message { grid-column: 1 / -1; }
.cloud-request-form button,.status-card > .primary-button { width: 100%; min-height: 52px; margin-top: 4px; }
.cloud-privacy-note,.cloud-wait-note { display: block; margin-top: 17px; color: #7d8792; font-size: 11px; line-height: 1.5; }
.cloud-message { padding: 11px 13px; border-radius: 11px; font-size: 13px; font-weight: 750; }
.cloud-message.error { background: var(--red-soft); color: var(--red-dark); }
.cloud-status-icon { width: 70px; height: 70px; display: grid; place-items: center; margin: 2px auto 15px; border-radius: 50%; font-size: 30px; font-weight: 950; }
.cloud-status-icon.pending { background: var(--blue-soft); color: var(--blue); animation: cloud-pulse 1.8s ease-in-out infinite; }
.cloud-status-icon.expired { background: #fff2dd; color: var(--orange); }
.cloud-license-list { display: grid; gap: 8px; margin: 3px 0 20px; text-align: left; }
.cloud-license { display: grid; grid-template-columns: 35px 1fr; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.cloud-license > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 950; }
.cloud-license.expired > span { background: var(--red-soft); color: var(--red); }
.cloud-license b,.cloud-license small { display: block; }
.cloud-license small { margin-top: 2px; color: var(--muted); }
@keyframes cloud-pulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(23,90,155,.07); } }

.module-card.cloud-locked { filter: grayscale(.45); opacity: .72; }
.module-card.cloud-locked .card-actions button { pointer-events: none; }
.access-status.cloud-license-active { background: var(--green-soft); color: var(--green); }
.access-status.cloud-license-locked { background: #f1f3f5; color: var(--muted); }

@media (max-width: 1050px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .quiz-layout { grid-template-columns: 1fr; }
  .quiz-panel { min-height: 210px; }
  .question-map { grid-template-columns: repeat(10, 1fr); }
  .finish-button { margin-top: 18px; }
  .exam-workarea { min-height: 310px; }
  .exam-summary-grid { grid-template-columns: repeat(7, 1fr); }
  .manual-shell { grid-template-columns: 1fr; }
  .manual-toc-resizer,
  .manual-content-resizer { display:none; }
  .manual-toc { position: static; max-height: none; }
  .manual-topics { max-height: 320px; }
  .manual-figure-page { overflow: visible; }
  .manual-presentation-button { display: none; }
  .manual-figure-layout { height:auto; grid-template-columns:1fr; overflow:visible; }
  .manual-signal-card { position:static; height:auto; }
  .manual-signal-card img { height:min(62vh,620px); }
  .manual-facts-scroll { height:auto; max-height:620px; }
}

@media (max-width: 780px) {
  .cloud-access-screen { align-items: start; padding: 18px 13px; }
  .cloud-access-card { margin-top: 10px; padding: 27px 20px; border-radius: 20px; }
  .cloud-access-card h1 { font-size: 31px; }
  .cloud-request-form { grid-template-columns: 1fr; }
  .cloud-request-form button,.cloud-request-form .cloud-message { grid-column: 1; }
  .mobile-only { display: inline-grid; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(0,0,0,.16); }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 20px 16px 45px; }
  .topbar { align-items: center; }
  .topbar > div:nth-child(2) { flex: 1; }
  .topbar h1 { font-size: 30px; }
  .data-badge { display: none; }
  .icon-button { width: 40px; height: 40px; place-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 26px; }
  .hero-mark { display: none; }
  .module-grid, .dashboard-strip { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .question-area { grid-template-columns: 1fr; }
  .question-image { max-height: 220px; }
  .quiz-card { min-height: 0; padding: 18px; }
  .question-map { grid-template-columns: repeat(6,1fr); }
  .result-hero { grid-template-columns: 1fr; text-align: center; }
  .result-reaction { margin: auto; }
  .result-badge { margin: auto; }
  .result-numbers { justify-content: center; }
  .chart-row { grid-template-columns: 90px 1fr 42px; }
  .setup-grid { grid-template-columns: 1fr; }
  .animated-mascot { width: 290px; height: 265px; }
  .startup-title strong { font-size: 38px; }
  .auth-card { padding: 24px; }
  .language-card { padding: 24px; }
  .language-choice-grid { grid-template-columns: 1fr; }
  .language-choice-grid button { min-height: 98px; }
  .quiz-head { align-items: flex-start; }
  .quiz-head-tools { align-items: flex-end; flex-direction: column; }
  .speaker-button span { display: none; }
  body.exam-mode .main-content { padding: 0; }
  .exam-stage { min-height: 100vh; justify-content: flex-start; }
  .exam-console { border: 0; border-radius: 0; }
  .exam-toolbar { grid-template-columns: 1fr auto; }
  .exam-brand { padding: 8px; }
  .exam-brand img { width: 55px; height: 50px; }
  .exam-brand b { font-size: 13px; }
  .exam-brand small { display: none; }
  .exam-question-position { display: none; }
  .exam-timer { min-width: 112px; padding: 8px; }
  .exam-timer b { font-size: 22px; }
  .exam-progress { grid-template-columns: repeat(10, 1fr); }
  .exam-workarea, .exam-workarea.has-image { min-height: 0; grid-template-columns: 1fr; padding: 22px 18px; }
  .exam-question-copy h2 { font-size: 23px; }
  .exam-question-image { max-height: 230px; }
  .exam-answer-row { padding: 12px; gap: 9px; }
  .exam-answer { min-height: 66px; gap: 8px; }
  .exam-answer > span { width: 39px; height: 39px; font-size: 20px; }
  .exam-answer b { font-size: 16px; }
  .exam-footer { grid-template-columns: 1fr 1fr; }
  .exam-watermark { display: none; }
  .exam-summary-button { grid-row: 2; }
  .exam-summary-body { padding: 20px 14px; }
  .exam-summary-grid { grid-template-columns: repeat(5, 1fr); }
  .exam-summary-footer { grid-template-columns: 1fr; }
  .exam-summary-footer > div { order: -1; }
  .official-exam-header { grid-template-columns: 1fr auto; min-height: 82px; padding: 8px; }
  .official-logo img { width: 58px; height: 55px; }
  .official-title { grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0; padding: 8px 14px; }
  .official-ministry small, .official-logo span { display: none; }
  .official-ministry > span { width: 48px; height: 48px; font-size: 13px; }
  .exam-group-tabs { grid-template-columns: repeat(2,1fr); }
  .official-exam .exam-progress { grid-template-columns: repeat(10,1fr); }
  .exam-live-tools { flex-wrap: wrap; }
  .official-exam .exam-answer-row { gap: 10px; }
  .official-footer { grid-template-columns: 1fr 1fr; }
  .official-footer .exam-timer, .official-footer .exam-summary-button { grid-column: span 2; }
  .classroom-feedback { grid-template-columns: 1fr; }
  .classroom-mascot { margin: auto; }
  .manual-page { padding: 25px 20px 34px; }
  .manual-page-head { display: grid; }
  .manual-tools { justify-content: flex-start; }
  .manual-callouts, .manual-figure-layout { grid-template-columns: 1fr; }
  .manual-signal-card { position: static; }
  .manual-book-nav { grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 10px; }
  .manual-book-nav button { min-width: 42px; padding-inline: 11px; }
  .manual-book-nav button span { display: none; }
  .manual-book-position { min-width: 105px; }
  .manual-signal-card img { height: 250px; }
  .manual-fact-list li { padding: 13px 12px; }
}
