:root {
  --bg: #0f0f0f;
  --panel: #17171c;
  --panel-border: #26262d;
  --text: #e0e0e0;
  --muted: #9d9dae;
  --danger: #ff4757;
  --ok: #2ed573;
  --warn: #f1c40f;
  --accent: #1e90ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, #191926 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, #1c1219 0%, transparent 38%),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.13;
  pointer-events: none;
}

.bg-orb-a {
  width: 350px;
  height: 350px;
  background: #ff4757;
  top: -80px;
  right: -60px;
}

.bg-orb-b {
  width: 320px;
  height: 320px;
  background: #1e90ff;
  bottom: -90px;
  left: -50px;
}

.app-shell {
  --shell-top-gap: 48px;
  width: min(920px, 92vw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--shell-top-gap);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

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

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  margin: 0;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
}

.search-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
}

.search-row {
  display: flex;
  gap: 10px;
}

.search-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: stretch;
}

input[type="text"] {
  flex: 1;
  background: #121218;
  color: var(--text);
  border: 1px solid #2b2b37;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 2px solid rgba(30, 144, 255, 0.45);
  outline-offset: 1px;
}

button[type="submit"] {
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  min-height: 48px;
  background: linear-gradient(135deg, #ff4757, #ff6b6b);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button[type="submit"]:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.strictness-select-wrap {
  position: relative;
  min-width: 150px;
}

.strictness-select-wrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #a8caff;
  border-bottom: 2px solid #a8caff;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  opacity: 0.9;
}

.strictness-select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid #3c5f8d;
  background: linear-gradient(180deg, rgba(90, 140, 214, 0.24), rgba(17, 25, 38, 0.92)), #111a29;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px rgba(60, 95, 141, 0.16);
  color: #deebff;
  padding: 0 34px 0 12px;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.strictness-select:hover {
  border-color: #5e91d6;
}

.strictness-select:focus-visible {
  outline: 2px solid rgba(30, 144, 255, 0.45);
  outline-offset: 1px;
}

.strictness-help {
  margin: 8px 2px 0;
  color: #8ea5c7;
  font-size: 0.78rem;
  line-height: 1.3;
}

.disclaimer {
  margin: 14px 0 0;
  color: #8f8fa1;
  font-size: 0.9rem;
}

.status-message {
  min-height: 1.6rem;
  margin: 14px 2px 0;
  color: var(--muted);
}

.status-message[data-state="error"] {
  color: #ff9099;
}

.result-card {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  animation: rise-in 260ms ease-out;
}

.site-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(18, 18, 26, 0.78);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
  color: #9898a9;
  font-size: 0.84rem;
  line-height: 1.35;
}

.site-footer a {
  color: #9ec6ff;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: #c5ddff;
}

.hidden {
  display: none;
}

.cover {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #2d2d35;
  object-fit: cover;
  background: #101015;
  min-height: 200px;
}

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

.title-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.title-line h2 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.2rem, 2.8vw, 1.75rem);
}

.source-pill {
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.74rem;
  color: #9ec6ff;
  border: 1px solid #2a3f5f;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
}

.score-line p {
  margin: 0;
}

.tone-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid #34465f;
  padding: 4px 10px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #141a25;
}

.tone-icon {
  font-size: 0.86rem;
  line-height: 1;
}

.tone-very-classy {
  color: #92f2c3;
  border-color: #2d6f52;
  background: linear-gradient(180deg, rgba(57, 137, 101, 0.3), rgba(14, 30, 24, 0.95));
}

.tone-classy {
  color: #b4efcf;
  border-color: #3a785d;
  background: linear-gradient(180deg, rgba(74, 138, 110, 0.28), rgba(19, 34, 28, 0.95));
}

.tone-chaotic {
  color: #ffe2a2;
  border-color: #7e6840;
  background: linear-gradient(180deg, rgba(137, 112, 56, 0.3), rgba(39, 31, 18, 0.95));
}

.tone-trashy {
  color: #ffb7a0;
  border-color: #835343;
  background: linear-gradient(180deg, rgba(136, 84, 60, 0.3), rgba(40, 24, 20, 0.95));
}

.tone-super-trash {
  color: #ff9ca4;
  border-color: #8e3f4a;
  background: linear-gradient(180deg, rgba(150, 63, 77, 0.32), rgba(43, 16, 22, 0.95));
}

#scoreValue {
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: color 200ms ease;
}

.meter-track {
  margin-top: 8px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
      90deg,
      rgba(84, 167, 130, 0.2) 0%,
      rgba(218, 178, 79, 0.2) 55%,
      rgba(202, 87, 101, 0.24) 100%
    ),
    #0f1116;
  border: 1px solid #2f3643;
  overflow: hidden;
}

.meter-fill {
  --meter-glow: rgba(255, 91, 103, 0.45);
  --meter-arrow-opacity: 1;
  width: 0;
  height: 100%;
  position: relative;
  border-radius: 999px;
  transition: width 520ms ease, box-shadow 200ms ease;
  background: linear-gradient(90deg, #4fd79d 0%, #f2cb57 55%, #ff5b67 100%);
  box-shadow: 0 0 10px var(--meter-glow);
}

.meter-fill::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid rgba(14, 17, 23, 0.64);
  transform: translateY(-50%);
  opacity: var(--meter-arrow-opacity);
  transition: opacity 180ms ease;
}

.tag-list {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.tag-list li {
  background: #131924;
  border: 1px solid #26374f;
  border-radius: 10px;
  padding: 8px 10px;
  color: #bddbff;
  font-family: "JetBrains Mono", "SFMono-Regular", monospace;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.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;
}

@keyframes rise-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    --shell-top-gap: 26px;
    width: min(920px, 94vw);
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .cover {
    width: min(220px, 62vw);
  }

  .search-row {
    flex-direction: column;
  }

  .search-actions {
    width: 100%;
  }

  .search-actions .strictness-select-wrap,
  .search-actions button[type="submit"] {
    flex: 1;
  }

  .search-actions .strictness-select-wrap {
    min-width: 0;
  }

  .search-panel {
    padding: 14px;
  }
}

@media (max-width: 520px) {
  .hero {
    margin-bottom: 18px;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .result-card {
    padding: 13px;
  }

  .cover {
    width: min(210px, 68vw);
    min-height: 180px;
  }

  .score-line {
    gap: 10px;
    flex-wrap: wrap;
  }

  .site-footer {
    padding: 10px;
    gap: 7px;
  }

  .site-footer p {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .app-shell {
    width: 95vw;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  input[type="text"] {
    padding: 13px 14px;
  }

  .search-panel {
    padding: 12px;
  }

  .result-card {
    padding: 11px;
  }
}
