:root {
  --bg: #f7f3ea;
  --bg-alt: #efe3cf;
  --text: #1e1b18;
  --muted: #5e5345;
  --accent: #f25f4c;
  --accent-2: #2e86ab;
  --ok: #2a9d62;
  --warn: #c44536;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-strong: #fffdf8;
  --border: rgba(30, 27, 24, 0.1);
  --shadow: 0 16px 30px rgba(37, 28, 19, 0.12);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  padding: 1.4rem;
  position: relative;
  z-index: 0;
  overflow-x: hidden;
  background: none;
}

body::before {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;

  width: 180vh;
  height: 60vw;

  background-image: url("../Direction2025.jpg");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;

  transform: translate(-50%, -50%) rotate(180deg);
  z-index: -1;
}

body.lightbox-open {
  overflow: hidden;
}

.site-header,
.container {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(7px);
  border: 1px solid var(--border);
}

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

.brand h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(1.9rem, 4vw, 3rem);
  letter-spacing: 0.04em;
}

.brand-badge {
  background: var(--text);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 700;
  font-size: 0.8rem;
}

.site-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.mode-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 0.5rem;
  padding: 0.4rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  opacity: 0.68;
  transition: transform 0.2s ease, background 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  opacity: 0.88;
}

.nav-title {
  display: block;
  line-height: 1.05;
  font-size: 0.92rem;
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
  border-color: #e44633;
  opacity: 1;
  box-shadow: 0 10px 20px rgba(242, 95, 76, 0.35);
}

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1rem, 3vw, 2.2rem);
  box-shadow: var(--shadow);
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-2);
}

.hero h2 {
  margin: 0.4rem 0 0.5rem;
  font-size: clamp(1.5rem, 5vw, 2.8rem);
}

.hero-copy {
  margin: 0;
  color: var(--muted);
}

.hero-tools {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.upload-toggle-btn {
  margin-left: auto;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent-2);
  color: #fff;
  padding: 0.82rem 1.2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

.upload-toggle-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.upload-toggle-btn[aria-expanded="true"] {
  background: #1f6c8a;
}

.upload-form {
  margin-top: 0.2rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.9rem;
  animation: drop-open 0.25s ease;
}

.upload-form h3 {
  margin: 0 0 0.65rem;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 0.65rem;
}

.upload-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.upload-grid input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 0.5rem 0.55rem;
  font: inherit;
}

.upload-form .submit-btn {
  margin-top: 0.75rem;
}

.hero-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hero-controls label {
  font-weight: 700;
}

.hero-controls .teacher-select {
  max-width: 300px;
}

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

