/* ============================================
   BrainJoy Simulations — Shared Styles
   ============================================ */

/* ── CSS Variables ── */
:root {
  --purple: #6a0dad;
  --purple-light: #9b4dca;
  --purple-dark: #4a0080;
  --purple-50: #f5eefc;
  --purple-100: #e8deff;
  --purple-200: #d4c2f5;
  --purple-300: #c9c2e8;

  --teal: #00bfa5;
  --teal-light: #1de9b6;
  --teal-50: #e0f7f4;

  --pink: #ff5ca2;
  --pink-light: #ff80b5;

  --slate: #8b9dc3;
  --slate-light: #a8b9d8;

  --text: #1f1f2e;
  --text-secondary: #5a5a6e;
  --text-muted: #8a8a9a;

  --bg: #faf8ff;
  --bg-card: #ffffff;
  --border: #e6e0f0;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 2px 8px rgba(106, 13, 173, 0.06);
  --shadow-md: 0 8px 24px rgba(106, 13, 173, 0.10);
  --shadow-lg: 0 16px 40px rgba(106, 13, 173, 0.14);

  --font-display: 'Baloo 2', cursive;
  --font-body: 'Poppins', sans-serif;

  --max-width: 1120px;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Navigation ── */
.sim-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.sim-nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--purple);
}

.sim-nav .brand img {
  height: 34px;
  width: auto;
}

.sim-nav .nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.sim-nav .nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}

.sim-nav .nav-links a:hover {
  color: var(--purple);
}

.sim-nav .nav-links a.current {
  color: var(--purple);
  font-weight: 600;
}

.sim-nav .nav-links a.current::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: var(--purple);
  border-radius: 2px;
}

/* ── Hero ── */
.sim-hero {
  text-align: center;
  padding: 56px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.sim-hero .eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--purple-light);
  background: var(--purple-50);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.sim-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 12px;
}

.sim-hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Layout Containers ── */
.sim-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.sim-lab {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 860px) {
  .sim-lab {
    grid-template-columns: 1fr;
  }
}

/* ── Panels ── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 6px;
  color: var(--text);
}

.panel-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ── Hub Grid (Simulations Menu) ── */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  padding-bottom: 40px;
}

.sim-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  position: relative;
  overflow: hidden;
}

.sim-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--purple-200);
}

.sim-card.teal {
  border-color: #c8f0e8;
  background: linear-gradient(180deg, #fff 0%, #f0fdf9 100%);
}

.sim-card.teal:hover {
  border-color: var(--teal);
}

.sim-card.locked {
  opacity: 0.65;
  pointer-events: none;
  filter: grayscale(0.35);
}

.sim-card .tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--purple-50);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.sim-card.teal .tag {
  color: #00796b;
  background: var(--teal-50);
}

.sim-card .sim-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

.sim-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--text);
}

.sim-card > p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
  margin-bottom: 16px;
}

.sim-card .go {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--purple);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}

.sim-card:hover .go {
  gap: 10px;
}

.sim-card .badge-soon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: #f0f0f5;
  padding: 4px 10px;
  border-radius: 6px;
}

/* ── Apparatus Panel (Atom Sim) ── */
.apparatus-panel {
  align-items: center;
  text-align: center;
}

.atom-svg {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ── Readouts ── */
.readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.readout {
  background: var(--purple-50);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}

.readout .rlabel {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.readout .rval {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--purple-dark);
  line-height: 1.2;
}

/* ── Pills ── */
.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.pill.neutral {
  background: #e8e8f0;
  color: #555;
}

.pill.acidic {
  background: #ffe0ec;
  color: #c2185b;
}

.pill.basic {
  background: #e0f7f4;
  color: #00796b;
}

/* ── Form Controls ── */
.field {
  margin-bottom: 22px;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text);
}

.field .val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--purple);
  background: var(--purple-50);
  padding: 2px 10px;
  border-radius: 6px;
  min-width: 28px;
  text-align: center;
}

.field input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--purple-100);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(106, 13, 173, 0.25);
  cursor: pointer;
  transition: transform 0.15s;
}

