@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;600;700&display=swap');

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

:root {
  --cyan:    #00d4ff;
  --magenta: #cc00cc;
  --pink:    #ff00aa;
  --dark:    rgba(4, 10, 18, 0.82);
  --border:  rgba(0, 212, 255, 0.18);
  --muted:   rgba(255,255,255,0.35);
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: #000;
  color: #e0f4ff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── BACKGROUND ── */
.hero {
  background-image: url('../images/extinction-code-bg-desktop-no-logo.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 100vh;
  position: relative;
}
.hero::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.07) 3px,
    rgba(0,0,0,0.07) 4px
  );
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 768px) {
  .hero {
    background-image: url('../images/extinction-code-bg-for-web-mobile.jpg');
  }
}

/* ── LAYOUT ── */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 20px 280px;
}

/* ── HEADER ── */
.site-header {
  text-align: center;
  padding-bottom: 32px;
}
@media (max-width: 600px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    background: var(--dark);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,212,255,0.1);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .page-wrap {
    padding-top: 140px;
  }
}
.branded-logo {
  max-width: 320px;
  width: 100%;
  filter: drop-shadow(0 0 14px rgba(0,212,255,0.5));
}
.header-version {
  color: #fff;
  opacity: 0.5;
  letter-spacing: 2px;
  margin-left: 10px;
}

.header-sub {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--cyan);
  text-transform: uppercase;
  margin-top: 12px;
  opacity: 0.7;
}

/* ── PANEL ── */
.panel {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 1px rgba(0,212,255,0.06),
    0 8px 40px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(0,212,255,0.1);
  overflow: hidden;
  margin-bottom: 16px;
}

/* ── PANEL TITLE BAR ── */
.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,212,255,0.04);
}
.panel-title-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  flex-shrink: 0;
}
.panel-title span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--cyan);
  text-transform: uppercase;
  opacity: 0.8;
}
.panel-title-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,212,255,0.2), transparent);
}

/* ── SECTION HEADING ── */
.section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  color: var(--magenta);
  text-transform: uppercase;
  padding: 18px 20px 10px;
  opacity: 0.8;
  border-bottom: 1px solid rgba(204,0,204,0.12);
}

/* ── PARAMETER GRID ── */
.param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 600px) {
  .param-grid { grid-template-columns: 1fr; }
}

.param-row {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0,212,255,0.07);
  border-right: 1px solid rgba(0,212,255,0.07);
  transition: background 0.15s;
}
.param-row:nth-child(even) { border-right: none; }
.param-row:hover { background: rgba(0,212,255,0.04); }

.param-label {
  font-size: 15px;
  font-weight: 600;
  color: #a8d8f0;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.param-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.param-input {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 3px;
  color: var(--cyan);
  padding: 5px 10px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}
.param-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0,212,255,0.25);
}
.param-input::-webkit-outer-spin-button,
.param-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── SLIDER ── */
.param-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  margin: 8px 0 10px;
  display: block;
  transition: background 0.4s ease;
}
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  cursor: pointer;
}
.param-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  cursor: pointer;
}
.param-slider::-moz-range-track {
  background: rgba(255,255,255,0.08);
  height: 3px;
  border-radius: 2px;
}
.param-slider::-moz-range-progress {
  background: var(--cyan);
  height: 3px;
  border-radius: 2px;
}

.param-desc {
  font-size: 15px;
  color: #999;
  line-height: 1.5;
  letter-spacing: 0.2px;
}
.param-desc-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.param-desc-text {
  flex: 1;
}
.param-expand-btn {
  flex-shrink: 0;
  margin-left: auto;
  background: none;
  border: 1px solid #3a3a3a;
  cursor: pointer;
  color: #777;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.param-expand-btn:hover,
.param-expand-btn[aria-expanded="true"] {
  color: var(--cyan);
  border-color: var(--cyan);
}
.param-expand-icon::before {
  content: '+';
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  line-height: 1;
  display: block;
}
.param-expand-btn[aria-expanded="true"] .param-expand-icon::before {
  content: '×';
}
.param-expand-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.28s ease;
}
.param-expand-body.is-open {
  max-height: 400px;
}
.param-expand-body p {
  font-size: 14px;
  color: rgba(224,244,255,0.6);
  line-height: 1.7;
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid rgba(0,212,255,0.08);
}

.param-row.full {
  grid-column: 1 / -1;
  border-right: none;
}
.param-row.full .param-input {
  max-width: 260px;
}

/* ── RUN BUTTON ── */
.run-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #000;
  background: var(--cyan);
  border: none;
  border-radius: 3px;
  padding: 12px 32px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s;
  box-shadow: 0 0 18px rgba(0,212,255,0.4);
  flex-shrink: 0;
}
.run-btn:hover {
  box-shadow: 0 0 28px rgba(0,212,255,0.7);
  transform: translateY(-1px);
}
.run-btn:active { transform: translateY(0); }

/* ── RESULTS PANEL ── */
.results-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--dark);
  border-top: 1px solid rgba(204,0,204,0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 -4px 40px rgba(0,0,0,0.85),
    inset 0 1px 0 rgba(204,0,204,0.1);
}

.results-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(204,0,204,0.12);
  background: rgba(204,0,204,0.04);
}
.results-title-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: none;
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}
.results-title-dot.dot-active {
  background: var(--magenta);
  box-shadow: 0 0 6px var(--magenta);
}
.results-title span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--magenta);
  text-transform: uppercase;
  opacity: 0.8;
}
@media (max-width: 768px) {
  .results-title-label { display: none; }
}
.results-title-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(204,0,204,0.2), transparent);
}

