body[data-page="stem-games"] {
  background:
    radial-gradient(circle at 10% 0%, rgba(55,232,194,.18), transparent 28rem),
    radial-gradient(circle at 100% 20%, rgba(119,88,232,.22), transparent 32rem),
    #10172a !important;
  color: #f7f8ff;
}
body[data-page="stem-games"]::before { opacity: .16; }
.stem-nav { color: var(--ink); }
.stem-hero {
  width: min(1160px, calc(100% - 32px)); margin: 24px auto 34px; padding: clamp(34px, 7vw, 72px);
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center;
  overflow: hidden; position: relative; border: 1px solid rgba(255,255,255,.13); border-radius: 36px;
  background: linear-gradient(145deg, #202b4e, #17203b); box-shadow: 0 30px 80px rgba(0,0,0,.28);
}
.stem-kicker { color: #74f1d5; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.stem-hero h1 { margin: 8px 0 18px; font-size: clamp(3.2rem, 7vw, 6.4rem); line-height: .9; letter-spacing: -.055em; }
.stem-hero h1 span { color: #ffd45f; }
.stem-hero p:not(.stem-kicker) { max-width: 660px; color: #bec8df; font-size: 1.1rem; line-height: 1.7; }
.stem-hero > div > a { display: inline-block; margin-top: 12px; padding: 13px 18px; color: #17233b; border-radius: 15px; background: #74f1d5; text-decoration: none; font-weight: 900; }
.stem-hero-machine {
  width: min(320px, 100%); height: 340px; margin: auto; padding: 28px; position: relative;
  border: 10px solid #343f67; border-radius: 32px 32px 70px 70px; background: #7758e8;
  box-shadow: inset 0 -20px rgba(0,0,0,.13), 0 26px 50px rgba(0,0,0,.3);
}
.machine-screen {
  height: 180px; display: grid; place-items: center; color: #74f1d5; border: 10px solid #1a2240;
  border-radius: 18px; background: repeating-linear-gradient(0deg,#081027 0 3px,#0b1531 3px 6px);
  font: 800 2.6rem "Baloo 2", sans-serif; text-shadow: 0 0 16px #74f1d5;
}
.machine-controls { margin-top: 24px; display: flex; gap: 12px; }
.machine-controls i { width: 28px; height: 28px; border-radius: 50%; background: #ffd45f; box-shadow: inset 0 -5px rgba(0,0,0,.15); }
.machine-controls i:nth-child(2) { background: #f06aa7; } .machine-controls i:nth-child(3) { background: #74f1d5; }
.machine-stick { width: 12px; height: 60px; position: absolute; right: 50px; bottom: 38px; border-radius: 8px; background: #17233b; transform: rotate(12deg); transform-origin: bottom; }
.machine-stick::before { content: ""; width: 32px; height: 32px; position: absolute; left: -10px; top: -18px; border-radius: 50%; background: #ff6e78; }
.stem-main { width: min(1060px, calc(100% - 32px)); margin: 0 auto 70px; }
.stem-stats { margin-bottom: 24px; padding: 18px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(255,255,255,.06); }
.stem-stats div { text-align: center; } .stem-stats strong { display: block; color: #ffd45f; font-size: 1.5rem; } .stem-stats span { color: #aeb9d0; font-size: .85rem; }
.stem-game-card {
  margin: 22px 0; overflow: hidden; color: var(--ink); border: 1px solid rgba(255,255,255,.14);
  border-radius: 30px; background: #fff; box-shadow: 0 22px 55px rgba(0,0,0,.2);
}
.game-intro { padding: 30px; background: linear-gradient(135deg, #fff, #f4f2ff); }
.game-intro > div { display: flex; justify-content: space-between; align-items: center; }
.stem-tag { padding: 7px 11px; border-radius: 99px; color: #fff; background: #7758e8; font-size: .72rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.stem-tag.engineering { background: #e77932; } .stem-tag.coding { background: #247fc5; } .stem-tag.chemistry { background: #16a77d; } .stem-tag.math { background: #c24f89; }
.difficulty { color: #e8b323; letter-spacing: .15em; }
.game-intro h2 { margin: 18px 0 5px; font-size: clamp(2rem,5vw,3rem); line-height: 1; }
.game-intro p { max-width: 760px; margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.stem-start, .stem-action, .stem-secondary {
  min-height: 46px; padding: 9px 16px; border: 0; border-radius: 14px; cursor: pointer; font-weight: 900;
}
.stem-start, .stem-action { color: #fff; background: linear-gradient(135deg,#7758e8,#5438bd); }
.stem-secondary { color: var(--ink); border: 1px solid var(--line); background: #fff; }
.stem-play-area { padding: clamp(20px,5vw,38px); border-top: 1px solid var(--line); background: #fafbff; }
.game-toolbar { margin-bottom: 18px; padding: 11px 15px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--muted); border-radius: 14px; background: #fff; border: 1px solid var(--line); }
.game-toolbar strong { color: var(--ink); }
#gravity-canvas { width: 100%; height: auto; display: block; border-radius: 18px; background: #dff3ff; border: 3px solid #b8dceb; }
.stem-controls { margin: 18px 0; display: grid; gap: 14px; }
.two-controls { grid-template-columns: 1fr 1fr; }
.stem-controls label { padding: 13px; border-radius: 14px; background: #fff; font-weight: 800; }
.stem-controls input { width: 100%; accent-color: #7758e8; }
.science-note { margin: 16px 0 0; padding: 13px 15px; color: #526077; border-radius: 13px; background: #edf1f8; line-height: 1.5; }
.circuit-board { min-height: 230px; padding: 24px; display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; gap: 15px; border-radius: 20px; background: #202943; }
.battery { padding: 13px; color: #fff; border-radius: 12px; background: #ef6c63; text-align: center; font-weight: 900; }.battery span { margin: 0 5px; }
.circuit-branches { display: grid; gap: 38px; position: relative; }
.circuit-branches::before, .circuit-branches::after { content: ""; width: 4px; position: absolute; top: 22px; bottom: 22px; background: #71809d; }
.circuit-branches::before { left: 0; } .circuit-branches::after { right: 0; }
.wire-path { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; }
.wire { height: 5px; background: #71809d; }
.circuit-switch { width: 46px; height: 46px; padding: 0 !important; color: #fff !important; border: 3px solid #8795b0 !important; border-radius: 50% !important; background: #35415e !important; box-shadow: none !important; }
.circuit-switch.closed { border-color: #74f1d5 !important; background: #16a77d !important; box-shadow: 0 0 15px rgba(116,241,213,.6) !important; }
.bulb { font-size: 3.5rem; filter: grayscale(1) brightness(.6); transition: .2s; }.bulb.on { filter: none; text-shadow: 0 0 28px #ffd45f; transform: scale(1.08); }
.circuit-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 9px; }
.rover-grid { width: min(420px,100%); margin: auto; display: grid; grid-template-columns: repeat(5,1fr); gap: 5px; padding: 8px; border-radius: 18px; background: #263150; }
.rover-cell { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; background: #e7eff8; font-size: clamp(1.2rem,5vw,2rem); }
.rover-cell.rock { background: #7d8ba0; }.rover-cell.goal { background: #fff2a9; box-shadow: inset 0 0 0 3px #e5bf34; }.rover-cell.rover { background: #c9f5e8; }
.command-deck { margin: 16px 0 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.command-deck button { color: #fff; background: #247fc5; border: 0; border-radius: 12px; padding: 10px 13px; cursor: pointer; font-weight: 800; }
.command-queue { min-height: 46px; padding: 12px; border-radius: 12px; background: #edf1f8; text-align: center; }
.molecule-formula { margin: 18px auto; color: #087154; font: 800 clamp(3rem,10vw,6rem) "Baloo 2",sans-serif; text-align: center; }
.atom-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.atom-button, .built-atom { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; font-weight: 900; }
.atom-button { color: #fff; border: 0; background: #16a77d; cursor: pointer; }.atom-button:nth-child(even){ background:#247fc5; }
.molecule-workbench { min-height: 100px; margin-top: 16px; padding: 20px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; color: var(--muted); border: 2px dashed #b8c5d6; border-radius: 18px; }
.built-atom { color: #fff; background: #7758e8; box-shadow: 0 6px 12px rgba(0,0,0,.13); }
.reactor-core {
  width: 170px; height: 170px; margin: 24px auto 14px; display: grid; place-items: center; color: #fff;
  border: 12px solid #323c62; border-radius: 50%; background: radial-gradient(circle,#f06aa7,#7758e8 65%);
  box-shadow: 0 0 0 12px #e7eafb, 0 0 35px rgba(119,88,232,.5); font: 800 4.5rem "Baloo 2",sans-serif;
}
.reactor-question { text-align: center; color: var(--muted); }
.prime-actions { display: flex; justify-content: center; gap: 10px; }.prime-actions button { min-width: 130px; padding: 13px; color: #fff; border: 0; border-radius: 14px; background: #c24f89; cursor: pointer; font-weight: 900; }.prime-actions button:last-child{background:#7758e8;}
.stem-finale { margin-top: 35px; padding: 30px; display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 26px; background: rgba(255,255,255,.07); }
.stem-finale > span { font-size: 4rem; }.stem-finale h2 { margin: 0 0 4px; }.stem-finale p { margin: 0; color: #b7c1d8; line-height: 1.6; }
body[data-page="stem-games"] .site-footer { color: #9ba7bf; border-color: rgba(255,255,255,.12); }
@media(max-width:760px){.stem-hero{grid-template-columns:1fr}.stem-hero-machine{height:280px}.machine-screen{height:135px}.two-controls{grid-template-columns:1fr}.circuit-board{grid-template-columns:62px 1fr 62px;padding:15px}.battery{padding:9px}.bulb{font-size:2.6rem}.wire-path{grid-template-columns:45px 1fr 45px}}
@media(max-width:520px){.stem-stats{grid-template-columns:1fr}.stem-stats div+div{padding-top:10px;border-top:1px solid rgba(255,255,255,.1)}.game-intro{padding:22px}.stem-play-area{padding:17px}.stem-finale{grid-template-columns:1fr}.prime-actions{flex-direction:column}.prime-actions button{width:100%}}
.battle-promo {
  margin: 22px 0;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  color: #fff;
  border: 1px solid rgba(116,241,213,.35);
  border-radius: 24px;
  background: radial-gradient(circle at 90% 10%,rgba(255,212,95,.2),transparent 18rem),linear-gradient(135deg,#374d96,#151d3b);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.battle-promo>span { font-size: 3.2rem; }
.battle-promo small { color: #74f1d5; font-weight: 900; text-transform: uppercase; }
.battle-promo h2 { margin: 3px 0; font-size: 2rem; }
.battle-promo p { margin: 0; color: #c8d2ec; }
.battle-promo>strong { color: #ffd45f; white-space: nowrap; }
@media(max-width:620px){.battle-promo{grid-template-columns:auto 1fr}.battle-promo>strong{grid-column:1/-1}}
