:root {
  --parchment-light: #f0e6c8;
  --parchment-mid:   #e8d5a8;
  --parchment-dark:  #c9a96e;
  --parchment-edge:  #8b6914;
  --ink:             #2c1a0a;
  --ink-light:       #4a2f0f;
  --border-gold:     #9a6f1a;
  --panel-bg:        rgba(20,10,2,0.88);
  --panel-border:    #6b4a12;
  --btn-bg:          #3a2205;
  --btn-hover:       #5a3510;
  --btn-active:      #7a4a15;
  --btn-disabled:    #1a1005;
  --gold-color:      #d4a017;
  --army-color:      #8b2020;
  --research-color:  #2060a0;
  --infra-color:     #207040;
  --log-bg:          rgba(10,5,0,0.75);
  --shadow:          rgba(0,0,0,0.7);
  --aethelred-fill:  #7a8a52;
  --glimmerock-fill: #9e5c3a;
  --seaborne-fill:   #4a6e8a;
  --brighthelm-fill: #3d6e3a;
  --sunstone-fill:   #c8a83a;
  --grimforge-fill:  #7a4a1a;
  --whisperwood-fill:#3a6e6a;
}

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

body {
  background: #100800;
  color: var(--parchment-light);
  font-family: Georgia, 'Times New Roman', serif;
  height: 100vh;
  overflow: hidden;
}

/* ── OUTER FRAME ─────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ── TOP TITLE BAR ───────────────────────────────────────── */
#title-bar {
  grid-column: 1 / -1;
  text-align: center;
  padding: 8px 16px 4px;
  background: linear-gradient(180deg, #0a0500 0%, #1a0d02 100%);
  border-bottom: 2px solid var(--border-gold);
  letter-spacing: 0.12em;
}
#title-bar h1 {
  font-size: 1.5rem;
  color: var(--gold-color);
  text-shadow: 0 0 12px #c8800040, 1px 1px 2px #000;
}
#title-bar p {
  font-size: 0.7rem;
  color: var(--parchment-dark);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* ── SIDE PANELS ─────────────────────────────────────────── */
#left-panel, #right-panel {
  background: var(--panel-bg);
  border-top: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #5a3510 #100800;
}
#left-panel::-webkit-scrollbar,
#right-panel::-webkit-scrollbar { width: 5px; }
#left-panel::-webkit-scrollbar-track,
#right-panel::-webkit-scrollbar-track { background: #100800; }
#left-panel::-webkit-scrollbar-thumb,
#right-panel::-webkit-scrollbar-thumb { background: #5a3510; border-radius: 3px; }
#left-panel  { border-right: 2px solid var(--panel-border); }
#right-panel { border-left:  2px solid var(--panel-border); }

.panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid #3a2208;
}
.panel-section h2 {
  font-size: 0.78rem;
  color: var(--parchment-dark);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 8px;
  border-bottom: 1px solid #3a2208;
  padding-bottom: 4px;
}

/* Kingdom header */
#kingdom-header {
  padding: 14px;
  border-bottom: 1px solid #3a2208;
}
#kingdom-crest {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 4px;
}
#kingdom-name {
  font-size: 1.15rem;
  color: var(--gold-color);
  font-weight: bold;
}
#kingdom-owner {
  font-size: 0.72rem;
  color: var(--parchment-dark);
  letter-spacing: 0.1em;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.stat-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid #3a2208;
  border-radius: 3px;
  padding: 6px 8px;
  text-align: center;
}
.stat-value {
  font-size: 1.25rem;
  font-weight: bold;
  line-height: 1;
}
.stat-label {
  font-size: 0.6rem;
  color: var(--parchment-dark);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}
.stat-gold    { color: var(--gold-color); }
.stat-army    { color: var(--army-color); }
.stat-research{ color: var(--research-color); }
.stat-infra   { color: var(--infra-color); }

#bonus-desc {
  font-size: 0.68rem;
  color: #c8a870;
  line-height: 1.5;
  margin-top: 2px;
  font-style: italic;
}

#kingdom-list {
  font-size: 0.68rem;
  line-height: 1.8;
}
.kl-entry { display: flex; align-items: center; gap: 6px; }
.kl-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kl-name  { flex: 1; color: var(--parchment-light); }
.kl-armies{ color: var(--army-color); }
.kl-conquered { opacity: 0.55; text-decoration: line-through; }
.kl-controlled { font-weight: bold; }

/* ── ACTION MENU ─────────────────────────────────────────── */
#action-menu { flex: 1; }

