/* Shared primitives for every simulation. Scene CSS lives in sims/<id>.css and must
   scope every selector under .sim-<id>. Never restyle these classes globally.
   No text-transform: uppercase anywhere (Turkish locale turns i into dotted capital I
   inside English terms). Write capitals by hand when you need them. */
.sim-root {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.35;
  isolation: isolate;
  container-type: size;
}
.sim-root *,
.sim-root *::before,
.sim-root *::after { box-sizing: border-box; }
.sim-root button,
.sim-root input,
.sim-root select { font: inherit; color: inherit; }

/* "Temsili canlandirma" tag. Every sim that invents data must show one. */
.sim-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--fg-mute);
}
.sim-tag::before {
  content: '';
  width: var(--px);
  height: var(--px);
  background: currentColor;
}

/* panels */
.sim-panel {
  background: color-mix(in srgb, var(--bg-raise) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
}
.sim-well {
  background: var(--bg-well);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* terminal window, the home surface of this video */
.sim-term {
  display: flex;
  flex-direction: column;
  background: #161513;
  color: #ece7da;
  border: 1px solid rgba(243, 239, 228, 0.16);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.7);
}
.sim-term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(243, 239, 228, 0.1);
  color: #8f897d;
  font-size: var(--step--1);
}
.sim-term-bar i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(243, 239, 228, 0.18);
}
.sim-term-body { flex: 1; min-height: 0; padding: 18px 22px; overflow: hidden; }
.sim-term .t-dim { color: #8f897d; }
.sim-term .t-clay { color: #d77757; }
.sim-term .t-gold { color: #e8b23a; }
.sim-term .t-ok { color: #8aa672; }
.sim-term .t-no { color: #d2553b; }
.sim-caret {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: -0.18em;
  background: currentColor;
  animation: sim-blink 1.05s steps(1) infinite;
}
@keyframes sim-blink { 50% { opacity: 0; } }

/* buttons */
.sim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.62em 1.05em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: var(--step-0);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s var(--ease-out), color 0.2s;
}
.sim-btn:hover:not(:disabled) { border-color: var(--fg); transform: translateY(-1px); }
.sim-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.sim-btn:disabled { opacity: 0.35; cursor: default; }
.sim-btn:focus-visible,
.sim-seg button:focus-visible,
.sim-range:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.sim-btn.is-clay { background: var(--clay); border-color: var(--clay); color: #1b1712; }
.sim-btn.is-gold { background: var(--gold); border-color: var(--gold); color: #1b1712; }
.sim-btn.is-ghost { border-color: transparent; color: var(--fg-soft); }

/* segmented control */
.sim-seg {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-well);
}
.sim-seg button {
  padding: 0.5em 1em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-soft);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s var(--ease-out), color 0.2s;
}
.sim-seg button[aria-pressed='true'] { background: var(--fg); color: var(--bg); }
.sim-seg.is-clay button[aria-pressed='true'] { background: var(--clay); color: #1b1712; }
.sim-seg.is-gold button[aria-pressed='true'] { background: var(--gold); color: #1b1712; }

/* range */
.sim-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: calc(var(--px) * 2);
  background: linear-gradient(to right, var(--range-fill, var(--gold)) var(--range-pct, 0%), var(--line-strong) var(--range-pct, 0%));
  border-radius: 0;
  cursor: pointer;
}
.sim-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(var(--px) * 5);
  height: calc(var(--px) * 5);
  background: var(--fg);
  border: calc(var(--px) * 0.75) solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg);
}
.sim-range::-moz-range-thumb {
  width: calc(var(--px) * 4);
  height: calc(var(--px) * 4);
  background: var(--fg);
  border: calc(var(--px) * 0.75) solid var(--bg);
  border-radius: 0;
}

/* labels, keys, chips, meters */
.sim-label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--fg-mute);
}
.sim-kbd {
  display: inline-block;
  padding: 0.12em 0.5em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-well);
}
.sim-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.28em 0.7em;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--fg-soft);
}
.sim-chip.is-allow { color: var(--allow); border-color: color-mix(in srgb, var(--allow) 50%, transparent); }
.sim-chip.is-ask { color: var(--ask); border-color: color-mix(in srgb, var(--ask) 50%, transparent); }
.sim-chip.is-deny { color: var(--deny); border-color: color-mix(in srgb, var(--deny) 50%, transparent); }
.sim-chip.is-clay { color: var(--clay); border-color: color-mix(in srgb, var(--clay) 50%, transparent); }

/* pixel meter: fills in whole quadrant blocks, never a smooth bar */
.sim-meter {
  --meter-pct: 0;
  --meter-color: var(--gold);
  height: calc(var(--px) * 3);
  background:
    linear-gradient(to right, var(--meter-color) calc(var(--meter-pct) * 1%), transparent 0),
    repeating-linear-gradient(to right, var(--line-strong) 0 calc(var(--px) * 2), transparent 0 calc(var(--px) * 3));
  -webkit-mask: repeating-linear-gradient(to right, #000 0 calc(var(--px) * 2), transparent 0 calc(var(--px) * 3));
  mask: repeating-linear-gradient(to right, #000 0 calc(var(--px) * 2), transparent 0 calc(var(--px) * 3));
}

.sim-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-3);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.sim-h {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-2);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
}

/* freeze decorative CSS animation when the presenter pauses motion */
.sim-root[data-sim-paused='true'] *,
.sim-root[data-sim-paused='true'] *::before,
.sim-root[data-sim-paused='true'] *::after { animation-play-state: paused !important; }

@media (prefers-reduced-motion: reduce) {
  .sim-caret { animation: none; }
}
