/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #263348;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --gradient-primary: linear-gradient(135deg, #6366f1, #06b6d4);
  --gradient-bg: linear-gradient(180deg, #0a0e1a 0%, #111827 100%);
  --border-color: #1e293b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font:
    "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

html {
  font-size: 16px;
}
body {
  font-family: var(--font);
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Screens ===== */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
}

/* ===== Landing ===== */
#screen-landing {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.landing-container {
  max-width: 800px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.logo-area {
  text-align: center;
}
.logo-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}
.logo-area h1 {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.tagline {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.25rem;
}

/* System Info Card */
.system-info-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.info-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}
.info-section-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}
.info-section-title:first-child {
  margin-top: 0;
}
.info-item-wide {
  grid-column: 1 / -1;
}

/* Capability Badges */
.info-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.cap-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.cap-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.cap-inactive {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  opacity: 0.7;
}

/* Test Selector */
.test-selector {
  width: 100%;
}
.test-selector h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  text-align: center;
}
.test-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.test-option {
  cursor: pointer;
}
.test-option input {
  display: none;
}
.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  text-align: center;
}
.test-option input:checked + .option-card {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}
.option-card:hover {
  background: var(--bg-card-hover);
}
.option-icon {
  font-size: 1.5rem;
}
.option-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.option-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* ===== Running Screen ===== */
#screen-running {
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}
.running-container {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.running-header {
  width: 100%;
  text-align: center;
}
.running-header h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-text {
  position: absolute;
  right: 0;
  top: -1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Live Stats */
.live-stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.live-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.live-stat-card canvas {
  width: 100%;
  height: 80px;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Sub-test Status */
.sub-test-status {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sub-test-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.sub-test-item.running {
  border-left: 3px solid var(--accent-primary);
}
.sub-test-item.done {
  border-left: 3px solid var(--accent-success);
  opacity: 0.7;
}
.sub-test-item.pending {
  border-left: 3px solid var(--border-color);
  opacity: 0.4;
}
.sub-test-icon {
  font-size: 1rem;
}
.sub-test-name {
  flex: 1;
}
.sub-test-result {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-secondary);
}

/* ===== Results Screen ===== */
#screen-results {
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}
.results-container {
  max-width: 960px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.results-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.results-header h2 {
  font-size: 2rem;
}

/* Score Ring */
.overall-score-ring {
  position: relative;
  width: 160px;
  height: 160px;
}
.score-ring-svg {
  width: 100%;
  height: 100%;
}
.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-number {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Results Breakdown */
.results-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.result-category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.result-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.result-cat-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}
.result-cat-score {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-secondary);
}
.result-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}
.result-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gradient-primary);
  transition: width 1s ease;
}
.result-sub-scores {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.result-sub-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}
.result-sub-name {
  color: var(--text-secondary);
}
.result-sub-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* Charts */
.results-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1rem;
}
.result-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.result-chart-card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}
.result-chart-card canvas {
  width: 100%;
}

/* Results Details */
.results-details {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.details-table {
  width: 100%;
  border-collapse: collapse;
}
.details-table th,
.details-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.details-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
}
.details-table td {
  font-family: var(--font-mono);
}
.details-table tr:last-child td {
  border-bottom: none;
}

/* Results Actions */
.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .logo-area h1 {
    font-size: 2rem;
  }
  .test-options {
    grid-template-columns: repeat(2, 1fr);
  }
  .live-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .results-charts {
    grid-template-columns: 1fr;
  }
  .results-breakdown {
    grid-template-columns: 1fr;
  }
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 400px) {
  .test-options {
    grid-template-columns: 1fr;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.screen.active {
  animation: fadeIn 0.4s ease;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card-hover);
  border-radius: 3px;
}
