/* styles — part 2 of 6 (css/2-pages-heroes-events.css). The site's one stylesheet, split in its
   original order: the parts are loaded in this order (partials/head.html,
   admin/index.html) and must stay so — later rules win ties. */

/* Three-part bar: an invisible spacer the same width as the toggle keeps
   the center block visually centered instead of drifting left once the
   toggle occupies the right edge. */
.footer-spacer {
  /* As wide as the right-hand group (the language switch, 76px, + 8px +
     the theme button, 44px), so the credits stay centred. */
  width: 128px;
  flex-shrink: 0;
}

.footer-center {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

/* "© 2026 Duel Commander Piacenza" always on one line: on narrow phones the
   room between the spacer and the theme toggle is ~230px, a bit less than
   it takes at full size — there its size follows the screen's width
   (≈ 13px on a 360px phone), up to the usual 1rem. */
.footer-center > :first-child {
  white-space: nowrap;
  font-size: min(1rem, 3.6vw);
}

.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

/* The site's version (js/version.js), first on the credits' line: small,
   faint — there to check which deploy is on screen, not to be read. A dot
   after it parts it from "Created by". */
.footer-version:not(:empty)::after {
  content: "·";
  margin-left: 6px;
}

.footer-version {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  opacity: 0.55;
}

.footer-credit img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  opacity: 0.8;
  transition: opacity 150ms ease, transform 150ms ease;
}

.footer-credit a:hover img {
  opacity: 1;
  transform: scale(1.12);
}

/* ---------------------------------------------------------------------- */
/* Shared page shell for every new tracker page                          */
/* ---------------------------------------------------------------------- */

.page-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  .pie-chart,
  .pie-legend-item,
  .commander-card-perspective {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .cs-wrap.is-open .cs-menu {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .cd-wrap.is-open .cd-popup {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .site-search-box.is-open .site-search-results {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

.page-heading {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

/* Deliberately no entrance animation and no loading-state hiding here — a
   detail page's <h1> starts as a plain "Caricamento..." placeholder
   (static HTML, present at first paint) and is simply overwritten in place
   once js/*-detail.js's first fetch resolves, the same way any other
   already-there text would update. Treating that swap as something to
   animate or hide until "ready" made it feel like part of the page's
   loading choreography; the title isn't meant to be — it's meant to just
   already be there, briefly wrong for a moment on a detail page, same as
   a list page's own static title (which never changes at all). */
.page-heading h1 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--text-title);
}

.admin-topbar h1 {
  margin: 0;
  font-size: 1.9rem;
  color: var(--text-title);
  animation: entrance-fade-up 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Admin's subview h3 titles (see .page-heading-row) only had their own
   inline margin-top: 0 — the browser's default h3 margin-bottom (~1em)
   was still there, making .page-heading's box taller than the text alone
   and pushing the text toward the top of it, away from true vertical
   center against the back button beside it. */
.page-heading h3 {
  margin: 0;
}

/* Commander detail page's Scryfall card art, pinned to its container's
   top-right corner (in the hero: css/4-profile-card.css .detail-hero-card). */
.commander-card-figure {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
}

/* Card-shaped loading placeholder, shown from first paint in exactly the
   spot and size the card will take (same positioning as
   .commander-card-figure; Scryfall "normal" image proportions, 488×680), so
   nothing around it moves when the real card replaces it. A soft brand-red shimmer sweeps across while waiting.
   js hides it once the card is revealed, or drops it if there's no image. */
.commander-card-skeleton {
  position: absolute;
  top: 0;
  right: 0;
  height: 280px;
  aspect-ratio: 488 / 680;
  border-radius: 12px;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--brand-red) 6%, transparent) 30%,
    color-mix(in srgb, var(--brand-red) 16%, transparent) 50%,
    color-mix(in srgb, var(--brand-red) 6%, transparent) 70%
  );
  background-size: 250% 100%;
  animation: card-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes card-skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}

:root[data-theme="dark"] .commander-card-skeleton {
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 30%,
    color-mix(in srgb, var(--brand-red-deep) 14%, transparent) 50%,
    rgba(255, 255, 255, 0.04) 70%
  );
}

@media (prefers-reduced-motion: reduce) {
  .commander-card-skeleton {
    animation: none;
  }
}

/* player.html "Album comandanti" card carousel (js/commander-carousel.js):
   phones — the current card centered, its neighbours peeking on both
   sides turned away like the sides of a drum, stats stacked below;
   desktop (from 880px) — the current card lined up with the page's left
   margin, the next ones peeking on the right (turned more steeply), a card
   leaving on the left fading out through a gradient at that edge rather
   than sliding past it. The stats below the cards at every width. The
   per-card looks are js applyDepth, switched at the same width. */
.cmd-carousel {
  /* Phones: same size as commander.html's card on mobile
     (.commander-card-face). The tighter gap below keeps a sliver of the
     neighbours in view beside a card this wide. */
  --cmd-card-w: min(260px, 80vw);
  --cmd-card-gap: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* No bottom margin: the next section's <h2> already brings its own. */
}

.cmd-carousel-main {
  min-width: 0;
}

/* A section heading with its "?" (.help-toggle-btn) right after the text —
   "Album comandanti" on player.html and account.html. */
.heading-help {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* league.html's "Regolamento" (js/league-rules.js — how the standings are
   scored; not for a Topdeck series): a full button in the hero's colour
   (--hero-btn, like the back pill), a book before the label and a chevron
   after it. On a computer at the right end of the numbers' line; up to
   820px (the hero one centred column) above the numbers, centred. */
.league-rules-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  box-sizing: border-box;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-pill);
  background: var(--hero-btn, #4a4345);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  text-shadow: none;
  cursor: pointer;
  transition: background 150ms ease;
}