.action-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: var(--btn-bg);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  color: var(--parchment-light);
  font-family: Georgia, serif;
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.05em;
}
.action-btn:hover:not(:disabled) {
  background: var(--btn-hover);
  border-color: var(--gold-color);
}
.action-btn:active:not(:disabled) { background: var(--btn-active); }
.action-btn:disabled {
  background: var(--btn-disabled);
  color: #555;
  cursor: not-allowed;
  border-color: #2a1808;
}
.action-btn .cost {
  float: right;
  color: var(--gold-color);
  font-size: 0.65rem;
}
.action-btn .effect {
  display: block;
  font-size: 0.62rem;
  color: var(--parchment-dark);
  margin-top: 1px;
}

/* ── LOG ─────────────────────────────────────────── */
#log-section {
  display: flex;
  flex-direction: column;
  min-height: 180px;
}
#log-scroll {
  height: 260px;
  overflow-y: auto;
  padding: 8px 12px;
  font-size: 0.65rem;
  line-height: 1.65;
  color: var(--parchment-dark);
  background: var(--log-bg);
  scrollbar-width: thin;
  scrollbar-color: #5a3510 #100800;
}
#log-scroll::-webkit-scrollbar { width: 5px; }
#log-scroll::-webkit-scrollbar-track { background: #100800; }
#log-scroll::-webkit-scrollbar-thumb { background: #5a3510; border-radius: 3px; }
.log-entry { margin-bottom: 3px; padding-bottom: 3px; border-bottom: 1px solid #2a1808; }
.log-round  { color: var(--gold-color); font-weight: bold; letter-spacing: 0.1em; margin: 6px 0 2px; }
.log-win    { color: #f0c040; font-weight: bold; }
.log-attack { color: #d04040; }
.log-trade  { color: var(--infra-color); }
.log-spy    { color: #a060d0; }
.log-build  { color: var(--infra-color); }
.log-research { color: var(--research-color); }

/* ── MAP CENTER ──────────────────────────────────────────── */
#map-area {
  background: #1a0e04;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 12px;
  position: relative;
}

#map-svg {
  width: 100%;
  max-width: 700px;
  height: auto;
  border: 3px solid var(--border-gold);
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(0,0,0,0.8), inset 0 0 60px rgba(0,0,0,0.3);
  cursor: default;
}

/* kingdom territory hover */
.territory {
  cursor: pointer;
  transition: filter 0.15s;
}
.territory:hover { filter: brightness(1.25); }
.territory.targetable { cursor: crosshair; }
.territory.targetable:hover { filter: brightness(1.4) drop-shadow(0 0 6px white); }

/* army count labels */
.army-label {
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: bold;
  fill: #fff;
  text-shadow: 1px 1px 2px #000;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 2.5px;
  pointer-events: none;
}
.territory-label {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 10px;
  fill: #1a0a00;
  paint-order: stroke;
  stroke: rgba(240,220,180,0.6);
  stroke-width: 2px;
  pointer-events: none;
  font-style: italic;
  letter-spacing: 0.08em;
}

/* ── BOTTOM BAR ──────────────────────────────────────────── */
#bottom-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: linear-gradient(0deg, #0a0500 0%, #1a0d02 100%);
  border-top: 2px solid var(--border-gold);
  gap: 12px;
}

#player-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
#current-player-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gold-color);
  flex-shrink: 0;
}
#current-player-text {
  font-size: 0.8rem;
  color: var(--parchment-light);
}
#current-player-text strong { color: var(--gold-color); }

#round-counter {
  font-size: 0.78rem;
  color: var(--parchment-dark);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#turn-timer {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  font-weight: bold;
  min-width: 40px;
  text-align: center;
  color: #a0b878;
  letter-spacing: 0.05em;
  transition: color 0.3s;
}

#end-turn-btn {
  padding: 10px 28px;
  background: linear-gradient(180deg, #5a3510 0%, #3a2005 100%);
  border: 2px solid var(--border-gold);
  border-radius: 4px;
  color: var(--gold-color);
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
#end-turn-btn:hover {
  background: linear-gradient(180deg, #7a4a20 0%, #5a3010 100%);
  box-shadow: 0 0 12px #d4a01740;
}
#end-turn-btn:active {
  background: linear-gradient(180deg, #9a5a25 0%, #6a3a15 100%);
}
#end-turn-btn:disabled {
  background: #1a1005;
  color: #444;
  border-color: #3a2208;
  cursor: not-allowed;
}

