/* /vote: two voting panels (sub goals, variety games). Mobile first. */

/* The backdrop fades into the page color exactly where the image ends, so there is no hard edge. */
body.vote-page {
  background:
    linear-gradient(180deg, rgba(18, 18, 20, 0.55) 0, var(--bg) 460px) center top / 100% 460px no-repeat,
    url('/assets/hero-bg-960.webp') center top / auto 460px no-repeat,
    var(--bg);
}
@media (min-width: 700px) {
  body.vote-page {
    background:
      linear-gradient(180deg, rgba(18, 18, 20, 0.5) 0, var(--bg) 640px) center top / 100% 640px no-repeat,
      url('/assets/hero-bg-1920.webp') center top / max(100%, 1140px) 640px no-repeat,
      var(--bg);
  }
}

.hub {
  width: calc(100% - var(--gutter) * 2);
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 0 0;
}

.hub-heading {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}
.hub-title { display: flex; align-items: center; gap: 4px; }
.hub-title h1 {
  color: var(--red-bright);
  font-weight: 700;
  font-size: clamp(1.15rem, 4.6vw, 1.45rem);
  letter-spacing: 0.08em;
  line-height: 1.2;
}
.hub-help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.hub-help-toggle:hover, .hub-help-toggle[aria-expanded='true'] { color: var(--text); }
.hub-help-toggle .icon { width: 20px; height: 20px; }
.hub-help {
  max-width: 720px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--red-bright);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.hub-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.hub-account-info { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hub-account-info .signed-in { font-weight: 600; font-size: 0.92rem; }
.hub-account-info .signed-in strong { color: var(--text); }
.hub-demo-hint { flex-basis: 100%; color: var(--faint); font-size: 0.8rem; }

@media (min-width: 1000px) {
  .hub { padding-top: 40px; }
  .hub-heading { grid-template-columns: 1fr auto; align-items: center; margin-bottom: 28px; }
  .hub-help { grid-column: 1 / -1; grid-row: 2; }
  .hub-account { justify-content: flex-end; }
  .hub-demo-hint { text-align: right; }
}

/* ---------- Panels ---------- */

.hub-columns { display: grid; gap: 20px; }
@media (min-width: 1000px) {
  .hub-columns { grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
}

.hub-panel {
  min-width: 0;
  padding: 18px 14px 10px;
  background: rgba(30, 33, 32, 0.94);
}
@media (min-width: 700px) {
  .hub-panel { padding: 24px 24px 14px; }
}

.hub-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.hub-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 200px;
  max-width: 260px;
}
.hub-search > .icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.hub-search input {
  width: 100%;
  min-height: 44px;
  padding: 8px 40px 8px 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.3);
  font-size: 1rem;
}
.hub-search input::-webkit-search-cancel-button { display: none; }
.hub-search input:focus { outline: none; border-color: var(--red-bright); }
.hub-search button {
  position: absolute;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.hub-search button .icon { width: 14px; height: 14px; }

.hub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line-strong);
}
.hub-views {
  display: flex;
  gap: 4px;
  margin-bottom: -1px;
  overflow-x: auto;
  scrollbar-width: none;
}
.hub-views button {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-bottom-color: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}
.hub-views button:hover { color: var(--text); }
.hub-views button[aria-pressed='true'] {
  background: var(--card);
  color: var(--red-bright);
  border-bottom-color: var(--card);
}
.hub-balance { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; font-size: 0.85rem; color: var(--muted); }
.hub-balance b { color: var(--text); font-size: 1rem; }
.hub-my-votes {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.hub-my-votes[aria-pressed='true'] { border-color: var(--red-bright); background: var(--red-soft); }

@media (max-width: 420px) {
  .hub-views button { padding: 0 9px; font-size: 0.8rem; }
}

/* ---------- Rows ---------- */

.hub-list { padding-top: 4px; }
@media (min-width: 1000px) {
  .hub-list {
    height: 560px;
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--red) transparent;
  }
}

.hub-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.hub-row[data-ranked] { grid-template-columns: 32px minmax(0, 1fr) auto; }
.hub-rank { color: var(--red-bright); font-weight: 800; font-variant-numeric: tabular-nums; }
.hub-row-text { min-width: 0; }
.hub-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hub-row-meta .icon { width: 11px; height: 11px; }
.hub-locked { display: inline-flex; align-items: center; gap: 4px; padding-left: 6px; border-left: 1px solid var(--line-strong); }
.hub-row-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.95rem; line-height: 1.3; overflow-wrap: anywhere; }
.hub-row-title a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -10px -10px -6px;
  flex: none;
  color: var(--muted);
}
.hub-row-title a:hover { color: var(--text); }
.hub-row-title a .icon { width: 13px; height: 13px; }
.hub-row-sub { margin-top: 2px; color: var(--muted); font-size: 0.8rem; }

.hub-total {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 56px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.hub-total .icon { width: 18px; height: 18px; color: var(--red-bright); transition: transform 0.15s; }
.hub-total:hover .icon { transform: scale(1.15); }

.hub-stepper { display: flex; align-items: center; gap: 2px; }
.hub-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.hub-stepper button .icon { width: 14px; height: 14px; }
.hub-stepper button:hover:not([aria-disabled='true']) { border-color: var(--red-bright); background: var(--red-soft); }
.hub-stepper button:active:not([aria-disabled='true']) { transform: scale(0.94); }
.hub-stepper button[aria-disabled='true'] { opacity: 0.35; cursor: not-allowed; }
.hub-stepper output { min-width: 26px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.hub-stepper output[data-mine='true'] { color: var(--red-bright); }

.hub-row.bump .hub-total { animation: heart 0.4s ease; }
@keyframes heart { 40% { transform: scale(1.18); } }

.hub-empty { padding: 32px 8px; text-align: center; color: var(--muted); }

/* Phones: title on its own line, controls below, so 360px never overflows */
@media (max-width: 479px) {
  .hub-row:not([data-ranked]) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'text text' 'total stepper';
    row-gap: 6px;
  }
  .hub-row:not([data-ranked]) .hub-row-text { grid-area: text; }
  .hub-row:not([data-ranked]) .hub-total { grid-area: total; justify-content: flex-start; }
  .hub-row:not([data-ranked]) .hub-stepper { grid-area: stepper; }
}

/* ---------- Dialogs ---------- */

.voters-item-title { margin-bottom: 12px; font-weight: 700; }
.voters-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.voters-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.voters-list li span:last-child { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.voters-list .icon { width: 14px; height: 14px; color: var(--red-bright); }

.suggest-form { display: grid; gap: 16px; }
.suggest-notice { padding: 10px 12px; background: var(--red-soft); border-left: 3px solid var(--red-bright); font-size: 0.9rem; }
.suggest-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.suggest-error { color: #ff6b6b; font-weight: 600; font-size: 0.9rem; }
.my-suggestions summary { min-height: 44px; display: flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; }
.my-suggestions ul { list-style: none; margin: 0; padding: 0; }
.my-suggestions li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
