:root {
  color-scheme: dark;
  --bg: #090d18;
  --panel: #111827;
  --panel-2: #151e30;
  --line: #263348;
  --text: #f3f6fc;
  --muted: #9cabc0;
  --cyan: #6be9e3;
  --violet: #ae91ff;
  --amber: #ffcb83;
  font-family: "DM Sans", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -10%, #15314a 0, transparent 34rem),
    radial-gradient(circle at 100% 40%, #24193c 0, transparent 24rem),
    var(--bg);
  color: var(--text);
}
button { font: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}
a { color: inherit; }
.wrap { width: min(100% - 32px, 1100px); margin-inline: auto; }
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-block: 22px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: "Space Grotesk", sans-serif; font-weight: 700; letter-spacing: -.04em; font-size: 1.13rem; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid #68e7e08a; border-radius: 10px; color: var(--cyan);
  background: #6be9e312; box-shadow: 0 0 18px #6be9e325;
}
.header-right { display: flex; align-items: center; gap: 14px; }
.live { display: inline-flex; align-items: center; gap: 7px; color: #b1c4cf; font-size: .72rem; font-weight: 700; letter-spacing: .12em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.share-button, .subtle-button {
  border: 1px solid #33435a; color: #d8e4f1; background: #172234;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: .78rem; font-weight: 700;
}
.share-button:hover, .subtle-button:hover { border-color: var(--cyan); }
.hero { text-align: center; padding: 44px 0 31px; }
.eyebrow { color: var(--cyan); font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Space Grotesk", sans-serif; }
h1 { max-width: 800px; margin: 13px auto 12px; font-size: clamp(2.55rem, 8vw, 5rem); letter-spacing: -.065em; line-height: 1.05; }
.hero p { max-width: 600px; margin: auto; color: var(--muted); font-size: clamp(.95rem, 2vw, 1.1rem); line-height: 1.65; }
.gradient-text { background: linear-gradient(90deg, var(--cyan), #9cacf9 55%, var(--violet)); color: transparent; background-clip: text; }
.card {
  border: 1px solid var(--line); border-radius: 22px;
  background: linear-gradient(145deg, #141e2d, #0e1523);
  box-shadow: 0 18px 60px #0000002b;
}
.lab { overflow: hidden; }
.lab-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 21px 22px 0; }
.section-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .76rem; color: #c4d3e2; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
.section-label::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 12px #6be9e399; }
.lab-id { color: #728399; font-size: .68rem; letter-spacing: .12em; font-weight: 700; }
.apparatus {
  position: relative; min-height: 290px; display: grid; grid-template-columns: 1fr 1fr;
  align-items: center; padding: 16px 18px 8px; isolation: isolate;
}
.apparatus::before {
  content: ""; position: absolute; inset: 13% 13%; z-index: -1;
  background-image: linear-gradient(#7b91aa0b 1px, transparent 1px), linear-gradient(90deg, #7b91aa0b 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse, black 25%, transparent 75%);
}
.connection {
  position: absolute; top: 43%; left: 23%; width: 54%; height: 2px; z-index: -1;
  background: linear-gradient(90deg, var(--cyan), #8b9ffc, var(--violet));
  opacity: .65; box-shadow: 0 0 20px #8b9ffc;
}
.connection::after {
  content: ""; display: block; width: 100%; height: 100%;
  background: repeating-linear-gradient(90deg, transparent 0 12px, #e5ffff 12px 17px, transparent 17px 30px);
  opacity: .75; animation: flow 2s linear infinite;
}
.particle-station { text-align: center; min-width: 0; }
.particle-caption { font-size: .69rem; color: #8c9fb4; text-transform: uppercase; font-weight: 700; letter-spacing: .15em; }
.particle-shell {
  position: relative; display: grid; place-items: center;
  width: clamp(118px, 32vw, 180px); height: clamp(118px, 32vw, 180px);
  margin: 12px auto;
  border: 1px solid #34485c; border-radius: 50%;
  background: radial-gradient(circle, #21354a55 0 28%, #18243555 29% 47%, transparent 48%);
}
.particle-shell::before, .particle-shell::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid #6388a342; }
.particle-shell::before { inset: 13px; }
.particle-shell::after { inset: 28px; border-style: dashed; }
.particle-shell.violet { border-color: #564274; background: radial-gradient(circle, #392a5355 0 28%, #251b3a55 29% 47%, transparent 48%); }
.particle-shell.violet::before, .particle-shell.violet::after { border-color: #a28ad049; }
.particle-core {
  position: relative; z-index: 1; display: grid; place-items: center; width: 51px; height: 51px;
  border-radius: 50%; font-family: "Space Grotesk", sans-serif; font-size: 1.5rem; font-weight: 700;
  color: #09121e; background: var(--cyan); box-shadow: 0 0 14px var(--cyan), 0 0 50px #6be9e38c;
  transition: transform .3s ease;
}
.violet .particle-core { background: var(--violet); box-shadow: 0 0 14px var(--violet), 0 0 50px #ae91ff8c; }
.measuring .particle-core { animation: pulse .5s ease-in-out infinite alternate; }
.particle-name { margin: 0 0 4px; font-size: 1rem; font-weight: 700; }
.particle-outcome { min-height: 23px; color: var(--muted); font-size: .8rem; }
.particle-outcome strong { color: var(--text); }
.center-badge {
  position: absolute; left: 50%; top: 43%; transform: translate(-50%, -50%);
  padding: 7px 10px; border: 1px solid #526376; border-radius: 7px;
  background: #101a2a; color: #ccdaea; font-size: .65rem; font-weight: 700;
  letter-spacing: .12em; white-space: nowrap;
}
.controls { display: grid; gap: 18px; padding: 20px 22px 24px; border-top: 1px solid var(--line); background: #101929; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.control-label { display: block; margin-bottom: 9px; color: #b7c9da; font-size: .77rem; font-weight: 700; }
.angle-options { display: flex; gap: 5px; padding: 4px; border: 1px solid #2b3b50; border-radius: 11px; background: #0b1320; }
.angle-options button {
  flex: 1; min-width: 0; border: 0; border-radius: 7px; background: transparent;
  color: #8ea2b8; padding: 9px 3px; cursor: pointer; font-size: .8rem; font-weight: 700;
}
.angle-options button[aria-pressed="true"] { color: #09202c; background: var(--cyan); box-shadow: 0 2px 12px #6be9e348; }
.angle-options.violet button[aria-pressed="true"] { background: var(--violet); color: #1a1130; box-shadow: 0 2px 12px #ae91ff48; }
.measure-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.measure-button {
  min-height: 51px; border: 0; border-radius: 12px; cursor: pointer;
  color: #071a23; background: linear-gradient(100deg, #74eee3, #9ecce9);
  font-weight: 800; box-shadow: 0 8px 24px #6be9e329;
}
.measure-button:hover:not(:disabled) { filter: brightness(1.08); }
.measure-button:disabled { cursor: wait; opacity: .7; }
.ghost-button { border: 0; padding: 8px; background: transparent; color: #a6b8ca; cursor: pointer; font-size: .77rem; font-weight: 700; }
.ghost-button:hover { color: white; }
.result-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-top: 1px solid var(--line); background: #0d1523;
}
.result-title { color: #91a4b8; font-size: .7rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 700; }
.result-main { margin-top: 4px; font-family: "Space Grotesk", sans-serif; font-size: .88rem; font-weight: 700; }
.result-main.opposite { color: var(--cyan); }
.result-main.same { color: var(--amber); }
.stat-pill { border: 1px solid #34475a; border-radius: 9px; padding: 8px 10px; color: #c1d2df; white-space: nowrap; font-size: .73rem; }
.stat-pill strong { color: white; }
.below-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-top: 18px; }
.info-card { padding: 23px; }
.card-kicker { color: var(--cyan); font-size: .69rem; text-transform: uppercase; letter-spacing: .17em; font-weight: 700; }
.info-card h2 { margin: 8px 0 8px; font-size: 1.35rem; letter-spacing: -.04em; }
.info-card p { color: var(--muted); font-size: .83rem; line-height: 1.62; }
.probability { margin: 21px 0 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.probability span { color: #aabed0; font-size: .78rem; }
.probability strong { color: var(--cyan); font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; }
.meter { height: 10px; overflow: hidden; border: 1px solid #354a5b; border-radius: 99px; background: #192737; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #61dcd8, #aa92ff); transition: width .4s ease; }
.meter-scale { display: flex; justify-content: space-between; margin-top: 8px; color: #7f93a9; font-size: .69rem; }
.formula { margin-top: 19px; padding: 12px 13px; border: 1px solid #30405a; border-radius: 11px; background: #111d2e; color: #c3d2e4; font-size: .75rem; line-height: 1.55; }
.formula strong { color: white; }
.coin-pair { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 21px 0; }
.coin { display: grid; place-items: center; width: 62px; height: 62px; border: 3px double #d8ad70; border-radius: 50%; color: #fff0d5; background: linear-gradient(145deg, #8d633c, #4a3026); box-shadow: inset 0 0 0 4px #e4b47733, 0 6px 19px #0005; font-family: "Space Grotesk", sans-serif; font-weight: 700; }
.coin-arrow { color: #987c72; font-size: 1.2rem; }
.coin-note { padding: 11px 12px; border-radius: 10px; background: #ffffff08; color: #c8bcb5; font-size: .75rem; line-height: 1.5; }
.bottom-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; margin-top: 18px; }
.history-list { display: flex; flex-wrap: wrap; gap: 7px; min-height: 32px; margin-top: 17px; }
.history-chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid #345460; border-radius: 7px; background: #143039; color: #a9f3e8; font-size: .7rem; font-weight: 700; }
.history-chip.same { border-color: #5d4d43; background: #322923; color: #ffd1a0; }
.empty { color: #8196ab; font-size: .78rem; }
.glossary { display: grid; gap: 8px; margin-top: 15px; }
.glossary details { border: 1px solid #2a394d; border-radius: 10px; background: #101b2a; }
.glossary summary { cursor: pointer; list-style: none; padding: 10px 12px; color: #e2edf8; font-size: .78rem; font-weight: 700; }
.glossary summary::-webkit-details-marker { display: none; }
.glossary summary::after { content: "+"; float: right; color: var(--cyan); }
.glossary details[open] summary::after { content: "−"; }
.glossary details p { margin: 0; padding: 0 12px 12px; }
.footnote { max-width: 760px; margin: 22px auto 0; color: #8598ae; text-align: center; font-size: .72rem; line-height: 1.6; }
footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding: 22px 0 max(24px, env(safe-area-inset-bottom)); border-top: 1px solid #263348; color: #7f92a8; font-size: .72rem; }
footer a { text-decoration: none; color: #a8c4d1; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border: 1px solid #46737d; border-radius: 10px; background: #17303c; box-shadow: 0 12px 28px #0008; color: white; font-size: .78rem; }
@keyframes pulse { to { transform: scale(1.2); filter: brightness(1.4); } }
@keyframes flow { to { transform: translateX(30px); } }
@media (max-width: 700px) {
  .hero { padding: 28px 0 27px; }
  .below-grid, .bottom-grid { grid-template-columns: 1fr; }
  .apparatus { min-height: 245px; }
  .lab-top { padding-inline: 16px; }
  .controls { padding-inline: 16px; }
  .result-strip { padding-inline: 16px; }
}
@media (max-width: 390px) {
  .wrap { width: min(100% - 24px, 1100px); }
  .live { display: none; }
  .apparatus { padding-inline: 8px; }
  .particle-shell { width: 116px; height: 116px; }
  .particle-core { width: 45px; height: 45px; }
  .control-grid { gap: 9px; }
  .angle-options button { font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}