:root {
  --black: #111111;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --line: #d8d8d8;
  --paper: #ffffff;
  --page: #f6f6f6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  font-family: Manrope, system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f4f4 55%, #ececec 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid #e4e4e4;
  pointer-events: none;
}

header {
  text-align: center;
  padding: 52px 20px 8px;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 18px;
  max-width: 280px;
  color: var(--black);
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--black);
  opacity: 0.35;
}

.ornament span {
  font-size: 14px;
  letter-spacing: 0.2em;
}

.kicker {
  letter-spacing: 0.38em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px;
}

h1 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 400;
  margin: 0 auto;
  max-width: 100%;
  padding: 0 8px;
  line-height: 1.15;
  color: var(--black);
  overflow-wrap: anywhere;
}

.lead {
  max-width: 480px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 28px;
  padding: 36px 20px 72px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
}

.card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--black);
  border-radius: 0;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 8px 8px 0 #111;
  display: flex;
  flex-direction: column;
}

.photo-open {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ececec;
  cursor: zoom-in;
  overflow: hidden;
}

.photo-open img,
.card img {
  width: 100%;
  max-width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: center 18%;
  display: block;
  filter: grayscale(0.18) contrast(1.05);
}

.photo-open span {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: #111;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 7px 10px;
  pointer-events: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.lightbox-stage img {
  max-width: min(92vw, 100%);
  max-height: 88vh;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 1px solid #fff;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.lightbox-hint {
  position: absolute;
  top: 22px;
  left: 12px;
  right: 60px;
  margin: 0;
  color: #fff;
  opacity: 0.8;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.card h2 {
  margin: 16px 16px 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.card .vote {
  margin: 0 16px 18px;
  border: 1px solid var(--black);
  border-radius: 0;
  padding: 12px 16px;
  background: var(--black);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
}

.card .vote:hover:not(:disabled) {
  background: #fff;
  color: #111;
}

.card .vote:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 12px 18px;
  border-radius: 0;
  z-index: 10;
  letter-spacing: 0.04em;
}

.stats-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 24px;
}

.stats-actions button {
  padding: 12px 16px;
  border: 1px solid #111;
  background: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.stats-actions .danger {
  background: #111;
  color: #fff;
}

.result-info {
  min-width: 0;
  flex: 1;
  padding-right: 12px;
}

.bar {
  height: 6px;
  background: #ececec;
  margin-top: 10px;
}

.bar span {
  display: block;
  height: 100%;
  background: #111;
  max-width: 100%;
}

.admin-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.admin-form input,
.admin-form button {
  padding: 12px 14px;
  border-radius: 0;
  border: 1px solid #111;
  font: inherit;
  background: #fff;
}

.admin-form button {
  background: #111;
  color: #fff;
  border: 1px solid #111;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card {
  flex-direction: row;
  align-items: center;
  margin-bottom: 14px;
}

.result-card img,
.result-photo img {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  filter: grayscale(0.18) contrast(1.05);
}

.result-photo {
  flex-shrink: 0;
  width: 110px;
}

.place {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.votes {
  margin: 6px 0 0;
  font-weight: 700;
}

@media (max-width: 640px) {
  .bg::after {
    inset: 10px;
  }

  .card {
    box-shadow: 5px 5px 0 #111;
  }
}
