/* Corazze · interfaccia
   Una sala briefing, non un sito: superfici scure e opache, righe sottili, un solo accento (ambra segnale)
   riservato all'azione principale e al fuoco. Font di sistema, cifre tabulari, niente glow decorativi. */
:root {
  --bg: #0b0d12;
  --surface: rgba(255, 255, 255, .035);
  --surface-hi: rgba(255, 255, 255, .06);
  --material: rgba(16, 19, 26, .78);
  --line: rgba(255, 255, 255, .085);
  --line-hi: rgba(255, 255, 255, .16);
  --text: #e9ecf1;
  --muted: #8f97a6;          /* 6,6:1 su --bg */
  --faint: #7a8291;          /* 4,9:1 su --bg */
  --accent: #f5b942;         /* ambra segnale: azione principale e fuoco */
  --on-accent: #1a1204;
  --live: #3ddc97;
  --danger: #ff6b6b;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --spring: cubic-bezier(.2, .9, .25, 1);       /* molla smorzata, senza rimbalzo */
  --t-fast: 120ms; --t-med: 220ms;
  --font: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
canvas { display: block; cursor: crosshair; }
b, strong { font-weight: 650; }
.hidden { display: none !important; }

/* ---------- controlli ---------- */
input, select, button { font: inherit; color: var(--text); }
input, select { background: rgba(0, 0, 0, .35); border: 1px solid var(--line-hi); border-radius: var(--r-sm); padding: 9px 12px; min-height: 40px; }
input::placeholder { color: var(--faint); }
input[type=color] { padding: 3px; width: 44px; height: 40px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input[type=range] { accent-color: var(--accent); min-height: 0; padding: 0; border: 0; background: none; }
button { cursor: pointer; background: var(--surface-hi); border: 1px solid var(--line-hi); border-radius: var(--r-sm); padding: 9px 16px; min-height: 40px;
  transition: background var(--t-fast) ease-out, border-color var(--t-fast) ease-out, transform var(--t-fast) ease-out; }
button:hover { background: rgba(255, 255, 255, .1); }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 650; padding: 10px 24px; }
button.primary:hover { background: #ffc85c; }
button.ghost { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }

/* ---------- livelli sopra il gioco ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 24px 16px;
  background: rgba(5, 6, 9, .58); }
.overlay:not(.menu) { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.overlay:not(.menu):not(.hidden) .panel { animation: arrive var(--t-med) var(--spring); }
@keyframes arrive { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.panel { background: var(--material); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--line); border-top-color: var(--line-hi); border-radius: var(--r-lg); padding: 24px;
  width: min(860px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 24px 64px rgba(0, 0, 0, .55); }
.panel.small { width: min(460px, 100%); }
.panel.wide { width: min(1120px, 100%); }
.panel h2 { margin: 0 0 16px; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; font-weight: 700; }

/* ---------- menu ---------- */
/* dietro c'è una battaglia vera (dimostrazione): a sinistra un velo scuro per leggere, a destra la si vede */
.menu { display: block; padding: 0; background:
  linear-gradient(90deg, rgba(7, 9, 13, .94) 0%, rgba(7, 9, 13, .82) 30%, rgba(7, 9, 13, .25) 60%, rgba(7, 9, 13, .05) 100%),
  linear-gradient(0deg, rgba(7, 9, 13, .7) 0%, rgba(7, 9, 13, 0) 30%); }
.deck { position: relative; width: 100%; }
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: 22px; max-width: 560px;
  padding: 56px clamp(20px, 5vw, 80px) 96px; }
.kicker { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.wordmark { margin: -6px 0 0 -4px; font-size: clamp(64px, 9vw, 132px); line-height: .88; font-weight: 850; letter-spacing: -.05em;
  text-shadow: 0 10px 40px rgba(0, 0, 0, .55); }
.lede { margin: 0; color: #b6bdca; font-size: 17px; line-height: 1.55; max-width: 40ch; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 550; max-width: 340px; }
.field input { font-size: 16px; background: rgba(0, 0, 0, .45); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12px; line-height: 1; font-weight: 650;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px rgba(61, 220, 151, .18); }
.status { margin: 0; color: var(--accent); font-size: 14px; }
.status:empty { display: none; }

/* stanze online: l'azione principale, schede con la loro scena */
.rooms { display: flex; flex-direction: column; gap: 10px; }
.room { display: grid; grid-template-columns: 168px 1fr; gap: 16px; align-items: center; text-align: left; padding: 8px 16px 8px 8px; border-radius: var(--r-lg);
  background: rgba(12, 15, 21, .72); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.room:hover { background: rgba(20, 24, 32, .85); border-color: rgba(245, 185, 66, .6); }
.room .frame { border-radius: 10px; }
.room .mHead b { font-size: 18px; }
.room .count { display: flex; align-items: center; gap: 7px; color: var(--live); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.room .pip { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.room .of { color: var(--faint); font-weight: 500; margin-left: -4px; }
.room .mDesc { font-size: 13px; }
.room:hover .chev, .modeTile:hover .chev { color: var(--accent); transform: translateX(2px); }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; }
.link { background: none; border: 0; padding: 8px 0; min-height: 40px; color: var(--text); font-weight: 550; }
.link:hover { background: none; color: var(--accent); }
.help { color: var(--muted); font-size: 14px; flex-basis: 100%; }
.links .help { flex-basis: auto; }
.help[open] { flex-basis: 100%; }
.help summary { cursor: pointer; padding: 8px 0; min-height: 40px; color: var(--text); font-weight: 550; list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after, details.custom > summary::after { content: '+'; margin-left: 8px; color: var(--faint); }
.help[open] summary::after, details.custom[open] > summary::after { content: '–'; }
.help ul { margin: 4px 0 0; padding: 12px 14px 12px 30px; background: rgba(12, 15, 21, .72); border: 1px solid var(--line); border-radius: var(--r-md); }
.help li { margin: 4px 0; }
.help b { color: var(--text); font-weight: 600; }

.scrollCue { position: absolute; top: calc(100svh - 64px); left: clamp(20px, 5vw, 80px); display: flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.scrollCue svg { width: 16px; height: 16px; animation: nudge 2.4s ease-in-out infinite; }
.scrollCue:hover { color: var(--text); }
@keyframes nudge { 50% { transform: translateY(3px); } }

/* modalità: scene illustrate con la grafica del gioco */
.modes { position: relative; padding: 140px clamp(20px, 5vw, 80px) 72px;
  background: linear-gradient(180deg, rgba(11, 13, 18, 0) 0, rgba(11, 13, 18, .92) 110px, var(--bg) 200px); }
.modesHead { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 24px; max-width: 1480px; }
.modesHead h2 { margin: 0; font-size: clamp(30px, 3.2vw, 44px); line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.modesHead p { margin: 0; color: var(--muted); }
.modeGrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 20px; max-width: 1480px; }
.modeTile { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; background: none; border: 0; padding: 0; border-radius: var(--r-md); }
.modeTile:hover { background: none; }
.frame { display: block; position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: var(--r-md); background: #0c0f15;
  border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0, 0, 0, .35); transition: border-color var(--t-fast) ease-out, box-shadow var(--t-med) ease-out; }
.art { display: block; width: 100%; height: 100%; transition: transform 420ms var(--spring); }
.modeTile:hover .frame { border-color: rgba(245, 185, 66, .65); box-shadow: 0 16px 40px rgba(0, 0, 0, .5), 0 0 0 1px rgba(245, 185, 66, .25); }
.modeTile:hover .art, .room:hover .art { transform: scale(1.06); }
.mBody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mHead { display: flex; align-items: baseline; gap: 10px; }
.mHead b { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.mHead .chev { margin-left: auto; align-self: center; }
.idx { color: var(--faint); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mTag { margin-left: auto; color: var(--faint); font-size: 12px; font-weight: 600; white-space: nowrap; }
.mDesc { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.chev { flex: none; width: 16px; height: 16px; color: var(--faint); transition: transform var(--t-fast) var(--spring), color var(--t-fast) ease-out; }

/* scenario personalizzato */
details.custom { margin-top: 20px; color: var(--muted); }
details.custom > summary { cursor: pointer; list-style: none; padding: 10px 0; min-height: 40px; color: var(--text); font-weight: 550; }
details.custom > summary::-webkit-details-marker { display: none; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 6px 0 16px; }
.presets label { flex: 1 1 240px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px 16px; margin: 0 0 14px; background: var(--surface); min-width: 0; }
legend { padding: 0 6px; color: var(--text); font-weight: 650; font-size: 14px; }
label { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 13px; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); }
.range { display: flex; gap: 10px; align-items: center; }
.range input { flex: 1; }
output { min-width: 34px; color: var(--text); font-variant-numeric: tabular-nums; }
.teamHead, .teamRow { display: grid; grid-template-columns: 48px 1fr 80px 130px 90px 40px; gap: 8px; align-items: center; }
.teamHead { color: var(--faint); font-size: 12px; margin-top: 4px; }
.teamRow { margin-top: 8px; }
.teamRow .radio { display: flex; justify-content: center; }
.teamRow button { padding: 6px 0; }
#btnAddTeam { margin-top: 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 16px; }
.actions.col { flex-direction: column; align-items: stretch; }
#summary { margin-right: auto; color: var(--muted); font-size: 14px; }

/* tabelle (fine partita) */
table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-variant-numeric: tabular-nums; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 550; font-size: 12px; }
td:not(:first-child), th:not(:first-child) { text-align: right; }
#endBody table:last-child td:nth-child(2), #endBody table:last-child th:nth-child(2) { text-align: left; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }

/* albero delle classi */
#treeBody h3 { margin: 28px 0 10px; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.treeGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.treeCard { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; }
.treeCard canvas { flex: none; background: rgba(0, 0, 0, .3); border-radius: var(--r-sm); }
.treeCard p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.treeCard small { color: var(--faint); }
.nem { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 600; }
.nem .prey { color: #7bd88f; }
.nem .hunter { color: #ff8a8a; }
.tag { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--accent); }
.puIcon { flex: none; width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; color: #10131a; font-weight: 800; font-size: 16px; }

.mapHint { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.mapInfo { position: sticky; top: -24px; z-index: 3; background: var(--material); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: 12px; min-height: 76px; }
.mapInfo p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.mapInfo small { color: var(--faint); }
.mapInfo .nem { flex-direction: row; gap: 16px; flex-wrap: wrap; }
.mapScroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
.classMap { position: relative; margin: 0 auto; }
.mapLines { position: absolute; inset: 0; pointer-events: none; }
.mapLines path { opacity: .6; transition: opacity var(--t-med) ease-out; }
.mapLines path.dim { opacity: .1; }
.mapCol { position: absolute; top: 0; text-align: center; color: var(--muted); font-weight: 650; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.mapNode { position: absolute; display: flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; text-align: left; min-height: 0;
  background: #12151c; border: 1.5px solid; border-radius: var(--r-md); cursor: pointer; z-index: 1;
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) ease-out, background var(--t-fast) ease-out; }
.mapNode:hover, .mapNode.sel { transform: scale(1.05); box-shadow: 0 0 0 3px rgba(255, 255, 255, .14), 0 8px 20px rgba(0, 0, 0, .5); z-index: 2; background: #1a1f29; }
.mapNode canvas { flex: none; }
.mapNode span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.mapNode b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mapNode small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- schermi stretti ---------- */
@media (max-width: 900px) {
  .menu { background: linear-gradient(180deg, rgba(7, 9, 13, .55) 0%, rgba(7, 9, 13, .9) 45%); }
  .hero { min-height: auto; padding-top: 40px; padding-bottom: 8px; }
  .scrollCue { display: none; }
  .modes { padding-top: 32px; }
}
@media (max-width: 480px) { .room { grid-template-columns: 112px 1fr; gap: 12px; } .room .mDesc { display: none; } }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .teamHead { display: none; }
  .teamRow { grid-template-columns: 48px 1fr 70px; }
  .teamRow select { grid-column: 1 / 3; }
  .panel { padding: 18px; }
}

/* ---------- preferenze di accessibilità ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .overlay:not(.menu):not(.hidden) .panel { animation: fade var(--t-med) ease-out; }
  @keyframes fade { from { opacity: 0; } }
  button:active, .mapNode:hover, .mapNode.sel, .modeTile:hover .art, .room:hover .art { transform: none; }
  .scrollCue svg { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .panel, .mapInfo { background: #12151c; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(255, 255, 255, .3); --line-hi: rgba(255, 255, 255, .5); --muted: #c3c9d4; --faint: #9aa2b0; }
}
