/* ==========================================================================
   Resume Roast AI
   ========================================================================== */

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  --ink-0: #07061a;
  --ink-1: #120b31;
  --ink-2: #1c1147;
  --violet: #a879ff;
  --violet-hot: #7b3dff;
  --cyan: #43e6ff;
  --heat: #ff5c8a;
  --text: #f2eeff;
  --muted: #a69fca;
  --faint: #6f6898;
  --line: rgba(196, 176, 255, 0.14);
  --glass: rgba(26, 17, 64, 0.42);
  --glass-strong: rgba(30, 20, 72, 0.62);

  --gauge-a: var(--violet);
  --gauge-b: var(--cyan);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, sans-serif;
  --font-serif: 'Newsreader', ui-serif, Georgia, serif;

  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--ink-0);
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.55;
  font-variation-settings: 'opsz' 14;
  background: radial-gradient(120% 90% at 50% -10%, var(--ink-2) 0%, var(--ink-1) 42%, var(--ink-0) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* ---------- Background ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}

.blob-a {
  width: 46vmax;
  height: 46vmax;
  left: -14vmax;
  top: -10vmax;
  background: radial-gradient(circle, var(--violet-hot), transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.blob-b {
  width: 38vmax;
  height: 38vmax;
  right: -12vmax;
  top: 18vh;
  background: radial-gradient(circle, rgba(67, 230, 255, 0.55), transparent 65%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.blob-c {
  width: 34vmax;
  height: 34vmax;
  left: 20vw;
  bottom: -18vmax;
  background: radial-gradient(circle, rgba(255, 92, 138, 0.35), transparent 65%);
  animation: drift-c 38s ease-in-out infinite alternate;
}

/* Heat builds while the AI is working */
body[data-state='loading'] .blob-c {
  opacity: 0.8;
  transition: opacity 1.2s ease;
}

@keyframes drift-a {
  to { transform: translate(12vw, 10vh) scale(1.12); }
}
@keyframes drift-b {
  to { transform: translate(-14vw, 16vh) scale(0.9); }
}
@keyframes drift-c {
  to { transform: translate(-10vw, -12vh) scale(1.15); }
}

#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grain {
  position: absolute;
  inset: -50%;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Layout ---------- */

.topbar {
  width: min(760px, 100% - 40px);
  margin: 0 auto;
  padding: 24px 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 26px;
  height: 26px;
  fill: var(--violet);
  filter: drop-shadow(0 0 10px rgba(168, 121, 255, 0.7));
}

.stage {
  width: min(760px, 100% - 40px);
  margin: 0 auto;
  padding: clamp(40px, 9vh, 96px) 0 72px;
}

.view {
  animation: view-in 0.7s var(--ease-out) both;
}

.view.is-leaving {
  animation: view-out 0.32s ease-in both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes view-out {
  to { opacity: 0; transform: translateY(-12px); filter: blur(6px); }
}

/* ---------- Hero ---------- */

.headline {
  margin: 0;
  font-size: clamp(3rem, 11vw, 6.4rem);
  line-height: 0.92;
  font-weight: 800;
  font-variation-settings: 'opsz' 96, 'wdth' 78;
  letter-spacing: -0.035em;
  background: linear-gradient(100deg, #f2eeff 0%, var(--violet) 32%, var(--cyan) 58%, var(--violet) 82%, #f2eeff 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: sheen 9s linear infinite;
  filter: drop-shadow(0 0 28px rgba(140, 90, 255, 0.35));
}

.headline span {
  display: block;
}

@keyframes sheen {
  to { background-position: -220% 0; }
}

.lede {
  max-width: 34em;
  margin: 26px 0 36px;
  color: var(--muted);
  font-size: clamp(1.02rem, 2.3vw, 1.15rem);
}

/* ---------- Glass panel ---------- */

.panel {
  position: relative;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 30px 80px -30px rgba(5, 2, 20, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: box-shadow 0.4s ease;
}

/* Animated glowing border: a rotating conic gradient masked to a 1.5px ring */
.panel::before {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--angle), transparent 0deg, var(--violet) 70deg, var(--cyan) 140deg, transparent 210deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: spin 4s linear infinite;
  pointer-events: none;
}

.panel:focus-within::before,
body[data-state='loading'] .panel::before {
  opacity: 1;
}

.panel:focus-within {
  box-shadow: 0 30px 80px -30px rgba(5, 2, 20, 0.9), 0 0 60px -12px rgba(140, 90, 255, 0.45);
}

body[data-state='loading'] .panel::before {
  animation-duration: 1.4s;
}

@keyframes spin {
  to { --angle: 360deg; }
}

.field {
  position: relative;
  margin: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(8, 5, 26, 0.5);
}

#resume {
  display: block;
  width: 100%;
  min-height: clamp(240px, 34vh, 340px);
  padding: 16px 18px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.65;
  font-variation-settings: 'opsz' 14;
  color: var(--text);
  caret-color: var(--cyan);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

textarea::placeholder,
input::placeholder {
  color: var(--faint);
  font-style: italic;
}

#resume:focus-visible {
  outline: none;
}


/* ---------- Target role + job description ---------- */

.target {
  display: grid;
  gap: 18px;
  padding: 16px 14px 22px;
}

.target-field {
  display: grid;
  gap: 8px;
}

.field-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--text);
}

.field-hint {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--faint);
}

.input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(8, 5, 26, 0.5);
  color: var(--text);
  outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.input:hover {
  border-color: rgba(196, 176, 255, 0.26);
}

.input:focus {
  border-color: rgba(168, 121, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(168, 121, 255, 0.18);
  background: rgba(10, 6, 32, 0.7);
}

.input-role {
  height: 52px;
  padding: 0 18px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
}

.input-jd {
  display: block;
  min-height: 120px;
  max-height: 320px;
  padding: 14px 18px;
  resize: vertical;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.6;
}

/* ---------- Resume header + mode switch ---------- */

.resume-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 16px 14px 10px;
  border-top: 1px solid var(--line);
}

.modes {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 5, 26, 0.45);
}

.mode {
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.mode:hover {
  color: var(--text);
}

.mode[aria-pressed='true'] {
  color: var(--ink-0);
  background: linear-gradient(120deg, var(--violet), var(--cyan));
}

.mode:disabled {
  cursor: default;
}

/* ---------- Dropzone ---------- */

.dropzone {
  display: grid;
  min-height: clamp(240px, 34vh, 340px);
  padding: 14px;
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.drop-inner {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  width: 100%;
  border-radius: 14px;
  border: 1.5px dashed rgba(196, 176, 255, 0.28);
  background: none;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.drop-inner:hover,
.field.is-dragging .drop-inner {
  border-color: var(--cyan);
  background: rgba(67, 230, 255, 0.06);
}

.drop-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(67, 230, 255, 0.5));
  transition: transform 0.3s var(--ease-out);
}

.drop-inner:hover .drop-icon,
.field.is-dragging .drop-icon {
  transform: translateY(-4px);
}

.drop-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.drop-hint {
  color: var(--faint);
  font-size: 0.875rem;
}

.file-card {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(168, 121, 255, 0.35);
  background: rgba(26, 17, 64, 0.55);
  animation: view-in 0.45s var(--ease-out) both;
}

.file-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 64px;
  height: 80px;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(168, 121, 255, 0.35), rgba(67, 230, 255, 0.2));
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.file-size {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Result: target, keywords, language ---------- */

.result-title {
  min-width: 0;
}

.target-line {
  margin: 14px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.target-line span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 0.8125rem;
  font-weight: 400;
}

.extra {
  margin-top: 32px;
  opacity: 0;
  transform: translateY(14px);
}

.extra.is-in {
  animation: fix-in 0.6s var(--ease-out) forwards;
  animation-delay: var(--delay, 0ms);
}

.extra h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.extra-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(67, 230, 255, 0.35);
  background: rgba(67, 230, 255, 0.07);
  color: #bff6ff;
  font-size: 0.9rem;
  font-weight: 500;
}

.lang-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.lang-list li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 8px 14px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: rgba(10, 6, 30, 0.45);
  border: 1px solid var(--line);
}

