:root {
  --bg: #0b1020;
  --bg-soft: rgba(255, 255, 255, 0.08);
  --card: rgba(14, 20, 38, 0.72);
  --card-strong: rgba(22, 28, 52, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f7ff;
  --muted: #a7b2d3;
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.22);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.26), transparent 32%),
    radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.18), transparent 28%),
    linear-gradient(160deg, #090d19 0%, #0d1324 42%, #10182d 100%);
}

body.page-vote {
  min-height: 100dvh;
  overflow: hidden;
}

body.page-results {
  min-height: 100dvh;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.bg-blur {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
}

.bg-blur-a {
  width: 340px;
  height: 340px;
  background: rgba(139, 92, 246, 0.34);
  top: -60px;
  left: -80px;
}

.bg-blur-b {
  width: 320px;
  height: 320px;
  background: rgba(34, 197, 94, 0.18);
  bottom: -80px;
  right: -70px;
}

.app-shell {
  position: relative;
  z-index: 2;
  height: 100dvh;
  padding: clamp(14px, 2vw, 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(12px, 1.5vw, 18px);
}

.topbar,
.viewer-card,
.vote-panel,
.results-header,
.result-card,
.empty-results {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #b8c3e5;
}

.image-title,
.results-header h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 2rem);
  line-height: 1.12;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter-chip,
.results-link,
.total-votes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.results-link {
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.results-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.viewer-card {
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(10px, 1vw, 16px);
  padding: clamp(12px, 1.2vw, 18px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
}

.image-frame {
  position: relative;
  min-width: 0;
  height: 100%;
  border-radius: calc(var(--radius-xl) - 8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(8, 10, 18, 0.9), rgba(14, 18, 30, 0.82));
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mainImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
}

.empty-state {
  max-width: 560px;
  padding: 32px;
  text-align: center;
}

.empty-state h2 {
  margin-top: 0;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.nav-button {
  width: clamp(52px, 5vw, 68px);
  height: clamp(52px, 5vw, 68px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-button span {
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1;
  transform: translateY(-2px);
}

.nav-button:hover {
  transform: scale(1.03);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.vote-panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.vote-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.vote-label {
  margin: 0 0 4px;
  font-weight: 700;
}

.vote-subtitle,
.mobile-hint {
  margin: 0;
  color: var(--muted);
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.vote-button {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: var(--radius-lg);
  cursor: pointer;
  padding: 14px 10px;
  display: grid;
  gap: 8px;
  place-items: center;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.vote-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
}

.vote-button.is-selected {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.28), rgba(139, 92, 246, 0.18));
  border-color: rgba(167, 139, 250, 0.9);
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.22);
}

.vote-button .emoji {
  font-size: clamp(1.6rem, 2vw, 2rem);
}

.vote-text {
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.results-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.results-grid {
  display: grid;
  gap: 16px;
}

.result-card,
.empty-results {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--card-strong);
  box-shadow: var(--shadow);
}

.result-image-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 220px;
}

.result-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-content {
  display: grid;
  gap: 16px;
  align-content: start;
}

.result-headline-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.result-headline-row h2 {
  margin: 0;
  font-size: 1.2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stat-pill {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.stat-topline,
.stat-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-values strong {
  font-size: 1.15rem;
}

@media (max-width: 980px) {
  .vote-grid,
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
    height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
  }

  .topbar,
  .vote-panel,
  .results-header {
    padding: 12px;
  }

  .topbar,
  .vote-panel-header,
  .results-header,
  .result-headline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right {
    justify-content: space-between;
  }

  .viewer-card {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
  }

  .nav-left,
  .nav-right {
    order: initial;
    justify-self: stretch;
    align-self: stretch;
  }

  .nav-button {
    width: 44px;
    height: auto;
    min-height: 100%;
    border-radius: 16px;
  }

  .nav-button span {
    font-size: 1.8rem;
    transform: none;
  }

  .image-frame {
    min-height: 0;
    height: 100%;
  }

  #mainImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .vote-panel {
    padding: 12px;
    gap: 10px;
  }

  .vote-grid,
  .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .vote-button {
    min-height: 72px;
    padding: 10px 6px;
  }

  .vote-button .emoji {
    font-size: 1.35rem;
  }

  .vote-text {
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .mobile-hint {
    display: none;
  }

  .result-card {
    grid-template-columns: 1fr;
  }
}

.vote-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.vote-count-item,
.vote-count-total {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 600;
}

.vote-count-item .emoji {
  font-size: 1.05rem;
  line-height: 1;
}

@media (max-width: 480px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar,
  .vote-panel,
  .results-header {
    padding: 10px;
  }

  .eyebrow {
    font-size: 0.68rem;
    margin-bottom: 4px;
  }

  .image-title,
  .results-header h1 {
    font-size: 1rem;
  }

  .counter-chip,
  .results-link,
  .total-votes {
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  .viewer-card {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
    padding: 6px;
  }

  .nav-button {
    width: 40px;
    border-radius: 14px;
  }

  .nav-button span {
    font-size: 1.5rem;
  }

  .vote-grid,
  .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }

  .vote-button {
    min-height: 64px;
    padding: 8px 4px;
    border-radius: 14px;
  }

  .vote-button .emoji {
    font-size: 1.2rem;
  }

  .vote-text,
  .stat-label {
    font-size: 0.66rem;
    line-height: 1.05;
  }

  .vote-counts {
    gap: 6px;
  }

  .vote-count-item,
  .vote-count-total {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .results-shell {
    padding: 10px;
  }
}


