:root {
  --bg: #0b0b0c;
  --fg: #f2f2f2;
  --muted: rgba(242,242,242,0.65);
  --line: rgba(242,242,242,0.12);
  --accent: #b24a32;
  --link: #ff6b3d;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
}

/* Subtle grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 18px calc(110px + env(safe-area-inset-bottom));
}

.top {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 22px;
}

h1 { font-size: 22px; margin: 0; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.status { color: var(--muted); font-size: 13px; letter-spacing: 1px; }

.stage {
  display: grid;
  justify-items: center;
}

.orange {
  width: 100%;
  max-width: 520px;
  display: block;
}

/* --- Orange Structure --- */

.orange-fill{
  fill: rgba(178, 74, 50, 0.05);
}

.orange-ring{
  fill: none;
  stroke: rgba(178, 74, 50, 0.22);
  stroke-width: 1.2;
  shape-rendering: geometricPrecision;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.wedge {
  fill: rgba(242, 242, 242, 0.03);
  stroke: rgba(242, 242, 242, 0.10);
  stroke-width: 1;
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease;
}

.wedge:hover {
  fill: rgba(242, 242, 242, 0.06);
}

.wedge.active {
  fill: rgba(178, 74, 50, 0.10);
  stroke: rgba(178, 74, 50, 0.28);
}

.orange-center {
  fill: rgba(178, 74, 50, 0.18);
  stroke: var(--accent);
  stroke-width: 1.2;
  cursor: pointer;
}

.stateReadout {
  margin: 8px 0 4px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
}

.controlStrip {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 10px;
}

button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(242,242,242,0.03);
  color: var(--fg);
  cursor: pointer;
}

button:disabled { opacity: 0.5; }

.primary {
  background: rgba(242,242,242,0.06);
  font-weight: 600;
}

.hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.foot {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.small { font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.spec {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(178, 74, 50, 0.65);
}

.spec .la5{
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.spec .la5:hover{
  color: #ff845f;
  text-shadow: 0 0 10px rgba(255, 107, 61, 0.18);
  text-decoration: underline;
}
/* Status readout lives by the buttons now */
.controlStrip .status{
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 6px 0 2px;
}

/* Subtle blink */
.controlStrip .status.loading{
  color: var(--accent);
  animation: statusPulse 1.15s ease-in-out infinite;
}

/* Terminal dots after the text */
.controlStrip .status.loading::after{
  content: "";
  display: inline-block;
  width: 1.5em;              /* reserves space so layout doesn’t shift */
  margin-left: 0.25em;
  text-align: left;
  animation: statusDots 1.1s steps(4, end) infinite;
  opacity: 0.9;
}

@keyframes statusPulse{
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

@keyframes statusDots{
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}

/* ===== START GATE OVERLAY ===== */

.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.90);
  backdrop-filter: blur(2px);
  z-index: 50;
}

.overlay.hidden{
  display: none;
}

.panel{
  width: min(420px, calc(100% - 40px));
  border: 1px solid rgba(242,242,242,0.14);
  border-radius: 14px;
  background: rgba(12,12,13,0.88);
  box-shadow: 0 18px 60px rgba(0,0,0,0.42);
  padding: 22px 18px;
  text-align: center;
}

.title{
  font-size: 14px;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.msg{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}


.primary{
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(242,242,242,0.08);
}

.ghost{
  padding: 4px 8px;
  font-size: 10px;
  letter-spacing: 0.06em;
  opacity: 0.5;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(242,242,242,0.02);
}

.ghost:hover{
  opacity: 0.75;
  background: rgba(255,255,255,0.05);
}


.controlFooter{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0.10));
  pointer-events: none;
}

.controlFooter > *{
  pointer-events: auto;
}

#playPauseMount{
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.terminalBack{
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px;
  background: rgba(242,242,242,0.03);
  color: rgba(236,232,225,0.65);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terminalBack:hover{
  color: rgba(236,232,225,0.85);
  background: rgba(255,255,255,0.05);
}
