:root {
  color-scheme: dark;
  --bg: #0e0f12;
  --panel: #151822;
  --panel2: #11131a;
  --text: #e9ecf2;
  --muted: #aab2c3;
  --line: #263048;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #60a5fa;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

* { box-sizing: border-box; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(1200px 700px at 20% 10%, #1a2340 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 20%, #31204a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
}

header {
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}

footer {
  padding: 12px 18px 18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(255,255,255,0.03), transparent);
  font-size: 0.85rem;
  color: var(--muted);
}

footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: space-between;
}

footer .credits {
  line-height: 1.4;
}

footer .credits b {
  color: var(--text);
  font-weight: 600;
}

footer .links {
  white-space: normal;
}

footer .links a {
  color: var(--muted);
  text-decoration: none;
}

footer .links a:hover {
  color: var(--text);
}

h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.3px;
}

.sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  max-width: 980px;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 45%), var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.28);
  min-width: 0;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #dfe6ff;
  letter-spacing: 0.25px;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.35;
  outline: none;
}

textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

code {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 2;
  outline: none;
  margin-top: 10px;
}

code:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

button {
  background: linear-gradient(180deg, rgba(96,165,250,0.25), rgba(96,165,250,0.10));
  border: 1px solid rgba(96,165,250,0.55);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.2px;
}

button:hover { filter: brightness(1.08); }

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  user-select: none;
}

input[type="checkbox"] {
  transform: translateY(1px);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: var(--muted);
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.results {
  display: flex;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 1100px) {
  .results { flex-direction: column; }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
}

.kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(38,48,72,0.55);
  min-width: 0;
}

.kv:last-child { border-bottom: none; }

.k { color: #cdd6f4;  }
.v { color: var(--text); }

.warn { color: var(--warn) !important; }
.bad { color: var(--bad) !important; }
.good { color: var(--good) !important; }
.info { color: var(--info) !important; }

.health-grid {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  margin-top: 10px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 740px;
  font-size: 12px;
}

th, td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(38,48,72,0.55);
  text-align: center;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: rgba(17,19,26,0.95);
  color: #cdd6f4;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}

td.label {
  text-align: left;
  font-weight: 700;
  color: #dbeafe;
  background: rgba(96,165,250,0.06);
}

.geno {
  font-family: var(--mono);
  border-radius: 8px;
  padding: 2px 6px;
  display: inline-block;
  border: 1px solid rgba(38,48,72,0.8);
  background: rgba(255,255,255,0.03);
}

.gHH { color: var(--good); border-color: rgba(74,222,128,0.5); }
.gHh { color: var(--warn); border-color: rgba(251,191,36,0.5); }
.ghh { color: var(--bad); border-color: rgba(251,113,133,0.55); }

.section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.14);
}

.best-pair-section {
  font-size: 12px;
  margin-bottom: 10px;
}

.best-pair-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #e5e7ff;
  letter-spacing: 0.2px;
}

.best-pair-female {
  color: rgba(255, 142, 166, 0.75);
}

.best-pair-male {
  color: rgba(127, 219, 255, 0.75);
}

.section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #e5e7ff;
  letter-spacing: 0.2px;
}

.mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 700px) {
  .mini { grid-template-columns: 1fr; }
}

.err {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(251,113,133,0.5);
  background: rgba(251,113,133,0.10);
  color: #ffd7dd;
  font-size: 13px;
  line-height: 1.4;
}

.small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.probGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 980px) {
  .probGrid { grid-template-columns: 1fr; }
}

.probItem {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0,0,0,0.12);
  min-width: 0;
}

.probItem .title {
  font-weight: 700;
  color: #dbeafe;
  margin-bottom: 6px;
  font-size: 13px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(38,48,72,0.9);
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}

.fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(96,165,250,0.9), rgba(74,222,128,0.9));
}

.barLabel {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 700px) {
  footer {
    padding: 14px 14px 18px;
  }

  footer .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  footer .credits,
  footer .links {
    width: 100%;
  }

  footer .links {
    text-align: left;
    font-size: 0.8rem;
  }

  body {
    font-size: 14px;
  }

  header {
    padding: 14px 14px 8px;
  }

  main {
    padding: 10px;
  }

  .card,
  .section,
  .probItem {
    padding: 10px;
  }

  table {
    min-width: 0;
  }
}

.construction-banner {
  border: 1px dashed rgba(251,191,36,0.6);
  background:
    linear-gradient(180deg, rgba(251,191,36,0.08), transparent 55%),
    var(--panel);
  position: relative;
  z-index: 1;
  display: none;
}

.construction-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.construction-banner .pill {
  align-self: flex-start;
  font-weight: 700;
  border-color: rgba(251,191,36,0.6);
  background: rgba(251,191,36,0.12);
  color: var(--warn);
}

.construction-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
}

.tabbar {
  display: flex;
  gap: 8px;
  margin: 16px auto;
  max-width: 1100px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.tabbar .tab {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

.tabbar .tab:hover {
  background: var(--panel);
}

.tabbar .tab.active {
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  color: #fff;
  border-color: transparent;
}