/* The panel: English left to right by default, Persian right to left by choice, Vazirmatn for both, one quiet palette in light and dark. Alignment says start and end, never left and right, so it follows the page. */

:root {
    --ground: #f6f4ef;
    --paper: #ffffff;
    --ink: #1f1d1a;
    --soft: #6b665d;
    --line: #e2ddd2;
    --gold: #a4781f;
    --good: #2f7d4f;
    --bad: #b3372b;
    --bad-ground: #fbecea;
    --good-ground: #e9f4ec;
    --side: #1f2a24;
    --side-ink: #e9e4d6;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ground: #151513;
        --paper: #1e1e1b;
        --ink: #ece8de;
        --soft: #a49e91;
        --line: #33322d;
        --gold: #d6a84a;
        --good: #5fbf85;
        --bad: #e5776a;
        --bad-ground: #3a1f1c;
        --good-ground: #1b3124;
        --side: #0f1411;
        --side-ink: #e9e4d6;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --ground: #151513;
    --paper: #1e1e1b;
    --ink: #ece8de;
    --soft: #a49e91;
    --line: #33322d;
    --gold: #d6a84a;
    --good: #5fbf85;
    --bad: #e5776a;
    --bad-ground: #3a1f1c;
    --good-ground: #1b3124;
    --side: #0f1411;
    --side-ink: #e9e4d6;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: "Vazirmatn", Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .6rem; }

.shell { display: flex; min-height: 100vh; }

.side {
    width: 210px;
    flex-shrink: 0;
    background: var(--side);
    color: var(--side-ink);
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.side a {
    color: var(--side-ink);
    padding: .45rem .7rem;
    border-radius: 6px;
    opacity: .8;
}

.side a.active, .side a:hover { background: rgba(255, 255, 255, .08); opacity: 1; text-decoration: none; }

/* Something came that somebody has to look at: new lines from the game beside Languages. */
.mark {
    display: inline-block;
    margin-inline-start: .4rem;
    padding: 0 .5rem;
    border-radius: 999px;
    background: var(--gold);
    color: var(--paper);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.6;
    vertical-align: .08em;
}
.side .mark { color: var(--side); }
.news { background: color-mix(in srgb, var(--gold) 14%, var(--paper)); border-inline-start: 4px solid var(--gold); border-radius: 8px; padding: .6rem .9rem; }
tr.fresh td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
[dir="rtl"] tr.fresh td:first-child { box-shadow: inset -4px 0 0 var(--gold); }

/* A language's lines, one part of the game to a tab; a line with no text yet is marked in red. */
.tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 1rem 0 .6rem; border-bottom: 1px solid var(--line); }
.tabs .tab {
    font: inherit;
    color: var(--soft);
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: .4rem .8rem;
    margin-bottom: -1px;
    cursor: pointer;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.on { color: var(--ink); background: var(--paper); border-color: var(--line); font-weight: 700; }
.tabs .tab.none { opacity: .5; }
.tabs .count { font-size: .8rem; color: var(--soft); font-weight: 400; font-variant-numeric: tabular-nums; }
.mark.empty { background: var(--bad); }
tr.empty textarea { border-color: var(--bad); background: var(--bad-ground); }

.brand { font-size: 1.4rem; font-weight: 700; margin-bottom: 1rem; }
.brand span { color: var(--gold); font-weight: 500; }

.who { margin-top: auto; font-size: .85rem; opacity: .85; }
.who .email { word-break: break-all; }
.who form { margin-top: .5rem; }

.page { flex: 1; padding: 1.6rem 2rem; min-width: 0; }

.bare { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.door { width: min(420px, 100%); }
.door .brand { color: var(--ink); }

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.2rem 1.4rem;
}

.act { margin: 1rem 0; }
.act h2 { margin-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin-bottom: .8rem; }

label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--soft); margin-bottom: .8rem; }
label.why { max-width: 560px; }

input, select {
    font: inherit;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .45rem .6rem;
    min-width: 0;
}

input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

button {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--gold);
    background: var(--gold);
    color: #fff;
    border-radius: 6px;
    padding: .4rem .9rem;
}

