/* Project styles on top of Pico. The look is shared with Sprint Paddock: deep navy, slate blue
   for the brand and links, warm orange for the main action. Card colours only mean card colours. */

:root {
  --card-red: #e5484d;
  --card-blue: #3b82f6;
  --card-yellow: #f5c518;
  --card-green: #2fa866;
  --card-black: #23252b;
  --card-purple: #8b5cf6;
  --card-white: #eceae4;
  --card-size: 135px;
  --side-column: clamp(13rem, 17vw, 20rem);

  --cta-color: #d9774a;
  --cta-hover: #c9683c;
  --gold: #e6b325;
  --silver: #aab4bd;
  --bronze: #c1793a;
  --display-font: "Michroma", "Segoe UI", Roboto, "Yu Gothic", "Noto Sans CJK JP", sans-serif;
}

/* :root raises these above Pico's own theme rules, whatever order the two files load in. */
:root[data-theme="dark"] {
  --pico-background-color: #13171f;
  --pico-color: #c2c7d0;
  --pico-muted-color: #94a3b8;
  --pico-muted-border-color: #2d3a4a;
  --pico-h1-color: #e2e8f0;
  --pico-h2-color: #e2e8f0;
  --pico-h3-color: #e2e8f0;
  --pico-h4-color: #e2e8f0;
  --pico-h5-color: #e2e8f0;
  --pico-h6-color: #e2e8f0;
  --pico-card-background-color: #1e293b;
  --pico-card-sectioning-background-color: #1a2332;
  --pico-card-border-color: #2d3a4a;
  --pico-dropdown-background-color: #1e293b;
  --pico-dropdown-border-color: #2d3a4a;
  --pico-dropdown-hover-background-color: #2d3a4a;
  --pico-form-element-background-color: #1a2332;
  --pico-form-element-active-background-color: #1e293b;
  --pico-form-element-border-color: #2d3a4a;
  --pico-table-border-color: #2d3a4a;
  --pico-primary: #6b8cbe;
  --pico-primary-background: #4a6fa5;
  --pico-primary-border: #4a6fa5;
  --pico-primary-underline: rgba(107, 140, 190, 0.5);
  --pico-primary-hover: #8aa6cf;
  --pico-primary-hover-background: #5a7fb5;
  --pico-primary-hover-border: #5a7fb5;
  --pico-primary-hover-underline: #8aa6cf;
  --pico-primary-focus: rgba(107, 140, 190, 0.4);
  --pico-primary-inverse: #fff;
  --brand-title: #6b8cbe;
  --header-background: #13171f;
  --banner-background: #2c3e6b;
  --banner-color: #e2e8f0;
  --banner-link: #f2b89c;
  --accent-text: #e8926a;
  --tile-color: #4d8bf5;
  --overlay: linear-gradient(rgba(10, 16, 28, 0.72), rgba(10, 16, 28, 0.86));
  --hero-background: #1a2332;
  --hero-color: #c2c7d0;
  --gold-text: var(--gold);
  --silver-text: var(--silver);
  --bronze-text: var(--bronze);
  --tile-border: #2d3a4a;
  --text: #e2e8f0;
  --card-outline: rgba(255, 255, 255, 0.25);
}

:root[data-theme="light"] {
  --pico-background-color: #f1f4f8;
  --pico-color: #334155;
  --pico-muted-color: #475569;
  --pico-muted-border-color: #d6e0ea;
  --pico-h1-color: #1f2937;
  --pico-h2-color: #1f2937;
  --pico-h3-color: #1f2937;
  --pico-h4-color: #1f2937;
  --pico-h5-color: #1f2937;
  --pico-h6-color: #1f2937;
  --pico-card-background-color: #f8fafc;
  --pico-card-sectioning-background-color: #eef3f8;
  --pico-card-border-color: #d6e0ea;
  --pico-dropdown-background-color: #f8fafc;
  --pico-dropdown-border-color: #d6e0ea;
  --pico-dropdown-hover-background-color: #eef3f8;
  --pico-form-element-background-color: #f8fafc;
  --pico-form-element-active-background-color: #fff;
  --pico-form-element-border-color: #c7d3df;
  --pico-table-border-color: #d6e0ea;
  --pico-primary: #3f6ea6;
  --pico-primary-background: #3f6ea6;
  --pico-primary-border: #3f6ea6;
  --pico-primary-underline: rgba(63, 110, 166, 0.5);
  --pico-primary-hover: #284d77;
  --pico-primary-hover-background: #345d8e;
  --pico-primary-hover-border: #345d8e;
  --pico-primary-hover-underline: #284d77;
  --pico-primary-focus: rgba(63, 110, 166, 0.35);
  --pico-primary-inverse: #fff;
  --brand-title: #284d77;
  --header-background: #f8fafd;
  --banner-background: #d7e5f3;
  --banner-color: #1f2937;
  --banner-link: #9c4a22;
  --accent-text: #a8532a;
  --tile-color: #003a96;
  --overlay: linear-gradient(rgba(240, 245, 251, 0.8), rgba(240, 245, 251, 0.9));
  --hero-background: #e3ebf4;
  --hero-color: #334155;
  --gold-text: #8a6507;
  --silver-text: #5f6b75;
  --bronze-text: #9c5a22;
  --tile-border: #d6e0ea;
  --text: #1f2937;
  --card-outline: rgba(0, 0, 0, 0.2);
}

/* Room for the scrollbar on every page, so the menu doesn't shift between long and short ones. */
html {
  scrollbar-gutter: stable;
}

body {
  background: var(--pico-background-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Header: the same on every page */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: none;
  padding: 0;
  background: var(--header-background);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.top-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.1rem 1rem;
  background: var(--banner-background);
  color: var(--banner-color);
  font-size: 0.72rem;
}

.top-banner a {
  color: var(--banner-link);
  font-weight: 700;
}

[data-banner-closed] .top-banner {
  display: none;
}

.top-banner button {
  width: auto;
  margin: 0;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.7;
}

.site-nav {
  --pico-nav-element-spacing-vertical: 0.1rem;
  --pico-nav-link-spacing-vertical: 0.2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1rem;
  padding: 0.15rem 1rem;
  font-size: 0.85rem;
}

/* Links and actions join the header's three columns; the mobile menu groups them again. */
.nav-panel {
  display: contents;
}

.site-nav ul {
  margin-block: 0;
}

.nav-actions {
  justify-self: end;
}

.site-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--brand-title);
  font-family: var(--display-font);
  font-size: 1rem;
  text-transform: uppercase;
}

.logo {
  flex: none;
  width: 1.3em;
  height: auto;
}

.site-nav a,
.site-nav summary {
  white-space: nowrap;
}

.site-nav a:not([role="button"]),
.site-nav details.dropdown > summary:not([role]) {
  color: var(--pico-muted-color);
}

.site-nav a:not([role="button"]):hover,
.site-nav details.dropdown > summary:not([role]):hover {
  color: var(--text);
}

.site-nav .brand:not([role="button"]),
.site-nav .brand:not([role="button"]):hover {
  color: var(--brand-title);
}

