/* ============================================================
   SCI/STUDY — Shared Design System
   A dark, distraction-free aesthetic for biology study tools.
   ============================================================ */

/* ===================== DESIGN TOKENS ===================== */
:root {
  /* Backgrounds */
  --bg: #0a0e0c;
  --bg-2: #0f1513;
  --surface: #131a18;
  --surface-2: #1a2421;

  /* Borders */
  --border: #243029;
  --border-bright: #2f3d35;

  /* Accent palette */
  --green: #5eead4;
  --green-glow: #5eead4;
  --lime: #a3e635;
  --magenta: #f472b6;
  --amber: #fbbf24;
  --cyan: #67e8f9;
  --red: #f87171;

  /* Text */
  --text: #f0fdf4;
  --text-2: #cbd5cb;
  --text-muted: #7a8a82;
  --text-dim: #4a5a52;

  /* Typography */
  --serif: 'Fraunces', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Base-pair colors (used by Replicase) */
  --A: #a3e635;
  --T: #5eead4;
  --G: #f472b6;
  --C: #fbbf24;
  --U: #67e8f9;

  /* Trait colors (used by Genolab) */
  --teal: #5eead4;
  --coral: #f472b6;
  --sun: #fbbf24;
  --leaf: #a3e635;
}


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

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--green);
  color: var(--bg);
}


/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--green); }


/* ===================== BACKGROUND CANVAS ===================== */
.bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}


/* ===================== CORNER DECORATIONS ===================== */
.corner {
  position: fixed;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  z-index: 3;
}
.corner.tl { top: 24px; left: 24px; }
.corner.tr { top: 24px; right: 24px; }
.corner.bl { bottom: 24px; left: 24px; }
.corner.br { bottom: 24px; right: 24px; }
.corner span { color: var(--green); }


/* ===================== TYPOGRAPHY ===================== */

/* Eyebrow / label pill */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--green);
  padding: 6px 14px;
  border: 1px solid var(--border-bright);
  border-radius: 100px;
  background: rgba(94, 234, 212, 0.05);
  margin-bottom: 28px;
}

/* Animated pulse dot */
.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Large display title */
.display-title {
  font-family: var(--serif);
  font-size: clamp(56px, 10vw, 168px);
  line-height: 0.85;
  letter-spacing: -0.05em;
  font-weight: 300;
  margin-bottom: 8px;
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'wght' 300;
}
.display-title em {
  font-style: italic;
  color: var(--green);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 400;
}

/* Subtitle line with left border */
.subtitle {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 16px;
  border-left: 2px solid var(--green);
  margin-bottom: 36px;
}
.subtitle span { color: var(--green); }

/* Body description text */
.desc {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--text-2);
  margin-bottom: 40px;
  max-width: 560px;
  font-variation-settings: 'opsz' 36, 'SOFT' 60;
}
.desc em { color: var(--green); font-style: italic; }
.desc strong { color: var(--text); font-weight: 500; }

/* Section headings */
.h2 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 56px 0 20px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'wght' 400;
}
.h2-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  letter-spacing: 0.15em;
}
.h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin: 32px 0 12px;
  color: var(--text);
  font-variation-settings: 'opsz' 36, 'SOFT' 50, 'wght' 500;
}
.h3 em {
  font-style: italic;
  color: var(--green);
  font-variation-settings: 'opsz' 36, 'SOFT' 100, 'wght' 500;
}

/* Paragraph defaults */
p {
  margin-bottom: 16px;
  color: var(--text-2);
}
p strong { color: var(--text); font-weight: 500; }
p em.acc { font-style: normal; color: var(--green); font-weight: 500; }


/* ===================== BUTTONS ===================== */

/* Pill button (menu / action) */
.btn {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 16px 24px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.btn:hover {
  border-color: var(--green);
  background: rgba(94, 234, 212, 0.05);
  transform: translateX(4px);
}
.btn.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
  font-weight: 700;
}
.btn.primary:hover {
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 32px rgba(94, 234, 212, 0.4);
}
.btn .arrow { font-family: var(--serif); font-size: 18px; }
.btn .val { color: var(--green); font-weight: 700; }
.btn.primary .val { color: var(--bg); }

/* Small inline button */
.btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-sm:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(94, 234, 212, 0.05);
}
.btn-sm.primary {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}
.btn-sm.primary:hover {
  background: var(--lime);
  border-color: var(--lime);
  box-shadow: 0 0 20px rgba(94, 234, 212, 0.4);
}

/* Icon button (circle) */
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--green); color: var(--green); }


