:root {
  --ink: #f5ead8;
  --paper: #e5d2ae;
  --muted: #aa9b83;
  --black: #080706;
  --charcoal: #15110e;
  --panel: #1d1712;
  --line: rgba(229, 210, 174, 0.18);
  --red: #bd3027;
  --gold: #d6a245;
  --green: #2d6a4f;
  --blue: #1f6676;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(189, 48, 39, 0.24), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(214, 162, 69, 0.16), transparent 28%),
    linear-gradient(180deg, #090806, #17110e 58%, #080706);
  color: var(--ink);
  font-family:
    Arial, Helvetica, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  /* iOS Safari: eliminates the 300ms tap delay on all buttons,
     including inside iframes (Shopify App Proxy / widget embeds). */
  touch-action: manipulation;
}

button,
input,
select,
textarea {
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(216, 162, 69, 0.8);
  outline-offset: 2px;
}

/* Back-to-store link — shown only on Shopify App Proxy via JS */
.ses-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  margin: 10px 14px 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #bcbcbc;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.ses-back-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.stories-shell {
  width: min(1660px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.review-hero,
.control-panel,
.map-panel,
.feed-panel {
  border: 1px solid var(--line);
  background: rgba(12, 10, 8, 0.94);
  box-shadow: var(--shadow);
}

.review-hero {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 210px;
  gap: 14px;
  align-items: stretch;
  padding: 14px;
}

.brand-card,
.impact-card,
.panel-block {
  border: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.78);
}

.brand-card,
.impact-card {
  display: grid;
  align-content: space-between;
  min-height: 112px;
  padding: 12px;
}

.brand-card img {
  width: 64px;
  aspect-ratio: 1;
  object-fit: cover;
}

.brand-card span,
.impact-card span,
.impact-card small,
.story-meta,
.detection-card span,
.map-stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-card strong {
  color: var(--paper);
  font-size: 1.45rem;
  line-height: 1;
  text-transform: uppercase;
}

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

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

h1 {
  max-width: 900px;
  margin-bottom: 6px;
  color: var(--paper);
  font-size: clamp(2rem, 4.5vw, 4.4rem);
  line-height: 0.88;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  color: var(--paper);
  font-size: 1.12rem;
  text-transform: uppercase;
}

.review-hero p:last-child,
.privacy-note p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.impact-card strong {
  color: var(--paper);
  font-size: 2.2rem;
  line-height: 1;
}

.review-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 250px;
  gap: 10px;
  height: clamp(640px, calc(100vh - 150px), 900px);
  margin-top: 10px;
  min-height: 0;
}

.app-tabs {
  position: sticky;
  top: 0;
  z-index: 800;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.94);
  box-shadow: var(--shadow);
}

.tab-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--paper);
  font-weight: 900;
  text-transform: uppercase;
}

.tab-button:hover,
.filter-chip:hover,
.secondary-action:hover {
  border-color: rgba(229, 210, 174, 0.38);
  background: rgba(229, 210, 174, 0.06);
}

.tab-button.active {
  border-color: transparent;
  background: var(--red);
  color: #fff7e7;
  box-shadow: inset 0 -3px 0 rgba(216, 162, 69, 0.45);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.control-panel,
.feed-panel {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  scrollbar-color: rgba(216, 162, 69, 0.55) rgba(8, 7, 6, 0.2);
  scrollbar-width: thin;
}

.panel-block {
  padding: 10px;
}

.panel-compact h2,
.feed-header h2 {
  font-size: 1rem;
}

.story-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.field-required {
  color: #c0392b;
  margin-left: 2px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(216, 162, 69, 0.58);
  background: rgba(8, 7, 6, 0.92);
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 112px;
  padding: 11px;
  resize: vertical;
}

.checkbox-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.checkbox-line input {
  width: auto;
}

.primary-action,
.secondary-action,
.filter-chip {
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--paper);
  font-weight: 900;
  text-transform: uppercase;
}

.primary-action {
  border-color: transparent;
  background: var(--red);
}

.primary-action:hover {
  background: #d1392e;
  transform: translateY(-1px);
}

.secondary-action {
  background: transparent;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.filter-chip {
  flex: 1 1 calc(50% - 8px);
  min-height: 38px;
  padding: 0 10px;
}

.filter-chip.active {
  border-color: transparent;
  background: var(--gold);
  color: var(--black);
  box-shadow: 0 10px 24px rgba(216, 162, 69, 0.16);
}

.detection-card {
  display: grid;
  gap: 8px;
}

.detection-card strong {
  color: var(--paper);
  line-height: 1.25;
}

.map-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map-toolbar {
  display: none;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.map-stats-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 560;
  pointer-events: none;
}

.map-stats span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.72);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.map-frame {
  position: relative;
  min-height: 0;
  width: 100%;
  height: auto;
  aspect-ratio: 1672 / 941;
  overflow: hidden;
  background: #080706;
}

.story-feed {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.feed-card,
.admin-card,
.activity-list div,
.rules-list div,
.leaderboard-card,
.initiative-card,
.vote-tree-node {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.6);
}

.feed-card {
  cursor: pointer;
}

.feed-card:hover,
.feed-card.is-selected {
  border-color: rgba(216, 162, 69, 0.52);
  background: rgba(216, 162, 69, 0.08);
}

.feed-card strong,
.admin-card strong,
.activity-list strong,
.rules-list strong,
.leaderboard-card strong,
.initiative-card strong,
.vote-tree-node strong {
  color: var(--paper);
  line-height: 1.25;
}

.feed-card strong {
  font-size: 0.96rem;
}

.feed-card .secondary-action {
  min-height: 36px;
}

.feed-image {
  height: 104px;
}

.leaderboard-card,
.initiative-card,
.vote-tree-node {
  min-height: 126px;
}

.leaderboard-card:first-child {
  border-color: rgba(216, 162, 69, 0.58);
  background:
    linear-gradient(135deg, rgba(216, 162, 69, 0.14), transparent 58%),
    rgba(8, 7, 6, 0.68);
}

.initiative-card.open,
.vote-tree-node.open {
  border-color: rgba(216, 162, 69, 0.48);
}

.vote-tree-node.complete {
  border-color: rgba(229, 210, 174, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 50%),
    rgba(70, 70, 66, 0.22);
  opacity: 0.72;
}

.initiative-card.locked,
.vote-tree-node.locked {
  opacity: 0.58;
}