/* ── MODAL OVERLAY ───────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#modal-overlay.open { display: flex; }

#modal-box {
  background: linear-gradient(160deg, #1e1204 0%, #0e0800 100%);
  border: 2px solid var(--border-gold);
  border-radius: 6px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 0 40px rgba(0,0,0,0.9), 0 0 80px rgba(200,128,0,0.1);
  position: relative;
}
#modal-box h3 {
  font-size: 1.1rem;
  color: var(--gold-color);
  margin-bottom: 12px;
  letter-spacing: 0.1em;
  border-bottom: 1px solid #3a2208;
  padding-bottom: 8px;
}
#modal-body {
  font-size: 0.78rem;
  color: var(--parchment-light);
  line-height: 1.6;
  margin-bottom: 14px;
}
#modal-body p { margin-bottom: 8px; }

.modal-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.modal-btn {
  flex: 1;
  min-width: 80px;
  padding: 7px 12px;
  background: var(--btn-bg);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  color: var(--parchment-light);
  font-family: Georgia, serif;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-btn:hover { background: var(--btn-hover); border-color: var(--gold-color); }
.modal-btn.cancel { background: #1a0805; color: #888; }
.modal-btn.cancel:hover { background: #2a1208; }
.modal-btn.confirm { background: #3a1a05; color: var(--gold-color); border-color: var(--gold-color); }
.modal-btn.confirm:hover { background: #5a2a08; }

/* Army slider */
#army-slider-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
#army-slider { flex: 1; accent-color: var(--gold-color); }
#army-slider-val { color: var(--gold-color); font-weight: bold; min-width: 20px; }

/* Victory modal */
#victory-box {
  text-align: center;
  max-width: 500px;
}
#victory-box h3 {
  font-size: 1.6rem;
  color: var(--gold-color);
  text-shadow: 0 0 20px #d4a01780;
  margin-bottom: 8px;
}
#victory-kingdom {
  font-size: 2.5rem;
  margin: 8px 0;
}
#victory-details {
  font-size: 0.82rem;
  color: var(--parchment-dark);
  margin-bottom: 16px;
}

/* Info box for selected target */
#target-info {
  background: rgba(255,255,255,0.03);
  border: 1px solid #3a2208;
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 0.7rem;
  color: var(--parchment-dark);
  line-height: 1.7;
  margin-top: 4px;
}
#target-info .ti-name {
  font-size: 0.9rem;
  color: var(--gold-color);
  margin-bottom: 4px;
}
#target-info .ti-unknown { color: #666; font-style: italic; }

/* Spy badge */
.spy-badge {
  display: inline-block;
  background: #3a0060;
  color: #c080ff;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Research dots */
.level-dots {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
  margin-left: 4px;
}
.level-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1px solid currentColor;
}
.level-dot.filled { background: currentColor; }

/* Fortify indicator */
.fortified-badge {
  display: inline-block;
  background: #003a60;
  color: #80c0ff;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 4px;
}

/* Trade treaty badge */
.treaty-badge {
  display: inline-block;
  background: #1a3a20;
  color: #80d090;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 2px;
  margin-right: 3px;
}

/* Turn used indicator */
#turn-used-notice {
  font-size: 0.7rem;
  color: #a06020;
  text-align: center;
  padding: 6px;
  background: rgba(160,96,32,0.1);
  border: 1px solid #5a3210;
  border-radius: 3px;
  margin: 6px 14px;
}

/* ── Turn Banner (top of map, replaces waiting overlay) ──── */
#turn-banner {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 50;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  background: linear-gradient(90deg, rgba(10,6,1,0.92) 0%, rgba(26,16,4,0.88) 50%, rgba(10,6,1,0.92) 100%);
  border-bottom: 1px solid #5a3a10;
  backdrop-filter: blur(2px);
}
#turn-banner.visible { display: flex; }

#turn-banner-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
#turn-banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
#turn-banner-name {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  font-weight: bold;
  color: #d4a017;
  letter-spacing: 0.06em;
}
#turn-banner-sub {
  font-family: Georgia, serif;
  font-size: 0.65rem;
  color: #7a5a28;
  font-style: italic;
}
#turn-banner-crest {
  font-size: 1.4rem;
  opacity: 0.7;
}

/* ── End Screen ─────────────────────────────────────────── */
#end-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 1.2s ease;
}
#end-screen-overlay.visible {
  background: rgba(0,0,0,0.88);
}

