:root {
  color-scheme: dark;
  --bg: #111318;
  --fg: #e8e6e1;
  --muted: #8b8f9a;
  --accent: #f2c744;
  --accent-fg: #111318;
  --border: #2a2d35;
  --card-bg: #171922;
  --input-bg: #0a0b0e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* --- Intro --- */

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.intro img {
  border-radius: 1rem;
  margin-bottom: 0.25rem;
}

h1 {
  font-size: 1.3rem;
  margin: 0;
  line-height: 1.3;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}

p.tagline {
  color: var(--muted);
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --- Cards --- */

.card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscribe-card {
  background: transparent;
  border-style: dashed;
}

/* --- Rating pyramid: 4-5-6 on top, 1-2-3 / 7-8-9 below --- */
/* No scrolling needed. The bottom row (6 buttons + a spacer) is the tight
   constraint on narrow phones -- flex-shrink (not fixed widths) so buttons
   shrink together and guarantee a fit down to a ~2rem floor, rather than
   hand-computed breakpoints that could overflow on a given device width.
   2.8rem is the ideal/max size (reached on wider screens); the floor still
   comfortably fits a 320px-wide viewport (checked against this page's
   existing main/.card padding). */

.rating-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.pyramid-row {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
}

.pyramid-row button {
  flex: 0 1 2.8rem;
  aspect-ratio: 1;
  min-width: 2rem;
  max-width: 2.8rem;
  height: auto;
  padding: 0;
  border-radius: 50%;
  font-size: 1.05rem;
  font-weight: 700;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.pyramid-spacer {
  flex: 0 1 1.1rem;
  min-width: 0.6rem;
  max-width: 1.1rem;
}

.pyramid-row button.selected {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  transform: scale(1.08);
}

.scale-hint {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

/* --- Note field --- */

.field-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.field-label .optional {
  font-weight: 400;
}

#log-note,
#label-input {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.65rem 0.75rem;
}

#log-note {
  resize: vertical;
}

/* --- Buttons --- */

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 0.85rem 1.25rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button[hidden] {
  display: none;
}

/* --- Status text --- */

#status,
#log-status {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* --- Subscription debug details --- */

details#subscription-details summary {
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

pre#subscription-output {
  width: 100%;
  max-height: 40vh;
  overflow: auto;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.75rem;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 0.5rem;
}
