/* ==========================================================================
   SUPREMACY 1914 — DOSSIER & INTELLIGENCE SYSTEM
   Stile Grafico Ufficiale: Documento Militare Classificato Prima Guerra Mondiale
   ========================================================================== */

:root {
  --paper: #e8dcc0;
  --paper-dark: #d4c39d;
  --paper-sheet: #f5eedc;
  --ink: #2a1f14;
  --ink-soft: #4a3826;
  --blood: #7a1f1f;
  --blood-deep: #5a1414;
  --gold: #a8842c;
  --gold-dark: #7a5f15;
  --olive: #5e6336;
  --olive-dark: #3f4424;
  --shadow: rgba(40, 25, 10, .35);
  --parchment-glow: rgba(255, 250, 235, .65);
  --border-radius: 2px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: 'Crimson Pro', serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 10%, rgba(168, 132, 44, .15), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(122, 31, 31, .12), transparent 50%),
    repeating-linear-gradient(45deg, transparent 0 2px, rgba(74, 56, 38, .025) 2px 3px),
    linear-gradient(135deg, #ebdfc3 0%, #d8c8a3 100%);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 32px 16px 64px;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(0, 0, 0, .08) 0, transparent 2px),
    radial-gradient(circle at 85% 75%, rgba(0, 0, 0, .06) 0, transparent 2px),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .05) 0, transparent 1px);
  background-size: 120px 120px, 180px 180px, 60px 60px;
  pointer-events: none;
  z-index: 0;
  opacity: .6;
}

/* Timbro militare classified */
.stamp {
  position: absolute;
  top: 24px;
  right: 24px;
  border: 3px double var(--blood);
  color: var(--blood);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: .2em;
  padding: 8px 14px;
  transform: rotate(8deg);
  font-size: 11px;
  opacity: .75;
  z-index: 5;
  background: rgba(232, 220, 192, .5);
  box-shadow: 2px 2px 0 var(--shadow);
  user-select: none;
}

.stamp::before {
  content: "★";
  margin-right: 6px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   HEADER & EYEBROW
   ========================================================================== */
header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--ink-soft);
  position: relative;
}

header::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--ink-soft);
  margin-top: 4px;
}

.eyebrow {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

h1 {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(26px, 4.5vw, 48px);
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--ink);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .08);
}

.subtitle {
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 10px;
  font-size: 16px;
}

.meta {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 14px;
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-soft);
  text-transform: uppercase;
  flex-wrap: wrap;
}

.meta span {
  position: relative;
}

.meta span + span::before {
  content: "✦";
  position: absolute;
  left: -13px;
  color: var(--blood);
}

/* ==========================================================================
   PANNELLO MISSION CONTROL / QUERY BAR
   ========================================================================== */
.control-station {
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 20px 22px;
  box-shadow: 4px 4px 0 var(--shadow);
  position: relative;
  margin-bottom: 28px;
}

.control-station::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--ink-soft);
  pointer-events: none;
}

.station-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--ink-soft);
}

.station-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.station-tag {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  letter-spacing: .15em;
}

.query-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.input-with-label {
  display: flex;
  align-items: center;
  background: rgba(255, 250, 235, .8);
  border: 1px solid var(--ink-soft);
  padding: 2px 10px;
}

.input-prefix {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-right: 8px;
  white-space: nowrap;
}

.query-input {
  width: 100%;
  padding: 8px 6px;
  font-family: 'Special Elite', monospace;
  font-size: 15px;
  font-weight: bold;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
}

.query-input::placeholder {
  color: rgba(74, 56, 38, .45);
  font-weight: normal;
}

/* Pulsanti stile militare Prima Guerra Mondiale */
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 10px 18px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 2px 2px 0 var(--shadow);
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--blood-deep);
  border-color: var(--blood-deep);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--shadow);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink-soft);
  padding: 10px 14px;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 2px 2px 0 var(--shadow);
  white-space: nowrap;
}

.btn-secondary:hover {
  border-color: var(--blood);
  color: var(--blood);
  background: rgba(255, 250, 235, .9);
}

.status-feed {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  padding-top: 10px;
  border-top: 1px dotted var(--ink-soft);
  flex-wrap: wrap;
  gap: 8px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--olive);
  display: inline-block;
}

.status-dot.loading {
  background: var(--gold);
  animation: pulse 1s infinite alternate;
}

.status-dot.error {
  background: var(--blood);
}

@keyframes pulse {
  from { opacity: .4; }
  to { opacity: 1; }
}

/* ==========================================================================
   PANNELLO OVERVIEW / STATI GENERALI
   ========================================================================== */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background: rgba(255, 250, 235, .5);
  border: 1px solid var(--ink-soft);
  padding: 12px 14px;
  border-left: 3px solid var(--ink);
  transition: transform .15s;
}

.stat-box.highlight-afk {
  border-left-color: var(--blood);
  background: rgba(122, 31, 31, .06);
}

.stat-box.highlight-human {
  border-left-color: var(--olive);
  background: rgba(94, 99, 54, .06);
}

.stat-box.highlight-gold {
  border-left-color: var(--gold);
  background: rgba(168, 132, 44, .06);
}

.stat-box.highlight-blood {
  border-left-color: var(--blood);
  background: linear-gradient(180deg, rgba(122, 31, 31, .08) 0%, transparent 100%), var(--paper);
}

/* Card Composizione Nazioni Unificata */
.nations-composition-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-left-color: #235487;
  background: linear-gradient(180deg, rgba(35, 84, 135, .04) 0%, rgba(255, 250, 235, .4) 100%);
}