.lang-type {
  justify-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffc2d3;
  background: rgba(255, 92, 138, 0.12);
}

.lang-type[data-type='grammar'] {
  color: #dcc8ff;
  background: rgba(168, 121, 255, 0.16);
}

.lang-type[data-type='punctuation'] {
  color: #bff6ff;
  background: rgba(67, 230, 255, 0.12);
}

.lang-change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--font-serif);
  font-size: 1.02rem;
}

.lang-from {
  color: #ff9ab6;
  text-decoration: line-through;
  text-decoration-color: rgba(255, 92, 138, 0.7);
}

.lang-arrow {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lang-to {
  color: #9ff0ff;
}

.lang-clean {
  margin: 12px 0 0;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(67, 230, 255, 0.3);
  background: rgba(67, 230, 255, 0.06);
  color: #bff6ff;
  font-size: 0.95rem;
}

/* ---------- Scanner (loading) ---------- */

.scanner {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background:
    repeating-linear-gradient(0deg, rgba(67, 230, 255, 0.05) 0 1px, transparent 1px 4px);
}

.beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 90px;
  background: linear-gradient(180deg, transparent 0%, rgba(67, 230, 255, 0.0) 10%, rgba(67, 230, 255, 0.22) 88%, rgba(160, 245, 255, 0.95) 99%, transparent 100%);
  box-shadow: 0 1px 18px 2px rgba(67, 230, 255, 0.55);
  transform: translateY(-100%);
}

