/* Climber screens (Task 11): find/add gym, gym home, climb grid, add climb,
 * climb detail, rate sheet, sign-in. Builds on the tokens in app.css.
 *
 * The photo is the hero everywhere: cards are mostly photo, with the tape
 * chip and grade riding on it and the vote strip directly beneath, so a
 * climber can find "the green one on the cave" and vote with one thumb.
 */

/* Tape colour as a variable for blanks (no photo yet). */
[data-color='red'] { --tape: var(--hold-red); }
[data-color='orange'] { --tape: var(--hold-orange); }
[data-color='yellow'] { --tape: var(--hold-yellow); }
[data-color='green'] { --tape: var(--hold-green); }
[data-color='blue'] { --tape: var(--hold-blue); }
[data-color='purple'] { --tape: var(--hold-purple); }
[data-color='pink'] { --tape: var(--hold-pink); }
[data-color='black'] { --tape: var(--hold-black); }
[data-color='white'] { --tape: var(--hold-white); }
[data-color='grey'] { --tape: var(--hold-grey); }

/* ── Shared bits ── */

.section-title {
  font-size: var(--fs-lg);
  font-weight: 750;
  margin-bottom: var(--s3);
}

.error-box {
  display: grid;
  gap: var(--s2);
  justify-items: start;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--ink);
  font-weight: 550;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px var(--s2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.badge .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.badge-verified {
  background: color-mix(in srgb, var(--soft) 18%, transparent);
  color: var(--ink);
}

.badge-unverified {
  background: var(--surface-2);
  color: var(--ink-2);
}

.osm-credit {
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.osm-credit a {
  color: inherit;
}

.results-empty {
  color: var(--ink-2);
  padding: var(--s2) 0;
}

.fine-print {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  margin-top: var(--s4);
}

/* ── Forms ── */

.stack-form {
  display: grid;
  gap: var(--s5);
}

.field {
  display: grid;
  gap: var(--s2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  padding: 0;
  font-weight: 700;
}

.field-hint {
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.stack-form input[type='text'],
.stack-form input[type='url'],
.stack-form input[type='search'],
.stack-form select,
.signin input,
.search-row input,
.filter-chip select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s4);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 1.0625rem; /* ≥16px: iOS does not zoom on focus. */
}

.stack-form select,
.filter-chip select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.stack-form input:focus,
.stack-form select:focus,
.signin input:focus,
.search-row input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-row {
  display: flex;
  gap: var(--s2);
}

.search-row .btn {
  flex: none;
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: var(--r-md);
}

/* Toggle pills: real checkboxes, visually hidden, the label is the target. */
.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.toggle-pill,
.pill {
  position: relative;
  display: inline-flex;
}

.toggle-pill input,
.pill input,
.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-pill span,
.pill-face {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.toggle-pill input:checked + span,
.pill input:checked + .pill-face {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.toggle-pill input:focus-visible + span,
.pill input:focus-visible + .pill-face,
.segment input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.scale-fields {
  display: grid;
  gap: var(--s4);
}

.scale-fields:empty {
  display: none;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.segment span {
  display: grid;
  place-items: center;
  min-height: var(--tap);
  border-radius: 9px;
  font-weight: 650;
  cursor: pointer;
}

.segment input:checked + span {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.where {
  display: grid;
  gap: var(--s3);
}

.where-chosen {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  font-weight: 650;
}

.where-chosen .icon {
  color: var(--accent-text);
}

.where-chosen-block {
  display: grid;
  gap: var(--s1);
  padding: var(--s3);
  border-radius: var(--r-md);
  background: var(--surface);
}

.place-list,
.gym-list,
.dupe-list,
.tag-list,
.consensus-legend {
  list-style: none;
  margin: 0;
  padding: 0;
}

.place-list {
  display: grid;
  gap: 1px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--line);
  margin-bottom: var(--s2);
}

.place-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  width: 100%;
  min-height: 52px;
  padding: var(--s3);
  border: 0;
  background: var(--surface);
  text-align: left;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.place-row .icon {
  color: var(--ink-3);
}

.place-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

/* The Add-gym map: the pin is the one thing in colour, so it reads as
 * "the gym is here" at a glance, the way a tape chip reads on a photo. */
.where-map {
  height: 220px;
  margin: var(--s2) calc(-1 * var(--s3)) 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  /* Leaflet's own stacking stays inside the map (below the tab bar and sheets). */
  isolation: isolate;
  z-index: 0;
}

.where-map.is-unavailable {
  display: grid;
  place-items: center;
  height: auto;
  min-height: 80px;
  padding: var(--s3);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  text-align: center;
}

.where-map .leaflet-control-attribution {
  font: var(--fs-xs) / 1.4 var(--font);
  color: #333;
}

.map-pin {
  background: none;
  border: 0;
}

.map-pin svg {
  display: block;
  width: 32px;
  height: 44px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.map-pin-body {
  fill: var(--accent);
  stroke: var(--accent-ink);
  stroke-width: 1.5;
}

.map-pin-dot {
  fill: var(--surface);
}

.map-pin:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.leaflet-dragging .map-pin svg {
  transform: translateY(-4px);
}

/* The primary action sits above the tab bar, under the thumb. */
.sticky-action {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s2));
  z-index: 5;
  padding-top: var(--s2);
}

.sticky-action::before {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--s4)) calc(-1 * var(--s4)) calc(-1 * var(--s2));
  z-index: -1;
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
  pointer-events: none;
}

.turnstile-slot:empty {
  display: none;
}

.dupes {
  display: grid;
  gap: var(--s2);
  padding: var(--s4);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--hard) 14%, var(--surface));
}