.initiative-card button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.vote-status-pill {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(229, 210, 174, 0.16);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.initiative-card.open .vote-status-pill,
.vote-tree-node.open .vote-status-pill {
  border-color: rgba(216, 162, 69, 0.4);
  color: var(--gold);
}

.vote-tree-node.complete .vote-status-pill {
  color: rgba(229, 210, 174, 0.72);
}

.feed-card.is-hidden {
  display: none;
}

.two-column,
.admin-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.panel-stack,
.dashboard-layout,
.activity-list,
.rules-list,
.admin-list,
.leaderboard-list,
.vote-progress-tree {
  display: grid;
  gap: 12px;
}

.form-panel,
.voting-option-form,
.impact-update-form {
  display: grid;
  gap: 14px;
}

.checkbox-row {
  display: grid;
  gap: 8px;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.dashboard-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
  margin-top: 16px;
}

/* ── Vote tab: token amount row ───────────────────────────────────────────── */
.vote-token-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.vote-token-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}

.vote-token-row input[type="number"] {
  width: 90px;
  text-align: center;
}

/* ── Admin voting: declare winner UI ─────────────────────────────────────── */
.declare-winner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.declare-winner-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.declare-winner-label select {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem;
}

.declared-winner-badge {
  display: block;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(216, 162, 69, 0.4);
  border-radius: 6px;
  background: rgba(216, 162, 69, 0.08);
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Wave 3 custom option list in admin */
.wave3-option-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wave3-option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.wave3-option-item > div {
  flex: 1 1 0;
  min-width: 0;
}

.wave3-option-item strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.wave3-option-item p {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.icon-action {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 0.7rem;
  opacity: 0.6;
}

.icon-action:hover {
  opacity: 1;
}

.muted-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 6px 0 0;
}

.delivery-type-badge {
  display: inline-block;
  margin: 6px 0 4px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.profile-summary,
.token-balance {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(216, 162, 69, 0.08), transparent 52%),
    var(--black);
}

.token-balance strong {
  display: block;
  color: var(--gold);
  font-size: 4.6rem;
  line-height: 0.95;
}

.leaderboard-layout,
.vote-layout {
  display: grid;
  gap: 14px;
}

.leaderboard-list,
.initiative-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.leaderboard-list,
.initiative-grid {
  display: grid;
  gap: 14px;
}

.impact-timeline {
  display: grid;
  gap: 12px;
}

.public-impact-panel {
  margin-top: 14px;
}

.public-impact-panel h2 {
  max-width: 760px;
}

.public-impact-copy {
  max-width: 780px;
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.public-impact-panel .impact-timeline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.impact-update-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(216, 162, 69, 0.08), transparent 54%),
    rgba(8, 7, 6, 0.68);
}

.impact-update-card strong {
  display: block;
  margin: 4px 0;
  color: var(--paper);
  line-height: 1.1;
}

.impact-update-card p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.impact-update-card > div:last-child {
  min-width: 0;
}

.impact-update-image {
  min-height: 112px;
  border: 1px solid rgba(229, 210, 174, 0.18);
  background-color: #050505;
  background-position: center;
  background-size: cover;
}

.initiative-card p,
.vote-tree-node p,
.leaderboard-hero p,
.vote-hero p,
.instagram-box p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.vote-meter {
  height: 12px;
  border: 1px solid var(--line);
  background: var(--black);
}

.vote-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.impact-mini {
  display: grid;
  gap: 6px;
}

.impact-mini div,
.admin-stats div,
.story-viewer-meta div {
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(8, 7, 6, 0.52);
}

.impact-mini div {
  background:
    linear-gradient(135deg, rgba(216, 162, 69, 0.08), transparent 54%),
    rgba(8, 7, 6, 0.52);
}

.impact-mini strong,
.admin-stats strong,
.story-viewer-meta strong {
  display: block;
  color: var(--paper);
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.impact-admin-form {
  display: flex;
  gap: 8px;
  align-items: end;
  min-width: min(360px, 100%);
}

.impact-admin-form label {
  display: grid;
  flex: 1;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.impact-admin-form input {
  min-height: 40px;
}

.impact-admin-form button {
  min-height: 40px;
}

.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-subtab {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--paper);
  font-weight: 900;
  text-transform: uppercase;
}

.admin-subtab.active {
  border-color: transparent;
  background: var(--gold);
  color: var(--black);
}

.admin-helper-copy {
  max-width: 760px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.voting-admin-step {
  border: 1px solid rgba(229, 210, 174, 0.12);
  border-radius: var(--ui-radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.028), transparent 55%),
    rgba(3, 4, 3, 0.55);
}

.voting-admin-step-live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 14px;
  align-items: end;
  padding: 14px;
  margin: 10px 0 12px;
}

.impact-cycle-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin: 10px 0 12px;
}

.impact-cycle-admin strong {
  display: block;
  margin-top: 8px;
  color: var(--paper);
  font-size: 1.15rem;
  line-height: 1;
  text-transform: uppercase;
}

.impact-cycle-admin p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.voting-step-copy {
  display: grid;
  gap: 5px;
}

.voting-step-copy strong {
  color: var(--paper);
  font-size: 0.96rem;
  text-transform: uppercase;
}

.voting-step-copy p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.setup-step {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid rgba(216, 162, 69, 0.25);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.voting-stage-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.voting-stage-card {
  align-content: start;
}

.voting-stage-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.selected-option-line {
  min-height: 34px;
  color: rgba(247, 242, 232, 0.78);
  font-size: 0.72rem;
  line-height: 1.35;
}

.voting-stage-actions {
  grid-template-columns: 1fr;
}

.voting-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}

.voting-preset-card {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.voting-preset-card h3 {
  margin: 0;
  color: var(--paper);
  font-size: 0.98rem;
  text-transform: uppercase;
}

.voting-preset-card span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.voting-preset-card .setup-step {
  color: var(--gold);
  font-size: 0.62rem;
}

.preset-option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preset-option {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-height: 72px;
  padding: 10px;
  border: 1px solid rgba(229, 210, 174, 0.13);
  border-radius: var(--ui-radius-sm);
  background: rgba(1, 2, 1, 0.72);
  cursor: pointer;
}

.preset-option.selected {
  border-color: rgba(216, 162, 69, 0.44);
  background:
    linear-gradient(135deg, rgba(216, 162, 69, 0.12), transparent 62%),
    rgba(1, 2, 1, 0.88);
}

.preset-option.disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.preset-option input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--gold);
}

.preset-option span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.preset-option strong {
  color: var(--paper);
  font-size: 0.74rem;
  line-height: 1.1;
  text-transform: uppercase;
}

.preset-option small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.voting-stage-card.complete {
  opacity: 0.72;
}

.impact-cycle-record {
  border-color: rgba(216, 162, 69, 0.28);
}

.cycle-decision-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.cycle-decision-list span {
  padding: 7px 9px;
  border: 1px solid rgba(229, 210, 174, 0.16);
  border-radius: 999px;
  color: var(--paper);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: grid;
}

