:root {
  --bg: #0d0b14;
  --card: #17131f;
  --card-2: #1f1a2b;
  --card-hover: #252035;
  --text: #f4f0ff;
  --muted: #b5acd0;
  --muted-dim: #7a7396;
  --accent: #ff5c8a;
  --accent-2: #ffb347;
  --accent-glow: rgba(255, 92, 138, 0.25);
  --good: #4ade80;
  --good-dim: rgba(74, 222, 128, 0.15);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.15);
  --bad: #fb5b5b;
  --bad-dim: rgba(251, 91, 91, 0.15);
  --border: #2c2540;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.45);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
}

::selection {
  background: rgba(255, 92, 138, 0.35);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: #3d3558;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica,
    Arial, sans-serif;
  background: radial-gradient(120% 120% at 50% -10%, #1a1426 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* ── Background ── */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.38;
  will-change: transform;
}

.blob-1 {
  width: 520px;
  height: 520px;
  background: #ff5c8a;
  top: -200px;
  right: -140px;
  animation: float1 18s ease-in-out infinite;
}

.blob-2 {
  width: 460px;
  height: 460px;
  background: #7c5cff;
  bottom: -180px;
  left: -140px;
  animation: float2 22s ease-in-out infinite;
}

.blob-3 {
  width: 320px;
  height: 320px;
  background: #ffb347;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.15;
  animation: float3 26s ease-in-out infinite;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 20%, transparent 75%);
}

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-30px, 25px) scale(1.05); }
  66% { transform: translate(20px, -15px) scale(0.97); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  40% { transform: translate(35px, -20px) scale(1.04); }
  70% { transform: translate(-20px, 30px) scale(0.96); }
}

@keyframes float3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-48%, -52%) scale(1.08); }
}

/* ── Layout ── */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 56px 20px 80px;
  overflow: visible;
}

/* ── Reveal animations ── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: revealIn 0.65s var(--ease-out) forwards;
}

.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.15s; }
.reveal-3 { animation-delay: 0.25s; }
.reveal-4 { animation-delay: 0.35s; }
.reveal-5 { animation-delay: 0.45s; }
.reveal-6 { animation-delay: 0.55s; }

@keyframes revealIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Hero ── */
.hero {
  text-align: center;
  overflow: visible;
}

.badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.14), rgba(255, 92, 138, 0.08));
  border: 1px solid rgba(255, 179, 71, 0.35);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(255, 179, 71, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(255, 179, 71, 0.15);
}

h1,
.hero-title {
  font-size: clamp(2.2rem, 6.5vw, 3.6rem);
  line-height: 1.08;
  margin: 0 0 16px;
  font-weight: 800;
  text-align: center;
}

.hero-title {
  --fat-scale: 1.7;
  --fat-dur: 0.4s;
  --fat-ease: cubic-bezier(0.34, 1.35, 0.64, 1);
  --fat-spread: calc(1.5em * (var(--fat-scale) - 1));
}

.hero-line {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.34em;
  max-width: 100%;
  white-space: nowrap;
}

.hero-before,
.hero-after {
  flex: 0 0 auto;
}

.fat-slot {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  position: relative;
  margin-inline: 0;
  transition: margin-inline var(--fat-dur) var(--fat-ease);
}

.fat-slot::before {
  content: "fett";
  grid-area: 1 / 1;
  visibility: hidden;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.fat {
  grid-area: 1 / 1;
  display: block;
  color: var(--accent);
  transform: scaleX(1);
  transform-origin: center center;
  transition: transform var(--fat-dur) var(--fat-ease);
}

@media (hover: hover) {
  .fat-slot:hover {
    margin-inline: var(--fat-spread);
  }

  .fat-slot:hover .fat {
    transform: scaleX(var(--fat-scale));
  }
}

.sub {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
  text-wrap: balance;
}

/* ── Search form ── */
.search {
  margin: 36px auto 0;
  max-width: 580px;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-pill:focus-within {
  border-color: rgba(255, 92, 138, 0.5);
  box-shadow: var(--shadow-card), 0 0 0 4px var(--accent-glow);
}

.search-icon {
  display: flex;
  color: var(--muted-dim);
  flex-shrink: 0;
  margin-right: 10px;
}

#url {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.05rem;
  font-family: inherit;
  padding: 12px 0;
  outline: none;
  min-width: 0;
}

#url::placeholder {
  color: var(--muted-dim);
}

