:root {
  color-scheme: light;
  --ink: #192649;
  --muted: #4a5976;
  --page: #f0f5fc;
  --paper: #fff;
  --border: #d7e2f0;
  --yellow: #ffd05a;
  --pine: #0c5d49;
  --rose: #972b4c;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--ink); }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.13; letter-spacing: -.025em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.45rem); }
h2 { font-size: 1.35rem; }
p { color: var(--muted); }
a { color: inherit; }
button, input, select { font: inherit; }
button, .secondary, input, select { min-height: 3rem; border-radius: .8rem; }
button, .secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  border: 1px solid transparent;
  padding: .6rem 1rem;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: .46; cursor: default; }
:where(button, a, input, select):focus-visible {
  outline: 3px solid #3268be;
  outline-offset: 3px;
}
.primary { background: var(--yellow); color: var(--ink); }
.primary:hover:enabled { background: #ffbf30; }
.secondary { background: var(--paper); color: var(--ink); border-color: var(--border); }
.secondary:hover:enabled, a.secondary:hover { background: #e7f0ff; }
.like { background: var(--pine); color: white; }
.like:hover:enabled { background: #084f3e; }
.dislike { background: #fff2f5; color: var(--rose); border-color: #efc8d3; }
.dislike:hover:enabled { background: #fbe1e9; }
.error { color: var(--rose); font-weight: 650; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  max-width: 77rem;
  margin: 0 auto;
  padding: .5rem max(1rem, 3vw);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 950;
  letter-spacing: -.09em;
  line-height: 1;
  text-decoration: none;
}
.wordmark span { color: #ce631d; }
.paper {
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--paper);
  box-shadow: 0 7px 20px #1c3e6e09;
}

.review { max-width: 38rem; margin: auto; padding: .4rem 1rem max(1rem, env(safe-area-inset-bottom)); }
.intro {
  margin-top: clamp(1rem, 10vh, 7rem);
  padding: clamp(1.5rem, 6vw, 3rem);
  text-align: center;
}
.intro p { max-width: 29rem; margin: .8rem auto 0; }
.intro .google-signin {
  margin-top: 1.5rem;
  min-width: 12rem;
  gap: .75rem;
  border-color: #747775;
  border-radius: 2rem;
  color: #1f1f1f;
  font-weight: 600;
}
.google-signin img { flex: none; }
.postmark {
  display: grid;
  place-items: center;
  width: 3.8rem;
  aspect-ratio: 1;
  margin: 0 auto 1rem;
  color: #3060a3;
  border: 1px dashed #7ca0cc;
  border-radius: .95rem;
  background: #eaf3ff;
  transform: rotate(-8deg);
  font-size: 1.6rem;
}
.postmark span { transform: rotate(8deg); }
.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
}
.deck-header p { margin-top: .3rem; }
.counter {
  flex: none;
  padding: .35rem .7rem;
  border-radius: 1.2rem;
  background: #e0ebf9;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
progress {
  display: block;
  width: 100%;
  height: .42rem;
  margin: .8rem 0;
  border: 0;
  border-radius: .4rem;
  overflow: hidden;
  background: #dbe7f6;
  color: #3a73bf;
}
progress::-webkit-progress-bar { background: #dbe7f6; }
progress::-webkit-progress-value { background: #3a73bf; }
progress::-moz-progress-bar { background: #3a73bf; }
.image-stage {
  display: grid;
  place-items: center;
  position: relative;
  height: clamp(14rem, 61svh, 42rem);
  padding: .5rem;
  border: 1px solid #c9daee;
  border-radius: 1.15rem;
  background: #e3edf8;
  overflow: hidden;
}
.image-stage img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  opacity: 0;
  transition: opacity .16s ease;
}
.image-stage img.ready { opacity: 1; }
.load-status { position: absolute; text-align: center; padding: 1rem; color: var(--muted); }
.actions { margin-top: .8rem; }
.actions > button { width: 100%; }
.actions .error { margin-top: .5rem; }
.vote-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
.vote-buttons span { font-size: 1.25rem; line-height: 1; }

.dashboard { max-width: 77rem; margin: auto; padding: .7rem max(1rem, 3vw) 3rem; }
.dashboard-header, .results-header { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.dashboard-header { margin-bottom: 1.2rem; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.metric { display: grid; gap: .25rem; padding: .9rem 1rem; }
.metric strong { font-size: clamp(1.12rem, 3vw, 1.75rem); line-height: 1.2; }
.metric span { font-size: .875rem; color: var(--muted); }
.results { margin-top: 1.6rem; }
input, select {
  width: 100%;
  min-width: 0;
  border: 1px solid #c9d8e9;
  background-color: var(--paper);
  color: var(--ink);
  padding: .55rem .7rem;
  font-size: 1rem;
  font-weight: 450;
}
select {
  appearance: none;
  padding-right: 1.8rem;
  background-image: linear-gradient(45deg, transparent 50%, #49658b 50%),
                    linear-gradient(135deg, #49658b 50%, transparent 50%);
  background-position: calc(100% - 1rem) 50%, calc(100% - .7rem) 50%;
  background-size: .3rem .3rem;
  background-repeat: no-repeat;
}
.filters { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: .6rem; margin: .8rem 0; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.result-card { display: grid; grid-template-columns: minmax(5rem, .68fr) minmax(0, 1fr); align-items: center; overflow: hidden; min-width: 0; }
.thumbnail { display: block; width: 100%; height: 100%; background: #e1edf9; }
.thumbnail img { width: 100%; height: 100%; aspect-ratio: 2 / 3; object-fit: contain; display: block; }
.thumbnail:focus-visible { outline-offset: -3px; }
.card-info { display: grid; gap: .33rem; padding: .7rem; min-width: 0; }
.card-info h3 { font-size: 1rem; }
.asset-id { font-size: .8125rem; overflow-wrap: anywhere; }
.counts { display: flex; flex-wrap: wrap; gap: .4rem .7rem; margin: 0; font-variant-numeric: tabular-nums; }
.counts dt, .total-votes { font-size: .875rem; color: var(--muted); }
.counts dd { margin: 0; font-size: .875rem; font-weight: 750; }
.likes { color: var(--pine); }
.dislikes { color: var(--rose); }
.ratio { width: 100%; height: .6rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: .9rem; margin-top: 1rem; }

@media (max-width: 56rem) {
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 35rem) {
  .topbar { min-height: 3rem; }
  .dashboard-header, .results-header { align-items: flex-start; }
  .results-header { flex-direction: column; gap: .35rem; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters input { grid-column: 1 / -1; }
  .results-grid { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 6rem 1fr; }
  .metric { padding: .65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .image-stage img { transition: none; }
}