.status-banner {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.status-banner.is-error {
  border-color: rgba(196, 69, 54, 0.4);
  color: #6e1c0f;
  background: rgba(255, 217, 210, 0.88);
}

.status-banner.is-success {
  border-color: rgba(42, 157, 98, 0.35);
  color: #14532d;
  background: rgba(210, 243, 225, 0.88);
}

.cards-grid,
.category-grid,
.podium-grid {
  margin-top: 1.3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.podium-grid {
  align-items: end;
}

.vote-card,
.category-card,
.submit-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vote-card.selected-like {
  border-color: var(--ok);
  box-shadow: 0 16px 30px rgba(42, 157, 98, 0.3);
  transform: translateY(-2px);
}

.vote-card.selected-dislike {
  border-color: var(--warn);
  box-shadow: 0 16px 30px rgba(196, 69, 54, 0.3);
  transform: translateY(-2px);
}

.vote-image {
  width: 100%;
  height: 220px;
  object-fit: contain;
  display: block;
  background: rgba(18, 16, 13, 0.08);
}

.vote-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.vote-image-button:focus-visible {
  outline: 3px solid rgba(46, 134, 171, 0.45);
  outline-offset: -3px;
}

.vote-content {
  padding: 1rem;
}

.meme-teacher {
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.meme-teacher strong {
  color: var(--text);
}

.vote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.vote-score {
  font-weight: 700;
  color: var(--text);
}

.vote-content h3,
.category-card h3 {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.vote-content p {
  margin-top: 0;
  color: var(--muted);
}

.vote-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.vote-btn,
.submit-btn {
  border: 0;
  border-radius: var(--radius-md);
  padding: 0.68rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

.vote-btn:hover,
.submit-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.vote-btn.like {
  background: #d2f3e1;
  color: #14532d;
}

.vote-btn.dislike {
  background: #ffd9d2;
  color: #6e1c0f;
}

.vote-btn.selected.like {
  background: var(--ok);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(42, 157, 98, 0.28);
}

.vote-btn.selected.dislike {
  background: var(--warn);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(196, 69, 54, 0.28);
}

.category-card {
  padding: 1rem;
}

.category-card.selected {
  border-color: var(--accent-2);
  box-shadow: 0 16px 30px rgba(46, 134, 171, 0.28);
}

.category-card label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.category-summary,
.category-vote-note {
  margin-top: 0;
  color: var(--muted);
}

.category-vote-note {
  margin-bottom: 0;
  margin-top: 0.75rem;
  font-size: 0.92rem;
}

.teacher-select {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font: inherit;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.teacher-select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent-2) 45%, white);
  border-color: transparent;
}

.teacher-select.selected {
  border-color: var(--accent-2);
  background: #eef8fc;
  box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.2);
}

.submit-panel {
  margin-top: 1rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.submit-btn {
  background: var(--accent);
  color: #fff;
}

.submit-panel p {
  margin: 0;
  color: var(--muted);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: rgba(18, 16, 13, 0.82);
  backdrop-filter: blur(6px);
}

.image-lightbox[hidden] {
  display: none;
}

.image-lightbox-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(92vw, 1100px);
}

.image-lightbox-media {
  width: min(92vw, 1100px);
  height: min(88vh, 900px);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  object-fit: contain;
  background: #111;
}

.image-lightbox-footer {
  width: min(92vw, 1100px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.image-lightbox-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.image-lightbox-teacher,
.image-lightbox-score {
  color: var(--text);
  font-weight: 700;
}

.image-lightbox-score {
  color: var(--muted);
  font-weight: 500;
}

.image-lightbox-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.image-lightbox-nav {
  width: 3.25rem;
  height: 3.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.image-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.podium-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.podium-card.first {
  transform: translateY(-16px);
}

.podium-rank {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.05em;
}

.podium-image-shell {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.55)),
    linear-gradient(180deg, rgba(255, 217, 138, 0.45), rgba(46, 134, 171, 0.18));
  overflow: hidden;
}

.podium-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.podium-score {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.podium-votes,
.podium-vote-state {
  margin: 0;
  color: var(--muted);
}

.podium-block {
  width: 100%;
  border-radius: 18px 18px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  color: rgba(30, 27, 24, 0.92);
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}

.podium-block-1 {
  height: 180px;
  background: linear-gradient(180deg, #ffd86f, #dca426);
}

.podium-block-2 {
  height: 130px;
  background: linear-gradient(180deg, #eceef2, #b7bcc5);
}

.podium-block-3 {
  height: 95px;
  background: linear-gradient(180deg, #f2c9a1, #b87743);
}

.reveal {
  animation: pop-in 0.45s ease both;
}

.reveal:nth-child(2) { animation-delay: 0.06s; }
.reveal:nth-child(3) { animation-delay: 0.12s; }
.reveal:nth-child(4) { animation-delay: 0.18s; }
.reveal:nth-child(5) { animation-delay: 0.24s; }

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 700px) {
  body {
    padding: 0.9rem;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    width: 100%;
    align-items: stretch;
  }

  .mode-switch {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .nav-link {
    text-align: center;
  }

  .submit-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .image-lightbox {
    padding: 1rem;
    gap: 0.5rem;
  }

  .image-lightbox-footer {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .image-lightbox-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .image-lightbox-nav {
    width: 2.8rem;
    height: 2.8rem;
  }

  .podium-card.first {
    transform: none;
  }
  .upload-grid {
    grid-template-columns: 1fr;
  }

  .hero-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-toggle-btn {
    margin-left: 0;
    width: 100%;
  }

  .hero-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