.nations-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.nations-breakdown-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.nation-type-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(74, 56, 38, .05);
  border: 1px solid rgba(74, 56, 38, .18);
  padding: 3px 6px;
  border-radius: var(--border-radius);
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  flex: 1;
  min-width: 80px;
  justify-content: space-between;
}

.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-human { background: #2e7d32; }
.dot-open { background: #1976d2; }
.dot-afk { background: var(--blood); }
.dot-native { background: #888; }

.chip-lbl {
  font-size: 10px;
  color: var(--ink-soft);
  margin-right: 2px;
}

.chip-val {
  font-weight: bold;
  color: var(--ink);
}

.chip-val.blood {
  color: var(--blood-deep);
}

.nations-ratio-bar {
  display: flex;
  height: 5px;
  background: rgba(74, 56, 38, .12);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-top: 6px;
}

.ratio-segment {
  height: 100%;
  transition: width .4s ease;
}

.ratio-human { background: #2e7d32; }
.ratio-open { background: #1976d2; }
.ratio-afk { background: var(--blood); }
.ratio-native { background: #9e9e9e; }

.stat-box-lbl {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.stat-box-val {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-box-val.blood {
  color: var(--blood-deep);
}

.stat-box-sub {
  font-size: 11px;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ==========================================================================
   NAVIGAZIONE TABS & FILTRI
   ========================================================================== */
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  background: rgba(74, 56, 38, .08);
  border: 1px solid var(--ink-soft);
  border-bottom: none;
  padding: 8px 18px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover {
  background: rgba(255, 250, 235, .8);
  color: var(--blood);
}

.tab-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 700;
}

.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(74, 56, 38, .06);
  padding: 12px 16px;
  border: 1px solid var(--ink-soft);
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* Etichetta "Filtra:" inline — estratta da inline style */
.filter-label-text {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  padding: 5px 12px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all .15s;
}

.filter-pill:hover {
  border-color: var(--blood);
  color: var(--blood);
}

.filter-pill.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 250, 235, .8);
  border: 1px solid var(--ink-soft);
  padding: 4px 8px;
  min-width: 220px;
}

.search-icon {
  margin-right: 6px;
  opacity: .6;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}

.sort-select {
  padding: 6px 10px;
  background: rgba(255, 250, 235, .8);
  border: 1px solid var(--ink-soft);
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

/* ==========================================================================
   BADGE DI STATO INTELLIGENCE (Il cuore del bot!)
   ========================================================================== */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .1);
}

/* Umano attivo in gioco */
.status-human {
  color: #2b5e28;
  border-color: #2b5e28;
  background: rgba(43, 94, 40, .12);
}

/* Nazione giocabile in attesa di un comandante umano (slot libero) */
.status-open-slot {
  color: #155084;
  border-color: #1976d2;
  background: rgba(25, 118, 210, .14);
  font-weight: bold;
}

/* Il segreto dei bot: Umano AFK sostituito dall'IA */
.status-afk-ai {
  color: var(--blood-deep);
  border-color: var(--blood);
  background: rgba(122, 31, 31, .15);
  font-weight: bold;
}

/* Nazione neutrale controllata da IA fin dall'inizio */
.status-native-ai {
  color: var(--ink-soft);
  border-color: var(--ink-soft);
  background: rgba(74, 56, 38, .1);
}

/* Sconfitto o ritirato */
.status-defeated {
  color: #777;
  border-color: #999;
  background: rgba(120, 120, 120, .1);
  text-decoration: line-through;
}

/* ==========================================================================
   TABELLA E GRIGLIA ROSTER NAZIONI
   ========================================================================== */
.roster-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 24px;
}

.intel-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}

.intel-table th {
  background: rgba(74, 56, 38, .12);
  border-bottom: 2px solid var(--ink);
  padding: 10px 12px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: left;
}

.intel-table th.text-right, .intel-table td.text-right {
  text-align: right;
}

.intel-table th.text-center, .intel-table td.text-center {
  text-align: center;
}

.intel-table td {
  padding: 10px 12px;
  border-bottom: 1px dotted var(--ink-soft);
  color: var(--ink);
  vertical-align: middle;
}

.intel-table tbody tr {
  transition: background .15s;
}

.intel-table tbody tr:hover {
  background: rgba(168, 132, 44, .12);
  cursor: pointer;
}

.nation-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nation-color-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .2);
  flex-shrink: 0;
}

.nation-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: .02em;
}

.nation-title {
  font-size: 11px;
  font-style: italic;
  color: var(--ink-soft);
}

.player-info-cell {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  font-weight: bold;
  color: var(--ink);
}

.player-id-sub {
  font-size: 10px;
  color: var(--ink-soft);
  font-family: 'Special Elite', monospace;
  opacity: .8;
}

.progress-vp {
  width: 70px;
  height: 6px;
  background: rgba(74, 56, 38, .15);
  border: 1px solid var(--ink-soft);
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

.progress-vp-fill {
  height: 100%;
  background: var(--blood);
}

/* Classi helper per celle inline (estratte da inline styles nel JS) */
.kd-sub-text {
  font-size: 10px;
  font-family: 'Special Elite', monospace;
  color: var(--ink-soft);
  margin-top: 2px;
}

.province-count {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
}

.province-pct {
  font-size: 11px;
  opacity: .7;
  margin-left: 2px;
}

.vp-score {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  color: var(--blood-deep);
}

.dispatch-day-label {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

/* Stato aperto — colore blu per nome giocatore */
.player-name-open-slot {
  color: #155084;
  font-style: italic;
}

/* Helper per apertura fascicolo nella card dossier */
.dossier-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-top: 1px dashed var(--ink-soft);
  padding-top: 8px;
  margin-top: 8px;
  font-size: 11px;
  font-family: 'Special Elite', monospace;
}

.dossier-expand-link {
  color: var(--blood);
  cursor: pointer;
}

/* Badge status margin nella card dossier */
.dossier-badge-wrap {
  margin-bottom: 10px;
}

/* Card header layout con swatch e nazione */
.dossier-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stili valori condizionali nelle dossier-stat-val */
.stat-val-open-slot {
  color: #155084;
  font-style: italic;
}

.stat-val-alliance {
  color: #7a1f1f;
}

.stat-val-muted {
  color: var(--ink-soft);
}

.stat-val-kd-positive {
  color: #1f6b1f;
}

.stat-val-kd-negative {
  color: var(--blood-deep);
}

.stat-val-blood {
  color: var(--blood-deep);
}

.stat-val-war {
  color: var(--blood);
}

/* Notizia vuota (grid full-width) */
.news-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  font-style: italic;
  color: var(--ink-soft);
}