.dupes-title {
  font-size: var(--fs-md);
  font-weight: 750;
}

/* ── Home: find a gym ── */

.find {
  display: grid;
  gap: var(--s3);
}

.find .section-title {
  margin-bottom: 0;
}

.find-results:empty {
  display: none;
}

.gym-list {
  display: grid;
  gap: var(--s2);
  margin-bottom: var(--s2);
}

.gym-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 60px;
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.gym-row:active {
  background: var(--surface-2);
}

.gym-row > .icon {
  color: var(--ink-3);
}

.gym-row-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.gym-row-name {
  font-weight: 700;
  font-size: 1.0625rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gym-row-meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.gym-row-last {
  border-left: 4px solid var(--accent);
}

/* OSM gyms not in Rateclimbs yet: dashed, like an outline waiting to be
 * filled in, with "Add" where the chevron would be. */
.osm-gyms {
  display: grid;
  gap: var(--s2);
  margin-top: var(--s4);
}

.osm-gyms-title {
  font-size: var(--fs-md);
  font-weight: 750;
}

.gym-row-osm {
  background: transparent;
  border: 1.5px dashed var(--line);
}

.gym-row-osm:active {
  background: var(--surface);
}

.gym-row-add {
  flex: none;
  padding: var(--s1) var(--s3);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: 750;
}

.add-gym-cta {
  display: grid;
  gap: var(--s3);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

/* ── Sign-in ── */

.signin {
  display: grid;
  gap: var(--s3);
  padding-top: var(--s1);
}

/* The swapped step's children lay out as direct grid items of .signin,
 * next to the stable Turnstile slot. */
.signin-step {
  display: contents;
}

.signin .sheet-title {
  margin-bottom: 0;
}

.sheet-lede {
  color: var(--ink-2);
}

.signin-form {
  display: grid;
  gap: var(--s3);
}

/* Google's button rules: white, #747775 border, #1f1f1f text, the
 * unmodified four-colour G. Same in dark mode (white stays allowed). */
.gsi-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 var(--s4);
  border: 1px solid #747775;
  border-radius: 999px;
  background: #ffffff;
  color: #1f1f1f;
  font-family: Roboto, var(--font);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
}

.gsi-btn:active {
  background: #f2f2f2;
}

.gsi-logo {
  width: 20px;
  height: 20px;
  flex: none;
}

.or-rule {
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.or-rule::before,
.or-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.signin .code-input {
  min-height: 64px;
  text-align: center;
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: 0.4em;
  font-variant-numeric: tabular-nums;
}

.signin-alt {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}

.signin-alt .btn {
  padding: 0 var(--s2);
}

.confirm {
  display: grid;
  gap: var(--s4);
  padding-top: var(--s5);
}

.confirm-title {
  font-size: var(--fs-xl);
  font-weight: 750;
}

/* ── Gym home ── */

.gym-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

.gym-site {
  font-size: var(--fs-sm);
  font-weight: 600;
}

.fresh-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 112px;
  gap: var(--s2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 calc(-1 * var(--s4));
  padding: 0 var(--s4) var(--s2);
  scrollbar-width: none;
}

.fresh-strip::-webkit-scrollbar {
  display: none;
}

.fresh-card {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  scroll-snap-align: start;
}

.fresh-card img,
.fresh-blank {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fresh-blank {
  display: block;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tape, var(--hold-grey)) 55%, var(--surface-2)), var(--surface-2));
}