/* ===================== CARDS ===================== */

/* Generic card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(94, 234, 212, 0.06), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover { border-color: var(--border-bright); transform: translateY(-2px); }
.card:hover::before { opacity: 1; }

.card-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 12px;
}
.card-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 8px;
  font-variation-settings: 'opsz' 36, 'SOFT' 50, 'wght' 500;
}
.card-title em {
  font-style: italic;
  color: var(--green);
  font-variation-settings: 'opsz' 36, 'SOFT' 100, 'wght' 500;
}
.card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}
.card-content { font-size: 15px; }
.card-content p { font-size: 15px; line-height: 1.5; }

/* Navigation card link (index page) */
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 20px 24px;
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.card-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.04), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.card-link:hover {
  border-color: var(--green);
  transform: translateX(4px);
}
.card-link:hover::before { opacity: 1; }

.card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.card-label .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.card-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 72, 'SOFT' 60, 'wght' 400;
}
.card-name em {
  font-style: italic;
  color: var(--green);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 400;
}
.card-desc {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.4;
  font-variation-settings: 'opsz' 24, 'SOFT' 50;
}
.card-arrow {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--text-dim);
  transition: all 0.25s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.card-link:hover .card-arrow {
  color: var(--green);
  transform: translateX(4px);
}


/* ===================== BADGES & CHIPS ===================== */

.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid var(--border-bright);
  border-radius: 100px;
  color: var(--green);
  background: rgba(94, 234, 212, 0.05);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.badge .lvl {
  color: var(--text-muted);
  border-left: 1px solid currentColor;
  padding-left: 8px;
  margin-left: 4px;
}

.chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-2);
}
.chip.teal   { color: var(--teal);   border-color: var(--teal); }
.chip.coral  { color: var(--coral);  border-color: var(--coral); }
.chip.round  { color: var(--lime);   border-color: var(--lime); }
.chip.oval   { color: var(--amber);  border-color: var(--amber); }
.chip.wide   { color: var(--cyan);   border-color: var(--cyan); }
.chip.narrow { color: var(--magenta); border-color: var(--magenta); }


/* ===================== TABLES ===================== */

.table-wrap {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
}
.tbl th {
  background: var(--bg-2);
  padding: 14px 18px;
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-2);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(94, 234, 212, 0.02); }
.tbl td strong { color: var(--text); font-weight: 500; }


/* ===================== LISTS ===================== */

.bullet-list {
  list-style: none;
  margin: 16px 0;
}
.bullet-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  color: var(--text-2);
}
.bullet-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 11px;
  width: 12px;
  height: 1px;
  background: var(--green);
}
.bullet-list li strong { color: var(--text); font-weight: 500; }


/* ===================== PROGRESS BAR ===================== */

.progress-bar {
  height: 4px;
  background: var(--bg-2);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--lime));
  border-radius: 100px;
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--green);
}


/* ===================== HP BAR (Games) ===================== */

.hp-bar {
  width: 220px;
  height: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--lime));
  border-radius: 100px;
  transition: width 0.4s, background 0.3s;
  width: 100%;
  box-shadow: 0 0 12px var(--green);
}
.hp-fill.warn {
  background: linear-gradient(90deg, var(--amber), var(--magenta));
  box-shadow: 0 0 12px var(--amber);
}
.hp-fill.danger {
  background: linear-gradient(90deg, var(--red), var(--magenta));
  box-shadow: 0 0 16px var(--red);
  animation: hpDanger 0.6s ease-in-out infinite;
}
@keyframes hpDanger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}


/* ===================== HUD (Games) ===================== */

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 12, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 16px;
}
.hud-block { display: flex; flex-direction: column; }
.hud-block.left { align-items: flex-start; }
.hud-block.right { align-items: flex-end; }
.hud-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.hud-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
  margin-top: 2px;
}
.hud-value.score { color: var(--green); }
.hud-value.combo { color: var(--amber); }
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}


/* ===================== SCREENS (Games) ===================== */

.screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transition: opacity 0.4s, visibility 0.4s;
  overflow: hidden;
}
.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


/* ===================== MODAL ===================== */

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 12, 0.85);
  backdrop-filter: blur(10px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-bg.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}
.modal-bg.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { border-color: var(--green); color: var(--green); }

.modal-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 12px;
}
.modal-title {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
}
.modal-title em {
  font-style: italic;
  color: var(--green);
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}


/* ===================== TOAST (Games) ===================== */

