:root {
  --bg: #0a0a0f;
  --card: #15151f;
  --border: rgba(255, 255, 255, 0.08);
  --fg: #fafafa;
  --muted: #a1a1aa;
  --primary: #3b82f6;
  --destructive: #ef4444;
  --success: hsl(160 60% 45%);
  --radius: 0.5rem;
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.wordmark span {
  color: var(--primary);
}

h1 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
}

h1:focus {
  outline: none;
}

.sub {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.note {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -12px 0 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

/* Per-score scale: outline colour (--box) plus a legible ink for the filled
   state. Green (9-10) -> yellow (8) -> amber (7) -> red deepening to the
   darkest red at 1. Ink is white on the dark reds, near-black on the light
   ones so the number stays readable when the box fills on tap. */
.grid button[data-score="1"]  { --box: #7f1d1d; --ink: #ffffff; }
.grid button[data-score="2"]  { --box: #991b1b; --ink: #ffffff; }
.grid button[data-score="3"]  { --box: #b91c1c; --ink: #ffffff; }
.grid button[data-score="4"]  { --box: #dc2626; --ink: #ffffff; }
.grid button[data-score="5"]  { --box: #ef4444; --ink: #ffffff; }
.grid button[data-score="6"]  { --box: #f87171; --ink: #0a0a0f; }
.grid button[data-score="7"]  { --box: #f59e0b; --ink: #0a0a0f; }
.grid button[data-score="8"]  { --box: #eab308; --ink: #0a0a0f; }
.grid button[data-score="9"]  { --box: #22c55e; --ink: #0a0a0f; }
.grid button[data-score="10"] { --box: #16a34a; --ink: #0a0a0f; }

.grid button {
  min-height: 56px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--box, var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.grid button:hover {
  background: var(--box, var(--primary));
  color: var(--ink, #fff);
}

.grid button:focus-visible,
.btn:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.grid button.selected {
  background: var(--box, var(--primary));
  border-color: var(--box, var(--primary));
  color: var(--ink, #fff);
}

.grid button:disabled {
  cursor: default;
  opacity: 0.6;
}

.grid button.selected:disabled {
  opacity: 1;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 10px;
}

.hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

.error {
  color: var(--destructive);
  font-size: 0.9rem;
  margin-top: 16px;
}

.badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 20px;
  color: #fff;
}

.badge-success {
  background: var(--success);
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 15px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-alert {
  background: var(--destructive);
  color: #fff;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

textarea {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 8px;
}

textarea::placeholder {
  color: var(--muted);
}

.sig {
  color: var(--muted);
  font-size: 0.9rem;
  margin: -12px 0 20px;
}

@media (min-width: 640px) {
  .card {
    padding: 40px 36px;
  }

  .grid {
    grid-template-columns: repeat(10, 1fr);
  }

  .grid button {
    min-height: 48px;
    font-size: 1rem;
  }
}