/* Subtitle inline nel newspaper title bar */
.newspaper-edition-label {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.newspaper-subtitle {
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Meta badge in status feed */
.game-meta-badge {
  font-style: italic;
}

/* Provinces sub (overview card) */
.ovw-provinces-sub {
  text-align: right;
  padding-top: 4px;
}

/* Open slots — color */
.open-slots-val {
  color: #155084;
}

/* Discord panel description */
.discord-description {
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

/* Helper generici per tabelle e sezioni */
.table-empty-cell {
  text-align: center;
  padding: 24px;
  font-style: italic;
  color: var(--ink-soft);
}

.table-rank-cell {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  color: var(--blood-deep);
}

.swatch-sm {
  width: 11px;
  height: 11px;
}

.swatch-md {
  width: 12px;
  height: 12px;
}

.swatch-lg {
  width: 16px;
  height: 16px;
}

.leader-crown-icon {
  color: var(--gold);
  font-size: 12px;
  margin-left: 2px;
}

.order-resource-cat {
  font-size: 10px;
  color: var(--ink-soft);
  margin-left: 4px;
}

.order-icon-spacer {
  margin-right: 4px;
}

.order-nation-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
}

.order-amount-cell {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
}

.order-price-cell {
  font-family: 'Special Elite', monospace;
}

.order-total-cell {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  color: var(--blood-deep);
}

.col-pos {
  width: 45px;
}

.col-operation {
  width: 110px;
}

.header-with-filter {
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.header-market-bar {
  margin-bottom: 14px;
}

.orderbook-station {
  margin-top: 28px;
}

.footer-disclaimer {
  margin-top: 6px;
  font-size: 9px;
  opacity: .7;
}

/* ==========================================================================
   DOSSIER CARD GRID (Vista a schede)
   ========================================================================== */
.dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.dossier-card {
  background: linear-gradient(180deg, rgba(255, 250, 235, .7) 0%, rgba(255, 250, 235, .3) 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 16px;
  box-shadow: 3px 3px 0 var(--shadow);
  position: relative;
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}

.dossier-card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ink-soft);
  pointer-events: none;
}

.dossier-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--shadow);
  background: rgba(255, 250, 235, .9);
}

.dossier-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px dashed var(--ink-soft);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.dossier-rank {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 900;
  color: var(--blood-deep);
  border: 1px solid var(--blood);
  padding: 2px 6px;
  background: rgba(122, 31, 31, .08);
}

.dossier-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.dossier-stat-item {
  display: flex;
  flex-direction: column;
}

.dossier-stat-lbl {
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dossier-stat-val {
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
}

/* ==========================================================================
   GIORNALE DI GUERRA (UltNewspaperState)
   ========================================================================== */
.newspaper-container {
  background: linear-gradient(180deg, rgba(255, 250, 235, .8) 0%, rgba(255, 250, 235, .5) 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 24px;
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 24px;
}

.newspaper-title-bar {
  text-align: center;
  border-bottom: 3px double var(--ink);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.newspaper-name {
  font-family: 'Cinzel', serif;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.articles-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

/* ==========================================================================
   DISCORD EXPORT & ANTEPRIMA REPORT
   ========================================================================== */
.discord-panel {
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 24px;
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 28px;
  position: relative;
}

.discord-panel::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--ink-soft);
  pointer-events: none;
}

.discord-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.discord-preview-box {
  background: #1e1f22;
  color: #dbdee1;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 16px;
  border-radius: 4px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  margin: 16px 0;
  border: 1px solid #313338;
}

/* ==========================================================================
   MODALE DOSSIER COMPLETO
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 31, 20, .75);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .2s ease-out;
}

.modal-content {
  background: var(--paper);
  border: 3px double var(--ink);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 8px 8px 0 var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  background: transparent;
  border: 1px solid var(--ink-soft);
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  padding: 3px 9px;
  color: var(--ink-soft);
  line-height: 1.2;
  z-index: 10;
  transition: all .15s ease;
}

.modal-close:hover {
  background: var(--blood);
  color: var(--paper);
  border-color: var(--blood);
}

.modal-player-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 14px;
  padding-right: 95px;
  gap: 12px;
}

/* Toast di notifica stile ceralacca / timbro */
.toast-stamp {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--gold);
  padding: 12px 20px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .15em;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--shadow);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUpToast .3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--ink-soft);
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

/* ==========================================================================
   TURN COUNTDOWN & REGOLE MAPPA
   ========================================================================== */
