/* The Line-Up (game/design.md, section 11), on the site's tokens. Phones first: at 360 px the board is four columns
   of 76 px with 8 px between them and 16 px gutters, a figure is 104 px tall, and the tray is two columns under it:
   twelve figures (328 px) and four rows of cards (44 px each, 6 px apart) come to 538 px with the table's own top
   edge. The line under the board on how a man is marked adds its one or two lines to that, but only on a player's
   first line-ups: a returning player does not see it. The board and the tray sit in a .scene, which is dark in
   both themes; everything round it follows the theme. */

/* ---- the drawings: ink on paper, the same in both themes. game-art.js sets every stroke's width and ends as
   attributes, so nothing here may set them. ---- */

.lineup-paper { fill: #f5edda; }
.lineup-ink { fill: #1d1a17; }
.lineup-line, .lineup-hatch { stroke: #1d1a17; }
.lineup-wall { stroke: #1d1a17; stroke-opacity: .3; }
.lineup-gilt { fill: #d2a94a; }
.lineup-red { fill: #b3261e; }

/* ---- the page ---- */

/* On this page alone the masthead scrolls away with the page: fixed to the top it would take about 61 px of a
   560 px phone screen from the board and the tray. */
.page--game .masthead { position: static; }

.game-top { padding-block: var(--s-5) var(--s-4); }
.game-top h1 { margin-bottom: var(--s-3); }
.game-top .lead { margin-bottom: 0; }
/* On a phone the lead is set as text: at lead size it is eight lines in Sinhala, and the board starts a screen down. */
@media (max-width: 599px) {
  .game-top { padding-block: var(--s-4) var(--s-3); }
  .game-top .lead { font-size: 1rem; }
}
.game-noscript { margin: var(--s-4) 0 0; padding: var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.game-quote { margin: 0 0 var(--s-6); padding-left: var(--s-4); border-left: 2px solid var(--gilt); }
.game-quote p { margin: 0 0 var(--s-2); font-style: italic; }
.lang-si .game-quote p { font-style: normal; }
.game-quote footer { color: var(--muted); font-size: .88em; }
.game-how { margin-bottom: var(--s-5); }
.game-how__notes { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); color: var(--muted); font-size: .92em; }
.game-how__notes p { margin: 0; }
.game-share { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); }

/* Without scripts there is no game to show, only the page round it. */
.game { display: none; }
.js .game { display: block; max-width: 56rem; margin: 0 auto; padding-bottom: var(--s-6); }
/* Until the scripts have started the stage holds this one line; if one of them never arrives it stays. */
.game__loading { margin: var(--s-5) var(--gutter); color: var(--muted); }
.game__panel > * { margin-inline: var(--gutter); }
.game__panel > .game__scene { margin-inline: 0; }

.game__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- tabs and the head ---- */

.game__tabs { display: flex; gap: var(--s-2); margin: 0 var(--gutter) var(--s-4); border-bottom: 1px solid var(--line); }
.game__tab { min-height: 44px; margin-bottom: -1px; padding: 0 var(--s-4); border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.game__tab:hover { color: var(--text); }
.game__tab.is-current { border-bottom-color: var(--gilt); color: var(--text); }

.game__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-1) var(--s-4); margin-bottom: var(--s-3); }
.game__title { margin: 0; font-size: clamp(1.35rem, 3.2vw, 1.75rem); }
.game__title:focus, .game__outcome:focus { outline: none; }
.game__meta { display: flex; flex-wrap: wrap; gap: 0 var(--s-3); margin: 0; color: var(--muted); font-size: .88em; font-variant-numeric: tabular-nums; }
.game__meta li + li::before { content: "\00B7"; margin-right: var(--s-3); color: var(--line-strong); }
.game__lede { margin-bottom: var(--s-3); }
.game__after { margin-block: 0; }   /* the block only: directly under the panel it keeps the panel's gutter */
.game__panel > .game__after { margin-top: var(--s-4); }
.game__box { display: grid; gap: var(--s-4); max-width: 40rem; }
.game__box p, .game__box .actions { margin: 0; }
.game__device { margin: 0; color: var(--muted); font-size: .85em; }
.game__label { margin: 0 0 var(--s-2); color: var(--gilt); font-size: .82em; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.lang-si .game__label { letter-spacing: .02em; font-size: .9em; }

.game__rule { margin-bottom: var(--s-3); padding: 0 var(--s-4); border-left: 3px solid var(--gilt); border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface); }
.game__rule summary { padding: var(--s-3) 0; font-weight: 600; cursor: pointer; }
.game__rule p { margin: 0; padding-bottom: var(--s-3); color: var(--muted); font-size: .92em; }

/* ---- the table: the board, and beside or under it the tray and the name ---- */

.game__scene { display: grid; gap: var(--s-2); padding: var(--s-2) var(--gutter) var(--s-4); border-block: 1px solid var(--line); background-color: var(--surface); }
.game__board { display: grid; gap: var(--s-2); width: 100%; max-width: 26rem; margin: 0 auto; }
.game__row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); }

.game__figure { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.game__figure > svg:first-child, .game__tile > svg:first-child { display: block; width: 100%; height: auto; }
.game__over { position: absolute; top: 0; left: 0; width: 100%; height: 100%; max-width: none; pointer-events: none; }
/* Crossed out: dimmed, and struck through with a drawn stroke. In doubt: a mark in the corner. Neither rests on a
   colour, and a man crossed out still shows what he wears, since a clue may speak of the man beside him. */
.game__figure.is-crossed > svg:first-child { opacity: .5; }
.game__plate, .game__doubt, .game__caller { fill: #1d1a17; }
.game__no { fill: #f5edda; font-family: "EB Garamond", Georgia, "Times New Roman", serif; font-weight: 600; }
.game__strike { stroke: #1d1a17; }
.game__strike-edge { stroke: #f5edda; stroke-opacity: .85; }
.game__doubt-sign, .game__caller-sign { stroke: #f5edda; }
.game__doubt-dot { fill: #f5edda; }
@media (hover: hover) {
  .game__figure:hover { box-shadow: 0 0 0 2px var(--gilt); }
}

.game__side { display: grid; gap: var(--s-2); align-content: start; min-width: 0; }
.game__tray { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.game__slot { display: flex; min-width: 0; }
.game__card { position: relative; display: flex; align-items: center; gap: var(--s-2); width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 4px 16px 4px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; line-height: 1.2; text-align: left; }
/* The same signs as the shared result: a disc for a trace, a square for a witness. */
.game__card::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: currentColor; opacity: .7; }
.game__card--trace::after { border-radius: 50%; }
/* Face down: a dark back with its emblem. Face up: paper, with the clue in ink. */
.game__card--back { background: var(--surface-2); color: var(--text); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.game__card--back:hover { border-color: var(--text); }
.game__card--face { align-items: flex-start; border-color: var(--text); background: var(--text); color: var(--bg); }
.game__emblem { position: relative; flex: none; width: 34px; }
.game__emblem svg { width: 100%; border-radius: 4px; }
.game__card--face .game__emblem, .game__token .game__emblem { width: 26px; }
/* A card's letter on its plate, as a figure wears its number: in the corner of the card's emblem, in play and at
   the end, and at the end under every man the card rules out. Ink and paper, the same in both themes. */
.game__letter { display: grid; place-items: center; flex: none; width: 15px; height: 15px; border-radius: 3px; background: #1d1a17; box-shadow: 0 0 0 1px #f5edda; color: #f5edda; font-family: "EB Garamond", Georgia, "Times New Roman", serif; font-size: .75rem; font-weight: 600; line-height: 1; }
.game__emblem .game__letter { position: absolute; top: -3px; left: -3px; }
.game__card-text { display: grid; gap: 2px; min-width: 0; }
.game__kind { font-size: .8125rem; }
.game__class { font-size: .6875rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.lang-si .game__class { letter-spacing: 0; }
.game__clue { margin: 0; font-size: .875rem; line-height: 1.25; }
.lang-si .game__kind, .lang-si .game__clue { font-size: .8125rem; line-height: 1.45; }
.game__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.game__chip svg { width: 30px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(29, 26, 23, .4); }
.game__note, .game__legend, .game__hint { margin: 0; color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.game__legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.game__legend span { display: inline-flex; align-items: center; gap: 6px; }
.game__legend span::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.game__legend .game__legend-trace::before { border-radius: 50%; }

.game__status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-top: var(--s-1); }
.game__count { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.game__name { flex: 1 1 12rem; padding-block: var(--s-2); box-shadow: none; }
.game__name[disabled] { border-color: var(--line-strong); background: none; color: var(--muted); font-size: .88em; font-weight: 400; opacity: 1; cursor: default; }
.game__name[disabled]:active { transform: none; }

.game__confirm-heading { margin-bottom: var(--s-2); font-size: 1.3rem; }
.game__confirm p { margin-bottom: var(--s-4); }
.game__confirm .actions { margin: 0; }
.game__status .game__confirm { flex: 1 1 100%; padding: var(--s-4); border: 1px solid var(--gilt); border-radius: var(--radius); background: var(--bg); }
.game__dialog { width: min(24rem, calc(100vw - 2rem)); padding: var(--s-5); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); }
.game__dialog::backdrop { background: rgba(11, 10, 9, .72); }
.game__dialog:not([open]) { display: none; }

.game__words { margin-top: var(--s-3); }
.game__words summary { padding: var(--s-3) 0; color: var(--muted); cursor: pointer; }
.game__scroll { overflow-x: auto; }
.game__list { width: 100%; border-collapse: collapse; font-size: .82em; line-height: 1.3; }
.game__list th, .game__list td { padding: var(--s-2) var(--s-4) var(--s-2) 0; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.game__list th { font-weight: 600; }

/* ---- the end ---- */

.game__end { display: grid; gap: var(--s-5); max-width: 40rem; }
.game__verdict { display: flex; align-items: center; gap: var(--s-4); }
.game__seal { flex: none; width: 72px; }
.game__seal svg { width: 100%; }
.game__seal--none { width: 56px; height: 56px; border: 2px dashed var(--line-strong); border-radius: 50%; }
.game__outcome { margin: 0 0 var(--s-1); font-size: clamp(1.5rem, 4vw, 2rem); }
.game__outcome-line { margin: 0; }
.game__facts { display: grid; gap: var(--s-1); color: var(--muted); font-variant-numeric: tabular-nums; }
.game__token { display: inline-flex; align-items: center; gap: 6px; margin-left: 3px; vertical-align: middle; color: var(--text); font-size: .92em; }
.game__token .game__emblem svg { box-shadow: 0 0 0 1px var(--line-strong); }

.game__share-text, .game__share-area { display: block; width: 100%; margin: 0 0 var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: .95em; font-variant-numeric: tabular-nums; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.game__share-area { resize: vertical; }

/* How the evidence falls: the line-up and every card stay on the screen, on the same dark table as in play, so
   that the explanation can be checked against them. At phone width the table runs to the screen's edges, as in
   play, which keeps the columns 76 px wide at 360 px; it is one column at every width. */
.game__explain { border-block: 1px solid var(--line); }
.game__explain summary { padding: var(--s-3) 0; font-weight: 600; cursor: pointer; }
.game__caller-line { margin: 0 0 var(--s-3); font-weight: 600; }
.game__mistaken { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); margin: 0 0 var(--s-3); }
.game__scene--end { margin-inline: calc(-1 * var(--gutter)); padding-top: var(--s-4); }
.game__man { display: grid; gap: 5px; align-content: start; min-width: 0; }
.game__tile { position: relative; display: block; border-radius: 4px; }
/* The caller: a ring and a tick. A man wrongly named: a broken ring. Every other man: the letters of the cards
   that rule him out, or the empty plate of the man no witness spoke against. None of it rests on a colour. */
.game__man.is-caller .game__tile { box-shadow: 0 0 0 3px var(--gilt); }
.game__man.is-named .game__tile { outline: 2px dashed var(--accent-text); outline-offset: 1px; }
.game__letters { display: flex; flex-wrap: wrap; gap: 4px; min-height: 15px; padding-inline: 1px; }
.game__letter--none { background: none; box-shadow: inset 0 0 0 1.5px var(--text); }
/* At the end every card lies face up. One the player never opened is hollow and says so; the mistaken witness's
   card has a frame, and the line above the table names it. */
.game__card.is-unopened { background: none; color: var(--text); border-style: dashed; }
.game__card.is-mistaken { box-shadow: inset 0 0 0 2px var(--accent); }
.game__unopened { font-size: .6875rem; font-style: italic; opacity: .85; }
.lang-si .game__unopened { font-style: normal; }
.game__falls { display: grid; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: .92em; }
.game__falls-none { display: flex; align-items: baseline; gap: var(--s-2); }
.game__falls-none::before { content: ""; flex: none; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; transform: translateY(2px); }

.game__done { display: grid; gap: var(--s-3); }
.game__done h3, .game__done p { margin: 0; }
.game__week { display: flex; gap: var(--s-2); margin-bottom: var(--s-2); }
.game__day { position: relative; display: grid; place-items: center; width: 36px; height: 36px; }
.game__day svg { width: 34px; }
.game__day--today::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -7px; height: 2px; background: var(--gilt); }
.game__pip { display: block; width: 26px; height: 26px; border: 1.5px dashed var(--line-strong); border-radius: 50%; }
.game__pip--none { border-style: solid; background: linear-gradient(var(--line-strong), var(--line-strong)) center / 10px 2px no-repeat; }
.game__more { margin: 0; }

/* ---- a phone: the board stays at the top of the screen while the tray scrolls under it, so a clue and the men it
   speaks of are seen together (first seen in a browser on 2026-11-20: twelve men and eight open cards are two
   screens in Sinhala). Only where three rows leave room for cards; Sunday's four rows scroll as before. ---- */

@media (max-width: 859px) and (min-height: 560px) {
  .game__board:not(.game__board--end):not(:has(> .game__row:nth-child(4))) { position: sticky; top: 0; z-index: 2; padding-block: var(--s-2); margin-block: calc(-1 * var(--s-2)); background-color: var(--surface); }
}

/* ---- wider screens: the table gets an edge, then the tray moves beside a board that stops growing ---- */

@media (min-width: 600px) {
  .game__panel > .game__scene { margin-inline: var(--gutter); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }
  .game__scene--end { margin-inline: 0; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }
}
@media (min-width: 860px) {
  .game__scene { grid-template-columns: minmax(0, 26rem) minmax(0, 24rem); justify-content: center; align-items: start; gap: var(--s-5); padding: var(--s-5); }
  .game__board { margin: 0; }
  .game__card { min-height: 56px; }
  .game__scene--end { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); padding: var(--s-4); }
  .game__board--end { margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .game *, .game *::before, .game *::after { animation: none !important; transition: none !important; }
}