.reset-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--magenta);
  background: transparent;
  border: 1px solid rgba(204,0,204,0.35);
  border-radius: 3px;
  padding: 5px 14px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, color 0.2s;
  flex-shrink: 0;
}
.reset-btn:hover {
  border-color: var(--magenta);
  box-shadow: 0 0 10px rgba(204,0,204,0.3);
  color: #fff;
}

.results-body {
  padding: 14px 24px 18px;
}

#results-awaiting,
#results-loading {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.awaiting-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--muted);
  opacity: 0.6;
}

.loading-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--cyan);
  opacity: 0.8;
}

.loading-dots::after {
  content: '';
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

.outcome-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.outcome-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--pink);
  text-shadow: 0 0 14px rgba(255,0,170,0.5);
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
}

/* ── MONTE CARLO layout ── */
.mc-layout {
  display: grid;
  grid-template-columns: minmax(0, 480px) 1fr;
  gap: 12px 0;
  align-items: start;
}
@media (max-width: 600px) {
  .mc-layout { grid-template-columns: 1fr; }
}

.mc-stats {
  padding-left: 32px;
}

.prob-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 20px;
  margin-top: 4px;
}
.prob-row {
  display: grid;
  grid-template-columns: 100px 1fr 34px;
  align-items: center;
  gap: 8px;
}
.prob-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.prob-track {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.prob-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.6s ease;
}
.prob-fill--takeover   { background: var(--pink);    box-shadow: 0 0 6px rgba(255,0,170,0.4); }
.prob-fill--extinction { background: #ff4444;        box-shadow: 0 0 6px rgba(255,68,68,0.4); }
.prob-fill--robot-ext  { background: var(--cyan);    box-shadow: 0 0 6px rgba(0,212,255,0.4); }
.prob-fill--none       { background: var(--muted); }
.prob-pct {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 0;
}
.mc-stats {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

.stat-card {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(0,212,255,0.12);
  border-radius: 3px;
  padding: 8px 12px;
}
.stat-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.stat-value {
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0,212,255,0.4);
}

/* ── ERROR LIST ── */
.error-list {
  background: rgba(255,0,0,0.08);
  border: 1px solid rgba(255,0,0,0.3);
  border-radius: 3px;
  padding: 14px 20px;
  margin-bottom: 16px;
}
.error-list ul { padding-left: 16px; }
.error-list li {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #ff6666;
  line-height: 1.8;
}

/* ── INFO BUTTON ── */
.info-btn {
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: shimmer 2.8s ease-in-out infinite;
}
.info-btn:hover {
  animation: none;
  color: #fff;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.9));
}
@keyframes shimmer {
  0%   { opacity: 1;    filter: drop-shadow(0 0 3px rgba(255,255,255,0.5)); }
  50%  { opacity: 0.4;  filter: drop-shadow(0 0 1px rgba(255,255,255,0.1)); }
  100% { opacity: 1;    filter: drop-shadow(0 0 3px rgba(255,255,255,0.5)); }
}

/* ── MODAL (DOS TERMINAL) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.modal-visible {
  opacity: 1;
  pointer-events: all;
}

.modal-panel {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.07) 2px,
      rgba(0,0,0,0.07) 4px
    ), #000;
  border: 1px solid #00bb00;
  border-radius: 0;
  box-shadow:
    0 0 0 1px rgba(0,187,0,0.08),
    0 0 40px rgba(0,187,0,0.1),
    0 24px 80px rgba(0,0,0,0.98);
  width: 100%;
  max-width: 680px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform 0.2s ease;
  overflow: hidden;
  animation: crt-flicker 12s infinite;
}
.modal-overlay.modal-visible .modal-panel {
  transform: translateY(0);
}
@keyframes crt-flicker {
  0%, 88%, 90%, 100% { opacity: 1; }
  89% { opacity: 0.93; }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid #00bb00;
  background: #001800;
  flex-shrink: 0;
}
.modal-header-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00ff41;
  box-shadow: 0 0 6px #00ff41;
  flex-shrink: 0;
}
.modal-header span {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 3px;
  color: #00ff41;
  text-transform: uppercase;
  opacity: 1;
}
.modal-header-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,187,0,0.4), transparent);
}
.modal-close {
  background: transparent;
  border: none;
  color: #00bb00;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.modal-close:hover { color: #00ff41; }

.modal-body {
  overflow-y: auto;
  padding: 28px 28px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,187,0,0.3) transparent;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(0,187,0,0.3); border-radius: 0; }

.modal-lead {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0,255,65,0.45);
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.modal-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #00cc00;
  line-height: 1.75;
  margin-bottom: 14px;
}

.modal-section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 4px;
  color: #00ff41;
  text-transform: uppercase;
  margin: 24px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,187,0,0.25);
  opacity: 1;
}

.modal-outcomes {
  list-style: none;
  padding: 0;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-outcomes li {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #00cc00;
  line-height: 1.5;
  padding-left: 12px;
  border-left: 2px solid rgba(0,187,0,0.35);
}
.modal-outcome-tag {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  color: #00ff41;
  text-shadow: 0 0 5px rgba(0,255,65,0.4);
  margin-right: 6px;
}

@keyframes dos-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.modal-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: #00ff41;
  box-shadow: 0 0 4px #00ff41;
  vertical-align: text-bottom;
  animation: dos-blink 0.7s step-end infinite;
  margin-left: 1px;
}



.modal-footer-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: rgba(0,204,0,0.55);
  line-height: 1.7;
  margin-top: 20px;
  font-style: italic;
}

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--magenta);
  opacity: 0.6;
  padding: 30px 0 0;
}
