:root {
  --bg-deep: #0c0e14;
  --bg-surface: #141820;
  --bg-elevated: #1c2230;
  --bg-card: rgba(28, 34, 48, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #f0f2f8;
  --text-secondary: #8b95a8;
  --text-muted: #5c6678;
  --accent: #e85d4c;
  --accent-hover: #f07060;
  --accent-glow: rgba(232, 93, 76, 0.35);
  --accent-soft: rgba(232, 93, 76, 0.12);
  --gold: #d4a853;
  --gold-soft: rgba(212, 168, 83, 0.15);
  --success: #3ecf8e;
  --error-bg: rgba(232, 93, 76, 0.12);
  --error-text: #f08070;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-glow: 0 0 40px rgba(232, 93, 76, 0.15);
  --font-display: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--bg-deep);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(232, 93, 76, 0.18), transparent),
    radial-gradient(ellipse 60% 50% at 100% 50%, rgba(100, 80, 200, 0.1), transparent),
    radial-gradient(ellipse 50% 40% at 0% 80%, rgba(212, 168, 83, 0.08), transparent),
    var(--bg-deep);
  -webkit-font-smoothing: antialiased;
}

main {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-family: var(--font-display);
  max-width: 720px;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-family: var(--font-display);
  margin-top: 8px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

p {
  max-width: 560px;
  color: var(--text-secondary);
  line-height: 1.6;
}

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 150ms ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

input, textarea, select, button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input, textarea, select {
  background: var(--bg-elevated);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b95a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #d44a3a 100%);
  color: white;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

button:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

button.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-hover);
  box-shadow: none;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.site-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #d44a3a 100%);
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.site-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.stack {
  display: grid;
  gap: 20px;
}

section.stack > div:first-child {
  display: grid;
  gap: 12px;
}

.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.row button {
  width: auto;
  min-width: 120px;
  white-space: nowrap;
}

.panel, .card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}

.panel {
  padding: 24px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.card .muted {
  margin-top: 4px;
}

.muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.45;
}

.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-card);
}

.selected::before {
  content: "✓";
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
}

.error {
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.9rem;
}

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

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: background 150ms ease;
}

.ranking-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ranking-item.rank-1 {
  background: var(--gold-soft);
  border-color: rgba(212, 168, 83, 0.3);
}

.ranking-item.rank-2 {
  border-color: rgba(180, 190, 210, 0.2);
}

.ranking-item.rank-3 {
  border-color: rgba(180, 140, 100, 0.2);
}

.rank-position {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-surface);
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.rank-1 .rank-position {
  background: linear-gradient(135deg, var(--gold) 0%, #b8923f 100%);
  color: #1a1408;
}

.rank-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-primary);
}

.rank-votes {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.rank-votes strong {
  color: var(--accent);
  font-weight: 700;
}

.url-box {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.url-box label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.url-box a {
  font-size: 0.9rem;
  word-break: break-all;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  main {
    padding: 24px 16px 48px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .panel {
    padding: 18px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row button {
    width: 100%;
  }

  .site-header {
    margin-bottom: 28px;
  }
}
