/* --- Root Variables & Themes --- */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: #182238;
  --bg-card-border: #2a3b5c;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --ms-red: #f25022;
  --ms-green: #7fba00;
  --ms-blue: #00a4ef;
  --ms-yellow: #ffb900;
  
  --danger-glow: rgba(242, 80, 34, 0.4);
  --blue-glow: rgba(0, 164, 239, 0.35);
  
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 164, 239, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(242, 80, 34, 0.08) 0%, transparent 40%);
}

.site-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header & Nav */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0 1.5rem 0;
  border-bottom: 1px solid var(--bg-card-border);
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.ms-grid {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  grid-gap: 3px;
}

.square {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.sq-red { background-color: var(--ms-red); }
.sq-green { background-color: var(--ms-green); }
.sq-blue { background-color: var(--ms-blue); }
.sq-yellow { background-color: var(--ms-yellow); }

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--ms-red);
  border-radius: 50%;
}

.pulsating {
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(242, 80, 34, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(242, 80, 34, 0); }
  100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(242, 80, 34, 0); }
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon, .btn-pill, .btn-mini {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.btn-pill {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-mini {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-icon:hover, .btn-pill:hover, .btn-mini:hover {
  background: var(--bg-card-border);
  transform: translateY(-1px);
}

/* Main Safety Sign Card */
.safety-sign-card {
  background: var(--bg-card);
  border: 3px solid #334155;
  border-radius: 16px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 20px var(--danger-glow);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  text-align: center;
}

/* Hazard Stripes */
.hazard-stripe {
  height: 14px;
  background: repeating-linear-gradient(
    -45deg,
    #f25022,
    #f25022 14px,
    #1e293b 14px,
    #1e293b 28px
  );
  width: 100%;
}

.card-inner {
  padding: 2.5rem 1.5rem;
}

.safety-header {
  margin-bottom: 1.25rem;
}

.safety-badge {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding: 0.35rem 1.2rem;
  border-radius: 6px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.safety-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

.counter-headline {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f1f5f9;
  margin: 1rem 0;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .counter-headline {
    font-size: 2.25rem;
  }
}

/* The Big 0 Counter */
.counter-display-wrapper {
  margin: 1.5rem auto;
  background: #090d16;
  border: 4px solid #1e293b;
  border-radius: 18px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 4rem;
  min-width: 260px;
  position: relative;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.9);
}

.counter-glow {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.counter-digit {
  font-size: 8rem;
  line-height: 1;
  font-weight: 900;
  font-family: var(--font-mono);
  color: #ef4444;
  text-shadow: 
    0 0 20px rgba(239, 68, 68, 0.8),
    0 0 50px rgba(239, 68, 68, 0.4),
    0 0 80px rgba(239, 68, 68, 0.2);
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (min-width: 640px) {
  .counter-digit {
    font-size: 12rem;
  }
}

.counter-unit {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.counter-caption {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

/* Glitch Animation */
.glitch {
  animation: glitch-anim 0.35s ease-in-out;
}

@keyframes glitch-anim {
  0% { transform: scale(1) translate(0); color: #ef4444; }
  20% { transform: scale(1.08) translate(-6px, 3px); color: #00a4ef; filter: drop-shadow(4px 0 #f25022); }
  40% { transform: scale(0.95) translate(5px, -3px); color: #ffb900; }
  60% { transform: scale(1.05) translate(-4px, -2px); color: #ef4444; }
  80% { transform: scale(0.98) translate(3px, 2px); color: #7fba00; }
  100% { transform: scale(1) translate(0); color: #ef4444; }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 680px;
  margin: 0 auto 2rem auto;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  padding: 0.85rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-box.highlight {
  border-color: var(--ms-blue);
  background: rgba(0, 164, 239, 0.08);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.live-clock {
  color: var(--ms-yellow);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
}

.btn-action {
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.btn-danger {
  background: #dc2626;
  color: white;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}
.btn-danger:hover {
  background: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.6);
}
.btn-danger:active {
  transform: translateY(0);
}

.btn-primary {
  background: #0284c7;
  color: white;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.btn-primary:hover {
  background: #0ea5e9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}

.btn-secondary {
  background: #334155;
  color: var(--text-primary);
  border-color: #475569;
}
.btn-secondary:hover {
  background: #475569;
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--bg-card-border);
}
.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Spinner for Telemetry */
.spinner-ring {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Ticker Section */
.ticker-section {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.ticker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ticker-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: #7f1d1d;
  color: #fca5a5;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.ticker-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.ticker-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.incident-alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.incident-message-wrap {
  flex-grow: 1;
}

.incident-message {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
}

.incident-source {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-family: var(--font-mono);
}

/* Info Section / FAQ */
.info-section {
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  text-align: center;
  color: var(--text-secondary);
}

.faq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .faq-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.faq-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  padding: 1.25rem;
  border-radius: 10px;
}

.faq-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #e2e8f0;
}

.faq-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Clippy Assistant */
.clippy-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
  animation: clippy-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes clippy-pop {
  from { transform: scale(0.5) translateY(40px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.clippy-bubble {
  background: #fffae6;
  border: 2px solid #334155;
  color: #1e293b;
  padding: 1rem 1.2rem;
  border-radius: 14px 14px 2px 14px;
  max-width: 280px;
  margin-bottom: 8px;
  position: relative;
  font-size: 0.88rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.clippy-close-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  color: #64748b;
}

.clippy-close-btn:hover {
  color: #0f172a;
}

.clippy-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.clippy-opt-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  color: #0f172a;
}

.clippy-opt-btn:hover {
  background: #e2e8f0;
}

.clippy-character {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.clippy-character:hover {
  transform: translateY(-4px) rotate(4deg);
}

/* Toast Banner */
.toast-banner {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid #dc2626;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 2000;
  font-size: 0.9rem;
  font-weight: 600;
  animation: toast-in 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes toast-in {
  from { transform: translate(-50%, -30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Share Modal Dialog */
.share-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 480px;
  width: 90%;
  margin: auto;
  position: fixed;
  inset: 0;
  z-index: 3000;
}

.share-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 1.5rem;
  color: var(--text-primary);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 {
  font-size: 1.2rem;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.btn-close:hover {
  color: white;
}

.share-quote-box {
  background: var(--bg-secondary);
  border: 1px dashed var(--bg-card-border);
  border-radius: 8px;
  padding: 1rem;
  font-style: italic;
  color: #e2e8f0;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.share-actions a {
  text-decoration: none;
}

/* BSOD Overlay */
.bsod-screen {
  position: fixed;
  inset: 0;
  background-color: #0078d7;
  color: #ffffff;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  user-select: none;
}

.bsod-content {
  max-width: 800px;
  width: 100%;
}

.bsod-frowny {
  font-size: 7rem;
  line-height: 1;
  margin-bottom: 1.5rem;
  font-weight: 300;
}

.bsod-title {
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.bsod-desc {
  font-size: 1.2rem;
  margin-bottom: 2.5rem;
  opacity: 0.95;
}

.bsod-details {
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.bsod-text {
  font-size: 0.95rem;
  line-height: 1.6;
}

.bsod-code {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.bsod-exit-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.bsod-exit-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 2rem 0 1rem 0;
  text-align: center;
  border-top: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: var(--ms-blue);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.disclaimer-text {
  font-style: italic;
}

.copyright {
  font-size: 0.75rem;
}

/* Utility classes */
.hidden {
  display: none !important;
}
