/* ══════════════════════════════════════════════ */
/* ✨ BASE PAGE STYLING */
/* ══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Cardo", Georgia, serif;
  background: radial-gradient(circle at 40% 20%, #eaf5ff 0%, #b7d8f2 35%, #fbe49c 90%);
  color: #1b1d25;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 12px;
}

mjx-container {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  text-align: center !important;
  font-size: 0.9em !important;
  white-space: normal !important;
  margin: 12px auto !important;
  display: block !important;
  padding: 4px 0;
}

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,245,236,0.98));
  border: 4px solid #d8b552;
  border-radius: 20px;
  box-shadow: 0 0 25px rgba(27,102,170,0.45), inset 0 0 12px rgba(255,255,255,0.4);
  width: 100%;
  max-width: 720px;
  padding: 30px 24px 40px;
  text-align: center;
}

/* 🔖 HEADERS */
h1 {
  font-family: "Uncial Antiqua", serif;
  color: #124e88;
  text-shadow: 0 0 8px rgba(28,105,175,0.5);
  margin: 8px 0 6px;
  font-size: 2.3em;
  letter-spacing: 0.5px;
}

.subtitle {
  font-style: italic;
  font-size: 1.05em;
  color: #725a2e;
  margin-bottom: 18px;
  line-height: 1.4;
}

