/* Pixel Code Academy — stile arcade */
:root {
  --bg: #000;
  --panel: #141a2b;
  --navy: #0d1233;
  --line: #2a3352;
  --text: #f4f4f4;
  --muted: #a9b0c7;
  --yellow: #ffff00;
  --magenta: #ff1ae0;
  --cyan: #00f0ff;
  --red: #ff2a2a;
  --green: #39ff6a;
  --pixel: "Press Start 2P", monospace;
  --pixel-alt: "Press Start 2P", monospace;
  --body: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --c: var(--yellow);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.c-yellow { --c: var(--yellow); }
.c-magenta { --c: var(--magenta); }
.c-cyan { --c: var(--cyan); }
.c-green { --c: var(--green); }
.t-yellow { color: var(--yellow); }
.t-magenta { color: var(--magenta); }
.t-cyan { color: var(--cyan); }
.t-red { color: var(--red); }
.t-green { color: var(--green); }

/* ---- ticker ---- */
.ticker {
  background: var(--yellow);
  color: #000;
  font: 14px/1 var(--pixel);
  padding: 13px 0 11px;
  overflow: hidden;
  white-space: nowrap;
}
.ticker-track { display: inline-flex; animation: ticker 40s linear infinite; }
.ticker-track > span { padding-right: 2rem; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---- topbar ---- */
.topbar {
  width: min(940px, 100% - 32px);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: start;
  font: 12px/1.6 var(--pixel);
}
.score { display: flex; flex-direction: column; align-items: center; text-decoration: none; position: relative; }
.score:hover .score-value { color: var(--yellow); }
.score-value.bump { animation: bump .6s steps(3); color: var(--yellow); }
@keyframes bump { 30% { transform: scale(1.35); } }
.score-pop {
  position: absolute; top: 100%; left: 0; margin-top: 4px;
  color: var(--green); font: 12px var(--pixel); white-space: nowrap; pointer-events: none;
  animation: pop 1.6s steps(8) forwards;
}
@keyframes pop { to { transform: translateY(-34px); opacity: 0; } }
.score:first-child { align-items: flex-start; padding-left: 2.2rem; }
.score-value { color: #fff; letter-spacing: 1px; }
.topnav { display: flex; gap: 1.4rem; justify-content: flex-end; align-items: baseline; text-transform: uppercase; }
.nav-form { display: inline; margin: 0; }
.nav-form button { background: none; border: 0; padding: 0; color: var(--red); font: inherit; text-transform: uppercase; }
.nav-form button:hover { color: var(--yellow); }
.nav-player { color: var(--cyan); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav a { text-decoration: none; }
.topnav a:hover { color: var(--yellow); }

.logo {
  display: block;
  width: fit-content;
  margin: 64px auto 70px;
  padding: 0 16px;
  font: clamp(22px, 5vw, 52px)/1.2 var(--pixel);
  color: var(--yellow);
  text-decoration: none;
  text-align: center;
  text-shadow: 4px 4px 0 var(--red);
  letter-spacing: 2px;
}
.logo:hover { text-shadow: -4px 4px 0 var(--magenta), 4px -4px 0 var(--cyan); }

.wrap { width: min(980px, 100% - 32px); margin: 0 auto; flex: 1; }

/* ---- hero ---- */
.hero {
  width: min(744px, 100%);
  margin: 0 auto 64px;
  background: var(--navy);
  border: 5px solid var(--yellow);
  box-shadow: 0 0 22px rgba(255, 255, 0, .55), inset 0 0 18px rgba(255, 255, 0, .12);
  padding: 30px 40px 28px;
  text-align: center;
}
.hero h1 {
  margin: 0 0 18px;
  color: var(--yellow);
  font: clamp(17px, 3vw, 30px)/1.3 var(--pixel-alt);
  letter-spacing: 1px;
}
.hero p { margin: 0; font-size: 15.5px; }

/* ---- category cards ---- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 80px;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--panel);
  border: 5px solid var(--c);
  box-shadow: 6px 6px 0 var(--c);
  padding: 40px 22px 34px;
  text-decoration: none;
  transition: transform .12s steps(2), box-shadow .12s steps(2);
}
.cat-card:hover { transform: translate(-3px, -3px); box-shadow: 9px 9px 0 var(--c), 0 0 24px var(--c); }
.cat-card:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--c); }
.cat-count { position: absolute; top: 8px; right: 12px; color: var(--yellow); font: 11px var(--pixel); }
.cat-icon { color: var(--c); width: 56px; height: 56px; display: grid; place-items: center; }
.cat-icon svg { width: 52px; height: 52px; }
.cat-card h2 { margin: 20px 0 12px; font: 21px/1.2 var(--pixel-alt); }
.cat-card p { margin: 0; font-size: 14.5px; line-height: 1.5; }

/* ---- posts ---- */
.section-title {
  font: 16px/1.4 var(--pixel);
  color: var(--yellow);
  margin: 0 0 28px;
  text-transform: uppercase;
}
.latest { margin-bottom: 72px; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 26px;
  margin-bottom: 40px;
}
.post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 3px solid var(--line);
  border-top: 6px solid var(--c);
  padding: 20px;
  text-decoration: none;
  transition: border-color .1s, transform .1s;
}
.post-card:hover { border-color: var(--c); transform: translateY(-3px); }
.post-card:hover .play { color: var(--c); }
.post-cover { width: calc(100% + 40px); margin: -20px -20px 6px; aspect-ratio: 16/9; object-fit: cover; display: block; }
.post-card h3 { margin: 0; font: 700 19px/1.3 var(--body); }
.post-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pts { font: 10px/1 var(--pixel); color: var(--yellow); white-space: nowrap; }
.pts.done { color: var(--green); }
.post-card.is-done { border-color: rgba(57, 255, 106, .35); }
.post-card p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.post-meta { display: flex; justify-content: space-between; font: 10px var(--pixel); color: var(--muted); margin-top: 6px; }
.tag {
  align-self: flex-start;
  display: inline-block;
  color: var(--c);
  font: 10px/1 var(--pixel);
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid var(--c);
  padding: 6px 8px 5px;
}
.empty { color: var(--muted); font-family: var(--pixel); font-size: 12px; line-height: 1.8; }

/* ---- category page ---- */
.cat-tabs { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 28px; }
.cat-tabs a {
  font: 11px var(--pixel);
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 14px 9px;
  border: 3px solid var(--c);
  color: var(--c);
}
.cat-tabs a.on, .cat-tabs a:hover { background: var(--c); color: #000; }
.cat-head {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--panel);
  border: 5px solid var(--c);
  box-shadow: 6px 6px 0 var(--c);
  padding: 26px 30px;
  margin-bottom: 28px;
}
.cat-head h1 { margin: 0 0 10px; font: 22px/1.2 var(--pixel-alt); color: var(--c); }
.cat-head p { margin: 0; }
.search { display: flex; gap: 10px; margin-bottom: 28px; }
.search input { flex: 1; }

/* ---- article ---- */
.article {
  max-width: 760px;
  margin: 0 auto 72px;
}
.article-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.article h1 {
  font: clamp(20px, 3.4vw, 30px)/1.45 var(--pixel);
  color: var(--c);
  margin: 0 0 14px;
  text-shadow: 3px 3px 0 rgba(255, 42, 42, .7);
}
.article-meta { font: 10px var(--pixel); color: var(--muted); margin: 0 0 28px; }
.article-cover { width: 100%; border: 4px solid var(--c); margin-bottom: 24px; display: block; }
.lead { font-size: 19px; line-height: 1.55; border-left: 5px solid var(--c); padding-left: 18px; margin: 0 0 32px; }

.prose { font-size: 17px; line-height: 1.75; }
.prose h2, .prose h3, .prose h4 { font-family: var(--pixel-alt); font-weight: 400; color: var(--c, var(--yellow)); line-height: 1.5; margin: 1.8em 0 .6em; }
.prose h2 { font-size: 18px; }
.prose h3 { font-size: 15px; }
.prose h4 { font-size: 13px; }
.prose a { color: var(--cyan); }
.prose code { font-family: var(--mono); font-size: .88em; background: var(--navy); border: 1px solid var(--line); padding: 1px 6px; }
.prose pre.code {
  position: relative;
  background: #070b1f;
  border: 3px solid var(--line);
  box-shadow: 5px 5px 0 var(--line);
  padding: 22px 20px 18px;
  overflow-x: auto;
  margin: 1.4em 0;
  line-height: 1.6;
}
.prose pre.code code { background: none; border: 0; padding: 0; color: var(--green); font-size: 14.5px; line-height: 1.6; }
.code-lang { position: absolute; top: 0; right: 0; background: var(--line); color: var(--muted); font: 9px var(--pixel); padding: 5px 8px 4px; text-transform: uppercase; }
.prose blockquote { margin: 1.4em 0; padding: 14px 20px; border-left: 6px solid var(--magenta); background: var(--panel); font-style: italic; }
.prose img { display: block; border: 3px solid var(--line); margin: 1.4em auto; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul { list-style: square; }
.prose li::marker { color: var(--c, var(--yellow)); }
.prose hr { border: 0; border-top: 4px dashed var(--line); margin: 2em 0; }

/* ---- quest (punti a fine articolo) ---- */
.quest {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  margin-top: 48px; padding: 24px 26px;
  background: var(--navy); border: 5px solid var(--c); box-shadow: 6px 6px 0 var(--c);
}
.quest-points { text-align: center; min-width: 96px; color: var(--c); }
.quest-points strong { display: block; font: 26px/1 var(--pixel); }
.quest-points span { font: 10px var(--pixel); text-transform: uppercase; color: var(--muted); }
.quest-body { flex: 1 1 260px; }
.quest-body h2 { margin: 0 0 8px; font: 15px/1.4 var(--pixel); color: var(--c); }
.quest-body p { margin: 0; }
.quest-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 0; }
.quest.done { --c: var(--green); }
.quest.claimed { animation: flash-ok .5s steps(2) 3; }
@keyframes flash-ok { 50% { background: rgba(57, 255, 106, .2); } }

/* ---- profilo ---- */
.profile-head {
  display: grid; grid-template-columns: 1fr auto auto; gap: 20px; align-items: stretch; margin-bottom: 28px;
}
.profile-head > div:first-child { background: var(--panel); border: 5px solid var(--cyan); box-shadow: 6px 6px 0 var(--cyan); padding: 22px 26px; }
.profile-kicker { margin: 0 0 10px; font: 10px var(--pixel); color: var(--muted); text-transform: uppercase; }
.profile-head h1 { margin: 0 0 10px; font: clamp(18px, 3vw, 26px)/1.3 var(--pixel); color: var(--cyan); word-break: break-all; }
.profile-since { margin: 0; color: var(--muted); font-size: 14px; }
.profile-score, .profile-rank {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
  background: var(--navy); border: 5px solid var(--yellow); box-shadow: 0 0 18px rgba(255, 255, 0, .4);
  padding: 18px 26px; text-decoration: none;
}
.profile-rank { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255, 26, 224, .4); }
.profile-score span, .profile-rank span { font: 10px var(--pixel); color: var(--muted); text-transform: uppercase; }
.profile-score strong { font: 24px var(--pixel); color: var(--yellow); }
.profile-rank strong { font: 24px var(--pixel); color: var(--magenta); }
.progress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 28px; }
.progress { display: block; background: var(--panel); border: 3px solid var(--c); padding: 16px 18px; text-decoration: none; }
.progress-label { display: flex; justify-content: space-between; font: 11px var(--pixel); color: var(--c); text-transform: uppercase; margin-bottom: 14px; }
.progress-label em { font-style: normal; color: var(--text); }
.progress-bar { display: block; height: 16px; background: #070b1f; border: 2px solid var(--line); }
.progress-bar span { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--c) 0 10px, transparent 10px 12px); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 2px dotted var(--line); }
.history li:first-child { border-top: 0; }
.h-title a { text-decoration: none; font-weight: 700; }
.h-title a:hover { color: var(--yellow); }
.h-date { color: var(--muted); font-size: 13px; }
.history strong { font: 12px var(--pixel); color: var(--green); }
.panel + .latest { margin-top: 48px; }

