:root {
  --pergamena: #efe3c8; --inchiostro: #2b2118; --bordo: #8b6d47; --accento: #8b1e1e;
  --mare: #a9c4c9; --pannello: #f6eedb; --riga: #e2d4b4;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--pergamena); color: var(--inchiostro); font: 14px/1.4 Georgia, 'Times New Roman', serif; }
body { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
header#barra { grid-row: 1; display: flex; gap: 10px; align-items: center; padding: 6px 12px; background: #3b2a1a; color: #f3e6c8; flex-wrap: wrap; font-size: 13px; }
header#barra[hidden] { display: none; }
#b-data { font-weight: bold; min-width: 220px; }
.voce b { color: #fff; }
#b-vel { display: inline-block; min-width: 72px; text-align: center; }
button, .bottone { font: inherit; background: var(--pannello); color: var(--inchiostro); border: 1px solid var(--bordo); border-radius: 4px; padding: 3px 9px; cursor: pointer; }
button:hover:not(:disabled), .bottone:hover { background: #fff7e3; }
button:disabled { opacity: .5; cursor: default; }
button.attivo, button.attivo:hover:not(:disabled) { background: var(--accento); color: #fff; border-color: var(--accento); }
main { grid-row: 2; position: relative; display: grid; grid-template-columns: 1fr 360px; min-height: 0; }
main.senza-pannello { grid-template-columns: 1fr; }
canvas#mappa { width: 100%; height: 100%; display: block; background: var(--mare); cursor: crosshair; }
aside#pannello { overflow-y: auto; background: var(--pannello); border-left: 2px solid var(--bordo); padding: 10px 12px; }
aside#pannello[hidden] { display: none; }
h2, h3 { margin: .4em 0; font-variant: small-caps; letter-spacing: .03em; }
.schede { display: flex; gap: 4px; margin: 10px 0 6px; flex-wrap: wrap; }
table { border-collapse: collapse; width: 100%; }
td { padding: 2px 4px; border-bottom: 1px solid var(--riga); vertical-align: top; }
.riga { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--riga); }
.riga.scelta { background: #fff7e3; }
.muto { color: #7a6a55; font-size: 12px; }
.guerra { color: #b03a2e; font-weight: bold; }
.comandi { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
#inizio { position: absolute; left: 12px; top: 12px; bottom: 12px; width: 420px; display: flex; flex-direction: column; background: rgba(246, 238, 219, .96); border: 2px solid var(--bordo); border-radius: 6px; padding: 12px; }
#inizio[hidden] { display: none; }
#inizio h1 { margin: 0 0 4px; font-variant: small-caps; color: var(--accento); }
#inizio-lista { overflow-y: auto; flex: 1; margin: 8px 0; }
.carta { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer; }
.carta:hover, .carta.scelta { background: #fff7e3; outline: 1px solid var(--bordo); }
.colore { width: 14px; height: 14px; border-radius: 3px; border: 1px solid #0006; flex: none; }
.diff { margin-left: auto; font-size: 12px; }
.diff-facile { color: #2e7d32; } .diff-normale { color: #6d5d2e; } .diff-difficile { color: #b8621b; } .diff-molto-difficile { color: #b03a2e; }
#inizio-scheda { min-height: 120px; border-top: 1px solid var(--bordo); padding-top: 8px; }
#notizie { position: absolute; left: 12px; bottom: 12px; max-width: 480px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
#notizie div { background: rgba(43, 33, 24, .82); color: #f3e6c8; padding: 3px 8px; border-radius: 3px; font-size: 13px; }
#avviso { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--accento); color: #fff; padding: 6px 14px; border-radius: 4px; z-index: 5; }
#avviso[hidden] { display: none; }
#finestra { position: absolute; inset: 0; background: rgba(30, 20, 10, .45); display: grid; place-items: center; z-index: 4; }
#finestra[hidden] { display: none; }
#finestra-corpo { background: var(--pannello); border: 2px solid var(--bordo); border-radius: 6px; padding: 16px 20px; max-width: 520px; max-height: 80vh; overflow-y: auto; }
input[type=number] { width: 80px; font: inherit; }
.voto { padding: 6px 0; border-bottom: 1px solid var(--riga); }
.barra-voto { position: relative; display: flex; justify-content: space-between; padding: 1px 6px; margin: 2px 0; font-size: 12px; background: #efe5cc; border-radius: 3px; overflow: hidden; }
.barra-voto span { position: relative; z-index: 1; }
.barra-voto .riempi { position: absolute; left: 0; top: 0; bottom: 0; background: #c9b27e; z-index: 0; }
.barra-voto.scelta { font-weight: bold; outline: 1px solid var(--accento); }
#b-jev { font-size: 12px; color: #e8d39b; }
.dipl { padding: 4px 0 6px; border-bottom: 1px solid var(--riga); }
.dipl .riga { border: 0; padding: 2px 0; }
.rel { display: inline-block; width: 70px; height: 6px; background: #e2d4b4; border-radius: 3px; overflow: hidden; }
.rel span { display: block; height: 100%; background: linear-gradient(90deg, #b03a2e, #c9a227, #5f8f3a); }
button.piccolo { font-size: 12px; padding: 1px 6px; }
.dipl select { font: inherit; font-size: 12px; }

.leva { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.leva .nome { width: 70px; }
.leva b { width: 24px; text-align: center; }
.opzione { margin: 8px 0; }
.opzione button { width: 100%; text-align: left; }
#battaglie { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 3; flex-wrap: wrap; justify-content: center; max-width: 90%; }
.battaglia { background: rgba(43, 33, 24, .9); color: #f3e6c8; padding: 6px 10px; border-radius: 4px; font-size: 13px; min-width: 220px; }
.battaglia .titolo { font-weight: bold; margin-bottom: 2px; }
.battaglia.vinta { background: rgba(63, 111, 58, .92); }
.battaglia.persa { background: rgba(140, 40, 30, .92); }
.battaglia .guerra { color: #f0a090; }
.avviso-coalizione { background: #f3d6c8; border: 1px solid #b03a2e; padding: 6px 8px; border-radius: 4px; margin-bottom: 8px; }
