:root {
  --ink: #1d2926;
  --paper: #fbfaf6;
  --paper-light: #fffefd;
  --muted: #706b5f;
  --line: rgba(29, 41, 38, .19);
  --rose: #c95558;
  --rose-dark: #7f2936;
  --ocean: #068a8b;
  --ocean-dark: #075761;
  color: var(--ink);
  background: var(--paper);
  font-family: "Roboto Mono", monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 10%, rgba(201, 85, 88, .055), transparent 27rem),
    radial-gradient(circle at 92% 18%, rgba(6, 138, 139, .055), transparent 30rem),
    var(--paper);
}

html[data-embedded="true"],
html[data-embedded="true"] body {
  overflow: hidden;
}

html[data-embedded="true"] body {
  min-height: 0;
  padding: 18px;
}

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

.page-shell {
  width: min(100% - 28px, 760px);
  margin: 0 auto;
}

main { padding: 18px 0 28px; }

html[data-single-poll="true"] .page-shell {
  width: min(100%, 390px);
}

html[data-single-poll="true"] main {
  padding: 0;
}

html[data-single-poll="true"] .cards {
  grid-template-columns: minmax(0, 1fr);
}

.page-title {
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.loading-card {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.coffee-card {
  --accent: var(--rose);
  --accent-dark: var(--rose-dark);
  position: relative;
  overflow: hidden;
  border: 7px solid #e2d2b9;
  border-radius: 25px;
  background: #e2d2b9;
  box-shadow: 0 14px 34px rgba(36, 30, 22, .1);
}

.coffee-card.ocean {
  --accent: var(--ocean);
  --accent-dark: var(--ocean-dark);
}

.card-title {
  margin: 0 0 9px;
  padding: 0 4px;
  font-family: "Roboto Mono", monospace;
  font-size: clamp(.96rem, 2vw, 1.12rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.artwork {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 18px;
  background: var(--accent-dark);
}

.artwork::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10, 24, 21, .45));
  pointer-events: none;
}

.artwork img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}

.coffee-card:hover .artwork img { transform: scale(1.025); }

.label {
  position: relative;
  z-index: 2;
  width: calc(100% - 22px);
  margin: -40px auto 11px;
  padding: 18px;
  border: 1px solid rgba(34, 31, 26, .12);
  border-radius: 2px;
  background: rgba(255, 254, 251, .98);
  box-shadow: 0 9px 22px rgba(24, 24, 19, .13);
}

.details {
  display: grid;
  grid-template-columns: 64px 1fr;
  margin-bottom: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-label, .detail-value {
  padding: 8px 0;
  line-height: 1.35;
  text-transform: uppercase;
}

.detail-label {
  font-size: .59rem;
  font-weight: 700;
  letter-spacing: .09em;
}

.detail-value {
  padding-left: 10px;
  border-left: 1px solid var(--line);
  font-size: .52rem;
  letter-spacing: .025em;
  white-space: nowrap;
}

.detail-label:nth-of-type(3), .detail-value:nth-of-type(4) {
  border-top: 1px solid var(--line);
}

.options { display: grid; gap: 6px; }

.choice {
  position: relative;
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: 600 .76rem/1.2 "Roboto Mono", monospace;
  text-align: left;
  transition: border-color .2s, background .2s, transform .2s;
}

.choice:hover { transform: translateY(-1px); border-color: var(--accent); }

.choice.selected {
  border-color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent) 11%, white);
}

.ring {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 1.5px solid #8f8b81;
  border-radius: 50%;
}

.selected .ring { border: 4px solid var(--accent-dark); }

.results { display: grid; gap: 10px; }

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  font-size: .69rem;
  font-weight: 600;
}

.result-track {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8e0d1;
}

.result-fill {
  height: 100%;
  width: var(--percent);
  border-radius: inherit;
  background: var(--accent);
  animation: grow .8s ease both;
}

@keyframes grow { from { width: 0; } }

.vote-total {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .65rem;
}

.status-error {
  position: static;
  width: auto;
  height: auto;
  margin: 12px 0 0;
  overflow: visible;
  clip: auto;
  color: #9f2635;
  white-space: normal;
  font-size: .68rem;
  text-align: center;
}

button:focus-visible {
  outline: 3px solid #e19532;
  outline-offset: 4px;
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 360px); }
  html[data-single-poll="true"] .page-shell { width: min(100%, 390px); }
  main { padding-top: 10px; }
  .page-title { margin-bottom: 12px; padding-bottom: 12px; }
  .cards { grid-template-columns: 1fr; gap: 14px; }
  .coffee-card { border-width: 6px; border-radius: 23px; }
  .artwork { border-radius: 16px; aspect-ratio: 4 / 5; }
  .label { width: calc(100% - 18px); margin-top: -36px; margin-bottom: 9px; padding: 16px; }
}

@media (max-width: 430px) {
  html[data-embedded="true"] body { padding: 10px; }
  .details { grid-template-columns: 56px 1fr; }
  .detail-value { padding-left: 8px; font-size: .48rem; }
  .card-title { font-size: .96rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
