  :root {
    --ink: #0a0a0a;
    --paper: #f0ebe0;
    --rust: #9b2226;
    --gold: #b5921f;
    --ash: #3d3d3d;
    --smoke: #c8c0b0;
    --red-dim: rgba(155,34,38,0.12);
  }

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

  html { scroll-behavior: smooth; }

  body {
    background: var(--ink);
    color: var(--paper);
    font-family: 'DM Mono', monospace;
    overflow-x: hidden;
  }

  /* ── HEADER ── */
  header {
    position: relative;
    background: var(--ink);
    border-bottom: 2px solid var(--rust);
    padding: 48px 40px 32px;
    text-align: center;
    overflow: hidden;
  }
  header::before {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      0deg,
      transparent, transparent 28px,
      rgba(155,34,38,0.06) 28px, rgba(155,34,38,0.06) 29px
    );
    pointer-events: none;
  }
  .header-eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--rust);
    text-transform: uppercase;
    margin-bottom: 16px;
  }
  h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(52px, 10vw, 96px);
    letter-spacing: 0.05em;
    line-height: 0.9;
    color: var(--paper);
    margin-bottom: 8px;
  }
  h1 span { color: var(--rust); }
  .header-sub {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 14px;
    color: var(--smoke);
    margin-top: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
  }
  .stat-bar {
    display: flex;
    justify-content: center;
    gap: 48px;
    margin-top: 32px;
    flex-wrap: wrap;
  }
  .stat-item { text-align: center; }
  .stat-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    color: var(--rust);
    display: block;
  }
  .stat-label {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--smoke);
    text-transform: uppercase;
  }

  /* ── LAYOUT ── */
  .app {
    display: grid;
    grid-template-columns: 340px 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - var(--hh, 280px));
    min-height: 600px;
  }

  /* ── FILTERS ── */
  .filters {
    grid-column: 1 / -1;
    background: #111;
    border-bottom: 1px solid #2a2a2a;
    padding: 12px 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
  }
  .filters label {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--smoke);
    text-transform: uppercase;
  }
  .filter-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--smoke);
    padding: 4px 14px;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
  }
  .filter-btn:hover, .filter-btn.active {
    background: var(--rust);
    border-color: var(--rust);
    color: #fff;
  }
  .search-box {
    background: #1a1a1a;
    border: 1px solid #333;
    color: var(--paper);
    padding: 5px 12px;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    width: 200px;
    outline: none;
    margin-left: auto;
  }
  .search-box::placeholder { color: #555; }
  .search-box:focus { border-color: var(--rust); }

  /* ── SIDEBAR LIST ── */
  .sidebar {
    background: #0d0d0d;
    border-right: 1px solid #222;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rust) #111;
  }
  .sidebar::-webkit-scrollbar { width: 4px; }
  .sidebar::-webkit-scrollbar-track { background: #111; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--rust); }

  .event-card {
    border-bottom: 1px solid #1a1a1a;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
  }
  .event-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.15s;
  }
  .event-card:hover { background: #141414; }
  .event-card:hover::before, .event-card.active::before { background: var(--rust); }
  .event-card.active { background: #160e0e; }

  .card-year {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: var(--rust);
    line-height: 1;
  }
  .card-name {
    font-size: 11px;
    color: var(--paper);
    margin-top: 2px;
    line-height: 1.4;
    font-weight: 400;
  }
  .card-country {
    font-size: 9px;
    letter-spacing: 0.15em;
    color: var(--smoke);
    margin-top: 4px;
    text-transform: uppercase;
  }
  .card-tags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
  }
  .tag {
    font-size: 8px;
    letter-spacing: 0.1em;
    padding: 2px 6px;
    border: 1px solid;
    text-transform: uppercase;
  }
  .tag-war { border-color: #7a1a1a; color: #ff6b6b; }
  .tag-invasion { border-color: #7a4a1a; color: #ffaa6b; }
  .tag-bombing { border-color: #4a6a7a; color: #6baeff; }
  .tag-coup { border-color: #5a7a2a; color: #9aee6b; }
  .tag-occupation { border-color: #5a1a7a; color: #cc6bff; }
  .tag-naval { border-color: #1a5a7a; color: #6bddff; }
  .tag-proxy { border-color: #7a6a1a; color: #ffdd6b; }

  /* ── DETAIL PANEL ── */
  .detail {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--rust) #0d0d0d;
    background: #0a0a0a;
  }
  .detail::-webkit-scrollbar { width: 4px; }
  .detail::-webkit-scrollbar-thumb { background: var(--rust); }

  .detail-inner {
    padding: 40px 48px;
    max-width: 800px;
  }

  .detail-year-badge {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 80px;
    color: var(--rust);
    opacity: 0.15;
    line-height: 1;
    position: absolute;
    top: 32px;
    right: 48px;
    pointer-events: none;
    letter-spacing: 0.05em;
  }

  .detail-wrap { position: relative; }

  .detail-eyebrow {
    font-size: 9px;
    letter-spacing: 0.3em;
    color: var(--rust);
    text-transform: uppercase;
    margin-bottom: 8px;
  }

  .detail-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 5vw, 48px);
    color: var(--paper);
    line-height: 1.05;
    margin-bottom: 8px;
  }

  .detail-location {
    font-size: 11px;
    color: var(--smoke);
    letter-spacing: 0.1em;
    margin-bottom: 24px;
    text-transform: uppercase;
  }

  .detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }

  .divider {
    width: 48px;
    height: 2px;
    background: var(--rust);
    margin-bottom: 24px;
  }

  .detail-desc {
    font-family: 'Libre Baskerville', serif;
    font-size: 14px;
    line-height: 1.8;
    color: #ccc;
    margin-bottom: 32px;
  }

  /* ── STATS GRID ── */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1px;
    background: #1a1a1a;
    border: 1px solid #1a1a1a;
    margin-bottom: 32px;
  }
  .stats-grid--two-col {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-cell {
    background: #0d0d0d;
    padding: 16px;
  }
  .stat-cell-label {
    font-size: 8px;
    letter-spacing: 0.2em;
    color: #555;
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .stat-cell-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    color: var(--gold);
    line-height: 1;
  }
  .stat-cell-value.red { color: var(--rust); }
  .stat-cell-value.white { color: var(--paper); font-size: 16px; font-family: 'DM Mono', monospace; }
  .stat-cell-sub {
    font-size: 9px;
    color: #444;
    margin-top: 4px;
  }

  /* ── KEY FACTS ── */
  .key-facts {
    margin-bottom: 32px;
  }
  .key-facts h3 {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.3em;
    color: var(--rust);
    text-transform: uppercase;
    margin-bottom: 12px;
  }
  .fact-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #1a1a1a;
    font-size: 12px;
    color: #aaa;
    line-height: 1.4;
  }
  .fact-item::before {
    content: '//';
    color: var(--rust);
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 1px;
  }

  /* ── OUTCOME ── */
  .outcome-box {
    background: #111;
    border-left: 3px solid var(--gold);
    padding: 16px 20px;
    margin-bottom: 32px;
  }
  .outcome-label {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 6px;
  }
  .outcome-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: 13px;
    color: #bbb;
    line-height: 1.6;
  }

  /* ── EMPTY STATE ── */
  .empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    flex-direction: column;
    gap: 12px;
    color: #333;
    text-align: center;
    padding: 40px;
  }
  .empty-state .big { font-family: 'Bebas Neue', sans-serif; font-size: 64px; color: #1a1a1a; }
  .empty-state p { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #333; }

  /* ── TIMELINE ── */
  .timeline-section {
    background: #050505;
    border-top: 2px solid #1a1a1a;
    padding: 40px;
    overflow-x: auto;
  }
  .timeline-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: var(--paper);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
  }
  .timeline-sub {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--smoke);
    text-transform: uppercase;
    margin-bottom: 32px;
  }

  .tl-container {
    position: relative;
    min-height: 120px;
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--rust) #111;
    cursor: grab;
  }
  .tl-container:active { cursor: grabbing; }
  .tl-container::-webkit-scrollbar { height: 6px; }
  .tl-container::-webkit-scrollbar-track { background: #111; }
  .tl-container::-webkit-scrollbar-thumb { background: var(--rust); }
  .tl-track {
    position: relative;
    height: 80px;
  }
  .tl-axis {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 2px;
    background: linear-gradient(to right, transparent, #2a2a2a 5%, #2a2a2a 95%, transparent);
  }
  .tl-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--rust);
    background: var(--ink);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
  }
  .tl-dot:hover, .tl-dot.active {
    background: var(--rust);
    width: 14px;
    height: 14px;
    box-shadow: 0 0 12px rgba(155,34,38,0.6);
  }
  .tl-dot-label {
    position: absolute;
    top: calc(50% + 14px);
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 10px;
    color: #555;
    white-space: nowrap;
    pointer-events: none;
    transition: color 0.2s;
  }
  .tl-dot:hover .tl-dot-label, .tl-dot.active .tl-dot-label {
    color: var(--rust);
  }
  .tl-decade-marker {
    position: absolute;
    top: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 24px;
    background: #222;
    margin-top: -12px;
  }

  .tl-dot.tl-live {
    border-color: #ff4444 !important;
    box-shadow: 0 0 8px rgba(255,68,68,0.5);
    animation: livePulse 1.4s infinite;
  }
  @keyframes livePulse {
    0%,100% { box-shadow: 0 0 6px rgba(255,68,68,0.5); }
    50% { box-shadow: 0 0 16px rgba(255,68,68,0.9); }
  }
  .tl-decade-label {
    position: absolute;
    top: calc(50% - 30px);
    transform: translateX(-50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: 11px;
    color: #333;
    white-space: nowrap;
  }

  /* ── ERA LEGEND ── */
  .era-legend {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .era-item { display: flex; align-items: center; gap: 8px; }
  .era-dot { width: 10px; height: 10px; border-radius: 50%; }
  .era-label { font-size: 9px; letter-spacing: 0.15em; color: #666; text-transform: uppercase; }

  /* ── COUNT BADGE ── */
  .count-badge {
    background: var(--rust);
    color: #fff;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    padding: 2px 8px;
    margin-left: 8px;
  }

  .event-card.live-event {
    border-left: 3px solid #ff4444 !important;
  }
  .live-badge {
    display: inline-block;
    background: #ff4444;
    color: #fff;
    font-size: 8px;
    letter-spacing: 0.15em;
    padding: 2px 6px;
    animation: blink 1.2s infinite;
    margin-left: 6px;
    vertical-align: middle;
  }
  @keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }
  @media (max-width: 768px) {
    header { padding: 24px 16px 18px; }
    .header-eyebrow { font-size: 9px; letter-spacing: 0.15em; }
    .header-sub { font-size: 12px; margin-top: 10px; }
    .stat-bar { gap: 12px 20px; margin-top: 18px; }
    .stat-num { font-size: 26px; }
    .stat-label { font-size: 7px; letter-spacing: 0.1em; }

    .filters { gap: 6px 8px; padding: 10px 12px; }
    .filter-btn { padding: 7px 10px; font-size: 9px; }
    .search-box { width: 100%; margin-left: 0; margin-top: 2px; }

    .app { grid-template-columns: 1fr; height: auto; min-height: unset; }
    .sidebar { max-height: 42vh; min-height: 180px; border-right: none; border-bottom: 1px solid #222; }
    .detail { min-height: 60vh; }
    .detail-inner { padding: 20px 16px; }
    .detail-year-badge { font-size: 52px; right: 16px; top: 14px; }

    .empty-state .big { font-size: 0; }
    .empty-state .big::after { content: '↓'; font-size: 64px; color: #1a1a1a; font-family: 'Bebas Neue', sans-serif; }
    .empty-state p { font-size: 10px; }

    .timeline-section { padding: 24px 14px; }
    .timeline-title { font-size: 22px; }
    .timeline-sub { font-size: 8px; letter-spacing: 0.1em; }
  }

  /* ── LOSSES PANEL ── */
  .losses-panel {
    margin-bottom: 32px;
    border: 1px solid #1e1e1e;
  }
  .losses-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #0d0d0d;
    border-bottom: 1px solid #1e1e1e;
  }
  .losses-line {
    flex: 1;
    height: 1px;
    background: #2a2a2a;
  }
  .losses-title-text {
    font-size: 9px;
    letter-spacing: 0.3em;
    color: var(--rust);
    text-transform: uppercase;
    white-space: nowrap;
  }
  .losses-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: #1a1a1a;
  }
  .losses-col {
    background: #0a0a0a;
    padding: 16px;
  }
  .losses-col-head {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e1e1e;
  }
  .losses-flag-label {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 30px;
    line-height: 1;
    margin-bottom: 3px;
  }
  .losses-flag-label.us-label   { color: #5577cc; }
  .losses-flag-label.iran-label { color: #cc5533; }
  .losses-col-sublabel {
    display: block;
    font-size: 8px;
    letter-spacing: 0.2em;
    color: #555;
    text-transform: uppercase;
  }
  .loss-row {
    margin-bottom: 14px;
  }
  .loss-icons-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    min-height: 22px;
  }
  .loss-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.15s;
  }
  .loss-icon:hover { opacity: 1; }
  .loss-overflow {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    opacity: 0.9;
    margin-left: 2px;
    line-height: 1;
  }
  .loss-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .loss-aircraft-name {
    font-size: 10px;
    color: var(--paper);
    letter-spacing: 0.05em;
  }
  .loss-aircraft-count {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15px;
    line-height: 1;
  }
  .loss-aircraft-note {
    font-size: 9px;
    color: #444;
    font-style: italic;
  }
  @media (max-width: 768px) {
    .losses-cols { grid-template-columns: 1fr; }
    .losses-flag-label { font-size: 22px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid--two-col { grid-template-columns: 1fr; }
  }

  /* ── COUNTRIES SECTION ── */
  .countries-section {
    background: #050505;
    border-top: 2px solid var(--rust);
    padding: 48px 40px 64px;
  }
  .countries-section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    color: var(--paper);
    letter-spacing: 0.1em;
    margin-bottom: 6px;
  }
  .countries-section-sub {
    font-size: 9px;
    letter-spacing: 0.2em;
    color: var(--smoke);
    text-transform: uppercase;
    margin-bottom: 36px;
  }
  .countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
  }
  .country-row {
    display: flex;
    align-items: baseline;
    border-bottom: 1px solid #1a1a1a;
    padding: 10px 0;
    gap: 12px;
  }
  .country-row-name {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--paper);
    letter-spacing: 0.05em;
    white-space: nowrap;
  }
  .country-row-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 13px;
    color: var(--rust);
    margin-right: 6px;
    flex-shrink: 0;
  }
  .country-row-years {
    font-family: 'DM Mono', monospace;
    font-size: 9px;
    color: var(--smoke);
    letter-spacing: 0.05em;
    text-align: right;
    flex-shrink: 0;
  }
  @media (max-width: 768px) {
    .countries-section { padding: 28px 16px 40px; }
    .countries-section-title { font-size: 22px; }
    .countries-grid { grid-template-columns: 1fr; }
    .country-row-years { font-size: 8px; }
  }
