:root {
  --bg: #0c0c0f;
  --bg-elevated: #141419;
  --border: #252530;
  --text: #e8e6ed;
  --text-muted: #8b8799;
  --accent: #7c5cff;
  --accent-dim: rgba(124, 92, 255, 0.25);
  --success: #34d399;
  --error: #f87171;
  --radius: 12px;
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 92, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.25rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.input-section {
  width: 100%;
  margin-bottom: 1.5rem;
}

.input-wrap {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.url-input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 1rem;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.url-input::placeholder {
  color: var(--text-muted);
}

.btn-fetch {
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
}

.btn-fetch:hover:not(:disabled) {
  background: #8d6fff;
}

.btn-fetch:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-fetch:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-fetch .btn-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-fetch.loading .btn-text {
  display: none;
}

.btn-fetch.loading .btn-loader {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.platform-hint {
  margin: 0.5rem 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.25em;
}

.platform-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}

.result-section {
  width: 100%;
}

.result-section.hidden {
  display: none;
}

.result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-preview {
  aspect-ratio: 16 / 9;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.result-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-meta {
  padding: 1rem 1.25rem 0;
}

.result-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-author {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-downloads {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-downloads a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}

.result-downloads a:hover {
  background: #8d6fff;
}

.result-error {
  margin: 0;
  padding: 1rem 1.25rem;
  color: var(--error);
  font-size: 0.9rem;
}

.result-error.hidden {
  display: none;
}

.footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}