.fresh-meta {
  position: absolute;
  left: var(--s1);
  bottom: var(--s1);
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 3px 4px 3px 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s2);
}

.wall-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-height: 104px;
  padding: var(--s3) var(--s4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.wall-card:active {
  background: var(--surface-2);
}

.wall-card-count {
  order: -1;
  margin-bottom: auto;
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.wall-card-count strong {
  color: var(--ink);
  font-size: var(--fs-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.wall-card-name {
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.wall-card-meta {
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.wall-card-add {
  align-items: flex-start;
  justify-content: space-between;
  background: transparent;
  border: 1.5px dashed var(--line);
  color: var(--ink-2);
  font: inherit;
}

.feedback-link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.feedback-link > span {
  flex: 1;
  display: grid;
}

.feedback-link .muted {
  font-size: var(--fs-sm);
}

/* ── Climb grid ── */

.filter-bar {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 8;
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0;
  padding: var(--s2) var(--s4);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

label.filter-chip {
  padding: 0;
}

.filter-chip select {
  min-height: var(--tap);
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  padding: 0 34px 0 var(--s4);
  font-size: var(--fs-sm);
  font-weight: 650;
  max-width: 11rem;
}

.filter-chip.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.filter-chip.is-on select {
  color: var(--bg);
  background-image: linear-gradient(45deg, transparent 50%, var(--bg) 50%), linear-gradient(135deg, var(--bg) 50%, transparent 50%);
}

.climb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3) var(--s2);
}

@media (min-width: 560px) {
  .climb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.climb-card {
  display: grid;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  transition: opacity 160ms var(--ease);
}

.climb-card.is-saving {
  opacity: 0.7;
}

.climb-card.is-skeleton {
  aspect-ratio: 3 / 5;
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to { background-position: -150% 0; }
}

.climb-card-photo {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
}

.climb-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.climb-card-blank {
  display: grid;
  place-items: center;
  height: 100%;
  background:
    repeating-linear-gradient(-35deg, transparent 0 18px, color-mix(in srgb, var(--ink) 4%, transparent) 18px 19px),
    linear-gradient(170deg, color-mix(in srgb, var(--tape, var(--hold-grey)) 45%, var(--surface-2)), var(--surface-2) 75%);
}

.climb-card-blank .chip {
  width: 64px;
  height: 26px;
}

/* Chip and grade ride on the photo, top left, on a solid tab. */
.climb-card-tag {
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 3px 3px 8px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.climb-card-tag .chip {
  width: 22px;
  height: 11px;
}

.climb-card-body {
  display: grid;
  gap: 6px;
  padding: var(--s2) var(--s2) var(--s2);
}

.climb-card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s1);
  min-height: 20px;
  padding: 0 2px;
}

.climb-card-count {
  font-size: var(--fs-xs);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.climb-card .tri-wrap {
  display: flex;
  padding: 0 2px;
}

.card-votes {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 3px;
}

.card-vote {
  min-height: var(--tap);
  padding: 0 2px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms var(--ease), transform 120ms var(--ease);
}

.card-vote:active {
  transform: scale(0.95);
}

.card-vote[aria-pressed='true'].vote-soft,
.vote-btn[aria-checked='true'].vote-soft { background: var(--soft); color: #04201d; }
.card-vote[aria-pressed='true'].vote-correct,
.vote-btn[aria-checked='true'].vote-correct { background: var(--correct); color: #111417; }
.card-vote[aria-pressed='true'].vote-hard,
.vote-btn[aria-checked='true'].vote-hard { background: var(--hard); color: #2a1702; }

/* ── Add climb ── */

.shot {
  display: grid;
  gap: var(--s2);
}

.shot-take {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s1);
  min-height: 220px;
  padding: var(--s5);
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, var(--line));
  border-radius: var(--r-lg);
  background: var(--accent-soft);
  text-align: center;
  cursor: pointer;
}

.shot-take .icon {
  width: 44px;
  height: 44px;
  stroke-width: 1.6;
  color: var(--accent-text);
}

.shot-title {
  font-size: var(--fs-lg);
  font-weight: 750;
}

.shot-hint {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.shot {
  position: relative;
}

.shot-preview {
  width: 100%;
  max-height: 52vh;
  object-fit: cover;
  border-radius: var(--r-lg);
}

.shot-retake {
  position: absolute;
  right: var(--s3);
  bottom: var(--s3);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.color-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s2);
}

.color-row .pill-face {
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0;
  border-radius: var(--r-md);
}

.color-row .pill {
  display: flex;
}

.color-row .pill-face .chip {
  width: 38px;
  height: 18px;
}

.color-row .pill input:checked + .pill-face {
  background: var(--surface);
  border: 3px solid var(--ink);
}

.wall-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

/* ── Climb detail ── */

.detail {
  display: grid;
  gap: var(--s4);
}

.detail-photo {
  width: calc(100% + 2 * var(--s4));
  max-height: 68vh;
  margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0;
  object-fit: cover;
  background: var(--surface-2);
}

.detail-photo-blank {
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--s2);
  aspect-ratio: 4 / 3;
  color: var(--ink-2);
  background: linear-gradient(170deg, color-mix(in srgb, var(--tape, var(--hold-grey)) 45%, var(--surface-2)), var(--surface-2) 75%);
}

.detail-photo-blank .chip {
  width: 80px;
  height: 32px;
}

/* Photo gallery: edge to edge like the single photo was, one angle per
 * swipe. The pager is tape in the hold colour; the photo in view gets the
 * long strip. */
.gallery {
  display: grid;
  gap: var(--s2);
  margin: calc(-1 * var(--s4)) calc(-1 * var(--s4)) 0;
}

.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  background: var(--surface-2);
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-track:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.gallery-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery-photo {
  display: block;
  width: 100%;
  height: min(68vh, 133vw);
  object-fit: cover;
  user-select: none;
}

/* The last slide: a frame waiting for another angle. */
.gallery-add {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s3);
  height: min(68vh, 133vw);
  padding: var(--s5);
  text-align: center;
  border: 2px dashed var(--line);
  background: var(--surface-2);
}

.gallery-add.is-first {
  height: auto;
  aspect-ratio: 4 / 3;
  border: 0;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tape, var(--hold-grey)) 45%, var(--surface-2)), var(--surface-2) 75%);
}

.gallery-add.is-first .chip {
  width: 80px;
  height: 32px;
}

.gallery-add-text {
  max-width: 24ch;
  margin: 0;
  color: var(--ink-2);
}

.gallery-add-count {
  margin: 0;
  font-size: var(--fs-sm);
}

.gallery-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s5);
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.gallery-add-btn:disabled {
  opacity: 0.6;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 2px;
}

.gallery-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.gallery-dot::before {
  content: '';
  width: 12px;
  height: 7px;
  background: var(--tape, var(--hold-grey));
  opacity: 0.35;
  clip-path: polygon(0 10%, 12% 0, 100% 8%, 92% 55%, 100% 100%, 10% 90%, 0 100%, 6% 50%);
  transition: width 160ms var(--ease), opacity 160ms var(--ease);
}

.gallery-dot[aria-current='true']::before {
  width: 26px;
  opacity: 1;
}

/* White and black tape vanish on one theme each; the grey stays visible. */
.gallery-dots[data-color='white'] .gallery-dot::before,
.gallery-dots[data-color='black'] .gallery-dot::before {
  background: var(--ink-3);
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s2);
}

