/*
 * Shared frame for every simulation: stage, panel area, panels and in-canvas
 * labels. Simulations always render in the dark "sim world" (the same look in
 * both platform themes), so these values mirror daisyUI's `black` theme.
 * Simulations add only their own semantic colors.
 */

@font-face {
  font-family: "DM Sans";
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/dm-sans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "DM Mono";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/dm-mono-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "DM Mono";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/dm-mono-500-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --sim-bg: #000;
  --sim-panel: rgb(20 20 20 / 0.88);
  --sim-line: #262626;
  --sim-fg: #d6d6d6;
  --sim-strong: #fff;
  --sim-muted: rgb(214 214 214 / 0.8);
  --sim-radius: 0.5rem;
  --sim-font: "DM Sans", system-ui, sans-serif;
  --sim-mono: "DM Mono", ui-monospace, monospace;
  --sim-panel-height: 0px;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sim-bg);
  color: var(--sim-fg);
  font: 14px/1.45 var(--sim-font);
}

/* The 3D stage. The simulation mounts its canvas (and label layer) here. */
#sim-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#sim-stage canvas {
  display: block;
  touch-action: none;
}

/* Panel area. Desktop: cards stacked in the top-right corner of the stage.
   Phone: a strip under the stage, as tall as the shell says. */
#sim-panels {
  position: absolute;
  top: 12px;
  right: 12px;
  width: min(320px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#sim-panels[hidden] {
  display: none;
}
body[data-dock="bottom"] #sim-stage {
  bottom: var(--sim-panel-height);
}
body[data-dock="bottom"] #sim-panels {
  inset: auto 0 0 0;
  width: auto;
  height: var(--sim-panel-height);
  max-height: none;
  padding: 12px;
  border-top: 1px solid var(--sim-line);
  background: var(--sim-bg);
}

.sim-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--sim-line);
  border-radius: var(--sim-radius);
  background: var(--sim-panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sim-panel[hidden] {
  display: none;
}
body[data-dock="bottom"] .sim-panel {
  padding: 0;
  border: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sim-eyebrow {
  margin: 0;
  font-size: 12px;
  color: var(--sim-muted);
}
.sim-title {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.15;
  color: var(--sim-strong);
}
.sim-text {
  margin: 0;
  font-size: 13px;
}
.sim-note {
  margin: 0;
  font-size: 12px;
  color: var(--sim-muted);
}
.sim-mono {
  font-family: var(--sim-mono);
  font-variant-numeric: tabular-nums;
}
.sim-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--sim-muted);
}
.sim-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sim-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* In-canvas labels: small pill buttons on the parts. The label renderer gives
   each label its own z-index; z-index 0 keeps them in one stacking context,
   so they stay under the panels. */
.sim-labels {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sim-label {
  pointer-events: auto;
  cursor: pointer;
  padding: 4px 9px;
  border: 1px solid var(--sim-line);
  border-radius: 999px;
  background: rgb(10 10 10 / 0.85);
  color: var(--sim-fg);
  font: 500 12px/1 var(--sim-font);
  white-space: nowrap;
}
.sim-label:hover,
.sim-label:focus-visible {
  border-color: var(--sim-fg);
  outline: none;
}
.sim-label[aria-pressed="true"] {
  border-color: var(--sim-strong);
  background: var(--sim-strong);
  color: var(--sim-bg);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