body[data-state='loading'] .scanner {
  opacity: 1;
}

body[data-state='loading'] .beam {
  animation: scan 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

body[data-state='loading'] #resume,
body[data-state='loading'] .dropzone,
body[data-state='loading'] .target {
  opacity: 0.55;
  filter: saturate(0.4);
}

@keyframes scan {
  from { top: 0; transform: translateY(-100%); }
  to { top: 100%; transform: translateY(0); }
}

/* ---------- Panel footer ---------- */

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 6px 4px 16px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  color: var(--faint);
  font-size: 0.875rem;
}

.count {
  font-variant-numeric: tabular-nums;
}

.count.is-short {
  color: var(--muted);
}

.link {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: underline;
  text-decoration-color: rgba(168, 121, 255, 0.5);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--text);
}

.link:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--violet-hot), #9a5bff 45%, #3fc9ff);
  box-shadow: 0 10px 30px -10px rgba(123, 61, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 16px 44px -10px rgba(123, 61, 255, 0.95), 0 0 34px -4px rgba(67, 230, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  box-shadow: none;
}

body[data-state='loading'] #roast-btn {
  opacity: 1;
  cursor: progress;
  background-size: 200% 100%;
  animation: btn-shift 1.2s linear infinite;
}

@keyframes btn-shift {
  from { background-position: 0 0; }
  to { background-position: -200% 0; }
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 26px -6px rgba(168, 121, 255, 0.55);
}

/* ---------- Status + error ---------- */

.status {
  display: none;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--cyan);
  font-size: 0.95rem;
}

body[data-state='loading'] .status {
  display: flex;
}

body[data-state='loading'] .meta {
  display: none;
}

#status-text {
  transition: opacity 0.25s ease;
}

#status-text.is-swapping {
  opacity: 0;
}

.pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  animation: ping 1.4s ease-out infinite;
}

@keyframes ping {
  to { transform: scale(3.2); opacity: 0; }
}

.error {
  margin: 10px 6px 4px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: rgba(255, 92, 138, 0.1);
  border: 1px solid rgba(255, 92, 138, 0.35);
  color: #ffc2d3;
  font-size: 0.95rem;
  animation: view-in 0.4s var(--ease-out) both;
}

.fineprint {
  margin: 18px 4px 0;
  color: var(--faint);
  font-size: 0.8125rem;
}

/* ---------- Result card ---------- */