.countdown-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ovw-speed-tag {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.turn-countdown {
  margin-top: 4px;
  font-family: 'Special Elite', monospace;
  background: rgba(122, 31, 31, .07);
  border: 1px solid rgba(122, 31, 31, .35);
  padding: 6px 8px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all .3s ease;
}

.turn-countdown.turn-imminent {
  background: rgba(122, 31, 31, .16);
  border-color: var(--blood);
  animation: pulseImminent 2s infinite ease-in-out;
}

.turn-countdown.turn-finished {
  background: rgba(184, 134, 11, .15);
  border-color: var(--gold);
}

@keyframes pulseImminent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(122, 31, 31, 0.4); }
  50% { box-shadow: 0 0 8px 2px rgba(122, 31, 31, 0.3); }
}

.countdown-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.countdown-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--blood);
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: var(--border-radius);
  letter-spacing: .05em;
}

.pulse-dot {
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

.countdown-title-text {
  font-weight: bold;
  color: var(--blood-deep);
}

.countdown-digits {
  font-family: 'Special Elite', monospace;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: .08em;
  color: var(--blood-deep);
  line-height: 1.2;
}

.countdown-details-row {
  font-size: 10px;
  color: var(--ink-soft);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-cycle-bar {
  height: 4px;
  background: rgba(74, 56, 38, .15);
  border-radius: var(--border-radius);
  overflow: hidden;
  margin-top: 3px;
}

.day-cycle-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--blood) 100%);
  transition: width .4s ease;
}

/* ==========================================================================
   QUADRO TATTICO: STATO AVANZAMENTO VITTORIA
   ========================================================================== */
.victory-dossier {
  background: linear-gradient(180deg, rgba(255, 252, 244, .9) 0%, rgba(245, 238, 220, .98) 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 4px 4px 0 var(--shadow);
  position: relative;
}

.victory-station-header {
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.victory-header-icon {
  font-size: 20px;
  margin-right: 6px;
}

.victory-status-tag {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--blood-deep);
  background: rgba(122, 31, 31, .08);
  border: 1px dashed var(--blood);
  padding: 3px 8px;
  border-radius: var(--border-radius);
}

.victory-panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.victory-panel {
  background: var(--paper);
  border: 1.5px solid var(--ink-soft);
  padding: 14px;
  box-shadow: 2px 2px 0 var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.victory-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(74, 56, 38, .15);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.victory-panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.victory-panel-icon {
  font-size: 22px;
}

.victory-panel-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
}

.victory-panel-target {
  font-size: 11px;
  color: var(--ink-soft);
  font-style: italic;
}

.victory-status-badge {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--border-radius);
  text-transform: uppercase;
  background: rgba(74, 56, 38, .08);
  border: 1px solid var(--ink-soft);
  color: var(--ink);
}

.victory-status-badge.badge-dominance {
  background: rgba(184, 134, 11, .15);
  border-color: var(--gold);
  color: #7a5404;
  font-weight: bold;
}

.victory-status-badge.badge-won {
  background: #1f6b1f;
  border-color: #164f16;
  color: #fff;
  font-weight: bold;
}

.v-leader-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.v-leader-identity {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.v-leader-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.v-leader-founder {
  font-size: 11px;
  color: var(--ink-soft);
  width: 100%;
}

.v-leader-vp-badge {
  font-family: 'Special Elite', monospace;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: right;
  white-space: nowrap;
}

.v-vp-current {
  font-size: 18px;
  font-weight: bold;
  color: var(--blood-deep);
}

.v-progress-container {
  margin: 10px 0;
}

.v-progress-bar {
  height: 14px;
  background: rgba(74, 56, 38, .12);
  border: 1px solid var(--ink-soft);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
}

.v-progress-fill {
  height: 100%;
  transition: width .5s ease;
}

.v-progress-fill.coalition-fill {
  background: linear-gradient(90deg, #4d682e 0%, #769a3b 100%);
}

.v-progress-fill.solo-fill {
  background: linear-gradient(90deg, #8a4b38 0%, #bf5938 100%);
}

.v-progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  margin-top: 4px;
  color: var(--ink-soft);
}

.v-members-box, .v-rivals-box {
  background: rgba(74, 56, 38, .04);
  border: 1px dashed rgba(74, 56, 38, .25);
  padding: 8px 10px;
  margin-top: 10px;
  border-radius: var(--border-radius);
}

.v-members-title, .v-rivals-title {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.v-members-list, .v-rivals-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v-member-row, .v-rival-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dotted rgba(74, 56, 38, .1);
  font-size: 12px;
}

.v-member-row:last-child, .v-rival-item:last-child {
  border-bottom: none;
}

.v-member-name, .v-rival-info {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v-member-user, .v-rival-leader {
  font-size: 10px;
  color: var(--ink-soft);
}

.v-member-stats, .v-rival-vp {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  white-space: nowrap;
  text-align: right;
}

.v-member-vp {
  color: var(--blood-deep);
  font-weight: bold;
}

.v-member-share {
  color: var(--ink-soft);
  font-size: 10px;
  margin-left: 3px;
}

.v-member-prov {
  color: var(--ink-soft);
  font-size: 10px;
  margin-left: 3px;
}

.v-rival-rank {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  font-weight: bold;
  min-width: 18px;
}

.v-rival-gap {
  font-size: 10px;
  color: var(--blood);
  margin-left: 4px;
}

.v-leader-tag {
  font-size: 9px;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 1px 4px;
  border-radius: var(--border-radius);
  margin-left: 4px;
  text-transform: uppercase;
}

.v-empty-state {
  text-align: center;
  padding: 24px 12px;
  color: var(--ink-soft);
  font-style: italic;
}

.v-empty-icon {
  font-size: 28px;
  margin-bottom: 6px;
  opacity: .6;
}

.v-empty-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 4px;
}

.v-empty-desc {
  font-size: 11px;
  line-height: 1.4;
}

.victory-footer-brief {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 12px;
  background: rgba(184, 134, 11, .08);
  border: 1px solid rgba(184, 134, 11, .3);
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
}

.victory-footer-brief .brief-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.rules-dossier {
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 12px 18px;
  margin-bottom: 24px;
  box-shadow: 3px 3px 0 var(--shadow);
  position: relative;
}

.rules-dossier-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.rules-dossier-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
}

.rules-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-badge {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 3px 8px;
  background: rgba(74, 56, 38, .1);
  border: 1px solid var(--ink-soft);
  color: var(--ink);
}

/* ==========================================================================
   BADGE TATTICI GIOCATORE & K/D RATIO
   ========================================================================== */
.kd-badge {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: var(--border-radius);
  display: inline-block;
}

.kd-positive {
  color: #1f6b1f;
  background: rgba(31, 107, 31, .12);
  border: 1px solid #2b5e28;
}

.kd-negative {
  color: var(--blood-deep);
  background: rgba(122, 31, 31, .12);
  border: 1px solid var(--blood);
}

.kd-neutral {
  color: var(--ink-soft);
  background: rgba(74, 56, 38, .08);
  border: 1px solid var(--ink-soft);
}

.badge-tag {
  display: inline-block;
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: var(--border-radius);
  margin-left: 4px;
  vertical-align: middle;
}

.badge-host {
  color: var(--gold);
  border: 1px solid var(--gold);
  background: rgba(168, 132, 44, .15);
}

.badge-premium {
  color: #8c6a15;
  border: 1px solid #8c6a15;
  background: rgba(212, 175, 55, .15);
}

.badge-capital-lost {
  color: var(--blood);
  border: 1px solid var(--blood);
  background: rgba(122, 31, 31, .15);
  font-weight: bold;
  animation: pulseCapital 2s infinite ease-in-out;
}

.badge-alliance-tag {
  color: #681d1d;
  border: 1px solid #8f2a2a;
  background: rgba(143, 42, 42, .14);
  font-weight: bold;
}

@keyframes pulseCapital {
  0%, 100% { opacity: 1; }
  50% { opacity: .65; }
}

/* ==========================================================================
   LISTINO BORSA & MERCATO RISORSE (ORDER BOOK ARCHITECTURE)
   ========================================================================== */
.market-panel {
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 20px;
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 28px;
}

.market-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink-soft);
  padding-bottom: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.market-topbar-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.market-resource-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.res-tab-btn {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 4px 9px;
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: all .15s ease;
  user-select: none;
}

