:root {
  --bg: #f7f0e7;
  --surface: #fffaf4;
  --surface-strong: #ffffff;
  --ink: #171717;
  --muted: #716c65;
  --line: rgba(31, 28, 24, 0.12);
  --line-strong: rgba(31, 28, 24, 0.18);
  --green: #34452c;
  --green-2: #445a37;
  --orange: #e56f24;
  --gold: #c79232;
  --shadow: 0 24px 70px rgba(57, 43, 28, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(229, 111, 36, 0.16), transparent 28rem),
    radial-gradient(circle at 92% 2%, rgba(52, 69, 44, 0.14), transparent 24rem),
    linear-gradient(180deg, #fffaf4 0%, var(--bg) 46%, #efe4d8 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.23;
  background-image:
    linear-gradient(rgba(52, 69, 44, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 69, 44, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.72), transparent 82%);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

.vote-shell {
  position: relative;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 46px;
}

.vote-hero { margin-bottom: 16px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--green);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.back-link::before { content: "←"; }
.back-link:hover { text-decoration: underline; }

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 250, 244, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-mark {
  width: clamp(118px, 18vw, 220px);
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: -0.07em;
}

.hero-copy {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.hero-status {
  min-width: 190px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--muted);
  text-align: right;
}

.hero-status strong {
  display: block;
  color: var(--green);
  font-size: 0.98rem;
}
.hero-status span { font-size: 0.84rem; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(247, 240, 231, 0.88);
  backdrop-filter: blur(16px);
}

.search-box, .select-box, .pick-meter {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 13px 14px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 750;
}

input:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(229, 111, 36, 0.22);
  border-color: rgba(229, 111, 36, 0.55);
}

.pick-meter {
  min-width: 128px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  color: var(--muted);
}

.pick-meter strong {
  color: var(--green);
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.notice-card {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 16px;
  padding: 13px 16px;
  border: 1px solid rgba(199, 146, 50, 0.25);
  border-radius: 18px;
  background: rgba(255, 246, 222, 0.78);
  color: #5f5138;
}
.notice-card strong { color: #2d261b; }

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.sticker-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 244, 0.94);
  box-shadow: 0 14px 34px rgba(65, 47, 28, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.sticker-card:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 69, 44, 0.26);
  box-shadow: 0 20px 46px rgba(65, 47, 28, 0.13);
}

.sticker-card.is-liked { border-color: rgba(229, 111, 36, 0.42); }
.sticker-card.is-top { box-shadow: 0 18px 48px rgba(199, 146, 50, 0.24); }

.art-button {
  border: 0;
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(52, 69, 44, 0.04) 25%, transparent 25%, transparent 75%, rgba(52, 69, 44, 0.04) 75%),
    linear-gradient(45deg, rgba(52, 69, 44, 0.04) 25%, transparent 25%, transparent 75%, rgba(52, 69, 44, 0.04) 75%),
    #fff;
  background-position: 0 0, 9px 9px;
  background-size: 18px 18px;
  padding: 10px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.art-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(35, 29, 22, 0.12));
}

.sticker-meta { min-width: 0; }
.sticker-index {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--orange);
  font-weight: 950;
  letter-spacing: 0.06em;
}

.sticker-title {
  margin: 0 0 6px;
  font-size: 1.08rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.sticker-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vote-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fff;
  color: var(--green);
  font-weight: 900;
}

.vote-btn:hover { background: #fff7ef; }
.vote-btn[aria-pressed="true"] {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}
.vote-btn.top-btn[aria-pressed="true"] {
  border-color: #a26f20;
  background: #a26f20;
}
.vote-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.vote-icon { font-size: 1.05rem; line-height: 1; }

.empty-state {
  margin-top: 24px;
  padding: 34px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.62);
}
.empty-state p { color: var(--muted); margin-bottom: 0; }

.vote-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 28px;
  color: var(--muted);
}
.vote-footer p { margin: 0; }
.vote-footer a { color: var(--green); font-weight: 900; }

.preview-dialog {
  width: min(560px, calc(100% - 28px));
  border: 0;
  border-radius: 30px;
  padding: 0;
  background: transparent;
}
.preview-dialog::backdrop { background: rgba(18, 15, 10, 0.52); backdrop-filter: blur(6px); }
.preview-card {
  position: relative;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}
.preview-card img {
  display: block;
  width: min(360px, 100%);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: 0 auto 18px;
}
.preview-card h2 { margin-bottom: 7px; font-size: 1.8rem; letter-spacing: -0.05em; }
.preview-card p:last-child { margin-bottom: 0; color: var(--muted); }
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

@media (max-width: 960px) {
  .hero-card { align-items: stretch; flex-direction: column; }
  .hero-status { text-align: left; }
  .sticker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .vote-shell { width: min(100% - 18px, 1180px); padding-top: 12px; }
  .hero-card { padding: 18px; border-radius: 22px; }
  .brand-lockup { align-items: flex-start; flex-direction: column; gap: 12px; }
  .brand-mark { width: min(200px, 78vw); }
  .toolbar { position: static; grid-template-columns: 1fr; border-radius: 18px; }
  .sticker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sticker-card { padding: 10px; gap: 10px; border-radius: 18px; }
  .art-button { border-radius: 14px; padding: 6px; }
  .action-row { grid-template-columns: 1fr; }
  .vote-footer { display: grid; }
}

@media (max-width: 420px) {
  .sticker-grid { grid-template-columns: 1fr; }
}

/* v218: Vote buttons stay usable at the 10-vote limit. Tapping a new one swaps it in. */
.vote-btn.top-btn.can-swap {
  border-style: dashed;
  color: #7a4f13;
  background: #fff9ee;
}
.vote-btn.top-btn.can-swap:hover {
  background: #fff2dc;
}
