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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f0f0f0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #222;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
}

.screen.active {
  display: block;
}

#screen-intro.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel {
  max-width: 400px;
  padding: 2rem 1.5rem;
  text-align: center;
}

.panel h1 {
  font-size: 1.85rem;
  margin-bottom: 0.75rem;
}

.lead {
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.muted {
  font-size: 0.88rem;
  color: #666;
  margin-bottom: 1.5rem;
}

.back, .back-play {
  color: #666;
  text-decoration: none;
  font-size: 0.88rem;
}

.back { display: inline-block; margin-bottom: 1.25rem; }
.back:hover, .back-play:hover { color: #333; }

.back-play {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  z-index: 10;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,0.75);
  border-radius: 6px;
}

button {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0.5rem auto 0;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #222;
  color: #fff;
}

button:hover { opacity: 0.88; }

.btn-secondary {
  background: transparent;
  color: #555;
  border: 1px solid #ccc;
  font-weight: 500;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #f0f0f0;
}

#hud {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 10;
  padding: 0.4rem 0.75rem;
  background: rgba(255,255,255,0.8);
  border-radius: 999px;
}

#btn-mic {
  width: auto;
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 1.1rem;
  background: #eee;
  border-radius: 50%;
  line-height: 1;
}

#btn-mic.off { opacity: 0.45; }
#btn-mic.on  { background: #4caf50; }

#level-bar {
  display: block;
  width: 80px;
  height: 8px;
  background: #ddd;
  border-radius: 4px;
  overflow: hidden;
}

#level-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: #4caf50;
  border-radius: 4px;
  transition: width 0.05s linear;
}

#level-label {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: #555;
  min-width: 2.2rem;
  text-align: right;
}