.gallery-actions:empty {
  display: none;
}

.gallery-spacer {
  flex: 1;
}

.gallery-note {
  padding: 0 var(--s3);
  font-size: var(--fs-sm);
}

.gallery-remove {
  color: var(--danger);
}

@media (prefers-reduced-motion: reduce) {
  .gallery-dot::before {
    transition: none;
  }
}

.detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3);
}

.detail-grade {
  display: grid;
}

.detail-grade-main {
  font-size: 3.25rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.detail-grade-sub {
  color: var(--ink-2);
  font-weight: 600;
}

.detail-where {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  font-weight: 650;
  text-align: right;
}

.detail-stars {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.detail-stars .stars {
  font-size: var(--fs-lg);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.detail-consensus {
  padding: var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
}

.consensus-bar .tri-wrap,
.consensus-bar .tri {
  display: flex;
  width: 100%;
}

.consensus-bar .tri {
  height: 14px;
  border-radius: 7px;
}

.consensus-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  margin: var(--s3) 0 var(--s2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.consensus-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.consensus-legend strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-soft .legend-dot { background: var(--soft); }
.legend-correct .legend-dot { background: var(--correct); }
.legend-hard .legend-dot { background: var(--hard); }

.consensus-verdict {
  font-weight: 650;
}

.stripped-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--bg);
  font-weight: 650;
}

.detail-strip {
  justify-self: center;
  font-size: var(--fs-sm);
}

/* ── Rate sheet ── */

.rate {
  display: grid;
  gap: var(--s3);
}

.rate-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink-2);
  font-weight: 600;
}

