.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 24px;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

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

.logoImage {
  width: 22px;
  height: 22px;
  display: block;
}

.logoText {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.5px;
  color: var(--text);
}

.version {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-2);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
}

.tagline {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
  border-left: 1px solid var(--border2);
  padding-left: 12px;
}

.right {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.githubBtnContainer {
  position: relative;
  display: flex;
  align-items: center;
}

.githubBtnContainer::after {
  content: "View on GitHub";
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.githubBtnContainer:hover::after {
  opacity: 1;
}

.githubBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.2s, color 0.15s;
  color: var(--text-2);
  line-height: 1;
  text-decoration: none;
}
.githubBtn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  transform: rotate(12deg);
  color: var(--text);
}

.themeBtnContainer {
  position: relative;
  display: flex;
  align-items: center;
}

.themeBtnContainer::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.themeBtnContainer:hover::after {
  opacity: 1;
}

.themeBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.2s;
  line-height: 1;
}
.themeBtn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  transform: rotate(12deg);
}

.reloadBtnContainer {
  position: relative;
  display: flex;
  align-items: center;
}

.reloadBtnContainer::after {
  content: "Reload Scenario Cache";
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.reloadBtnContainer:hover::after {
  opacity: 1;
}

.reloadBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.2s, color 0.15s;
  color: var(--text-2);
  line-height: 1;
}
.reloadBtn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
  transform: rotate(12deg);
}

/* Exam history button */
.historyBtnContainer {
  position: relative;
  display: flex;
  align-items: center;
}

.historyBtnContainer::after {
  content: "Exam History";
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface3);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.historyBtnContainer:hover::after {
  opacity: 1;
}

.historyBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  color: var(--text-2);
  line-height: 1;
}
.historyBtn:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.clusterBadge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
}

.clusterBadge.ready {
  background: var(--green-dim);
  border-color: rgba(57,217,138,0.3);
  color: var(--green);
}

.clusterBadge.notReady {
  background: var(--amber-dim);
  border-color: rgba(252,196,25,0.3);
  color: var(--amber);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ready .dot {
  animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Reload button spinning state */
.reloadBtnSpinning svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ── Reload Cache Modal ──────────────────────────────────────────────────────── */

.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: modalFadeIn 0.18s ease;
}

@keyframes modalFadeIn { from { opacity: 0 } to { opacity: 1 } }

.reloadModal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: min(400px, 92vw);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97) }
  to   { opacity: 1; transform: translateY(0)    scale(1) }
}

.reloadModalIcon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.reloadIconSuccess {
  background: var(--green-dim);
  border-color: rgba(57,217,138,0.3);
  color: var(--green);
}

.reloadIconError {
  background: var(--red-dim);
  border-color: rgba(255,80,80,0.3);
  color: var(--red);
}

.reloadSpinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border2);
  border-top-color: var(--text-2);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: block;
}

.reloadModalTitle {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
}

.reloadModalSub {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
}

.reloadModalError {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(255,80,80,0.25);
  border-radius: 6px;
  padding: 8px 12px;
  width: 100%;
  text-align: center;
  word-break: break-all;
}

.reloadStats {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
  width: 100%;
}

.reloadStat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 3px;
}

.reloadStatDivider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

.reloadStatNum {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.reloadStatLabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
}

.reloadModalActions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
}

.reloadPageBtn {
  flex: 1;
  padding: 9px 0;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity 0.15s;
}
.reloadPageBtn:hover { opacity: 0.85; }

.reloadCloseBtn {
  flex: 1;
  padding: 9px 0;
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}
.reloadCloseBtn:hover { background: var(--border); }