.site-nav a.nav-login:not([role="button"]) {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-nav .btn-cta {
  padding: 0.25rem 0.8rem;
  font-size: 0.85rem;
  box-shadow: none;
}

.site-nav .user-name {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav details.dropdown > ul a:not([role="button"]) {
  color: var(--pico-dropdown-color);
}

/* Pico draws a nav dropdown like a form select; here it should read as a link. */
.site-nav details.dropdown > summary:not([role]) {
  height: auto;
  padding: var(--pico-nav-link-spacing-vertical) var(--pico-nav-link-spacing-horizontal);
  border: 0;
  background-color: transparent;
  box-shadow: none;
  line-height: inherit;
}

.site-nav details.dropdown > summary:not([role])::after {
  margin-inline-start: 0.35rem;
  width: 0.8rem;
  height: calc(1rem * var(--pico-line-height, 1.5));
  float: none;
  display: inline-block;
  vertical-align: top;
}

.site-nav a[aria-current="page"]:not([role="button"]),
.site-nav details.dropdown > summary[aria-current="page"]:not([role]) {
  color: var(--pico-primary);
}

.menu-toggle {
  display: none;
  width: auto;
  margin: 0;
  padding: 0.1rem 0.7rem;
}

.theme-toggle {
  margin: 0;
  padding: 0.2rem 0.5rem;
  line-height: 1;
}

.logout-form {
  margin: 0;
}

/* Reset Pico's button look so "log out" matches the links around it. */
.link-button,
.link-button:hover,
.link-button:focus {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pico-dropdown-color);
  text-align: inherit;
}

@media (max-width: 1199px) {
  .site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .menu-toggle {
    display: block;
  }

  .nav-panel {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding-bottom: 0.5rem;
  }

  .nav-panel.open {
    display: flex;
  }

  .nav-panel > ul {
    flex-wrap: wrap;
    margin-inline: 0;
  }

  .nav-panel > ul:first-child {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-actions {
    justify-self: auto;
  }

  .nav-panel details.dropdown {
    border: 0;
  }
}

/* The main action, and the quieter one beside it */
button.btn-cta,
a.btn-cta[role="button"],
a.btn-ghost[role="button"] {
  display: inline-block;
  width: auto;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s, background-color 0.15s;
}

button.btn-cta,
a.btn-cta[role="button"] {
  border: 1px solid var(--cta-color);
  background: var(--cta-color);
  color: #fff;
}

button.btn-cta:hover,
a.btn-cta[role="button"]:hover {
  border-color: var(--cta-hover);
  background: var(--cta-hover);
  color: #fff;
}

a.btn-ghost[role="button"] {
  border: 1px solid var(--hero-color);
  background: transparent;
  color: var(--hero-color);
}

a.btn-ghost[role="button"]:hover {
  background: color-mix(in srgb, var(--hero-color) 14%, transparent);
  color: var(--hero-color);
}

/* Titles in the site's wide display face */
.display-title {
  color: var(--brand-title);
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

/* Home: a title over slowly sliding card art */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 2rem;
  padding: 3.2rem 1.25rem 2.8rem;
  border-radius: 16px;
  background: var(--hero-background);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  text-align: center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--overlay);
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
  filter: blur(1.5px);
}

.hero-row {
  display: flex;
  flex: none;
  gap: 0.6rem;
  width: max-content;
  animation: hero-slide 140s linear infinite;
}

.hero-row:nth-child(even) {
  animation-direction: reverse;
}

.hero-row img {
  flex: none;
  width: clamp(8rem, 13vw, 14rem);
  height: auto;
  border-radius: 6px;
}

@keyframes hero-slide {
  to {
    transform: translateX(calc(-50% - 0.3rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-row {
    animation: none;
  }
}

.hero .display-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
}

.hero-tagline {
  margin: 0 auto 0.3rem;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.hero-subtext {
  max-width: 720px;
  margin: 0 auto 1.2rem;
  color: var(--hero-color);
  line-height: 1.75;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.hero-cta .btn-cta {
  box-shadow: 0 4px 14px rgba(232, 146, 106, 0.35);
}

/* Home: the three numbers */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  --stat-color: var(--gold);
  --stat-text: var(--gold-text);
  margin: 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--stat-color) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--stat-color) 7%, transparent);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-silver {
  --stat-color: var(--silver);
  --stat-text: var(--silver-text);
}

.stat-bronze {
  --stat-color: var(--bronze);
  --stat-text: var(--bronze-text);
}

.stat-card h2 {
  margin: 0;
  color: var(--stat-text);
  font-size: 2.5rem;
}

.stat-card p {
  margin: 0.3rem 0 0;
  color: var(--stat-text);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-card span {
  color: var(--pico-muted-color);
  font-size: 0.75rem;
}

/* Home: lists under a heading with a "see more" link */
.home-block {
  margin-bottom: 2rem;
}

.home-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-block-head h2 {
  margin: 0;
  font-size: 1.75rem;
}

.home-block-head a {
  flex: none;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

a.home-item:not([role]) {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--tile-border);
  border-radius: 10px;
  background: var(--pico-card-background-color);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s;
}

a.home-item:not([role]):hover {
  transform: translateY(-2px);
  border-color: var(--pico-primary);
}

.home-item-art {
  flex: none;
  width: 4.25rem;
  aspect-ratio: 300 / 419;
  overflow: hidden;
  border-radius: 5px;
  background: var(--pico-card-sectioning-background-color);
}

.home-item-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-item-body {
  display: block;
  min-width: 0;
}

.home-item-body h3 {
  margin: 0.15rem 0;
  font-size: 1.05rem;
}

.home-item-body p {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.home-item-tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border: 1px solid color-mix(in srgb, var(--pico-primary) 50%, transparent);
  border-radius: 4px;
  color: var(--pico-primary);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.home-item-tag.is-upcoming {
  border-color: color-mix(in srgb, var(--accent-text) 50%, transparent);
  color: var(--accent-text);
}

.home-item-more {
  display: block;
  margin-top: 0.15rem;
  color: var(--pico-primary);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Tiles leading to the site's sections */
.nav-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

a.nav-tile:not([role]) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon title" "icon desc";
  gap: 0.15rem 0.8rem;
  align-items: center;
  padding: 1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--tile-color) 32%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--tile-color) 7%, transparent);
  color: var(--tile-color);
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

a.nav-tile:not([role]):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--tile-color) 52%, transparent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  color: var(--tile-color);
}

.nav-tile-icon {
  grid-area: icon;
  display: flex;
}

.nav-tile-icon svg {
  width: 2rem;
  height: 2rem;
}

.nav-tile h3 {
  grid-area: title;
  margin: 0;
  color: inherit;
  font-size: 1rem;
  line-height: 1.2;
}

.nav-tile p {
  grid-area: desc;
  margin: 0;
  color: inherit;
  font-size: 0.78rem;
  line-height: 1.3;
}

/* Every other page opens on a centred title */
.page-hero {
  margin-bottom: 2rem;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--tile-border);
  text-align: center;
}

.page-hero h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.page-hero h1 a {
  color: inherit;
  text-decoration: none;
}

.page-hero h1 a:hover {
  color: var(--text);
}

.page-hero p {
  max-width: 600px;
  margin: 0 auto;
  color: var(--pico-muted-color);
  font-size: 1.1rem;
}

.page-body {
  max-width: 72rem;
  margin-inline: auto;
  text-align: center;
}

.page-body .nav-tiles {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  text-align: start;
}

.wip-badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Forms */
.auth-card {
  max-width: 28rem;
  margin: 2rem auto;
  border: 1px solid var(--tile-border);
  border-radius: 10px;
}

.auth-card h1 {
  color: var(--brand-title);
  font-family: var(--display-font);
  font-size: 1.3rem;
  font-weight: 400;
  text-align: center;
  text-transform: uppercase;
}

.form-errors {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--card-red);
  background: color-mix(in srgb, var(--card-red) 12%, transparent);
}

.form-errors p {
  margin: 0;
}

.site-footer {
  padding: 1rem;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

.site-footer hr {
  margin: 0 0 1rem;
  border-color: var(--tile-border);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--brand-title);
  font-family: var(--display-font);
  text-decoration: none;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.footer-links a {
  color: var(--pico-muted-color);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

.info-page {
  max-width: 46rem;
  margin: 0 auto 2.5rem;
}

.info-page section {
  margin-bottom: 1.75rem;
}

.info-page h2 {
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 1.15rem;
}

.info-page p {
  margin-bottom: 0.6rem;
}

.info-page details {
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
}

.info-page details summary {
  color: var(--text);
  font-weight: 700;
}

.info-page details[open] summary {
  margin-bottom: 0.5rem;
}

.info-updated {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.info-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.footer-disclaimer {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  text-align: center;
}

@media (max-width: 768px) {
  .stat-grid,
  .nav-tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card h2 {
    font-size: 2rem;
  }
}

.account-facts {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin-bottom: 1.5rem;
  text-align: start;
}

.account-facts dt {
  color: var(--pico-muted-color);
  font-weight: 400;
}

.account-facts dd {
  margin: 0;
  font-weight: 600;
}

/* Cards page: filter column on the left, results on the right. */
.cards-layout {
  display: grid;
  grid-template-columns: var(--side-column) minmax(0, 1fr) var(--side-column);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0.5rem 0.75rem;
}

/* Positioned so the chips' hidden inputs scroll with it instead of stretching the page. */
.filter-panel {
  position: relative;
  overflow-y: auto;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--tile-border);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  font-size: 0.9rem;
  --pico-form-element-spacing-vertical: 0.4rem;
  --pico-form-element-spacing-horizontal: 0.6rem;
}

.filter-panel > summary {
  font-weight: 700;
}

.filter-panel fieldset {
  margin-bottom: 0.9rem;
}

.filter-panel legend,
.filter-panel label {
  font-weight: 600;
}

.filter-panel input:not([type="checkbox"], [type="radio"]),
.filter-panel select {
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

.sort-row {
  grid-template-columns: 1fr;
  gap: 0;
}

.range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: center;
}

.range legend {
  grid-column: 1 / -1;
}

.range input {
  margin-bottom: 0 !important;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chip {
  margin: 0;
  cursor: pointer;
  font-weight: 400 !important;
}

/* The real input stays focusable for keyboards; the span carries the look. */
.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.chip span {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  font-size: 0.82rem;
}

.chip input:checked + span {
  border-color: var(--pico-primary-background);
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-weight: 600;
}

.chip input:focus-visible + span {
  outline: 2px solid var(--pico-primary);
  outline-offset: 1px;
}

/* Colours are round buttons; screen readers get the name from the input's label. */
.color-chip span {
  display: block;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--card-outline);
  border-radius: 50%;
  background: var(--swatch);
}

.color-chip:hover span {
  transform: scale(1.1);
}

.color-chip input:checked + span {
  border-color: var(--swatch);
  background: var(--swatch);
  outline: 3px solid var(--pico-primary-background);
  outline-offset: 2px;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.filter-actions > * {
  margin: 0;
  padding: 0.4rem;
  font-size: 0.9rem;
}

.results-header h1 {
  margin: 0;
  font-size: 1.15rem;
  white-space: nowrap;
}

/* The slider sets --card-size; each row still fills the whole width. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--card-size), 100%), 1fr));
  gap: 0.6rem;
}

/* A tile is just the card. Counters appear over it when needed. */
.card-tile {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4.5%/3.2%;
  background: none;
  box-shadow: none;
}

.card-tile.save-failed {
  outline: 2px solid var(--card-red);
  outline-offset: 1px;
}

.card-tile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4.5%/3.2%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  background: var(--tile-border);
}

.card-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 7;
  padding: 0.5rem;
  border-radius: 4.5%/3.2%;
  border-top: 6px solid var(--accent);
  background: var(--tile-border);
  text-align: center;
}

.copies {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  left: 0.3rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.2rem;
  align-items: center;
  border-radius: 999px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.12s ease;
}

/* Nothing owned: hidden until the pointer or keyboard reaches the card. */
.card-tile:hover .copies,
.card-tile:focus-within .copies {
  background: rgba(0, 0, 0, 0.8);
  opacity: 1;
}

/* Copies owned: the count stays, as a small badge in the corner. */
.card-tile.is-owned .copies {
  opacity: 1;
}

.card-tile.is-owned:not(:hover, :focus-within) .copies {
  grid-template-columns: auto;
  justify-content: end;
}

.card-tile.is-owned:not(:hover, :focus-within) .copies button {
  display: none;
}

.card-tile.is-owned:not(:hover, :focus-within) .copies output {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.copies button {
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-weight: 700;
  line-height: 1.5;
}

.copies button:hover {
  color: var(--pico-primary-background);
}

.copies output {
  min-width: 1.5rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Touch screens have no hover, so the counters stay available. */
@media (hover: none) {
  .card-tile .copies {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
  }
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding-block: 1.5rem;
}

.pagination a {
  margin: 0;
  padding: 0.3rem 0.9rem;
}

.no-results {
  padding-block: 3rem;
  color: var(--pico-muted-color);
  text-align: center;
}

/* On a computer the column is always open, with nothing to collapse it. */
@media (min-width: 681px) {
  .filter-panel > summary {
    display: none;
  }
}

/* The right column, always there so opening a card never resizes the list. */
.card-detail {
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid var(--tile-border);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  font-size: 0.9rem;
}

.card-detail[hidden] {
  display: none;
}

.card-detail section {
  margin-bottom: 1rem;
}

.card-detail h3 {
  margin-bottom: 0.35rem;
  color: var(--pico-muted-color);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.detail-header h2:focus {
  outline: none;
}

.detail-close {
  width: auto;
  margin: 0;
  padding: 0 0.55rem;
  line-height: 1.5;
}

.detail-code {
  margin-bottom: 0.6rem;
  color: var(--pico-muted-color);
  font-size: 0.82rem;
}

.detail-image {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 8px;
  background: var(--tile-border);
}

.detail-facts {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.detail-facts > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.5rem;
}

.detail-facts dt {
  color: var(--pico-muted-color);
  font-weight: 400;
}

.detail-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-list {
  margin: 0;
  padding-left: 1.1rem;
}

.detail-list li {
  margin-bottom: 0.15rem;
}

.detail-text p,
.detail-pre {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.detail-more {
  margin-bottom: 0.6rem;
}

.detail-more summary {
  font-weight: 600;
}

.detail-entry {
  margin-bottom: 0.7rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--tile-border);
}

.detail-entry p {
  margin-bottom: 0.25rem;
}

.detail-source {
  margin: 0.8rem 0 0;
  color: var(--pico-muted-color);
}

.print-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr));
  gap: 0.35rem;
}

.print-link {
  display: block;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
}

.print-link[aria-current="true"] {
  border-color: var(--pico-primary-background);
}

.print-link img {
  display: block;
  width: 100%;
  height: auto;
}

.print-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 7;
  background: var(--tile-border);
  color: var(--pico-muted-color);
  font-size: 0.62rem;
  text-align: center;
  overflow-wrap: anywhere;
}