.admin-actions,
.review-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.admin-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.review-dialog,
.story-dialog {
  width: min(980px, calc(100vw - 28px));
  border: 1px solid var(--line);
  padding: 0;
  background: var(--charcoal);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

.review-dialog::backdrop,
.story-dialog::backdrop {
  background: rgba(8, 7, 6, 0.76);
  backdrop-filter: blur(4px);
}

/* Close-button bar — always visible above the scrollable content */
.story-dialog-bar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 14px 0;
  flex-shrink: 0;
}

.review-shell,
.story-viewer {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  padding: 18px;
}

.review-media,
.story-viewer-media {
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(189, 48, 39, 0.72), rgba(214, 162, 69, 0.42)),
    var(--black);
  background-size: cover;
  background-position: center;
}

.review-fields,
.story-viewer-details {
  display: grid;
  gap: 14px;
  align-content: start;
}

.review-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

/* story-close is no longer absolutely positioned — lives in .story-dialog-bar */
.story-close {
  flex-shrink: 0;
}

.story-viewer-caption {
  color: var(--muted);
  line-height: 1.55;
}

.story-viewer-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--black);
  color: var(--paper);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1240px) {
  .review-hero,
  .review-layout,
  .two-column,
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .review-layout {
    height: auto;
  }

  .map-panel {
    grid-template-rows: 560px;
  }

  .control-panel,
  .feed-panel {
    max-height: none;
    overflow: visible;
  }

  .dashboard-layout,
  .leaderboard-list,
  .initiative-grid,
  .voting-preset-grid,
  .voting-stage-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .stories-shell {
    padding: 12px;
  }

  .review-hero {
    padding: 16px;
  }

  .form-grid,
  .lookup-row,
  .dashboard-layout,
  .leaderboard-list,
  .initiative-grid,
  .voting-preset-grid,
  .impact-cycle-admin,
  .voting-admin-step-live,
  .voting-stage-summary,
  .preset-option-list,
  .review-shell,
  .story-viewer,
  .story-viewer-meta {
    grid-template-columns: 1fr;
  }

  /* ── Mobile story dialog: full-height sheet ────────────────────────────── */
  /* IMPORTANT: scope to dialog[open] — if we set display:flex on the bare
     .story-dialog class, it wins over the UA's "dialog { display:none }"
     rule (our class selector 0,1,0 beats the UA element selector 0,0,1),
     so the dialog renders permanently in normal document flow even when
     closed, showing the last-loaded story content as a ghost beneath the map. */
  dialog[open].story-dialog {
    /* Explicit height so flex:1 on the article child has space to expand.
       Browser UA already positions open dialogs via position:fixed + margin:auto. */
    height: 92dvh;
    max-height: 92dvh;
    width: calc(100vw - 16px);
    margin: auto;
    /* flex column so the close bar stays fixed while the article scrolls */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 10px;
  }

  dialog[open].story-dialog .story-viewer {
    /* the article scrolls independently; the close bar above it does not */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
  }

  .story-viewer-media {
    /* Square crop — matches the original tile aesthetic, fills dialog width */
    aspect-ratio: 1 / 1;
    width: 100%;
    min-height: unset;
    max-height: unset;
  }

  /* Smaller meta/details so everything fits below the square image */
  .story-viewer-details {
    gap: 8px;
    padding-bottom: 8px;
  }

  .story-viewer-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .story-viewer-meta div {
    font-size: 0.7rem;
    padding: 6px 8px;
  }

  .story-viewer-meta span {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }

  .story-viewer-meta strong {
    font-size: 0.75rem;
  }

  .story-viewer-caption {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .map-frame {
    min-height: 0;
  }
}

/* Streetwear polish pass */
.review-hero,
.app-tabs,
.control-panel,
.map-panel,
.feed-panel,
.panel-block {
  border-color: rgba(229, 210, 174, 0.14);
}

.review-hero {
  background:
    linear-gradient(90deg, rgba(189, 48, 39, 0.09), transparent 34%),
    rgba(8, 7, 6, 0.94);
}

.brand-card,
.impact-card,
.panel-block {
  box-shadow: inset 0 0 0 1px rgba(245, 234, 216, 0.035);
}

.brand-card img {
  width: 58px;
  filter: contrast(1.12);
}

.brand-card span,
.impact-card span,
.impact-card small,
.story-meta,
.detection-card span,
.map-stats span {
  font-size: 0.7rem;
  line-height: 1.22;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 0.68rem;
}

.eyebrow::before {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

h1 {
  max-width: 760px;
  font-size: clamp(2.15rem, 4vw, 4rem);
  line-height: 0.9;
}

h2 {
  font-size: 1rem;
  line-height: 1.05;
}

.review-hero p:last-child {
  max-width: 650px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.impact-card strong {
  color: #fff1cf;
  font-size: 2rem;
}

.app-tabs {
  gap: 6px;
  padding: 8px;
  background:
    linear-gradient(90deg, rgba(216, 162, 69, 0.05), transparent 42%),
    rgba(8, 7, 6, 0.96);
}

.tab-button {
  min-height: 46px;
  padding: 0 18px;
  border-color: rgba(229, 210, 174, 0.14);
  background:
    linear-gradient(180deg, rgba(245, 234, 216, 0.035), transparent),
    #070605;
  color: #eadabb;
  font-size: 0.88rem;
}

.tab-button:hover {
  border-color: rgba(216, 162, 69, 0.5);
  color: #fff5df;
}

.tab-button.active {
  background:
    linear-gradient(135deg, rgba(189, 48, 39, 0.98), rgba(139, 29, 23, 0.98));
  box-shadow:
    inset 0 -3px 0 rgba(216, 162, 69, 0.7),
    0 14px 28px rgba(189, 48, 39, 0.2);
}

.filter-list {
  display: grid;
  grid-template-columns: 1fr;
}

.filter-chip {
  justify-content: space-between;
  min-height: 38px;
  width: 100%;
  border-color: rgba(229, 210, 174, 0.14);
  background:
    linear-gradient(90deg, rgba(245, 234, 216, 0.035), transparent),
    #060504;
  color: #eadabb;
  font-size: 0.82rem;
}

.filter-chip::after {
  color: rgba(216, 162, 69, 0.7);
  content: "+";
}

.filter-chip.active::after {
  color: var(--black);
  content: "•";
}

.filter-chip.active {
  background: var(--gold);
  color: var(--black);
}

.primary-action,
.secondary-action,
.filter-chip,
.tab-button,
.admin-subtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  /* iOS Safari: fire tap immediately, no 300ms double-tap delay.
     Critical in iframes (Shopify App Proxy / embedded widget). */
  touch-action: manipulation;
}

.primary-action,
.secondary-action {
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.86rem;
}

.secondary-action {
  border-color: rgba(229, 210, 174, 0.16);
}

.map-stats-overlay {
  top: 16px;
  right: 16px;
}

.map-stats span {
  border-color: rgba(216, 162, 69, 0.22);
  color: #e6d3ad;
  font-size: 0.68rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}



.feed-card,
.admin-card,
.activity-list div,
.rules-list div,
.leaderboard-card,
.initiative-card,
.vote-tree-node {
  border-color: rgba(229, 210, 174, 0.13);
  background:
    linear-gradient(135deg, rgba(245, 234, 216, 0.03), transparent 48%),
    rgba(8, 7, 6, 0.68);
}

.feed-card {
  padding: 9px;
}

.feed-image {
  border: 1px solid rgba(229, 210, 174, 0.12);
}

.feed-card strong {
  font-size: 0.92rem;
  line-height: 1.18;
}

.impact-mini div {
  display: grid;
  gap: 4px;
}

.impact-mini strong {
  color: #f3dfb5;
  font-size: 1.15rem;
}

input,
select,
textarea {
  border-color: rgba(229, 210, 174, 0.14);
  background: rgba(4, 4, 3, 0.92);
}

label {
  font-size: 0.74rem;
}

/* Previous concept alignment: sharper streetwear map chrome */
:root {
  --acid: #c8ff2e;
  --acid-soft: rgba(200, 255, 46, 0.22);
  --street-line: rgba(255, 255, 255, 0.095);
  --street-panel: rgba(5, 6, 5, 0.88);
}

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    radial-gradient(circle at 52% 18%, rgba(83, 106, 48, 0.28), transparent 34%),
    radial-gradient(circle at 82% 82%, rgba(189, 48, 39, 0.12), transparent 28%),
    #030403;
  background-size:
    64px 64px,
    64px 64px,
    32px 32px,
    auto,
    auto,
    auto;
  color: #f7f2e8;
}

.stories-shell {
  width: min(1880px, 100%);
  padding: 20px 24px;
}

.review-hero,
.app-tabs,
.control-panel,
.map-panel,
.feed-panel,
.panel-block,
.brand-card,
.impact-card {
  border-color: var(--street-line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 54%),
    var(--street-panel);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(0, 0, 0, 0.82);
}

.review-hero {
  grid-template-columns: 150px minmax(0, 1fr) 220px;
  gap: 18px;
  min-height: 118px;
  padding: 14px;
}

.brand-card,
.impact-card {
  min-height: 90px;
  background: rgba(3, 4, 3, 0.9);
}

.brand-card img {
  width: 58px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.eyebrow,
.panel-block .eyebrow,
.feed-header .eyebrow {
  color: var(--acid);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
}

h1 {
  color: #ffffff;
  font-size: clamp(2.15rem, 3.6vw, 4.3rem);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}

h2,
.feed-card strong {
  color: #ffffff;
}

.review-hero p:last-child {
  color: rgba(247, 242, 232, 0.72);
  font-weight: 800;
}

.impact-card span,
.impact-card small,
.brand-card span,
.story-meta,
.detection-card span,
.map-stats span {
  color: rgba(247, 242, 232, 0.62);
  letter-spacing: 0;
}

.impact-card strong {
  color: #ffffff;
  line-height: 0.95;
}

.app-tabs {
  width: fit-content;
  max-width: 100%;
  margin: 18px auto;
  padding: 10px;
  gap: 10px;
  background: rgba(4, 5, 4, 0.92);
}

.tab-button,
.filter-chip,
.primary-action,
.secondary-action,
.admin-subtab {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--ui-radius-sm, 7px);
  background: rgba(2, 3, 2, 0.92);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 950;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.7),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.tab-button {
  padding: 0 26px;
  min-width: 104px;
}

.tab-button:hover,
.filter-chip:hover,
.primary-action:hover,
.secondary-action:hover {
  border-color: rgba(200, 255, 46, 0.65);
  background: rgba(16, 20, 10, 0.96);
  color: var(--acid);
  transform: translateY(-1px);
}

.tab-button.active,
.filter-chip.active {
  border-color: #ffffff;
  background: #ffffff;
  color: #050505;
  box-shadow:
    inset 0 -3px 0 var(--acid),
    0 16px 34px rgba(0, 0, 0, 0.32);
}

.primary-action {
  border-color: rgba(200, 255, 46, 0.58);
  background: var(--acid);
  color: #050505;
}

.secondary-action {
  color: #f7f2e8;
}

.filter-list {
  gap: 8px;
}

.filter-chip {
  justify-content: center;
}

.filter-chip::after,
.filter-chip.active::after {
  content: "";
}

.review-layout {
  gap: 14px;
}

.control-panel,
.feed-panel {
  background: rgba(3, 4, 3, 0.76);
}

.panel-block {
  padding: 18px;
}

.impact-mini div,
.activity-list div,
.rules-list div,
.feed-card,
.leaderboard-card,
.initiative-card,
.vote-tree-node,
.admin-card {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.034), transparent 54%),
    rgba(4, 5, 4, 0.82);
}

