/*
  Design notes:
  - System font stack only (no webfont download) - keeps first load tiny on
    slow connections / entry-level phones, and matches the OS's own
    accessibility text-size settings automatically.
  - Buttons are oversized (min 84px tall) - bigger than the usual 44px
    minimum, because the primary users are locating controls by touch/sound,
    not by looking.
  - Color tokens pulled from the EchoesVision logo:
      --bg          #0a0e27  (deep navy, matches app icon background)
      --surface     #131a3a  (card surface)
      --accent      #29c2ff  (the logo's cyan-blue)
      --accent-2    #0f7fd6  (deeper blue, gradients / pressed states)
      --text        #f5f7fa
      --text-dim    #a7b0d1
      --danger      #ff6b6b
      --success     #35d68f
  - Signature motif: a soft radiating "sound wave" pulse (echoing the logo's
    eye + sound-wave mark) plays while the app is listening/analyzing. It's
    pure CSS, costs nothing on slow networks, and is skipped entirely under
    prefers-reduced-motion.
*/

:root {
  --bg: #0a0e27;
  --surface: #131a3a;
  --surface-2: #1b2454;
  --accent: #29c2ff;
  --accent-2: #0f7fd6;
  --text: #f5f7fa;
  --text-dim: #a7b0d1;
  --danger: #ff6b6b;
  --success: #35d68f;
  --focus-ring: #ffe066;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: 0.2px;
}

.brand .tagline {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
}

.icon-btn {
  background: var(--surface);
  border: 2px solid transparent;
  color: var(--text);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Visual "eye" stage: shows a live camera preview when active, and a resting
   glyph plus pulse rings while idle/analyzing. */
.stage {
  position: relative;
  background: radial-gradient(circle at 50% 35%, var(--surface-2), var(--surface) 70%);
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stage.idle video {
  opacity: 0;
}

.pulse-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pulse-rings span {
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
}

.stage.busy .pulse-rings span {
  animation: pulse 1.8s ease-out infinite;
}

.stage.busy .pulse-rings span:nth-child(2) { animation-delay: 0.5s; }
.stage.busy .pulse-rings span:nth-child(3) { animation-delay: 1s; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stage.busy .pulse-rings span { animation: none; opacity: 0.35; }
}

.stage-center-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  z-index: 1;
}

/* Status + output */
.status-line {
  min-height: 24px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
}

.output-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 20px;
  min-height: 84px;
}

.output-card.placeholder {
  color: var(--text-dim);
  font-style: italic;
}

/* Big primary controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

button.big {
  font-size: 21px;
  font-weight: 700;
  padding: 22px 20px;
  min-height: 84px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  text-align: left;
  width: 100%;
}

button.big .emoji {
  font-size: 30px;
  flex-shrink: 0;
}

button.big.secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--surface-2);
}

button.big:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.row-2 button.big {
  font-size: 18px;
  padding: 18px 14px;
}

/* Settings panel */
details.settings {
  background: var(--surface);
  border-radius: 16px;
  padding: 4px 18px;
}

details.settings > summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 600;
  list-style: none;
}

details.settings > summary::-webkit-details-marker {
  display: none;
}

.settings-body {
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.field label {
  font-size: 15px;
  color: var(--text-dim);
}

.field input[type="range"] {
  width: 100%;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid #2b366c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}

footer.note {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: auto;
}

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