/* The tile link wraps image and text; it shouldn't restyle them. */
a.tile-open:not([role]) {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-tile.is-selected {
  outline: 3px solid var(--pico-primary-background);
  outline-offset: 2px;
}

/* Rarity keywords */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.82rem;
}

.tag > span.tag-text {
  padding: 0.12rem 0.6rem;
}

.tag button {
  width: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.5;
}

.tag button.tag-text {
  padding: 0.12rem 0.2rem 0.12rem 0.6rem;
}

.tag button.tag-remove {
  padding: 0.12rem 0.5rem 0.12rem 0.25rem;
  color: var(--pico-muted-color);
}

.tag button:hover {
  color: var(--pico-primary);
}

.tag input.tag-edit-input,
.card-detail input.tag-add {
  height: auto;
  margin: 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.82rem;
}

.card-detail input.tag-add {
  margin-bottom: 0.4rem;
}

.tag input.tag-edit-input {
  width: 11rem;
  border: 0;
}

.tag-status {
  margin: 0;
  color: var(--card-red);
  font-size: 0.8rem;
}

.tag-reset {
  width: auto;
  margin: 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
}

.tag-version {
  margin-bottom: 0.5rem;
  color: var(--pico-muted-color);
  font-size: 0.82rem;
}

.tag-version strong {
  color: var(--text);
}

/* Title line of the cards page, with the collection actions on the right. */
.results-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 0.25rem;
}

.results-title h1 {
  margin: 0;
}

.collection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.collection-actions button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.88rem;
}

.collection-dialog article {
  width: min(36rem, 100%);
}

.collection-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
}

.collection-dialog textarea {
  font-family: var(--pico-font-family-monospace);
  font-size: 0.85rem;
}

.collection-dialog fieldset {
  margin-block: 0.8rem;
}

.collection-dialog fieldset label {
  display: inline-block;
  margin-right: 1rem;
}

.bulk-result {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--tile-border);
}

.bulk-result p {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.bulk-result .bulk-problem {
  color: var(--card-red);
}

.bulk-result .bulk-details {
  max-height: 7rem;
  overflow-y: auto;
  color: var(--pico-muted-color);
  font-size: 0.82rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* Choosing the art an unclear id refers to, inside the import dialog. */
.art-picker {
  margin-top: 1rem;
}

.art-picker[hidden],
.bulk-form[hidden] {
  display: none;
}

.art-progress {
  margin-bottom: 0.2rem;
  color: var(--pico-muted-color);
  font-size: 0.82rem;
}

.art-question {
  margin-bottom: 0.7rem;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.art-question:focus {
  outline: none;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.5rem;
  max-height: 45vh;
  margin-bottom: 0.8rem;
  padding: 3px;
  overflow-y: auto;
}

button.art-choice {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.25rem;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  text-align: center;
}

button.art-choice:hover {
  border-color: var(--tile-border);
}

button.art-choice[aria-pressed="true"] {
  border-color: var(--pico-primary-background);
  background: color-mix(in srgb, var(--pico-primary-background) 15%, transparent);
}

.art-choice img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
  background: var(--tile-border);
}

.art-choice span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.art-error {
  color: var(--card-red);
  font-size: 0.85rem;
}

.art-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.art-actions button {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
}

.art-reports {
  margin-top: 2rem;
}

.art-reports h2 {
  font-size: 1.15rem;
}

.art-report-dismiss {
  margin: 0;
}

.art-report-dismiss button {
  width: auto;
  margin: 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.82rem;
}

/* "Import Current Sort", with how many copies right below it. */
.collection-actions {
  align-items: flex-start;
}

.import-sort {
  display: flex;
  gap: 0.25rem;
}

.copies-stepper {
  display: grid;
  grid-template-columns: auto 3rem auto;
  gap: 0.25rem;
  width: auto;
}

.collection-actions .copies-stepper button {
  padding: 0.1rem 0.5rem;
  font-size: 0.82rem;
}

.copies-stepper input[type="number"] {
  height: auto;
  margin: 0;
  padding: 0.1rem 0.25rem;
  font-size: 0.85rem;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.copies-stepper input[type="number"]::-webkit-inner-spin-button,
.copies-stepper input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

/* Pico styles role="group" as a full-width block with a bottom margin. Over a card that pushes
   the counters past the right edge: left and right alone must decide their width. */
.card-tile .copies {
  width: auto;
  margin: 0;
  box-shadow: none;
}

.copies-stepper {
  margin: 0;
  box-shadow: none;
}

.collection-dialog .bulk-problem {
  color: var(--card-red);
}

/* Deck builder: the deck stays docked at the bottom of the screen, under the card list. */
.deck-dock {
  flex: none;
  min-width: 0;
  border-top: 1px solid var(--tile-border);
  background: var(--pico-card-background-color);
  font-size: 0.85rem;
}

.deck-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.2rem 0.75rem;
  border-bottom: 1px solid var(--tile-border);
  --pico-form-element-spacing-vertical: 0.2rem;
  --pico-form-element-spacing-horizontal: 0.5rem;
}

.deck-bar select,
.deck-bar input[type="text"] {
  width: 11rem;
  height: auto;
  margin: 0;
  font-size: 0.85rem;
}

.deck-bar form {
  margin: 0;
}

.deck-bar button {
  width: auto;
  margin: 0;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
}

.deck-bar button[hidden] {
  display: none;
}

.deck-counters {
  display: flex;
  gap: 1rem;
  margin: 0 0 0 0.5rem;
  white-space: nowrap;
}

.deck-counter span {
  color: var(--pico-muted-color);
}

.deck-counter strong {
  font-size: 1.05rem;
}

.deck-counter.is-over,
.deck-counter.is-over strong {
  color: var(--card-red);
  font-weight: 700;
}

.deck-message {
  flex: 1;
  min-width: 8rem;
  margin: 0;
  color: var(--card-red);
  font-weight: 600;
}

.deck-message:empty {
  display: none;
}

.deck-toggle {
  margin-left: auto !important;
}

.deck-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(38rem, 38%);
  grid-template-rows: minmax(0, 1fr);
  height: clamp(5.5rem, 12vh, 6.5rem);
}

.deck-dock.is-collapsed .deck-panel {
  display: none;
}

.deck-list {
  min-width: 0;
  padding: 0.35rem 0.75rem;
  overflow-y: auto;
}

.deck-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr));
  gap: 0.3rem;
}

/* Small tiles need smaller counters. */
.deck-tiles .copies {
  right: 0.1rem;
  bottom: 0.15rem;
  left: 0.1rem;
}

.deck-tiles .copies output {
  min-width: 1.2rem;
  padding-inline: 0.2rem;
  font-size: 0.78rem;
}

.deck-empty {
  margin: 0;
  padding-block: 1.5rem;
  color: var(--pico-muted-color);
  text-align: center;
}