.impact-mini strong,
.token-balance strong {
  color: #ffffff;
}

.map-panel {
  background:
    radial-gradient(circle at 50% 50%, rgba(200, 255, 46, 0.075), transparent 42%),
    rgba(4, 5, 4, 0.58);
}

.map-frame {
  border-color: rgba(255, 255, 255, 0.16);
  background: #050605;
}

.map-frame::after {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(200, 255, 46, 0.08),
    inset 0 0 140px rgba(0, 0, 0, 0.24);
}

.map-stats-overlay {
  top: 14px;
  right: 14px;
}

.map-stats span {
  border-color: rgba(200, 255, 46, 0.3);
  background: rgba(3, 4, 3, 0.84);
  color: var(--acid);
  font-size: 0.66rem;
}







input,
select,
textarea {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(3, 4, 3, 0.92);
  color: #ffffff;
}

.review-layout {
  position: relative;
  grid-template-columns: 260px minmax(0, 1fr);
}

.feed-panel {
  display: none !important;
}

.feed-panel.has-selection {
  display: none !important;
}

.feed-header {
  border-color: rgba(200, 255, 46, 0.28);
  background:
    linear-gradient(135deg, rgba(200, 255, 46, 0.06), transparent 48%),
    rgba(3, 4, 3, 0.9);
  backdrop-filter: blur(10px);
}

.story-feed {
  max-height: calc(100vh - 310px);
  overflow: auto;
  scrollbar-width: thin;
}

.selected-story-card {
  cursor: default;
}

.selected-story-card .feed-image {
  height: 150px;
}

.selected-story-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.selected-story-stats span {
  min-height: 34px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.36);
  color: var(--acid);
  font-size: 0.68rem;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}





@media (max-width: 980px) {
  .review-layout {
    grid-template-columns: 1fr;
  }

  .feed-panel {
    display: none !important;
  }

  .feed-panel.has-selection {
    display: none !important;
  }
}

.stories-shell {
  width: min(1440px, 100%);
}

.review-hero {
  grid-template-columns: 126px minmax(0, 1fr) 190px;
  min-height: 96px;
  padding: 10px;
}

