:root {
  --ink: #2b2b2b;
  --muted: #9a9a9a;
  --line: #e2e2e2;
  --paper: #ffffff;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
}

#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

#states {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: calc(100vw - 32px);
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

#states button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

#states button:hover { color: var(--ink); }

#states button.active {
  background: var(--ink);
  color: var(--paper);
}

#states button span {
  opacity: 0.5;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

#hint {
  position: fixed;
  left: 20px;
  bottom: 20px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  user-select: none;
}

.pagelink {
  position: fixed;
  left: 20px;
  top: 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.pagelink:hover { color: var(--ink); }

#toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translate(-50%, -8px);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* lil-gui light theme */
.lil-gui {
  --background-color: rgba(255, 255, 255, 0.92);
  --text-color: #444;
  --title-background-color: #f4f4f4;
  --title-text-color: #222;
  --widget-color: #f0f0f0;
  --hover-color: #e8e8e8;
  --focus-color: #dcdcdc;
  --number-color: #2b2b2b;
  --string-color: #2b2b2b;
  --font-size: 11px;
  --input-font-size: 11px;
  --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --padding: 5px;
  --spacing: 5px;
  --widget-height: 20px;
  --name-width: 46%;
  --slider-knob-width: 2px;
  --slider-input-width: 30%;
  --scrollbar-width: 4px;
  --widget-border-radius: 3px;
  --checkbox-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.lil-gui.root { top: 16px; right: 16px; }
.lil-gui.root > .title { letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }
.lil-gui .title { font-weight: 500; }

/* panel: scroll when taller than the screen */
.lil-gui.root { max-height: calc(100vh - 32px); }
.lil-gui.root > .children { overflow-y: auto; max-height: calc(100vh - 72px); }

/* mobile */
@media (max-width: 640px) {
  .lil-gui.root {
    top: 8px;
    right: 8px;
    width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px);
  }
  .lil-gui.root > .children { max-height: calc(70vh - 40px); }
  #hint { display: none; }
  #states {
    bottom: 12px;
    padding: 4px;
    gap: 2px;
  }
  #states button {
    padding: 8px 9px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  #states button span { display: none; }
  .pagelink { top: 46px; left: 12px; } /* below the collapsed panel bar */
}
