:root {
  --bg: #10140f;
  --bg-elev: #1a2118;
  --bg-soft: #232b20;
  --line: rgba(232, 220, 180, 0.14);
  --text: #f4efe2;
  --muted: #a8b09a;
  --accent: #d4ff4f;
  --accent-2: #ff7a3d;
  --danger: #ff5c6c;
  --gold: #f0c14b;
  --silver: #c5cdd8;
  --bronze: #c47a4a;
  --radius: 18px;
  --font-display: "Bebas Neue", sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 255, 79, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 122, 61, 0.16), transparent 50%),
    var(--bg);
  line-height: 1.5;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(244, 239, 226, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 239, 226, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
  z-index: 0;
}

.topbar, main, .footer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  background: rgba(16, 20, 15, 0.75);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-mark {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border-radius: 0.7rem;
  background: var(--accent);
  color: #10140f;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: 0.06em;
}

.nav {
  display: flex;
  gap: 0.4rem;
}

.nav-btn, .tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-btn.is-active,
.tab.is-active {
  color: var(--bg);
  background: var(--accent);
}

.nav-btn:hover:not(.is-active),
.tab:hover:not(.is-active) {
  color: var(--text);
  border-color: var(--line);
}

main {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.view[hidden] {
  display: none !important;
}

.hero h1,
.vote-header h2,
.done-panel h2,
.ranking-header h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 0.95;
  margin: 0.2rem 0 0.8rem;
}

.hero h1 {
  font-size: clamp(3.2rem, 10vw, 5.6rem);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0;
}

.lead, .hint {
  color: var(--muted);
  max-width: 36rem;
}

.panel {
  margin-top: 1.8rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26, 33, 24, 0.95), rgba(22, 28, 20, 0.92));
  box-shadow: var(--shadow);
}

.login-panel label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="password"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 255, 79, 0.18);
}

.btn {
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.85rem 1.3rem;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--accent);
  color: #10140f;
  width: 100%;
  margin-top: 1rem;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  width: auto;
  margin: 0;
}

.error {
  color: var(--danger);
  margin: 0.8rem 0 0;
  font-size: 0.95rem;
}

.vote-header,
.ranking-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.vote-header h2,
.ranking-header h2,
.done-panel h2 {
  font-size: clamp(2.4rem, 7vw, 3.6rem);
}

.vote-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.vote-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 0.8rem;
  align-items: end;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(35, 43, 32, 0.7);
}

.vote-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.vote-card label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.vote-actions {
  margin-top: 1.2rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 1.2rem 0;
  flex-wrap: wrap;
}

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

.rank-item {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(26, 33, 24, 0.9);
  animation: rise 0.35s ease both;
}

.rank-item:nth-child(1) { animation-delay: 0.02s; }
.rank-item:nth-child(2) { animation-delay: 0.06s; }
.rank-item:nth-child(3) { animation-delay: 0.1s; }

.rank-pos {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--muted);
}

.rank-item:nth-child(1) .rank-pos { color: var(--gold); }
.rank-item:nth-child(2) .rank-pos { color: var(--silver); }
.rank-item:nth-child(3) .rank-pos { color: var(--bronze); }

.rank-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.rank-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.rank-score {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent);
}

.meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

.api-status.ok { color: var(--accent); }
.api-status.bad { color: var(--danger); }

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

@media (max-width: 720px) {
  .vote-card {
    grid-template-columns: 1fr;
  }

  .vote-header,
  .ranking-header {
    flex-direction: column;
  }

  .rank-item {
    grid-template-columns: 2.4rem 1fr;
  }

  .rank-score {
    grid-column: 2;
    justify-self: start;
  }
}
