/* Card games' Django-served pages (accounts, history, a game's result), in
   the card room: the player's table style from themes.css, the felt and
   buttons from cards.css. Panels sit on the felt like the table's sheets.
   The account templates are shared with The Register, so they keep its
   class names (rp-card, rp-form, rp-small); here they wear the card room. */

body.tp { overflow: auto; }
.tp-felt { max-width: 1040px; margin: 0 auto; padding: 14px max(22px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(22px, env(safe-area-inset-left, 0px)); gap: 0; }
.tp-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 48px; padding-bottom: 10px; border-bottom: var(--panel-edge); }
.tp-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: 15px; }
.tp-nav a, .tp-link { color: var(--soft); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.tp-nav a:hover, .tp-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.tp-nav form { display: inline; }
.tp-main { flex: 1; width: 100%; max-width: 820px; margin: 0 auto; padding: 34px 0 48px; }
/* the foot (house rule 10): the way back at the left, the copyright at the right */
/* every link in the foot alike, Feedback and Analytics among them: ink, bold, underlined (docs/adr/0064) */
.tp-foot :is(a, .house-feedback) { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tp-foot :is(a, .house-feedback):hover { text-decoration-thickness: 2px; }
.tp-foot { display: flex; justify-content: flex-end; gap: 16px; flex-wrap: wrap; color: var(--soft); font-size: 13px; padding-top: 12px; border-top: var(--panel-edge); }
.tp :is(a, summary, .tp-link):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* the house's page skeleton (docs/design-language.md, "Layout and type"): kicker, title, lead */
.tp .kicker { margin: 0 0 var(--s2); }
.tp h1 { font: var(--display-weight) var(--t-display)/var(--lh-display) var(--display); margin: 0 0 12px; }
.tp h2 { font: var(--display-weight) var(--t-heading)/var(--lh-heading) var(--display); margin: 0 0 12px; }
.tp .lead { font-size: var(--t-lead); line-height: var(--lh-body); color: var(--soft); max-width: 38em; margin: 0 0 24px; }
.tp-messages { list-style: none; padding: 0; margin: 0 0 20px; }
.tp-messages li { background: var(--sheet); border: var(--panel-edge); border-left: 4px solid var(--good); border-radius: var(--btn-radius); padding: 10px 14px; }

/* panels: forms, tables, the standings */
.tp :is(.rp-card, .tp-panel, .tp-stat) { background: var(--sheet); border: var(--panel-edge); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.tp .rp-card { padding: 22px 24px; max-width: 460px; }
.tp .rp-card + .rp-card { margin-top: 18px; }
/* a form straight under its heading (no lead) still gets the lead's room */
.tp h1 + .rp-card { margin-top: 24px; }
.tp-panel { padding: 18px 20px; margin: 0 0 18px; min-width: 0; }
.tp .rp-form p { margin: 0 0 16px; }
.tp .rp-form p:last-child { margin-bottom: 0; }
.tp .rp-form label { display: block; font-weight: 600; font-size: var(--t-label); margin-bottom: 6px; }
.tp .rp-form input:not([type=hidden]) {
  width: 100%; background: var(--panel); color: var(--ink); border: var(--field-edge); border-radius: var(--btn-radius);
  padding: 9px 12px; min-height: 44px; font-size: 16px;
}
.tp .rp-form .helptext { display: block; color: var(--soft); font-size: var(--t-note); margin-top: 5px; }
.tp .rp-form .helptext ul { margin: 4px 0 0; padding-left: 18px; }
.tp ul.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--bad); font-size: var(--t-note); font-weight: 700; }
.tp .rp-small { color: var(--soft); font-size: var(--t-note); }
.tp .rp-small a, .tp-note a, .tp-share a:not(.btn) { color: var(--ink); text-underline-offset: 3px; }
.tp .rp-card .btn:not(.primary) { background: var(--btn2); color: var(--btn2-ink); border: var(--btn2-edge); }
.tp-note { font-size: var(--t-note); margin: 10px 0 0; }
.tp-tag { display: inline-block; font-size: 12px; font-weight: 700; line-height: 1.4; padding: 0 7px; border: 1px solid currentColor; border-radius: 99px; color: var(--soft); vertical-align: 1px; white-space: nowrap; }

/* words for a screen reader only (a ratings board's Rank) */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the history page */
.tp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 18px; }
/* with your rating, a fourth (two by two on a phone) */
.tp-stats:has(> :nth-child(4)) { grid-template-columns: repeat(4, 1fr); }
.tp-stat { padding: 14px 18px; display: flex; flex-direction: column; }
.tp-stat b { font: var(--display-weight) 34px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.tp-stat span { color: var(--soft); font-size: var(--t-note); }
.tp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 18px; }
.tp-pair .tp-panel { margin: 0; }
.tp-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tp-table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); padding: 4px 8px 6px; vertical-align: bottom; }
.tp-table td { padding: 7px 8px; border-top: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); vertical-align: baseline; overflow-wrap: anywhere; }
/* Figures keep to one line and their own width; a name takes what's left
   and wraps if it must (a hand's scores share the width out evenly). */