button.quiet { background: transparent; color: var(--gold); }
.side button.quiet { color: var(--side-ink); border-color: rgba(255, 255, 255, .3); }
button.danger { background: var(--bad); border-color: var(--bad); }
/* A button that cannot be pressed yet looks it. */
button:disabled { opacity: .45; cursor: default; }

.hint { color: var(--soft); font-size: .92rem; }
.quiet { color: var(--soft); }

.trouble { background: var(--bad-ground); color: var(--bad); border-radius: 8px; padding: .6rem .9rem; }
.trouble.big { font-weight: 700; }
.done { background: var(--good-ground); color: var(--good); border-radius: 8px; padding: .6rem .9rem; }

.health { display: flex; flex-wrap: wrap; gap: 1.4rem; align-items: center; margin-bottom: 1.2rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-inline-end: .4rem; vertical-align: middle; }
.dot.well { background: var(--good); }
.dot.ill { background: var(--bad); }
.dot.unknown { background: var(--line); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.tile .number { font-size: 1.8rem; font-weight: 700; text-align: start; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--soft); }
.tile .small { color: var(--soft); font-size: .8rem; }
/* Under a number on the visits page (2026-10-16): how many a day, and the change on the span before. */
.tile .trend { display: flex; flex-direction: column; gap: .1rem; margin-top: .4rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem 1.2rem; margin: 1rem 0; }
.facts span { display: block; color: var(--soft); font-size: .85rem; }