.deck-problems {
  margin: 0 0 0.5rem;
  padding: 0.3rem 0.6rem;
  border-left: 4px solid var(--card-red);
  background: color-mix(in srgb, var(--card-red) 12%, transparent);
  color: var(--card-red);
  font-size: 0.8rem;
  font-weight: 600;
  list-style: none;
}

/* Pico pads list items inside an aside as if they were a side menu. */
.deck-problems li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.limit-badge {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.5;
  pointer-events: none;
}

.limit-banned {
  background: #b3261e;
}

/* Graphs and Turn 1 odds, on the right of the list. */
.deck-stats {
  display: grid;
  grid-template-columns: 1fr 1.6fr 1.4fr 1fr minmax(17rem, 1.3fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.25rem 0.6rem;
  min-width: 0;
  padding: 0.2rem 0.6rem;
  border-left: 1px solid var(--tile-border);
}

.deck-chart {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.deck-chart figcaption,
.deck-chart h3 {
  overflow: hidden;
  white-space: nowrap;
  padding: 0;
  margin: 0 0 0.1rem;
  color: var(--pico-muted-color);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.bars {
  flex: 1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-bottom: 0;
  list-style: none;
}

.bar {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar-track {
  position: relative;
  display: block;
  min-height: 0;
  border-bottom: 1px solid var(--tile-border);
}

/* The top 20% of the track stays free for the value above the tallest bar. */
.bar-fill {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: min(100%, 24px);
  height: calc(var(--h) * 0.8);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--bar-color, var(--pico-primary-background));
  box-shadow: var(--bar-edge, none);
  transform: translateX(-50%);
}

.bar-value {
  position: absolute;
  right: 0;
  bottom: calc(var(--h) * 0.8);
  left: 0;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.bar-label {
  overflow: hidden;
  color: var(--pico-muted-color);
  font-size: 0.66rem;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}

.color-chart .bar-label {
  font-size: 0.58rem;
}

/* Game colours: black and white need an edge to show on either theme. */
.bar[data-color="red"] { --bar-color: var(--card-red); }
.bar[data-color="blue"] { --bar-color: var(--card-blue); }
.bar[data-color="yellow"] { --bar-color: var(--card-yellow); }
.bar[data-color="green"] { --bar-color: var(--card-green); }
.bar[data-color="purple"] { --bar-color: var(--card-purple); }
.bar[data-color="black"] { --bar-color: var(--card-black); --bar-edge: inset 0 0 0 1px var(--card-outline); }
.bar[data-color="white"] { --bar-color: var(--card-white); --bar-edge: inset 0 0 0 1px var(--card-outline); }
.bar[data-color="multi"] { --bar-color: var(--pico-muted-color); }

.turn-one {
  overflow: hidden;
}

.turn-one table {
  width: 100%;
  margin: 0;
  font-size: 0.78rem;
}

.turn-one th,
.turn-one td {
  padding: 0.1rem 0.25rem;
  border-bottom: 1px solid var(--tile-border);
  background: transparent;
  font-size: inherit;
  line-height: 1.3;
  text-align: right;
}

.turn-one thead th {
  color: var(--pico-muted-color);
  font-size: 0.7rem;
  font-weight: 600;
}

.turn-one tbody th {
  color: var(--pico-muted-color);
  font-weight: 400;
  text-align: left;
}

.turn-one tbody td {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.turn-one p {
  margin: 0.15rem 0 0;
  color: var(--pico-muted-color);
  font-size: 0.72rem;
}

.deck-dialog article {
  width: min(28rem, 100%);
}

.deck-dialog h2 {
  font-size: 1.15rem;
}

.deck-dialog form {
  margin: 0;
}

.deck-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.deck-dialog-actions button,
.deck-dialog-actions [role="button"] {
  width: auto;
  margin: 0;
}

.deck-transfer article {
  width: min(44rem, 100%);
}

.deck-transfer fieldset {
  margin-bottom: 0.8rem;
}

.deck-transfer fieldset[hidden] {
  display: none;
}

.deck-transfer legend,
.deck-transfer label[for] {
  margin-bottom: 0.25rem;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.deck-transfer textarea {
  margin-bottom: 0;
  font-family: var(--pico-font-family-monospace);
  font-size: 0.85rem;
}

.deck-transfer canvas {
  display: block;
  max-width: 100%;
  max-height: 50dvh;
  margin-inline: auto;
}

.deck-import-formats {
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
}

.deck-import-formats dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  margin: 0.4rem 0 0;
}

.deck-import-formats dd {
  margin: 0;
}

.deck-transfer-status {
  margin: 0;
  color: var(--pico-muted-color);
}

.turn-one tbody th {
  white-space: nowrap;
}

/* Too narrow for both side by side: the deck takes the dock and the statistics follow it. */
@media (max-width: 1000px) {
  .deck-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    height: 45dvh;
    overflow-y: auto;
  }

  .deck-list {
    overflow: visible;
  }

  .deck-stats {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: 8rem;
    border-top: 1px solid var(--tile-border);
    border-left: 0;
  }

  .deck-stats .turn-one {
    grid-column: 1 / -1;
  }

  #layout-toggle {
    display: none;
  }
}

@media (max-width: 680px) {
  .deck-bar select,
  .deck-bar input[type="text"] {
    width: 8.5rem;
  }

  /* Folded on a phone, the dock is one line: which deck, and how full. */
  .deck-dock.is-collapsed #deck-name,
  .deck-dock.is-collapsed .deck-action,
  .deck-dock.is-collapsed .deck-delete {
    display: none;
  }

  .deck-counters {
    gap: 0.5rem;
    margin-left: 0;
  }

  .deck-stats {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 7rem;
  }
}

/* Card pages: the screen doesn't scroll. The menu stays on top and each column scrolls alone. */
body.app-page {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-page main {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 0;
}

.card-results {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.results-header {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.25rem 1rem;
  margin: 0 0 0.35rem;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

.results-title {
  justify-content: flex-start;
  align-items: baseline;
  margin: 0;
}

.results-count {
  margin: 0;
  font-size: 0.82rem;
}

.deck-hint {
  color: var(--pico-muted-color);
}

/* Touch screens have no right click: tiles carry an "i" button instead. */
@media (hover: none) {
  .deck-hint {
    display: none;
  }
}

/* One line above the cards when it fits: the hint gives way before the tools do. */
.results-header:has(#layout-toggle) .results-title {
  flex: 1 1 14rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.results-header:has(#layout-toggle) .results-count {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.results-tools button {
  width: auto;
  margin: 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.82rem;
}

.card-size {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.82rem;
  white-space: nowrap;
}

.card-size input[type="range"] {
  width: clamp(5rem, 9vw, 12rem);
  margin: 0;
}

.card-size output {
  min-width: 2.6rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Room around the cards for the selected card's outline. */
.card-scroll {
  flex: 1;
  min-height: 0;
  padding: 5px;
  overflow-y: auto;
}

.card-scroll .pagination {
  padding-block: 0.75rem;
}

.load-more {
  padding-block: 0.75rem;
  color: var(--pico-muted-color);
  text-align: center;
}

.load-more button {
  width: auto;
  margin: 0;
  padding: 0.3rem 0.9rem;
}

.list-disclaimer {
  display: block;
  padding-block: 0.5rem;
  color: var(--pico-muted-color);
  text-align: center;
}

.detail-placeholder {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--tile-border);
  border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color);
  font-size: 0.9rem;
  text-align: center;
}

.cards-layout.has-detail .detail-placeholder {
  display: none;
}

/* In the deck builder a click adds the card, so the tile only shows the count. */
.tile-count {
  position: absolute;
  right: 0.3rem;
  bottom: 0.3rem;
  min-width: 1.5rem;
  padding-inline: 0.3rem;
  border-radius: 999px;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.card-tile:not(.is-owned) .tile-count {
  display: none;
}

.tile-info {
  display: none;
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.6rem;
  height: 1.6rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

@media (hover: none) {
  .tile-info {
    display: block;
  }
}

/* Overlays, each above this dimmed layer. */
.overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.55);
}

#filters-open {
  display: none;
}

/* No room for three columns: the card opens in the middle of the screen. */
@media (max-width: 1100px) {
  .cards-layout {
    grid-template-columns: var(--side-column) minmax(0, 1fr);
  }

  .detail-placeholder {
    display: none;
  }

  .card-detail {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 30;
    width: min(34rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
  }

  .cards-layout.has-detail .overlay-backdrop {
    display: block;
  }
}

@media (max-width: 680px) {
  .cards-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .filter-panel[open] {
    max-height: 45dvh;
  }
}

@media (max-width: 1300px) {
  .bar-value {
    font-size: 0.56rem;
    letter-spacing: -0.03em;
  }
}

/* The other deck builder layout: cards on the left, deck on the right, filters in an overlay. */
@media (min-width: 1001px) {
  /* Docked, the graphs stay small: the basis of the odds moves to the tooltip. */
  html:not([data-deck-layout="split"]) .turn-one p {
    display: none;
  }

  html:not([data-deck-layout="split"]) .turn-one thead th {
    font-size: 0.62rem;
    line-height: 1.1;
  }

  html:not([data-deck-layout="split"]) .turn-one th,
  html:not([data-deck-layout="split"]) .turn-one td {
    padding: 0.05rem 0.15rem;
  }

  html:not([data-deck-layout="split"]) .turn-one tbody th {
    font-size: 0.62rem;
    line-height: 1.1;
    white-space: normal;
  }

  html:not([data-deck-layout="split"]) .turn-one tbody td {
    font-size: 0.72rem;
  }

  html:not([data-deck-layout="split"]) .deck-stats .deck-chart:nth-child(4) .bar-label {
    font-size: 0.52rem;
  }

  /* One row of cards sets the height and the rest scroll down. A warning adds its own line.
     The cards get all the width the graphs, kept to a small block, don't need. */
  html:not([data-deck-layout="split"]) .deck-panel {
    grid-template-columns: minmax(0, 1fr) clamp(27rem, 30vw, 34rem);
    height: 9.3rem;
  }

  html:not([data-deck-layout="split"]) .deck-panel:has(.deck-problems) {
    height: 11rem;
  }

  /* The deck's size button: twice the height, which fits two rows of cards. A short screen keeps
     room for the card list. */
  html[data-deck-tall]:not([data-deck-layout="split"]) .deck-panel {
    height: min(18.6rem, 45dvh);
  }

  html[data-deck-tall]:not([data-deck-layout="split"]) .deck-panel:has(.deck-problems) {
    height: min(22rem, 45dvh);
  }

  html:not([data-deck-layout="split"]) .deck-list {
    padding: 0.3rem 0.5rem;
    overflow-x: hidden;
    overflow-y: scroll;
  }

  html:not([data-deck-layout="split"]) .deck-tiles {
    grid-template-columns: repeat(auto-fill, 6rem);
  }

  html:not([data-deck-layout="split"]) .deck-chart:not(.color-chart) .bar-label {
    font-size: 0.58rem;
  }

  html:not([data-deck-layout="split"]) .deck-problems {
    margin-bottom: 0.25rem;
    padding-block: 0.1rem;
  }

  /* The graphs two by two, with the odds beside them. Each row shares its width by how many bars
     its graphs have, so their numbers don't run into each other. */
  html:not([data-deck-layout="split"]) .deck-stats {
    grid-template-columns: repeat(6, minmax(0, 1fr)) 10rem;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 0.15rem 0.4rem;
    padding: 0.15rem 0.5rem;
  }

  html:not([data-deck-layout="split"]) .deck-stats .deck-chart:nth-child(1) {
    grid-column: span 2;
  }

  html:not([data-deck-layout="split"]) .deck-stats .deck-chart:nth-child(2) {
    grid-column: span 4;
  }

  html:not([data-deck-layout="split"]) .deck-stats .deck-chart:nth-child(3),
  html:not([data-deck-layout="split"]) .deck-stats .deck-chart:nth-child(4) {
    grid-column: span 3;
  }

  html:not([data-deck-layout="split"]) .deck-stats .turn-one {
    grid-column: 7;
    grid-row: 1 / 3;
  }

  html:not([data-deck-layout="split"]) .deck-chart figcaption,
  html:not([data-deck-layout="split"]) .deck-chart h3 {
    font-size: 0.6rem;
  }

  html:not([data-deck-layout="split"]) .bar-value {
    font-size: 0.56rem;
  }

  /* Narrow colour bars: a swatch under each instead of its name, which stays in the tooltip. */
  html:not([data-deck-layout="split"]) .color-chart .bar-label {
    height: 0.5rem;
    width: min(100%, 0.8rem);
    margin: 0.2rem auto 0.1rem;
    border-radius: 2px;
    background: var(--bar-color);
    box-shadow: var(--bar-edge, none);
    font-size: 0;
  }

  /* The tools keep one line; the whole group moves below the title if it must. */
  .results-tools {
    flex: none;
    flex-wrap: nowrap;
  }

  [data-deck-layout="split"] main {
    flex-direction: row;
  }

  [data-deck-layout="split"] .cards-layout {
    grid-template-columns: minmax(0, 1fr);
    flex: 1 1 0;
  }

  [data-deck-layout="split"] #filters-open {
    display: inline-block;
  }

  [data-deck-layout="split"] .detail-placeholder,
  [data-deck-layout="split"] .deck-toggle {
    display: none;
  }

  [data-deck-layout="split"] .filter-panel {
    display: none;
  }

  [data-deck-layout="split"][data-filters-open] .filter-panel {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 30;
    width: min(24rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
  }

  [data-deck-layout="split"][data-filters-open] .overlay-backdrop,
  [data-deck-layout="split"] .cards-layout.has-detail .overlay-backdrop {
    display: block;
  }

  [data-deck-layout="split"] .card-detail {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 30;
    width: min(34rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 2rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
  }

  [data-deck-layout="split"] .deck-dock {
    display: flex;
    flex: 0 0 clamp(27rem, 42%, 46rem);
    flex-direction: column;
    border-top: 0;
    border-left: 1px solid var(--tile-border);
  }

  [data-deck-layout="split"] .deck-panel {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    height: auto;
    min-height: 0;
  }

  [data-deck-layout="split"] .deck-stats {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: 6.5rem;
    border-top: 1px solid var(--tile-border);
    border-left: 0;
  }

  [data-deck-layout="split"] .turn-one {
    grid-column: 1 / -1;
  }

  [data-deck-layout="split"] .deck-tiles {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.4rem;
  }
}

/* DigiDLE */
.digidle {
  --clue-correct: #2fa866;
  --clue-partial: #d9a01f;
  --clue-wrong: #b5474b;
  margin-bottom: 2rem;
}

.digidle-modes {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.digidle-modes button {
  width: auto;
  margin: 0;
  padding: 0.25rem 1rem;
  font-size: 0.85rem;
}

.digidle-modes button[aria-pressed="true"] {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
}

.digidle-search {
  position: relative;
  max-width: 36rem;
  margin: 0 auto;
}

.digidle-search[hidden] {
  display: none;
}

.digidle-search input {
  margin: 0;
}

.digidle-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: min(26rem, 60dvh);
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  background: var(--pico-card-background-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  list-style: none;
}

.digidle-results li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  list-style: none;
}

.digidle-results [role="option"] {
  cursor: pointer;
}

.digidle-results [aria-selected="true"],
.digidle-results [role="option"]:hover {
  background: var(--pico-dropdown-hover-background-color);
}

.digidle-results [aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

.digidle-results small {
  margin-inline-start: auto;
  color: var(--pico-muted-color);
}

.digidle-results img {
  flex: none;
  width: 2.4rem;
  height: auto;
  aspect-ratio: 300 / 419;
  border-radius: 3px;
  background: var(--pico-card-sectioning-background-color);
}

.digidle-empty {
  color: var(--pico-muted-color);
}

.digidle-status {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.digidle-clock {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.digidle-clock[hidden] {
  display: none;
}

.digidle-status button {
  width: auto;
  margin: 0;
  padding: 0.1rem 0.7rem;
  font-size: 0.8rem;
}

.digidle-status button[hidden] {
  display: none;
}

.digidle-end article {
  width: min(26rem, 100%);
  padding: 1.25rem;
  text-align: center;
}

.digidle-end.is-won article {
  border: 2px solid var(--clue-correct);
}

.digidle-end h2 {
  margin: 0 0 0.75rem;
  font-size: 1.4rem;
}

.digidle-end img {
  display: block;
  width: 10rem;
  height: auto;
  margin: 0 auto 0.75rem;
  border-radius: 8px;
}

.digidle-end p {
  margin: 0 0 0.25rem;
}

.digidle-end-count {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.digidle-end-card {
  color: var(--text);
  font-weight: 700;
}

#digidle-end-count {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.digidle-end-elo {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.1rem 0.6rem;
  margin: 0.6rem 0 0;
  padding: 0.5rem;
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  background: var(--pico-card-sectioning-background-color);
}

.digidle-end-elo[hidden] {
  display: none;
}

.digidle-end-elo strong {
  font-size: 1.7rem;
}

.digidle-end-elo .is-gain {
  color: var(--clue-correct);
}

.digidle-end-elo .is-loss {
  color: var(--clue-wrong);
}

.digidle-end-elo small {
  width: 100%;
  color: var(--pico-muted-color);
}

.digidle-end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
}

.digidle-end-actions form {
  margin: 0;
}

.digidle-end-actions button,
.digidle-end-actions [role="button"] {
  width: auto;
  margin: 0;
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
}

.digidle-end-actions a:not([role]) {
  flex-basis: 100%;
  font-size: 0.85rem;
}

.digidle-board {
  overflow-x: auto;
  border-radius: 8px;
}

.digidle-board table {
  min-width: 62rem;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0.2rem;
  background: none;
}

.digidle-board thead th {
  padding: 0.3rem;
  border: 0;
  background: none;
  color: var(--pico-muted-color);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
}

.digidle-board td,
.digidle-board tbody th {
  padding: 0.3rem;
  border: 0;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.digidle-board .clue {
  color: #fff;
  font-weight: 600;
}

.clue-value {
  white-space: nowrap;
}

.digidle-board .clue.is-correct,
.clue-sample.is-correct {
  background: var(--clue-correct);
}

.digidle-board .clue.is-partial,
.clue-sample.is-partial {
  background: var(--clue-partial);
}

.digidle-board .clue.is-partial {
  color: #17181c;
}

.digidle-board .clue.is-wrong,
.clue-sample.is-wrong {
  background: var(--clue-wrong);
}

.digidle-board .clue.is-new {
  animation: clue-appear 0.35s both;
}

@keyframes clue-appear {
  from {
    opacity: 0;
    transform: rotateX(70deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .digidle-board .clue.is-new {
    animation: none;
  }
}

/* The card stays in view when the clues scroll sideways on a small screen. */
.digidle-board tbody th.clue-card {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 13rem;
  min-width: 11rem;
  background: var(--pico-card-background-color);
  color: var(--text);
  text-align: start;
}

.digidle-board tbody th.clue-card.is-correct {
  outline: 2px solid var(--clue-correct);
  outline-offset: -2px;
}

.clue-card {
  white-space: normal;
}

.clue-card img {
  float: left;
  width: 2.8rem;
  height: auto;
  margin-inline-end: 0.5rem;
  border-radius: 3px;
}

.clue-card small {
  color: var(--pico-muted-color);
}

.digidle-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin: 1rem 0 0;
  padding: 0;
  color: var(--pico-muted-color);
  font-size: 0.78rem;
  list-style: none;
}

.digidle-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  list-style: none;
}

.clue-sample {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 3px;
}

/* A lone tile keeps a tile's size instead of filling the page. */
.page-body .nav-tiles:has(> :only-child) {
  max-width: 30rem;
  margin-inline: auto;
}

/* DigiDLE's page: your numbers, the button, then the ladder */
.digidle-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 64rem;
  margin: 0 auto 1.5rem;
}

.digidle-stats .stat-card {
  padding: 0.75rem 0.5rem;
}

.digidle-stats .stat-card h2 {
  font-size: 1.8rem;
}

.digidle-stats .stat-card p {
  font-size: 0.72rem;
}

.digidle-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.digidle-actions form {
  margin: 0;
}

.digidle-actions button,
.digidle-actions [role="button"] {
  width: auto;
  margin: 0;
}

.digidle-rules {
  max-width: 44rem;
  margin: 0.75rem auto 2rem;
  color: var(--pico-muted-color);
  font-size: 0.82rem;
  text-align: center;
}

.digidle-ladder {
  max-width: 64rem;
  margin: 0 auto 2rem;
}

.digidle-ladder h2 {
  font-size: 1.5rem;
}

.digidle-ladder-scroll {
  overflow-x: auto;
}

.digidle-ladder table {
  margin: 0;
}

.digidle-ladder th:not(:nth-child(2)),
.digidle-ladder td:not(:nth-child(2)) {
  text-align: center;
}

.digidle-ladder tr.is-me td {
  background: color-mix(in srgb, var(--pico-primary) 18%, transparent);
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 768px) {
  .digidle-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .digidle-stats .stat-card:first-child {
    grid-column: 1 / -1;
  }
}

/* DigiGuess: the picture, the search box under it, then the wrong guesses */
.digiguess-art {
  display: block;
  width: min(17rem, 70vw);
  height: auto;
  aspect-ratio: 430 / 600;
  max-width: 100%;
  margin: 0 auto 1rem;
  border-radius: 12px;
  background: var(--tile-border);
  object-fit: cover;
}

.digiguess-history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.5rem;
  max-width: 50rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.digiguess-history li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  padding: 0.35rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--clue-wrong) 60%, transparent);
  border-radius: 8px;
  list-style: none;
}

.digiguess-history .is-passed {
  border-color: var(--tile-border);
}

.digiguess-history .is-passed span {
  color: var(--pico-muted-color);
}

.digiguess-history img {
  flex: none;
  width: 2.2rem;
  height: auto;
  border-radius: 3px;
}

.digiguess-history span {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.digiguess-history small {
  color: var(--pico-muted-color);
  white-space: nowrap;
}

/* Tier lists */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.tierlist-page {
  max-width: 76rem;
  margin: 1.5rem auto 3rem;
}

.tierlist-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tierlist-head h1 {
  margin: 0;
}

.tierlist-by {
  margin: 0.25rem 0 0;
  color: var(--pico-muted-color);
}

.tierlist-mine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.tierlist-mine span {
  color: var(--pico-muted-color);
}

.tierlist-mine a {
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--tile-border);
  border-radius: 999px;
  text-decoration: none;
}

.tierlist-mine a[aria-current] {
  border-color: var(--pico-primary);
  color: var(--pico-primary);
}

.tierlist-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.tierlist-bar .tierlist-name {
  flex: 1;
  margin: 0;
}

.tierlist-bar input,
.tierlist-bar button,
.tierlist-bar [role="button"] {
  margin: 0;
}

.tierlist-save-status,
.tier-status {
  min-height: 1.4em;
  overflow-wrap: anywhere;
  margin: 0.35rem 0 0.5rem;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.tier-export,
.tierlist-owner-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tier-export button,
.tierlist-owner-tools button,
.tierlist-owner-tools form {
  margin: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.tierlist-owner-tools form {
  padding: 0;
}

.tierlist-owner-tools {
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.tierlist-search {
  margin: 1rem 0;
}

.tierlist-search > label {
  font-weight: 600;
}

.tierlist-search-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.35rem;
}

.tierlist-search-row .digidle-search {
  flex: 1;
  max-width: none;
  margin: 0;
}

.tierlist-target {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  white-space: nowrap;
}

.tierlist-target select {
  width: auto;
  min-width: 6rem;
  margin: 0;
}

.tierlist-hint {
  margin: 0.4rem 0 0;
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

.tier-board {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tier-row {
  --tier-color: #888888;
  display: flex;
  min-height: 6rem;
  border: 1px solid var(--tile-border);
  border-radius: 10px;
  background: var(--pico-card-background-color);
  overflow: hidden;
}

.tier-row.is-target {
  border-color: var(--tier-color);
  box-shadow: 0 0 0 1px var(--tier-color);
}

.tier-label {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  width: 7rem;
  padding: 0.4rem;
  background: var(--tier-color);
  color: #111111;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.tier-label input[type="text"] {
  width: 100%;
  margin: 0;
  padding: 0.2rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.25);
  color: #111111;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.tier-label input[type="text"]:focus {
  border-color: #111111;
  background: rgba(255, 255, 255, 0.6);
}

.tier-label input[type="color"] {
  width: 2.2rem;
  height: 1.6rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.tier-cards {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.35rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
}

.tier-board.is-editing .tier-cards {
  cursor: pointer;
}

.tier-board.is-editing .tier-cards:empty::before {
  content: attr(data-empty);
  align-self: center;
  margin: auto;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.tier-cards.is-over {
  background: color-mix(in srgb, var(--tier-color) 15%, transparent);
}

.tier-card {
  position: relative;
  width: 4.5rem;
  margin: 0;
  list-style: none;
  border-radius: 4px;
}

.tier-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 300 / 419;
  border-radius: 4px;
  background: var(--pico-card-sectioning-background-color);
}

.tier-board.is-editing .tier-card {
  cursor: grab;
}

.tier-card.is-picked {
  outline: 3px solid var(--pico-primary);
  outline-offset: 1px;
}

.tier-card.is-dragged {
  opacity: 0.4;
}

.tier-card-remove {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.4rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.tier-card:hover .tier-card-remove,
.tier-card:focus-within .tier-card-remove,
.tier-card.is-picked .tier-card-remove {
  opacity: 1;
}

.tier-tools {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.35rem;
}

.tier-tools button {
  width: 2rem;
  height: 1.8rem;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.home-tierlist .tier-row {
  min-height: 4.5rem;
}

.home-tierlist .tier-label {
  width: 5rem;
}

.home-tierlist-empty {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

@media (hover: none) {
  .tier-card-remove {
    opacity: 1;
  }
}

@media (max-width: 680px) {
  .tierlist-bar,
  .tierlist-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .tier-label {
    width: 4.5rem;
    font-size: 1.2rem;
  }

  .tier-label input[type="text"] {
    font-size: 1rem;
  }

  .tier-card {
    width: 3.2rem;
  }

  .tier-tools {
    padding: 0.2rem;
  }

  .tier-tools button {
    width: 1.7rem;
  }
}

/* Tournament results */

/* Chart colours: one fixed slot per deck, the most played deck first. A deck keeps its colour on both charts. */
:root[data-theme="dark"] {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --series-other: #4b5563;
}

:root[data-theme="light"] {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --series-other: #b8c0cc;
}

.tournament-page {
  /* Narrower than the screen on wide displays, leaving the sides free. */
  max-width: 72rem;
  margin-inline: auto;
}

.tournament-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.tournament-head h1 {
  font-size: 1.6rem;
  margin-bottom: 0.15rem;
}

.tournament-format,
.tournament-credit,
.tour-caption {
  color: var(--pico-muted-color);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.tour-caption {
  font-size: 0.8rem;
}

.tournament-head-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tournament-head-tools form,
.tournament-head-tools select,
.tournament-head-tools button,
.tour-filter,
.tour-filter select {
  margin: 0;
}

.tournament-notice {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--pico-primary);
  background: var(--pico-card-background-color);
}

.tour-panel,
.tour-stats .tour-stat {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: 0.75rem;
}

.tour-panel {
  padding: 0.85rem 1rem;
  margin: 0;
}

.tour-panel h2 {
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
}

.tournament-overview {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.tour-share-body {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.tour-donut {
  width: min(10.5rem, 100%);
  flex: 0 0 auto;
  overflow: visible;
}

.tour-slice {
  fill: var(--fill);
  /* A 2px gap of the surface between slices. */
  stroke: var(--pico-card-background-color);
  stroke-width: 2;
  stroke-linejoin: round;
  cursor: pointer;
  outline: none;
  transition: opacity 0.15s;
}

.tour-donut:hover .tour-slice:not(.is-hovered),
.tour-donut:focus-within .tour-slice:not(.is-hovered) {
  opacity: 0.55;
}

.tour-donut-number {
  text-anchor: middle;
  font-family: var(--display-font);
  font-size: 22px;
  fill: var(--pico-h1-color);
}

.tour-donut-label {
  text-anchor: middle;
  font-size: 11px;
  fill: var(--pico-muted-color);
}

.tour-legend {
  flex: 1 1 14rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.84rem;
}

.tour-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0;
  list-style: none;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.tour-legend li > a,
.tour-legend li > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tour-legend-value {
  font-variant-numeric: tabular-nums;
  color: var(--pico-h1-color);
}

.tour-legend-count {
  min-width: 2.2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--pico-muted-color);
  font-size: 0.85em;
}

.tour-swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  background: var(--swatch);
  margin-right: 0.35rem;
}

.tour-legend .tour-swatch {
  margin-right: 0;
}

.tour-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-content: start;
}

.tour-stat {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.45rem 0.75rem;
  min-width: 0;
}

.tour-stat-wide {
  grid-column: 1 / -1;
}

.tour-stat > span {
  font-size: 0.7rem;
  color: var(--pico-muted-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tour-stat strong {
  font-family: var(--display-font);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--pico-h1-color);
  overflow-wrap: anywhere;
}

.tour-stat small {
  color: var(--pico-muted-color);
  font-size: 0.78rem;
}

.tour-trend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tour-trend-chart svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 15rem;
  overflow: visible;
}

.tour-grid {
  stroke: var(--pico-muted-border-color);
  stroke-width: 1;
}

.tour-baseline {
  stroke: var(--pico-muted-color);
}

.tour-axis {
  font-size: 11px;
  fill: var(--pico-muted-color);
  font-variant-numeric: tabular-nums;
}

.tour-axis-y {
  text-anchor: end;
}

.tour-axis-x {
  text-anchor: middle;
}

.tour-line {
  fill: none;
  stroke: var(--stroke);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tour-point {
  fill: var(--fill);
  /* A ring of the surface where lines cross. */
  stroke: var(--pico-card-background-color);
  stroke-width: 2;
}

.tour-line-label {
  font-size: 12px;
  fill: var(--pico-color);
}

.tour-crosshair {
  stroke: var(--pico-muted-color);
  stroke-dasharray: 3 3;
}

.tour-band {
  fill: transparent;
  outline: none;
  cursor: crosshair;
}

.tour-movers h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.tour-movers h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pico-muted-color);
  margin: 0.5rem 0 0.2rem;
}

.tour-movers ul {
  padding: 0;
  margin: 0;
}

.tour-movers li {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.4rem;
  padding: 0.15rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.tour-movers li small {
  grid-column: 2 / -1;
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  font-variant-numeric: tabular-nums;
}

.tour-mover-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tour-mover-change {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  white-space: nowrap;
}

.tour-mover-change.is-up {
  color: #3fb950;
}

.tour-mover-change.is-down {
  color: #e5534b;
}

.tour-tooltip {
  position: absolute;
  z-index: 50;
  max-width: 16rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--pico-dropdown-background-color);
  border: 1px solid var(--pico-dropdown-border-color);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.35);
  color: var(--pico-color);
  font-size: 0.82rem;
  line-height: 1.4;
  white-space: pre-line;
  pointer-events: none;
}

.tour-tooltip::first-line {
  font-weight: 600;
  color: var(--pico-h1-color);
}

.tour-results-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tour-results-head h2 {
  margin: 0;
  font-size: 1.3rem;
}

.tour-results-head h2 small {
  color: var(--pico-muted-color);
  font-size: 0.7em;
}

.tour-filter select {
  min-width: 14rem;
  padding-block: 0.35rem;
}

.tour-result-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.tour-result {
  margin: 0;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  border-radius: 0.6rem;
}

.tour-result > summary {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1.4fr) 6.5rem minmax(0, 1fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 2.2rem 0.4rem 0.75rem;
  font-size: 0.9rem;
  margin: 0;
  position: relative;
  line-height: 1.3;
}

/* Pico's arrow sits on the right of the summary, after the source link. */
.tour-result > summary::after {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  margin: 0;
}

.tour-result[open] > summary::after {
  transform: translateY(-50%);
}

.tour-result[open] > summary {
  border-bottom: 1px solid var(--pico-card-border-color);
}

.tour-date {
  color: var(--pico-muted-color);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.tour-deck {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0.4rem;
  min-width: 0;
}

.tour-deck-name {
  font-weight: 600;
  color: var(--pico-h1-color);
}

.tour-deck small,
.tour-player small,
.tour-event small {
  color: var(--pico-muted-color);
}

.tour-place {
  justify-self: start;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--pico-muted-border-color);
  font-size: 0.82rem;
  white-space: nowrap;
}

.tour-place.is-first {
  border-color: var(--gold);
  color: var(--gold);
}

.tour-place.is-second {
  border-color: var(--silver);
  color: var(--silver);
}

.tour-place.is-top {
  border-color: var(--bronze);
  color: var(--bronze);
}

.tour-player,
.tour-event {
  min-width: 0;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.tour-source {
  justify-self: end;
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--pico-muted-color);
}

.tour-result-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 1rem;
  padding: 0.75rem;
}

.tour-decklist h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pico-muted-color);
  margin: 0 0 0.5rem;
}

.tour-decklist h4 small {
  color: var(--pico-h1-color);
}

.tour-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr));
  gap: 0.3rem;
  padding: 0;
  margin: 0 0 0.6rem;
}

.tour-cards li {
  position: relative;
  list-style: none;
  margin: 0;
  aspect-ratio: 200 / 279;
  border-radius: 0.3rem;
  overflow: hidden;
  background: var(--pico-card-sectioning-background-color);
}

.tour-cards img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tour-card-missing {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 0.75rem;
  color: var(--pico-muted-color);
}

.tour-qty {
  position: absolute;
  right: 0.25rem;
  bottom: 0.25rem;
  min-width: 1.4rem;
  height: 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgb(11 15 20 / 0.88);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.tour-info dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.2rem 0.75rem;
  margin: 0 0 0.75rem;
  font-size: 0.84rem;
}

.tour-info dt {
  color: var(--pico-muted-color);
  font-weight: 400;
}

.tour-info dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.tour-info .tour-source {
  font-size: inherit;
}

.tour-export {
  width: 100%;
  padding-block: 0.4rem;
}

.tour-colors {
  display: inline-flex;
  gap: 0.2rem;
  vertical-align: middle;
}

.tour-color {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25);
}

@media (max-width: 1000px) {
  .tournament-overview,
  .tour-trend {
    grid-template-columns: minmax(0, 1fr);
  }

  .tour-result > summary {
    grid-template-columns: 6.5rem minmax(0, 1fr) auto;
  }

  .tour-player,
  .tour-event,
  .tour-source {
    grid-column: 2 / -1;
  }

  .tour-source {
    justify-self: start;
  }
}

@media (max-width: 680px) {
  .tour-share-body {
    justify-content: center;
  }

  /* The chart keeps readable text and scrolls sideways inside its panel. */
  .tour-trend-chart {
    overflow-x: auto;
  }

  .tour-trend-chart svg {
    width: 36rem;
    max-width: none;
    max-height: none;
  }

  .tour-result > summary {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.3rem 0.75rem;
  }

  .tour-date,
  .tour-player,
  .tour-event,
  .tour-source {
    grid-column: 1 / -1;
  }

  .tour-deck {
    grid-column: 1;
  }

  .tour-place {
    grid-column: 2;
    grid-row: 2;
  }

  .tour-result-body {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.75rem;
  }

  .tour-cards {
    grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr));
  }

  .tour-filter,
  .tour-filter select {
    width: 100%;
    min-width: 0;
  }
}

/* Deck profiles */

.profile-muted,
.profile-kicker,
.profile-meta {
  color: var(--pico-muted-color);
}

.profile-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-draft {
  font-size: 0.75rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  margin-right: 0.4rem;
}

.profile-list-head,
.profile-editor-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.profile-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.profile-tile {
  display: flex;
  gap: 1rem;
  padding: 0.9rem;
  border-radius: 0.75rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.profile-tile:hover {
  border-color: var(--pico-primary);
  transform: translateY(-2px);
}

.profile-tile-art {
  flex: 0 0 5rem;
  aspect-ratio: 200 / 279;
  border-radius: 0.35rem;
  overflow: hidden;
  background: var(--pico-card-sectioning-background-color);
}

.profile-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-tile-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.profile-tile-text strong {
  font-family: var(--display-font);
  font-weight: 400;
  color: var(--pico-h1-color);
}

.profile-tile-text span {
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

.profile-tile-text mark {
  align-self: flex-start;
}

.profile-hero {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--pico-card-background-color), var(--pico-background-color));
  border: 1px solid var(--pico-card-border-color);
}

.profile-cover {
  width: 9rem;
  flex: 0 0 auto;
  border-radius: 0.45rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.4);
}