#go {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #1a0e14;
  font-weight: 800;
  font-size: 1rem;
  font-family: inherit;
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

#go:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: scale(1.02);
}

#go:active:not(:disabled) {
  transform: scale(0.97);
}

#go:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#go .btn-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Example chips ── */
.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.examples-label {
  font-size: 0.82rem;
  color: var(--muted-dim);
}

.example-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.example-chip:hover {
  background: rgba(255, 92, 138, 0.1);
  border-color: rgba(255, 92, 138, 0.35);
  color: var(--text);
  transform: translateY(-1px);
}

.example-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Status / Loading ── */
.status {
  margin: 32px auto 0;
  max-width: 580px;
}

.status.error {
  text-align: center;
  color: var(--bad);
  font-size: 1rem;
  padding: 16px;
  background: var(--bad-dim);
  border: 1px solid rgba(251, 91, 91, 0.3);
  border-radius: var(--radius-md);
}

.loading-panel {
  text-align: center;
  animation: rise 0.4s var(--ease-out) both;
}

.loading-scale {
  position: relative;
  width: 120px;
  height: 80px;
  margin: 0 auto 20px;
}

.scale-base {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-pill);
}

.scale-stand {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 36px;
  background: var(--muted-dim);
  border-radius: 2px;
}

.scale-beam {
  position: absolute;
  bottom: 42px;
  left: 50%;
  width: 90px;
  height: 4px;
  margin-left: -45px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transform-origin: center center;
  animation: wobble 1.8s ease-in-out infinite;
}

.scale-pan {
  position: absolute;
  bottom: 46px;
  width: 36px;
  height: 6px;
  background: var(--muted);
  border-radius: 3px;
}

.scale-pan-left {
  left: 8px;
  animation: panLeft 1.8s ease-in-out infinite;
}

.scale-pan-right {
  right: 8px;
  animation: panRight 1.8s ease-in-out infinite;
}

.scale-emoji {
  position: absolute;
  bottom: 52px;
  right: 12px;
  font-size: 1.4rem;
  animation: bounce 1.8s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

@keyframes panLeft {
  0%, 100% { transform: translateY(6px); }
  50% { transform: translateY(-2px); }
}

@keyframes panRight {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(6px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.loading-text {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 24px;
  min-height: 1.5em;
  transition: opacity 0.3s;
}

.loading-text.fade {
  opacity: 0;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.skeleton-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  height: 96px;
}

.skeleton-line {
  height: 10px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--border) 25%, #3a3350 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmerLine 1.4s ease-in-out infinite;
}

.skeleton-line.short {
  width: 55%;
  margin-bottom: 14px;
}

.skeleton-line.long {
  width: 80%;
  height: 22px;
}

@keyframes shimmerLine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Results ── */
.result {
  margin-top: 36px;
}

.result-block {
  animation: rise 0.5s var(--ease-out) both;
}

.result-block:nth-child(1) { animation-delay: 0s; }
.result-block:nth-child(2) { animation-delay: 0.08s; }
.result-block:nth-child(3) { animation-delay: 0.16s; }
.result-block:nth-child(4) { animation-delay: 0.24s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verdict {
  background: linear-gradient(145deg, var(--card-2) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
  position: relative;
}

.level-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(255, 179, 71, 0.1);
  border: 1px solid rgba(255, 179, 71, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}

.verdict-level-1,
.verdict-level-2,
.verdict-level-3,
.verdict-level-4,
.verdict-level-5 {
  border-color: rgba(74, 222, 128, 0.25);
}

.verdict-level-6,
.verdict-level-7,
.verdict-level-8,
.verdict-level-9,
.verdict-level-10 {
  border-color: rgba(251, 191, 36, 0.25);
}

.verdict-level-11,
.verdict-level-12,
.verdict-level-13,
.verdict-level-14 {
  border-color: rgba(251, 146, 60, 0.3);
}

.verdict-level-15,
.verdict-level-16,
.verdict-level-17,
.verdict-level-18 {
  border-color: rgba(251, 91, 91, 0.35);
}

.verdict-level-19,
.verdict-level-20 {
  border-color: rgba(180, 50, 255, 0.45);
  box-shadow: var(--shadow-card), 0 0 48px rgba(120, 50, 200, 0.12);
}

.verdict .emoji {
  font-size: 4rem;
  line-height: 1;
  display: inline-block;
  animation: popIn 0.6s var(--ease-out) both;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.verdict h2 {
  font-size: 1.55rem;
  margin: 14px 0 8px;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.verdict .roast {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0;
  line-height: 1.55;
  max-width: 480px;
  margin-inline: auto;
}

/* Tachometer scale */
.weight-gauge {
  margin: 28px 0 0;
  position: relative;
}

.weight-track {
  position: relative;
  height: 14px;
  border-radius: var(--radius-pill);
  background: #2a2340;
  overflow: visible;
}

.weight-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--good), var(--warn), var(--bad));
  width: 0;
  transition: width 1s var(--ease-out);
}

.weight-marker {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  margin-left: -11px;
  background: var(--text);
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(255, 92, 138, 0.5);
  transition: left 1s var(--ease-out);
  z-index: 2;
}

.weight-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted-dim);
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  gap: 8px;
}

.weight-ticks {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding: 0 2px;
  gap: 2px;
}

.weight-tick {
  flex: 1;
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.2;
  filter: grayscale(0.6);
  transition: opacity 0.3s, transform 0.3s, filter 0.3s;
  cursor: default;
  min-width: 0;
}

.weight-tick.active {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.weight-tick.current {
  opacity: 1;
  filter: none;
  transform: scale(1.25);
  text-shadow: 0 0 12px rgba(255, 92, 138, 0.4);
}

/* Stat grid */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--stat-accent, var(--border));
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: rgba(255, 255, 255, 0.08);
}