.result-card {
  position: relative;
  padding: clamp(24px, 5vw, 44px);
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 60% at 100% 0%, rgba(67, 230, 255, 0.12), transparent 60%),
    radial-gradient(80% 70% at 0% 100%, rgba(123, 61, 255, 0.2), transparent 60%),
    var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 40px 100px -40px rgba(3, 1, 14, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.result-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-brand h2 {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1;
  font-weight: 800;
  font-variation-settings: 'opsz' 96, 'wdth' 80;
  letter-spacing: -0.03em;
}

.result-brand .brand-mark {
  width: 34px;
  height: 34px;
}

/* Gauge */

.gauge {
  position: relative;
  flex: none;
  width: clamp(124px, 26vw, 156px);
  aspect-ratio: 1;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.gauge circle {
  fill: none;
}

.gauge-track {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 9;
}

.gauge-ticks {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 3;
  stroke-dasharray: 1 5.91;
}

.gauge-fill {
  stroke: url(#gauge-grad);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  filter: drop-shadow(0 0 7px var(--gauge-b));
}

.gauge-readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.gauge-num {
  font-size: clamp(2.3rem, 7vw, 2.9rem);
  line-height: 1;
  font-weight: 750;
  font-variation-settings: 'opsz' 72, 'wdth' 85;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.gauge-cap {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.result-card[data-tier='low'] { --gauge-a: #ff8a5c; --gauge-b: var(--heat); }
.result-card[data-tier='mid'] { --gauge-a: var(--violet-hot); --gauge-b: var(--violet); }
.result-card[data-tier='high'] { --gauge-a: var(--violet); --gauge-b: var(--cyan); }

.verdict {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  opacity: 0;
  transition: opacity 0.5s ease 0.9s;
}

.verdict.is-in {
  opacity: 1;
}

/* Roast */

.roast {
  position: relative;
  margin: 30px 0 0;
  padding: 0 0 0 22px;
  border-left: 2px solid;
  border-image: linear-gradient(180deg, var(--gauge-a), var(--gauge-b)) 1;
  min-height: 7.5em;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.2rem, 3.1vw, 1.45rem);
  line-height: 1.5;
  font-variation-settings: 'opsz' 36;
  color: #f7f4ff;
}

.roast-line {
  display: inline;
}

.roast .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Fixes */

.fixes {
  margin-top: 36px;
}

.fixes h3 {
  opacity: 0;
  transition: opacity 0.4s ease;
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.fix-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: fix;
}

.fix {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: rgba(10, 6, 30, 0.45);
  border: 1px solid var(--line);
  counter-increment: fix;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

.fix.is-in {
  animation: fix-in 0.6s var(--ease-out) forwards;
  animation-delay: var(--delay, 0ms);
}

@keyframes fix-in {
  to { opacity: 1; transform: none; }
}

.fixes.is-in h3 {
  opacity: 1;
}

.fix:hover {
  border-color: rgba(168, 121, 255, 0.4);
  background: rgba(20, 12, 50, 0.55);
}

.fix::before {
  content: counter(fix);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-weight: 750;
  font-size: 0.95rem;
  color: var(--ink-0);
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  box-shadow: 0 0 16px -2px rgba(168, 121, 255, 0.7);
}

.fix-title {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
}

.fix-detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.result-foot {
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8125rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .stage {
    width: calc(100% - 28px);
  }

  .panel {
    padding: 6px;
  }

  #resume {
    padding: 18px;
    font-size: 1rem;
  }

  .target {
    padding: 14px 10px 18px;
  }

  .resume-head {
    padding: 14px 10px 10px;
  }

  .field {
    margin: 0 10px;
  }

  .modes {
    width: 100%;
  }

  .mode {
    flex: 1;
  }

  .lang-list li {
    grid-template-columns: 1fr;
  }

  .panel-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 12px 4px 4px;
  }

  .panel-foot .btn {
    width: 100%;
  }

  .meta,
  .status {
    justify-content: space-between;
    padding: 0 8px;
  }

  body[data-state='loading'] .status {
    justify-content: center;
  }

  .result-head {
    align-items: center;
    gap: 12px;
  }

  .result-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .gauge {
    width: 112px;
  }

  .fix {
    padding: 16px;
    gap: 4px 12px;
  }

  .actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  body[data-state='loading'] .beam {
    top: 50%;
    transform: none;
  }

  .fix,
  .fixes h3,
  .extra {
    opacity: 1;
    transform: none;
  }
}

#result-title:focus {
  outline: none;
}