table.grid { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.grid th, .grid td { text-align: start; padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-weight: 500; color: var(--soft); font-size: .88rem; }
.grid tr:last-child td { border-bottom: none; }
.grid tr.refused td { color: var(--soft); }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover td { background: var(--line); }
.grid td.out { color: var(--bad); }
.grid td.in { color: var(--good); }
.grid tr.group td { background: color-mix(in srgb, var(--gold) 10%, var(--paper)); color: var(--ink); font-weight: 700; padding-block: .35rem; }
.grid tr.group .count { font-size: .8rem; color: var(--soft); font-weight: 400; font-variant-numeric: tabular-nums; }
label.find { flex: 1; min-width: 200px; max-width: 420px; }

.seat { display: inline-block; margin-inline-end: .6rem; }
.seat.gone { color: var(--soft); text-decoration: line-through; }
.seat.own { border: 1px solid var(--soft); border-radius: 999px; padding: 0 .5rem; color: var(--soft); font-size: .85em; white-space: nowrap; }

.search { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.search input { flex: 1; min-width: 160px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem; margin-top: 1rem; }
/* The turner under every table: the arrows and the size are small, and it stays with its table. */
.pager { margin: .6rem 0 1.2rem; font-size: .9rem; }
.pager button, .pager select { padding: .25rem .7rem; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager small { margin-inline-start: .5rem; font-variant-numeric: tabular-nums; }
.aside { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.transcript {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem;
    max-height: 60vh;
    overflow: auto;
    font-size: .85rem;
    white-space: pre-wrap;
    text-align: left;
}

.qr { background: #fff; padding: .8rem; border-radius: 8px; width: fit-content; margin: .6rem auto; }
.qr svg { display: block; width: 220px; height: 220px; }
.secret { font-family: monospace; font-size: 1.05rem; letter-spacing: .05em; text-align: center; }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .side { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem 1rem; }
    .brand { margin: 0; margin-inline-end: 1rem; }
    .who { margin: 0; margin-inline-start: auto; display: flex; gap: .6rem; align-items: center; }
    .who .role { display: none; }
    .page { padding: 1rem; }
    .grid { font-size: .85rem; }
    table.grid { display: block; overflow-x: auto; }
}

.switch { margin: .4rem 0; }
.door .corner { margin-top: 1rem; text-align: end; }
.door .corner .switch { margin: 0; }

input.narrow { width: 5.5rem; }
label.inline { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); }

.bracket { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; }
.match { padding: .7rem .9rem; }
.match .in { color: var(--good); font-weight: 700; }

/* The table page's scoreboard: the two sides, the cards down, whose turn it is. A side here is a
   pair, never .side: that name is the menu column's, as wide as it and as tall as the window. */
.score { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; margin: 1rem 0; }
.score .pair .names { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .3rem 0; }
.score .pair .names .turn { text-decoration: underline; text-underline-offset: .25em; }
.score .pair .big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.score .pair.won { outline: 2px solid var(--gold); }
.trick { display: flex; flex-wrap: wrap; gap: .6rem; }
.trick .played { display: flex; flex-direction: column; align-items: center; min-width: 5rem; }
.trick .played b { font-size: 1.6rem; }
.red { color: var(--bad); }
details summary { cursor: pointer; margin: 1rem 0 .4rem; font-weight: 600; }

/* goud.games: every language of a text side by side, each with the site's own reading under it. */
.langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.lang { display: flex; flex-direction: column; gap: .35rem; }
.lang-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--soft); }
.lang textarea, .lang input, textarea.json { width: 100%; box-sizing: border-box; font: inherit; }
textarea.json { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.preview { border-inline-start: 3px solid var(--line); padding-inline-start: .7rem; font-size: .95rem; }
.preview p { margin: .4rem 0; }
.preview .door { color: var(--gold); border-bottom: 1px dotted var(--gold); }
.problems li.stops { color: var(--bad); }
.picture { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0; }
fieldset.parts { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .8rem; }

/* The patterns a tournament is defined from: each a name to press, and a small cross beside it that drops it. */
.patterns { align-items: center; gap: .5rem .8rem; }
.patterns .pattern { display: inline-flex; }
.patterns .pattern button:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
.patterns .pattern .drop { border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start: 0; padding: .4rem .55rem; color: var(--soft); }

/* The Stats page. Three colours for who is counted, the same three on every chart: people, the
   house's own players, bots. They were chosen as a set and checked against this paper in light and
   in dark, so they are told apart by somebody who sees red and green as one. A chart of a single
   thing wears the panel's gold. Numbers and names stay in ink: only a mark wears a colour. */
:root { --who-1: #2a78d6; --who-2: #eb6834; --who-3: #1baf7a; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --who-1: #3987e5; --who-2: #d95926; --who-3: #199e70; }
}
:root[data-theme="dark"] { --who-1: #3987e5; --who-2: #d95926; --who-3: #199e70; }

.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-inline-end: .35rem; flex-shrink: 0; }
.swatch.who-1 { background: var(--who-1); }
.swatch.who-2 { background: var(--who-2); }
.swatch.who-3 { background: var(--who-3); }
.swatch.one, .bar.one { background: var(--gold); }

.choose { display: flex; flex-wrap: wrap; gap: .8rem 2rem; align-items: center; }
.grains { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.grains button { background: none; color: var(--soft); border: none; border-radius: 0; padding: .35rem 1rem; }
.grains button.on { background: var(--gold); color: #fff; }
.whos { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.whos label { margin: 0; }

.four h2 { margin: 1.4rem 0 .5rem; }
/* A figure too long for its square is set smaller until it fits (2026-10-08), by its length in
   characters and the square's own width; a digit is taken as .62 of the font's size across. */
.four .tile { container-type: inline-size; min-width: 0; }
.four .tile .number { font-size: min(1.8rem, calc(100cqi / (var(--len, 1) * .62))); white-space: nowrap; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: .8rem; margin-top: 1.6rem; align-items: start; }
.chart { margin: 0; min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem .5rem; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; align-items: baseline; margin-bottom: .5rem; }
.chart .legend { display: flex; flex-wrap: wrap; gap: .2rem .9rem; color: var(--soft); font-size: .85rem; }
.chart .legend span { display: inline-flex; align-items: center; }

.plot { position: relative; }
.plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.plot .rule { stroke: var(--line); stroke-width: 1; }
.plot .base { stroke: var(--soft); stroke-opacity: .55; stroke-width: 1; }
.plot .tick { fill: var(--soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.plot .piece.who-1 { fill: var(--who-1); }
.plot .piece.who-2 { fill: var(--who-2); }
.plot .piece.who-3 { fill: var(--who-3); }
.plot .piece.one { fill: var(--gold); }
/* A show's live curve (the quiz's stats, CurveChart.razor). */
.plot .curve { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .curve.who-1 { stroke: var(--who-1); }
.plot .curve.who-2 { stroke: var(--who-2); }
.plot .curve.watch { stroke: var(--gold); stroke-dasharray: 5 4; }
.plot .start { stroke: var(--soft); stroke-dasharray: 3 3; }
.plot .hit { fill: var(--ink); fill-opacity: 0; }
.plot .hit.on { fill-opacity: .06; }

.tip {
    position: absolute;
    top: 0;
    z-index: 2;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    min-width: 9.5rem;
    white-space: nowrap;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .4rem .65rem;
    font-size: .85rem;
    line-height: 1.6;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
}
.tip span { display: flex; align-items: center; color: var(--soft); }
.tip em { font-style: normal; margin-inline-start: auto; padding-inline-start: 1.2rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip .sum { border-top: 1px solid var(--line); margin-top: .2rem; padding-top: .2rem; }

.chart details summary { margin: .3rem 0; font-weight: 400; font-size: .85rem; color: var(--soft); }
/* What a number counted (2026-10-07): a number, a bar's name or a square of the Stats page that
   can be pressed is a button that looks like what it was, with a line under it when pointed at;
   and its list opens at the side over the page, wide enough for a table. */
button.open { display: block; width: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
button.open:hover .number, button.open:hover .label, button.open.small:hover, button.open.name:hover, button.open.value:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: .2em; }
button.open:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.tile button.open .number, .tile button.open .label { display: block; }
.tile button.open.small { color: var(--soft); font-size: .8rem; }
.bars button.open.name { width: auto; color: var(--soft); font-size: .9rem; }
.best button.open.value { width: auto; font-variant-numeric: tabular-nums; }
button.heat { border: 0; padding: 0; width: 100%; cursor: pointer; }
button.heat:hover, button.heat:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.drawer.behind {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    width: min(56rem, 100vw);
    overflow-y: auto;
    padding: 1rem 1.2rem 2rem;
    background: var(--paper);
    border-inline-start: 1px solid var(--line);
    box-shadow: 0 0 2rem rgba(0, 0, 0, .25);
    z-index: 20;
}
.drawer.behind header { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.drawer.behind header h3 { margin: 0; overflow-wrap: anywhere; }

table.figures { font-size: .88rem; margin-bottom: .5rem; }
table.figures th, table.figures td { padding: .25rem .6rem; font-variant-numeric: tabular-nums; }

.bars { display: grid; grid-template-columns: max-content 1fr max-content; gap: .5rem .8rem; align-items: center; padding-bottom: .5rem; }
.bars .name { color: var(--soft); font-size: .9rem; }
.bars .track { display: block; }
.bars .bar { display: block; height: 14px; min-width: 2px; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.bars .value { font-variant-numeric: tabular-nums; }
.bars .value small { color: var(--soft); margin-inline-start: .4rem; }

/* When the house is busy: one hue from pale to deep, an empty hour left the colour of the paper.
   On dark paper the same hue runs the other way, deep for little and bright for much. */
:root { --heat-1: #cde2fb; --heat-2: #9ec5f4; --heat-3: #6da7ec; --heat-4: #2a78d6; --heat-5: #184f95; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --heat-1: #0d366b; --heat-2: #184f95; --heat-3: #256abf; --heat-4: #3987e5; --heat-5: #86b6ef; }
}
:root[data-theme="dark"] { --heat-1: #0d366b; --heat-2: #184f95; --heat-3: #256abf; --heat-4: #3987e5; --heat-5: #86b6ef; }

.chart.wide { grid-column: 1 / -1; }
.hours { display: grid; grid-template-columns: max-content repeat(24, minmax(0, 1fr)); gap: 2px; align-items: center; max-width: 760px; }
.hours .hour { color: var(--soft); font-size: 11px; font-variant-numeric: tabular-nums; }
.hours .day { color: var(--soft); font-size: .8rem; padding-inline-end: .5rem; }
.heat { display: block; height: 18px; border-radius: 3px; background: color-mix(in srgb, var(--line) 45%, transparent); }
.heat.heat-1 { background: var(--heat-1); }
.heat.heat-2 { background: var(--heat-2); }
.heat.heat-3 { background: var(--heat-3); }
.heat.heat-4 { background: var(--heat-4); }
.heat.heat-5 { background: var(--heat-5); }
.scale { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin: .7rem 0 .3rem; color: var(--soft); font-size: .85rem; }
.scale .heat { width: 18px; height: 12px; }
.scale .busiest { margin-inline-start: 1.2rem; }

/* Who came back: a number, what it is out of, and a line as long as the number. */
table.back td { position: relative; padding-bottom: .5rem; }
table.back td small { color: var(--soft); margin-inline-start: .4rem; }
table.back .meter { position: absolute; inset-inline-start: .6rem; bottom: .2rem; height: 3px; max-width: calc(100% - 1.2rem); border-radius: 2px; background: var(--gold); }

/* Who did the most: a name, a bar as long as its number, and the number. */
.best { list-style: none; margin: 0; padding: 0 0 .5rem; display: grid; gap: .45rem; counter-reset: best; }
.best li { display: grid; grid-template-columns: 1.6rem minmax(7rem, 12rem) 1fr max-content; gap: .7rem; align-items: center; counter-increment: best; }
.best li::before { content: counter(best); color: var(--soft); font-size: .85rem; font-variant-numeric: tabular-nums; text-align: end; }
.best .name { display: inline-flex; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.best .track { display: block; }
.best .bar { display: block; height: 14px; min-width: 2px; border-start-end-radius: 4px; border-end-end-radius: 4px; }
.best .value { font-variant-numeric: tabular-nums; }

/* Every table (2026-10-03): rows take turns in two shades and the one under the pointer stands
   out; a column's name sorts on a click and moves when dragged, and the funnel beside it opens
   the box that filters by it. */
.grid tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 4%, var(--paper)); }
.grid tbody tr:hover td { background: color-mix(in srgb, var(--gold) 12%, var(--paper)); }
.grid tbody tr.group:hover td { background: color-mix(in srgb, var(--gold) 10%, var(--paper)); }
.grid tbody tr.none:hover td { background: var(--paper); }
.grid tr.none td { color: var(--soft); text-align: center; }
.grid thead th { background: color-mix(in srgb, var(--ink) 6%, var(--paper)); white-space: nowrap; }
.grid th .head { display: flex; align-items: center; gap: .35rem; }
.grid th .name { cursor: grab; user-select: none; }
.grid th .name.sorts { cursor: pointer; }
.grid th .name.sorts:hover { color: var(--ink); }
.grid th[aria-sort] .name { color: var(--ink); font-weight: 700; }
.grid th .way { font-style: normal; font-size: .7rem; margin-inline-start: .25rem; color: var(--gold); }
.grid th button.sift { padding: .1rem .2rem; border: none; background: transparent; color: var(--soft); opacity: .45; line-height: 1; cursor: pointer; }
.grid th:hover button.sift, .grid th button.sift:focus-visible { opacity: 1; }
.grid th button.sift.on { color: var(--gold); opacity: 1; }
.grid th input.sift { display: block; width: 100%; min-width: 5rem; margin-top: .3rem; padding: .2rem .4rem; font-size: .85rem; font-weight: 400; }
p.order { margin: -.4rem 0 1rem; font-size: .85rem; text-align: end; }
p.order button { padding: .15rem .6rem; }

/* The menu in groups (2026-10-07): each group folds under its own name, a line has a small
   drawing before its name and, when something is waiting on somebody, a count after it. A folded
   group shows the sum of its counts beside its name; an open one leaves them to its lines. The
   menu stays where it is while the page scrolls. */
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; gap: .5rem; padding: 1rem .8rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: .2rem; padding-inline: .4rem; }
.brand a { color: inherit; opacity: 1; padding: 0; }
.brand a:hover { background: none; }
.side .menu { display: none; padding: .2rem .4rem; border: none; }
.icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.side .find { display: flex; align-items: center; gap: .5rem; width: 100%; padding: .4rem .6rem; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); color: var(--side-ink); opacity: .85; }
.side .find:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.side .find span { flex: 1; text-align: start; }
kbd { font: inherit; font-size: .72rem; padding: 0 .35rem; border: 1px solid currentColor; border-radius: 4px; opacity: .6; }

.shelves { display: flex; flex-direction: column; gap: .3rem; }
.shelf { display: flex; flex-direction: column; }
.shelf summary { display: flex; align-items: center; margin: .3rem 0 .1rem; padding: .1rem .4rem; font-size: .74rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; opacity: .55; list-style: none; user-select: none; }
[dir="rtl"] .shelf summary { letter-spacing: 0; font-size: .8rem; }
.shelf summary::-webkit-details-marker { display: none; }
.shelf summary::after { content: "▾"; margin-inline-start: auto; font-size: .8rem; }
.shelf:not([open]) summary::after { content: "▸"; }
[dir="rtl"] .shelf:not([open]) summary::after { content: "◂"; }
.shelf summary:hover { opacity: .9; }
.shelf summary .mark { margin-inline-start: .5rem; }
.shelf[open] summary .mark { display: none; }
.shelf a { display: flex; align-items: center; gap: .55rem; padding: .34rem .6rem; }
.shelf a .name { flex: 1; min-width: 0; }
.shelf a .mark { margin: 0; }
.shelf a.active { box-shadow: inset 3px 0 0 var(--gold); }
[dir="rtl"] .shelf a.active { box-shadow: inset -3px 0 0 var(--gold); }

.who { padding: .6rem .4rem 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.who a { padding: 0; }
.who .row { gap: .4rem; margin: .4rem 0 0; align-items: center; }
.who .row .switch { margin: 0; }
.who button { padding: .2rem .6rem; font-size: .82rem; }

@media (max-width: 760px) {
    .side { position: static; height: auto; flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
    .side .menu { display: inline-flex; }
    .side .find, .side .shelves, .side .who { display: none; }
    .side.open .find, .side.open .shelves { display: flex; }
    .side.open .who { display: block; margin: 0; }
    .who .role { display: block; }
}

/* The search box: opened by Ctrl+K, a line to a place, the arrows move among them. */
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.finder { width: min(560px, calc(100vw - 2rem)); margin-top: 12vh; }
.finder input { width: 100%; border: none; border-bottom: 1px solid var(--line); border-radius: 0; padding: .9rem 1.1rem; font-size: 1.05rem; background: transparent; }
.finder input:focus { outline: none; border-bottom-color: var(--gold); }
.finder .found { max-height: 55vh; overflow-y: auto; padding: .3rem .5rem .5rem; }
.finder h3 { margin: .7rem .6rem .2rem; font-size: .76rem; font-weight: 500; color: var(--soft); }
.finder .found a { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; padding: .4rem .6rem; border-radius: 6px; color: var(--ink); }
.finder .found a:hover, .finder .found a:focus { background: color-mix(in srgb, var(--gold) 16%, var(--paper)); text-decoration: none; outline: none; }
.finder .found a small { color: var(--soft); }
.finder .found a small.red { color: var(--bad); }
.finder .hint { margin: .8rem .6rem; }
.finder .keys { margin: 0; padding: .4rem 1rem; border-top: 1px solid var(--line); color: var(--soft); text-align: end; }

/* The question before a press that matters, and the word to type before one that cannot be taken back. */
.sure { width: min(460px, calc(100vw - 2rem)); padding: 1.2rem 1.4rem; }
.sure p { margin: 0 0 1rem; }
.sure label b { color: var(--ink); }
.sure label input { margin-top: .3rem; }
.sure .row { margin: 0; justify-content: flex-end; }

/* An answer, floating in the corner a line ends at: green for done, red for refused. */
.toasts { position: fixed; inset-block-end: 1.2rem; inset-inline-end: 1.2rem; z-index: 30; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2.4rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .9rem; border-radius: 10px; border: 1px solid; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); cursor: pointer; animation: rise .18s ease-out; }
.toast span { flex: 1; overflow-wrap: anywhere; }
.toast.good { background: var(--good-ground); color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.toast.bad { background: var(--bad-ground); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.toast button { padding: 0 .35rem; border: none; color: inherit; font-size: 1.1rem; line-height: 1.2; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* A page in tabs, each with an address of its own: the house and an account. A tab that is a
   link looks as a tab that is a button does. */
.tabs a.tab, .tabs a.tab:hover { text-decoration: none; }
.tabs .count { margin-inline-start: .25rem; }
/* What saves every tab at once stays in sight under whichever tab is open. */
.savebar { position: sticky; bottom: 0; z-index: 5; margin-top: 1.2rem; padding: .8rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 -6px 18px rgba(0, 0, 0, .08); }
.savebar .row { margin: 0; }
.savebar label { margin: 0; flex: 1; }

/* What is waiting on the reader, at the top of the dashboard: a line to a thing, the number first. */
.waiting { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem; margin: 0 0 1.2rem; }
.waiting a { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; color: var(--ink); background: color-mix(in srgb, var(--gold) 12%, var(--paper)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); border-radius: 10px; }
.waiting a:hover { text-decoration: none; border-color: var(--gold); }
.waiting a b { font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.waiting a.late { background: var(--bad-ground); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.waiting a.late b { color: var(--bad); }
p.nothing { color: var(--soft); margin: 0 0 1.2rem; }

/* One measure for what is pressed and what is typed in, and a ring on whatever the keyboard is on. */
button, a.tab { transition: background-color .12s, border-color .12s, opacity .12s; }
button:not(:disabled):hover { filter: brightness(1.08); }
button.quiet:not(:disabled):hover { background: color-mix(in srgb, var(--gold) 12%, transparent); filter: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .45rem .6rem; }
textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* Something typed and not saved: a line that stays at the top of the page until a save goes through. */
.unsavedbar { display: none; position: sticky; top: 0; z-index: 6; margin: -.6rem 0 1rem; padding: .45rem .9rem; border-radius: 8px; background: color-mix(in srgb, var(--gold) 18%, var(--paper)); border: 1px solid var(--gold); color: var(--ink); font-size: .92rem; }
body.unsaved .unsavedbar { display: block; }

/* A column moved a place by a press, for a finger: shown only where nothing hovers. */
.grid th .moves { display: none; }
@media (hover: none) {
    .grid th .moves { display: inline-flex; }
    .grid th .moves button.sift { opacity: .8; padding: .1rem .45rem; font-size: 1rem; }
}

/* A table on a phone: a row is a card, each cell a line with its column's name before it, and
   the columns' names sit above as a row of chips that still sort, filter and move. */
@media (max-width: 760px) {
    table.grid { display: block; overflow-x: visible; background: none; border: none; font-size: .9rem; }
    .grid thead, .grid tbody { display: block; }
    .grid thead tr { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
    .grid thead th { display: block; padding: .15rem .6rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
    .grid tbody tr { display: block; margin-bottom: .5rem; padding: .3rem 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
    .grid tbody td { display: flex; gap: .8rem; align-items: baseline; padding: .25rem .8rem; border: none; background: none !important; overflow-wrap: anywhere; }
    .grid tbody td::before { content: attr(data-title); flex: 0 0 36%; color: var(--soft); font-size: .82rem; }
    .grid tbody td:not([data-title])::before, .grid tbody td[data-title=""]::before, .grid tr.none td::before { content: none; }
    .grid tbody tr:nth-child(even) { background: color-mix(in srgb, var(--ink) 4%, var(--paper)); }
    .tabs { flex-wrap: nowrap; overflow-x: auto; }
    .tabs .tab { white-space: nowrap; }
    .toasts { inset-inline: 1rem; width: auto; }
    .savebar { padding: .6rem; }
}

/* The face a player sits behind (2026-10-10): small and round in a list, larger on the account. */
img.face { width: 1.8rem; height: 1.8rem; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--line, #ddd); }
img.face.big { width: 3.2rem; height: 3.2rem; margin-inline-end: .5rem; }

/* A knockout as a circle (Parts/CupCircle.razor, the-circle.md): the faces round the rim, each
   round a ring further in, the final in the middle; what was pressed beside it. */
.cupring { display: grid; grid-template-columns: minmax(0, 82vh) minmax(220px, 300px); gap: 1rem; align-items: start; margin: 1rem 0; }
@media (max-width: 900px) { .cupring { grid-template-columns: minmax(0, 1fr); } }
.cupring .field { position: relative; overflow: hidden; aspect-ratio: 1; max-height: 82vh; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; touch-action: none; cursor: grab; }
.cupring .field.dragging { cursor: grabbing; }
.cupring .zoom { position: absolute; inset: 0; }
.cupring .zoom svg { width: 100%; height: 100%; display: block; }
.cupring .zoombar { position: absolute; bottom: .5rem; inset-inline-end: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.cupring .zoombar button { width: 2rem; height: 2rem; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); }
.cupring svg text { font-family: inherit; pointer-events: none; }
.cupring svg .ring-hit { cursor: pointer; }
.cupring svg .ring-line { fill: none; stroke: var(--line); stroke-width: 1.6; stroke-dasharray: 4 4; }
.cupring svg .ring-line.is-went { stroke: var(--gold); stroke-width: 2.4; stroke-dasharray: none; }
.cupring svg .ring-line.is-road { stroke: #3b7dd8; stroke-width: 4; stroke-dasharray: none; }
.cupring svg .ring-face .ring-disc { fill: var(--ground); }
.cupring svg .ring-face .ring-edge { fill: none; stroke: var(--gold); stroke-width: 2; }
.cupring svg .ring-face.is-out image { filter: grayscale(1) brightness(.75); }
.cupring svg .ring-face.is-out .ring-edge { stroke: var(--line); }
.cupring svg .ring-face.is-regular .ring-edge { stroke: var(--soft); stroke-dasharray: 5 3; }
.cupring svg .ring-face.is-road .ring-edge { stroke: #3b7dd8; stroke-width: 4; stroke-dasharray: none; }
.cupring svg .ring-face:hover .ring-edge { stroke-width: 4; }
.cupring svg .ring-letter { fill: var(--soft); font-weight: 700; }
.cupring svg .ring-knot .ring-disc { fill: var(--paper); stroke: var(--soft); stroke-width: 1.5; }
.cupring svg .ring-knot.st-done .ring-disc { fill: color-mix(in srgb, var(--gold) 30%, var(--paper)); stroke: var(--gold); }
.cupring svg .ring-knot.st-playing .ring-disc { fill: var(--bad); stroke: var(--bad); }
.cupring svg .ring-knot.is-chosen .ring-disc { stroke: #3b7dd8; stroke-width: 4; }
.cupring svg .ring-score { fill: #fff; font-weight: 700; }
.cupring svg .ring-under { fill: var(--ink); font-weight: 700; }
.cupring svg .ring-medal { fill: var(--paper); stroke: var(--gold); stroke-width: 3; }
.cupring svg .ring-middle.st-playing .ring-medal { stroke: var(--bad); stroke-width: 5; }
.cupring svg .ring-middle.is-chosen .ring-medal { stroke: #3b7dd8; }
.cupring svg .ring-title { fill: var(--gold); font-weight: 700; }
.cupring svg .ring-final { fill: var(--bad); font-weight: 700; }
.cupring .ring-side h3 { margin: 0 0 .3rem; }
.cupring .ring-pair { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.cupring .ring-pair.won .ring-who { border-color: var(--gold); font-weight: 700; }
.cupring .ring-who { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem .15rem .2rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
.cupring .ring-score-line { font-size: 1.6rem; font-weight: 700; text-align: center; }
.cupring .ring-road { list-style: none; margin: .5rem 0 0; padding: 0; }
.cupring .ring-road li button { padding: .2rem 0; text-align: start; color: inherit; }
.cupring .ring-road li.through button { color: var(--good); }
.cupring .ring-road li.out button { color: var(--bad); }
/* Every player's own lane on the circle (2026-10-16): plain while to be played, gold through, dim out, blue on the road. */
.cupring svg .ring-line.is-in { stroke: var(--soft); stroke-width: 1.5; stroke-dasharray: none; }
.cupring svg .ring-line.is-went { stroke-width: 2; }
.cupring svg .ring-line.is-lost { stroke: var(--line); stroke-width: 1.3; stroke-dasharray: none; }
.cupring svg .ring-line.is-road { stroke-width: 2.6; }
.cupring svg .ring-pair { fill: transparent; stroke: none; }
.cupring svg .ring-pair.is-chosen { stroke: #3b7dd8; stroke-width: 3; stroke-dasharray: 6 4; }