#end-screen-box {
  position: relative;
  max-width: 520px;
  width: 90%;
  padding: 48px 40px 40px;
  border-radius: 4px;
  text-align: center;
  font-family: Georgia, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}
#end-screen-overlay.visible #end-screen-box {
  opacity: 1;
  transform: translateY(0);
}

/* Victory variant */
#end-screen-box.end-victory {
  background: linear-gradient(160deg, #1e1a08 0%, #100e04 100%);
  border: 1px solid #8a6010;
  box-shadow:
    0 0 60px rgba(212,160,23,0.25),
    0 0 120px rgba(212,160,23,0.1),
    inset 0 1px 0 rgba(212,160,23,0.15);
}
#end-screen-box.end-victory::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(180,120,20,0.3);
  border-radius: 3px;
  pointer-events: none;
}

/* Defeat variant */
#end-screen-box.end-defeat {
  background: linear-gradient(160deg, #140a0a 0%, #0c0606 100%);
  border: 1px solid #5a1a1a;
  box-shadow:
    0 0 60px rgba(160,40,20,0.2),
    inset 0 1px 0 rgba(200,80,40,0.1);
}
#end-screen-box.end-defeat::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(140,50,30,0.25);
  border-radius: 3px;
  pointer-events: none;
}

#end-crest {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 20px currentColor);
}
.end-victory #end-crest { color: #d4a017; }
.end-defeat  #end-crest { color: #8a3020; }

#end-title {
  font-size: 2rem;
  letter-spacing: 0.2em;
  font-weight: bold;
  text-transform: uppercase;
}
.end-victory #end-title {
  color: #d4a017;
  text-shadow: 0 0 30px #d4a01780, 0 0 60px #d4a01740;
}
.end-defeat #end-title {
  color: #a04030;
  text-shadow: 0 0 20px #a0403060;
}

#end-subtitle {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  font-style: italic;
}
.end-victory #end-subtitle { color: #9a7840; }
.end-defeat  #end-subtitle { color: #7a4030; }

#end-divider {
  width: 60%;
  height: 1px;
  margin: 4px 0;
}
.end-victory #end-divider { background: linear-gradient(90deg, transparent, #8a6010, transparent); }
.end-defeat  #end-divider { background: linear-gradient(90deg, transparent, #6a2a18, transparent); }

#end-lore {
  font-size: 0.82rem;
  line-height: 1.8;
  max-width: 400px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
#end-lore.visible { opacity: 1; transform: translateY(0); }
.end-victory #end-lore { color: #c8a868; }
.end-defeat  #end-lore { color: #9a7060; }

#end-stats {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: #7a6030;
  margin-top: -4px;
}

#end-btn {
  margin-top: 10px;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding: 10px 28px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.end-victory #end-btn {
  border: 1px solid #5a3a10;
  color: #9a7030;
}
.end-victory #end-btn:hover {
  background: #2a1e08;
  border-color: #d4a017;
  color: #d4a017;
}
.end-defeat #end-btn {
  border: 1px solid #4a1a10;
  color: #7a4030;
}
.end-defeat #end-btn:hover {
  background: #1a0a08;
  border-color: #a04030;
  color: #c05040;
}

/* End screen button row */
#end-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

#end-btn-watch {
  background: transparent;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 10px 28px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #3a5028;
  color: #70a040;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
#end-btn-watch:hover {
  background: #1a2a10;
  border-color: #80b040;
  color: #a0d060;
}

/* ── Chronicle Button (end screen) ─────────────────────── */
#end-btn-chronicle {
  background: transparent;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  padding: 8px 20px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border: 1px solid #3a3428;
  color: #8a7850;
}
#end-btn-chronicle:hover {
  background: #201c10;
  border-color: #c0a050;
  color: #d4b870;
}

/* ── Play Again Button (end screen) ────────────────────── */
#end-btn-again {
  background: transparent;
  font-family: Georgia, serif;
  font-size: 0.8rem;
  padding: 8px 20px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border: 1px solid #3a5028;
  color: #70a040;
}
#end-btn-again:hover {
  background: #1a2a10;
  border-color: #80b040;
  color: #a0d060;
}