.stat-good { --stat-accent: var(--good); }
.stat-warn { --stat-accent: var(--warn); }
.stat-bad { --stat-accent: var(--bad); }

.stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.stat .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat .value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.stat .hint {
  color: var(--muted-dim);
  font-size: 0.82rem;
  margin-top: 4px;
}

/* Trackers */
.trackers {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 12px;
  transition: border-color 0.2s;
}

.trackers.warn-many {
  border-color: rgba(251, 91, 91, 0.35);
  background: linear-gradient(135deg, var(--card), rgba(251, 91, 91, 0.04));
}

.trackers .label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.trackers .label-icon {
  font-size: 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(251, 91, 91, 0.12);
  border: 1px solid rgba(251, 91, 91, 0.35);
  color: #ff9b9b;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  transition: transform 0.12s;
}

.chip:hover {
  transform: scale(1.03);
}

.chip.clean {
  background: var(--good-dim);
  border-color: rgba(74, 222, 128, 0.35);
  color: var(--good);
}

.analyzed {
  text-align: center;
  color: var(--muted-dim);
  font-size: 0.85rem;
  margin-top: 20px;
  word-break: break-all;
}

.foot {
  text-align: center;
  color: var(--muted-dim);
  font-size: 0.85rem;
  margin-top: 52px;
}

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#url:focus-visible {
  outline: none;
}

#go:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-title {
    --fat-scale: 1.12;
    --fat-dur: 0.01ms;
    --fat-ease: ease;
  }

  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ── Mobile ── */
@media (max-width: 560px) {
  .wrap {
    padding: 40px 16px 64px;
  }

  .hero-title {
    --fat-scale: 1.65;
  }

  .hero-line {
    gap: 0.22em;
    white-space: normal;
    flex-wrap: wrap;
    row-gap: 0.1em;
  }

  .search-pill {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-lg);
    padding: 12px;
    gap: 10px;
  }

  .search-icon {
    display: none;
  }

  #url {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    text-align: center;
  }

  #go {
    width: 100%;
    justify-content: center;
    padding: 16px;
  }

  .skeleton-grid,
  .grid {
    grid-template-columns: 1fr;
  }

  .verdict {
    padding: 24px 20px;
  }

  .verdict .emoji {
    font-size: 3.2rem;
  }

  .weight-tick {
    font-size: 0.55rem;
  }

  .weight-scale {
    font-size: 0.65rem;
  }
}
