/* ---------- nuove schede ---------- */
#tabs { grid-template-columns: repeat(6, 1fr); }
#tabs button { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- tavolo del governo, elezioni, ambizioni ---------- */
.dlg.gov { background: #fbf6e9; border: 2px solid var(--gold); max-width: 620px; }
.gov-k { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #8c7440; font-weight: 600; margin-bottom: 4px; }
.gov-who { font-size: 13px; color: #6b5f48; margin: -2px 0 10px; font-style: italic; }
.gov-txt { font-size: 15px; line-height: 1.55; }
.dlg .opts button .eff { display: block; font-size: 12px; color: #7a6a48; margin-top: 2px; font-weight: 400; }
.dlg .opts button.later { background: transparent; border-style: dashed; color: #8f887b; }
.cands { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; }
.cand { text-align: left; padding: 12px 14px; border-radius: 10px; background: #fffdf7; border: 1px solid #d8ccb0; display: flex; flex-direction: column; gap: 4px; }
.cand:hover { border-color: var(--gold); background: #fff6dc; box-shadow: 0 4px 14px rgba(140,116,64,.2); }
.cand .cn { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.cand .cs { font-size: 12px; color: #8c7440; font-weight: 600; }
.cand .ct { font-size: 12.5px; color: #4a4336; line-height: 1.4; }

/* ---------- crisi ---------- */
.dlg.crisis { background: #2a1b1b; color: #f6e6e0; border: 2px solid #c8463a; }
.dlg.crisis h2 { color: #fff; }
.dlg.crisis p { color: #f0d6cf; line-height: 1.55; }
.dlg.crisis .opts button { background: #3c2626; color: #fbeae5; border-color: #7a3a33; }
.dlg.crisis .opts button:hover:not(:disabled) { background: #4d2f2f; }
.cr-k { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #ff8a7a; font-weight: 700; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .55; } }
#crisis { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); min-width: 320px; max-width: 460px; background: linear-gradient(180deg, #4a1d1a, #2e1210); color: #fff; border: 2px solid #e0574a; border-radius: 10px; padding: 8px 14px 10px; cursor: pointer; box-shadow: 0 8px 26px rgba(0,0,0,.45), 0 0 22px rgba(224,87,74,.35); z-index: 6; display: none; text-align: center; }
#crisis:hover { filter: brightness(1.15); }
#crisis .cb-t { font-weight: 700; font-size: 15px; }
#crisis .cb-s { font-size: 12px; color: #ffcbc3; margin: 2px 0 6px; }
#crisis .cb-bar { height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
#crisis .cb-bar div { height: 100%; background: linear-gradient(90deg, #ff6b5b, #ffb36b); }
.crisis-card { border-color: #e0574a !important; background: #fff1ee !important; }

/* ---------- spionaggio ---------- */
.dlg.spy { background: #e9e4d6; color: #1f1c16; font-family: 'Special Elite', 'Courier New', monospace; border: 1px solid #8a7f68; box-shadow: 0 20px 60px rgba(0,0,0,.4), inset 0 0 60px rgba(120,100,60,.15); }
.dlg.spy h2 { font-family: 'Special Elite', 'Courier New', monospace; font-size: 22px; }
.spy-k { display: inline-block; border: 2px solid #a3261c; color: #a3261c; padding: 2px 8px; font-size: 12px; letter-spacing: .15em; text-transform: uppercase; transform: rotate(-1.5deg); margin-bottom: 8px; }
.dlg.spy p { line-height: 1.6; font-size: 14.5px; }
.dlg.spy .opts button { background: #f5f1e6; font-family: inherit; border-color: #8a7f68; }
.dlg.spy .opts button .eff { font-family: var(--sans); }

/* ---------- capi di governo ---------- */
.leader { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(135deg, #fffaf0, #f3ead6); border: 1px solid #d8ccb0; border-radius: 10px; padding: 12px; margin: 10px 0; }
.leader .lav { flex: none; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a5a78, #1d2430); color: var(--gold-2); display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 19px; border: 2px solid var(--gold); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.leader .lt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8c7440; font-weight: 600; }
.leader .ln { font-family: var(--serif); font-weight: 700; font-size: 18px; margin-bottom: 3px; }
.leader.small-l .lav { width: 42px; height: 42px; font-size: 15px; }
.leader.small-l .ln { font-size: 16px; }
.card.amb { border-color: var(--gold); background: #fffaf0; }

/* ---------- corsa alle scoperte ---------- */
.race { display: grid; grid-template-columns: 14px 64px 1fr 70px 38px; align-items: center; gap: 4px; font-size: 12px; padding: 3px 0; }
.race .dot { margin: 0; }
.race .rn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race .rt { color: #5d574d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.race .rb { height: 7px; background: var(--paper-2); border-radius: 4px; overflow: hidden; }
.race .rb span { display: block; height: 100%; }
.race .rp { text-align: right; font-weight: 600; }
.race.me { background: #fff3d0; border-radius: 4px; }

/* ---------- bollettini di guerra ---------- */
#reports { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 6; width: 290px; }
.report { background: #f4ecd8; color: #2a2318; border: 1px solid #b8a67e; border-left: 5px solid #8c7440; border-radius: 6px; padding: 8px 12px; font-size: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.35); cursor: pointer; animation: tin .3s ease-out; transition: opacity .5s, transform .5s; font-family: Georgia, serif; }
.report.win { border-left-color: #2a8a5a; } .report.lose { border-left-color: #c0392b; }
.report.out { opacity: 0; transform: translateX(-20px); }
.report .rp-h { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: #7a6a48; }
.report .rp-t { font-family: var(--serif); font-weight: 900; font-size: 16px; margin: 2px 0 6px; }
.report .rp-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; line-height: 1.4; }
.report .rp-r { margin-top: 6px; border-top: 1px solid #d3c49f; padding-top: 4px; }

/* guida: pulsanti su una riga, puntini sopra */
#tutBox .tnav { flex-wrap: wrap; }
#tutBox .dots { width: 100%; margin-bottom: 6px; flex-wrap: wrap; }
#tutBox .dots i { width: 6px; height: 6px; }

/* ---------- amicizie e patti ---------- */
.tag.friend { background: #fde3ea; color: #a3324f; border-color: #e7a9b9; }
.friend-card { background: #fff3f6 !important; border-color: #e7a9b9 !important; margin: 8px 0; }
.card.pact { border-left: 4px solid var(--gold); }
details.pactnew { margin-top: 8px; border: 1px dashed #c9b88f; border-radius: 8px; padding: 6px 10px; background: #fffaf0; }
details.pactnew summary { cursor: pointer; font-weight: 600; color: #6b5420; }
.pactlist { max-height: 260px; overflow-y: auto; }
.pactlist .list-item.on { background: #fff3d0; }
.pactlist .chk { width: 18px; font-size: 15px; }

/* ---------- risorse, borsa, oro ---------- */
.resrow { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dotted #ddd2b8; }
.resrow.latent { opacity: .6; }
.resrow .ri { font-size: 20px; width: 26px; text-align: center; }
.resrow .lv { color: #8c7440; letter-spacing: 1px; font-size: 11px; }
.resrow button { font-size: 11.5px; line-height: 1.25; padding: 4px 8px; text-align: center; }
table.borsa td, table.borsa th { padding: 4px 4px; font-size: 12px; vertical-align: middle; }
table.borsa .bb { white-space: nowrap; }
table.borsa .bb button { padding: 2px 6px; font-size: 11px; margin-left: 2px; }
table.borsa tr.shortrow td { background: #fff1ee; }
svg.spark { display: block; }
.gold-card { border-color: #d9b45a !important; background: linear-gradient(135deg, #fffaf0, #f8edcc) !important; margin-top: 10px; }
.lux-card { border-color: #c98a9a !important; background: #fff6f8 !important; }
label.chk { display: flex; gap: 6px; align-items: center; margin: 6px 0; cursor: pointer; }
#legend .lg-btn { cursor: pointer; border: 1px solid rgba(226,184,74,.6); border-radius: 10px; padding: 1px 8px; }
#legend .lg-btn.on { background: rgba(226,184,74,.3); }

.bx { border: 1px solid #e3d8bd; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; background: #fffdf7; }
.bx .bb button { padding: 2px 8px; font-size: 11px; margin-left: 4px; }
.bx.shortrow { background: #fff1ee; border-color: #e0a59b; }

/* ---------- scheda provincia al passaggio del mouse ---------- */
#mapHint.pcard { max-width: 300px; min-width: 220px; padding: 9px 12px; font-size: 12px; line-height: 1.45; z-index: 8; }
#mapHint .pc-h { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 2px; }
#mapHint .pc-h span { font-size: 12px; white-space: nowrap; }
#mapHint .pc-s { margin-top: 3px; }
#mapHint .pc-r { margin: 5px 0 2px; padding: 5px 0; border-top: 1px solid rgba(226,184,74,.3); border-bottom: 1px solid rgba(226,184,74,.3); }
#mapHint .pc-r .lv { color: #e2b84a; letter-spacing: 1px; }
#mapHint .latent { opacity: .55; }
.rep-tot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; margin: 4px 0 2px; }
table.rep td, table.rep th { font-size: 12px; padding: 3px 4px; }
table.rep sup { color: #8c7440; font-weight: 700; }

/* ---------- barra delle risorse in alto ---------- */
#resBar { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 6px; align-items: center; cursor: pointer; padding: 2px 8px; border-left: 1px solid rgba(226,184,74,.25); border-right: 1px solid rgba(226,184,74,.25); }
#resBar:hover { background: rgba(226,184,74,.08); }
#resBar .rb { font-size: 11.5px; color: var(--on-chrome, #eee); white-space: nowrap; padding: 1px 5px; border-radius: 6px; font-variant-numeric: tabular-nums; }
#resBar .rb i { font-style: normal; margin-right: 3px; }
#resBar .rb em { font-style: normal; font-size: 10px; margin-left: 3px; opacity: .95; }
#resBar .rb em.up { color: #7be0a4; } #resBar .rb em.dn { color: #ff9a8a; }
#resBar .rb.short { background: rgba(200,50,40,.45); color: #fff; animation: blink 1.4s infinite; }
@media (max-width: 1350px) { #resBar { grid-template-columns: repeat(3, auto); } #resBar .rb { font-size: 10.5px; padding: 0 3px; } }

/* ---------- consiglieri, dottrine, guerra ---------- */
.mm { font-size: 10.5px; opacity: .8; font-weight: 400; white-space: nowrap; }
#quest.adv { width: 330px; max-height: calc(100% - 24px); overflow-y: auto; }
#quest .qtabs { display: flex; gap: 2px; background: rgba(0,0,0,.25); border-bottom: 1px solid rgba(217,178,90,.3); }
#quest .qtabs a { flex: 1; text-align: center; padding: 6px 4px; color: var(--on-chrome-2); text-decoration: none; font-size: 12px; font-weight: 600; }
#quest .qtabs a.on { color: var(--gold-2); background: rgba(217,178,90,.15); }
#quest .qtabs a.mn { flex: 0 0 30px; }
#quest .aecon { padding: 7px 12px; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
#quest .asec { border-bottom: 1px solid rgba(255,255,255,.08); }
#quest .ash { display: grid; grid-template-columns: 20px auto 1fr; gap: 2px 6px; align-items: baseline; padding: 7px 12px; cursor: pointer; }
#quest .ash:hover { background: rgba(255,255,255,.05); }
#quest .asec.open .ash { background: rgba(217,178,90,.1); }
#quest .ash .ai { color: var(--gold-2); }
#quest .ash .an { font-weight: 700; color: var(--gold-2); }
#quest .ash .ast { grid-column: 2 / 4; font-size: 11.5px; color: var(--on-chrome); }
#quest .good, .at .good { color: #7be0a4; } #quest .bad { color: #ff9a8a; } #quest .warn { color: #f0c36a; }
.at { display: flex; gap: 8px; align-items: center; padding: 6px 12px 6px 38px; font-size: 12px; line-height: 1.35; }
#panel .at { padding: 7px 0; border-bottom: 1px dotted var(--line, #ddd); font-size: 13px; }
.at .atx { flex: 1; min-width: 0; }
.at .as { display: block; font-size: 11px; opacity: .75; margin-top: 1px; }
.at .ab, .dl .ab { flex: none; font-size: 11.5px; padding: 3px 9px; border-radius: 6px; cursor: pointer; }
#quest .at .ab { background: var(--gold, #d9b25a); color: #1b1b1b; border: none; font-weight: 600; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 6px 0 10px; }
.doc { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; border: 1px solid #d8ccb0; background: #fffdf7; }
.doc.on { border: 2px solid var(--gold, #d9b25a); background: #fff6dc; }
.doc .di { font-size: 16px; } .doc b { font-size: 13px; }
.doc .dd { font-size: 11.5px; color: #5d574d; line-height: 1.3; }
.doc .db { font-size: 10.5px; color: #8c7440; font-variant-numeric: tabular-nums; }
details.adv-b { margin: 6px 0 12px; } details.adv-b summary { cursor: pointer; font-size: 12.5px; color: #6b5420; }
.econline { font-size: 13px; }
.econline .good { color: #1d6640; } .econline .bad { color: #8e2a1f; } .econline .warn { color: #9a5b00; }
.tag.warn { background: #fff0d4; color: #8a5a00; }
.list-item.dl { flex-wrap: wrap; row-gap: 2px; }
.list-item.dl .dlr { flex-basis: 100%; display: flex; gap: 6px; align-items: center; padding-left: 16px; }
.list-item.dl .dlw { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.gue td { font-size: 12.5px; }

#date .slow { font-size: .8em; margin-left: 4px; cursor: help; animation: blink 1.6s infinite; }

/* ---------- consigli automatici ---------- */
#hint { display: none; position: absolute; left: 12px; bottom: 54px; width: 340px; z-index: 7; background: linear-gradient(180deg, #fffaf0, #f4ead2); color: #2a2318; border: 2px solid var(--gold, #d9b25a); border-radius: 10px; padding: 10px 14px 12px; box-shadow: 0 10px 28px rgba(0,0,0,.4); animation: tin .35s ease-out; }
#hint .hh { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #8c7440; font-weight: 700; }
#hint .ht { font-size: 14px; font-weight: 600; margin: 3px 0 2px; line-height: 1.35; }
#hint .hs { font-size: 12px; color: #5d574d; line-height: 1.35; }
#hint .hbtns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
#hint .hb { background: #2a3a55; color: #fff; border: none; font-weight: 600; padding: 5px 14px; border-radius: 6px; cursor: pointer; }
#hint .hl { background: transparent; border: 1px solid #c9b88f; color: #6b5420; padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; }
#quest .hint-sw a { color: var(--gold-2, #e9c46a); text-decoration: none; }

/* ---------- navigazione della mappa ---------- */
#mapWrap { background: radial-gradient(ellipse at center, #2b5378 0%, #1a3350 70%, #142840 100%) !important; }
#mapNav { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 6; }
#mapNav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid rgba(226,184,74,.55); background: rgba(27,34,46,.88); color: #f1dfa8; font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.35); padding: 0; }
#mapNav button:hover { background: rgba(60,72,92,.95); }

/* ---------- fronti, battaglie decisive, conferenza di pace ---------- */
.dlg.battle { background: #1f2329; color: #eef0f3; border: 2px solid #b8893a; max-width: 760px; }
.dlg.battle h2 { color: #fff; margin: 2px 0 10px; }
.dlg.battle .cr-k { color: #e0b562; }
.dlg.battle p { color: #cfd5dd; }
.bt-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; background: #2a3038; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.bt-sides > div:last-child { text-align: right; }
.bt-sides .vs { text-align: center; color: #e0b562; }
.tts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 10px 0; }
.tt { text-align: left; background: #2a3038; color: #eef0f3; border: 1px solid #47505c; border-radius: 8px; padding: 9px 11px; cursor: pointer; font: inherit; }
.tt:hover { border-color: #e0b562; background: #323a44; }
.tt b { display: block; font-size: 15px; margin-bottom: 3px; }
.tt span { display: block; font-size: 12px; color: #b9c1cb; line-height: 1.4; }
.tt em { display: block; font-style: normal; font-size: 12px; margin-top: 6px; font-weight: 600; }
.tt em.good { color: #7fd19b; } .tt em.warn { color: #e8c46a; } .tt em.bad { color: #ef8a80; }
.dlg.battle .opts button { background: #2a3038; color: #eef0f3; border-color: #47505c; }
.wbar { height: 10px; border-radius: 5px; background: #c8463a; overflow: hidden; margin: 6px 0 3px; }
.wbar > div { height: 100%; background: #2f7fc0; }
.card.front { margin-bottom: 8px; }
.card.front .small { margin-top: 3px; }
.card.army { padding: 7px 10px; margin-bottom: 6px; }
.ords { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 5px; }
.ords button { padding: 3px 9px; font-size: 12px; }
.ords button.sel { background: var(--ink, #1b2430); color: #fff; }
.pitems { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; max-height: 280px; overflow: auto; }
.pitems label { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border: 1px solid rgba(0,0,0,.12); border-radius: 6px; cursor: pointer; }
.pitems .grow { flex: 1; }

/* la barra in alto non deve mai spingere fuori schermo mappa e pannello */
#app { grid-template-columns: minmax(0, 1fr); }
#top { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
#top > * { flex-shrink: 0; }

/* ---------- campagne stagionali ---------- */
.dlg.plan { max-width: 900px; width: 94vw; }
.plan-t { width: 100%; font-size: 13px; }
.plan-t td { vertical-align: top; padding: 6px; }
.plan-t td.num { white-space: nowrap; text-align: center; }
.plan-t tr.main td { background: rgba(226, 184, 74, .14); }
button.mini { padding: 2px 7px; font-size: 12px; margin: 1px; }
button.mini.sel { background: var(--ink, #1b2430); color: #fff; }
.cards-s { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; margin: 6px 0 10px; }
.card-s { text-align: left; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.card-s b { display: block; } .card-s span { display: block; font-size: 12px; opacity: .85; } .card-s em { display: block; font-style: normal; font-size: 12px; margin-top: 4px; font-weight: 600; }
.card-s.used { outline: 2px solid #2f7fc0; }
.card.sector { padding: 7px 10px; margin-bottom: 6px; }
.card.sector.main { border-color: #b8893a; }
.press { height: 5px; background: rgba(0,0,0,.08); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.press span { display: block; height: 100%; } .press .pa { background: #2f7fc0; } .press .pb { background: #c8463a; }
.split-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.split-row input[type=range] { flex: 1; min-width: 60px; }
.split-row b { min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tavolo di guerra a turni ---------- */
#tavBar { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 12px;
  background: rgba(24, 28, 35, .94); color: #f1ead8; border: 1px solid #b8893a; border-radius: 10px; padding: 7px 8px 7px 14px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
#tavBar button { background: #e2b84a; color: #1b2430; border: 0; border-radius: 7px; padding: 7px 14px; font-weight: 700; cursor: pointer; font-size: 14px; }
#tavBar button:hover { background: #f0c95c; }
.tvrep { margin: 6px 0 12px; padding-left: 18px; line-height: 1.7; font-size: 14px; }
.tvrep li.good { color: #1d6b45; } .tvrep li.bad { color: #a3271c; }
.card.army.sel { border-color: #b8893a; }