.brand-card,
.impact-card {
  min-height: 76px;
  padding: 10px;
}

h1 {
  font-size: clamp(2rem, 3.1vw, 3.45rem);
}

.review-hero p:last-child {
  max-width: 760px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.app-tabs {
  margin: 10px auto 14px;
  padding: 7px;
}

.tab-button {
  min-height: 40px;
  padding: 0 20px;
}

.review-layout {
  height: min(calc(100vh - 270px), 720px);
  min-height: 520px;
}

/* Pixel-map build: one static art layer plus lightweight story hotspots */
.map-frame::before,
.map-frame::after {
  display: none !important;
}

.map-frame {
  border: 1px solid rgba(235, 224, 198, 0.18);
  background:
    radial-gradient(circle at 50% 48%, rgba(200, 255, 46, 0.055), transparent 48%),
    #050505;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.map-inner-frame {
  position: absolute;
  inset: 0;
  border: 0;
  background: #050505;
  box-shadow: none;
}

.pixel-map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050505;
  aspect-ratio: 1672 / 941;
}

.pixel-map-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.78;
  filter: brightness(0.78) contrast(0.72) saturate(0.84);
  user-select: none;
  pointer-events: none;
}

.pixel-story-layer,
.pixel-hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
}

.pixel-hotspot-layer {
  z-index: 9;
}

.pixel-region,
.pixel-story-tile {
  position: absolute;
  left: var(--cell-left);
  top: var(--cell-top);
  border: 0;
  transform: none;
}

.pixel-region {
  width: calc(var(--cell-width) * 2.5);
  height: calc(var(--cell-height) * 2.5);
  border: 0;
  background: transparent;
  color: transparent;
  border-radius: 4px;
}

.pixel-region.is-active {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.pixel-region.is-warm {
  box-shadow: none;
}

.pixel-region.is-hot {
  box-shadow: none;
}

.pixel-region span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.62rem;
  font-weight: 950;
  opacity: 0;
  text-shadow: 0 1px 8px #000;
  transition: opacity 160ms ease;
}

.pixel-region:hover,
.pixel-region:focus-visible {
  border-color: var(--acid);
  background: radial-gradient(circle, rgba(200, 255, 46, 0.48), rgba(200, 255, 46, 0.12) 44%, transparent 72%);
  outline: none;
}

.pixel-region:hover span,
.pixel-region:focus-visible span {
  opacity: 1;
}




.pixel-story-tile {
  z-index: 11;
  display: grid;
  place-items: center;
  width: var(--cell-width);
  height: var(--cell-height);
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(229, 210, 174, 0.34);
  border-radius: 1px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
    rgba(9, 9, 8, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  animation: tile-live 3.8s ease-in-out infinite;
  animation-delay: var(--delay);
}

.pixel-story-tile.has-image {
  background: rgba(9, 9, 8, 0.92);
}

.pixel-story-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pixel-story-tile::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.pixel-story-tile:hover,
.pixel-story-tile:focus-visible {
  z-index: 30;
  border-color: var(--acid);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.84),
    0 0 14px rgba(200, 255, 46, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.42);
  outline: none;
  transform: scale(1.7);
  transform-origin: center;
}

.pixel-story-tile span {
  font-size: 0;
}

@keyframes tile-live {
  0%,
  100% {
    filter: brightness(0.92);
  }
  50% {
    filter: brightness(1.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pixel-story-tile {
    animation: none;
  }
}

.map-stats-overlay {
  z-index: 20;
}

/* Final brand polish: compact streetwear UI with softer, production-ready controls */
:root {
  --ui-radius: 10px;
  --ui-radius-sm: 7px;
  --ui-radius-pill: 999px;
  --ui-surface: rgba(5, 6, 5, 0.86);
  --ui-surface-soft: rgba(12, 13, 11, 0.72);
  --ui-border: rgba(255, 255, 255, 0.115);
  --ui-border-strong: rgba(245, 234, 216, 0.24);
}

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    radial-gradient(circle at 50% 32%, rgba(200, 255, 46, 0.075), transparent 30%),
    radial-gradient(circle at 86% 88%, rgba(189, 48, 39, 0.15), transparent 28%),
    #030403;
  background-size: 76px 76px, 76px 76px, auto, auto, auto;
}

.stories-shell {
  padding: 18px;
}

.review-hero,
.app-tabs,
.control-panel,
.map-panel,
.feed-panel,
.panel-block,
.brand-card,
.impact-card,
.feed-card,
.admin-card,
.activity-list div,
.rules-list div,
.leaderboard-card,
.initiative-card,
.vote-tree-node,
.token-balance,
.privacy-note,
.detection-card,
.modal-content {
  border-radius: var(--ui-radius);
}

.review-hero {
  border-color: var(--ui-border);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 46%),
    linear-gradient(90deg, rgba(200, 255, 46, 0.045), transparent 34%),
    rgba(4, 5, 4, 0.86);
  box-shadow:
    0 20px 64px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.brand-card,
.impact-card,
.panel-block {
  border-color: var(--ui-border);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.04), transparent 58%),
    rgba(3, 4, 3, 0.82);
}

.brand-card img {
  border-radius: var(--ui-radius-sm);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
}

.eyebrow {
  color: var(--acid);
  font-size: 0.68rem;
}

h1 {
  max-width: 760px;
  font-size: clamp(2.2rem, 3.6vw, 4rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.02rem;
  line-height: 1.08;
}

.review-hero p:last-child {
  max-width: 690px;
  color: rgba(247, 242, 232, 0.7);
  font-size: 0.9rem;
}

.impact-card strong {
  font-size: clamp(1.8rem, 2.4vw, 2.45rem);
}

.app-tabs {
  gap: 8px;
  padding: 8px;
  border-color: var(--ui-border);
  background: rgba(3, 4, 3, 0.88);
  backdrop-filter: blur(14px);
}

.tab-button,
.filter-chip,
.primary-action,
.secondary-action,
.admin-subtab,
.admin-actions button,
.initiative-card button {
  border-radius: var(--ui-radius-sm);
  letter-spacing: 0;
}

.tab-button {
  min-width: 98px;
  min-height: 42px;
  padding: 0 22px;
}

.filter-chip {
  min-height: 44px;
}

.tab-button,
.filter-chip,
.secondary-action,
.admin-subtab {
  border-color: var(--ui-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(1, 2, 1, 0.88);
  color: rgba(255, 255, 255, 0.92);
}

.tab-button.active,
.filter-chip.active {
  border-color: rgba(255, 255, 255, 0.88);
  background: #ffffff;
  color: #030403;
  box-shadow:
    inset 0 -4px 0 var(--acid),
    0 14px 28px rgba(0, 0, 0, 0.34);
}

.primary-action {
  border-color: rgba(200, 255, 46, 0.72);
  background:
    linear-gradient(180deg, #e0ff66, var(--acid));
  color: #030403;
}

.tab-button:hover,
.filter-chip:hover,
.primary-action:hover,
.secondary-action:hover,
.admin-subtab:hover,
.initiative-card button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(200, 255, 46, 0.18);
}

.review-layout {
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 12px;
}

.control-panel {
  border-color: var(--ui-border);
  background: rgba(3, 4, 3, 0.62);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.34);
}

.panel-block {
  padding: 16px;
}

.filter-list {
  gap: 9px;
}

.impact-mini div,
.feed-card,
.admin-card,
.activity-list div,
.rules-list div,
.leaderboard-card,
.initiative-card,
.vote-tree-node,
.selected-story-stats span {
  border-radius: var(--ui-radius-sm);
  border-color: var(--ui-border);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 52%),
    rgba(2, 3, 2, 0.78);
}

