:root {
  --bg: #030509;
  --cyan: #4df3ff;
  --cyan-dim: #6fb9c4;
  --cyan-soft: rgba(77, 243, 255, 0.5);
  --text: #d9f4f7;
  --panel-bg: rgba(8, 16, 28, 0.55);
  --panel-border: rgba(77, 243, 255, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* Fixed, permanently-minimized sidebar — same spot and size whether stopped
   or driving, so it never moves around and stays out of the way of the
   starfield. */
main {
  position: fixed;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  z-index: 1;
  width: auto;
  max-width: 240px;
  text-align: left;
}

.hud-header h1 {
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--cyan);
  text-shadow: 0 0 18px var(--cyan-soft), 0 0 40px rgba(77, 243, 255, 0.25);
  margin: 0 0 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 170px;
  height: auto;
  margin: 0 auto 10px;
}

.subtitle,
.note {
  display: none;
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35), inset 0 0 30px rgba(77, 243, 255, 0.04);
}

.voice-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--cyan-dim);
  margin-bottom: 14px;
  text-align: left;
}

.voice-picker select {
  background: rgba(77, 243, 255, 0.07);
  border: 1px solid rgba(77, 243, 255, 0.35);
  border-radius: 10px;
  color: var(--cyan);
  padding: 10px 12px;
  font-size: 0.85rem;
  appearance: none;
  -webkit-appearance: none;
}

#startBtn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: radial-gradient(circle at 50% 40%, rgba(77, 243, 255, 0.18), rgba(77, 243, 255, 0.04));
  color: var(--cyan);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  font-weight: 600;
  box-shadow: 0 0 28px rgba(77, 243, 255, 0.4), inset 0 0 24px rgba(77, 243, 255, 0.18);
  transition: all 0.15s ease;
  margin: 0 auto;
  display: block;
}

#startBtn:active {
  transform: scale(0.96);
}

#startBtn.running {
  background: radial-gradient(circle at 50% 40%, rgba(77, 243, 255, 0.4), rgba(77, 243, 255, 0.1));
  box-shadow: 0 0 48px rgba(77, 243, 255, 0.7), inset 0 0 34px rgba(77, 243, 255, 0.35);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 48px rgba(77, 243, 255, 0.7), inset 0 0 34px rgba(77, 243, 255, 0.35); }
  50% { box-shadow: 0 0 64px rgba(77, 243, 255, 0.9), inset 0 0 44px rgba(77, 243, 255, 0.5); }
}

.status {
  font-size: 0.7rem;
  text-align: left;
}

.status .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(77, 243, 255, 0.12);
}

.status .row:last-child { border-bottom: none; }

.status .row span:first-child {
  color: var(--cyan-dim);
}

.status .row span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.controls {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.62rem;
  color: var(--cyan-dim);
  line-height: 1.3;
}

.controls input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

/* Minimize/restore tab — sits at the sidebar's right edge, stays visible even
   when the panel is fully hidden so the user can always bring it back. */
#panelToggle {
  position: fixed;
  top: 50%;
  left: 232px;
  transform: translateY(-50%);
  z-index: 2;
  width: 28px;
  height: 56px;
  border-radius: 0 10px 10px 0;
  border: 1px solid var(--panel-border);
  border-left: none;
  background: var(--panel-bg);
  color: var(--cyan);
  font-size: 1rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: left 0.3s ease;
}

body.panel-hidden main {
  display: none;
}

body.panel-hidden #panelToggle {
  left: 0;
  border-radius: 0 10px 10px 0;
}

/* Paywall — fail-closed: covers everything until verify-access confirms an
   active subscription, then body.unlocked hides it. */
#paywallOverlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 9, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: center;
  padding: 24px;
}

#paywallOverlay .paywall-card {
  max-width: 360px;
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 32px 28px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.paywall-logo {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin: 0 auto 16px;
}

#paywallOverlay h2 {
  color: var(--cyan);
  letter-spacing: 0.16em;
  font-size: 1.2rem;
  margin: 0 0 10px;
  text-shadow: 0 0 16px var(--cyan-soft);
}

#paywallOverlay p {
  color: var(--cyan-dim);
  font-size: 0.85rem;
  margin: 0 0 20px;
  line-height: 1.5;
}

#subscribeBtn {
  background: rgba(77, 243, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}

#subscribeBtn:disabled {
  opacity: 0.5;
  cursor: default;
}

#paywallStatus {
  margin-top: 14px;
  margin-bottom: 0;
  font-size: 0.75rem;
  min-height: 1em;
}

body.unlocked #paywallOverlay {
  display: none;
}

.link-btn {
  background: none;
  border: none;
  color: var(--cyan-dim);
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-top: 14px;
  display: block;
}

.link-btn:hover {
  color: var(--cyan);
}

#restoreForm {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#restoreForm input[type="email"] {
  flex: 1;
  min-width: 0;
  background: rgba(77, 243, 255, 0.07);
  border: 1px solid rgba(77, 243, 255, 0.35);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.85rem;
}

#restoreForm button {
  background: rgba(77, 243, 255, 0.15);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

#manageSubBtn {
  margin: 14px auto 0;
}
