/* ======================================================================
   pa-tournaments.css — tournament rows, banner, popup and demo pay step.
   Shared by the hub (/), the list page (/tournaments) and the tournament
   page (/tournaments/<id>). Materials from pa-tokens.css only: square
   corners, ink hairlines, spot red for what is live now.
   ====================================================================== */

/* ---- rows ---------------------------------------------------------------- */

.pt-list { list-style: none; margin: 0; padding: 0; }
.pt-list li + li { border-top: 1px solid var(--pa-rule); }

.pt-row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--pa-s-3);
  width: 100%;
  padding: var(--pa-s-3) 0;
  border: none; background: none; font: inherit; color: inherit;
  text-align: start; cursor: pointer; text-decoration: none;
  transition: background 160ms var(--pa-ease);
}
.pt-row:hover { background: var(--pa-chrome-tint); }
.pt-row__body { min-width: 0; }

/* The three-part title: game · format · status. */
.pt-row__t {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.4rem;
  font-family: var(--pa-serif); font-weight: 700;
  font-size: var(--pa-size-body); line-height: 1.3;
}
.pt-row__t i { font-style: normal; color: var(--pa-ink-3); font-weight: 400; }
.pt-st.is-running { color: var(--pa-red-deep); }
.pt-st.is-upcoming { color: var(--pa-ink-2); }
.pt-st.is-ended { color: var(--pa-ink-3); }

.pt-row__n {
  display: flex; align-items: baseline; gap: var(--pa-s-2); min-width: 0;
  margin-top: 0.1rem;
  font-size: var(--pa-size-meta); color: var(--pa-ink-2); line-height: 1.5;
}
.pt-row__n span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.pt-row__s {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.3rem;
  margin-top: 0.15rem;
  font-size: var(--pa-size-meta); font-weight: 600; line-height: 1.4; color: var(--pa-ink-2);
}
.pt-row__s svg { flex: none; }
.pt-row__s .is-in { display: inline-flex; align-items: center; gap: 0.2rem; color: var(--pa-green); }
/* The joined mark and the prize/countdown are separate pieces, so on a
   narrow row the second wraps whole instead of leaving a dangling "·". */
.pt-row__s .is-in::after { content: '·'; margin-inline-start: 0.1rem; color: var(--pa-ink-3); }
.pt-row__when { display: inline-flex; align-items: center; gap: 0.2rem; }
.pt-row.is-ended .pt-row__s { font-weight: 400; }
.pt-row__end { display: flex; align-items: center; color: var(--pa-ink-2); }

.pt-tag {
  flex: none;
  padding: 0 0.35rem; border: 1px solid var(--pa-rule-strong);
  font-family: var(--pa-sans); font-size: var(--pa-size-meta); font-weight: 600;
  line-height: 1.5; color: var(--pa-ink-2); white-space: nowrap;
}
.pt-tag.is-fee { border-color: var(--pa-red-deep); color: var(--pa-red-deep); }

/* Row thumbnails: printed puzzle content, square corners, no letters. */
.pt-thumb { display: block; width: 3.5rem; height: 3.5rem; }
img.pt-thumb { object-fit: cover; border: 1px solid var(--pa-ink); background: var(--pa-cell); }
.pt-thumb .bg { fill: var(--pa-cell); }
.pt-thumb .b { fill: var(--pa-cyan-16); }
.pt-thumb .g { stroke: var(--pa-rule); stroke-width: 1; fill: none; }
.pt-thumb .gb { stroke: var(--pa-ink); stroke-width: 1.5; fill: none; }
.pt-thumb .fr { stroke: var(--pa-ink); stroke-width: 2; fill: none; }
.pt-row.is-ended .pt-thumb { opacity: 0.55; }

.pt-more { margin-top: var(--pa-s-3); display: flex; }
.pt-more .pa-btn { flex: 1; text-decoration: none; }

/* ---- banner ----------------------------------------------------------------
   The game's own pattern, faint, bleeding off the right; the name set in
   the serif over it. Wide and short on desktop, taller on phones. A
   banner_url, when the API sends one, replaces the drawing. */

.pt-banner {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 16 / 8;
  border: 1px solid var(--pa-rule-strong);
  background: var(--pa-cell);
}
.pt-banner__art, .pt-banner__img {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.pt-banner__art {
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.35) 35%, #000 75%);
          mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.35) 35%, #000 75%);
}
.pt-banner__art .g { stroke: var(--pa-rule-strong); stroke-width: 1; fill: none; }
.pt-banner__art .gb { stroke: var(--pa-ink-2); stroke-width: 2; fill: none; }
.pt-banner__art .b { fill: var(--pa-cyan-16); }
.pt-banner__art .f { fill: var(--pa-red-16); }
.pt-banner__img { object-fit: cover; }
.pt-banner__body {
  position: relative;
  padding: var(--pa-s-4);
  max-width: 36rem;
}
.pt-banner.has-img .pt-banner__body { background: color-mix(in srgb, var(--pa-paper-lift) 88%, transparent); }
.pt-banner__kick {
  margin: 0 0 var(--pa-s-1);
  font-size: var(--pa-size-meta); font-weight: 600; color: var(--pa-ink-2);
  letter-spacing: 0.02em;
}
.pt-banner__t {
  margin: 0;
  font-family: var(--pa-serif); font-weight: 700;
  font-size: var(--pa-size-masthead); line-height: 1.15;
  overflow-wrap: anywhere;
}
.pt-banner__rule { width: 3rem; height: 2px; background: var(--pa-red); margin: var(--pa-s-2) 0; }
.pt-banner__m { margin: 0; font-size: var(--pa-size-meta); color: var(--pa-ink-2); }
.pt-banner__m b { color: var(--pa-ink); font-variant-numeric: tabular-nums; }
.pt-banner__by {
  position: relative;
  padding: var(--pa-s-1) var(--pa-s-4);
  border-top: 1px solid var(--pa-rule);
  background: var(--pa-paper-lift);
  font-size: var(--pa-size-meta); font-weight: 600; color: var(--pa-red-deep);
}
.pt-banner.is-ended .pt-banner__art { opacity: 0.5; }