/* ---- classifica ---- */
.lb-wrap { max-width: 744px; margin: 0 auto 72px; }
.leaderboard { list-style: none; margin: 0; padding: 0; font: 13px/1.4 var(--pixel); }
.leaderboard li {
  display: grid; grid-template-columns: 3.5em 1fr auto auto; gap: 18px; align-items: center;
  padding: 14px 18px; border-bottom: 2px dotted var(--line);
}
.leaderboard li:nth-child(1) { color: var(--yellow); font-size: 15px; }
.leaderboard li:nth-child(2) { color: var(--cyan); }
.leaderboard li:nth-child(3) { color: var(--magenta); }
.leaderboard li.me { background: rgba(255, 255, 0, .1); outline: 3px solid var(--yellow); }
.lb-rank::after { content: "°"; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-done { font-size: 9px; color: var(--muted); }
.lb-cta { text-align: center; margin-top: 32px; }

/* ---- credits / 404 ---- */
.credit-list { list-style: none; padding: 0; margin: 26px 0 0; text-align: left; font: 11px/1.6 var(--pixel); }
.credit-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 2px dotted var(--line); }
.credit-list li span:first-child { color: var(--cyan); }
.gameover h1 { color: var(--red); font-family: var(--pixel); }
.gameover p { margin-bottom: 26px; }

