:root {
  --bg-deep: #fcfbf9;
  --bg-panel: #f4f2ed;
  --bg-card: rgba(252, 251, 249, 0.96);
  --border: #dcd8cf;
  --border-strong: #111111;
  --text-main: #111111;
  --text-muted: #595959;
  --accent: #0369a1;
  --red: #dc2626;
  --amber: #d97706;
  --green: #059669;
  --blue: #2563eb;
  --gray: #64748b;
  --font-serif: "Noto Serif KR", "AppleMyungjo", "Batang", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
}

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

body {
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
}

.sim-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-deep);
  border-bottom: 2px solid var(--border-strong);
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  background: #111111;
  color: #fcfbf9;
  border: 1px solid #111111;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-main);
}

.brand-sub {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.tension-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
}

.tension-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.tension-bar-wrap {
  width: 90px;
  height: 7px;
  background: #e2dfd7;
  border-radius: 99px;
  overflow: hidden;
}

.tension-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  transition: width 0.35s ease;
}

.tension-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.tension-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.14);
  color: #92400e;
}

.date-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ctrl-btn:hover {
  background: var(--bg-panel);
  border-color: var(--border-strong);
}

.ctrl-btn.primary {
  background: #eff6ff;
  border-color: rgba(3, 105, 161, 0.45);
  color: #0369a1;
  font-weight: 600;
}

.ctrl-btn.primary:hover {
  background: #e0f2fe;
  border-color: #0369a1;
}

.ctrl-btn.primary.active {
  background: rgba(220, 38, 38, 0.12);
  border-color: var(--red);
  color: #991b1b;
}

.ctrl-btn.small {
  padding: 3px 8px;
  font-size: 11px;
}

.date-select {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.window-filters {
  display: inline-flex;
  background: #e9e4da;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.win-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.win-btn:hover {
  color: var(--text-main);
}

.win-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.layer-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--text-main);
  border-color: #8c877c;
}

.filter-btn.active {
  background: #111111;
  color: #fcfbf9;
  border-color: #111111;
  font-weight: 600;
}

.filter-btn.theme-pos.active {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.filter-btn.theme-neg.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selected-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hint-text {
  font-size: 11.5px;
  color: var(--text-muted);
}

.country-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e0f2fe;
  border: 1px solid rgba(3, 105, 161, 0.4);
  color: #0c4a6e;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.country-chip:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: var(--red);
  color: #991b1b;
}

.hidden {
  display: none !important;
}

/* Map Workspace (Map + Floating Right Panel) */
.map-workspace {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at 50% 45%, #eef4f9 0%, #e4ecf4 82%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Desk Flip Calendar Overlay */
.desk-calendar {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 18;
  pointer-events: none;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(252, 251, 249, 0.86);
  backdrop-filter: blur(4px);
  border: 1px solid #d5d0c5;
  border-radius: 10px;
  padding: 8px 10px 12px;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.12);
}

.desk-cal-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  font-family: var(--font-serif);
}

