/* Shared styles for the full-screen canvas simulators — xscript.net
   Pairs with /js/canvas-sim.js. Each page sets its colours on <html>:
     --sim-bg   letterbox colour behind the scene (the scene's own background)
     --accent   buttons, headings, links
   The scene itself is drawn by the page's own script on canvas#c. */

:root {
  --sim-bg: #05070c;
  --bg: #07090e;
  --panel: #0d1119;
  --line: #1c2431;
  --line-bright: #313d4f;
  --text: #e8eef5;
  --muted: #8894a6;
  --accent: #35d0ff;
  --amber: #ffb020;
  --font-data: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: var(--font-data);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}
button, input { font-family: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Stage ---------- */
.sim {
  height: 100vh;
  height: 100dvh;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--sim-bg);
  position: relative;            /* the shared video overlay covers this */
}
.sim:fullscreen { height: 100vh; width: 100vw; min-height: 0; }
.sim:-webkit-full-screen { height: 100vh; width: 100vw; min-height: 0; }

.sim-view {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--sim-bg);
}
.sim-view canvas { display: block; }

.sim-notice {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  z-index: 5;
}
.sim-notice p { max-width: 520px; line-height: 1.6; color: #c4ccd6; }
.sim-notice .sbtn { font-size: 0.8rem; padding: 9px 16px; }

/* ---------- Control bar ---------- */
.sim-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--panel);
  border-top: 2px solid var(--accent);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  z-index: 10;
}
.sim-name { color: var(--text); font-weight: 700; letter-spacing: 0.14em; }
.sim-tag {
  color: var(--amber);
  border: 1px dashed rgba(255, 176, 32, 0.6);
  padding: 2px 6px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.sim-seek { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; min-width: 120px; }
.sim-seek input[type="range"] {
  flex: 1 1 auto;
  min-width: 60px;
  height: 18px;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
}
.sim-time { color: var(--text); font-weight: 600; }
.sim-time small { color: var(--muted); font-weight: 400; font-size: 1em; }
.sim-btns { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.sbtn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-bright);
  padding: 5px 9px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.sbtn:hover, .sbtn:focus-visible { background: rgba(255, 255, 255, 0.08); border-color: var(--text); }
.sbtn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* Fullscreen: the bar floats over the scene and hides when the mouse is still */
.sim.is-fs .sim-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: rgba(8, 10, 16, 0.82);
  transition: opacity 0.4s;
}
.sim.is-fs.is-idle .sim-bar { opacity: 0; pointer-events: none; }
.sim.is-fs.is-idle { cursor: none; }

/* ---------- Reference content ---------- */
.tool-info {
  max-width: 900px;
  margin: 44px auto 40px;
  padding: 0 24px;
  color: #a3aeb8;
  line-height: 1.7;
  font-size: 0.92rem;
}
.tool-info h1 { color: var(--text); font-size: 1.3rem; letter-spacing: 0.03em; margin-bottom: 14px; line-height: 1.35; }
.tool-info h2 {
  color: var(--text);
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 32px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.tool-info h3 { color: var(--text); font-size: 0.94rem; margin: 22px 0 6px; }
.tool-info p { margin-bottom: 12px; }
.tool-info ul, .tool-info ol { margin: 0 0 12px 22px; }
.tool-info li { margin-bottom: 6px; }
.tool-info a { color: var(--accent); }
.tool-info strong { color: var(--text); }
.tool-info code { font-family: var(--font-data); font-size: 0.88em; color: var(--text); }
.tool-info kbd {
  font-family: var(--font-data);
  font-size: 0.8em;
  border: 1px solid var(--line-bright);
  border-bottom-width: 2px;
  padding: 0 5px;
  border-radius: 3px;
  color: var(--text);
}
.glossary { margin: 0 0 12px; }
.glossary dt { color: var(--text); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.84rem; margin-top: 16px; }
.glossary dd { margin: 4px 0 0; }

.table-wrap { overflow-x: auto; margin: 0 0 14px; }
.info-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 560px; }
.info-table th, .info-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.info-table th { color: var(--text); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; border-bottom-color: var(--line-bright); }
.info-table td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }

.site-foot {
  border-top: 1px solid var(--line-bright);
  background: var(--panel);
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
}
.site-foot-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-foot-links a { color: var(--text); text-decoration: none; }
.site-foot-links a:hover { text-decoration: underline; }
.site-foot-note { color: var(--muted); font-size: 0.72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sim-tag { display: none; }
}
@media (max-width: 820px), (max-height: 520px) and (orientation: portrait) {
  .sim { height: auto; min-height: 0; }
  .sim:fullscreen, .sim:-webkit-full-screen { height: 100vh; }
  .sim:not(.is-fs) .sim-view { flex: 0 0 auto; aspect-ratio: 16 / 9; }
  .sim-bar { flex-wrap: wrap; justify-content: center; white-space: normal; row-gap: 6px; }
  .sim-name { display: none; }
  .sim-seek { flex: 1 1 100%; order: -1; }
  .sim-btns { flex: 1 1 100%; flex-wrap: wrap; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .sbtn, .sim.is-fs .sim-bar { transition: none; }
}