/* ---- footer ---- */
.footer {
  border-top: 4px solid var(--yellow);
  margin-top: 40px;
  padding: 22px 16px;
  display: flex;
  justify-content: center;
  gap: 24px 40px;
  flex-wrap: wrap;
  font: 10px var(--pixel);
  color: var(--muted);
}
.footer p { margin: 0; }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- forms & buttons ---- */
input, select, textarea {
  width: 100%;
  background: #070b1f;
  color: var(--text);
  border: 3px solid var(--line);
  padding: 11px 12px;
  font: 15px/1.4 var(--body);
  border-radius: 0;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--yellow); box-shadow: 0 0 10px rgba(255, 255, 0, .35); }
input:invalid:not(:placeholder-shown):not(:focus) { border-color: var(--red); }
textarea { resize: vertical; }
#f-content { font: 14.5px/1.65 var(--mono); min-height: 380px; }
label { display: block; font: 10px/1 var(--pixel); text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
label > input, label > textarea, label > select { margin-top: 10px; }

.btn, button {
  font: 11px/1 var(--pixel);
  text-transform: uppercase;
  cursor: pointer;
}
.btn {
  display: inline-block;
  background: var(--yellow);
  color: #000;
  border: 0;
  padding: 14px 18px 13px;
  text-decoration: none;
  box-shadow: 4px 4px 0 var(--red);
  transition: transform .08s, box-shadow .08s;
  white-space: nowrap;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--red); }
