/* What's Next? — capture screen (mobile-first) */

:root {
  --bg: #111214;
  --surface: #1c1e22;
  --surface-hover: #25282d;
  --text: #f2f3f5;
  --text-muted: #a3a8b0;
  --accent: #ff8a3d;
  --accent-hover: #ff9d5c;
  --accent-text: #1a1007;
  --border: #2e3137;
  --focus: #7cc4ff;
  --listening: #d93a3a;
  --listening-glow: rgba(217, 58, 58, 0.55);
  --radius: 16px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f4;
    --surface: #ffffff;
    --surface-hover: #ececea;
    --text: #15171a;
    --text-muted: #5b6068;
    --accent: #e8690f;
    --accent-hover: #d15c08;
    --accent-text: #ffffff;
    --border: #d9dad6;
    --focus: #1a6fd1;
  }
}

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

html,
body {
  margin: 0;
  height: 100%;
}

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

button,
textarea,
label {
  font: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.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;
}

/* Layout */

.capture {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding:
    max(24px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  gap: 24px;
}

.capture__header {
  text-align: center;
}

.app-name {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.capture__primary {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

/* TELL ME — dominates the screen */

.tell-me {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48vh;
  min-height: 48dvh;
  padding: 24px;
  border: 0;
  border-radius: 28px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, transform 0.1s;
}

.tell-me:hover {
  background: var(--accent-hover);
}

.tell-me:active {
  transform: scale(0.98);
}

.tell-me__icon {
  font-size: 4.5rem;
  line-height: 1;
}

.tell-me__label {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.tell-me__hint {
  font-size: 1.0625rem;
  font-weight: 700;
}

.tell-me__hint:empty {
  display: none;
}

/* Listening state */

.tell-me.is-listening {
  background: var(--listening);
  color: #fff;
  animation: listening-pulse 1.6s ease-in-out infinite;
}

@keyframes listening-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--listening-glow); }
  50% { box-shadow: 0 0 0 14px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .tell-me.is-listening {
    animation: none;
  }
}

/* Secondary actions */

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

.secondary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.secondary-btn:hover {
  background: var(--surface-hover);
}

/* The file input is visually hidden, so show focus on its label */
.capture__secondary:has(#photo-input:focus-visible) label.secondary-btn {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Typed idea */

.type-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.type-form[hidden] {
  display: none;
}

.type-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.0625rem; /* ≥16px prevents iOS zoom on focus */
  resize: vertical;
}

.save-btn {
  min-height: 52px;
  border: 0;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  cursor: pointer;
}

.photo-preview {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: center;
}

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: center;
}

/* Footer */

.capture__footer {
  text-align: center;
}

.idea-box-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.idea-box-note strong {
  color: var(--text);
}

.link-btn {
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 16px;
  border: 0;
  background: none;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Idea Box */

.idea-box {
  margin-top: 8px;
  text-align: left;
}

.idea-box__empty {
  margin: 0;
  color: var(--text-muted);
  text-align: center;
}

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

.idea {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.idea__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.idea__time {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.idea__sync {
  display: inline-block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: italic;
}

.idea-box__sync-note {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* Sign-in */

.auth {
  margin-top: 4px;
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  margin: 8px auto 0;
  text-align: left;
}

.auth__form[hidden] {
  display: none;
}

.auth__label {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.auth__input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem; /* ≥16px prevents iOS zoom on focus */
}

.auth__who,
.auth__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.auth__who strong {
  color: var(--text);
}

.auth__note {
  margin-top: 4px;
  font-size: 0.8125rem;
}

.auth__status {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth__status:empty {
  display: none;
}

.prototype-note {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  opacity: 0.8;
}

/* Desktop: same single-purpose screen, just more breathing room */

@media (min-width: 768px) {
  .capture {
    justify-content: center;
    padding-top: 48px;
    padding-bottom: 48px;
    gap: 32px;
  }

  .app-name {
    font-size: 2.5rem;
  }

  .tagline {
    font-size: 1.125rem;
  }

  .capture__primary {
    flex: 0 0 auto;
  }

  .tell-me {
    min-height: 320px;
  }
}