.toast {
  position: fixed;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 400;
  font-style: italic;
  color: var(--green);
  text-shadow: 0 0 30px var(--green), 0 0 60px var(--green);
  pointer-events: none;
  opacity: 0;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 144, 'SOFT' 90;
  z-index: 8;
  white-space: nowrap;
}
.toast.show { animation: toastShow 1.6s ease-out forwards; }
.toast.miss { color: var(--magenta); text-shadow: 0 0 30px var(--magenta); }
@keyframes toastShow {
  0%  { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100%{ opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}


/* ===================== GAME OVER / WIN SCREENS ===================== */

.over-frame {
  text-align: left;
  max-width: 520px;
  width: 100%;
}
.over-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--magenta);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(244, 114, 182, 0.05);
  display: inline-block;
  margin-bottom: 24px;
}
.over-eyebrow.win { color: var(--green); background: rgba(94, 234, 212, 0.05); }

.over-title {
  font-family: var(--serif);
  font-size: clamp(56px, 11vw, 130px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  font-weight: 300;
  margin-bottom: 32px;
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'wght' 300;
}
.over-title em {
  font-style: italic;
  color: var(--magenta);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'wght' 400;
}
.over-title.win em { color: var(--green); }

.over-stats {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.over-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.over-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.over-stat-value {
  font-family: var(--serif);
  font-size: 36px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
  line-height: 1;
}
.over-stat-value.green   { color: var(--green); }
.over-stat-value.amber   { color: var(--amber); }
.over-stat-value.magenta { color: var(--magenta); }

.over-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}


/* ===================== FOOTER ===================== */

.footer {
  position: relative;
  z-index: 2;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: var(--green); }


/* ===================== READING PROGRESS BAR ===================== */

.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green), var(--lime));
  z-index: 100;
  width: 0%;
  box-shadow: 0 0 10px var(--green);
  transition: width 0.1s ease;
}


/* ===================== TOP BAR ===================== */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: rgba(10, 14, 12, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  font-variation-settings: 'opsz' 144, 'SOFT' 80, 'wght' 600;
}
.brand-name { color: var(--text); }
.brand-slash { color: var(--green); margin: 0 2px; }
.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
}


/* ===================== SEARCH INPUT ===================== */

.search-wrap {
  flex: 1;
  max-width: 520px;
  margin: 0 32px;
  position: relative;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px 10px 42px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.15);
}
.search-input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}


/* ===================== PULL QUOTE ===================== */

.pull {
  border-left: 2px solid var(--green);
  padding: 8px 0 8px 28px;
  margin: 32px 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
  font-variation-settings: 'opsz' 60, 'SOFT' 90, 'wght' 350;
}
.pull cite {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 12px;
}


/* ===================== FORMULA BLOCK ===================== */

.formula {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin: 28px 0;
  position: relative;
  overflow: hidden;
}
.formula::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
}
.formula-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.formula-eq {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--green);
  text-align: center;
  padding: 8px 0;
  text-shadow: 0 0 20px rgba(94, 234, 212, 0.3);
}
.formula-eq sub, .formula-eq sup { font-size: 13px; }
.formula-eq .arrow { color: var(--text-muted); margin: 0 8px; }
.formula-eq .out { color: var(--lime); }


/* ===================== STAT BLOCKS ===================== */

.stat-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0;
}
.sb {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.sb-num {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--green);
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
  line-height: 1;
}
.sb-num.alt { color: var(--magenta); }
.sb-num.amber { color: var(--amber); }
.sb-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 6px;
}


/* ===================== COMPARISON SPLIT ===================== */

.compare {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 0;
  margin: 24px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.compare-side { padding: 28px; }
.compare-side h4 {
  font-family: var(--serif);
  font-size: 24px;
  margin-bottom: 16px;
  font-variation-settings: 'opsz' 36, 'SOFT' 80;
}
.compare-side.dna h4 { color: var(--green); }
.compare-side.rna h4 { color: var(--magenta); }
.compare-side ul { list-style: none; }
.compare-side li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 15px;
  color: var(--text-2);
}
.compare-side li:last-child { border-bottom: none; }
.compare-side li strong { color: var(--text); font-weight: 500; }
.compare-divider { background: var(--border); }


/* ===================== ANIMATIONS ===================== */

/* Fade-in stagger */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0); }
}
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.18s; }
.d3 { animation-delay: 0.32s; }
.d4 { animation-delay: 0.46s; }
.d5 { animation-delay: 0.6s; }
.d6 { animation-delay: 0.74s; }

/* Score pulse */
@keyframes scorePulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); color: var(--lime); }
  100% { transform: scale(1); }
}

