/* Content-sized layout: no absolute seat coordinates or fixed seat heights. */
* { box-sizing: border-box; }
:root { color-scheme: dark; font-family: "Courier New", monospace; color: #fff; background: #000; }
body { margin: 0; min-width: 0; line-height: 1.45; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: #fff; background: #000; border: 1px solid #fff; border-radius: 0; padding: .65rem; min-width: 0; max-width: 100%; }
button { min-height: 44px; cursor: pointer; overflow-wrap: anywhere; transition: transform 150ms ease-out, opacity 150ms ease-out; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid red; outline-offset: 3px; }
input { accent-color: red; }
input[type=number], select { font-size: 1rem; }
header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: 1rem clamp(.75rem, 4vw, 3rem); border-bottom: 1px solid #fff; }
header > a { white-space: nowrap; }
header > span { flex: 1 1 7rem; min-width: 0; overflow-wrap: anywhere; }
header button { border: 0; font-size: .8rem; }
main { width: 100%; max-width: 1500px; margin: auto; padding: clamp(.75rem, 3vw, 2.5rem); padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
#setup { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.5rem; }
#setup > *, .config > *, .bar > * { min-width: 0; }
.eyebrow { grid-column: 1 / -1; font-size: .75rem; }
h1 { font-size: clamp(2rem, 10vw, 7.5rem); overflow-wrap: anywhere; line-height: 1.05; letter-spacing: -.04em; margin: 1rem 0; }
em { font-style: normal; color: red; }
.config { display: flex; flex-direction: column; gap: 1rem; padding-top: 1.5rem; }
.human { display: flex; align-items: center; gap: .75rem; min-height: 44px; }
.human input { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
.bot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(8rem, 12rem) 44px; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.bot > span { overflow-wrap: anywhere; }
.bot select { width: 100%; }
.bot button { border: 0; }
.small { font-size: .75rem; line-height: 1.6; overflow-wrap: anywhere; }
.primary { background: red; border-color: red; color: #fff; padding: .8rem 1rem; font-weight: bold; }
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; font-size: .8rem; overflow-wrap: anywhere; }
#table { display: flex; flex-direction: column; gap: 1rem; min-width: 0; border: 1px dashed #fff; padding: clamp(.5rem, 1.5vw, 1rem); margin: 1rem 0; }
.seat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; min-width: 0; align-items: stretch; }
#seats.solo { grid-template-columns: minmax(0, 1fr); max-width: 19rem; width: 100%; align-self: center; }
#humanseat { grid-template-columns: minmax(0, 1fr); max-width: 22rem; width: 100%; align-self: center; }
#humanseat:empty { display: none; }
.seat { position: static; width: auto; min-width: 0; max-width: 100%; text-align: center; padding: .65rem .4rem; background: #000; border: 1px solid #fff; overflow-wrap: anywhere; }
.seat.active { border-color: red; box-shadow: inset 0 0 0 1px red; }
.seat.out { opacity: .45; }
.name { font-size: .8rem; line-height: 1.5; }
.chips { font-size: clamp(1rem, 2.2vw, 1.5rem); font-variant-numeric: tabular-nums; margin: .3rem 0; }
.tag { font-size: .7rem; line-height: 1.6; }
.center { position: static; transform: none; width: 100%; min-width: 0; text-align: center; padding: .75rem 0; }
#pot { font-size: clamp(1.1rem, 3vw, 1.6rem); overflow-wrap: anywhere; }
.cards { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: .4rem; padding: .65rem 0; min-width: 0; }
.card { flex: 0 0 auto; display: block; white-space: pre; font-family: "Courier New", monospace; font-size: clamp(.68rem, 1.45vw, .95rem); line-height: 1.1; }
.seat .card { font-size: clamp(.65rem, 1.15vw, .8rem); }
.red { color: red; }
#outcome { font-size: .75rem; margin-top: .5rem; overflow-wrap: anywhere; line-height: 1.6; }
#actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem; min-width: 0; }
#actions > button { flex: 1 1 7rem; }
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1rem; font-size: .8rem; overflow-wrap: anywhere; }
#stats { min-width: 0; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #fff; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .8rem; }
th, td { padding: .65rem .4rem; text-align: left; border-bottom: 1px dashed #fff; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
#stats > button { margin-top: 1rem; }
dialog { color: #fff; background: #000; border: 1px solid #fff; width: min(48rem, calc(100% - 1.5rem)); max-width: calc(100% - 1.5rem); max-height: calc(100dvh - 1.5rem); overflow: auto; padding: clamp(.75rem, 3vw, 1.5rem); }
dialog::backdrop { background: rgb(0 0 0 / 85%); }
#logbody { min-width: 0; margin-top: 1rem; font-size: .8rem; line-height: 1.7; overflow-wrap: anywhere; }
#logbody button { margin: .3rem .3rem .3rem 0; }
#logbody pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
details { padding: .75rem 0; border-bottom: 1px dashed #fff; }
summary { cursor: pointer; min-height: 44px; padding: .5rem 0; overflow-wrap: anywhere; }
#error, #settingserror { color: red; min-height: 1.5em; overflow-wrap: anywhere; }
@media (max-width: 750px) {
 #setup { grid-template-columns: minmax(0, 1fr); }
 .config { padding-top: 0; }
 .seat-grid { display: flex; flex-wrap: wrap; }
 .seat-grid > .seat { flex: 1 1 calc((100% - .65rem) / 2); min-width: min(8rem, 100%); }
}
@media (max-width: 480px) {
 header { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .5rem; }
 header > span { text-align: right; }
 header button { width: 100%; padding: .5rem .25rem; font-size: .75rem; }
 .bot { grid-template-columns: minmax(0, 1fr) 44px; }
 .bot select { grid-column: 1 / -1; grid-row: 2; }
 .bot button { grid-column: 2; grid-row: 1; }
 .seat-grid { gap: .5rem; }
 #actions > button { flex-basis: calc(50% - .5rem); }
 table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
 table, tbody { display: block; }
 tbody { display: grid; gap: .75rem; }
 tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #fff; padding: .4rem; gap: .25rem .75rem; }
 td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem; border: 0; padding: .35rem; }
 td:first-child { grid-column: 1 / -1; border-bottom: 1px dashed #fff; }
 td::before { content: attr(data-label); font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Keep controls out of display cutouts when viewport-fit=cover is active. */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
header { padding-top: max(1rem, env(safe-area-inset-top)); }
dialog { padding-left: max(clamp(.75rem, 3vw, 1.5rem), env(safe-area-inset-left)); padding-right: max(clamp(.75rem, 3vw, 1.5rem), env(safe-area-inset-right)); }

#seats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 36rem; width: 100%; align-self: center; }