.field input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.field input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--purple);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(106, 13, 173, 0.25);
  cursor: pointer;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.45;
}

/* ── Buttons ── */
.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.sbtn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
}

.sbtn:hover {
  transform: translateY(-1px);
}

.sbtn:active {
  transform: translateY(0);
}

.sbtn-primary {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 4px 12px rgba(106, 13, 173, 0.25);
}

.sbtn-primary:hover {
  background: var(--purple-dark);
  box-shadow: 0 6px 16px rgba(106, 13, 173, 0.35);
}

.sbtn-reset {
  background: #f0f0f5;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.sbtn-reset:hover {
  background: #e6e6f0;
  color: var(--text);
}

/* ── Callouts ── */
.callouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.callout h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--purple-dark);
}

.callout p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.callout strong {
  color: var(--text);
}

/* ── Quiz Section ── */
.quiz-section {
  margin-top: 40px;
}

.section-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--purple-light);
  margin-bottom: 6px;
}

.quiz-section h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--text);
}

.qcard {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.qtitle {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 14px;
  color: var(--text);
  line-height: 1.45;
}

.qopts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qopt {
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.qopt:hover:not(:disabled) {
  border-color: var(--purple-200);
  background: var(--purple-50);
}

.qopt:disabled {
  cursor: default;
  opacity: 0.9;
}

.qopt.correct {
  background: #e0f7e8;
  border-color: #2ecc71;
  color: #145a32;
  font-weight: 600;
}

.qopt.incorrect {
  background: #ffe0e0;
  border-color: #e74c3c;
  color: #922b21;
}

.qexplain {
  display: none;
  margin-top: 14px;
  padding: 14px;
  background: #f8f9ff;
  border-left: 3px solid var(--purple-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.score-card {
  display: none;
  text-align: center;
  background: linear-gradient(135deg, var(--purple-50) 0%, #fff 100%);
  border: 2px solid var(--purple-200);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  margin-top: 24px;
  box-shadow: var(--shadow-md);
}

.score-card h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--purple-dark);
  margin-bottom: 8px;
}

.score-card p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ── Footer ── */
.sim-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 28px 24px;
  margin-top: 20px;
}

.sim-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.sim-footer-links {
  display: flex;
  gap: 22px;
}

.sim-footer-links a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s;
}

.sim-footer-links a:hover {
  color: var(--purple);
}

/* ── Atom SVG Styles ── */
.shell-group {
  transform-origin: 150px 150px;
}

.shell-1 { animation: orbit 24s linear infinite; }
.shell-2 { animation: orbit 17s linear infinite reverse; }
.shell-3 { animation: orbit 11s linear infinite; }
.shell-4 { animation: orbit 8s linear infinite reverse; }

@keyframes orbit {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.nucleus-group {
  animation: pulse 3.2s ease-in-out infinite;
  transform-origin: 150px 150px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

.proton  { fill: #FF5CA2; stroke: #fff; stroke-width: 1.2; }
.neutron { fill: #8B9DC3; stroke: #fff; stroke-width: 1.2; }
.electron { fill: #00BFA5; }

.shell-ring {
  fill: none;
  stroke: #E8DEFF;
  stroke-width: 1.8;
}

.shell-ring.active {
  stroke: #C9C2E8;
  stroke-width: 2;
}

/* ── Utility ── */
@media (max-width: 640px) {
  .sim-nav {
    padding: 0 16px;
    height: 56px;
  }
  .sim-nav .nav-links {
    gap: 16px;
  }
  .sim-nav .nav-links a {
    font-size: 0.85rem;
  }
  .sim-hero {
    padding: 36px 16px 28px;
  }
  .sim-wrap {
    padding: 0 16px 36px;
  }
  .panel {
    padding: 20px;
  }
  .readouts {
    grid-template-columns: repeat(2, 1fr);
  }
  .callouts {
    grid-template-columns: 1fr;
  }
  .sim-footer-inner {
    flex-direction: column;
    text-align: center;
  }
}