.desk-cal-year {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.desk-cal-weekday {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
}

.desk-cal-weekday.sun { color: #dc2626; }
.desk-cal-weekday.sat { color: #0369a1; }

.desk-cal-cards {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desk-cal-card {
  position: relative;
  width: 68px;
  height: 66px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f6f0 50%, #f1eee6 100%);
  border: 1px solid #bdb6a7;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 3px 0 #ebe7de,
    0 4px 0 #b8b2a4,
    0 6px 12px rgba(17, 17, 17, 0.12);
  transform-origin: top center;
}

.desk-cal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 11px;
  border-radius: 6px 6px 0 0;
  background: #1e293b;
}

.desk-cal-card.month-card::before {
  background: #b91c1c;
}

.desk-cal-card::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 52%;
  height: 1px;
  background: rgba(17, 17, 17, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.cal-rings {
  position: absolute;
  top: -4px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.cal-rings span {
  width: 5px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(180deg, #e2e8f0, #64748b);
  border: 0.7px solid #334155;
}

.cal-face {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--font-serif);
}

.cal-num {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  color: #111111;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.cal-unit {
  font-size: 12px;
  font-weight: 700;
  color: #595959;
}

.desk-cal-card.flipping {
  animation: deskCalFlip 0.36s ease-out;
}

@keyframes deskCalFlip {
  0% { transform: perspective(260px) rotateX(-34deg); filter: brightness(0.92); }
  100% { transform: perspective(260px) rotateX(0deg); filter: brightness(1); }
}

#worldSvg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  user-select: none;
  cursor: grab;
}

#worldSvg.dragging {
  cursor: grabbing;
}

.grid-layer line {
  stroke: rgba(15, 23, 42, 0.06);
  stroke-width: 0.6;
}

.land-poly {
  fill: #f7f5f0;
  stroke: #b8b2a6;
  stroke-width: 0.55;
  stroke-linejoin: round;
  transition: fill 0.2s ease, opacity 0.25s ease, stroke 0.2s ease;
}

.land-poly.interactive {
  cursor: pointer;
}

.land-poly.interactive:hover {
  fill: #ebe7de;
  stroke: var(--accent);
  stroke-width: 0.9;
}

.land-poly.status-red { fill: rgba(220, 38, 38, 0.16); stroke: rgba(220, 38, 38, 0.55); }
.land-poly.status-amber { fill: rgba(217, 119, 6, 0.16); stroke: rgba(217, 119, 6, 0.5); }
.land-poly.status-green { fill: rgba(5, 150, 105, 0.14); stroke: rgba(5, 150, 105, 0.45); }
.land-poly.selected {
  fill: rgba(3, 105, 161, 0.18);
  stroke: var(--accent);
  stroke-width: 1.1;
}
.land-poly.dimmed {
  fill: #f3f0ea;
  stroke: #c5bfb3;
  opacity: 0.78;
}

/* Country Pins */
.country-node {
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.country-node.dimmed {
  opacity: 0.45;
}

.country-core {
  transition: r 0.2s ease;
}

.country-node:hover .country-core,
.country-node.selected .country-core {
  r: 6;
}

.country-label {
  font-size: 8.5px;
  fill: #1e293b;
  pointer-events: none;
  text-anchor: middle;
  font-weight: 700;
  paint-order: stroke;
  stroke: #f7f5f0;
  stroke-width: 2.6px;
  stroke-linejoin: round;
}

.country-node.dimmed .country-label {
  opacity: 0.85;
}

.pulse-ring {
  fill: none;
  stroke-width: 2.1;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulseRing 2.1s infinite ease-out;
  pointer-events: none;
}

@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.85; }
  100% { transform: scale(3.1); opacity: 0; }
}

.ripple-wave {
  fill: none;
  stroke-width: 1.8;
  animation: rippleExpand 1.6s infinite ease-out;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

@keyframes rippleExpand {
  0% { transform: scale(0.7); opacity: 0.95; }
  100% { transform: scale(4.2); opacity: 0; }
}

/* Arcs */
.event-arc {
  fill: none;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.25s ease;
}

.event-arc.dimmed {
  opacity: 0.14;
}

.event-arc.military {
  stroke: var(--red);
  stroke-dasharray: 5 4;
}

.event-arc.diplomacy {
  stroke: var(--green);
}

.event-arc.economy {
  stroke: var(--blue);
  stroke-dasharray: 2 4;
}

.event-arc.unrest {
  stroke: var(--amber);
}

.event-arc.active {
  stroke-width: 2.5;
  opacity: 1;
}

.event-arc.bg {
  stroke-width: 1.1;
  opacity: 0.34;
}

.moving-badge {
  font-size: 21px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(17, 17, 17, 0.35));
}

/* Legend & Tooltip */
.map-legend {
  position: absolute;
  left: 14px;
  bottom: 12px;
  display: flex;
  gap: 12px;
  background: rgba(252, 251, 249, 0.94);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.07);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.green { background: var(--green); }
.dot.gray { background: var(--gray); }

.map-zoom-controls {
  position: absolute;
  right: 14px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(17, 17, 17, 0.12);
  transition: all 0.15s ease;
}

.zoom-btn:hover {
  background: var(--bg-panel);
  border-color: var(--border-strong);
  color: var(--accent);
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  width: max-content;
  max-width: 280px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-main);
  border: 1px solid var(--accent);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  z-index: 30;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.14);
  transition: left 0.08s ease-out, top 0.08s ease-out;
}

/* Active Event Popup anchored below country */
.map-event-popup {
  position: absolute;
  pointer-events: none;
  z-index: 25;
  width: 245px;
  max-width: calc(100% - 24px);
  background: rgba(252, 251, 249, 0.96);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  padding: 7px 10px;
  box-shadow: 0 8px 22px rgba(17, 17, 17, 0.14);
  transition: left 0.25s ease, top 0.25s ease, border-color 0.2s ease;
}

.map-event-popup.military { border-color: var(--red); }
.map-event-popup.unrest { border-color: var(--amber); }
.map-event-popup.diplomacy { border-color: var(--green); }
.map-event-popup.economy { border-color: var(--blue); }

