/* Page styles: doubles area. Owned by its views; tokens and shared components live in ../app.css. */
/* Ladder (/), team (/teams/:id) and match feed (/matches). Values from Main, LadderStates,
   Team and AllMatches artboards. Prefix: .dbl- */

.dbl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 46px; }
.dbl-toggle-slot:empty { display: none; }
.dbl-self-start { align-self: flex-start; }
.dbl-inherit { color: inherit; text-decoration: none; }
.dbl-inherit:hover { color: inherit; text-decoration: underline; }
.dbl-namecol { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* Leader card and ladder rows */
.dbl-leader-top { display: flex; justify-content: space-between; align-items: center; }
.dbl-leader-bottom { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.dbl-figures { display: flex; align-items: baseline; gap: 8px; }
.dbl-figures.unplayed { gap: 6px; }
.ladder-row.unplayed .name { min-width: 0; overflow-wrap: anywhere; }
.ladder-row.unplayed .rank { font-size: 24px; }
.dbl-unplayed-h { margin: 10px 0 0; }
.section-head > [hidden] { display: none; }

/* Recent matches */
.dbl-recent { padding: 26px var(--gutter) 0; display: flex; flex-direction: column; }
.dbl-recent:empty { display: none; }
.dbl-voided .feed-line .w, .dbl-voided .feed-line .l { text-decoration: line-through; }
.dbl-voided .feed-line .w { color: var(--subtle); }
.dbl-voided .feed-deltas { color: var(--subtle); }

/* Team page */
.dbl-team-head { padding: 10px var(--gutter) 22px; display: flex; flex-direction: column; gap: 16px; }
.dbl-loading-title { color: transparent; background: var(--surface); border-radius: 8px; width: 70%; }
.dbl-rank { font-size: 13px; font-weight: 600; color: var(--gold); }
.dbl-titles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 14px; }
.dbl-title { min-height: 44px; max-width: 100%; min-width: 0; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; color: var(--gold); }
.dbl-actions { display: flex; gap: 8px; }
.dbl-actions > .btn { flex: 1; height: 48px; padding: 0 12px; }
.dbl-history { padding: 6px var(--gutter) 40px; display: flex; flex-direction: column; }
.dbl-history:empty { display: none; }
.dbl-hist-h { margin: 0 0 6px; }
a.hist-opp { display: block; color: var(--ink); }
.dbl-hist-figs { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.hist-delta.up { color: var(--ink); }
.hist-delta.down { color: var(--subtle); }
.dbl-void-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dbl-void-title { font-size: 15px; }
.dbl-none { margin: 0; padding: 14px 0; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
.result-chip { box-sizing: border-box; }

/* All matches */
.dbl-feed-head { padding: 10px var(--gutter) 14px; display: flex; flex-direction: column; gap: 16px; border-bottom: 1px solid var(--line); }
.dbl-filter { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--subtle); }
.dbl-select { height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--ink); padding: 0 12px; font: 500 16px var(--font-body); /* 16px: iPhone Safari zooms into a smaller field */ letter-spacing: 0; text-transform: none; }
.dbl-select:disabled { color: var(--subtle); }
.dbl-feed-status { padding: 16px var(--gutter) 0; }
.dbl-feed-status:empty { display: none; }
.dbl-feed { list-style: none; margin: 0; padding: 0 var(--gutter); }
.dbl-feed > li { border-bottom: 1px solid var(--line); }
.dbl-feed-btn {
  width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start;
  padding: 14px 0; background: transparent; border: 0; text-align: left; color: var(--ink); font: inherit; cursor: pointer;
}
.dbl-feed-btn.voided { color: var(--subtle); }
.dbl-feed-seq { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--subtle); font-variant-numeric: tabular-nums; padding-top: 1px; }
.dbl-feed-teams { gap: 3px; }
.dbl-feed-w { font-size: 15px; font-weight: 600; }
.dbl-feed-l { font-size: 14px; color: var(--muted); }
.dbl-feed-btn.voided .dbl-feed-w, .dbl-feed-btn.voided .dbl-feed-l { text-decoration: line-through; }
.dbl-feed-meta { font-size: 12px; color: var(--subtle); }
/* fitNames: condensed, so a 20-character username stays whole */
.dbl-feed-w.tight { font-family: var(--font-display); font-size: 17px; }
.dbl-feed-l.tight { font-family: var(--font-display); font-size: 16px; }
.dbl-feed-meta.tight { font-family: var(--font-display); font-size: 13px; }
.dbl-feed-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.dbl-feed-deltas { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dbl-feed-panel { display: flex; flex-direction: column; gap: 10px; padding: 0 0 16px 48px; }
.dbl-feed-panel[hidden] { display: none; }
.dbl-feed-audit { margin: 0; padding: 12px 12px 12px 30px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-card); display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.4; color: var(--soft-ink); }
.dbl-feed-audit strong { color: var(--ink); }
.dbl-feed-panel > .btn.ghost { height: auto; min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.dbl-more-wrap { display: flex; justify-content: center; padding: 16px; }
.dbl-more-wrap[hidden] { display: none; }
.dbl-more { min-height: 44px; padding: 0 18px; border-radius: 10px; background: transparent; border: 1px solid var(--border); color: var(--muted); font: 600 14px var(--font-body); }
.dbl-more:hover { color: var(--ink); }

/* Long text at phone width: usernames are up to 20 characters with no spaces and void or
   correction reasons up to 200 (a pasted URL has none). Headings and free text wrap anywhere;
   single-line list names keep their ellipsis. Nothing may widen the page past the screen. */
.dbl-wrap { min-width: 0; overflow-wrap: anywhere; }
.dbl-leader-bottom > .dbl-leader-name { min-width: 0; overflow-wrap: anywhere; }
.dbl-leader-name.long { font-size: 24px; line-height: 1.05; }
.dbl-leader-name.tight { font-size: 18px; line-height: 1.1; } /* fitNames: a username too wide at the size above */
.dbl-leader-bottom > .dbl-figures { flex: none; }
/* Still too wide at that size (20 wide letters on a narrow phone): the name takes the whole
   line and the figures go under it, rather than shrink the name further. */
.dbl-leader-bottom:has(.dbl-leader-name.tighter) { flex-wrap: wrap; }
.dbl-leader-bottom:has(.dbl-leader-name.tighter) > .dbl-leader-name { flex: 1 0 100%; }
.dbl-leader-bottom:has(.dbl-leader-name.tighter) > .dbl-figures { margin-left: auto; }
/* On that line, a 20-character username and its " &" (WWWW… &, about 14 em) can still be a
   pixel too wide at 18px on a 320px phone: sized to the card, so the name stays whole. */
.dbl-leader-bottom { container-type: inline-size; }
.dbl-leader-name.tighter { font-size: min(18px, calc(100cqw / 15)); }
/* fitNames .fit-wrap: a name that would otherwise shrink below 11px gets the row's full width
   (the figures go under it) rather than shrink further or split mid-word. Ladder rows (rank,
   name, figures), the match feed (number, names, deltas) and team history (chip, names,
   figures, pencil). */
.ladder-row:has(.fit-wrap) > :nth-child(2) { grid-column: 2 / -1; }
.ladder-row:has(.fit-wrap) > :nth-child(n+3) { grid-column: 2 / -1; justify-self: end; }
.dbl-feed-btn:has(.fit-wrap) > .dbl-feed-teams { grid-column: 2 / -1; }
.dbl-feed-btn:has(.fit-wrap) > .dbl-feed-right { grid-column: 2 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.hist-grid:has(.fit-wrap) > .dbl-namecol { grid-column: 2 / -1; }
.hist-grid:has(.fit-wrap) > .dbl-hist-figs { grid-area: 2 / 3; }
.hist-grid:has(.fit-wrap) > .icon-btn { grid-area: 2 / 4; }
.dbl-recent .feed-line { min-width: 0; overflow-wrap: anywhere; }
.dbl-team-title { min-width: 0; overflow-wrap: anywhere; }
.dbl-team-title.long { font-size: 34px; line-height: 0.95; }
.dbl-team-title.tight { font-size: 22px; line-height: 1; } /* fitNames: a username too wide at the size above */
/* fitNames: still too wide at 22px (WWWW…, the widest 20 characters, about 14 em, at 320 px):
   sized to the heading's box so the name stays whole, as on the profile heading. */
.dbl-team-titlebox { container-type: inline-size; }
.dbl-team-title.tighter { font-size: min(22px, calc(100cqw / 14)); }
.dbl-void-top > .dbl-void-title { flex: 1; }
.dbl-void-top > .badge { flex: none; }
.dbl-history .audit li, .dbl-feed-audit li { min-width: 0; overflow-wrap: anywhere; }
.dbl-feed-w, .dbl-feed-l, .dbl-feed-meta { overflow-wrap: anywhere; }
.dbl-feed-panel { min-width: 0; }
.dbl-feed > li { min-width: 0; }

/* Narrow phones (<=340 px): keep the Season/All-time toggle on one line and inside the screen. */
.dbl-toggle-slot { flex-shrink: 0; }
.dbl-toggle-slot .seg > button { white-space: nowrap; }
@media (max-width: 340px) {
  .dbl-toggle-slot .seg > button { padding: 0 10px; }
  .page-title { font-size: 44px; }
}

/* FP-STALE-CLIENT: marker for ensureStylesheet in team.js (leader .tighter, .fit-wrap rows). */
:root { --dbl-lows1: 1; }