.res-tab-btn:hover {
  background: rgba(255, 250, 235, 0.9);
  border-color: var(--blood);
  color: var(--blood);
}

.res-tab-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: bold;
}

.market-ticker-section {
  margin-bottom: 18px;
}

.commodity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.commodity-card {
  background: linear-gradient(180deg, rgba(255, 250, 235, .85) 0%, rgba(255, 250, 235, .45) 100%), var(--paper);
  border: 1px solid var(--ink-soft);
  padding: 8px 10px;
  text-align: center;
  box-shadow: 2px 2px 0 var(--shadow);
  position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}

.commodity-card:hover, .commodity-card.selected {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--shadow);
  border-color: var(--gold-dark);
}

.commodity-card.selected {
  background: rgba(168, 132, 44, 0.14);
  border: 1.5px solid var(--gold);
}

.commodity-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.commodity-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--ink);
}

.commodity-cat {
  font-family: 'Special Elite', monospace;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.commodity-price {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
  font-size: 15px;
  color: var(--blood-deep);
}

.commodity-unit {
  font-size: 9.5px;
  color: var(--ink-soft);
  font-family: 'Special Elite', monospace;
}

/* Griglia Order Book: Bids (Verde) vs Asks (Rosso) */
.orderbook-wrapper {
  margin-top: 10px;
}

.orderbook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.orderbook-side {
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.orderbook-side.orderbook-bids {
  border-top: 4px solid #2e7d32;
}

.orderbook-side.orderbook-asks {
  border-top: 4px solid var(--blood);
}

.orderbook-side-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1.5px solid var(--ink-soft);
  background: rgba(74, 56, 38, 0.06);
}

.side-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
}

.side-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.side-dot.dot-buy {
  background: #2e7d32;
  box-shadow: 0 0 4px rgba(46, 125, 50, 0.6);
}

.side-dot.dot-sell {
  background: var(--blood);
  box-shadow: 0 0 4px rgba(122, 31, 31, 0.6);
}

