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

[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: #0b0b0f;
  color: #f2f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- stage ---------- */

#stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
}

#preview, #playback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mirror { transform: scaleX(-1); }

#words {
  position: absolute;
  top: 12%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
  pointer-events: auto;
}

#words span {
  font-size: clamp(28px, 8vw, 56px);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
}

#rec-indicator {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 12px;
  border-radius: 999px;
}

#rec-indicator i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  animation: blink 1.1s infinite;
}

@keyframes blink { 50% { opacity: 0.25; } }

#hint, #status {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 15px;
  opacity: 0.85;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
  padding: 0 24px;
}

/* ---------- controls ---------- */

#controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px max(16px, env(safe-area-inset-right))
           calc(18px + env(safe-area-inset-bottom))
           max(16px, env(safe-area-inset-left));
  background: #0b0b0f;
}

#controls button {
  border: none;
  cursor: pointer;
  color: #f2f2f5;
  background: #1d1d26;
  font-size: 22px;
}

button.side {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex: none;
}

#btn-record {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid #f2f2f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

#btn-record i {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #ff3b30;
  transition: border-radius 0.15s, transform 0.15s;
}

#btn-record.recording i {
  border-radius: 8px;
  transform: scale(0.55);
}

#controls button.pill {
  flex: 1 1 0;
  min-width: 0;
  max-width: 150px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

#controls button.pill i {
  font-style: normal;
  font-size: 12px;
}

/* Narrow phones: 5 review buttons need every pixel. */
@media (max-width: 399px) {
  #controls button.pill i { display: none; }
}

@media (max-width: 359px) {
  #controls { gap: 8px; }
  button.side { width: 44px; height: 44px; }
  #controls button.pill {
    height: 44px;
    padding: 0 8px;
    font-size: 12px;
  }
}

#btn-reverse { background: #5e35b1; }
#btn-forward { background: #2e7d32; }

button:disabled { opacity: 0.4; }

/* ---------- start gate ---------- */

#gate {
  position: fixed;
  inset: 0;
  background: #0b0b0f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
  z-index: 20;
}

#gate h1 { font-size: 28px; }
#gate p { opacity: 0.7; line-height: 1.5; }

#gate-footer {
  position: absolute;
  bottom: calc(10px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  opacity: 0.22;
  letter-spacing: 0.03em;
}

#btn-start {
  margin-top: 10px;
  padding: 16px 36px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: #ff3b30;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

