/* The look of every page: colours and shapes, the bar on top with the
   tabs and the account, buttons and chips, and posters. What lies over the
   pages is in layers.css, and each page has its own sheet besides. */

:root {
  /* Brand */
  --purple: #742a85;
  --purple-deep: #4a1458;
  --gold: #f5b436;
  --pink: #ff6b9a;

  /* Surfaces */
  --bg: #f6f1f8;
  --card: #fff;
  --card-alt: #efe7f3;
  --card-selected: #f4ebf8;
  --border: #e3d6ea;

  /* Text */
  --text-strong: #1d1029;
  --text: #3b2b4a;
  --text-muted: #7d6b8c;

  /* Accents */
  --accent: var(--gold);
  --accent-bg: #f5b43624;
  /* What a tap votes for, lit under the pointer. */
  --vote-bg: #f5b43659;
  --accent-border: #f5b43670;
  --danger: #e03131;

  /* Wins and losses, as the matrices draw them */
  --win: #1fa463;
  --win-bg: #e3f6ec;
  --loss: #e5484d;
  --loss-bg: #fde7e8;
  --matrix-diag: #e8e0ed;
  --matrix-neutral: #e8e4ed;
  --matrix-legacy: #b8860b;
  --matrix-legacy-bg: #fdf3dc;
  --matrix-tie: #6f6080;
  --matrix-tie-bg: #ddd7e6;

  /* Shapes and motion */
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow-s: 0 1px 2px rgb(29 16 41 / 6%), 0 3px 10px rgb(29 16 41 / 6%);
  --shadow: 0 2px 6px rgb(29 16 41 / 6%), 0 12px 32px rgb(29 16 41 / 11%);
  --shadow-l: 0 24px 70px rgb(29 16 41 / 25%);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --header-h: 60px;
}
@media (max-width: 719px) {
  :root {
    --header-h: 56px;
  }
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 105% -8%, #f5b43626, transparent 62%),
    radial-gradient(800px 520px at -12% 108%, #742a851c, transparent 62%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body.sheet-open {
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
}
input {
  font: inherit;
}
.icon {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
}

/* THE BAR ON TOP: the name, the tabs in the middle, the account. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: rgb(255 255 255 / 78%);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgb(227 214 234 / 70%);
}
.brand {
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  text-align: left;
}
.brand-name {
  display: block;
  font-weight: 800;
  font-size: 17px;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The tabs: only the page shown says its name. */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--card-alt);
  border-radius: 999px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  font-weight: 750;
  font-size: 14px;
  color: var(--text-muted);
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
@media (hover: hover) {
  .tab:hover {
    color: var(--text-strong);
  }
}
.tab.active {
  padding: 8px 15px 8px 13px;
  background: var(--card);
  color: var(--purple);
  box-shadow: var(--shadow-s);
}
.tab:not(.active) .tab-label {
  display: none;
}
.tab-icon {
  position: relative;
  display: flex;
}
.tab .icon {
  width: 18px;
  height: 18px;
}
.pulse {
  position: absolute;
  top: -2px;
  right: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink);
  animation: ping 1.8s ease-out infinite;
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgb(255 107 154 / 60%);
  }
  80%,
  100% {
    box-shadow: 0 0 0 9px rgb(255 107 154 / 0%);
  }
}

.account-btn {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px;
  border-radius: 999px;
  transition: transform 0.2s var(--spring);
}
.account-btn:active {
  transform: scale(0.94);
}
.account-btn:not(.known) {
  padding: 3px 14px 3px 3px;
  background: var(--purple);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 14px rgb(116 42 133 / 32%);
}
.account-btn:not(.known) .avatar-blank {
  background: rgb(255 255 255 / 18%);
  color: #fff;
}
.account-btn.known .avatar {
  box-shadow:
    0 0 0 2px var(--card),
    0 0 0 4px var(--gold);
}
.avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  font-weight: 850;
  font-size: 15px;
}
.avatar-initial {
  background: linear-gradient(135deg, hsl(var(--hue) 70% 60%), hsl(calc(var(--hue) + 35) 70% 44%));
  color: #fff;
}
.avatar-blank {
  background: var(--card-alt);
  color: var(--text-muted);
}
.avatar-blank .icon {
  width: 55%;
  height: 55%;
}

/* On a phone the tabs move beside the account, and the account is its
   face alone. */
