/* varianz-sim.css — OSEG "Varianz-Simulator" widget for guide pages.
   Pick a volatility band + spin count → a Monte-Carlo balance chart shows
   how the same theoretical RTP (~96 %) rides completely differently.
   Educational, Spielgeld-only.

   All colours flow through the site tokens (tokens.css) with fallbacks, so
   the widget inherits light/dark automatically ([data-theme="dark"]) and
   still renders standalone. Band identity: Niedrig = Grün (--primary),
   Mittel = Gold (--star), Hoch = Violett (--accent).

   Mobile-first, 44px touch targets, prefers-reduced-motion supported (the
   JS renders the finished chart instantly; this file additionally kills
   all motion). */

/* ---------- design tokens (local aliases onto site tokens) ---------- */

.vsim {
  --vs-surface: var(--surface, #FFFDF9);
  --vs-chartbg: var(--hero, #F9EFDD);
  --vs-line: var(--line, #E4DDD3);
  --vs-ink: var(--ink, #2E241D);
  --vs-muted: var(--sub, #6B6157);
  --vs-primary: var(--primary, #00945E);
  --vs-on-primary: var(--on-primary, #ffffff);
  --vs-accent: var(--accent, #8A5FC9);
  --vs-gold: var(--star, #D89529);

  --vs-font-display: var(--font-display, 'Sora', system-ui, sans-serif);
  --vs-radius: var(--radius, 1rem);
  --vs-radius-m: var(--radius-m, 0.75rem);
  --vs-radius-s: var(--radius-s, 0.5rem);
}

/* ---------- card ---------- */

.vsim {
  color: var(--vs-ink);
  line-height: 1.5;
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  padding: var(--s-20, 1.25rem) var(--s-16, 1rem);
}

@media (min-width: 640px) {
  .vsim {
    padding: var(--s-24, 1.5rem);
  }
}

.vsim *,
.vsim *::before,
.vsim *::after {
  box-sizing: border-box;
}

.vs-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-8, 0.5rem) var(--s-16, 1rem);
  margin-bottom: var(--s-8, 0.5rem);
}

.vs-title {
  margin: 0;
  font-family: var(--vs-font-display);
  font-weight: 800;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  letter-spacing: 0.02em;
  color: var(--vs-ink);
}

.vs-note {
  margin: 0;
  padding: var(--s-4, 0.25rem) var(--s-12, 0.75rem);
  font-size: var(--fs-12, 0.75rem);
  font-weight: 600;
  color: var(--vs-gold);
  background: color-mix(in srgb, var(--vs-gold) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--vs-gold) 40%, transparent);
  border-radius: 999px;
  white-space: nowrap;
}

/* graceful degrade where color-mix is unsupported */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .vs-note {
    background: rgba(216, 149, 41, 0.12);
    border-color: rgba(216, 149, 41, 0.4);
  }
}

.vs-intro {
  margin: 0 0 var(--s-16, 1rem);
  font-size: var(--fs-14, 0.875rem);
  color: var(--vs-muted);
  max-width: 62ch;
}

/* ---------- controls ---------- */

.vs-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-12, 0.75rem) var(--s-24, 1.5rem);
  margin-bottom: var(--s-12, 0.75rem);
}

.vs-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.vs-legend {
  padding: 0;
  margin-bottom: var(--s-4, 0.25rem);
  font-size: var(--fs-12, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--vs-muted);
}

.vs-seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: 999px;
  overflow: hidden;
}

.vs-segbtn {
  min-height: 44px;
  padding: var(--s-8, 0.5rem) var(--s-16, 1rem);
  font-family: inherit;
  font-size: var(--fs-14, 0.875rem);
  font-weight: 600;
  color: var(--vs-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.vs-segbtn + .vs-segbtn {
  border-left: 1px solid var(--vs-line);
}

.vs-segbtn:hover {
  background: var(--vs-chartbg);
}

.vs-segbtn:focus-visible {
  outline: 2px solid var(--vs-accent);
  outline-offset: -3px;
  border-radius: 999px;
}

.vs-segbtn[aria-pressed="true"] {
  background: var(--vs-accent);
  color: #ffffff;
}

/* ---------- fixed stakes + run button ---------- */

.vs-metarow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8, 0.5rem) var(--s-16, 1rem);
  margin-bottom: var(--s-16, 1rem);
}

.vs-fixed {
  margin: 0;
  font-size: var(--fs-14, 0.875rem);
  color: var(--vs-muted);
}

.vs-fixed strong {
  color: var(--vs-ink);
}

.vs-run {
  min-height: 44px;
  padding: var(--s-8, 0.5rem) var(--s-28, 1.75rem);
  font-family: var(--vs-font-display);
  font-size: var(--fs-14, 0.875rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--vs-on-primary);
  background: var(--vs-primary);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.vs-run:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.vs-run:active {
  transform: none;
}

.vs-run:focus-visible {
  outline: 2px solid var(--vs-accent);
  outline-offset: 2px;
}

/* ---------- chart ---------- */

.vs-chartwrap {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: var(--s-8, 0.5rem);
  background: var(--vs-chartbg);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius-m);
  overflow: hidden;
}

.vs-placeholder {
  margin: 0;
  padding: var(--s-16, 1rem);
  font-size: var(--fs-14, 0.875rem);
  color: var(--vs-muted);
  text-align: center;
}

.vs-svg {
  display: block;
  width: 100%;
  height: auto;
}

.vs-grid {
  stroke: var(--vs-line);
  stroke-width: 1;
}

.vs-ref {
  stroke: var(--vs-muted);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.8;
}

.vs-ticklab,
.vs-axlab,
.vs-reflab {
  fill: var(--vs-muted);
  font-family: inherit;
  font-size: 11px;
}

.vs-axlab,
.vs-reflab {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.vs-line-path {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.vs-area {
  opacity: 0;
  fill-opacity: 0.1;
  stroke: none;
  transition: opacity 0.5s ease 0.45s;
}

.vs-area.is-in {
  opacity: 1;
}

/* ---------- stat chips ---------- */

.vs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s-8, 0.5rem);
  margin-top: var(--s-12, 0.75rem);
}

.vs-stats[hidden] {
  display: none;
}

.vs-stat {
  display: grid;
  gap: var(--s-2, 0.125rem);
  padding: var(--s-8, 0.5rem) var(--s-16, 1rem);
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius-m);
}

.vs-stat-value {
  font-family: var(--vs-font-display);
  font-weight: 800;
  font-size: var(--fs-20, 1.25rem);
  color: var(--vs-ink);
}

.vs-stat-label {
  font-size: var(--fs-12, 0.75rem);
  color: var(--vs-muted);
}

/* ---------- notes below the chart ---------- */

.vs-busted {
  margin: var(--s-8, 0.5rem) 0 0;
  padding: var(--s-8, 0.5rem) var(--s-12, 0.75rem);
  font-size: var(--fs-13, 0.8125rem);
  font-weight: 600;
  color: var(--vs-ink);
  background: var(--vs-chartbg);
  border: 1px dashed var(--vs-line);
  border-radius: var(--vs-radius-s);
}

.vs-busted[hidden] {
  display: none;
}

.vs-caption {
  margin: var(--s-16, 1rem) 0 0;
  font-size: var(--fs-14, 0.875rem);
  color: var(--vs-muted);
}

.vs-disclaimer {
  margin: var(--s-8, 0.5rem) 0 0;
  padding-top: var(--s-8, 0.5rem);
  border-top: 1px solid var(--vs-line);
  font-size: var(--fs-12, 0.75rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--vs-muted);
}

/* ---------- reduced motion: kill everything that moves ---------- */

@media (prefers-reduced-motion: reduce) {
  .vsim *,
  .vsim *::before,
  .vsim *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Stats grid — desktop-first phone steps aligned with the site breakpoints */
@media (max-width: 47.9375rem) {
  .vs-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 28.75rem) {
  .vs-stats { grid-template-columns: minmax(0, 1fr); }
}
