:root {
  --bg-deep: #070b14;
  --bg-panel: #101726;
  --bg-panel-alt: #162033;
  --bg-bevel-top: #2b3b59;
  --bg-bevel-bottom: #060911;
  --accent-cyan: #00f0ff;
  --accent-gold: #ffcc4d;
  --accent-green: #00ff9d;
  --accent-pink: #ff2a85;
  --accent-purple: #a855f7;
  --accent-orange: #f97316;
  --text-main: #e8f0ff;
  --text-muted: #8fa3c7;
  --border-subtle: rgba(0, 240, 255, 0.22);
  --font-ui: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-ui);
  overflow: hidden;
  user-select: none;
}

/* Classic RollerCoaster Tycoon meets Cyber-Silicon Beveled Window Frame (CR-005) */
.rct-window {
  background: var(--bg-panel);
  border-top: 2px solid #4e658f;
  border-left: 2px solid #4e658f;
  border-right: 3px solid #04070e;
  border-bottom: 3px solid #04070e;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 204, 77, 0.16), inset 0 0 0 1px rgba(0, 240, 255, 0.08);
}

.rct-titlebar {
  background: linear-gradient(90deg, #3b2314 0%, #1e2d4a 55%, #121d33 100%);
  border-top: 1px solid rgba(251, 191, 36, 0.42);
  border-bottom: 2px solid #080d18;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--accent-gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rct-btn {
  background: linear-gradient(180deg, #243554 0%, #162238 100%);
  border-top: 2px solid #3c527a;
  border-left: 2px solid #3c527a;
  border-right: 2px solid #090e1a;
  border-bottom: 2px solid #090e1a;
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 0.12s, transform 0.08s;
}

.rct-btn:hover:not(:disabled) {
  filter: brightness(1.18);
  border-color: var(--accent-cyan);
}

.rct-btn:active:not(:disabled) {
  transform: translateY(1px);
  border-top-color: #090e1a;
  border-left-color: #090e1a;
}

.rct-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rct-btn.active {
  background: linear-gradient(180deg, #005b7f 0%, #003852 100%);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.rct-btn.gold {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  border-top-color: #fbbf24;
  border-left-color: #fbbf24;
  color: #fffbeb;
}

/* Top Navigation & Telemetry Header */
.top-header {
  height: 58px;
  background: linear-gradient(180deg, #131c31 0%, #0a101d 100%);
  border-bottom: 2px solid #263859;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 10px;
  z-index: 50;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: radial-gradient(circle at 30% 30%, #00f0ff, #0044ff);
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-gold);
}

.version-badge {
  background: linear-gradient(180deg, #3b2314 0%, #1c1008 100%);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  box-shadow: 0 0 8px rgba(255, 204, 77, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.version-badge:hover {
  filter: brightness(1.25);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.55), 0 0 8px rgba(255, 204, 77, 0.45);
  transform: translateY(-1px);
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.telemetry-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.metric-pill {
  background: repeating-linear-gradient(
    180deg,
    #060b14 0px,
    #060b14 2px,
    #091120 2px,
    #091120 4px
  );
  border-top: 2px solid #03050a;
  border-left: 2px solid #03050a;
  border-right: 2px solid #2b3e63;
  border-bottom: 2px solid #2b3e63;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 118px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.75);
}

.metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.metric-value.kpi-flash-up {
  animation: kpiFlashUp 0.55s ease-out;
}

@keyframes kpiFlashUp {
  0% {
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(0, 255, 157, 0.8);
    transform: scale(1.06);
  }
  100% {
    color: #fff;
    text-shadow: none;
    transform: scale(1);
  }
}

.metric-delta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent-green);
}

.metric-delta.warn {
  color: var(--accent-orange);
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 255, 157, 0.1);
  border: 1px solid rgba(0, 255, 157, 0.35);
  color: var(--accent-green);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Toast Notification */
#toastContainer {
  position: fixed;
  bottom: 42px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: rgba(14, 23, 42, 0.95);
  border-left: 4px solid var(--accent-cyan);
  border-top: 1px solid #2b3b59;
  border-right: 1px solid #2b3b59;
  border-bottom: 1px solid #2b3b59;
  padding: 9px 14px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  animation: slideInToast 0.2s ease-out;
}

@keyframes slideInToast {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #070b14;
}
::-webkit-scrollbar-thumb {
  background: #273859;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Mobile-First Responsive Header & Scrollable Telemetry Strip (CR-029 / TASK-201) */
@media (max-width: 900px) {
  .top-header {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: 6px;
  }

  .brand-cluster {
    min-width: 0;
    flex: 1 1 auto;
    gap: 7px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 0.78rem;
    letter-spacing: 0.8px;
  }

  .brand-sub {
    font-size: 0.62rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 58vw;
  }

  .nav-tabs {
    order: 2;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .nav-tabs .rct-btn {
    padding: 4px 7px !important;
    font-size: 0.66rem !important;
    white-space: nowrap;
  }

  .live-sync-badge {
    display: none;
  }

  .telemetry-strip {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 5px;
    padding-bottom: 2px;
  }

  .metric-pill {
    min-width: 96px;
    padding: 3px 6px;
    flex-shrink: 0;
  }

  .metric-label {
    font-size: 0.58rem;
  }

  .metric-value {
    font-size: 0.76rem;
  }

  .metric-delta {
    font-size: 0.58rem;
  }
}