.league-rules-btn:hover {
  background: var(--hero-btn-hover, #383233);
}

.league-rules-btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.league-rules-btn[hidden] {
  display: none;
}

.league-rules-btn svg {
  flex: none;
  width: 18px;
  height: 18px;
}

.league-rules-btn .league-rules-chevron {
  width: 16px;
  height: 16px;
  margin-left: -2px;
  opacity: 0.8;
}

/* Beside "Recap" (a closed league), "Regolamento" white — an event's
   "Liste" look (.results-menu-btn's colours, the hero buttons' size). */
.league-rules-btn.is-light {
  border-color: var(--hairline);
  background: #fff;
  color: var(--brand-red-deep);
}

.league-rules-btn.is-light:hover {
  border-color: var(--hairline-hover);
  background: #fff7f4;
}

:root[data-theme="dark"] .league-rules-btn.is-light {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: color-mix(in srgb, var(--brand-red) 55%, #fff);
}

:root[data-theme="dark"] .league-rules-btn.is-light:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* The heroes' share button (js/share.js): round, the icon alone, as tall
   as the others, at the end of .hero-actions. */
.league-rules-btn.is-icon {
  justify-content: center;
  width: 42px;
  padding: 0;
}

.league-rules-btn.is-icon svg {
  width: 19px;
  height: 19px;
}

/* The rules' pop-up (js/league-rules.js): a small label over each part;
   the league points by position as a ladder —
   red columns as tall as their points, lighter down the ladder, the places
   under them on a base line; the three special rules as cards, each its
   number big on a red tile (the "−1" on a dark one). */
.league-rules-label {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.league-rules-ladder {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 18px;
}

.league-rules-step {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Each column's room, 150px (the tallest's), the bar sitting on its base
   line; the place under it. */
.league-rules-col {
  display: flex;
  align-items: flex-end;
  height: 150px;
  border-bottom: 2px solid rgba(154, 28, 32, 0.15);
}

.league-rules-bar {
  display: flex;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding-top: 8px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #e0262a, #a10f17);
  color: #fff;
}

.league-rules-bar b {
  font-size: 1.3rem;
  line-height: 1;
}

.league-rules-step:nth-child(3) .league-rules-bar {
  background: linear-gradient(180deg, #ef6b6e, #c0333a);
}

.league-rules-step:nth-child(4) .league-rules-bar {
  background: linear-gradient(180deg, #f39a9c, #d75a60);
}

.league-rules-step:nth-child(5) .league-rules-bar {
  background: linear-gradient(180deg, #f7c4c5, #e88e92);
  color: #6e0a10;
}

.league-rules-place {
  padding-top: 6px;
  color: var(--text-title);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.league-rules-bonuses {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.league-rules-bonuses li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
}

.league-rules-num {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--brand-red);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
}

.league-rules-num.is-minus {
  background: #3a3634;
}

.league-rules-bonuses li > span:last-child {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.league-rules-bonuses b {
  display: block;
  color: var(--text-title);
  font-size: 0.95rem;
}

:root[data-theme="dark"] .league-rules-col {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

:root[data-theme="dark"] .league-rules-num.is-minus {
  background: rgba(255, 255, 255, 0.16);
}

/* Small explanation pop-up (a <dialog> sharing .ecal-dialog's box). */
/* Open: a column — the title fixed, the content scrolling on its own under
   it (.info-dialog-body), its scrollbar inside the rounded box rather than
   over its corners (as when the dialog itself scrolled). Never closer than
   24px to the screen's edges (so on a phone it doesn't touch them). */
.ecal-dialog.info-dialog {
  width: min(360px, calc(100vw - 48px));
}

.info-dialog[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
}

.info-dialog-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.info-dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.info-dialog-head h3 {
  margin: 0;
  color: var(--text-title);
  font-size: 1.1rem;
  font-weight: 800;
}

.info-dialog p {
  margin: 0;
  line-height: 1.5;
}

.info-dialog p + p {
  margin-top: 10px;
}

/* account.html's "Effetti della carta" (js/card-cosmetics.js
   openCardEffectsInfo): a bit wider than the other pop-ups for a row of up
   to four previews; per family, its name, a line, then one small live
   preview per tier (a blank .player-card dressed by the real code) with its
   name and how much it takes. Scrolls inside on a short screen (the
   dialog's own max-height). */
#card-effects-dialog {
  width: min(440px, calc(100vw - 48px));
}

/* "Novità" (js/header-news.js — the shared pop-up, .news-dialog): a red
   band on top in the top bar's gradient, with a soft glow and the faint dot
   grid — the bell in a white disc, "Novità" and "N annunci · N da leggere"
   in white, the close button glass on it — then, on a faint cream, the
   announcements across the whole width, a thin rule between them (the
   unread ones with a red "Nuovo" chip on the right), each sliding in a
   beat after the one before. None: a big faded bell. */
.ecal-dialog.info-dialog.news-dialog {
  width: min(460px, calc(100vw - 48px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #fff9f7;
  box-shadow: 0 30px 70px rgba(40, 6, 9, 0.35);
}

.news-dialog .info-dialog-head {
  position: relative;
  justify-content: flex-start;
  gap: 14px;
  margin: 0;
  padding: 18px 18px 18px 20px;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 140, 140, 0.35), transparent 55%),
    radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1.6px) 0 0 / 14px 14px,
    linear-gradient(135deg, #7e0c13, #dc181c);
  color: #fff;
}

.news-dialog .info-dialog-head::before {
  content: "";
  flex: 0 0 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc181c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / 22px no-repeat;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.18), 0 6px 14px rgba(40, 6, 9, 0.3);
}

.news-dialog .info-dialog-titles {
  flex: 1;
  min-width: 0;
}

.news-dialog .info-dialog-head h3 {
  color: #fff;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}

.news-dialog .info-dialog-subtitle {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8rem;
  font-weight: 700;
}

.news-dialog .ecal-close,
:root[data-theme="dark"] .news-dialog .ecal-close {
  align-self: flex-start;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.news-dialog .ecal-close:hover,
:root[data-theme="dark"] .news-dialog .ecal-close:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.28);
}

/* The announcements one under the other across the whole width (lined up
   with the band's text), a thin rule between them — no cards. */
.news-dialog .info-dialog-body {
  padding: 4px 20px 8px;
}

.news-item {
  position: relative;
  padding: 16px 0;
  animation: news-item-in 340ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.news-item + .news-item {
  border-top: 1px solid rgba(154, 28, 32, 0.14);
}

.news-new {
  position: absolute;
  top: 16px;
  right: 0;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: #dc181c;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.news-title {
  margin: 0 0 6px;
  color: var(--text-title);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.news-item.is-new .news-title {
  padding-right: 64px;
}

.info-dialog .news-body {
  color: var(--text-body);
  font-size: 0.93rem;
  line-height: 1.55;
  /* A plain textarea in admin: the line breaks it was typed with. */
  white-space: pre-line;
}

/* An event's announcement (made when it's first closed): a button to the
   event's page under its text — the site's red pill, a size down. */
.info-dialog .news-link {
  gap: 4px;
  min-height: 36px;
  margin-top: 12px;
  padding: 0 12px 0 16px;
  font-size: 0.9rem;
  box-shadow: 0 6px 14px rgba(220, 24, 28, 0.22);
}

.info-dialog .news-link svg {
  width: 16px;
  height: 16px;
}

.info-dialog .news-link:hover {
  color: #fff;
  text-decoration: none;
}

.news-empty {
  padding: 26px 10px 18px;
  color: var(--text-muted);
  text-align: center;
}

.news-empty svg {
  width: 56px;
  height: 56px;
  color: rgba(220, 24, 28, 0.25);
}

.news-empty p {
  margin-top: 8px;
  font-weight: 700;
}

@keyframes news-item-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-item {
    animation: none;
  }
}

:root[data-theme="dark"] .ecal-dialog.info-dialog.news-dialog {
  border: 0;
  background: #1f1416;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

:root[data-theme="dark"] .news-item + .news-item {
  border-top-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .news-empty svg {
  color: rgba(255, 110, 110, 0.35);
}

.card-effects-family {
  margin-top: 18px;
}

.card-effects-family h4 {
  margin: 0 0 4px;
  color: var(--brand-red-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-effects-family p {
  color: var(--text-muted-2);
  font-size: 0.9rem;
}

.card-effects-tiers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.card-effects-tiers li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.3;
}

.card-effects-tiers li strong {
  display: block;
  color: var(--text-title);
}

/* Landscape like the real card (2:1, since 2026-10-23): as wide as its
   column allows, 104px at most; its corners rounded to its size. */
.player-card.pc-preview {
  width: 100%;
  max-width: 104px;
  animation: none;
}

.pc-preview .pc-frame {
  border-radius: calc(8px + var(--rim));
}

.pc-preview .pc-surface {
  border-radius: 8px;
}

.pc-preview .pc-art {
  background: linear-gradient(160deg, #46577a, #7a5a8c 55%, #a06a4a);
}

/* An invisible stand-in for a real card's glass panel — just its height —
   so the name (and the Podio bar behind it) sits where it does on a real
   card. */
.pc-preview .pc-panel {
  height: 9cqw;
  padding: 0;
  border: none;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* The seal and the stars, real size, would be a few px here: bigger in
   the previews so they read. */
.pc-preview .pc-fx-seal {
  width: 20cqw;
  height: 11cqw;
}

/* Centred in the preview's foot (on a 64px card the left edge is only a
   few px away — the star ran into it). */
.pc-preview .pc-foot {
  justify-content: center;
}

.pc-preview .pc-fx-stars {
  margin-left: 0;
}

.pc-preview .pc-fx-star {
  font-size: 12cqw;
}

.pc-preview .pc-fx-star-count {
  font-size: 9cqw;
}

/* A small card's shadow, not the full-size card's (scoped to the list to
   outrank .player-card.fx-rim .pc-frame, later in this file). */
.card-effects-tiers .player-card.pc-preview .pc-frame,
:root[data-theme="dark"] .card-effects-tiers .player-card.pc-preview .pc-frame {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

/* The "?" pop-ups (js/info-dialog.js). In: rises and scales up slightly as
   it fades in,
   backdrop fading with it.
   Out: the reverse, a touch quicker — js adds .is-closing and waits for
   the animation before the real close(). */
.info-dialog[open] {
  animation: info-dialog-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.info-dialog[open]::backdrop {
  animation: info-backdrop-in 220ms ease;
}

.info-dialog.is-closing {
  animation: info-dialog-out 160ms ease-in forwards;
}

.info-dialog.is-closing::backdrop {
  animation: info-backdrop-out 160ms ease-in forwards;
}

@keyframes info-dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

@keyframes info-dialog-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

@keyframes info-backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes info-backdrop-out {
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .info-dialog[open],
  .info-dialog[open]::backdrop,
  .info-dialog.is-closing,
  .info-dialog.is-closing::backdrop {
    animation: none;
  }
}

/* Phones (below 880px): the current card centered in the track, the side
   padding letting the first and last card reach the center too; the mask
   fades the track out from the current card's edges to its own left/right
   edges, so the peeking cards dissolve instead of being cut off (it fades
   the track's own visible box, not its scrolling content). Desktop's
   left-aligned version: the 880px block below. */
.cmd-carousel-track {
  position: relative;
  display: flex;
  gap: var(--cmd-card-gap);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 calc(50% - var(--cmd-card-w) / 2), #000 calc(50% + var(--cmd-card-w) / 2), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 calc(50% - var(--cmd-card-w) / 2), #000 calc(50% + var(--cmd-card-w) / 2), transparent 100%);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* Vertical room for the current card's shadow (an overflow-x scroller
     clips vertically too). */
  padding: 14px calc(50% - var(--cmd-card-w) / 2) 26px;
  scrollbar-width: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.cmd-carousel-track::-webkit-scrollbar {
  display: none;
}

/* Mouse drag (js/commander-carousel.js → js/drag-scroll.js): the current
   card shows a grab cursor (peeking ones keep the pointer: a click still
   moves to them); no text selection (the name-only fallback cards).
   Snapping is off during the drag and its glide after. */
html:not(.nav-mobile) .cmd-carousel-track.is-draggable {
  user-select: none;
}

html:not(.nav-mobile) .cmd-carousel-track.is-draggable .cmd-carousel-slide.is-active {
  cursor: grab;
}

.cmd-carousel-track.is-dragging {
  scroll-snap-type: none;
}

/* As specific as the grab rule above, and after it, so it wins mid-drag. */
html:not(.nav-mobile) .cmd-carousel-track.is-draggable.is-dragging,
html:not(.nav-mobile) .cmd-carousel-track.is-draggable.is-dragging .cmd-carousel-slide {
  cursor: grabbing;
}

/* border-box: a card with a frame (.fx-rim, below — a wider border) stays
   exactly as wide as the others, so the cards keep an even step. */
.cmd-carousel-slide {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 var(--cmd-card-w);
  aspect-ratio: 488 / 680;
  scroll-snap-align: center;
  /* Rounded like the card image itself (a Magic card's corner ≈ 4.75% of
     its width), measured on the image — the box inside the border
     (--rim: a frame's width, else the 1px edge) — plus that border: so the
     inside curve the image is clipped to is exactly the image's own corner,
     and a frame follows the card's edge all the way round. */
  border-radius: calc((var(--cmd-card-w) - 2 * var(--rim, 1px)) * 0.0475 + var(--rim, 1px));
  overflow: hidden;
  background: rgba(220, 24, 28, 0.06);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  /* transform/opacity/z-index are set per scroll frame by js
     (applyDepth, the drum effect) — no transition on them, they already
     follow the scroll continuously. */
  cursor: pointer;
  transition: box-shadow 260ms ease;
  will-change: transform, opacity;
}

/* Sized to fit the track's padding (14px above, 26px below), which the
   scroller clips at: 10px above, 26px below. */
.cmd-carousel-slide.is-active {
  cursor: default;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.cmd-carousel-track:focus-visible .cmd-carousel-slide.is-active {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

/* Not on a framed card (.fx-rim): its background is the frame. */
.cmd-carousel-slide.is-loading:not(.fx-rim) {
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--brand-red) 6%, transparent) 30%,
    color-mix(in srgb, var(--brand-red) 16%, transparent) 50%,
    color-mix(in srgb, var(--brand-red) 6%, transparent) 70%
  );
  background-size: 250% 100%;
  animation: card-skeleton-shimmer 1.4s ease-in-out infinite;
}

.cmd-carousel-slide.has-image {
  border-color: transparent;
}

/* No image (not found on Scryfall): the name, in a card-shaped box. */
.cmd-carousel-fallback {
  padding: 12px;
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
}

.cmd-carousel-slide.is-loading .cmd-carousel-fallback,
.cmd-carousel-slide.has-image .cmd-carousel-fallback {
  visibility: hidden;
}

/* fill, not cover: the box inside the border is a hair off the card's
   proportions (the border takes the same px from both sides), and cover
   cropped a px or two off the image's edges — shifting its rounded corners
   off the box's. The stretch is under 1%, invisible. */
.cmd-carousel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: opacity 240ms ease;
  user-select: none;
}

.cmd-carousel-slide.has-image .cmd-carousel-img {
  opacity: 1;
}

/* Album cards' special effects (js/commander-carousel.js ALBUM_EFFECTS),
   on the album's cards and the "?" pop-up's small previews alike
   (.album-card), the same looks as the player card's (js/card-cosmetics.js):
   - a frame for the events played with that commander (.fx-rim-1…4:
     silver → animated foil → gold → mythic orange) — the card's own border,
     the gradient painted on the border box under a dark padding-box fill, so
     the image (absolute, inset 0 = the padding box) and the clip
     (overflow, the inner radius) sit wholly inside it: nothing dark can
     show through the frame's edge;
   - a finish over the image for the matches won with it (.fx-art-1…4, the
     player card's .pc-fx-art / .pc-fx-sparks layers and rules, here over
     the whole image — no panel to fade out for — and above the image,
     appended once it loads). A size container, so those layers' cqw scale
     with the card. */
.album-card {
  container-type: inline-size;
}

/* A faint outer edge (an outline drawn over the frame's outer pixel, which
   follows the corners): on the white page a light frame's near-white parts
   would otherwise vanish, leaving only its grey ones — which read as a
   shadow cut off at the corners. */
.album-card.fx-rim {
  border: var(--rim) solid transparent;
  outline: 1px solid rgba(40, 44, 50, 0.22);
  outline-offset: -1px;
}

/* The player card's silver, here evened out: grey-to-light in short bands
   all the way round, no side left near-white (see the edge above). */
.album-card.fx-rim-1 {
  --rim: 4px;
  background:
    linear-gradient(#1d1315, #1d1315) padding-box,
    linear-gradient(135deg, #c9d0d6, #8a939b 20%, #eef1f3 40%, #9aa3ab 60%, #e3e7ea 80%, #8a939b) border-box;
}

.album-card.fx-rim-2 {
  --rim: 4px;
  background:
    linear-gradient(#1d1315, #1d1315) padding-box,
    conic-gradient(from var(--pc-fx-angle), #ffffff, #c9f3ff 8%, #b9c4ff 18%, #e9b8ff 30%, #ffd3e8 42%, #fff2c2 55%, #c6ffe2 68%, #b8eaff 82%, #ffffff) border-box;
  animation: pc-fx-turn 5s linear infinite;
}

.album-card.fx-rim-3 {
  --rim: 4px;
  background:
    linear-gradient(#1d1315, #1d1315) padding-box,
    conic-gradient(from var(--pc-fx-angle), #fffbe6, #ffe17d 8%, #f0bd3c 22%, #c8901a 50%, #f0bd3c 78%, #ffe17d 92%, #fffbe6) border-box;
  animation: pc-fx-turn 4s linear infinite;
}

.album-card.fx-rim-4 {
  --rim: 4px;
  background:
    linear-gradient(#1d1315, #1d1315) padding-box,
    conic-gradient(from var(--pc-fx-angle), #ffe2c4, #ffab5e 8%, #f26b1d 22%, #b8400c 50%, #f26b1d 78%, #ffab5e 92%, #ffe2c4) border-box;
  animation: pc-fx-turn 4s linear infinite;
}

.album-card .pc-fx-art {
  z-index: 1;
  -webkit-mask-image: none;
  mask-image: none;
}

/* The "?" pop-up's small blank album card: a neutral "art" (so the foil
   has something to shine on) inside its frame. */
.album-preview {
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 52px;
  aspect-ratio: 488 / 680;
  overflow: hidden;
  border-radius: 5px;
  background: #1d1315;
}

.album-preview-art {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #46577a, #7a5a8c 55%, #a06a4a);
}

/* The sparks' 1-2px dots would vanish at this size: bigger, on a tighter
   tile, fading out later. */
.album-preview .pc-fx-sparks {
  --sparks-tile-w: 28px;
  --sparks-tile-h: 36px;
  background-image:
    radial-gradient(circle at 25% 30%, #fff3c4 0 1.5px, rgba(255, 205, 90, 0.7) 2.5px, transparent 4px),
    radial-gradient(circle at 75% 75%, #ffe48a 0 1.5px, rgba(255, 190, 60, 0.7) 2.5px, transparent 4px);
  -webkit-mask-image: linear-gradient(to top, #000 20%, transparent);
  mask-image: linear-gradient(to top, #000 20%, transparent);
  animation-duration: 3s;
}

@media (prefers-reduced-motion: reduce) {
  .album-card.fx-rim {
    animation: none;
  }
}

/* Holds the charts' own ‹ • › pill bar (.chart-carousel-nav, the same look
   as on Comandanti — its 3-dot window from js renderDots), placed here:
   centred, under the cards. */
.cmd-carousel-nav {
  display: flex;
  justify-content: center;
  margin-top: -8px;
}

.cmd-carousel-nav .chart-carousel-nav {
  margin: 0;
}

/* Left-aligned at every width, like the page's own stat tiles above. */
.cmd-carousel-stats {
  min-width: 0;
}

/* A partner pair too long for one line (js/commander-carousel.js fitName):
   one commander per line. */
.cmd-carousel-name.is-split > .cmd-carousel-name-part {
  display: block;
}

.cmd-carousel-name {
  color: var(--text-title);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.cmd-carousel-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Both tiles' values (count and date) at the same, smaller size. Two
   classes: .stat-tile-value comes later in this file and would win over a
   single-class rule. */
.stat-tile-value.cmd-carousel-stat-value {
  font-size: 1.15rem;
  line-height: 1.3;
  margin-top: 8px;
}

/* The Winrate tile's V-S-P record, after the percentage: smaller, muted. */
.cmd-carousel-record {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (min-width: 880px) {
  .cmd-carousel {
    /* About commander.html's own desktop card, whose height js stretches
       from the title to the stat tiles, so it has no fixed size to copy. */
    --cmd-card-w: 260px;
    --cmd-card-gap: 16px;
  }

  /* The current card plus room for the next one's steeply turned peek
     (js applyDepth); the stats below it, in the column's whole width
     (player.html's album sits in half the page, beside Storico partite). */
  .cmd-carousel-main {
    width: 100%;
    max-width: calc(var(--cmd-card-w) * 1.7);
  }

  /* Desktop: the current card snapped to the left — lined up with the
     page's left margin — the right padding letting the last card reach it
     too. The track reaches 20px further left than that (negative margin,
     same padding, snapped past it: scroll-padding), room for the card's
     shadow, which the scroller clips at its edges like everything in it.
     The mask only fades the right side, from the current card's right
     edge; a card leaving on the left gets its own moving fade from js
     (applyDepth), transparent from the card's slot on — so nothing of it
     shows in that room. */
  .cmd-carousel-track {
    -webkit-mask-image: linear-gradient(to right, #000 calc(var(--cmd-card-w) + 20px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(var(--cmd-card-w) + 20px), transparent 100%);
    margin-left: -20px;
    padding: 14px calc(100% - var(--cmd-card-w)) 26px 20px;
    scroll-padding-left: 20px;
  }

  .cmd-carousel-slide {
    scroll-snap-align: start;
  }

  /* Cast down-right, sized to fit the track's room: 13px to the left
     (of 20), 10px above (of 14), 26px below (of 26). */
  .cmd-carousel-slide.is-active {
    box-shadow: 5px 8px 18px rgba(0, 0, 0, 0.22);
  }

  /* Drawn inside the card: outside, its left side would be clipped. */
  .cmd-carousel-track:focus-visible .cmd-carousel-slide.is-active {
    outline-offset: -2px;
  }

  /* Centered under the current card (at the left), not the whole track. */
  .cmd-carousel-nav {
    width: var(--cmd-card-w);
  }
}

:root[data-theme="dark"] .cmd-carousel-slide.is-loading:not(.fx-rim) {
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 30%,
    color-mix(in srgb, var(--brand-red-deep) 14%, transparent) 50%,
    rgba(255, 255, 255, 0.04) 70%
  );
}

@media (prefers-reduced-motion: reduce) {
  .cmd-carousel-slide,
  .cmd-carousel-img {
    transition: none;
  }

  .cmd-carousel-slide.is-loading {
    animation: none;
  }
}

@keyframes commander-card-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* perspective (not directly on .commander-card-flipper) is what gives the
   flip below its 3D depth rather than looking like a flat horizontal
   squash — kept on its own wrapper, one level below .commander-card-figure,
   rather than on the figure itself: perspective establishes a new
   stacking context on whatever it's set on, and .commander-card-flip-btn
   is a sibling of this wrapper, not a child of it — keeping the two out
   of the same stacking context is what actually fixed the button not
   being reliably clickable over the card (pointer-events: none on the
   svg, below, wasn't enough on its own).

   The entrance animation lives here too, for the exact same reason —
   putting it on .commander-card-figure itself (tried first) reintroduced
   the same button-not-clickable bug, since a CSS Animation that animates
   transform makes the browser treat its target as needing its own
   stacking context for as long as animation-fill-mode holds it there,
   regardless of the transform settling back to none. Removing the hidden
   attribute (js/commander-detail.js `revealCard`, once the front image has
   loaded) inserts this into the render tree fresh, which is what
   makes the animation actually play — it wouldn't if this had been
   visible the whole time. */
.commander-card-perspective {
  perspective: 1200px;
  animation: commander-card-in 450ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Double-faced commanders only (js/commander-detail.js only reveals the
   flip button when a second face actually exists) — front and back are
   both real <img> elements stacked in the same spot the whole time, not
   swapped on click, so the 3D rotation below has something physically "on
   the other side" to reveal rather than needing to cross-fade/swap
   mid-animation. */
.commander-card-flipper {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.4, 0.2, 0.2, 1);
}

.commander-card-flipper.is-flipped {
  transform: rotateY(180deg);
}

/* The space it takes is imposed, not left to the downloaded image: always
   Scryfall's card proportions (488×680, same as the loading placeholder and
   the player card), one side set (the JS height on desktop, the width on
   phones) and the other following from this ratio; an image that ever came
   in other proportions is cropped to fill the box (object-fit: cover), not
   resized around. */
.commander-card-face {
  display: block;
  width: auto;
  height: auto;
  aspect-ratio: 488 / 680;
  object-fit: cover;
  /* (In the hero, css/4 `.detail-hero .commander-card-face`: the column's
     width, no cap.) */
  max-width: 320px;
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  /* The face rotated away from the viewer (whichever one isn't currently
     showing) renders as literally invisible instead of a mirror-flipped
     image of itself. */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.commander-card-face-front {
  /* In normal flow — its own natural size (height set by JS, width
     derived from that) is what .commander-card-flipper itself sizes to,
     since the flipper is otherwise just a plain, unsized div. */
  position: relative;
}

.commander-card-face-back {
  /* width/height: 100% (not auto) against the flipper's own definite
     size — inset: 0 alone with width/height: auto (tried first) relies on
     browsers correctly "stretching" an absolutely positioned <img> to fill
     its containing block, which — like the height: 100% flex-stretch
     attempt earlier on this same page — turned out unreliable in practice
     (rendered oversized, close to the image's own intrinsic size instead
     of matching the front face). Percentage sizing against a definite
     ancestor size is the more reliably-supported path. max-width: none
     since .commander-card-face's own 320px cap is meant for the
     JS-height-driven front face, not relevant to this one sizing off it.
     Pre-rotated 180deg from the start: with the flipper itself also
     rotating, this face goes 180->360deg (i.e. back to facing the viewer)
     in lockstep with the front's 0->180deg (i.e. away from the viewer). */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  transform: rotateY(180deg);
}

.commander-card-flip-btn {
  position: absolute;
  top: 50%;
  right: -14px;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  /* Brand red, not a neutral dark tint — the site's own accent color
     family, same reasoning as .badge-status-open elsewhere: any small
     floating accent like this should read as "part of the site" rather
     than a generic dark UI chrome color. */
  background: rgba(220, 24, 28, 0.78);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-card-hover);
  transition: background 150ms ease, transform 150ms ease;
}

/* Same fix as .field[hidden] elsewhere — this
   rule's own display: flex above has the same specificity as the browser
   default [hidden] { display: none; }, but author styles always beat
   user-agent ones regardless of specificity, so without this override the
   hidden attribute was silently doing nothing and the button showed for
   every commander, not just double-faced ones. */
.commander-card-flip-btn[hidden] {
  display: none;
}

.commander-card-flip-btn:hover {
  background: rgba(220, 24, 28, 0.95);
  transform: translateY(-50%) scale(1.06);
}

.commander-card-flip-btn svg {
  width: 18px;
  height: 18px;
  /* Guarantees every click within the button's box — icon included — is
     handled by the <button> itself, not intercepted by the svg/its paths
     (a common source of "button not clickable right on the icon" bugs). */
  pointer-events: none;
}

@media (max-width: 640px) {
  /* Bigger touch target on mobile than the desktop 36px — comfortably
     tappable without needing to aim, now that the card itself is bigger
     here too. right: -14px (desktop) is kept as-is; it's already a
     reasonable overhang at this size. */
  .commander-card-flip-btn {
    width: 48px;
    height: 48px;
  }

  .commander-card-flip-btn svg {
    width: 24px;
    height: 24px;
  }
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: -14px 0 22px;
}

.page-loading,
.page-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 6px 0;
}

.page-error {
  color: var(--brand-red-deep);
  font-weight: 700;
  padding: 6px 0;
}

/* js/ui.js showError: the message, its "Riprova" button under it. */
.page-error-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}

.page-error-box .page-error {
  margin: 0;
  padding: 0;
}

/* Sits to the left of the page's <h1> (or h3, in admin's subviews) — see
   .page-heading-row below, which wraps the two together. Vertically
   centered (desktop) against the title, or the title+subtitle pair
   together where a page has one (e.g. event.html's date/meta line) — see
   .page-heading-row's own mobile override, though, for the one case
   (commander.html) where centering isn't actually what's wanted. */
.page-heading-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 640px) {
  /* (The admin's heading rows.) The button aligned to the top of the
     heading, so a heading that wraps keeps it beside the first line. */
  .page-heading-row {
    align-items: flex-start;
  }
}

.page-heading-row .page-heading {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.page-heading-row .page-subtitle {
  margin: 4px 0 0;
}

/* Round icon-only back button — the destination ("Tutti i comandanti" etc.)
   is preserved as aria-label/title on the link itself rather than visible
   text, since there's no text left in the DOM to announce it otherwise.
   44px is the usual minimum comfortable touch-target size. */
.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand-red);
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.breadcrumb-link:hover {
  background: var(--brand-red-deep-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

/* Smaller in admin's h3 subview headers than the public h1 pages — a
   full 44px circle next to h3's smaller text made the size mismatch
   itself read as misalignment, even once actually centered. */
.page-heading-row:has(h3) .breadcrumb-link {
  width: 32px;
  height: 32px;
}

.page-heading-row:has(h3) .breadcrumb-link svg {
  width: 16px;
  height: 16px;
}

.breadcrumb-link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  /* The chevron shape is mathematically centered in its own 24x24 viewBox,
     but reads as sitting slightly right of center once flex-centered in
     the circle — its "point" concentrates visual weight on the left side,
     the open "V" end leaves more empty space on the right, a common
     optical-vs-geometric mismatch with chevron/arrow glyphs specifically.
     Nudged left to compensate for how it actually looks, not just its
     coordinates. */
  transform: translateX(-1px);
}

/* Stat tiles */

.stat-tile {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card-sm);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-card);
  padding: 18px;
  backdrop-filter: blur(10px);
  /* Fades up like the site's other reveal-on-load cards. */
  animation: entrance-fade-up 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.stat-tile-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-tile-value {
  color: var(--brand-red);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  margin-top: 4px;
}

/* league.html's hero, like player.html's (.profile-hero.detail-hero
   .league-hero, js/league-detail.js): the name, "In corso" / "Conclusa" and
   the dates under it, then the numbers. */
.league-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
}

/* event.html's hero (.event-hero, js/event-detail.js), built like the
   league's: the results / decklists links right after the name (wrapping
   to their own line when the name leaves no room), the date and the league
   (a link) in the meta line under them. */
.event-hero-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
}

.event-hero-title-row .profile-hero-name {
  min-width: 0;
}

@media (max-width: 820px) {
  .event-hero-title-row {
    justify-content: center;
  }
}

.event-hero-meta a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.45);
  text-underline-offset: 3px;
}

.event-hero-meta a:hover {
  text-decoration-color: #fff;
}

#event-results:not([hidden]) {
  display: inline-flex;
  align-items: center;
  text-shadow: none;
}

/* The heroes' buttons (.hero-actions): event.html's "Recap" and "Liste",
   league.html's "Recap" (a closed league) and "Regolamento" — the first
   in the hero's colour (.league-rules-btn), the other white, as tall, its
   text the same size. On a computer at the right end of the numbers' line;
   up to 820px above the numbers, centred. */
.hero-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.hero-actions[hidden] {
  display: none;
}

.hero-actions .results-menu-btn {
  height: 42px;
  padding: 0 16px;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.hero-actions .results-menu-btn svg {
  width: 18px;
  height: 18px;
}

:is(.event-hero, .league-hero) .profile-hero-stats:has(> .hero-actions:not([hidden])) {
  display: flex;
  align-items: center;
  gap: 20px;
}

:is(.event-hero, .league-hero) .profile-hero-stats > .hero-actions {
  margin-left: auto;
}

@media (max-width: 820px) {
  :is(.event-hero, .league-hero) .profile-hero-stats:has(> .hero-actions:not([hidden])) {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  :is(.event-hero, .league-hero) .profile-hero-stats > .hero-actions {
    order: -1;
    align-self: center;
    margin-left: 0;
  }
}

/* "In corso" / "Conclusa" in the hero: the site's status chip
   (.status-chip, below with .badge-status) as see-through glass on the art
   — white text and edge, a slight blur; the dot keeps its colours. */
.league-hero-meta .badge-status.status-chip,
:root[data-theme="dark"] .league-hero-meta .badge-status.status-chip {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  text-shadow: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.league-hero-meta .badge-status-closed.status-chip::before,
:root[data-theme="dark"] .league-hero-meta .badge-status-closed.status-chip::before {
  background: rgba(255, 255, 255, 0.55);
}

/* A running league's "In corso" after its start date (js/league-detail.js
   leagueDateRange: "26 set 2026 – In corso"): plain text, like the date —
   no chip, no dot. (:root and the id: over the chip's own rules, dark mode
   included.) The "Conclusa" chip standing alone keeps its look. */
:root .league-hero-meta #league-dates .badge-status.status-chip {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

:root .league-hero-meta #league-dates .badge-status.status-chip::before {
  display: none;
}

/* No pulsing ring in the hero at all (the "In corso" chip's ::after, its
   live dot's halo): after the dates it outlived the hidden dot, a green
   dot blinking on its own. */
.league-hero-meta .badge-status-open.status-chip::after {
  display: none;
}

/* The dates holding the chip ("12 set 2026 – ● In corso"): on one line,
   centred on each other. */
#league-dates:not([hidden]) {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Up to 820px the hero is one centred column. */
@media (max-width: 820px) {
  .league-hero-meta {
    justify-content: center;
  }
}

/* The numbers all white: no winrate among them, so no red pill on the
   first one. */
#league-stats .stat-tile:first-child .stat-tile-value,
:root[data-theme="dark"] #league-stats .stat-tile:first-child .stat-tile-value,
#event-stats .stat-tile:first-child .stat-tile-value,
:root[data-theme="dark"] #event-stats .stat-tile:first-child .stat-tile-value {
  align-self: auto;
  padding: 0.12em 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-shadow: inherit;
}

/* A player's handle shown inline next to their name (leaderboards, match
   lists) — the muted tone of the small meta labels, but kept in whatever
   case it was actually entered in admin, not forced uppercase. */
.player-handle {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Leghe & Eventi (events.html, js/events-page.js; option D1, "Schede", of a
   mockup, 2026-10-30): two tabs (.profile-tabs, js/tabs.js — the pill bar
   on a computer, the sticky segmented control on touch screens), "In corso"
   — the league in progress as one white card, its next event beside it, the
   Topdeck series a row under it — and "Archivio", the concluded leagues in a
   grid of uniform tiles. Only one with anything in it: no tabs at all. */
.ev-tabs[hidden] {
  display: none;
}

.ev-tab-count {
  margin-left: 3px;
  font-size: inherit;
  opacity: 0.65;
}

.ev-panels > section:not(.is-current) {
  display: none;
}

#events-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ev-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  box-sizing: border-box;
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(154, 28, 32, 0.18);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(80, 10, 14, 0.08);
  color: var(--text-title);
  font: inherit;
  text-align: left;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: entrance-fade-up 380ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

a.ev-tile:hover,
button.ev-tile:hover {
  box-shadow: 0 8px 20px rgba(80, 10, 14, 0.14);
  text-decoration: none;
  transform: translateY(-2px);
}

button.ev-tile {
  cursor: pointer;
}

.ev-tile:focus-visible {
  outline: 3px solid var(--brand-red);
  outline-offset: 3px;
}

.ev-tile-k {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* An online league's label (js/events-page.js): endstep's mark before it,
   overhanging its line by a hair so the label stays as tall as the others'. */
.ev-tile-k .endstep-mark {
  margin-block: -0.1em;
}

.ev-tile-t {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-tile-s {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-ico {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* The league card, one link to the league (the whole card lifts on hover,
   like the other tiles — since 2026-11-12; before, its two parts were
   separate links to the same page): on the left "Lega" (no status
   chip, by choice: the tab says it), the name (one line, fitted by js/events-page.js fitBigNames, "…" if
   it still doesn't fit at the smallest size), the numbers in small, the
   ring of events played on their right (.league-ring, css/1); its next
   event on the right, a hairline between — under it from 820px down. */
.ev-tile.ev-league {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  padding: 0;
}

.ev-league-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 16px 24px;
}

/* Its text, then the ring (js/ui.js leagueRingHtml) on its right — 76px,
   so the text sets the card's height, not the ring. */
.ev-league .league-ring {
  --ring: 76px;
}

.ev-league .league-ring-label b {
  font-size: 1.2rem;
}

/* Its text, then the ring (js/ui.js leagueRingHtml) on its right. */
.ev-league-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* Tight (since the ring took the "N di M eventi giocati" line's place,
   2026-10-30): the label, the name, the numbers close under each other. */
.ev-league .ev-tile-t {
  margin: 6px 0 0;
  font-size: 1.45rem;
  line-height: 1.15;
}

.ev-league-played {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.ev-league-played b {
  color: var(--text-value);
}

.ev-league-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.ev-league-nums > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Its next event: the date as a small calendar sheet (solid red), its label
   red, the name and a line under it, the start time big and red on the
   right. */
.ev-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 20px 24px;
  border-left: 1px solid rgba(154, 28, 32, 0.14);
}

.ev-cal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 52px;
  height: 56px;
  border-radius: 12px;
  background: rgba(220, 24, 28, 0.08);
  color: var(--brand-red-deep);
  line-height: 1;
}

.ev-cal small {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ev-cal b {
  margin-top: 3px;
  font-size: 1.45rem;
  font-weight: 800;
}

.ev-cal b:only-child {
  margin-top: 0;
}

.ev-slot-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.ev-slot-name {
  margin-top: 3px;
  overflow: hidden;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-slot-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.ev-slot-side {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
}

.ev-slot-time {
  color: var(--brand-red);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.ev-slot-players {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.ev-slot.is-next .ev-tile-k {
  color: var(--brand-red);
}

.ev-slot.is-next .ev-cal {
  background: var(--brand-red);
  color: #fff;
}

@media (max-width: 820px) {
  .ev-tile.ev-league {
    grid-template-columns: minmax(0, 1fr);
  }

  .ev-league-main {
    padding: 16px 18px 14px;
  }

  .ev-slot {
    padding: 14px 18px 16px;
    border-top: 1px solid rgba(154, 28, 32, 0.14);
    border-left: 0;
  }

  .ev-slot-time {
    font-size: 1.35rem;
  }
}

@media (max-width: 480px) {
  .ev-league .ev-tile-t {
    font-size: 1.3rem;
  }

  .ev-league .league-ring {
    --ring: 66px;
  }

  .ev-league .league-ring-label b {
    font-size: 1.05rem;
  }
}

/* The Topdeck series under the league card, a step down: one plain row,
   like the archive's (no chip, no ring, no calendar sheet) — its label,
   name, next event and events played on the left, its players and an arrow
   on the right. */
.ev-tile.ev-minor {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 64px;
  padding: 10px 14px 10px 18px;
  border-radius: 16px;
  box-shadow: none;
}

.ev-minor-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ev-minor .ev-tile-s {
  display: block;
  margin-top: 1px;
}

.ev-minor .ev-tile-s b {
  color: var(--text-value);
}

.ev-chev {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(220, 24, 28, 0.08);
  color: var(--brand-red-deep);
}

/* Archivio: uniform tiles, as many as there are — one per line on phones;
   the standalone events' tile dashed (on the same white). */
.ev-archive {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.ev-archive .ev-tile {
  justify-content: flex-start;
  padding: 16px 18px;
  border-radius: 18px;
}

.ev-archive .ev-tile-t {
  margin-top: 16px;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: normal;
}

.ev-archive .ev-tile-s {
  margin-top: 4px;
}

.ev-archive .ev-tile.is-standalone {
  border-style: dashed;
}

/* A league's kind (js/events-page.js closedTile): the label and the year
   tag in its colour — a league red, a series grey, an online one
   endstep's gold (its tile edged in it too). */
.ev-archive .is-kind-league .ev-tile-k {
  color: var(--brand-red);
}

.ev-archive .is-kind-series .ev-tag {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

.ev-archive .is-kind-online {
  border-color: color-mix(in oklch, var(--endstep-gold) 45%, transparent);
}

.ev-archive .is-kind-online .ev-tile-k {
  color: var(--endstep-gold-deep);
}

.ev-archive .is-kind-online .ev-tag {
  background: color-mix(in oklch, var(--endstep-gold) 18%, transparent);
  color: var(--endstep-gold-deep);
}

@media (max-width: 640px) {
  .ev-archive {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

.ev-tag {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(154, 28, 32, 0.08);
  color: var(--brand-red-deep);
  letter-spacing: 0.04em;
}

/* The standalone events' list (a dialog): one row each, a link to it. */
.ev-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ev-list-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid rgba(154, 28, 32, 0.18);
  border-radius: 12px;
  color: var(--text-title);
  text-decoration: none;
}

.ev-list-row:hover {
  border-color: rgba(154, 28, 32, 0.36);
  background: rgba(220, 24, 28, 0.05);
  text-decoration: none;
}

.ev-list-date {
  color: var(--brand-red-deep);
  font-size: 0.8rem;
  font-weight: 800;
}

.ev-list-name {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-list-row .ev-tile-s {
  margin: 0;
}

:root[data-theme="dark"] .ev-tile {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}