.profile-hero-text {
  flex: 1;
  min-width: 0;
}

.profile-hero h1 {
  margin-bottom: 0.4rem;
}

.profile-summary {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.profile-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.profile-toc a {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--pico-muted-border-color);
  font-size: 0.85rem;
  text-decoration: none;
}

.profile-toc a:hover {
  border-color: var(--pico-primary);
}

.profile-edit-link {
  flex: 0 0 auto;
}

.profile-section {
  margin-bottom: 2rem;
  scroll-margin-top: 5rem;
}

.profile-section > h2 {
  font-size: 1.3rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.profile-prose p {
  max-width: 70ch;
  white-space: pre-line;
}

.profile-line h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.profile-line h3 small {
  color: var(--pico-muted-color);
  font-weight: 400;
}

.profile-cards {
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
}

.profile-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
}

.profile-combo h3 {
  font-size: 1.05rem;
}

.profile-combo-stage {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.4rem;
  padding: 0.5rem;
  margin: 0;
}

.profile-combo-stage li {
  position: relative;
  list-style: none;
  width: 6.5rem;
  aspect-ratio: 200 / 279;
  border-radius: 0.35rem;
  overflow: visible;
  opacity: 0.55;
  transform: scale(0.94);
  transition: opacity 0.35s, transform 0.35s, box-shadow 0.35s;
}