.btn.small { padding: 10px 12px 9px; font-size: 10px; box-shadow: 3px 3px 0 var(--red); }
.btn.ghost { background: transparent; color: var(--yellow); border: 3px solid var(--yellow); box-shadow: none; padding: 11px 14px 10px; }
.btn.ghost:hover { background: var(--yellow); color: #000; }
.btn.block { width: 100%; margin-top: 10px; }
.search button, .filters button { flex: none; }
.search button { background: var(--yellow); color: #000; border: 0; padding: 0 18px; }

.panel {
  background: var(--panel);
  border: 4px solid var(--line);
  padding: 22px;
}
.panel h2 { font: 11px var(--pixel); color: var(--yellow); text-transform: uppercase; margin: 0 0 16px; }
.login { max-width: 480px; margin: 0 auto 72px; border-color: var(--yellow); box-shadow: 0 0 22px rgba(255, 255, 0, .35); padding: 32px; }
.login h1 { font: 18px/1.4 var(--pixel); color: var(--yellow); margin: 0 0 26px; text-align: center; }
.login-intro { margin: -10px 0 24px; text-align: center; color: var(--muted); font-size: 15px; }
.form-switch { margin: 22px 0 0; text-align: center; font-size: 15px; color: var(--muted); }
.form-switch a { color: var(--cyan); }
.login .btn { width: 100%; margin-top: 6px; }

.form-error { background: rgba(255, 42, 42, .15); border: 3px solid var(--red); color: #fff; padding: 12px 14px; margin: 0 0 22px; font-size: 14.5px; }
.flash { background: rgba(57, 255, 106, .12); border: 3px solid var(--green); padding: 12px 16px; margin-bottom: 26px; font: 11px/1.6 var(--pixel); }
.flash.warn { background: rgba(255, 26, 224, .12); border-color: var(--magenta); }

/* ---- backoffice ---- */
.is-admin .logo { margin: 34px auto 26px; font-size: clamp(16px, 3vw, 26px); }
.is-admin .wrap, .is-admin .admin-bar { width: min(1240px, 100% - 32px); }
.admin-table td:first-child { min-width: 240px; }
.admin-table small { display: block; overflow-wrap: anywhere; }
.admin-bar {
  width: min(980px, 100% - 32px);
  margin: 0 auto 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 3px solid var(--line);
  background: var(--panel);
  padding: 8px;
}
.admin-bar a, .admin-bar button {
  font: 10px/1 var(--pixel);
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 12px 9px;
  background: none;
  border: 0;
  color: var(--text);
}
.admin-bar a:hover, .admin-bar button:hover { color: var(--yellow); }
.admin-bar a.on { background: var(--yellow); color: #000; }
.admin-bar form { margin-left: auto; }
.admin-bar button { color: var(--red); }

.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.admin-head h1 { font: 20px/1.3 var(--pixel); color: var(--yellow); margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--panel); border: 3px solid var(--c); box-shadow: 4px 4px 0 var(--c); padding: 16px 18px; }
.stat span { display: block; font: 9px var(--pixel); color: var(--muted); text-transform: uppercase; margin-bottom: 12px; }
.stat strong { font: 22px var(--pixel); color: var(--c); }

.filters { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.filters input { flex: 2 1 220px; width: auto; }
.filters select { flex: 1 1 160px; width: auto; }

.table-wrap { overflow-x: auto; border: 3px solid var(--line); margin-bottom: 60px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 900px; }
.points-form { display: flex; gap: 4px; margin: 0; }
.points-form input { width: 88px; padding: 6px 8px; font: 12px var(--mono); border-width: 2px; }
.points-form button { background: var(--navy); color: var(--yellow); border: 2px solid var(--line); padding: 0 8px; font-size: 9px; }
.points-form button:hover { border-color: var(--yellow); }
.score-cell { font: 12px var(--pixel); color: var(--yellow); }
.points-field { display: flex; align-items: center; gap: 10px; }
.points-field input { font: 16px var(--pixel); color: var(--yellow); }
.points-field span { font: 11px var(--pixel); color: var(--muted); }
.editor-side .hint { font-size: 12.5px; }
.admin-table th { text-align: left; font: 9px var(--pixel); color: var(--muted); text-transform: uppercase; background: var(--navy); padding: 14px 14px 12px; }
.admin-table td { padding: 14px; border-top: 2px solid var(--line); vertical-align: middle; }
.admin-table tr:hover td { background: rgba(255, 255, 255, .025); }
.row-title { font-weight: 700; text-decoration: none; display: block; }
.row-title:hover { color: var(--yellow); }
.admin-table small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.status { font: 9px/1 var(--pixel); text-transform: uppercase; padding: 6px 8px 5px; display: inline-block; }
.s-pubblicato { background: var(--green); color: #000; }
.s-bozza { border: 2px solid var(--muted); color: var(--muted); }
.actions { white-space: nowrap; text-align: right; }
.actions a, .actions .link { font: 9px var(--pixel); text-transform: uppercase; color: var(--cyan); background: none; border: 0; padding: 4px 6px; text-decoration: none; }
.actions a:hover, .actions .link:hover { text-decoration: underline; }
.actions form { display: inline; }
.actions .danger { color: var(--red); }

.editor { display: grid; grid-template-columns: 1fr 290px; gap: 26px; align-items: start; margin-bottom: 60px; }
.editor-side { display: grid; gap: 18px; position: sticky; top: 16px; }
.radio { display: flex; align-items: center; gap: 10px; font: 11px var(--pixel); color: var(--text); margin-bottom: 14px; cursor: pointer; }
.radio input { width: auto; accent-color: var(--yellow); margin: 0; }
.cover-preview { margin-top: 12px; width: 100%; aspect-ratio: 16/9; object-fit: cover; border: 3px solid var(--line); display: block; }

.md-field { margin-bottom: 20px; }
.md-tabs { display: flex; gap: 4px; }
.md-tabs button { background: var(--panel); color: var(--muted); border: 3px solid var(--line); border-bottom: 0; padding: 10px 14px 8px; font-size: 10px; }
.md-tabs button.on { background: var(--yellow); color: #000; border-color: var(--yellow); }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; background: var(--panel); border: 3px solid var(--line); border-bottom: 0; padding: 6px; }
.md-toolbar button { background: var(--navy); color: var(--text); border: 2px solid var(--line); padding: 7px 9px 6px; font: 10px var(--pixel); text-transform: none; }
.md-toolbar button:hover { border-color: var(--yellow); color: var(--yellow); }
.md-preview { border: 3px solid var(--line); background: #070b1f; min-height: 380px; padding: 6px 24px 20px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.hint code { font: 12px var(--mono); color: var(--text); }

/* ---- responsive ---- */
@media (max-width: 860px) {
  .cat-grid { grid-template-columns: 1fr; max-width: 420px; margin-inline: auto; }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .profile-head { grid-template-columns: 1fr 1fr; }
  .profile-head > div:first-child { grid-column: 1 / -1; }
  .progress-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { grid-template-columns: 1fr 1fr; row-gap: 14px; font-size: 10px; }
  .score:first-child { padding-left: 0; }
  .topnav { grid-column: 1 / -1; justify-content: center; }
  .logo { margin: 40px auto 44px; }
  .hero { padding: 24px 20px; }
  .cat-head { flex-direction: column; text-align: center; padding: 22px; }
  .admin-bar form { margin-left: 0; }
  .history li { grid-template-columns: 1fr auto; }
  .history .tag, .h-date { display: none; }
  .leaderboard li { grid-template-columns: 2.5em 1fr auto; gap: 10px; font-size: 11px; }
  .lb-done { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track, .blink { animation: none; }
}

/* ---- layout con colonna laterale + mini gioco ---- */
.layout {
  width: calc(100% - 32px);
  margin: 0 auto;
  flex: 1;
  display: grid;
  /* colonna centrale per i contenuti, simmetrica: il gioco sta nella colonna destra */
  grid-template-columns: minmax(330px, 1fr) minmax(0, 980px) minmax(330px, 1fr);
  align-items: start;
}
.layout > .wrap { grid-column: 2; width: auto; margin: 0; min-width: 0; }
.side { grid-column: 3; grid-row: 1; width: 300px; margin: 0 0 60px 30px; }
@media (min-width: 1281px) and (min-height: 860px) { .side { position: sticky; top: 20px; } }
.side-left { grid-column: 1; justify-self: end; margin: 0 30px 60px 0; }
.game-banner {
  background: var(--navy);
  border: 5px solid var(--magenta);
  box-shadow: 6px 6px 0 var(--magenta), 0 0 22px rgba(255, 26, 224, .35);
  padding: 18px 16px 16px;
  text-align: center;
  font-family: var(--pixel);
  display: flex; flex-direction: column; justify-content: center;
}
.game-title { margin: 0 0 12px; font: 15px/1.3 var(--pixel); color: var(--magenta); text-shadow: 3px 3px 0 #000; letter-spacing: 1px; }
.game-scores { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-bottom: 10px; }
.game-scores b { color: var(--yellow); font-weight: normal; }
.game-screen { position: relative; border: 3px solid var(--line); background: #000; line-height: 0; }
#snake { width: 100%; height: auto; image-rendering: pixelated; display: block; outline: none; }
#snake:focus-visible { box-shadow: 0 0 0 3px var(--cyan); }
.game-overlay {
  position: absolute; inset: 0; width: 100%;
  background: rgba(0, 0, 0, .72); color: var(--yellow); border: 0; cursor: pointer;
  font: 11px/1.8 var(--pixel); white-space: pre-line; animation: blink-soft 1s steps(2) infinite;
}
.game-overlay:hover { color: #fff; }
@keyframes blink-soft { 50% { opacity: .65; } }
.game-pad {
  display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 40px);
  gap: 4px; justify-content: center; margin: 12px 0 4px;
}
.game-pad button {
  background: var(--panel); color: var(--cyan); border: 2px solid var(--line);
  font: 12px var(--pixel); cursor: pointer; touch-action: manipulation;
}
.game-pad button:active, .game-pad button:hover { border-color: var(--cyan); }
.game-pad [data-dir="up"] { grid-column: 2; }
.game-pad [data-dir="left"] { grid-column: 1; grid-row: 2; }
.game-pad [data-dir="down"] { grid-column: 2; grid-row: 2; }
.game-pad [data-dir="right"] { grid-column: 3; grid-row: 2; }
.game-help { margin: 8px 0 0; font: 8px/1.9 var(--pixel); color: var(--muted); }

/* ---- pannello player (colonna sinistra) ---- */
.player-panel {
  background: var(--navy);
  border: 5px solid var(--cyan);
  box-shadow: -6px 6px 0 var(--cyan), 0 0 22px rgba(0, 240, 255, .3);
  padding: 18px 16px 16px;
  font-family: var(--pixel);
  display: flex; flex-direction: column;
}
/* i due riquadri laterali hanno la stessa altezza (vedi snake.js): lo spazio in più va in fondo */
.player-panel > .pp-bars:last-child, .player-panel > .pp-coin:last-child { margin-top: auto; }
.player-panel > .pp-all { margin-bottom: 18px; }
.player-panel > .pp-you { margin-top: 0; }
.pp-title { margin: 0 0 14px; text-align: center; font: 15px/1.3 var(--pixel); color: var(--cyan); text-shadow: 3px 3px 0 #000; letter-spacing: 1px; }
.pp-top { list-style: none; margin: 0; padding: 0; font: 10px/1.4 var(--pixel); }
.pp-top li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: center; padding: 8px 6px; border-top: 2px dotted var(--line); }
.pp-top li:first-child { border-top: 0; }
.pp-top li:nth-child(1) { color: var(--yellow); }
.pp-top li:nth-child(2) { color: var(--cyan); }
.pp-top li:nth-child(3) { color: var(--magenta); }
.pp-top li.me { background: rgba(255, 255, 0, .1); outline: 2px solid var(--yellow); }
.pp-rank::after { content: "°"; }
.pp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-all { display: block; margin: 12px 0 0; text-align: right; font-size: 8px; color: var(--muted); text-decoration: none; }
.pp-all:hover { color: var(--yellow); }
.pp-empty { font: 9px/1.9 var(--pixel); color: var(--muted); text-align: center; margin: 6px 0; }
.pp-you { margin: 16px 0 0; padding: 12px 0 0; border-top: 3px solid var(--line); text-align: center; font: 9px/2 var(--pixel); color: var(--muted); }
.pp-you b { font: 18px var(--pixel); color: #fff; }
.pp-head { margin: 18px 0 10px; font: 10px var(--pixel); color: var(--cyan); text-transform: uppercase; }
.pp-quest {
  display: block; text-decoration: none; background: var(--panel);
  border: 3px solid var(--c); box-shadow: 4px 4px 0 var(--c); padding: 12px;
}
.pp-quest:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--c); }
.pp-quest-cat { display: block; font-size: 8px; color: var(--c); text-transform: uppercase; }
.pp-quest-title { display: block; margin: 8px 0; font: 600 15px/1.35 var(--body); color: var(--text); }
.pp-quest-pts { font-size: 9px; color: var(--green); }
.pp-bars { padding-top: 18px; display: grid; gap: 12px; }
.pp-bar { display: block; text-decoration: none; }
.pp-bar > span:first-child { display: flex; justify-content: space-between; font-size: 8px; color: var(--c); text-transform: uppercase; margin-bottom: 6px; }
.pp-bar em { font-style: normal; color: var(--text); }
.pp-bar .progress-bar { height: 12px; }
.pp-coin { padding-top: 16px; border-top: 3px solid var(--line); text-align: center; }
.pp-coin .blink { margin: 0 0 10px; font: 12px var(--pixel); color: var(--yellow); }
.pp-coin p { margin: 0 0 12px; font: 14px/1.5 var(--body); }
.pp-login { font-size: 13px !important; color: var(--muted); }
.pp-login a { color: var(--cyan); }

@media (max-width: 1280px) {
  .layout { grid-template-columns: minmax(0, 1fr); width: min(980px, 100% - 32px); }
  .layout > .wrap, .side { grid-column: 1; grid-row: auto; }
  .side-left { justify-self: auto; }
  .side { width: min(340px, 100%); margin: 0 auto 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-overlay { animation: none; }
}

/* maiuscole accentate nel font pixel: lettera semplice + accento a pixel (1 pixel = .125em) */
.acc { position: relative; display: inline-block; }
.acc::before {
  content: ""; position: absolute; top: -.375em; left: .25em;
  width: .25em; height: .125em; background: currentColor;
  box-shadow: .125em .125em 0 currentColor;
}
.acc-acute::before { left: .375em; box-shadow: -.125em .125em 0 currentColor; }

/* ---- quiz a fine articolo ---- */
.quest.quiz { align-items: flex-start; }
.quiz-form { flex: 1 1 100%; margin: 0; }
.quiz-result { margin-top: 10px !important; color: var(--red); font-size: 14px; }
.quiz-q { border: 3px solid var(--line); background: #070b1f; margin: 0 0 16px; padding: 14px 16px 8px; min-width: 0; }
.quiz-q legend { display: flex; gap: 12px; align-items: baseline; padding: 0 8px; font: 600 16px/1.45 var(--body); color: var(--text); }
.quiz-q legend span { font: 12px var(--pixel); color: var(--c); }
.quiz-q legend b { font-weight: inherit; }
.quiz-opt {
  display: flex; gap: 12px; align-items: center; margin: 0 0 6px; padding: 7px 12px;
  font: 15px/1.4 var(--body); text-transform: none; color: var(--text);
  border: 2px solid transparent; cursor: pointer;
}
.quiz-opt:hover { border-color: var(--line); }
.quiz-opt:has(input:checked) { border-color: var(--c); background: rgba(255, 255, 255, .04); }
.quiz-opt input { width: auto; margin: 0; flex: none; accent-color: var(--c); }
.quiz-form button[disabled] { opacity: .55; cursor: not-allowed; }
.quiz-preview { margin: 14px 0 0; padding-left: 1.4em; }
.quiz-preview > li { margin-bottom: 10px; }
.quiz-preview ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--muted); }
.quiz-preview li.ok { color: var(--green); }
.quiz-field textarea { font: 14px/1.6 var(--mono); text-transform: none; }
.quiz-field { margin: 26px 0 0; }
