@font-face {
  font-family: 'Space Grotesk';
  src: url('/SpaceGrotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Slate Executive Architecture Theme */
  --page-bg: #f1f3f6;
  --page-card: #ffffff;
  --page-card-border: #e2e8f0;
  --page-shadow: rgba(15, 23, 42, 0.08);

  --term-bg: #0b0d11;
  --term-header: #131720;
  --term-surface: #0e1117;
  --term-border: #1e2430;
  --term-border-glow: rgba(16, 185, 129, 0.15);

  --txt-main: #cbd5e1;
  --txt-dim: #64748b;
  --txt-bright: #ffffff;

  --c-emerald: #10b981;
  --c-cyan: #06b6d4;
  --c-gold: #f59e0b;
  --c-purple: #a855f7;
  --c-blue: #3b82f6;

  --mono-font: ui-monospace, SFMono-Regular, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  --ui-font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--page-bg);
  background-image: 
    radial-gradient(#cbd5e1 1px, transparent 1px),
    linear-gradient(to bottom, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.95) 100%);
  background-size: 20px 20px, 100% 100%;
  color: #1e293b;
  font-family: var(--ui-font);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Header Outside Terminal */
.page-top-bar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
}

.top-trust-badges {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trust-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  letter-spacing: -0.01em;
}

.trust-pill-cert {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
}

.cert-shield {
  font-size: 13px;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-emerald);
  box-shadow: 0 0 6px var(--c-emerald);
}

/* Outer Window Frame */
.terminal-shell {
  width: 100%;
  max-width: 1100px;
  height: 82vh;
  max-height: 740px;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 
    0 20px 48px rgba(15, 23, 42, 0.16),
    0 4px 12px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Window Header Bar */
.terminal-header {
  height: 38px;
  min-height: 38px;
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 60px;
}

.btn-ctrl {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.btn-close { background: #ef4444; }
.btn-min   { background: #f59e0b; }
.btn-max   { background: #10b981; }

.terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ui-font);
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono-font);
  font-size: 10px;
  font-weight: 600;
  color: var(--c-gold);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.terminal-badge.ready {
  color: var(--c-emerald);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: pulse 1.8s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* Terminal Body - Scaled down font size for dense real-server feel */
.terminal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px;
  background: var(--term-bg);
  color: var(--txt-main);
  font-family: var(--mono-font);
  font-size: 12px; /* Smaller, authentic server font */
  line-height: 1.55;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: #1e2430 transparent;
}

.terminal-body::-webkit-scrollbar {
  width: 5px;
}
.terminal-body::-webkit-scrollbar-thumb {
  background: #1e2430;
  border-radius: 3px;
}

/* Log Lines Styling */
.log-line {
  margin: 1px 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-feature-settings: "liga" 0;
  animation: fadeInLine 0.2s ease-out;
}

@keyframes fadeInLine {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.log-cmd {
  color: #38bdf8;
  font-weight: 600;
}

.log-cmd-prefix {
  color: var(--c-emerald);
  font-weight: 700;
  margin-right: 6px;
}

.ascii-banner {
  color: #06b6d4;
  font-family: var(--mono-font);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.15;
  margin: 10px 0 12px 0;
  text-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
  overflow-x: auto;
  animation: fadeInLine 0.3s ease-out;
}

.log-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 1px 0;
}

.step-check {
  color: var(--c-emerald);
  font-weight: 700;
}

.step-num {
  color: #64748b;
  font-weight: 600;
}

.step-name {
  color: #f1f5f9;
  font-weight: 600;
  width: 170px;
}

.step-detail {
  color: #94a3b8;
  flex: 1;
}

.step-status {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.status-ok        { color: var(--c-emerald); background: rgba(16, 185, 129, 0.12); }
.status-active    { color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.status-connected { color: #a855f7; background: rgba(168, 85, 247, 0.12); }
.status-verified  { color: #10b981; background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); }

.log-gateway-title {
  color: #38bdf8;
  font-weight: 700;
  margin-top: 10px;
  margin-bottom: 4px;
}

.log-gateway-item {
  color: #cbd5e1;
  padding-left: 6px;
}
.log-gateway-item .gt-arrow {
  color: var(--c-emerald);
  margin-right: 6px;
}
.log-gateway-item .gt-key {
  color: #94a3b8;
  display: inline-block;
  width: 165px;
}
.log-gateway-item .gt-val {
  color: #f8fafc;
  font-weight: 600;
}

/* Interactive Ping Diagnostics Block with Waveform / Pulse Indicator */
.ping-diagnostic-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.015);
  border-left: 2px solid var(--c-emerald);
}

.ping-time {
  color: #64748b;
  font-size: 11px;
}

.ping-tag {
  color: #38bdf8;
  font-weight: 700;
  font-size: 11px;
  width: 60px;
}

.ping-radar-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-emerald);
  box-shadow: 0 0 8px var(--c-emerald);
  animation: radarWave 1.2s infinite ease-out;
}

@keyframes radarWave {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
  100% { transform: scale(0.9); opacity: 1; }
}

.ping-text {
  color: #cbd5e1;
  flex: 1;
}

.ping-ms {
  color: var(--c-emerald);
  font-weight: 700;
}

.ready-box {
  margin: 14px 0 10px 0;
  padding: 10px 16px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.08);
  border-radius: 5px;
  color: #34d399;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12);
}

.ready-sparkle {
  font-size: 16px;
}

/* Active Command Prompt Line */
.prompt-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: #f1f5f9;
}

.prompt-line.prompt-hidden {
  display: none !important;
}

.prompt-user {
  color: var(--c-emerald);
  font-weight: 700;
}

.prompt-cmd {
  color: #38bdf8;
  font-weight: 600;
}

.cursor-block {
  width: 7px;
  height: 14px;
  background: var(--c-emerald);
  display: inline-block;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Footer Metrics Bar */
.terminal-footer {
  height: 36px;
  min-height: 36px;
  background: var(--term-surface);
  border-top: 1px solid var(--term-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: var(--mono-font);
  font-size: 11px;
  user-select: none;
}

.footer-left, .footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.meta-k {
  color: var(--txt-dim);
  font-weight: 600;
}

.meta-v {
  color: #e2e8f0;
  font-weight: 600;
}

.text-emerald { color: var(--c-emerald) !important; }
.text-gold    { color: var(--c-gold) !important; }
.text-cyan    { color: var(--c-cyan) !important; }

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 8px;
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }
  .page-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
  }
  .top-trust-badges {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .trust-pill {
    padding: 4px 8px;
    font-size: 10.5px;
  }
  .terminal-shell {
    height: 75vh;
    min-height: 480px;
    max-height: none;
  }
  .terminal-body {
    padding: 10px 10px;
    font-size: 10.5px;
    line-height: 1.45;
  }
  .step-name {
    width: auto;
    min-width: 110px;
  }
  .log-step {
    flex-wrap: wrap;
    gap: 4px;
    word-break: normal;
  }
  .log-line {
    word-break: normal;
  }
  .step-status {
    font-size: 9.5px;
    padding: 1px 4px;
    margin-left: auto;
  }
  .terminal-footer {
    height: auto;
    min-height: 32px;
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 10px;
  }
  .footer-left {
    flex-wrap: wrap;
    gap: 8px;
  }
  .footer-right {
    gap: 8px;
  }
}