.profile-combo-stage li img {
  width: 100%;
  height: 100%;
  border-radius: 0.35rem;
  object-fit: cover;
}

/* An arrow from each card to the next. */
.profile-combo-stage li + li::before {
  content: "→";
  position: absolute;
  left: -1.15rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pico-muted-color);
}

.profile-combo-stage li.is-active {
  opacity: 1;
  transform: scale(1.04);
  box-shadow: 0 0 0 2px var(--cta-color), 0 8px 24px rgb(0 0 0 / 0.45);
}

.profile-step-number {
  position: absolute;
  left: -0.4rem;
  top: -0.4rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cta-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .profile-combo-stage li {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.profile-matchups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  align-items: start;
}

.profile-matchup {
  margin: 0;
  border-radius: 0.75rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  overflow: hidden;
}

.profile-matchup[open] {
  grid-column: 1 / -1;
}

.profile-matchup > summary {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 6.5rem;
  padding: 0.75rem 2.4rem 0.75rem 0.9rem;
  margin: 0;
}

/* The card's art as the button's background, darkened under the name. */
.profile-matchup-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.profile-matchup-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  filter: saturate(1.1);
}

.profile-matchup-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(10 14 20 / 0.92), rgb(10 14 20 / 0.45));
}

.profile-matchup-name {
  position: relative;
  font-family: var(--display-font);
  color: #fff;
  font-size: 1.05rem;
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.8);
}

