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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

#c {
  display: block;
  width: 100vw;
  height: 100vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#ui {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

#controls {
  display: flex;
  gap: 8px;
  pointer-events: all;
}

#info-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

#timer {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
}

#info {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.22);
  letter-spacing: 0.04em;
}

#biome-label {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.08em;
}

button {
  font-family: monospace;
  font-size: 11px;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

button:hover {
  border-color: rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.9);
}

button.active {
  border-color: rgba(255,80,80,0.7);
  color: rgba(255,80,80,0.9);
}

#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 100;
  transition: opacity 1.5s ease;
}

#start-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

#start-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

#start-title {
  font-family: monospace;
  font-size: 18px;
  font-weight: normal;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.2em;
}

#start-sub {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.1em;
}

#biome-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 620px;
}

.biome-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  width: 110px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  border-radius: 6px;
}

.biome-btn:hover {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.04);
}

.biome-icon {
  font-size: 22px;
  line-height: 1;
}

.biome-name {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
}

.biome-desc {
  font-family: monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.03em;
  text-align: center;
}

#btn-about-start {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  margin-top: 8px;
}

#btn-about-start:hover {
  border-color: rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.7);
}

#about-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.96);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
  transition: opacity 0.3s ease;
}

#about-overlay.hidden {
  display: none;
}

#about-inner {
  max-width: 720px;
  width: 100%;
  position: relative;
}

#btn-about-close {
  position: sticky;
  top: 0;
  float: right;
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 32px;
  transition: color 0.2s, border-color 0.2s;
}

#btn-about-close:hover {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.4);
}

#about-content {
  clear: both;
}

.about-section {
  margin-bottom: 48px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 32px;
}

.about-section:first-child {
  border-top: none;
  padding-top: 0;
}

.about-section h2 {
  font-family: monospace;
  font-size: 20px;
  font-weight: normal;
  color: rgba(255,255,255,0.8);
  letter-spacing: 0.15em;
  margin-bottom: 6px;
}

.about-section h3 {
  font-family: monospace;
  font-size: 11px;
  font-weight: normal;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.about-sub {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.05em;
}

.about-section p {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.8;
  margin-bottom: 20px;
  max-width: 600px;
}

.about-note {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  line-height: 1.8;
  font-style: italic;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

@media (max-width: 600px) {
  .about-grid { grid-template-columns: 1fr; }
}

.about-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about-label {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.about-text {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  line-height: 1.7;
}

.about-sound-states {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.sound-state {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.sound-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.sound-dot.dim   { background: rgba(255,255,255,0.15); }
.sound-dot.low   { background: rgba(255,255,255,0.35); }
.sound-dot.mid   { background: rgba(255,255,255,0.6); }
.sound-dot.full  { background: rgba(255,255,255,0.9); }
.sound-dot.eater { background: rgba(100,255,180,0.7); }

.sound-label {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.08em;
  min-width: 90px;
}

.sound-desc {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  line-height: 1.6;
}

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.about-tag {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 10px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

#github-link {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}

#github-link:hover {
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.5);
}

/* ── Rules section ──────────────────────────────── */

.rules-category {
  margin: 20px 0;
}

.rules-cat-label {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rules-list li {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  line-height: 1.7;
  padding-left: 12px;
  position: relative;
}

.rules-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: rgba(255,255,255,0.18);
}

/* ── Inspector ──────────────────────────────────── */

.inspector-hidden {
  display: none !important;
}

#inspector-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 300;
  background: rgba(0,0,0,0.88);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 200px;
}

.tt-type {
  font-family: monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tt-id {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.05em;
}

.tt-detail {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
}

.tt-bar {
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.tt-bar-fill {
  height: 100%;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  transition: width 0.1s;
}

.tt-bar-fill.dust {
  background: rgba(180,180,180,0.6);
}

#inspector-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  background: rgba(0,0,0,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  width: 240px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.panel-type {
  font-family: monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel-id {
  font-family: monospace;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  flex: 1;
}

.panel-close {
  font-family: monospace;
  font-size: 13px;
  color: rgba(255,255,255,0.3);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.panel-close:hover {
  color: rgba(255,255,255,0.8);
  border: none;
}

.panel-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-label {
  font-family: monospace;
  font-size: 9px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 72px;
}

.panel-value {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  gap: 5px;
}

.panel-value.val-bloom {
  color: rgba(180,255,180,0.8);
}

.panel-value.mono {
  letter-spacing: 0.06em;
}

.panel-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.panel-bar-fill {
  height: 100%;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  transition: width 0.3s;
}

.panel-bar-fill.eater {
  background: rgba(100,255,160,0.6);
}

.panel-note {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  line-height: 1.6;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 8px;
  margin-top: 2px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.swatch.dark {
  background: rgba(30,25,15,1);
}

/* ── Rules section ──────────────────────────────── */

.rules-category {
  margin: 20px 0;
}

.rules-cat-label {
  font-family: monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rules-list li {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  line-height: 1.7;
  padding-left: 12px;
  position: relative;
}

.rules-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: rgba(255,255,255,0.18);
}

#title {
  font-family: monospace;
  font-size: 12px;
  font-weight: normal;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.12em;
  margin-top: -16px;
}