:root {
  --bg: hsl(229, 70%, 7%);
  --bg-2: hsl(229, 49%, 14%);
  --ink: #f4f7fb;
  --muted: #93a0b8;
  --line: rgba(255, 255, 255, 0.08);
  --tangerine: #3b82f6;
  --tangerine-deep: #2563eb;
  --lime: #6aa7ff;
  --card: rgba(28, 34, 62, 0.86);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(at 0% 100%, hsl(225, 84%, 4%) 0, transparent 46%),
    radial-gradient(at 100% 0%, hsl(227, 70%, 12%) 0, transparent 42%),
    var(--bg);
  overflow-x: hidden;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.08;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.orb {
  pointer-events: none;
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
}

.orb-a {
  width: 420px;
  height: 420px;
  background: rgba(59, 130, 246, 0.28);
  top: -120px;
  right: -80px;
}

.orb-b {
  width: 360px;
  height: 360px;
  background: rgba(106, 167, 255, 0.16);
  bottom: -140px;
  left: -90px;
}

.top,
main,
footer {
  position: relative;
  z-index: 1;
}

.top {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong {
  display: block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #60a5fa, #2563eb);
  color: #f4f7fb;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.server-pill {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

.kicker {
  color: var(--lime);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

h1 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: clamp(2.2rem, 5vw, 4.3rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  max-width: 14ch;
}

.lede {
  margin-top: 18px;
  color: var(--muted);
  max-width: 46ch;
  font-size: 1.02rem;
  line-height: 1.6;
}

.panel {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

form label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="url"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  outline: none;
  box-shadow: var(--shadow);
}

input[type="url"]:focus {
  border-color: rgba(59, 130, 246, 0.8);
}

button,
.download {
  font: inherit;
  cursor: pointer;
  border: 0;
}

#analyze-btn,
.convert,
.download {
  background: var(--tangerine);
  color: #f4f7fb;
  font-weight: 600;
  border-radius: 16px;
  padding: 16px 22px;
  transition: transform 0.15s ease, background 0.15s ease;
}

#analyze-btn:hover,
.convert:hover,
.download:hover {
  background: #60a5fa;
  transform: translateY(-1px);
}

#analyze-btn:disabled,
.convert:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.status {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #dbe7ff;
}

.status.ok {
  background: rgba(61, 214, 140, 0.12);
  border-color: rgba(61, 214, 140, 0.35);
  color: #d9ffe9;
}

.result {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  padding: 18px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  background: #1c1916;
}

.meta h2 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

#details {
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.format-switch,
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.pill {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}

.chip.active,
.pill.active {
  background: #3b82f6;
  color: #f4f7fb;
  border-color: transparent;
}

.quality {
  margin: 18px 0;
}

.quality p {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.convert,
.download {
  display: inline-flex;
  margin-top: 4px;
}

.download {
  text-decoration: none;
  background: var(--lime);
}

.progress-wrap {
  margin-top: 16px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--tangerine), var(--lime));
  transition: width 0.25s ease;
}

#progress-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.warn {
  max-width: 1080px;
  margin: 0 auto 24px;
  padding: 12px 24px;
  color: #ffd7c8;
}

.feats {
  max-width: 1080px;
  margin: 0 auto 48px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
}

.feats li {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
}

.feats strong {
  display: block;
  font-family: "IBM Plex Sans", sans-serif;
  margin-bottom: 6px;
}

.feats span {
  color: var(--muted);
  font-size: 0.88rem;
}

footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 0.78rem;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 12, 28, 0.72);
  backdrop-filter: blur(8px);
}

.auth-screen[hidden] {
  display: none !important;
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 1.6rem;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.auth-card .lede {
  margin: 0 0 18px;
}

.auth-card input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8, 12, 28, 0.45);
  color: var(--ink);
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  outline: none;
}

#auth-submit {
  margin-top: 16px;
  width: 100%;
  background: var(--tangerine);
  color: #f4f7fb;
  font-weight: 600;
  border-radius: 16px;
  padding: 16px 22px;
}

#logout-btn {
  background: transparent;
  color: var(--muted);
}

@media (max-width: 800px) {
  .url-row,
  .result,
  .feats {
    grid-template-columns: 1fr;
  }

  .top {
    flex-direction: column;
    align-items: flex-start;
  }
}