.profile-matchup > summary::after {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  margin: 0;
  filter: invert(1);
}

.profile-matchup[open] > summary::after {
  transform: translateY(-50%);
}

.profile-matchup > .profile-prose {
  padding: 1rem;
}

.profile-videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
}

.profile-video {
  margin: 0;
}

.profile-video iframe,
.profile-video-play {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0.6rem;
}

.profile-video-play {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  color: var(--pico-h1-color);
}

.profile-video-play small {
  color: var(--pico-muted-color);
}

.profile-video-icon {
  width: 3.4rem;
  height: 2.4rem;
  border-radius: 0.6rem;
  background: #e5484d;
  position: relative;
}

.profile-video-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-35%, -50%);
  border-style: solid;
  border-width: 0.55rem 0 0.55rem 0.9rem;
  border-color: transparent transparent transparent #fff;
}

.profile-video figcaption {
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

/* The editor */

.profile-status {
  min-height: 1.5rem;
  color: var(--pico-muted-color);
}

.profile-editor-actions {
  display: flex;
  gap: 0.5rem;
}

.profile-editor-actions button,
.profile-editor-actions [role="button"] {
  margin: 0;
}

.profile-editor-meta,
.profile-edit-section,
.profile-editor-videos {
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.profile-field-label {
  display: block;
  margin-bottom: 0.35rem;
}

.profile-publish {
  margin: 0;
}

.profile-edit-section {
  border-left: 4px solid var(--pico-primary);
}

.profile-edit-section.is-cards {
  border-left-color: var(--card-green);
}

.profile-edit-section.is-tierlist {
  border-left-color: var(--gold);
}

.profile-edit-section.is-combos {
  border-left-color: var(--cta-color);
}

.profile-edit-section.is-matchups {
  border-left-color: var(--card-purple);
}

.profile-edit-section > header {
  margin-bottom: 0.75rem;
  padding: 0;
  background: none;
  border: 0;
}

.profile-type {
  align-self: center;
  font-size: 0.75rem;
  white-space: nowrap;
}

.profile-edit-line-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
}

.profile-edit-line-head > label {
  flex: 1 1 14rem;
  margin: 0;
}

.profile-edit-line-head > label input {
  margin: 0.2rem 0 0;
}

.profile-edit-line-head > .profile-muted {
  align-self: center;
  white-space: nowrap;
}

.profile-tools {
  display: flex;
  gap: 0.25rem;
}

.profile-tools button,
.profile-card-tools button {
  margin: 0;
  padding: 0.2rem 0.5rem;
  min-width: 2rem;
}

.profile-edit-line,
.profile-edit-item {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 0.6rem;
  background: var(--pico-card-sectioning-background-color);
}

.profile-edit-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0.75rem 0;
}