.rate .sheet-title {
  margin: var(--s2) 0 0;
}

.rate-label {
  margin-top: var(--s3);
  font-size: var(--fs-md);
  font-weight: 700;
}

.star-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s1);
}

.star-btn {
  min-height: 60px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--line);
  font-size: 2.6rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms var(--ease), color 140ms var(--ease);
}

.star-btn.is-on {
  color: var(--accent);
}

.star-btn:active {
  transform: scale(0.88);
}

.star-caption {
  min-height: 1.5em;
  text-align: center;
  color: var(--ink-2);
  font-weight: 650;
}

.vote-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s1);
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.vote-btn {
  min-height: 52px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 750;
  font-size: 1rem;
  cursor: pointer;
}

.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.tag-pill:disabled {
  opacity: 0.4;
  cursor: default;
}

.tag-pill[aria-pressed='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.tag-pill.is-static {
  min-height: 32px;
  padding: 0 var(--s3);
  background: var(--surface-2);
  border-color: transparent;
  cursor: default;
}

/* Duplicate list (add climb). */
.dupe-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 56px;
  padding: var(--s1) var(--s3) var(--s1) var(--s1);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.dupe-row img,
.dupe-blank {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
}

.dupe-cta {
  margin-left: auto;
  color: var(--accent-text);
  font-weight: 700;
  font-size: var(--fs-sm);
}

.dupe-list {
  display: grid;
  gap: var(--s2);
}
