/*
 * The look of the table. Everything that makes up the theme is in the first block: change the colours, the two
 * type families and the spacing there, and the whole page follows. The words are in strings.js.
 */
:root {
    /* ground */
    --ink: #0d1014;
    --ink-2: #13181e;
    --surface: #1a2028;
    --surface-2: #222a34;
    --line: #2d3743;
    --line-soft: #232b35;
    /* text */
    --text: #ece8df;
    --text-soft: #b9bcc0;
    --muted: #8a939d;
    /* the table */
    --felt: #1c4b45;
    --felt-deep: #0f2d2a;
    --felt-edge: #0a1f1d;
    --rail: #2b2118;
    --rail-light: #4a3a27;
    /* accents */
    --brass: #e3b663;
    --brass-deep: #b98a35;
    /* the one who has the floor: never the brass of a mission team */
    --floor: #8fdcff;
    --on-floor: #06202c;
    --on-brass: #1c1404;
    --yes: #63cfa9;
    --yes-bg: #12362c;
    --no: #f08672;
    --no-bg: #3d1c17;
    --good: #8cc0ee;
    --good-bg: #16293b;
    --evil: #ee8a79;
    --evil-bg: #3a1c19;
    /* the speech bubbles: a slip of paper for what was just said, a dark tag for what was said before */
    --paper: #e8e0cd;
    --paper-edge: #b3a686;
    --on-paper: #1b1710;
    --on-paper-soft: #564d3c;
    --bubble-quiet: rgba(13, 16, 20, .86);
    --bubble-lines: 4;
    /* type */
    --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    /* shape and space */
    --radius: 12px;
    --radius-small: 8px;
    --gap: 16px;
    --gap-small: 8px;
    --token: 56px;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    background: radial-gradient(1200px 700px at 30% -10%, #18212a 0%, var(--ink) 60%) fixed, var(--ink);
    color: var(--text);
    font: 16px/1.45 var(--font-ui);
    -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }
.icon { display: inline-flex; width: 1.1em; height: 1.1em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---- controls ---------------------------------------------------------------------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 9px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-small);
    background: var(--surface-2); color: var(--text);
    font-weight: 600; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.button:hover:not(:disabled) { border-color: #48566a; background: #2a3440; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button.primary { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
.button.primary:hover:not(:disabled) { background: #f0c678; border-color: #f0c678; }
.button.accent { border-color: var(--brass-deep); color: var(--brass); background: rgba(227, 182, 99, .08); }
.button.accent:hover:not(:disabled) { background: rgba(227, 182, 99, .16); border-color: var(--brass); }
.button.quiet { background: transparent; border-color: transparent; color: var(--text-soft); min-height: 40px; padding: 6px 10px; }
.button.quiet:hover:not(:disabled) { background: var(--surface); border-color: var(--line); }
.button.large { min-height: 52px; padding: 12px 22px; font-size: 1.05rem; }
.field {
    width: 100%; min-height: 44px; padding: 10px 12px;
    background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-small);
}
.field:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: transparent; }
.problem {
    padding: 8px 12px; border-radius: var(--radius-small);
    background: var(--no-bg); border: 1px solid #6b3027; color: #ffd0c6; font-size: .95rem;
}

/* ---- front page and lobby ---------------------------------------------------------- */

.front { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.front-card {
    width: min(560px, 100%); display: grid; gap: 20px; padding: 32px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--ink-2) 100%);
    border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
}
.front-head { display: grid; justify-items: center; gap: 6px; text-align: center; }
.front-mark { border-radius: 14px; }
.front-title { font: 600 2.6rem/1.1 var(--font-display); letter-spacing: .01em; }
.front-tagline { color: var(--text-soft); }
.front-lead { color: var(--text-soft); text-align: center; }
.front-form { display: grid; gap: 14px; }
.front-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.front-row.stacked { flex-direction: column; align-items: stretch; gap: 8px; }
.front-row .field { max-width: 220px; }
.front-row.stacked .field { max-width: none; }
.front-label { display: grid; gap: 2px; }
.front-name { font-weight: 600; }
.front-help { color: var(--muted); font-size: .88rem; }
.front-humans { padding: 10px 12px; border-radius: var(--radius-small); background: var(--ink-2); border: 1px dashed var(--line); text-align: center; color: var(--text-soft); }
.front-humans.bad { color: #ffd0c6; border-color: #6b3027; }
.front-notice { color: var(--muted); font-size: .85rem; text-align: center; border-top: 1px solid var(--line-soft); padding-top: 16px; }
.front-forms { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.front-forms legend { padding: 0 0 6px; }
.form-option { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--ink-2); cursor: pointer; }
.form-option:hover { border-color: #48566a; }
.form-option.on { border-color: var(--brass); background: rgba(227, 182, 99, .08); }
.form-radio { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--brass); }
.form-text { display: grid; gap: 2px; }
.form-name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.form-default { padding: 0 8px; border-radius: 999px; border: 1px solid var(--brass-deep); color: var(--brass); font-size: .74rem; font-weight: 600; }
.lobby-form { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-soft); font-size: .92rem; text-align: center; }
.lobby-form .icon { color: var(--brass); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--ink-2); flex: none; }
.stepper-button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 999px; color: var(--brass); }
.stepper-button:hover { background: var(--surface-2); }
.stepper-value { min-width: 2.2ch; text-align: center; font: 600 1.25rem var(--font-display); font-variant-numeric: tabular-nums; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { border-radius: 7px; }
.brand-name { font: 600 1.2rem var(--font-display); letter-spacing: .01em; white-space: nowrap; }
.lobby-title { font: 600 1.6rem/1.2 var(--font-display); margin-top: 10px; }
.lobby-seats { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.lobby-seat { width: 34px; height: 34px; border-radius: 50%; border: 2px dashed var(--line); }
.lobby-seat.taken { border: 2px solid var(--brass); background: radial-gradient(circle at 35% 30%, #f3d08b, var(--brass-deep)); }
.lobby-seat.other { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.lobby-count { text-align: center; color: var(--text-soft); }
.lobby-share { display: grid; gap: 8px; }
.lobby-link { display: flex; gap: 8px; }
.lobby-link .button { white-space: nowrap; }
.lobby-link .field { font-size: .9rem; color: var(--text-soft); min-width: 0; }
.lobby-you { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--yes); font-weight: 600; }

/* ---- the table page: frame --------------------------------------------------------- */

.app[data-view="table"] { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.bar, .dock, .bar-lost { flex: none; }
.bar {
    display: flex; align-items: center; gap: 16px; padding: 8px 16px;
    border-bottom: 1px solid var(--line-soft); background: rgba(13, 16, 20, .8);
}
.bar-status { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--text-soft); font-size: .95rem; white-space: nowrap; overflow: hidden; }
.bar-mission { font-weight: 600; color: var(--text); }
.bar-leader { display: inline-flex; align-items: center; gap: 5px; color: var(--brass); }
.bar-lost { padding: 6px 16px; background: var(--no-bg); color: #ffd0c6; text-align: center; font-size: .9rem; }
.board { flex: 1; display: grid; grid-template-columns: minmax(380px, 46fr) minmax(0, 54fr); gap: var(--gap); padding: var(--gap); min-height: 0; }
.stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; min-height: 0; min-width: 0; }
.talk { position: relative; min-height: 0; min-width: 0; display: grid; }

/* ---- the score track --------------------------------------------------------------- */

.track { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.discs { display: flex; gap: 10px; }
.disc {
    position: relative; width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    border: 2px solid var(--line); background: var(--ink-2); color: var(--muted);
    font: 600 1.15rem var(--font-display);
    transition: background .4s, border-color .4s, color .4s;
}
.disc-number { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); padding: 0 5px; border-radius: 6px; background: var(--ink); color: var(--muted); font: 600 .62rem var(--font-ui); }
.disc-two { position: absolute; top: -7px; right: -8px; padding: 1px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-soft); font: 700 .62rem var(--font-ui); }
.disc.now { border-color: var(--brass); color: var(--brass); box-shadow: 0 0 0 4px rgba(227, 182, 99, .12); }
.disc.success { border-color: var(--yes); background: var(--yes-bg); color: var(--yes); }
.disc.fail { border-color: var(--no); background: var(--no-bg); color: var(--no); border-radius: 12px; }
.disc .icon { width: 24px; height: 24px; }
.rejections { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; }
.pips { display: inline-flex; gap: 5px; }
.pip { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line); }
.rejections .pip.on { background: var(--no); border-color: var(--no); border-radius: 2px; }

/* ---- the table itself -------------------------------------------------------------- */

.table { position: relative; min-height: 240px; }
.felt {
    position: absolute; inset: 19% 15% 21%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 35%, var(--felt) 0%, var(--felt-deep) 70%, var(--felt-edge) 100%);
    box-shadow: 0 0 0 10px var(--rail), 0 0 0 11px var(--rail-light), 0 0 0 13px #17110b, 0 24px 60px rgba(0, 0, 0, .55), inset 0 0 60px rgba(0, 0, 0, .45);
}
.felt::after { content: ""; position: absolute; inset: 9%; border-radius: 50%; border: 1px solid rgba(227, 182, 99, .16); }
.centre {
    position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%);
    width: 52%; display: grid; justify-items: center; gap: 6px; text-align: center; pointer-events: none;
}
.centre-title { font: 600 1.25rem/1.2 var(--font-display); }
.centre-title.dim { color: rgba(236, 232, 223, .55); font-style: italic; }
.centre-title.success, .centre-title.good { color: var(--yes); }
.centre-title.fail, .centre-title.evil { color: var(--no); }
.centre-small { color: rgba(236, 232, 223, .62); font-size: .8rem; }
.centre-flag + .centre-title + .chips + .centre-small { display: none; }
.centre-flag { padding: 2px 10px; border-radius: 999px; background: var(--brass); color: var(--on-brass); font-weight: 700; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: rgba(13, 16, 20, .55); border: 1px solid rgba(227, 182, 99, .55); color: var(--text); font-weight: 600; font-size: .88rem; }
.chips.draft .chip { border-style: dashed; color: var(--brass); }

