:root {
  --bg: #0f0f17;
  --bg2: #1b1030;
  --panel: #17171f;
  --panel-border: #2a2a38;
  --text: #f4f4f6;
  --muted: #9ca3af;
  --accent: #a78bfa;
  --accent2: #f472b6;
  --good: #37d67a;
  --mid: #ffb020;
  --bad: #ff4d4d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, #241546 0%, var(--bg) 55%);
  display: flex;
  flex-direction: column;
}

#app {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 24px;
  flex: 1;
}

.hero { text-align: center; margin-bottom: 28px; }

h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.05;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.grad {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub { color: var(--muted); font-size: 1.05rem; margin: 0 auto; max-width: 34rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

textarea, input {
  width: 100%;
  background: #0e0e15;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

textarea:focus, input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.row { display: flex; align-items: center; gap: 12px; }
.row input { flex: 1; }
.counter { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

.turnstile { min-height: 65px; }

.cta {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  color: #12121a;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: transform 0.06s ease, filter 0.15s ease;
}
.cta:hover { filter: brightness(1.07); }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: 0.6; cursor: not-allowed; }

.error { color: var(--bad); margin: 0; font-size: 0.95rem; }

/* ---------- result ---------- */
.result { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }

.card {
  background: linear-gradient(160deg, #171326, #0f0f17);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 26px;
}

.card-top { color: var(--accent); font-weight: 700; font-size: 0.95rem; margin-bottom: 14px; }

.burn {
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 18px;
}

.score-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  padding: 14px 0;
  margin-bottom: 18px;
}
.score-row span:first-child { color: var(--muted); }
.score { font-size: 2.6rem; font-weight: 900; }
.score.good { color: var(--good); }
.score.mid { color: var(--mid); }
.score.bad { color: var(--bad); }

.roast { font-size: 1.1rem; line-height: 1.5; margin: 0 0 18px; }

.critiques { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 8px; }
.critiques li { line-height: 1.45; }

.for { color: var(--muted); font-size: 0.9rem; margin: 16px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions button, .actions .btn {
  flex: 1;
  min-width: 140px;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.actions button:hover, .actions .btn:hover { border-color: var(--accent); }

.foot { text-align: center; color: var(--muted); padding: 24px; font-size: 0.9rem; }
.foot a { color: var(--accent); }

.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