.map-panel {
  padding: 10px;
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  background:
    radial-gradient(circle at 50% 45%, rgba(200, 255, 46, 0.06), transparent 48%),
    rgba(3, 4, 3, 0.55);
}

.map-frame {
  border-radius: var(--ui-radius);
  border-color: var(--ui-border-strong);
  overflow: hidden;
  box-shadow:
    0 24px 76px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.map-inner-frame,
.pixel-map,
.pixel-map-art {
  border-radius: inherit;
}

.pixel-map-art {
  opacity: 0.78;
  filter: brightness(0.78) contrast(0.72) saturate(0.84);
}

.map-stats-overlay {
  top: 12px;
  right: 12px;
  gap: 8px;
}

.map-stats span {
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--ui-radius-sm);
  border-color: rgba(200, 255, 46, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(2, 3, 2, 0.84);
  color: var(--acid);
  backdrop-filter: blur(8px);
}

.pixel-story-tile {
  border-radius: 1px;
  border-color: rgba(229, 210, 174, 0.34);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(0, 0, 0, 0.28);
}

.pixel-story-tile:hover,
.pixel-story-tile:focus-visible {
  transform: scale(1.7);
}

input,
select,
textarea {
  border-radius: var(--ui-radius-sm);
}

.story-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

@media (max-width: 980px) {
  .stories-shell {
    padding: 10px;
  }

  .review-hero {
    grid-template-columns: 1fr;
  }

  .brand-card,
  .impact-card {
    min-height: auto;
  }

  .app-tabs {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .tab-button {
    min-width: max-content;
  }

  .review-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .control-panel {
    max-height: none;
    overflow: visible;
  }
}

/* Website-aligned contrast pass: reduce fluorescent accents and keep text contained */
:root {
  --acid: #9f927f;
  --acid-soft: rgba(159, 146, 127, 0.24);
  --site-ink: #ece8df;
  --site-muted: #9d968d;
  --site-line: rgba(219, 211, 198, 0.18);
  --site-line-strong: rgba(219, 211, 198, 0.32);
  --site-panel: rgba(4, 4, 4, 0.86);
}

body {
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(circle at 70% 88%, rgba(96, 42, 28, 0.18), transparent 28%),
    #000;
  background-size: 78px 78px, 78px 78px, auto, auto;
  color: var(--site-ink);
}

.review-hero,
.app-tabs,
.control-panel,
.map-panel,
.feed-panel,
.brand-card,
.impact-card,
.panel-block,
.impact-mini div,
.impact-update-card {
  border-color: var(--site-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.032), transparent 52%),
    var(--site-panel);
}

.eyebrow,
.panel-block .eyebrow,
.feed-header .eyebrow {
  color: #b7aa95;
}

.eyebrow::before {
  border-color: #b7aa95;
}

h1,
h2,
.impact-card strong,
.impact-mini strong {
  color: var(--site-ink);
}

.review-hero p:last-child,
.brand-card span,
.impact-card span,
.impact-card small,
.story-meta,
.detection-card span,
.impact-update-card p {
  color: var(--site-muted);
}

.tab-button,
.filter-chip,
.secondary-action,
.admin-subtab {
  border-color: var(--site-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008)),
    rgba(0, 0, 0, 0.88);
  color: #d8d3ca;
  text-shadow: none;
}

.tab-button.active,
.filter-chip.active {
  border-color: var(--site-line-strong);
  background:
    linear-gradient(180deg, rgba(232, 226, 216, 0.18), rgba(232, 226, 216, 0.07)),
    rgba(0, 0, 0, 0.94);
  color: #f1eee8;
  box-shadow:
    inset 0 -3px 0 rgba(183, 170, 149, 0.72),
    0 14px 28px rgba(0, 0, 0, 0.28);
}

.tab-button:hover,
.filter-chip:hover,
.primary-action:hover,
.secondary-action:hover,
.admin-subtab:hover,
.initiative-card button:hover {
  border-color: rgba(219, 211, 198, 0.36);
  background:
    linear-gradient(180deg, rgba(232, 226, 216, 0.12), rgba(232, 226, 216, 0.035)),
    rgba(0, 0, 0, 0.92);
  color: #f1eee8;
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(219, 211, 198, 0.08);
}

.primary-action {
  border-color: rgba(219, 211, 198, 0.34);
  background:
    linear-gradient(180deg, #d8d1c5, #aaa092);
  color: #050505;
}

.map-panel {
  background:
    radial-gradient(circle at 50% 45%, rgba(219, 211, 198, 0.035), transparent 50%),
    rgba(0, 0, 0, 0.64);
}

.map-frame {
  border-color: var(--site-line-strong);
}

.pixel-map-art {
  opacity: 0.78;
  filter: brightness(0.78) contrast(0.72) saturate(0.84);
}

.map-stats-overlay {
  top: 14px;
  right: 14px;
  left: auto;
  max-width: min(420px, calc(100% - 28px));
}

.map-stats {
  gap: 8px;
  align-items: stretch;
  justify-content: flex-end;
}

.map-stats span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 13px;
  border-color: rgba(219, 211, 198, 0.26);
  background:
    linear-gradient(180deg, rgba(232, 226, 216, 0.08), rgba(232, 226, 216, 0.02)),
    rgba(0, 0, 0, 0.78);
  color: #d4cabd;
  font-size: clamp(0.58rem, 0.66vw, 0.68rem);
  line-height: 1.05;
  text-align: center;
  white-space: normal;
  overflow-wrap: normal;
  text-shadow: none;
}

#tokenCount {
  min-width: 170px;
}

.impact-mini div {
  min-width: 0;
}

.impact-mini span,
.impact-mini strong {
  overflow-wrap: anywhere;
}