/* In the popup: smaller, the same drawing. */
.pt-banner.is-small { aspect-ratio: 16 / 6; }
.pt-banner.is-small .pt-banner__body { padding: var(--pa-s-3); }
.pt-banner.is-small .pt-banner__t { font-size: var(--pa-size-title); }

@media (min-width: 40rem) {
  .pt-banner { aspect-ratio: 16 / 5; }
  .pt-banner.is-small { aspect-ratio: 16 / 5; }
}

/* ---- the pieces a tournament is described with ------------------------------
   Shared by the tournament page and the game page's "more to play" list. */

.pt-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  margin: var(--pa-s-4) 0 0;
  background: var(--pa-rule); border: 1px solid var(--pa-rule);
}
.pt-facts div { background: var(--pa-cell); padding: var(--pa-s-2) var(--pa-s-3); min-width: 0; }
.pt-facts dt { font-size: var(--pa-size-meta); color: var(--pa-ink-2); }
.pt-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.pt-h {
  margin: var(--pa-s-4) 0 var(--pa-s-1);
  font-family: var(--pa-serif); font-weight: 700; font-size: var(--pa-size-body);
  border-bottom: 1px solid var(--pa-rule); padding-bottom: var(--pa-s-1);
}
.pt-prizes { list-style: none; margin: 0; padding: 0; }
.pt-prizes li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: var(--pa-s-2);
  padding: 0.3rem 0;
}
.pt-prizes li span:nth-child(2) { border-bottom: 1px dotted var(--pa-rule); transform: translateY(-0.3em); }
.pt-prizes b { font-variant-numeric: tabular-nums; text-align: end; }
.pt-joint { font-style: normal; font-weight: 400; color: var(--pa-ink-2); font-size: var(--pa-size-meta); }
.pt-deliver { margin: var(--pa-s-2) 0 0; font-size: var(--pa-size-meta); color: var(--pa-ink-2); line-height: 1.6; }

.pt-rules { margin: var(--pa-s-3) 0 0; font-size: var(--pa-size-meta); color: var(--pa-ink-2); line-height: 1.6; }
.pt-note { margin: 0; text-align: center; font-size: var(--pa-size-meta); color: var(--pa-ink-2); }
.pt-note.pt-err { color: var(--pa-red-deep); font-weight: 600; }
.pt-note.pt-err:empty { display: none; }
.pt-mobile { display: grid; gap: var(--pa-s-2); }
.pt-mobile label { font-weight: 600; }
.pt-mobile input {
  min-height: var(--pa-tap); padding: 0 var(--pa-s-3);
  border: 1px solid var(--pa-rule-strong); border-radius: var(--pa-r-md);
  background: var(--pa-cell); color: var(--pa-ink); font: inherit; font-size: var(--pa-size-body);
}
.pt-mobile input:focus { outline: 2px solid var(--pa-chrome); outline-offset: 1px; }

/* Desktop: rows match the hub's larger game rows. */
@media (min-width: 60rem) and (min-height: 40rem) {
  .pt-row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; padding: var(--pa-s-4) 0; }
  .pt-row .pt-thumb { width: 4.5rem; height: 4.5rem; }
}

/* ---- a tournament's round schedule ------------------------------------
   Every round is listed, so the list is read far more often than it is
   acted on: the round being played is the one marked, and the rest are
   quiet rows that say when their turn comes. */
.tn-rounds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tn-round {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--pa-line, #e3e1dc); border-radius: 10px;
  background: var(--pa-card, #fff);
}
.tn-round.is-live { border-color: var(--pa-red, #ee4023); }
.tn-round__t { display: grid; gap: 2px; min-width: 0; }
.tn-round__m, .tn-round__d, .tn-round__p, .tn-round__w {
  font-size: 13px; color: var(--pa-dim, #6b6a67);
}
.tn-round__p { font-size: 12px; }
.tn-round__a { display: grid; gap: 4px; justify-items: end; text-align: right; flex: none; }
.tn-round__w { font-size: 12px; }
@media (max-width: 520px) {
  .tn-round { flex-direction: column; align-items: stretch; }
  .tn-round__a { justify-items: stretch; text-align: left; }
}
