    body {
      background: #0a0e29;
      color: #eee;
      font-family: sans-serif;
      margin: 0;
    }

    /* HEADER-BAR oben: Avatar + Name | Suche + Text | Logout */
    #header-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 20px;
      background: #050819;
      border-bottom: 1px solid #252c3f;
    }

    #header-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .avatar-placeholder {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: #2c325a;
      border: 1px solid #454a7d;
    }

    .name-placeholder {
      font-size: 14px;
      font-weight: 600;
      color: #f3f6fb;
    }

    /* Mittlerer Bereich: Suche + Treffertext */
    #header-center {
      flex: 1;
      display: flex;
      justify-content: center;
    }

    #search-row {
      display: flex;
      align-items: center;
      gap: 10px;
      max-width: 420px;
      width: 100%;
    }

    #vehicle-search {
      flex: 1 1 auto;
      padding: 6px 10px;
      border-radius: 4px;
      border: 1px solid #454a7d;
      background: #151a2b;
      color: #f3f6fb;
      font-size: 13px;
      height: 32px;
      box-sizing: border-box;
    }

    #vehicle-search::placeholder {
      color: #8d9bb8;
      font-size: 12px;
    }

    #search-hint {
      flex: 0 0 auto;
      font-size: bold, 12px;
      color: #ffffff;
      white-space: nowrap;
    }

    /* Rechter Bereich: Logout */
    #header-right {
      display: flex;
      align-items: center;
    }

    #logout-btn {
      padding: 6px 14px;
      border-radius: 4px;
      border: 1px solid #7d4545;
      background: #5a2c2c;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 13px;
      font-weight: bold;
      white-space: nowrap;
    }

    #logout-btn:hover {
      background: #7a3838;
    }

    /* Nationen und Tree-Switcher */
    #nation-switcher {
      text-align: center;
      margin: 10px 0 8px 0;
    }

    #nation-switcher .nation-btn {
      display: inline-flex;
      align-items: center;
      margin: 0 5px;
      gap: 6px;
      padding: 8px 12px;
      border-radius: 5px;
      border: 1px solid #454a7d;
      background: #2c325a;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 14px;
      font-weight: bold;
    }

    #nation-switcher .nation-btn.active {
      border-color: #7fd2ff;
      box-shadow: 0 0 8px #7fd2ff55;
    }

    .nation-flag {
      width: 30px;
      height: 30px;
      object-fit: contain;
      border-radius: 2px;
    }

    .nation-label {
      white-space: nowrap;
    }

    #top-bar {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 16px;
      margin: 6px 0 8px 0;
      flex-wrap: wrap;
    }

    #tree-switcher {
      text-align: center;
    }

    #tree-switcher button {
      margin: 0 6px;
      padding: 8px 14px;
      border-radius: 4px;
      border: 1px solid #454a7d;
      background: #2c325a;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 14px;
      font-weight: bold;
    }

    #tree-switcher button.active {
      border-color: #ffd27f;
      box-shadow: 0 0 8px #ffd27f55;
    }

    .tree-wrapper {
      display: flex;
      justify-content: center;
      padding: 10px 0 60px;
      overflow-x: auto;
    }

    #tree {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 10px 20px;
      min-width: 700px;
      opacity: 1;
      transition: opacity 0.9s ease;
    }

    #tree.fading-out {
      opacity: 0;
    }

    .rank-row {
      position: relative;
      display: flex;
      align-items: stretch;
      margin-bottom: 4px;
    }

    .rank-row:last-child {
      border-bottom: none;
    }

    .rank-content {
      flex: 1 1 auto;
      padding-bottom: 8px;
      margin-bottom: 4px;
      border-bottom: 1px solid #3a4653;
      max-height: 1000px;
      opacity: 1;
      transition: max-height 0.25s ease, opacity 0.2s ease;
    }

    .rank-row.collapsed .rank-content {
      max-height: 0;
      opacity: 0;
    }

    .rank-row:last-child .rank-content {
      border-bottom: none;
    }

    .rank-header-column {
      min-width: 110px;
      padding-right: 6px;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
    }

    .rank-label {
      font-weight: bold;
      color: #ffd27f;
      white-space: nowrap;
      margin-top: 4px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .rank-arrow {
      font-size: 11px;
      line-height: 1;
      display: inline-block;
    }

    .branches-wrapper {
      display: flex;
      align-items: stretch;
      gap: 8px;
      position: relative;
      width: 100%;
      flex: 1 1 auto;
    }

    .branches-wrapper::after {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      border-right: 1px solid #3a4653;
      left: var(--research-divider-x, 0);
      pointer-events: none;
      overflow: hidden;
    }

    .branch-column {
      display: flex;
      flex-direction: column;
      align-self: stretch;
      gap: 6px;
      width: 170px;
      flex: 0 0 170px;
    }

    .vehicle-column {
      display: flex;
      flex-direction: column;
      gap: 6px;
      position: relative;
    }

    .branch-column.last-research {
      padding-right: 8px;
      margin-right: 4px;
    }

    .branch-column.premium-wrapper-column {
      display: flex;
      flex-direction: row;
      gap: 8px;
    }

    .branch-column.premium-column {
      border-left: none;
      padding-left: 0;
      margin-left: 0;
    }

    .vehicle {
      position: relative;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px;
      border-radius: 3px;
      background: linear-gradient(180deg, #1f2730 0%, #141a20 100%);
      border: 1px solid #3a4a5a;
      font-size: 12px;
      width: 150px;
      height: 68px;
      box-shadow: 0 0 4px #000a;
      overflow: visible;
      cursor: pointer;
    }

    .vehicle.researchable {
      background: linear-gradient(180deg, #13253a 0%, #0c1826 100%);
      border-color: #3a7bd5;
      box-shadow: 0 0 6px #3a7bd555;
    }

    .vehicle.squadron {
      background: linear-gradient(180deg, #163622 0%, #0c1f14 100%);
      border-color: #4caf50;
      box-shadow: 0 0 6px #4caf5055;
    }

    .vehicle.premium {
      background: linear-gradient(180deg, #3c3013 0%, #261d09 100%);
      border-color: #e0b84c;
      box-shadow: 0 0 6px #e0b84c55;
    }

    .vehicle.event {
      background: linear-gradient(180deg, #3a1325 0%, #260914 100%);
      border-color: #e04c7a;
      box-shadow: 0 0 6px #e04c7a55;
    }

    .vehicle.selected {
      outline: 2px solid #ffea8a;
      box-shadow: 0 0 10px #ffea8a88;
    }

    .vehicle img {
      width: 70px;
      height: 70px;
      margin-left: 3px;
      margin-top: 0;
      object-fit: contain;
      object-position: center;
      border-radius: 2px;
      opacity: 0;
      transition: opacity 200ms ease-out;
    }

    .vehicle img.visible {
      opacity: 1;
    }

    .text-block {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-self: stretch;
      justify-content: space-between;
      padding-left: 4px;
      max-height: 100%;
      overflow: hidden;
    }

    .vehicle .name {
      font-weight: 600;
      font-size: 13px;
      color: #f3f6fb;
      text-align: right;
      word-wrap: break-word;
      overflow-wrap: anywhere;
    }

    .vehicle .br {
      font-size: 11px;
      color: #dde4ec;
      text-align: right;
    }

    .vehicle.folder {
      margin-left: 16px;
      width: 134px;
      background: linear-gradient(180deg, #252c36 0%, #181e26 100%);
      border-style: dashed;
      opacity: 0.9;
    }

    .vehicle.folder .name {
      font-size: 12px;
    }

    #save-bar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: 48px;
      background: rgba(5, 10, 25, 0.95);
      display: flex;
      justify-content: center;
      align-items: center;
      box-shadow: 0 -3px 8px #000a;
      z-index: 999;
    }

    #save-bar.hidden {
      display: none;
    }

    #save-selection-btn {
      padding: 8px 18px;
      border-radius: 4px;
      border: 1px solid #4c7a4c;
      background: #245224;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 14px;
      font-weight: bold;
      white-space: nowrap;
    }

    #save-selection-btn:hover {
      background: #2f6a2f;
    }

    #modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 2000;
    }

    #modal-backdrop.visible {
      display: flex;
    }

    #success-modal {
      background: #151a2b;
      border-radius: 6px;
      border: 1px solid #4c7a4c;
      padding: 16px 20px;
      min-width: 260px;
      max-width: 360px;
      box-shadow: 0 0 16px #000a;
      text-align: center;
    }

    #success-modal h2 {
      margin: 0 0 8px 0;
      font-size: 18px;
      color: #c2ffb0;
    }

    #success-modal p {
      margin: 0 0 14px 0;
      font-size: 14px;
      color: #e5f5e0;
    }

    #success-modal button {
      padding: 6px 14px;
      border-radius: 4px;
      border: 1px solid #4c7a4c;
      background: #245224;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 13px;
      font-weight: bold;
    }

    #success-modal button:hover {
      background: #2f6a2f;
    }

    .vehicle.search-match {
      outline: 2px solid #7fd2ff;
      box-shadow: 0 0 10px #7fd2ff88;
    }

    /* Global-Search-Overlay */
    #global-search-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      display: none;
      justify-content: center;
      align-items: flex-start;
      padding-top: 40px;
      z-index: 1500;
    }

    #global-search-overlay.visible {
      display: flex;
    }

    #global-search-inner {
      background: #050819;
      border-radius: 6px;
      border: 1px solid #252c3f;
      max-width: 1600px;
      width: 95%;
      max-height: 80vh;
      padding: 0;
      box-shadow: 0 0 16px #000a;
    }

    #global-search-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 12px;
        font-size: 14px;
        color: #f3f6fb;
        background: #050819;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    #global-search-close {
      border: none;
      background: transparent;
      color: #f3f6fb;
      cursor: pointer;
      font-size: 16px;
    }

    #global-search-content {
        display: flex;
        gap: 16px;
        padding: 0 12px 10px 12px;
        max-height: 80vh;     /* hier scrollen */
        overflow: auto;
    }

    .global-search-nation {
      flex: 1 1 0;
      min-width: 140px;
      border-left: 1px solid #252c3f;
      padding-left: 8px;
    }

    .global-search-nation:first-child {
      border-left: none;
    }

    .global-search-nation-header {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-bottom: 6px;
      font-weight: 600;
    }

    .global-search-nation-header img {
      width: 20px;
      height: 14px;
      object-fit: contain;
      border-radius: 2px;
    }

    .global-search-entry {
      font-size: 12px;
      margin-bottom: 3px;
      cursor: pointer;
    }

    .global-search-entry:hover {
      text-decoration: underline;
    }

    /* Overlay Hintergrund */
    #login-overlay {
      position: fixed;
      inset: 0;
      background: #050819;
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 3000;
    }

    #login-container {
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    /* Card-Stil */
    #login-box {
      background: #0b102b;
      border-radius: 12px;
      border: 1px solid #252c3f;
      padding: 28px 32px 32px;
      max-width: 420px;
      width: 90%;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
      text-align: center;
      color: #f3f6fb;
    }

    /* Titel */
    #login-box .login-title {
      margin: 0 0 18px 0;
      font-size: 20px;
      font-weight: 700;
    }

    /* Logo */
    .login-logo-wrapper {
      display: flex;
      justify-content: center;
      margin-bottom: 24px;
    }

    .login-logo {
      width: 120px;
      height: 120px;
      border-radius: 50%;
      object-fit: cover;
      box-shadow: 0 0 18px rgba(0, 0, 0, 0.7);
    }

    /* Discord Button */
    .login-discord-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      width: 100%;
      padding: 12px 16px;
      margin-bottom: 22px;
      border-radius: 6px;
      border: none;
      background: #5865f2;
      color: #f3f6fb;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      box-shadow: 0 6px 14px rgba(88, 101, 242, 0.45);
      transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    }

    .login-discord-btn:hover {
      background: #4752c4;
      transform: translateY(-1px);
      box-shadow: 0 8px 18px rgba(88, 101, 242, 0.55);
    }

    .login-discord-btn:active {
      transform: translateY(0);
      box-shadow: 0 4px 10px rgba(88, 101, 242, 0.35);
    }

    .login-discord-icon {
      font-size: 18px;
    }

    /* Info-Text */
    .login-info {
      margin: 0;
      font-size: 13px;
      line-height: 1.5;
      color: #c3cee4;
    }

    /* App-Hauptinhalt ausblenden wenn nicht eingeloggt */
    #app-main.hidden {
      display: none;
    }

    .login-error-box {
      margin-top: 12px;
      padding: 10px 14px;
      max-width: 420px;
      width: 90%;
      border-radius: 8px;
      background: rgba(200, 50, 50, 0.15);
      border: 1px solid #e57373;
      color: #ffcccc;
      font-size: 13px;
      line-height: 1.4;
      text-align: center;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    }

    #loading-overlay {
      position: fixed;
      inset: 0;
      background: #050819;
      display: flex;               /* Startzustand: sichtbar */
      justify-content: center;
      align-items: center;
      z-index: 4000;               /* über allem */
    }

    .loading-spinner {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: 4px solid #252c3f;
      border-top-color: #5865f2;
      animation: spin 0.9s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }
    #success-modal,
    #error-modal {
      display: none;
    }
    #modal-backdrop.visible #success-modal.visible,
    #modal-backdrop.visible #error-modal.visible {
      display: block;
    }

#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 5000;
}

/* Backdrop sichtbar, aber Modale werden separat per .visible gesteuert */
#modal-backdrop.visible {
  display: flex;
}

/* Beide Modale standardmäßig unsichtbar */
#success-modal,
#error-modal {
  display: none;
}

/* Nur das jeweils aktiv gesetzte Modal anzeigen */
#success-modal.visible,
#error-modal.visible {
  display: block;
}


/* Basis-Styling für beide Modale */
#success-modal,
#error-modal {
  min-width: 280px;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 6px;
  background: #101520;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  color: #fff;
}

/* Titelzeile */
#success-modal h2,
#error-modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
  text-align: center;
}

/* Text */
#success-modal p,
#error-modal p {
  margin: 0 0 16px;
  font-size: 14px;
  text-align: center;
}

/* Buttons */
#success-modal button,
#error-modal button {
  display: block;
  margin: 0 auto;
  padding: 6px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

/* Farben unterschiedlich für Erfolg und Fehler */
#success-modal h2 {
  color: #4ade80; /* grün */
}
#success-modal button {
  background: #16a34a;
  color: #fff;
}

#error-modal h2 {
  color: #f97373; /* rot */
}
#error-modal button {
  background: #dc2626;
  color: #fff;
}