/* Interactive map viewport */
.map-inner-frame {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-frame.is-panning .map-inner-frame {
  cursor: grabbing;
}

.pixel-map {
  transform-origin: center center;
  will-change: transform;
  transition: transform 120ms ease-out;
}

.map-frame.is-panning .pixel-map,
.map-frame.is-pinching .pixel-map {
  /* Remove transition during active pan/pinch — each frame would restart a
     120 ms animation, making gestures feel laggy on real devices. */
  transition: none;
}

.map-frame.is-zoomed .map-gesture-hint {
  opacity: 0;
}

.map-controls {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 24;
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(219, 211, 198, 0.18);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}

.map-controls button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(219, 211, 198, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(232, 226, 216, 0.1), rgba(232, 226, 216, 0.025)),
    rgba(0, 0, 0, 0.86);
  color: #d8d3ca;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.map-controls button:hover {
  border-color: rgba(219, 211, 198, 0.38);
  color: #f1eee8;
}

.map-gesture-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 23;
  padding: 7px 10px;
  border: 1px solid rgba(219, 211, 198, 0.14);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: rgba(236, 232, 223, 0.62);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 160ms ease;
}

@media (max-width: 760px) {
  .stories-shell {
    padding: 8px;
  }

  .review-hero {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .brand-card {
    min-height: 84px;
    padding: 8px;
  }

  .brand-card img {
    width: 46px;
  }

  .brand-card span {
    font-size: 0.58rem;
  }

  .review-hero > div:nth-child(2) {
    min-width: 0;
  }

  .review-hero .impact-card,
  .impact-card {
    grid-column: 1 / -1;
    min-height: auto;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3.35rem);
    line-height: 0.9;
  }

  .review-hero p:last-child {
    font-size: 0.78rem;
    line-height: 1.28;
  }

  .app-tabs {
    justify-content: flex-start;
    width: 100%;
    margin: 10px 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    min-width: max-content;
    min-height: 40px;
    padding: 0 16px;
    font-size: 0.76rem;
  }

  .review-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: auto;
    min-height: 0;
  }

  .map-panel {
    order: 1;
    width: 100%;
    align-self: stretch;
    padding: 7px;
  }

  .control-panel {
    order: 2;
    width: 100%;
    align-self: stretch;
  }

  .map-frame {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .map-stats-overlay {
    top: 10px;
    right: 10px;
    max-width: calc(100% - 92px);
  }

  .map-stats span {
    min-width: 78px;
    min-height: 30px;
    padding: 6px 9px;
    font-size: 0.55rem;
  }

  #tokenCount {
    min-width: 126px;
  }

  .map-controls {
    top: 10px;
    left: 10px;
    gap: 5px;
    padding: 5px;
  }

  .map-controls button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .map-gesture-hint {
    left: 10px;
    bottom: 10px;
    font-size: 0;           /* hide desktop text */
  }

  /* Replace with touch-appropriate wording on mobile */
  .map-gesture-hint::after {
    content: "Touch to pan · Pinch to zoom";
    font-size: 0.54rem;
  }

  .panel-block {
    padding: 12px;
  }

  .filter-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-chip {
    min-height: 38px;
    font-size: 0.74rem;
  }

  .impact-mini {
    grid-template-columns: 1fr;
  }

  .impact-update-card {
    grid-template-columns: 1fr;
  }

  .admin-toolbar,
  .impact-admin-form {
    align-items: stretch;
    flex-direction: column;
  }

  .impact-admin-form {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .review-hero {
    grid-template-columns: 1fr;
  }

  .brand-card {
    grid-template-columns: 52px 1fr;
    align-items: center;
  }

  .map-frame {
    min-height: 0;
  }

  .map-stats-overlay {
    top: 50px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .map-stats {
    justify-content: flex-start;
  }
}

/* Gamified tile claiming */
.tile-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  background:
    linear-gradient(135deg, rgba(213, 173, 97, 0.08), transparent 60%),
    rgba(4, 5, 4, 0.78);
}

.tile-picker-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.tile-picker h3 {
  margin: 2px 0 0;
  color: var(--paper);
  font-size: 1rem;
  line-height: 1.05;
  text-transform: uppercase;
}

.tile-picker-head span {
  max-width: 260px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
  text-transform: uppercase;
}

.tile-picker-grid {
  position: relative;
  width: 100%;
  aspect-ratio: 1672 / 941;
  min-height: 180px;
  overflow: hidden;
  border: 1px solid rgba(235, 224, 198, 0.12);
  border-radius: var(--ui-radius-sm);
  background: #020202;
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.74);
}

.tile-picker-map-art,
.tile-picker-tile-layer {
  position: absolute;
  inset: 0;
}

.tile-picker-map-art {
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.5;
  filter: brightness(0.66) contrast(0.82) saturate(0.78);
  pointer-events: none;
  user-select: none;
}

.tile-picker-tile-layer {
  z-index: 2;
}

.tile-cell-option {
  position: absolute;
  left: var(--cell-left);
  top: var(--cell-top);
  width: var(--cell-width);
  height: var(--cell-height);
  min-width: 0;
  padding: 0;
  border: 1px solid rgba(214, 170, 91, 0.34);
  border-radius: 1px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    background-color 120ms ease;
}

.tile-cell-option.open {
  border-color: rgba(135, 172, 102, 0.88);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 52%),
    rgba(82, 132, 82, 0.86);
  box-shadow:
    inset 0 0 0 1px rgba(196, 231, 174, 0.22),
    0 0 5px rgba(116, 158, 90, 0.18);
}

.tile-cell-option.occupied {
  z-index: 3;
  border-color: rgba(190, 77, 61, 0.9);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 52%),
    rgba(165, 55, 44, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(242, 177, 160, 0.18),
    0 0 5px rgba(190, 77, 61, 0.2);
}

.tile-cell-option.outside-placement {
  cursor: default;
  border-color: rgba(229, 210, 174, 0.12);
  background: rgba(229, 210, 174, 0.05);
  box-shadow: none;
  opacity: 0.38;
}

.tile-cell-option.active {
  z-index: 5;
  border-color: rgba(235, 224, 198, 0.98);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.3), transparent 52%),
    rgba(196, 154, 88, 0.94);
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.68),
    0 0 16px rgba(214, 170, 91, 0.48);
}

.tile-cell-option:not(:disabled):hover,
.tile-cell-option:not(:disabled):focus-visible {
  z-index: 6;
  border-color: rgba(235, 224, 198, 0.96);
  outline: none;
  transform: scale(1.9);
  transform-origin: center;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.72),
    0 0 18px rgba(235, 224, 198, 0.34);
}

.map-cycle-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.map-cycle-panel p:last-child {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 760px) {
  .tile-picker-head,
  .map-cycle-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .tile-picker-head span {
    max-width: none;
    text-align: left;
  }
}

/* Hero brand lockup: logo-only card */
.brand-card {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 10px;
}

.brand-card img {
  width: min(100%, 122px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--ui-radius-sm);
}

