:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #d9dde4;
  --accent: #3b5bdb;
  --accent-text: #ffffff;
  --star: #f5a524;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1b1f27;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --border: #2d333e;
    --accent: #6d8bff;
  }
}

body.theme-spicy {
  --bg: linear-gradient(160deg, #2a0712, #5c0f25 60%, #8a1538);
  --card: rgba(30, 6, 14, 0.82);
  --text: #fde8ee;
  --muted: #e7a9bb;
  --border: #6b2238;
  --accent: #ff3d6e;
  --star: #ff6b3d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 2rem 1rem;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.card {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
}

h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.muted { color: var(--muted); margin-top: 0; }

.question {
  margin: 1.5rem 0 0;
  padding: 0;
  border: 0;
}

.question legend {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h2 {
  margin: 2.5rem 0 0;
  padding-bottom: 0.5rem;
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.hint {
  margin: -0.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

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

.scale input {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  opacity: 0.4;
}

.question.touched .scale input { opacity: 1; }

.question output {
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
  text-align: center;
}

input[type="text"], textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: transparent;
  color: inherit;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

input[type="text"]:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea { resize: vertical; }

.rating input, .choices input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.rating {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 0.25rem;
}

.rating label {
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.15s, filter 0.15s, transform 0.15s;
}

.rating input:checked ~ label,
.rating label:hover,
.rating label:hover ~ label {
  color: var(--star);
  opacity: 1;
  filter: none;
}

.rating label:hover { transform: scale(1.15); }
.rating input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 0.25rem; }

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choices label {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.choices input:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.choices input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

button {
  margin-top: 2rem;
  width: 100%;
  padding: 0.8rem;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 0.5rem;
  cursor: pointer;
}

button:disabled { opacity: 0.6; cursor: wait; }

.status { color: #e5484d; min-height: 1.5em; }
.hp { position: absolute; left: -9999px; }
.thanks { text-align: center; padding: 2rem 0; }

@media (max-width: 480px) {
  body { padding: 1rem; }
  .card { padding: 1.25rem; }
}

.admin { max-width: 56rem; }
.admin a { color: var(--accent); }

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.entry {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.entry summary { cursor: pointer; }
.entry summary .muted { font-size: 0.9rem; margin: 0; }
.entry h3 { margin: 1.5rem 0 0.5rem; font-size: 1rem; }

.entry-head {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  padding: 0.1rem 0.6rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 999px;
  font-size: 0.8rem;
}

.meta {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.answer {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.answer-label { font-weight: 600; font-size: 0.9rem; }
