:root {
  color-scheme: light dark;
  --bg: #f7f7f8;
  --fg: #1a1a1e;
  --muted: #6b6b76;
  --card-bg: #ffffff;
  --border: #dcdce2;
  --accent: #3b5bfd;
  --love: #1f9d55;
  --okay: #b58900;
  --nope: #c0392b;
  --supplement: #6b46c1;
  --error: #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171c;
    --fg: #f0f0f3;
    --muted: #a2a2ad;
    --card-bg: #212129;
    --border: #33333d;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

.rater-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.screen {
  display: block;
}

#name-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

#name-input {
  flex: 1 1 200px;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
}

button {
  font: inherit;
  cursor: pointer;
}

#name-form button,
#retry-btn {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.error-message {
  color: var(--error);
}

.progress {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.clip-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}

.clip-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.clip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tag-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
}

#clip-audio {
  width: 100%;
  margin-bottom: 1rem;
}

.notes-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

#notes-input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  resize: vertical;
  margin-bottom: 1rem;
}

.rating-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.rate-btn {
  padding: 0.9rem 0.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.rate-love { background: var(--love); }
.rate-okay { background: var(--okay); }
.rate-nope { background: var(--nope); }
.rate-supplement { background: var(--supplement); }

.rate-btn:active {
  transform: scale(0.98);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  background: var(--error);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

@media (max-width: 420px) {
  .rate-btn {
    font-size: 0.9rem;
    padding: 0.8rem 0.4rem;
  }
}