/* Responsive map viewport: fill the browser space while preserving the pixel map ratio. */
.review-layout {
  align-items: stretch;
  height: clamp(560px, calc(100dvh - 250px), 900px);
  min-height: 560px;
}

.control-panel,
.map-panel {
  align-self: stretch;
}

.map-panel {
  display: grid;
  min-height: 0;
  padding: 10px;
}

.map-frame {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
}

.map-inner-frame {
  display: grid;
  inset: 10px;
  place-items: center;
  padding: 0;
  width: auto;
  height: auto;
}

.pixel-map {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1672 / 941;
  transform-origin: center;
}

.impact-mini {
  align-content: start;
}

@media (max-width: 760px) {
  .brand-card {
    min-height: 78px;
  }

  .brand-card img {
    width: min(100%, 72px);
  }

  .review-layout {
    height: auto;
    min-height: 0;
  }

  .map-panel {
    height: auto;
    min-height: 360px;
    grid-template-rows: minmax(0, 1fr);
    padding: 6px;
  }

  .map-frame {
    height: clamp(430px, 72dvh, 680px) !important;
    min-height: 0;
    max-height: none;
  }

  .public-impact-panel .impact-timeline {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  .stories-shell {
    padding: 6px;
  }

  .stories-shell:has(#mapView.view.active) .review-hero {
    display: none;
  }

  .stories-shell:has(#mapView.view.active) .app-tabs {
    margin: 0;
  }

  #mapView.view.active {
    min-height: calc(100dvh - 58px);
  }

  #mapView .review-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - 58px);
    min-height: 0;
    gap: 0;
    margin-top: 6px;
  }

  #mapView .control-panel,
  #mapView .feed-panel {
    display: none !important;
  }

  #mapView .map-panel {
    height: 100%;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    padding: 6px;
  }

  #mapView .map-frame {
    height: 100% !important;
    min-height: 0;
  }
}

/* Admin voting layout repair: keep admin sections full-width and prevent sticky nav overlap. */
.stories-shell:has(#adminView.view.active) .app-tabs {
  position: relative;
  top: auto;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.admin-panel,
.admin-panel.active {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.admin-voting-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.admin-voting-panel > .eyebrow,
.admin-voting-panel > h2,
.admin-voting-panel > .admin-helper-copy {
  max-width: 920px;
}

.admin-helper-copy {
  margin-bottom: 0;
}

.impact-cycle-admin {
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  align-items: start;
  min-width: 0;
}

.impact-cycle-admin > div {
  min-width: 0;
}

.impact-cycle-admin .setup-step {
  white-space: nowrap;
}

.impact-cycle-admin strong {
  max-width: none;
  overflow-wrap: normal;
}

.impact-cycle-admin p {
  max-width: 820px;
}

.impact-cycle-admin .admin-actions {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
}

.impact-cycle-admin .admin-actions button {
  width: min(280px, 100%);
  min-height: 48px;
}

.voting-admin-step-live {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
}

.voting-stage-summary,
.voting-preset-grid {
  width: 100%;
  min-width: 0;
}

@media (max-width: 760px) {
  .impact-cycle-admin,
  .voting-admin-step-live {
    grid-template-columns: minmax(0, 1fr);
  }

  .impact-cycle-admin .admin-actions {
    justify-content: stretch;
  }

  .impact-cycle-admin .admin-actions button {
    width: 100%;
  }
}

/* ── Upload progress overlay ─────────────────────────────────────────────── */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-overlay[hidden] { display: none; }

.upload-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding: 2.5rem 2rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  max-width: 320px;
  width: 90%;
}

.upload-spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: upload-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes upload-spin {
  to { transform: rotate(360deg); }
}

.upload-overlay-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.upload-overlay-sub {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.5;
}

/* ── Shopify purchase gate overlay ───────────────────────────────────────── */
.shopify-gate {
  position: relative;
  z-index: 10;
  margin: 0 0 1.5rem;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, #fdf6ee 0%, #fff9f3 100%);
  border: 1px solid #e8d5b7;
  border-radius: 12px;
  text-align: center;
}

.shopify-gate-inner {
  max-width: 400px;
  margin: 0 auto;
}

.shopify-gate-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.shopify-gate-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.01em;
}

.shopify-gate-body {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.55;
}

.shopify-gate-btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: #1a1a1a;
  color: #fff;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.shopify-gate-btn:hover {
  background: #333;
}

/* ── Map-widget mode (?mode=map) ─────────────────────────────────────────────
   Applied when the page is embedded as a home-page widget.
   Hides the tab nav and fills the viewport with banner + map only.           */
[data-mode="map"] body,
[data-mode="map"] .stories-shell {
  height: 100%;
  overflow: hidden;
}

[data-mode="map"] .app-tabs {
  display: none !important;
}

/* Give the map view all remaining height after the banner */
[data-mode="map"] #mapView {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - var(--hero-height, 180px));
}

[data-mode="map"] .map-frame {
  flex: 1;
  height: 100% !important;
  min-height: 320px;
}

/* ── Mobile banner: compact but visible ──────────────────────────────────────
   Switch .review-hero to flex on mobile — sidesteps the ≤1240px grid collapse.
   Shows logo + title + impact amount in one row; hides verbose description.    */
@media (max-width: 760px) {
  .review-hero {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 8px !important;
    min-height: 0 !important;
  }

  /* Brand logo — fixed narrow column */
  .review-hero .brand-card {
    flex: 0 0 62px !important;
    width: 62px !important;
    min-height: 64px !important;
    padding: 8px !important;
  }

  .review-hero .brand-card img {
    width: 40px !important;
  }

  /* Title area — grows to fill remaining space */
  .review-hero > div:not(.brand-card):not(.impact-card) {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 8px 0 !important;
  }

  .review-hero h1 {
    font-size: clamp(1rem, 4vw, 1.5rem) !important;
    margin-bottom: 4px !important;
  }

  /* Description text — smaller so it fits the narrow middle column */
  .review-hero > div > p:last-child {
    display: block !important;
    font-size: 0.72rem !important;
    line-height: 1.4 !important;
    color: rgba(247, 242, 232, 0.65) !important;
    margin: 0 !important;
  }

  /* Impact amount — fixed width on the right */
  .review-hero .impact-card {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-height: 64px !important;
    padding: 8px 10px !important;
  }

  .review-hero .impact-card strong {
    font-size: 1.5rem !important;
    line-height: 1 !important;
  }

  /* Account for the compact banner — map gets adjusted height */
  .map-frame {
    height: clamp(320px, 58svh, 520px) !important;
  }
}

@media (max-width: 430px) {
  .review-hero .impact-card {
    flex-basis: 94px !important;
    width: 94px !important;
  }

  .map-frame {
    height: clamp(280px, 55svh, 420px) !important;
  }
}