.mep-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.mep-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.mep-badge.military { background: rgba(220, 38, 38, 0.12); color: #991b1b; border: 1px solid rgba(220, 38, 38, 0.35); }
.mep-badge.unrest { background: rgba(217, 119, 6, 0.14); color: #92400e; border: 1px solid rgba(217, 119, 6, 0.35); }
.mep-badge.diplomacy { background: rgba(5, 150, 105, 0.12); color: #065f46; border: 1px solid rgba(5, 150, 105, 0.35); }
.mep-badge.economy { background: rgba(37, 99, 235, 0.12); color: #1e40af; border: 1px solid rgba(37, 99, 235, 0.35); }

.mep-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

.mep-route {
  font-weight: 700;
  color: var(--accent);
}

.mep-date {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.mep-body {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-main);
  word-break: keep-all;
}

/* Docked Right RPG Dossier Panel */
.dossier-card {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 325px;
  height: 100%;
  background: rgba(252, 251, 249, 0.96);
  backdrop-filter: blur(6px);
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 24px rgba(17, 17, 17, 0.14);
  z-index: 35;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

@media (min-width: 821px) {
  .map-workspace:has(.dossier-card:not(.hidden)) .map-zoom-controls {
    right: 339px;
  }
}

.dossier-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

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

.dossier-flag {
  font-size: 26px;
  line-height: 1;
}

.dossier-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.dossier-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.dossier-stats {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
  color: var(--text-main);
}

.stat-bar {
  height: 6px;
  background: #e2dfd7;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
  transition: width 0.3s ease;
}

.daily-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.trend-dir.up { color: #dc2626; }
.trend-dir.down { color: #059669; }
.trend-dir.flat { color: #64748b; }

/* 3-Axis Bar Graph */
.axis-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0;
}

.axis-row {
  display: grid;
  grid-template-columns: 62px 1fr 26px;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.axis-lbl {
  color: #333333;
  font-weight: 600;
}

.axis-track {
  height: 6px;
  background: #e2dfd7;
  border-radius: 99px;
  overflow: hidden;
}

.axis-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.axis-num {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

/* Time-Series Sparkline */
.trend-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.trend-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  color: #222222;
}

.trend-legend span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.trend-legend i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.trend-svg {
  width: 100%;
  height: 104px;
  display: block;
}

.trend-dates {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.stat-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 10.5px;
}

.stat-pill {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

.dossier-info {
  font-size: 11.5px;
  color: #333333;
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.dossier-events-head {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
}

.dossier-events-list {
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.dossier-event-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dossier-event-item:hover,
.dossier-event-item.active {
  border-color: var(--accent);
  background: #eff6ff;
}

/* Bottom Ticker Bar */
.ticker-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 16px;
  background: var(--bg-deep);
  border-top: 2px solid var(--border-strong);
}

.ticker-main-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
}

.ticker-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ticker-controls .ctrl-btn.small {
  padding: 6px 11px;
  font-size: 14px;
}

.ticker-active {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.ev-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  flex-shrink: 0;
}

.ev-badge.military { background: rgba(220, 38, 38, 0.12); color: #991b1b; border: 1px solid rgba(220, 38, 38, 0.35); }
.ev-badge.unrest { background: rgba(217, 119, 6, 0.14); color: #92400e; border: 1px solid rgba(217, 119, 6, 0.35); }
.ev-badge.diplomacy { background: rgba(5, 150, 105, 0.12); color: #065f46; border: 1px solid rgba(5, 150, 105, 0.35); }
.ev-badge.economy { background: rgba(37, 99, 235, 0.12); color: #1e40af; border: 1px solid rgba(37, 99, 235, 0.35); }

.ticker-route {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.ticker-headline {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
  word-break: keep-all;
}

/* Flowing Marquee Strip */
.ticker-marquee-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  overflow: hidden;
}

.marquee-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: #dc2626;
  border: 1px solid #dc2626;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.ticker-marquee-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ticker-marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  white-space: nowrap;
  will-change: transform;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #333333;
  cursor: pointer;
  transition: color 0.15s ease;
}

.marquee-item:hover {
  color: #111111;
}

.marquee-item.active {
  color: var(--accent);
  font-weight: 700;
}

.marquee-sep {
  color: #b8b2a6;
  margin-left: 14px;
}

.ticker-queue {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  max-width: 280px;
  overflow-x: auto;
}

.q-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cdc7ba;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
}

.q-dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

/* Calendar Popover (Web Archive style) */
.calendar-trigger-wrap {
  position: relative;
  display: inline-flex;
}

.date-cal-btn {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: #ffffff;
  border-color: var(--border-strong, #b8b2a6);
  min-width: 132px;
  justify-content: center;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  width: 288px;
  background: #fcfbf9;
  border: 2px solid #1e293b;
  border-radius: 6px;
  box-shadow: 4px 4px 0 #1e293b;
  padding: 12px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #1e293b;
}

.cal-select-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.cal-select {
  padding: 3px 6px;
  border: 1px solid #475569;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.cal-step-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.cal-step-btn:hover {
  border-color: #1e293b;
  background: #f1f5f9;
  color: #0f172a;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  padding-bottom: 5px;
  border-bottom: 1px solid #e2dfd7;
  margin-bottom: 5px;
}

.cal-weekdays .sun { color: #dc2626; }
.cal-weekdays .sat { color: #2563eb; }

.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-day-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #0f172a;
  padding: 0;
}

.cal-day-empty { pointer-events: none; }

.cal-day-disabled {
  color: #cbd5e1;
  cursor: default;
}

.cal-day-available {
  font-weight: 700;
  border-color: #e2dfd7;
  background: #f5f2eb;
  cursor: pointer;
}

.cal-day-available:hover {
  border-color: #1e293b;
  background: #0f172a;
  color: #ffffff;
}

.cal-day-selected {
  background: #0369a1 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
}

.cal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2dfd7;
}

.desk-calendar {
  cursor: pointer;
}

.reset-big-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  background: #ffffff;
  border: 1.5px solid #475569;
  color: #0f172a;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

.reset-big-btn:hover {
  background: #f1f5f9;
  border-color: #0f172a;
}

.play-main-btn {
  min-width: 40px;
  height: 30px;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  background: #0369a1;
  border-color: #0369a1;
  color: #ffffff;
}

.play-main-btn:hover {
  background: #075985;
  border-color: #075985;
  color: #ffffff;
}

.play-main-btn.playing {
  background: #dc2626;
  border-color: #dc2626;
}

@media (max-width: 820px) {
  .sim-header {
    padding: 6px 10px;
    gap: 6px;
  }
  .brand-badge,
  .brand-sub,
  .tension-label,
  .selection-bar .hint-text,
  .ticker-queue {
    display: none;
  }
  .brand-title {
    font-size: 14px;
  }
  .tension-widget {
    padding: 3px 8px;
    gap: 6px;
  }
  .tension-bar-wrap {
    width: 52px;
  }
  .date-controls {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
  }
  .date-controls::-webkit-scrollbar {
    display: none;
  }
  .date-controls .ctrl-btn {
    padding: 4px 8px;
    font-size: 11.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .toolbar {
    padding: 5px 10px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .toolbar::-webkit-scrollbar {
    display: none;
  }
  .toolbar-left,
  .layer-filters {
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 5px;
  }
  .filter-btn,
  .win-btn,
  .reset-big-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .toolbar-group,
  .selection-bar {
    flex-shrink: 0;
  }
  .ticker-bar {
    padding: 5px 10px;
    gap: 6px;
  }
  .ticker-main-row {
    min-height: 36px;
    gap: 8px;
  }
  .ticker-route {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ticker-headline {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ticker-bar.is-playing .ticker-headline {
    display: none;
  }
  .calendar-popover {
    position: fixed;
    top: 82px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(300px, calc(100vw - 24px));
  }
  #worldSvg {
    touch-action: none;
  }
  .desk-calendar {
    transform: scale(0.74);
    transform-origin: top left;
    top: 8px;
    left: 8px;
  }
  .map-legend {
    left: 8px;
    bottom: 8px;
    gap: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }
  .map-zoom-controls {
    right: 8px;
    bottom: 8px;
  }
  .dossier-card {
    position: absolute;
    width: auto;
    height: auto;
    max-height: 50%;
    top: auto;
    bottom: 10px;
    left: 10px;
    right: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 -4px 20px rgba(17, 17, 17, 0.16);
    z-index: 35;
    overflow-y: auto;
  }
  .dossier-card .trend-box,
  .dossier-card .stat-pills {
    display: none;
  }
  .dossier-card .dossier-events-head {
    margin-top: 8px;
  }
  .dossier-card .dossier-events-list {
    max-height: 150px;
    overflow-y: auto;
  }
  .dossier-card .dossier-info {
    border-bottom: none;
    padding-bottom: 0;
  }
}