.profile-edit-cards li {
  position: relative;
  list-style: none;
  width: 100px;
}

.profile-edit-cards img {
  display: block;
  width: 100px;
  height: 140px;
  object-fit: cover;
  border-radius: 0.3rem;
}

.profile-edit-cards .tour-qty {
  bottom: auto;
  top: 0.25rem;
}

.profile-edit-cards.is-steps .tour-qty {
  right: auto;
  left: 0.25rem;
  background: var(--cta-color);
}

.profile-card-tools {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.profile-card-tools button {
  min-width: 0;
  flex: 1;
  padding: 0.1rem 0;
  font-size: 0.85rem;
}

.profile-edit-cards .profile-tools {
  margin-top: 0.25rem;
}

.profile-edit-cards .profile-tools button {
  flex: 1;
  min-width: 0;
  padding: 0.1rem 0;
}

.profile-search {
  max-width: 28rem;
}

.profile-search input {
  margin: 0;
}

.profile-single-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.profile-single-card img {
  width: 60px;
  height: 84px;
  object-fit: cover;
  border-radius: 0.25rem;
}

.profile-single-card .profile-search {
  flex: 1 1 14rem;
}

.profile-single-card > button {
  margin: 0;
}

.profile-add-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.profile-add-section button {
  margin: 0;
}

.profile-editor-videos .profile-edit-line-head {
  margin-bottom: 0.6rem;
}

.profile-delete {
  margin-top: 2rem;
}

@media (max-width: 760px) {
  .profile-hero {
    flex-direction: column;
  }

  .profile-cover {
    width: 7rem;
  }

  .profile-combo {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-cards {
    grid-template-columns: repeat(auto-fill, minmax(4.4rem, 1fr));
  }

  .profile-combo-stage li {
    width: 4.6rem;
  }

  .profile-videos {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-edit-cards li,
  .profile-edit-cards img {
    width: 76px;
  }

  .profile-edit-cards img {
    height: 106px;
  }
}

/* Set spoilers */

.spoiler-page {
  max-width: 72rem;
  margin-inline: auto;
}

.spoiler-head h1 {
  margin-bottom: 0.2rem;
}

.spoiler-muted,
.spoiler-credit {
  color: var(--pico-muted-color);
}

.spoiler-group {
  font-size: 1.1rem;
  margin: 1.25rem 0 0.6rem;
}

.spoiler-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0.75rem;
}

.spoiler-tile {
  display: flex;
  gap: 0.9rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-card-border-color);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.spoiler-tile:hover {
  border-color: var(--pico-primary);
  transform: translateY(-2px);
}

.spoiler-box {
  /* Box art is landscape, 3:2. */
  flex: 0 0 7.5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  border-radius: 0.4rem;
  overflow: hidden;
  background: var(--pico-card-sectioning-background-color);
  color: var(--pico-muted-color);
  font-size: 0.8rem;
}

.spoiler-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.spoiler-box-large {
  flex-basis: 15rem;
  height: 10rem;
}

.spoiler-tile-text,
.spoiler-hero-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.spoiler-tile-text small,
.spoiler-hero-text small {
  color: var(--pico-muted-color);
  letter-spacing: 0.04em;
}

.spoiler-tile-text strong {
  font-family: var(--display-font);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--pico-h1-color);
  overflow-wrap: anywhere;
}

.spoiler-tile-text > span {
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

/* How much of the set is revealed: a thin bar, the count under it. */
.spoiler-progress {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.15rem;
  max-width: 16rem;
  font-size: 0.78rem;
  color: var(--pico-muted-color);
}

.spoiler-bar {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pico-primary) var(--done), var(--pico-muted-border-color) var(--done));
}

.spoiler-back {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.spoiler-hero {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--pico-card-background-color), var(--pico-background-color));
  border: 1px solid var(--pico-card-border-color);
}

.spoiler-hero h1 {
  font-size: 1.5rem;
  margin: 0;
}

.spoiler-hero p,
.spoiler-hero form {
  margin: 0;
}

.spoiler-hero button {
  margin-top: 0.4rem;
  padding: 0.3rem 0.8rem;
  width: auto;
}

.spoiler-notice {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--pico-primary);
  background: var(--pico-card-background-color);
}

.spoiler-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.6rem;
  padding: 0;
  margin: 0;
}

.spoiler-card {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spoiler-card img,
.spoiler-unknown {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 300 / 419;
  border-radius: 0.4rem;
  object-fit: cover;
}

.spoiler-card a {
  display: block;
  transition: transform 0.15s;
}

.spoiler-card a:hover {
  transform: translateY(-2px);
}

/* A card not revealed yet: a card-shaped question mark. */
.spoiler-unknown {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgb(255 255 255 / 0.03) 10px 20px),
    var(--pico-card-sectioning-background-color);
  border: 2px dashed var(--pico-muted-border-color);
}

.spoiler-unknown span {
  font-family: var(--display-font);
  font-size: 2.6rem;
  color: var(--pico-muted-color);
}

.spoiler-code {
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.spoiler-code small {
  color: var(--pico-h1-color);
}

.spoiler-empty {
  margin-top: 1rem;
}

@media (max-width: 680px) {
  .spoiler-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .spoiler-box-large {
    flex-basis: auto;
    width: 12rem;
    height: 8rem;
  }

  .spoiler-grid {
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.4rem;
  }

  .spoiler-unknown span {
    font-size: 1.8rem;
  }
}