.side-count {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.orderbook-table-container {
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

.orderbook-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.orderbook-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(235, 226, 206, 0.98);
  border-bottom: 1.5px solid var(--ink-soft);
  padding: 7px 10px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: left;
}

.orderbook-table th.text-right, .orderbook-table td.text-right {
  text-align: right;
}

.orderbook-table td {
  padding: 6px 10px;
  border-bottom: 1px dotted rgba(74, 56, 38, 0.25);
  vertical-align: middle;
}

.orderbook-table tbody tr {
  transition: background .12s ease;
}

.orderbook-bids tbody tr:hover {
  background: rgba(46, 125, 50, 0.1);
}

.orderbook-asks tbody tr:hover {
  background: rgba(122, 31, 31, 0.1);
}

.ob-price {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
}

.ob-price-buy {
  color: #1f6b1f;
}

.ob-price-sell {
  color: var(--blood-deep);
}

.ob-amount {
  font-family: 'Special Elite', monospace;
  font-weight: bold;
}

.ob-total {
  font-family: 'Special Elite', monospace;
  color: var(--ink-soft);
}

.ob-nation {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.ob-res-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .orderbook-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ==========================================================================
   DISPACCI TATTICI BELLICI (State 2 newsArticles)
   ========================================================================== */
.newspaper-filter-toolbar {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dispatch-card {
  border: 1px solid var(--ink-soft);
  padding: 14px 16px;
  background: rgba(255, 250, 235, .55);
  box-shadow: 2px 2px 0 var(--shadow);
  position: relative;
  transition: transform .15s;
}

.dispatch-card:hover {
  transform: translateY(-1px);
  background: rgba(255, 250, 235, .85);
}

.dispatch-card.dispatch-combat { border-left: 4px solid var(--blood); }
.dispatch-card.dispatch-conquest { border-left: 4px solid var(--gold); }
.dispatch-card.dispatch-war { border-left: 4px solid #b83232; }
.dispatch-card.dispatch-revolt { border-left: 4px solid #d97706; }
.dispatch-card.dispatch-intel { border-left: 4px solid var(--olive); }
.dispatch-card.dispatch-destruction { border-left: 4px solid #4a1515; }
.dispatch-card.dispatch-manual { border-left: 4px solid var(--ink); }

.dispatch-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px dashed var(--ink-soft);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.dispatch-tag {
  font-family: 'Special Elite', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 2px 6px;
  background: rgba(74, 56, 38, .1);
  border: 1px solid var(--ink-soft);
}

.dispatch-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--blood-deep);
  margin-bottom: 4px;
}

.dispatch-text {
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

.dispatch-involved {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dotted var(--ink-soft);
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: var(--ink-soft);
}

.capital-warning-alert {
  background: rgba(122, 31, 31, .12);
  border: 1px solid var(--blood);
  color: var(--blood-deep);
  padding: 8px 12px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  margin-bottom: 12px;
}

.morale-penalty-alert {
  background: rgba(217, 119, 6, .12);
  border: 1px solid #d97706;
  color: #8c4a00;
  padding: 8px 12px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  margin-bottom: 12px;
}

/* ==========================================================================
   COALIZIONI & ALLEANZE DI GUERRA
   ========================================================================== */
.badge-coalition {
  color: #1a4269;
  border: 1px solid #235487;
  background: rgba(35, 84, 135, .12);
  font-weight: bold;
}

.coalitions-panel {
  background: linear-gradient(180deg, rgba(255, 250, 235, .6) 0%, transparent 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 22px;
  box-shadow: 4px 4px 0 var(--shadow);
  margin-bottom: 28px;
}

.coalitions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.coalition-card {
  background: linear-gradient(180deg, rgba(255, 250, 235, .8) 0%, rgba(255, 250, 235, .4) 100%), var(--paper);
  border: 2px solid var(--ink);
  padding: 18px;
  box-shadow: 3px 3px 0 var(--shadow);
  position: relative;
  transition: transform .15s, box-shadow .15s;
}

.coalition-card.disbanded {
  opacity: .65;
  filter: grayscale(40%);
  border-style: dashed;
}

.coalition-card:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--shadow);
}

.coalition-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--ink-soft);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.coalition-name-title {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 900;
  color: var(--ink);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coalition-motto {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.coalition-rank-badge {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 15px;
  color: var(--blood-deep);
  border: 1px solid var(--blood);
  padding: 2px 8px;
  background: rgba(122, 31, 31, .08);
}

.coalition-score-box {
  background: rgba(74, 56, 38, .06);
  border: 1px solid var(--ink-soft);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.coalition-score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
}

.coalition-score-val {
  font-size: 16px;
  font-weight: bold;
  color: var(--blood-deep);
}

.coalition-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(74, 56, 38, .15);
  border: 1px solid var(--ink-soft);
  overflow: hidden;
}

.coalition-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #235487, #3b7ec4);
}

.coalition-members-header {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--ink-soft);
  padding-bottom: 4px;
}

.coalition-member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dotted rgba(74, 56, 38, .3);
  font-size: 13px;
}

.coalition-member-item:last-child {
  border-bottom: none;
}

.coalition-member-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coalition-member-score {
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  font-weight: bold;
  color: var(--ink);
}

/* ==========================================================================
   SEZIONI MODALE PROFILO: STATISTICHE PARTITA vs STATISTICHE GENERALI
   ========================================================================== */
.modal-profile-section {
  border: 2px solid var(--ink);
  padding: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
  box-shadow: 3px 3px 0 var(--shadow);
  position: relative;
  border-radius: var(--border-radius);
}

/* Sezione Partita: tonalità militare d'epoca */
.section-match-stats {
  background: linear-gradient(180deg, rgba(255, 252, 242, .85) 0%, rgba(247, 240, 225, .6) 100%), var(--paper);
  border-color: #5c4733;
}

/* Sezione Statistiche Generali: tonalità archivio diplomatico Bytro */
.section-global-stats {
  background: linear-gradient(180deg, rgba(242, 247, 255, .85) 0%, rgba(235, 242, 250, .55) 100%), var(--paper);
  border-color: #235487;
}

.modal-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid;
  padding-bottom: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-match-stats .modal-section-header {
  border-color: #5c4733;
}

.section-global-stats .modal-section-header {
  border-color: #235487;
}

.modal-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-section-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.section-match-stats .modal-section-title {
  color: var(--blood-deep);
}

.section-global-stats .modal-section-title {
  color: #1a4269;
}

.modal-section-badge {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--border-radius);
}

.section-match-stats .modal-section-badge {
  background: rgba(122, 31, 31, .1);
  color: var(--blood-deep);
  border: 1px solid rgba(122, 31, 31, .25);
}

.section-global-stats .modal-section-badge {
  background: rgba(35, 84, 135, .1);
  color: #1a4269;
  border: 1px solid rgba(35, 84, 135, .25);
}