/* Combo pop */
@keyframes comboPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); color: var(--lime); }
  100% { transform: scale(1); }
}

/* Slow rotation */
@keyframes rotate { to { transform: rotate(360deg); } }

/* Bobbing float */
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-12px) rotate(2deg); }
}

/* Brand pulse */
@keyframes brandPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.1); }
}


/* ===================== RESPONSIVE ===================== */

/* ===================== MATCH FLIP GAME ===================== */

.matchflip-shell {
  position: relative;
  z-index: 2;
  width: min(1400px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0 48px;
}

.matchflip-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.matchflip-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.matchflip-panel {
  background: rgba(19, 26, 24, 0.82);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.matchflip-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 24px;
}

.matchflip-stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}

.matchflip-stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.matchflip-stat-value {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.matchflip-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.matchflip-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.matchflip-option {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 10px 16px;
  border-radius: 100px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.matchflip-option:hover,
.matchflip-option.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(94, 234, 212, 0.08);
}

.matchflip-progress {
  margin-bottom: 20px;
}

.matchflip-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.matchflip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.matchflip-card {
  position: relative;
  height: 220px;
  perspective: 1200px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.matchflip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

.matchflip-card.is-flipped .matchflip-card-inner,
.matchflip-card.is-matched .matchflip-card-inner {
  transform: rotateY(180deg);
}

.matchflip-card.is-matched {
  pointer-events: none;
}

.matchflip-card.is-matched .matchflip-card-inner {
  opacity: 0;
  transform: rotateY(180deg) scale(0.85);
}

.matchflip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  border-radius: 20px;
  padding: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.matchflip-face::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), transparent 55%);
  pointer-events: none;
}

.matchflip-front,
.matchflip-back {
  border: 1px solid var(--border-bright);
  background: linear-gradient(180deg, rgba(26, 36, 33, 0.98), rgba(15, 21, 19, 0.98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.matchflip-back {
  transform: rotateY(180deg);
}

.matchflip-card:hover .matchflip-front,
.matchflip-card:hover .matchflip-back,
.matchflip-card:focus-visible .matchflip-front,
.matchflip-card:focus-visible .matchflip-back {
  border-color: var(--green);
  transform: translateY(-3px);
}

.matchflip-card:focus-visible {
  outline: none;
}

.matchflip-kind,
.matchflip-index {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.matchflip-kind { color: var(--green); }
.matchflip-index { color: var(--text-dim); }

.matchflip-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  color: var(--text);
  font-size: 19px;
  line-height: 1.4;
}

.matchflip-front .matchflip-body {
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: -0.03em;
}

.matchflip-back .matchflip-body {
  font-size: 15px;
  color: var(--text-2);
}

.matchflip-card.is-selected .matchflip-front,
.matchflip-card.is-selected .matchflip-back {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.5), 0 18px 32px rgba(251, 191, 36, 0.12);
}

.matchflip-card.is-wrong .matchflip-front,
.matchflip-card.is-wrong .matchflip-back {
  border-color: var(--red);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.5), 0 18px 32px rgba(248, 113, 113, 0.16);
}

.matchflip-card.is-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.matchflip-toast {
  position: fixed;
  left: 50%;
  top: 120px;
  transform: translateX(-50%);
  z-index: 6;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-bright);
  background: rgba(15, 21, 19, 0.94);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.matchflip-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(8px);
}

.matchflip-toast.success { color: var(--green); border-color: var(--green); }
.matchflip-toast.error { color: var(--red); border-color: var(--red); }

.matchflip-empty {
  text-align: center;
  padding: 48px 16px 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .footer { flex-direction: column; gap: 8px; text-align: center; }
  .corner { display: none; }

  .matchflip-shell {
    width: min(100% - 24px, 1400px);
    padding-top: 44px;
  }

  .matchflip-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .matchflip-actions { justify-content: flex-start; }

  .matchflip-stats {
    grid-template-columns: 1fr 1fr;
  }

  .matchflip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .matchflip-card {
    height: 180px;
  }

  .matchflip-front .matchflip-body { font-size: 21px; }
  .matchflip-back .matchflip-body { font-size: 13px; }
}

@media (max-width: 700px) {
  .hud {
    grid-template-columns: 1fr 1fr;
    row-gap: 12px;
  }
  .hud-center { grid-column: 1 / -1; }
  .hud-value { font-size: 24px; }
  .over-stats { grid-template-columns: 1fr 1fr; }
  .over-stat-value { font-size: 28px; }
}