/* ── Chronicle Modal ────────────────────────────────────── */
#chronicle-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
}
#chronicle-modal.visible {
  background: rgba(0,0,0,0.82);
}
#chronicle-box {
  width: min(680px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: #0e0c08;
  border: 1px solid #5a4818;
  border-radius: 6px;
  box-shadow: 0 0 60px rgba(180,130,20,0.12);
  overflow: hidden;
}
#chronicle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #3a2e10;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  color: #c0a050;
  background: #13110a;
  flex-shrink: 0;
}
#chronicle-close {
  background: none;
  border: none;
  color: #7a6030;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.2s;
}
#chronicle-close:hover { color: #c0a050; }
#chronicle-scroll {
  overflow-y: auto;
  padding: 12px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#chronicle-scroll .log-entry {
  font-size: 0.78rem;
  padding: 3px 0;
}

/* ── Action Toast ───────────────────────────────────────── */
#action-toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  z-index: 300;
  background: linear-gradient(135deg, #1e1608, #0e0a04);
  border: 1px solid #8a6010;
  border-radius: 4px;
  padding: 10px 24px;
  font-family: Georgia, serif;
  font-size: 0.85rem;
  color: #d4a017;
  letter-spacing: 0.06em;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.7), 0 0 20px rgba(212,160,23,0.1);
  white-space: nowrap;
}
#action-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Event Toast ────────────────────────────────────────── */
#event-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  z-index: 350;
  background: linear-gradient(135deg, #1a0e04, #0a0600);
  border: 1px solid #6a4a10;
  border-top: 3px solid #c87010;
  border-radius: 6px;
  padding: 16px 32px;
  font-family: Georgia, serif;
  font-size: 1rem;
  color: #e8c87a;
  letter-spacing: 0.08em;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 8px 40px rgba(0,0,0,0.85), 0 0 30px rgba(200,112,16,0.15);
  max-width: 480px;
}
#event-toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.log-event { color: #c87010; font-style: italic; }

/* ── Round Summary Overlay ──────────────────────────────── */
#round-summary-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.82);
  align-items: center;
  justify-content: center;
}
#round-summary-overlay.open { display: flex; }

#round-summary-box {
  background: linear-gradient(160deg, #1a1206, #0e0a02);
  border: 1px solid #7a5010;
  border-radius: 6px;
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0,0,0,0.9), 0 0 40px rgba(200,128,0,0.08);
}
#round-summary-box::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(160,100,10,0.2);
  border-radius: 4px;
  pointer-events: none;
}

#rs-header {
  padding: 20px 28px 14px;
  border-bottom: 1px solid #3a2208;
  flex-shrink: 0;
}
#rs-round-label {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #d4a017;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

#rs-events {
  overflow-y: auto;
  padding: 16px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #5a3510 #100800;
}
#rs-events::-webkit-scrollbar { width: 5px; }
#rs-events::-webkit-scrollbar-track { background: #100800; }
#rs-events::-webkit-scrollbar-thumb { background: #5a3510; border-radius: 3px; }

.rs-event {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: Georgia, serif;
  font-size: 0.75rem;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px solid #1e1206;
  animation: rs-fadein 0.3s ease both;
}
.rs-event-icon { font-size: 1rem; flex-shrink: 0; }
.rs-event-text { color: #c8a868; flex: 1; }
.rs-event.rs-attack  .rs-event-text { color: #d07050; }
.rs-event.rs-trade   .rs-event-text { color: #80d090; }
.rs-event.rs-spy     .rs-event-text { color: #c080ff; }
.rs-event.rs-build   .rs-event-text { color: #80c0ff; }
.rs-event.rs-research .rs-event-text { color: #a0d870; }
.rs-event.rs-round   .rs-event-text { color: #d4a017; font-weight: bold; letter-spacing: 0.1em; }
.rs-event.rs-win     .rs-event-text { color: #f0c040; font-weight: bold; }

@keyframes rs-fadein {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

#rs-footer {
  padding: 14px 28px 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
#rs-countdown-bar {
  width: 100%;
  height: 3px;
  background: #2a1808;
  border-radius: 2px;
  overflow: hidden;
}
#rs-countdown-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #d4a017, #8a6010);
  border-radius: 2px;
  transform-origin: left;
  transition: transform 1s linear;
}
#rs-countdown-text {
  font-family: Georgia, serif;
  font-size: 0.7rem;
  color: #6a4a18;
  letter-spacing: 0.08em;
}

/* Spectator badge */
#spectator-badge {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(10,8,4,0.85);
  border: 1px solid #3a2510;
  border-radius: 20px;
  padding: 5px 16px;
  font-family: Georgia, serif;
  font-size: 0.7rem;
  color: #7a5a20;
  letter-spacing: 0.08em;
  pointer-events: none;
}

#music-credit {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-family: Georgia, serif;
  font-size: 0.6rem;
  color: #4a3a1a;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 10;
}