.global-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.profile-loading-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
}

.profile-error-box {
  padding: 8px 12px;
  background: rgba(122, 31, 31, .08);
  border: 1px dashed var(--blood);
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--blood-deep);
}

/* ==========================================================================
   MAPPA TATTICA INTERATTIVA (CARTOGRAFIA BELLICA VETTORIALE BYTRO)
   ========================================================================== */
.tactical-map-container {
  background: var(--paper-sheet);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(245, 238, 220, .95) 0%, rgba(235, 226, 206, .98) 100%);
  border-bottom: 2px solid var(--ink);
}

.map-modes-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.map-toolbar-label {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-right: 4px;
}

.map-tools-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-search-box {
  width: 220px;
}

.map-zoom-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.map-ctrl-btn {
  font-family: 'Special Elite', monospace;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 10px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--border-radius);
  box-shadow: 1px 1px 0 var(--shadow);
  transition: all .15s ease;
  user-select: none;
}

.map-ctrl-btn:hover {
  background: var(--paper-sheet);
  border-color: var(--gold-dark);
  transform: translateY(-1px);
}

.map-ctrl-btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Banner Nazione Selezionata */
.map-nation-banner {
  background: linear-gradient(90deg, #1d232a 0%, #29323c 100%);
  color: #f7eed8;
  border-bottom: 2px solid var(--gold);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  animation: slideDown .2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.banner-nation-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.banner-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.7);
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.banner-sub {
  display: block;
  font-size: 10px;
  color: #b0bec5;
  font-style: italic;
}

.banner-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: 'Special Elite', monospace;
}

.banner-revolt-tag {
  background: rgba(192, 57, 43, .3);
  color: #ff8a80;
  border: 1px solid rgba(192, 57, 43, .6);
  padding: 2px 8px;
  border-radius: var(--border-radius);
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-btn {
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--border-radius);
  cursor: pointer;
  background: var(--gold);
  color: #1a150e;
  border: 1px solid #c59b27;
  font-weight: bold;
  transition: all .15s ease;
}

.banner-btn:hover {
  background: #f1c40f;
  transform: translateY(-1px);
}

.banner-btn.close {
  background: rgba(255,255,255,0.1);
  color: #cfd8dc;
  border-color: rgba(255,255,255,0.2);
}

.banner-btn.close:hover {
  background: rgba(192, 57, 43, 0.4);
  color: #fff;
  border-color: rgba(192, 57, 43, 0.7);
}

/* Viewport della Mappa */
.map-viewport {
  position: relative;
  width: 100%;
  height: 680px;
  background: radial-gradient(ellipse at 50% 50%, #152232 0%, #0c1520 70%, #070c13 100%);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  user-select: none;
  cursor: grab;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-svg-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

.map-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 26, 33, .85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #f5eedc;
  font-family: 'Special Elite', monospace;
  font-size: 14px;
  z-index: 20;
  transition: opacity .3s ease;
}

.map-spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(212, 175, 55, .3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: mapSpin 1s linear infinite;
}

@keyframes mapSpin {
  to { transform: rotate(360deg); }
}

/* Poligoni SVG Province */
.supremacy-map-svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.map-prov-poly {
  vector-effect: non-scaling-stroke;
  stroke: rgba(10, 14, 20, 0.28);
  stroke-width: 0.55;
  stroke-linejoin: round;
  stroke-linecap: round;
  cursor: pointer;
  transition: fill .2s ease, opacity .2s ease;
}

.map-prov-poly.dimmed {
  opacity: 0.35;
}

.map-prov-poly.highlighted {
  stroke: rgba(255, 255, 255, 0.45) !important;
  stroke-width: 0.7 !important;
  filter: brightness(1.05);
  opacity: 1 !important;
}


/* Icone e Marker Capitali */
.map-capital-marker {
  pointer-events: none;
  user-select: none;
}

.map-capital-marker text.cap-star {
  fill: #ffd700;
  stroke: #0a0e14;
  stroke-width: 1.2px;
  paint-order: stroke fill;
  text-anchor: middle;
  dominant-baseline: central;
  filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
}

.map-capital-marker text.cap-label {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  fill: rgba(255, 255, 255, 0.7);
  stroke: #0a0e14;
  stroke-width: 1.6px;
  paint-order: stroke fill;
  text-anchor: middle;
  dominant-baseline: hanging;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: 0.75;
}

/* Nodi Città, Nomi Province e Badge Risorse */
.map-labels-group {
  pointer-events: none;
  user-select: none;
}

.map-city-dot {
  fill: #d8d4c8;
  stroke: #0a0e14;
  stroke-width: 0.8px;
  vector-effect: non-scaling-stroke;
}

.map-prov-text {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  fill: #ffffff;
  stroke: #0a0e14;
  stroke-width: 1.5px;
  paint-order: stroke fill;
  text-anchor: middle;
  dominant-baseline: hanging;
  letter-spacing: .02em;
  opacity: 0.7;
}

.map-prov-res-badge {
  text-anchor: middle;
  dominant-baseline: central;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
  pointer-events: none;
  user-select: none;
}

.map-prov-res-badge.is-double {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 2px rgba(255, 215, 0, 0.6));
}

/* Mostra i badge risorse nella modalità politica e nascondili in modalità morale */
.map-viewport.mode-morale .map-prov-res-badge {
  display: none !important;
}

.map-viewport.mode-political .map-prov-res-badge {
  display: inline !important;
}