.seats { position: absolute; inset: 0; }
.seat {
    position: absolute; transform: translate(-50%, -50%);
    display: grid; justify-items: center; gap: 3px; width: 92px; padding: 2px;
    background: none; border: 0; color: var(--text); text-align: center;
}
.token {
    position: relative; width: var(--token); height: var(--token); border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 35% 28%, #3a4655 0%, #232c37 62%, #1a212a 100%);
    border: 2px solid #46546a;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
    transition: border-color .25s, box-shadow .25s, transform .25s var(--ease);
}
.token-letter { font: 600 1.45rem var(--font-display); color: var(--text); }
.seat-name { font-weight: 600; font-size: .9rem; line-height: 1.15; display: grid; justify-items: center; }
.seat-you { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); }
.seat.me .token { border-color: var(--text); }
.seat.team .token { border-color: var(--brass); box-shadow: 0 0 0 4px rgba(227, 182, 99, .28), 0 6px 14px rgba(0, 0, 0, .5); transform: translateY(-3px); }
.seat.team .token::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px dashed rgba(227, 182, 99, .7); }
.seat.can { cursor: pointer; }
.seat.can .token { border-style: dashed; }
.seat.can:hover .token { border-color: var(--brass); }
.seat.can.pressed .token { border-style: solid; border-color: var(--brass); background: radial-gradient(circle at 35% 28%, #6a5530 0%, #3c3018 70%); }
.mark {
    position: absolute; width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center; border: 2px solid var(--ink);
}
.mark .icon { width: 14px; height: 14px; }
.mark.lead { top: -8px; left: -8px; background: var(--brass); color: var(--on-brass); }
.mark.vote { top: -8px; right: -8px; width: 26px; height: 26px; }
.mark.vote.yes { background: var(--yes); color: #06261c; }
.mark.vote.no { background: var(--no); color: #2e0b06; border-radius: 7px; }
.mark.pointed { top: -8px; right: -8px; background: var(--no); color: #2e0b06; }
.mark.lady { bottom: -7px; left: -8px; background: var(--good); color: var(--ink-2); }
.seat-role { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 10px; font-size: .7rem; font-weight: 700; line-height: 1.15; max-width: 100%; }
.seat-role .icon { width: 10px; height: 10px; }
.seat-role.evil { background: var(--evil-bg); color: var(--evil); border: 1px solid #70362e; }
.seat-role.good { background: var(--good-bg); color: var(--good); border: 1px solid #2c4d6b; }

/* who has the word, at a table that speaks in turn */
.floor {
    position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
    background: radial-gradient(circle, rgba(227, 182, 99, .34) 0%, rgba(227, 182, 99, .16) 48%, rgba(227, 182, 99, 0) 70%);
    box-shadow: 0 0 0 2px rgba(227, 182, 99, .85), 0 0 26px 6px rgba(227, 182, 99, .35);
    transition: left .55s var(--ease), top .55s var(--ease);
    animation: breathe 1.8s ease-in-out infinite;
}
.floor.still { transition: none; }
.floor.mine { box-shadow: 0 0 0 3px var(--brass), 0 0 34px 10px rgba(227, 182, 99, .5); }
@keyframes breathe { 0%, 100% { opacity: .78; } 50% { opacity: 1; } }
.seat.speaking .token { border-color: var(--floor); transform: scale(1.08); box-shadow: 0 0 0 3px rgba(143, 220, 255, .55), 0 0 18px 4px rgba(143, 220, 255, .35), 0 6px 14px rgba(0, 0, 0, .5); animation: floor-pulse 1.8s ease-in-out infinite; }
@keyframes floor-pulse { 50% { box-shadow: 0 0 0 5px rgba(143, 220, 255, .3), 0 0 24px 8px rgba(143, 220, 255, .2), 0 6px 14px rgba(0, 0, 0, .5); } }
@media (prefers-reduced-motion: reduce) { .seat.speaking .token { animation: none; } }
.seat.speaking.team .token { transform: translateY(-3px) scale(1.08); }
.seat.speaking .seat-name { color: var(--floor); }
.seat.spoken:not(.speaking) .token-letter { opacity: .62; }
.mark.floor-mark { top: -8px; right: -8px; background: var(--brass); color: var(--on-brass); }
.seat-floor { padding: 1px 8px; border-radius: 10px; background: var(--floor); color: var(--on-floor); font-size: .68rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.centre-floor { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 2px 10px; border-radius: 999px; background: rgba(13, 16, 20, .6); border: 1px solid rgba(227, 182, 99, .6); color: var(--brass); font-weight: 600; font-size: .84rem; }
.centre-floor.mine { background: var(--brass); color: var(--on-brass); border-color: var(--brass); }
.centre-floor .icon { width: 13px; height: 13px; }

/* what each seat said last: the speech bubbles */
.bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bubble {
    position: absolute; width: max-content; pointer-events: auto;
    display: grid; gap: 5px; padding: 8px 12px 9px;
    background: var(--paper); color: var(--on-paper);
    border: 1px solid var(--paper-edge); border-radius: var(--radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
    font-size: .9rem; line-height: 1.38; text-align: left; overflow-wrap: anywhere;
    transition: left .4s var(--ease), top .4s var(--ease);
}
.bubble.still, .bubble.measuring { transition: none; }
.bubble.measuring { animation: none; }
.bubble-body { min-width: 0; }
.bubble-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--bubble-lines); overflow: hidden; }
.bubble-tail { position: absolute; width: 12px; height: 12px; background: inherit; border: 0 solid var(--paper-edge); transform: rotate(45deg); }
.bubble-tail.bottom { bottom: -7px; margin-left: -6px; border-right-width: 1px; border-bottom-width: 1px; }
.bubble-tail.top { top: -7px; margin-left: -6px; border-left-width: 1px; border-top-width: 1px; }
.bubble-tail.left { left: -7px; margin-top: -6px; border-left-width: 1px; border-bottom-width: 1px; }
.bubble-tail.right { right: -7px; margin-top: -6px; border-right-width: 1px; border-top-width: 1px; }
.bubble-tag { justify-self: start; padding: 0 8px; border-radius: 999px; border: 1px solid var(--on-paper-soft); color: var(--on-paper-soft); font-size: .74rem; font-weight: 700; }
.bubble-foot { display: none; gap: 14px; align-items: baseline; }
.bubble.long .bubble-foot { display: flex; }
.bubble-more, .bubble-find { padding: 2px 0; border: 0; background: none; color: var(--on-paper); font-size: .82rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bubble-more:hover, .bubble-find:hover { color: #000; }
.bubble-find { display: none; font-weight: 600; color: var(--on-paper-soft); }
.bubble :focus-visible { outline-color: var(--on-paper); }
.bubble.mine { border-color: var(--brass-deep); box-shadow: 0 0 0 1px var(--brass-deep), 0 8px 20px rgba(0, 0, 0, .5); }
.bubble.over { z-index: 2; box-shadow: 0 14px 34px rgba(0, 0, 0, .65); }
.bubble.open .bubble-text { display: block; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: var(--on-paper-soft) transparent; }
.bubble.open .bubble-find { display: inline; }
/* said a while ago: the first line only */
.bubble.receded, .bubble.small {
    padding: 2px 10px 3px; gap: 0; border-radius: 999px;
    background: var(--bubble-quiet); border-color: var(--line); color: var(--text-soft);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .35); font-size: .78rem;
}
.bubble.receded .bubble-text, .bubble.small .bubble-text { display: block; white-space: nowrap; text-overflow: ellipsis; }
.bubble.receded .bubble-tag, .bubble.receded .bubble-foot, .bubble.small .bubble-foot { display: none; }
.bubble.receded .bubble-tail, .bubble.small .bubble-tail { width: 8px; height: 8px; border-color: var(--line); }
.bubble.receded .bubble-tail.bottom, .bubble.small .bubble-tail.bottom { bottom: -5px; margin-left: -4px; }
.bubble.receded .bubble-tail.top, .bubble.small .bubble-tail.top { top: -5px; margin-left: -4px; }
.bubble.receded .bubble-tail.left, .bubble.small .bubble-tail.left { left: -5px; margin-top: -4px; }
.bubble.receded .bubble-tail.right, .bubble.small .bubble-tail.right { right: -5px; margin-top: -4px; }
.bubble.receded { cursor: pointer; }
.bubble.receded:hover { border-color: var(--brass-deep); color: var(--text); }
.bubble.receded.mine { border-color: var(--brass-deep); box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.bubble.receded :focus-visible { outline-color: var(--brass); }
.bubble.small { color: var(--muted); font-style: italic; }
.mark.said { bottom: -7px; right: -8px; background: var(--paper); color: var(--on-paper); }
.seat.has-line:not(.can) { cursor: pointer; }
.pager {
    position: absolute; left: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 3px 4px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--bubble-quiet); color: var(--text-soft); font-size: .8rem;
}
.pager-button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--brass); cursor: pointer; }
.pager-button:hover:not(:disabled) { background: var(--surface-2); }
.pager-button:disabled { color: var(--muted); opacity: .5; cursor: default; }
.pager-count { min-width: 5ch; text-align: center; font-variant-numeric: tabular-nums; }
.pager-hide { margin-left: 4px; min-height: 28px; padding: 2px 10px; border: 0; border-left: 1px solid var(--line); border-radius: 0 999px 999px 0; background: none; color: var(--text-soft); font-size: .8rem; cursor: pointer; }
.pager-hide:hover { color: var(--text); }
.said.found { animation: found 1.8s ease-out both; border-radius: var(--radius-small); }
@keyframes found { 0%, 35% { background: rgba(227, 182, 99, .22); box-shadow: 0 0 0 6px rgba(227, 182, 99, .22); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }

/* the small ceremonies */
.mark.vote.pop { animation: pop .5s var(--ease) both; animation-delay: calc(var(--order) * 160ms + 200ms); }
@keyframes pop { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.flips { display: flex; gap: 8px; perspective: 600px; margin: 2px 0; }
.flip { position: relative; width: 38px; height: 54px; transform-style: preserve-3d; transform: rotateY(180deg); }
.flip.go { animation: flip .7s var(--ease) both; animation-delay: calc(var(--order) * 350ms + 700ms); }
@keyframes flip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
.flip-back, .flip-face { position: absolute; inset: 0; border-radius: 6px; backface-visibility: hidden; display: grid; place-items: center; border: 1.5px solid rgba(236, 232, 223, .5); }
.flip-back { background: repeating-linear-gradient(45deg, #2a3440 0 5px, #222a34 5px 10px); }
.flip-face { transform: rotateY(180deg); }
.flip.success .flip-face { background: var(--yes-bg); color: var(--yes); border-color: var(--yes); }
.flip.fail .flip-face { background: var(--no-bg); color: var(--no); border-color: var(--no); }
.flip-face .icon { width: 22px; height: 22px; }
.fresh { animation: rise .35s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- the private card -------------------------------------------------------------- */

.rolecard {
    display: grid; gap: 8px; padding: 10px 14px;
    background: linear-gradient(160deg, #232b36 0%, #171c23 100%);
    border: 1px solid var(--line); border-radius: var(--radius);
}
.rolecard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rolecard-title { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.rolecard-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text-soft); font-size: .82rem; cursor: pointer; }
.rolecard-toggle:hover { border-color: var(--brass); color: var(--brass); }
.rolecard-face { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 14px; row-gap: 4px; }
.rolecard-name { font: 600 1.25rem var(--font-display); }
.rolecard-side { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; justify-self: start; padding: 2px 10px; border-radius: 999px; }
.rolecard-face.good .rolecard-side { background: var(--good-bg); color: var(--good); border: 1px solid #2c4d6b; }
.rolecard-face.evil .rolecard-side { background: var(--evil-bg); color: var(--evil); border: 1px solid #70362e; }
.rolecard-role { font-weight: 600; color: var(--text); padding-left: 8px; border-left: 1px solid currentColor; }
.rolecard-knows { grid-column: 1 / -1; color: var(--text-soft); font-size: .92rem; }
.rolecard-seen { display: flex; align-items: center; gap: 6px; color: var(--text); }
.rolecard-seen .icon { width: 14px; height: 14px; flex: none; color: var(--good); }
.rolecard-back { padding: 8px 12px; border-radius: var(--radius-small); color: var(--muted); font-size: .9rem; background: repeating-linear-gradient(45deg, #1d242d 0 6px, #19202a 6px 12px); border: 1px dashed var(--line); }

/* ---- the conversation -------------------------------------------------------------- */

.log {
    overflow-y: auto; min-height: 0; padding: 0 18px 18px;
    background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.log-empty { color: var(--muted); padding: 24px 0; text-align: center; }
.log-head {
    position: sticky; top: 0; z-index: 1; margin: 0 -18px; padding: 12px 18px 8px;
    background: var(--ink-2); border-bottom: 1px solid var(--line-soft);
    font: 600 1.02rem var(--font-display); color: var(--brass);
}
.round { margin: 6px 0 14px; padding-left: 12px; border-left: 2px solid var(--line); display: grid; gap: 8px; }
.round.final { border-left-color: var(--brass); }
.round-head { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.round.final > .round-head { color: var(--brass); }
.said { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.said-token { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: 600 .9rem var(--font-display); color: var(--text-soft); }
.said.mine .said-token { border-color: var(--text); color: var(--text); }
.said-body { min-width: 0; overflow-wrap: anywhere; }
.said-name { font-weight: 700; margin-right: 8px; }
.said-text { color: var(--text); }
.said-pass { color: var(--muted); font-style: italic; }
.said.pass { opacity: .75; }
.said.pass .said-token { width: 22px; height: 22px; font-size: .7rem; margin: 2px 4px; }
.said-tag { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--brass-deep); color: var(--brass); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.said-text + .said-tag, .said-name + .said-tag { margin-left: 6px; }
.said.floor-line .said-token { border-color: var(--brass); color: var(--brass); }
.said.floor-line .said-name { color: var(--brass); }
.said-floor { color: var(--muted); font-style: italic; }
.dots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brass); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
.system { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: var(--radius-small); color: var(--text-soft); font-size: .93rem; }
.system.team { background: rgba(227, 182, 99, .08); color: var(--text); border: 1px solid rgba(227, 182, 99, .25); }
.system.notice { background: var(--surface); }
.system.strong { color: var(--text); font-weight: 600; border: 1px solid var(--line); }
.system.private { border: 1px dashed var(--line); font-style: italic; }
.log-section > .system { margin: 8px 0; }
.log-section { padding-bottom: 6px; }
.result { margin: 10px 0 16px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); display: grid; gap: 6px; }
.result.approved { border-left: 4px solid var(--yes); }
.result.rejected { border-left: 4px solid var(--no); }
.result-title { display: flex; align-items: center; gap: 8px; font: 600 1.02rem var(--font-display); }
.result.mission.approved .result-title { color: var(--yes); }
.result.mission.rejected .result-title { color: var(--no); }
.result-line { color: var(--text-soft); font-size: .93rem; }
.tally { display: grid; grid-template-columns: 20px 48px 1fr; gap: 6px; align-items: baseline; }
.tally .icon { align-self: center; }
.tally.yes .icon, .tally.yes .tally-label { color: var(--yes); }
.tally.no .icon, .tally.no .tally-label { color: var(--no); }
.tally-label { font-weight: 700; font-size: .85rem; }
.jump { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 8px 16px; border-radius: 999px; border: 1px solid var(--brass); background: var(--ink); color: var(--brass); font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.reveal { display: grid; gap: 10px; margin-bottom: 14px; }
.reveal-banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: var(--radius); font: 600 1.4rem var(--font-display); }
.reveal-banner.good { background: var(--good-bg); color: var(--good); border: 1px solid #2c4d6b; }
.reveal-banner.evil { background: var(--evil-bg); color: var(--evil); border: 1px solid #70362e; }
.reveal-list { display: grid; gap: 6px; }
.reveal-row { display: grid; grid-template-columns: 30px minmax(70px, auto) 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: var(--radius-small); background: var(--surface); }
.reveal-knight { font-weight: 700; }
.reveal-role { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.reveal-row.good .reveal-role { color: var(--good); }
.reveal-row.evil .reveal-role { color: var(--evil); }
.reveal-by { color: var(--muted); font-size: .88rem; text-align: right; }
.reveal-by.human { color: var(--text); }
.reveal-guesses { display: grid; gap: 4px; font-size: .93rem; }
.guess { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--text-soft); }
.guess-arrow { color: var(--muted); }
.guess-name { font-weight: 600; color: var(--text); }
.guess-part { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.guess-what { color: var(--muted); }
.guess-part.right .guess-name { color: var(--yes); }
.guess-note { color: var(--muted); font-style: italic; font-size: .86rem; }
.reveal-cards { display: grid; gap: 4px; color: var(--text-soft); font-size: .93rem; }
.reveal-cards li { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.reveal-mission { font-weight: 700; color: var(--text); min-width: 78px; }
.played { display: inline-flex; align-items: center; gap: 4px; }
.played.yes .icon { color: var(--yes); }
.played.no { color: var(--no); font-weight: 600; }

/* ---- the dock: what is asked of you ------------------------------------------------ */

.dock { border-top: 1px solid var(--line); background: linear-gradient(180deg, #171d25 0%, #11161c 100%); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.dock.turn { border-top: 2px solid var(--brass); box-shadow: 0 -12px 40px rgba(227, 182, 99, .07); }
.dock-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start; }
.dock-label { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }
.dock.turn .dock-label { color: var(--brass); }
.dock-main { display: grid; gap: 10px; min-width: 0; }
.dock-head { font-weight: 600; }
.dock-body { display: grid; gap: 10px; }
.dock-body:empty { display: none; }
.dock-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dock-divider { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.dock-hint { color: var(--muted); font-size: .88rem; }
.dock-wait { display: flex; align-items: center; gap: 10px; color: var(--text-soft); }
.dock-wait .pip.on { background: var(--brass); border-color: var(--brass); }
.dock.floor-mine .dock-label { font-size: .86rem; letter-spacing: .06em; }
.order { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.order-seat { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-soft); font-size: .86rem; }
.order-token { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: 600 .72rem var(--font-display); }
.order-seat.done { opacity: .55; }
.order-seat.now { border-color: var(--brass); background: rgba(227, 182, 99, .14); color: var(--brass); font-weight: 700; }
.order-seat.now .order-token { background: var(--brass); border-color: var(--brass); color: var(--on-brass); }
.order-seat.me .order-name { text-decoration: underline; text-underline-offset: 3px; }
.textbox { position: relative; }
.field.text { resize: none; line-height: 1.4; max-height: 9.5em; }
.counter { position: absolute; right: 10px; bottom: 7px; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.counter.over { color: var(--brass); font-weight: 600; }
.field.text.long { padding-bottom: 26px; }
.dock-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.button.choice { min-height: 72px; flex-direction: column; gap: 2px; font-size: 1.2rem; border-width: 2px; }
.button.choice .icon { width: 26px; height: 26px; }
.button.choice .button-sub { font-size: .8rem; font-weight: 500; opacity: .85; }
.button.choice.yes { background: var(--yes-bg); border-color: var(--yes); color: var(--yes); }
.button.choice.no { background: var(--no-bg); border-color: var(--no); color: var(--no); border-radius: 4px 18px 4px 18px; }
.button.choice.yes:hover:not(:disabled) { background: #184636; border-color: var(--yes); }
.button.choice.no:hover:not(:disabled) { background: #4d231d; border-color: var(--no); }
.button.choice.card { min-height: 96px; max-width: 220px; justify-self: center; width: 100%; }
.dock-choices:has(.card) { justify-content: center; }

/* ---- the rules --------------------------------------------------------------------- */

.rules { width: min(680px, calc(100% - 24px)); max-height: min(86dvh, 800px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.rules::backdrop { background: rgba(5, 7, 9, .7); }
.rules-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.rules-head h2 { font: 600 1.4rem var(--font-display); }
.rules-body { padding: 8px 20px 22px; }
.rules-body h3 { margin: 16px 0 6px; font: 600 1.05rem var(--font-display); color: var(--brass); }
.rules-body li { position: relative; padding: 3px 0 3px 16px; color: var(--text-soft); }
.rules-body li::before { content: ""; position: absolute; left: 2px; top: .78em; width: 5px; height: 5px; border-radius: 50%; background: var(--brass-deep); }

/* ---- a wide screen: the table gets the room, so that what is said has somewhere to lie -------- */

@media (min-width: 1200px) {
    .board { grid-template-columns: minmax(560px, 57fr) minmax(360px, 43fr); }
}

/* ---- a phone ----------------------------------------------------------------------- */

@media (max-width: 860px) {
    :root { --token: 42px; }
    /* No room for bubbles at a table this small: the conversation below is the record. */
    .bubbles, .pager { display: none; }
    body { font-size: 15px; }
    .bar { padding: 4px 10px; gap: 10px; }
    .brand-name { display: none; }
    .bar-button-text { display: none; }
    .bar-status { font-size: .9rem; gap: 10px; }
    .board { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; overflow: hidden; }
    .stage { display: contents; }
    .track, .rolecard-slot { flex: none; }
    .track { gap: 8px; flex-wrap: nowrap; }
    .discs { gap: 7px; }
    .disc { width: 34px; height: 34px; font-size: .95rem; }
    .disc .icon { width: 18px; height: 18px; }
    .disc-number { display: none; }
    .rejections-label { display: none; }
    .table { flex: 3 1 230px; min-height: 176px; max-height: 300px; }
    .felt { inset: 20% 21% 22%; box-shadow: 0 0 0 7px var(--rail), 0 0 0 8px var(--rail-light), 0 0 0 9px #17110b, 0 14px 30px rgba(0, 0, 0, .5), inset 0 0 40px rgba(0, 0, 0, .45); }
    .centre { width: 58%; gap: 3px; }
    .centre-title { font-size: .98rem; }
    .centre-small { font-size: .72rem; }
    .chip { font-size: .78rem; padding: 2px 8px; }
    .seat { width: 76px; gap: 1px; }
    .seat-name { font-size: .76rem; }
    .seat-you { font-size: .6rem; }
    .token-letter { font-size: 1.1rem; }
    .mark { width: 20px; height: 20px; }
    .mark.vote { width: 22px; height: 22px; }
    .mark .icon { width: 12px; height: 12px; }
    .flip { width: 28px; height: 40px; }
    .rolecard { padding: 6px 10px; gap: 4px; }
    .rolecard.closed { grid-template-columns: 1fr; }
    .rolecard.closed .rolecard-back { display: none; }
    .rolecard-face { grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; }
    .rolecard-name { font-size: 1.05rem; }
    .rolecard-side { font-size: .85rem; }
    .rolecard-knows { font-size: .84rem; }
    .rolecard-toggle { min-height: 28px; }
    .talk { flex: 2 1 130px; min-height: 56px; }
    .log { padding: 0 12px 12px; }
    .jump { bottom: 8px; padding: 5px 12px; font-size: .85rem; }
    .log-head { margin: 0 -12px; padding: 8px 12px 6px; font-size: .95rem; }
    .round { padding-left: 10px; gap: 6px; }
    .said { grid-template-columns: 24px 1fr; gap: 8px; }
    .said-token { width: 24px; height: 24px; font-size: .75rem; }
    .said.pass .said-token { width: 18px; height: 18px; margin: 2px 3px; }
    .dock { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
    .dock-inner { grid-template-columns: 1fr; gap: 4px; }
    .dock-label { padding-top: 0; font-size: .66rem; }
    .dock-main { gap: 8px; }
    .dock-head { font-size: .95rem; }
    .dock-divider { display: none; }
    .seat-floor { font-size: .58rem; padding: 0 6px; }
    .centre-floor { font-size: .74rem; padding: 1px 8px; }
    .order { gap: 4px; }
    .order-seat:not(.now):not(.me) { padding: 2px 3px; }
    .order-seat:not(.now):not(.me) .order-name { display: none; }
    .order-seat { padding: 2px 7px 2px 3px; font-size: .76rem; gap: 4px; }
    .order-token { width: 18px; height: 18px; font-size: .62rem; }
    .form-option { padding: 8px 10px; }
    .dock-actions .button { flex: 1 1 40%; padding: 7px 10px; min-height: 42px; }
    .dock-hint { font-size: .8rem; }
    .button.choice { min-height: 64px; }
    .button.choice.card { min-height: 76px; }
    .field.text { min-height: 40px; }
    .front-card { padding: 22px 18px; }
    .front-title { font-size: 2.1rem; }
    .front-row .field { max-width: 150px; }
    .reveal-row { grid-template-columns: 24px 1fr; }
    .reveal-row .reveal-role, .reveal-row .reveal-by { grid-column: 2; text-align: left; }
    .reveal-banner { font-size: 1.15rem; padding: 10px; }
}
@media (max-width: 380px) {
    .seat { width: 64px; }
    .discs { gap: 5px; }
    .disc { width: 30px; height: 30px; }
}
@media (min-width: 861px) and (max-height: 760px) {
    :root { --token: 46px; }
    .token-letter { font-size: 1.2rem; }
    .seat-name { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.front-lead.bad { color: #ffd0c6; }