.tag-badge {
  display: inline-block;
  background: linear-gradient(135deg, #2a68a5, #14497e);
  color: #fff;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(18, 78, 136, 0.3);
}

/* ⚡ PRESETS BAR */
.presets-wrap {
  margin: 14px auto 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.preset-chip {
  font-family: inherit;
  background: #fbf6e8;
  border: 1.5px solid #d8b552;
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 0.85em;
  color: #4a3617;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
  user-select: none;
}

.preset-chip:hover {
  background: #f8e8b8;
  border-color: #b58c29;
  transform: translateY(-1px);
}

.preset-chip.danger {
  background: #fdf0f0;
  border-color: #d88282;
  color: #8c2525;
}

.preset-chip.danger:hover {
  background: #fbe0e0;
}

.preset-chip.burn-chip {
  background: #fff3e0;
  border-color: #ff7043;
  color: #bf360c;
}

.preset-chip.burn-chip:hover {
  background: #ffe0b2;
}

.preset-chip.life-chip {
  background: #e8f5e9;
  border-color: #43a047;
  color: #1b5e20;
}

.preset-chip.life-chip:hover {
  background: #c8e6c9;
}

/* SECTION HEADINGS */
.section-heading {
  text-align: center;
  font-weight: 700;
  color: #124e88;
  position: relative;
  display: inline-block;
  margin: 18px auto 8px;
  font-size: 1.05em;
}

.section-heading::after {
  content: "";
  display: block;
  height: 2px;
  width: 0%;
  background-color: #d8b552;
  margin: 6px auto 0;
  transition: width 0.4s ease-in-out, opacity 0.4s ease-in-out;
  opacity: 0;
}

.section-heading:hover::after {
  width: 80%;
  opacity: 1;
}

/* 🎚️ INPUT CONTROLS */
.slider-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px auto;
}

label {
  width: 250px;
  text-align: right;
  font-weight: 700;
  color: #2a1e13;
  font-size: 0.98em;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

input[type="range"] {
  width: 170px;
  accent-color: #2f80ed;
  cursor: pointer;
}

input[type="number"] {
  width: 70px;
  padding: 5px 4px;
  font-size: 1em;
  border-radius: 6px;
  border: 2px solid #d8b552;
  text-align: center;
  background: #fffdf8;
  color: #1b1d25;
  font-family: inherit;
  font-weight: 600;
}

input[type="number"]:focus {
  outline: none;
  border-color: #4596e6;
  box-shadow: 0 0 8px rgba(69,150,230,0.6);
}

/* 💥 ENTRY MODE SELECTOR */
.mode-toggle-group {
  margin: 4px auto 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
  background: rgba(216, 181, 82, 0.15);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px dashed #d8b552;
  max-width: 490px;
}

.mode-label {
  font-weight: 700;
  color: #4a3617;
}

.mode-pills {
  display: flex;
  gap: 6px;
}

.mode-pill {
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid #d8b552;
  background: #fffdf8;
  color: #4a3617;
  font-weight: 700;
  font-size: 0.85em;
  transition: all 0.2s;
  user-select: none;
}

.mode-pill.active {
  background: #2f80ed;
  color: #fff;
  border-color: #1a5bb0;
  box-shadow: 0 2px 6px rgba(47,128,237,0.35);
}

.offspring-count-group {
  margin: 6px auto 14px;
  gap: 12px;
}

.offspring-count-group input[type="range"] {
  width: 140px;
}

.offspring-count-group input[type="number"] {
  width: 60px;
}

/* 🪄 BUTTONS */
.btn-group {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

button {
  background: linear-gradient(180deg, #f5e2a5, #e7c75e);
  border: 3px solid #d8b552;
  border-radius: 10px;
  padding: 10px 26px;
  font-family: "Uncial Antiqua", serif;
  font-size: 1.1em;
  color: #124e88;
  text-shadow: 0 0 5px rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

button:hover {
  background: linear-gradient(180deg, #ffeaa7, #f5d36e);
  box-shadow: 0 0 12px rgba(255,215,150,0.7);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

button.resolving {
  background: linear-gradient(180deg, #bcd8ff, #78a8f0);
  color: #fff;
  box-shadow: 0 0 18px rgba(60,120,255,0.8);
  pointer-events: none;
}

.btn-resolve {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 24px 9px;
  line-height: 1.25;
}

.btn-resolve-main {
  font-family: "Uncial Antiqua", serif;
  font-size: 1.1em;
  color: #124e88;
  text-shadow: 0 0 5px rgba(255,255,255,0.6);
}

.btn-resolve-sub {
  font-family: "Cardo", Georgia, serif;
  font-size: 0.73em;
  font-style: italic;
  font-weight: 600;
  color: #5c431d;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

button.resolving .btn-resolve-main {
  color: #fff;
  text-shadow: none;
}

button.resolving .btn-resolve-sub {
  color: #e8f0fe;
}

.btn-secondary {
  font-family: "Cardo", serif;
  font-weight: 700;
  font-size: 0.95em;
  padding: 10px 18px;
  background: #fffdf8;
  color: #725a2e;
  border: 2px solid #d8b552;
}

.btn-secondary:hover {
  background: #fdf7e3;
  box-shadow: 0 0 8px rgba(216,181,82,0.5);
}

/* 📐 NERD MATH TOGGLE */
.math-toggle-wrap {
  margin: 22px auto 6px;
  display: flex;
  justify-content: center;
}

.math-toggle-btn {
  border-radius: 18px;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.25s ease;
}

/* 📜 RESULT */
#result {
  font-size: 1.7em;
  margin-top: 24px;
  font-weight: bold;
  color: #0f4174;
  text-shadow: 0 0 6px rgba(67,132,185,0.4);
  transition: opacity 0.3s ease-in-out;
  line-height: 1.35;
}

.result-sub {
  font-size: 0.65em;
  color: #725a2e;
  display: block;
  margin-top: 4px;
  font-weight: normal;
}

.result-stat-pill {
  display: inline-block;
  background: rgba(216,181,82,0.2);
  border: 1px solid #d8b552;
  border-radius: 8px;
  padding: 2px 8px;
  margin: 3px 2px;
  font-size: 0.58em;
  font-weight: 700;
  color: #3b2c17;
}

/* 🧙‍♂️ NARRATIVE */
.narrative {
  opacity: 0;
  display: none;
  transform: translateY(-15px);
  transition: all 0.8s ease;
  background: rgba(255,255,255,0.85);
  border: 3px solid #d8b552;
  border-radius: 14px;
  box-shadow: 0 0 16px rgba(27,102,170,0.25);
  padding: 18px 22px;
  margin-top: 24px;
  text-align: left;
}

.show-scroll {
  display: block !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: scrollFadeIn 0.8s ease-out forwards;
}

@keyframes scrollFadeIn {
  0% { opacity: 0; transform: translateY(-16px) scaleY(0.98); }
  70% { opacity: 1; transform: translateY(0) scaleY(1.01); }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

/* 🟨 STACK UPDATE NOTE & BULLETS */
.stack-update {
  text-align: center;
  font-size: 0.9em;
  font-style: italic;
  color: #124e88;
  margin-top: 8px;
  margin-bottom: 2px;
  font-weight: 600;
}

ul {
  margin: 6px 0 12px 30px;
  padding: 0;
  list-style-type: disc;
  color: #1b1d25;
}

ul li { margin-bottom: 6px; }

/* 🧱 STACK VISUALIZATION */
.stack-line {
  background: rgba(255,255,255,0.88);
  border: 2px solid #d8b552;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0 14px;
  box-shadow: 0 0 8px rgba(27,102,170,0.2);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-direction: row;
  font-family: "Cardo", serif;
  font-size: 0.95em;
}

.stack-box {
  background: linear-gradient(180deg, #fffdf8, #fdf3c8);
  border: 1.5px solid #c9a848;
  border-radius: 6px;
  padding: 5px 10px;
  box-shadow: 0 0 6px rgba(27,102,170,0.18);
  white-space: nowrap;
  font-weight: 700;
}

.stack-arrow { 
  color: #c79838; 
  font-weight: bold; 
  font-size: 1.1em;
}

/* 📘 EXPLANATION BOX */
.explanation {
  font-size: 0.95em;
  color: #2a1e13;
  margin-top: 30px;
  line-height: 1.6em;
  text-align: left;
  background: linear-gradient(180deg, #fffdf8, #fdf6e8);
  border: 3px solid #d8b552;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 0 15px rgba(27,102,170,0.18), inset 0 0 10px rgba(0,0,0,0.04);
}

.explanation-title {
  text-align: center;
  font-family: "Uncial Antiqua", serif;
  font-size: 1.3em;
  color: #c79838;
  text-shadow: 0 0 6px rgba(200,150,56,0.5);
  margin-bottom: 14px;
}

.math-formula-box {
  background: #ffffff;
  border: 1.5px solid #d8b552;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 12px 0;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.03);
}


/* 📜 CREDITS & ACKNOWLEDGMENTS BOX */
.credits-box {
  margin-top: 30px;
  background: linear-gradient(180deg, #fffdf8, #fbf4e2);
  border: 2px solid #d8b552;
  border-radius: 14px;
  padding: 16px 20px;
  text-align: center;
  font-size: 0.9em;
  color: #4a3617;
  box-shadow: 0 0 12px rgba(216,181,82,0.25);
  line-height: 1.55;
}

.credits-heading {
  font-family: "Uncial Antiqua", serif;
  color: #124e88;
  font-size: 1.15em;
  margin: 0 0 8px;
  font-weight: 700;
}

.credits-box p {
  margin: 6px 0;
}

.credits-box a {
  color: #124e88;
  text-decoration: underline;
  font-weight: 700;
}

.credits-box a:hover {
  color: #2f80ed;
}

/* ✒️ AUTHOR SIGNATURE */
.signature-box {
  margin-top: 18px;
  font-family: "Cardo", Georgia, serif;
  font-size: 0.95em;
  letter-spacing: 0.5px;
  color: #725a2e;
  text-align: center;
  font-style: italic;
}

.signature-box strong {
  font-style: normal;
  font-weight: 700;
  color: #124e88;
  letter-spacing: 0.5px;
}

html[data-theme="dark"] .signature-box,
body[data-theme="dark"] .signature-box,
body.dark-mode .signature-box {
  color: #c4b9a3 !important;
}

html[data-theme="dark"] .signature-box strong,
body[data-theme="dark"] .signature-box strong,
body.dark-mode .signature-box strong {
  color: #79b8ff !important;
  text-shadow: 0 0 8px rgba(121, 184, 255, 0.3);
}

/* 📱 Mobile optimizations */
@media (max-width: 650px) {
  body {
    padding: 16px 8px;
  }
  .card {
    padding: 24px 14px 30px;
    border-radius: 16px;
  }
  h1 {
    font-size: 1.75em;
    line-height: 1.2;
  }
  .slider-group {
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px auto;
  }
  label {
    width: 100%;
    text-align: center;
    justify-content: center;
    font-size: 0.92em;
  }
  input[type="range"] {
    width: 60%;
  }
  input[type="number"] {
    width: 60px;
  }
  .explanation {
    font-size: 0.88em;
    padding: 16px 14px;
  }
  .offspring-count-group {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .offspring-count-group .mode-label {
    width: 100%;
    text-align: center;
  }
  .offspring-count-group input[type="range"] {
    width: 60%;
  }
  .offspring-count-group input[type="number"] {
    width: 60px;
  }
}

/* ══════════════════════════════════════════════ */
/* 🩸 ETB SYNERGY & WIN CONDITIONS */
/* ══════════════════════════════════════════════ */
.synergy-toggle-wrap {
  text-align: center;
  margin: 10px auto 14px;
}

.synergy-toggle-btn {
  font-size: 0.88em;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(216, 181, 82, 0.15);
  border: 1.5px dashed #d8b552;
  color: #725a2e;
  transition: all 0.2s ease;
}

.synergy-toggle-btn:hover {
  background: rgba(216, 181, 82, 0.28);
  border-color: #b59235;
}

.synergy-toggle-btn.active {
  background: #fdf3d0;
  border-style: solid;
  border-color: #c99c36;
  font-weight: bold;
}

.synergy-box {
  margin: 16px auto;
  background: rgba(216, 181, 82, 0.12);
  border: 1.5px dashed #d8b552;
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 540px;
}

.synergy-title {
  font-family: "Uncial Antiqua", serif;
  font-size: 1.05em;
  color: #124e88;
  margin-bottom: 2px;
  display: block;
}

.synergy-subtitle {
  font-size: 0.82em;
  font-style: italic;
  color: #725a2e;
  display: block;
  margin-bottom: 8px;
}

.synergy-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 10px;
}

.synergy-chip {
  background: #fffdf8;
  border: 1px solid #d8b552;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 0.8em;
  font-weight: 700;
  color: #4a3617;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.synergy-chip:hover {
  background: #f8e8b8;
  border-color: #b58c29;
  transform: translateY(-1px);
}

.synergy-chip.burn-chip:hover {
  background: #fbe9e7;
  border-color: #ff5722;
  color: #bf360c;
}

.synergy-chip.life-chip:hover {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #1b5e20;
}

/* 🩸 RESULT PILLS (BURN & LIFE GAIN) */
.result-burn-pill {
  display: inline-block;
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 1.5px solid #ff7043;
  color: #bf360c;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.6em;
  font-weight: 700;
  margin: 4px 3px;
  box-shadow: 0 2px 6px rgba(230, 81, 0, 0.15);
}

.result-burn-pill.lethal {
  background: linear-gradient(135deg, #ffebee, #ffcdd2);
  border-color: #e53935;
  color: #b71c1c;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.4);
  animation: pulseLethal 1.5s infinite alternate ease-in-out;
}

@keyframes pulseLethal {
  0% { transform: scale(1); box-shadow: 0 0 8px rgba(229, 57, 53, 0.4); }
  100% { transform: scale(1.03); box-shadow: 0 0 16px rgba(229, 57, 53, 0.7); }
}

.result-loss-pill {
  display: inline-block;
  background: linear-gradient(135deg, #f3e5f5, #e1bee7);
  border: 1.5px solid #ab47bc;
  color: #4a148c;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.6em;
  font-weight: 700;
  margin: 4px 3px;
  box-shadow: 0 2px 6px rgba(171, 71, 188, 0.18);
}

.result-loss-pill.lethal {
  background: linear-gradient(135deg, #fce4ec, #f8bbd0);
  border-color: #d81b60;
  color: #880e4f;
  box-shadow: 0 0 10px rgba(216, 27, 96, 0.4);
  animation: pulseLethal 1.5s infinite alternate ease-in-out;
}

.result-life-pill {
  display: inline-block;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 1.5px solid #43a047;
  color: #1b5e20;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.6em;
  font-weight: 700;
  margin: 4px 3px;
  box-shadow: 0 2px 6px rgba(67, 160, 71, 0.15);
}

/* ⚖️ RESULT NET LIFE PILL */
.result-net-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.6em;
  font-weight: 700;
  margin: 4px 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.result-net-pill.positive {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border: 1.5px solid #22c55e;
  color: #14532d;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.2);
}

.result-net-pill.negative {
  background: linear-gradient(135deg, #ffe4e6, #fecdd3);
  border: 1.5px solid #f43f5e;
  color: #881337;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.2);
}

.result-net-pill.negative.lethal {
  background: linear-gradient(135deg, #ffebee, #ffcdd2);
  border-color: #e53935;
  color: #b71c1c;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.5);
  animation: pulseLethal 1.5s infinite alternate ease-in-out;
}

.result-net-pill.neutral {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border: 1.5px solid #94a3b8;
  color: #334155;
  box-shadow: 0 2px 6px rgba(148, 163, 184, 0.2);
}

/* 💥 HARE-POCALYPSE MILESTONES */
.milestone-badge {
  margin: 14px auto 0;
  padding: 10px 16px;
  border-radius: 14px;
  max-width: 520px;
  background: linear-gradient(135deg, #fff9e6, #fff3cd);
  border: 2px solid #f1c40f;
  box-shadow: 0 4px 14px rgba(241, 196, 15, 0.25);
  animation: milestoneGlow 3s infinite alternate ease-in-out;
  text-align: center;
}

.milestone-title {
  font-family: "Uncial Antiqua", serif;
  font-size: 1.15em;
  color: #8c6d00;
  margin-bottom: 3px;
  display: block;
}

.milestone-subtitle {
  font-size: 0.88em;
  font-style: italic;
  color: #5c4700;
  line-height: 1.35;
  display: block;
}

@keyframes milestoneGlow {
  0% { box-shadow: 0 0 8px rgba(241, 196, 15, 0.3); }
  100% { box-shadow: 0 0 18px rgba(241, 196, 15, 0.6); }
}

/* 🍞 TOAST NOTIFICATION */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #14497e;
  color: #fff;
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 0.92em;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

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

@media (prefers-reduced-motion: reduce) {
  .milestone-badge {
    animation: none !important;
  }
  .result-burn-pill.lethal,
  .result-loss-pill.lethal,
  .result-net-pill.negative.lethal {
    animation: none !important;
  }
}

/* ══════════════════════════════════════════════ */
/* 🌓 THEME TOGGLE & HEADER BAR */
/* ══════════════════════════════════════════════ */
.header-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.theme-btn {
  background: #fbf6e8;
  border: 2px solid #d8b552;
  border-radius: 20px;
  padding: 5px 14px;
  font-family: "Cardo", Georgia, serif;
  font-size: 0.88em;
  font-weight: 700;
  color: #4a3617;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  text-shadow: none;
  user-select: none;
}

.theme-btn:hover {
  background: #f8e8b8;
  border-color: #b58c29;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(216,181,82,0.35);
}

/* ══════════════════════════════════════════════ */
/* 🌙 DARK MODE STYLES */
/* ══════════════════════════════════════════════ */
html[data-theme="dark"],
html[data-theme="dark"] body,
body[data-theme="dark"],
body.dark-mode {
  background: radial-gradient(circle at 50% 15%, #181d2e 0%, #0d101a 55%, #05060a 100%) !important;
  color: #e4e0d7 !important;
}

html[data-theme="dark"] .card,
body[data-theme="dark"] .card,
body.dark-mode .card {
  background: linear-gradient(180deg, rgba(25, 29, 43, 0.98), rgba(18, 21, 31, 0.98)) !important;
  border-color: #d4af37 !important;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.85), 0 0 15px rgba(212, 175, 55, 0.2) !important;
}

html[data-theme="dark"] h1,
body[data-theme="dark"] h1,
body.dark-mode h1 {
  color: #79b8ff !important;
  text-shadow: 0 0 12px rgba(100, 181, 246, 0.6) !important;
}

html[data-theme="dark"] .subtitle,
body[data-theme="dark"] .subtitle,
body.dark-mode .subtitle {
  color: #d8c29d !important;
}

html[data-theme="dark"] .tag-badge,
body[data-theme="dark"] .tag-badge,
body.dark-mode .tag-badge {
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a) !important;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.4) !important;
}

html[data-theme="dark"] .theme-btn,
body[data-theme="dark"] .theme-btn,
body.dark-mode .theme-btn {
  background: #232738 !important;
  border-color: #ffd54f !important;
  color: #ffd54f !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}

html[data-theme="dark"] .theme-btn:hover,
body[data-theme="dark"] .theme-btn:hover,
body.dark-mode .theme-btn:hover {
  background: #2e344a !important;
  border-color: #ffe082 !important;
  box-shadow: 0 0 12px rgba(255, 213, 79, 0.45) !important;
}

html[data-theme="dark"] .preset-chip,
body[data-theme="dark"] .preset-chip,
body.dark-mode .preset-chip {
  background: #222636 !important;
  border-color: #9e8338 !important;
  color: #f0e6d2 !important;
}

html[data-theme="dark"] .preset-chip:hover,
body[data-theme="dark"] .preset-chip:hover,
body.dark-mode .preset-chip:hover {
  background: #2f354c !important;
  border-color: #ffd54f !important;
  color: #fff !important;
}

html[data-theme="dark"] .preset-chip.danger,
body[data-theme="dark"] .preset-chip.danger,
body.dark-mode .preset-chip.danger {
  background: #3a1c1c !important;
  border-color: #a84242 !important;
  color: #ff9b9b !important;
}

html[data-theme="dark"] .preset-chip.danger:hover,
body[data-theme="dark"] .preset-chip.danger:hover,
body.dark-mode .preset-chip.danger:hover {
  background: #4c2222 !important;
}

html[data-theme="dark"] label,
body[data-theme="dark"] label,
body.dark-mode label {
  color: #ded7c8 !important;
}

html[data-theme="dark"] input[type="range"],
body[data-theme="dark"] input[type="range"],
body.dark-mode input[type="range"] {
  accent-color: #60a5fa !important;
}

html[data-theme="dark"] input[type="number"],
body[data-theme="dark"] input[type="number"],
body.dark-mode input[type="number"] {
  background: #141724 !important;
  border-color: #c9a848 !important;
  color: #f7f3ea !important;
}

html[data-theme="dark"] input[type="number"]:focus,
body[data-theme="dark"] input[type="number"]:focus,
body.dark-mode input[type="number"]:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.6) !important;
}

html[data-theme="dark"] .mode-toggle-group,
body[data-theme="dark"] .mode-toggle-group,
body.dark-mode .mode-toggle-group {
  background: rgba(212, 175, 55, 0.1) !important;
  border-color: #8f742c !important;
}

html[data-theme="dark"] .mode-label,
body[data-theme="dark"] .mode-label,
body.dark-mode .mode-label {
  color: #ffd54f !important;
}

html[data-theme="dark"] .mode-pill,
body[data-theme="dark"] .mode-pill,
body.dark-mode .mode-pill {
  background: #181c2b !important;
  border-color: #8d732c !important;
  color: #e6dfd1 !important;
}

html[data-theme="dark"] .mode-pill.active,
body[data-theme="dark"] .mode-pill.active,
body.dark-mode .mode-pill.active {
  background: #2563eb !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.5) !important;
}

html[data-theme="dark"] button,
body[data-theme="dark"] button,
body.dark-mode button {
  background: linear-gradient(180deg, #d4af37, #9b7e1c) !important;
  border-color: #ffd54f !important;
  color: #0b1526 !important;
  text-shadow: 0 0 3px rgba(255,255,255,0.4) !important;
}

html[data-theme="dark"] button:hover,
body[data-theme="dark"] button:hover,
body.dark-mode button:hover {
  background: linear-gradient(180deg, #ffd700, #b59325) !important;
  box-shadow: 0 0 16px rgba(255, 213, 79, 0.5) !important;
}

html[data-theme="dark"] .btn-resolve-main,
body[data-theme="dark"] .btn-resolve-main,
body.dark-mode .btn-resolve-main {
  color: #0b1526 !important;
  text-shadow: 0 0 3px rgba(255,255,255,0.4) !important;
}

html[data-theme="dark"] .btn-resolve-sub,
body[data-theme="dark"] .btn-resolve-sub,
body.dark-mode .btn-resolve-sub {
  color: #3b2a0c !important;
}

html[data-theme="dark"] button.resolving .btn-resolve-main,
body[data-theme="dark"] button.resolving .btn-resolve-main,
body.dark-mode button.resolving .btn-resolve-main {
  color: #fff !important;
  text-shadow: none !important;
}

html[data-theme="dark"] button.resolving .btn-resolve-sub,
body[data-theme="dark"] button.resolving .btn-resolve-sub,
body.dark-mode button.resolving .btn-resolve-sub {
  color: #e8f0fe !important;
}

html[data-theme="dark"] .btn-secondary,
body[data-theme="dark"] .btn-secondary,
body.dark-mode .btn-secondary {
  background: #1e2232 !important;
  border-color: #c9a848 !important;
  color: #e2dbcd !important;
}

html[data-theme="dark"] .btn-secondary:hover,
body[data-theme="dark"] .btn-secondary:hover,
body.dark-mode .btn-secondary:hover {
  background: #2a3047 !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3) !important;
}

html[data-theme="dark"] #result,
body[data-theme="dark"] #result,
body.dark-mode #result {
  color: #64b5f6 !important;
  text-shadow: 0 0 12px rgba(100, 181, 246, 0.6) !important;
}

html[data-theme="dark"] .result-sub,
body[data-theme="dark"] .result-sub,
body.dark-mode .result-sub {
  color: #e2cca0 !important;
}

html[data-theme="dark"] .result-stat-pill,
body[data-theme="dark"] .result-stat-pill,
body.dark-mode .result-stat-pill {
  background: rgba(212, 175, 55, 0.16) !important;
  border-color: #c9a848 !important;
  color: #f7edd7 !important;
}

html[data-theme="dark"] .section-heading,
body[data-theme="dark"] .section-heading,
body.dark-mode .section-heading {
  color: #79b8ff !important;
  text-shadow: 0 0 8px rgba(121, 184, 255, 0.35) !important;
}

html[data-theme="dark"] .narrative,
body[data-theme="dark"] .narrative,
body.dark-mode .narrative {
  background: rgba(20, 23, 34, 0.95) !important;
  border-color: #d4af37 !important;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.7) !important;
  color: #e4e0d7 !important;
}

html[data-theme="dark"] ul,
html[data-theme="dark"] ul li,
body[data-theme="dark"] ul,
body[data-theme="dark"] ul li,
body.dark-mode ul,
body.dark-mode ul li {
  color: #ded7c8 !important;
}

html[data-theme="dark"] .stack-update,
body[data-theme="dark"] .stack-update,
body.dark-mode .stack-update {
  color: #90caf9 !important;
}

html[data-theme="dark"] .stack-line,
body[data-theme="dark"] .stack-line,
body.dark-mode .stack-line {
  background: rgba(14, 16, 25, 0.94) !important;
  border-color: #b58c29 !important;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .stack-box,
body[data-theme="dark"] .stack-box,
body.dark-mode .stack-box {
  background: linear-gradient(180deg, #282d42, #1a1e2d) !important;
  border-color: #d4af37 !important;
  color: #f7f1e4 !important;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .stack-arrow,
body[data-theme="dark"] .stack-arrow,
body.dark-mode .stack-arrow {
  color: #ffd54f !important;
}

html[data-theme="dark"] .explanation,
body[data-theme="dark"] .explanation,
body.dark-mode .explanation {
  background: linear-gradient(180deg, #1b1e2e, #131622) !important;
  border-color: #d4af37 !important;
  color: #e4dfd3 !important;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .explanation-title,
body[data-theme="dark"] .explanation-title,
body.dark-mode .explanation-title {
  color: #ffd54f !important;
  text-shadow: 0 0 10px rgba(255, 213, 79, 0.4) !important;
}

html[data-theme="dark"] .math-formula-box,
body[data-theme="dark"] .math-formula-box,
body.dark-mode .math-formula-box {
  background: #141724 !important;
  border-color: #8d732c !important;
  color: #f0ebe1 !important;
}

html[data-theme="dark"] .math-formula-box p,
body[data-theme="dark"] .math-formula-box p,
body.dark-mode .math-formula-box p {
  color: #d0c8b8 !important;
}

html[data-theme="dark"] mjx-container,
body[data-theme="dark"] mjx-container,
body.dark-mode mjx-container {
  color: #f0ebe1 !important;
}

html[data-theme="dark"] .art-card img,
body[data-theme="dark"] .art-card img,
body.dark-mode .art-card img {
  border-color: #c9a848 !important;
  background: #141724 !important;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="dark"] .art-card img:hover,
body[data-theme="dark"] .art-card img:hover,
body.dark-mode .art-card img:hover {
  box-shadow: 0 0 22px rgba(255, 213, 79, 0.6) !important;
}

html[data-theme="dark"] .art-caption,
body[data-theme="dark"] .art-caption,
body.dark-mode .art-caption {
  color: #d8c29d !important;
}

html[data-theme="dark"] .credits-box,
body[data-theme="dark"] .credits-box,
body.dark-mode .credits-box {
  background: linear-gradient(180deg, #1c2032, #131624) !important;
  border-color: #c9a848 !important;
  color: #e2dbcc !important;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.5) !important;
}

html[data-theme="dark"] .credits-heading,
body[data-theme="dark"] .credits-heading,
body.dark-mode .credits-heading {
  color: #79b8ff !important;
}

html[data-theme="dark"] .credits-box a,
body[data-theme="dark"] .credits-box a,
body.dark-mode .credits-box a {
  color: #64b5f6 !important;
}

html[data-theme="dark"] .credits-box a:hover,
body[data-theme="dark"] .credits-box a:hover,
body.dark-mode .credits-box a:hover {
  color: #90caf9 !important;
}

html[data-theme="dark"] footer,
body[data-theme="dark"] footer,
body.dark-mode footer {
  color: #b8a58a !important;
}

/* 🌙 DARK MODE: SYNERGY & WIN CONDITIONS */
html[data-theme="dark"] .synergy-toggle-btn,
body[data-theme="dark"] .synergy-toggle-btn,
body.dark-mode .synergy-toggle-btn {
  background: rgba(216, 181, 82, 0.1) !important;
  border-color: #8c7335 !important;
  color: #d8c28c !important;
}

html[data-theme="dark"] .synergy-toggle-btn:hover,
body[data-theme="dark"] .synergy-toggle-btn:hover,
body.dark-mode .synergy-toggle-btn:hover {
  background: rgba(216, 181, 82, 0.2) !important;
  color: #f0dfb2 !important;
}

html[data-theme="dark"] .synergy-toggle-btn.active,
body[data-theme="dark"] .synergy-toggle-btn.active,
body.dark-mode .synergy-toggle-btn.active {
  background: rgba(216, 181, 82, 0.25) !important;
  border-style: solid !important;
  border-color: #d8b552 !important;
  color: #ffe8a8 !important;
}

html[data-theme="dark"] .synergy-box,
body[data-theme="dark"] .synergy-box,
body.dark-mode .synergy-box {
  background: rgba(22, 26, 40, 0.75) !important;
  border-color: #a88432 !important;
}

html[data-theme="dark"] .synergy-title,
body[data-theme="dark"] .synergy-title,
body.dark-mode .synergy-title {
  color: #79b8ff !important;
}

html[data-theme="dark"] .synergy-subtitle,
body[data-theme="dark"] .synergy-subtitle,
body.dark-mode .synergy-subtitle {
  color: #d8c29d !important;
}

html[data-theme="dark"] .synergy-chip,
body[data-theme="dark"] .synergy-chip,
body.dark-mode .synergy-chip {
  background: #191c2c !important;
  border-color: #8d732c !important;
  color: #e2dbcc !important;
}

html[data-theme="dark"] .synergy-chip:hover,
body[data-theme="dark"] .synergy-chip:hover,
body.dark-mode .synergy-chip:hover {
  background: #28304c !important;
  border-color: #c9a848 !important;
}

html[data-theme="dark"] .synergy-chip.burn-chip:hover,
body[data-theme="dark"] .synergy-chip.burn-chip:hover,
body.dark-mode .synergy-chip.burn-chip:hover {
  background: #3b1912 !important;
  border-color: #ff7043 !important;
  color: #ffab91 !important;
}

html[data-theme="dark"] .synergy-chip.life-chip:hover,
body[data-theme="dark"] .synergy-chip.life-chip:hover,
body.dark-mode .synergy-chip.life-chip:hover {
  background: #102d18 !important;
  border-color: #66bb6a !important;
  color: #a5d6a7 !important;
}

/* 🌙 DARK MODE: RESULT PILLS (BURN & LIFE GAIN) */
html[data-theme="dark"] .result-burn-pill,
body[data-theme="dark"] .result-burn-pill,
body.dark-mode .result-burn-pill {
  background: linear-gradient(135deg, #381a14, #26110d) !important;
  border-color: #ff7043 !important;
  color: #ffab91 !important;
  box-shadow: 0 0 12px rgba(255, 112, 67, 0.3) !important;
}

html[data-theme="dark"] .result-burn-pill.lethal,
body[data-theme="dark"] .result-burn-pill.lethal,
body.dark-mode .result-burn-pill.lethal {
  background: linear-gradient(135deg, #481115, #2b080b) !important;
  border-color: #ef5350 !important;
  color: #ff8a80 !important;
  box-shadow: 0 0 16px rgba(239, 83, 80, 0.5) !important;
}

html[data-theme="dark"] .result-loss-pill,
body[data-theme="dark"] .result-loss-pill,
body.dark-mode .result-loss-pill {
  background: linear-gradient(135deg, #2a1335, #190921) !important;
  border-color: #ba68c8 !important;
  color: #e1bee7 !important;
  box-shadow: 0 0 12px rgba(186, 104, 200, 0.3) !important;
}

html[data-theme="dark"] .result-loss-pill.lethal,
body[data-theme="dark"] .result-loss-pill.lethal,
body.dark-mode .result-loss-pill.lethal {
  background: linear-gradient(135deg, #3d0c26, #230414) !important;
  border-color: #f06292 !important;
  color: #f8bbd0 !important;
  box-shadow: 0 0 16px rgba(240, 98, 146, 0.5) !important;
}

html[data-theme="dark"] .result-life-pill,
body[data-theme="dark"] .result-life-pill,
body.dark-mode .result-life-pill {
  background: linear-gradient(135deg, #102d18, #0a1f11) !important;
  border-color: #4caf50 !important;
  color: #a5d6a7 !important;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.3) !important;
}

html[data-theme="dark"] .result-net-pill.positive,
body[data-theme="dark"] .result-net-pill.positive,
body.dark-mode .result-net-pill.positive {
  background: linear-gradient(135deg, #0f381e, #092413) !important;
  border-color: #4ade80 !important;
  color: #86efac !important;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.3) !important;
}

html[data-theme="dark"] .result-net-pill.negative,
body[data-theme="dark"] .result-net-pill.negative,
body.dark-mode .result-net-pill.negative {
  background: linear-gradient(135deg, #3b1016, #24080d) !important;
  border-color: #fb7185 !important;
  color: #fecdd3 !important;
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.3) !important;
}

html[data-theme="dark"] .result-net-pill.negative.lethal,
body[data-theme="dark"] .result-net-pill.negative.lethal,
body.dark-mode .result-net-pill.negative.lethal {
  background: linear-gradient(135deg, #4c0d13, #2e0508) !important;
  border-color: #f87171 !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.5) !important;
}

html[data-theme="dark"] .result-net-pill.neutral,
body[data-theme="dark"] .result-net-pill.neutral,
body.dark-mode .result-net-pill.neutral {
  background: linear-gradient(135deg, #1e2433, #151924) !important;
  border-color: #64748b !important;
  color: #cbd5e1 !important;
  box-shadow: 0 0 10px rgba(100, 116, 139, 0.25) !important;
}

/* 🌙 DARK MODE: HARE-POCALYPSE MILESTONES */
html[data-theme="dark"] .milestone-badge,
body[data-theme="dark"] .milestone-badge,
body.dark-mode .milestone-badge {
  background: linear-gradient(135deg, #262112, #18150a) !important;
  border-color: #ffd54f !important;
  box-shadow: 0 0 16px rgba(255, 213, 79, 0.3) !important;
}

html[data-theme="dark"] .milestone-title,
body[data-theme="dark"] .milestone-title,
body.dark-mode .milestone-title {
  color: #ffe082 !important;
  text-shadow: 0 0 8px rgba(255, 224, 130, 0.4) !important;
}

html[data-theme="dark"] .milestone-subtitle,
body[data-theme="dark"] .milestone-subtitle,
body.dark-mode .milestone-subtitle {
  color: #e0d5ba !important;
}

/* 🌙 DARK MODE: TOAST */
html[data-theme="dark"] .toast,
body[data-theme="dark"] .toast,
body.dark-mode .toast {
  background: #2a68a5 !important;
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.75) !important;
}

/* 🌙 DARK MODE: PRESET CHIPS */
html[data-theme="dark"] .preset-chip.burn-chip,
body[data-theme="dark"] .preset-chip.burn-chip,
body.dark-mode .preset-chip.burn-chip {
  background: #381a14 !important;
  border-color: #ff7043 !important;
  color: #ffab91 !important;
}
html[data-theme="dark"] .preset-chip.burn-chip:hover,
body[data-theme="dark"] .preset-chip.burn-chip:hover,
body.dark-mode .preset-chip.burn-chip:hover {
  background: #4e221a !important;
}

html[data-theme="dark"] .preset-chip.life-chip,
body[data-theme="dark"] .preset-chip.life-chip,
body.dark-mode .preset-chip.life-chip {
  background: #102d18 !important;
  border-color: #4caf50 !important;
  color: #a5d6a7 !important;
}
html[data-theme="dark"] .preset-chip.life-chip:hover,
body[data-theme="dark"] .preset-chip.life-chip:hover,
body.dark-mode .preset-chip.life-chip:hover {
  background: #184224 !important;
}