/* HUD Tattico Fluttuante */
.map-hud-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 290px;
  background: rgba(18, 24, 32, 0.92);
  color: #f5eedc;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  border-radius: 3px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0,0,0,0.5);
  padding: 12px 14px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.map-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.map-hud-title {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: bold;
  color: var(--gold);
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.map-hud-badge {
  font-family: 'Special Elite', monospace;
  font-size: 10px;
  color: #a0aec0;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--border-radius);
}

.map-hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}

.hud-label {
  color: #a0aec0;
  font-size: 11px;
}

.hud-val {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #edf2f7;
}

.hud-color-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.6);
}

.hud-morale-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-morale-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.hud-morale-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .2s ease;
}

.hud-revolt-warning {
  color: #ff5252 !important;
  font-weight: bold;
  animation: hudPulse 1.2s infinite;
}

@keyframes hudPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

.map-hud-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(212, 175, 55, 0.3);
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  color: var(--gold);
  text-align: center;
}

.map-scale-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  background: rgba(18, 24, 32, 0.85);
  color: #c9b085;
  font-family: 'Special Elite', monospace;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid rgba(201, 176, 133, 0.3);
  pointer-events: none;
}

/* Legenda Mappa a Fondo Pagina */
.map-legend {
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(245, 238, 220, .95) 0%, rgba(235, 226, 206, .98) 100%);
  border-top: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11px;
  font-family: 'Special Elite', monospace;
}

.legend-items-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--border-radius);
  border: 1px solid rgba(0,0,0,0.3);
}

.legend-hint {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 10px;
}

/* ==========================================================================
   RESPONSIVE — Consolidato in breakpoint distinti
   ========================================================================== */

/* Extra-small (≤360px) — colonna singola */
@media (max-width: 360px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

/* Small (≤480px) — card dossier singola colonna */
@media (max-width: 480px) {
  .dossier-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .dossier-card {
    padding: 12px;
  }
  .dossier-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    font-size: 12px;
  }
}

/* Medium-small (≤540px) — profilo globale a una colonna */
@media (max-width: 540px) {
  .global-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* Medium (≤600px) — compatta header, tabella, filtri e commodity */
@media (max-width: 600px) {
  body {
    padding: 16px 8px 48px;
  }

  header {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: .2em;
    line-height: 1.4;
  }
  .subtitle {
    font-size: 14px;
    margin-top: 6px;
  }
  .meta {
    gap: 12px;
    font-size: 9px;
    letter-spacing: .1em;
    margin-top: 10px;
  }
  .meta span + span::before {
    left: -8px;
  }

  .tabs-nav {
    margin-bottom: 16px;
  }
  .tab-btn {
    padding: 8px 12px;
    font-size: 10px;
    letter-spacing: .08em;
  }

  .roster-table-container {
    box-shadow: 2px 2px 0 var(--shadow);
    margin-bottom: 18px;
  }
  .intel-table {
    min-width: 580px;
    font-size: 13px;
  }
  .intel-table th, .intel-table td {
    padding: 8px 10px;
  }

  .commodity-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .coalitions-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Medium (≤640px) — control station, newspaper, discord, overview */
@media (max-width: 640px) {
  .control-station {
    padding: 14px 12px;
    margin-bottom: 20px;
    box-shadow: 2px 2px 0 var(--shadow);
  }
  .station-header {
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
  }
  .query-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .query-grid .btn-primary {
    width: 100%;
    padding: 12px 16px;
    font-size: 12px;
    text-align: center;
    display: block;
  }

  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
  }
  .stat-box {
    padding: 10px;
  }
  .stat-box-val {
    font-size: 17px;
  }
  .stat-box-lbl {
    font-size: 9px;
    letter-spacing: .1em;
  }
  .stat-box-sub {
    font-size: 10px;
  }

  .newspaper-container {
    padding: 14px 12px;
    box-shadow: 2px 2px 0 var(--shadow);
  }
  .newspaper-name {
    font-size: 20px;
    letter-spacing: .12em;
  }
  .articles-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .discord-panel {
    padding: 14px 12px;
    box-shadow: 2px 2px 0 var(--shadow);
  }
  .discord-actions {
    flex-direction: column;
    gap: 8px;
  }
  .discord-actions button {
    width: 100%;
    text-align: center;
  }
  .discord-preview-box {
    font-size: 11px;
    padding: 12px;
    max-height: 260px;
  }

  .modal-overlay {
    padding: 8px;
  }
  .modal-content {
    padding: 16px 12px;
    border-width: 2px;
    box-shadow: 4px 4px 0 var(--shadow);
  }
  .modal-close {
    top: 10px;
    right: 10px;
    padding: 3px 7px;
    font-size: 11px;
  }
  .modal-player-header {
    padding-right: 75px;
  }
  .toast-stamp {
    left: 12px;
    right: 12px;
    bottom: 12px;
    justify-content: center;
    text-align: center;
    padding: 10px 14px;
    font-size: 11px;
  }
}

/* Tablet (≤768px) — timbro statico, toolbar stack, mappa ridotta */
@media (max-width: 768px) {
  .stamp {
    position: static;
    display: table;
    margin: 0 auto 14px;
    transform: none;
    font-size: 10px;
    padding: 5px 12px;
    letter-spacing: .15em;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    gap: 10px;
  }
  .toolbar-controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .search-box {
    flex: 1 1 100% !important;
    width: 100%;
    min-width: 0 !important;
  }
  .sort-select {
    flex: 1 1 auto;
    min-width: 140px;
    font-size: 13px;
  }
  #btnToggleView {
    flex: 0 0 auto;
  }

  .map-viewport {
    height: clamp(240px, 62vw, 360px);
  }
  .map-hud-panel {
    width: 240px;
    top: 8px;
    right: 8px;
    padding: 8px 10px;
  }
  .map-search-box {
    width: 100%;
  }
}