.tp-table :is(td, th).num { text-align: right; white-space: nowrap; }
.tp-table:not(.tp-scores) :is(td, th).num { width: 1%; padding-left: 14px; }
.tp-table tfoot th { color: var(--ink); font-size: 15px; letter-spacing: 0; text-transform: none; border-top: 2px solid color-mix(in srgb, var(--ink) 40%, transparent); padding-top: 8px; }
.tp-table tfoot th.won { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tp-table th.me { color: var(--ink); }
.tp-scroll { overflow-x: auto; }
/* a table wider than the page fades at the edge it scrolls on, until its end */
.tp-scroll {
  background:
    linear-gradient(var(--sheet), var(--sheet)) right center / 28px 100% no-repeat local,
    linear-gradient(to left, rgba(0, 0, 0, .35), transparent) right center / 28px 100% no-repeat scroll;
}
.tp-scores thead th:not(:first-child) { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .02em; text-transform: none; font-size: 13px; }

.tp-games { list-style: none; margin: 0; padding: 0; }
.tp-games li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); }
.tp-games summary { display: grid; grid-template-columns: 7.5em 1fr auto 3.5em; gap: 12px; align-items: baseline; padding: 10px 4px 10px 22px; cursor: pointer; list-style: none; position: relative; }
.tp-games summary::-webkit-details-marker { display: none; }
.tp-games summary::marker { content: ''; }
.tp-games summary::before { content: "▸"; position: absolute; left: 2px; top: 9px; font-size: 15px; line-height: 1.2; color: var(--soft); transition: transform .15s; }
.tp-games details[open] summary::before { transform: rotate(90deg); }
.tp-games .when, .tp-games .place { color: var(--soft); font-size: var(--t-note); white-space: nowrap; }
.tp-games .who small, .tp-standings small { color: var(--soft); }
.tp-games .who .me { font-weight: 700; }
.tp-games .total { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.tp-games details > :not(summary) { margin-left: 22px; }
.tp-share { margin: 10px 0 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tp-pages { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }

/* a game's result page */
.tp-standings { list-style: none; margin: 0; padding: 0; }
.tp-standings li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 12px; align-items: baseline; padding: 9px 4px; font-size: 17px; }
.tp-standings li + li { border-top: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); }
.tp-standings .place { font: var(--display-weight) 20px var(--display); color: var(--soft); text-align: right; }
.tp-standings li:first-child .place { color: var(--ink); }
.tp-standings .total { font-weight: 700; font-variant-numeric: tabular-nums; }
.tp-standings li.me, .tp-table tr.me { background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* Retro PC's gray panels need black ink, as its sheets do at the table. */
[data-theme="retro"] .tp :is(.rp-card, .tp-panel, .tp-stat, .tp-messages li) { --ink: #000; --soft: #333; --bad: #a00000; color: #000; border-radius: 0; border: 2px outset #fff; box-shadow: none; }
[data-theme="retro"] .tp .rp-form input:not([type=hidden]) { background: #fff; border: 2px inset #fff; }
[data-theme="retro"] .tp .rp-card .btn:not(.primary) { box-shadow: none; font-weight: 400; }

@media (max-width: 720px) {
  .tp-felt { padding: 10px max(14px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); }
  .tp-main { padding: 22px 0 32px; }
  .tp-pair { grid-template-columns: 1fr; }
  .tp-stats { gap: 8px; }
  .tp-stats:has(> :nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
  .tp-stat { padding: 10px 12px; }
  .tp-stat b { font-size: 26px; }
  .tp-games summary { grid-template-columns: 1fr auto auto; row-gap: 2px; }
  .tp-games .who { grid-column: 1 / -1; grid-row: 2; }
}
/* A finger's reach on a touch screen (docs/design-language.md, "Fine
   details"): the top bar's links are 44px tall, their words where they were. */
@media (pointer: coarse) {
  .tp-top .tp-nav a, .tp-top .tp-link { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding-inline: 4px; margin-inline: -4px; justify-content: center; }
}

/* A kept game's drawings (tables/drawings.html, the drawing kit's "Kept
   drawings", docs/adr/0097): a grid of squares, each redrawn by draw.js. */
.kept-drawings { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.kept-drawing { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kept-canvas { aspect-ratio: 1 / 1; width: 100%; }
.kept-gone { display: grid; place-items: center; border: 1px dashed currentColor; border-radius: 6px; text-align: center; padding: 8px; box-sizing: border-box; }
.kept-down { margin: 0; }