@media (max-width: 719px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 0 12px 0 14px;
  }
  .account-btn:not(.known) {
    padding: 3px;
  }
  .account-label {
    display: none;
  }
}

/* PAGES */
.page {
  display: none;
}
.page.active {
  display: block;
  animation: page-in 0.35s var(--ease-out);
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* BUTTONS, CHIPS, TITLES */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffcd57, var(--gold));
  color: var(--text-strong);
  font-weight: 850;
  font-size: 16px;
  box-shadow: 0 6px 18px rgb(245 180 54 / 45%);
  transition:
    transform 0.2s var(--spring),
    box-shadow 0.2s,
    opacity 0.2s;
}
@media (hover: hover) {
  .cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 9px 24px rgb(245 180 54 / 52%);
  }
}
.cta:active {
  transform: scale(0.97);
}
.cta:disabled {
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-weight: 750;
  font-size: 14px;
  text-decoration: none;
}
@media (hover: hover) {
  .ghost-btn:hover {
    color: var(--text-strong);
    border-color: var(--text-muted);
  }
}
.ghost-btn.danger {
  color: var(--danger);
  border-color: #f3c4c6;
}
.mini-btn {
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--card-alt);
  color: var(--text);
  font-weight: 750;
  font-size: 13px;
  white-space: nowrap;
}
@media (hover: hover) {
  .mini-btn:hover {
    color: var(--text-strong);
  }
}
.mini-btn:disabled {
  opacity: 0.4;
}
.round-btn {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-s);
  transition:
    transform 0.2s var(--spring),
    opacity 0.2s;
}
.round-btn .icon {
  width: 22px;
  height: 22px;
}
@media (hover: hover) {
  .round-btn:hover {
    color: var(--purple);
  }
}
.round-btn:active {
  transform: scale(0.88) rotate(-8deg);
}
.round-btn:disabled {
  opacity: 0.35;
  transform: none;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--purple);
  font-weight: 750;
  font-size: 14px;
  text-decoration: none;
}
@media (hover: hover) {
  .link-btn:hover {
    background: var(--card-alt);
  }
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  max-width: 100%;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-s);
  font-weight: 750;
  font-size: 14px;
}
.chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip .icon {
  width: 17px;
  height: 17px;
  color: var(--purple);
}
.chip-on {
  padding: 0;
  background: var(--purple);
  color: #fff;
}
.chip-on .icon {
  color: var(--gold);
}
.chip-main {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  min-width: 0;
  padding: 0 4px 0 14px;
}
.chip-x {
  display: grid;
  place-items: center;
  width: 36px;
  height: 100%;
}
.chip-x .icon {
  color: #fff;
}
.badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: #94650a;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}
.section-title {
  font-size: 20px;
  font-weight: 850;
  color: var(--text-strong);
  letter-spacing: -0.015em;
}
.sub-title {
  margin: 22px 0 10px;
  font-size: 15px;
  font-weight: 850;
  color: var(--text-strong);
}
.fine-print {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
.form-error {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}
.tally-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--card-alt);
  overflow: hidden;
}
.tally-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--pink), var(--gold));
  transition: width 0.6s var(--ease-out);
}
@keyframes bump {
  30% {
    transform: scale(1.35);
  }
}
@keyframes wiggle {
  0%,
  70%,
  100% {
    transform: rotate(0);
  }
  80% {
    transform: rotate(-10deg) scale(1.06);
  }
  90% {
    transform: rotate(8deg) scale(1.06);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(12px);
  }
}

/* POSTERS, and the tile standing in for a missing one */
.poster,
.poster-ph {
  display: block;
  width: var(--pw, 100%);
  aspect-ratio: 2 / 3;
  border-radius: inherit;
}
.poster {
  height: auto;
  object-fit: cover;
  background: var(--card-alt);
  -webkit-user-drag: none;
  user-select: none;
}
.poster-ph {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(150deg, hsl(var(--hue) 82% 67%), hsl(calc(var(--hue) + 45) 70% 43%));
}
.poster-ph::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 28% 18%, rgb(255 255 255 / 38%), transparent 58%);
}
.poster-ph span {
  position: relative;
  z-index: 1;
  font-weight: 900;
  font-size: 34cqw;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 14px rgb(0 0 0 / 20%);
}
.poster-stack {
  position: relative;
  display: block;
  border-radius: inherit;
}
.poster-stack .poster {
  position: absolute;
  inset: 0;
  height: 100%;
}
