/* The game table. Layout rule: sections keep their size while the game runs,
   so nothing jumps as cards come and go. Phones stack and scroll. */
body.game { min-height: 100dvh; background: radial-gradient(120% 80% at 50% 0%, #26302a 0%, #1b211d 45%, var(--ink) 100%) fixed; }
.table { max-width: 1240px; margin: 0 auto; padding: 12px clamp(10px, 2.4vw, 24px) 28px; display: grid; gap: 14px;
  grid-template-columns: 1fr; grid-template-areas: "hud" "seats" "horde" "me"; }

/* hud: round, dawn clock, loot left */
.hud { grid-area: hud; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.hud .round { font-family: var(--display); font-size: 22px; letter-spacing: .04em; text-transform: uppercase; color: var(--bone); }
.hud .clock { display: flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; }
.hud .clock .ic { width: 22px; height: 22px; color: var(--loot); }
.hud .clock b, .hud .lootleft b { color: var(--bone); }
.hud .meter { flex: 1; height: 8px; border-radius: 4px; background: var(--ink-3); overflow: hidden; min-width: 60px; }
.hud .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--loot), #f3c34d); transition: width .5s; }
.hud .lootleft { display: flex; align-items: center; gap: 6px; }
.hud .lootleft .ic { width: 18px; height: 18px; color: var(--loot); }

/* opponents */
.seats { grid-area: seats; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.seats:empty { display: none; }
.seat { min-width: 0; position: relative; background: rgba(242,237,228,.06); border: 2px solid var(--line); border-radius: var(--radius); padding: 10px;
  display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto 1fr; column-gap: 10px; row-gap: 4px; min-height: 128px; transition: border-color .2s, background .2s, box-shadow .2s; }
.seat .portrait { grid-row: 1 / 3; }
.portrait { width: 52px; height: 52px; border-radius: 50%; background: var(--bone); border: 2px solid var(--bone); object-fit: cover; display: block; }
.seat .s-name, .seat .s-meta, .seat .s-play { min-width: 0; }
.seat .s-name { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; row-gap: 4px; }   /* FIRST and TARGET wrap rather than clip */
.seat .s-name span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord { font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; flex: none; }
.targetchip { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--zombie); color: var(--bone); border-radius: 6px; padding: 2px 6px; flex: none; }
.targetchip .ic { width: 12px; height: 12px; }
.firstchip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--loot); color: var(--ink); border-radius: 6px; padding: 2px 6px; flex: none; }
.seat .s-meta, .me-head .s-meta { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.s-meta .st { display: inline-flex; align-items: center; gap: 3px; color: var(--bone); font-weight: 700; font-size: 15px; }
.st .ic { color: var(--loot); }
.s-meta .st .ic { width: 15px; height: 15px; }
.gear { display: inline-flex; gap: 4px; }
.gear span { font-size: 11px; font-weight: 700; background: var(--ink-3); color: var(--bone); border-radius: 5px; padding: 2px 5px; }
.seat .s-play { grid-column: 1 / 3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 34px; align-self: end; }
.seat .s-flag { position: absolute; top: -11px; right: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; display: none; }
.seat.has-flag .s-flag { display: block; }
.seat.is-turn { border-color: var(--bone); background: rgba(242,237,228,.1); }
.seat.is-target { border-color: var(--danger-bright); box-shadow: 0 0 0 3px rgba(229,72,61,.35); }
.seat.is-zombie { background: rgba(63,122,31,.18); border-color: #355f22; }
.seat.is-zombie .portrait { border-color: var(--slime); }
.seat.pickable { cursor: pointer; border-color: var(--slime); box-shadow: 0 0 0 3px rgba(121,192,67,.35); }
.seat.pickable:hover { background: rgba(121,192,67,.15); }
.flag-target { background: var(--danger); color: #fff; }
.flag-found { background: var(--danger-bright); color: #fff; }
.flag-hidden { background: var(--survivor); color: #fff; }
.flag-bitten { background: var(--zombie); color: #fff; }
.flag-loot { background: var(--loot); color: var(--ink); }
.flag-hunted { background: var(--zombie); color: #fff; }
.thinking { color: var(--muted); font-size: 14px; }

/* the cards each player put down */
.s-cards { display: flex; gap: 6px; --cw: 62px; }
.s-cards.deal .card { animation: dealIn .3s ease both; }
.seat .s-play { min-height: 88px; }
.noisepill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 15px; background: var(--noise); color: #fff; }
.noisepill .ic { width: 16px; height: 16px; }
.noisepill .ic { transform: translateY(-.25px); }
.noisepill b { display: inline-block; transform: translateY(.055em); }   /* the speaker and the number both on the pill's centre line */

/* the horde: this round's zombie cards, and fights */
.horde { grid-area: horde; background: rgba(63,122,31,.12); border: 2px dashed #3d5a2c; border-radius: var(--radius); padding: 12px; min-height: 196px;
  display: grid; grid-template-columns: 1fr; gap: 10px; align-content: start; }
.horde-head { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); min-height: 26px; }
.horde-head .ic { width: 20px; height: 20px; color: var(--slime); }
.horde-head strong { color: var(--bone); font-family: var(--display); font-weight: 400; letter-spacing: .05em; text-transform: uppercase; font-size: 18px; }
.horde-cards { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; min-height: 132px; }
.hc { display: flex; flex-direction: column; align-items: center; gap: 4px; --cw: 92px; }
.hc .owner { font-size: 13px; color: var(--muted); max-width: 92px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc .card { transition: transform .35s; }
.hc.flip .card { animation: flip .45s ease; }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.hc.enter .card { animation: dealIn .35s ease; }
@keyframes dealIn { from { transform: translateY(-14px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.stage-msg { font-size: 17px; color: var(--bone); min-height: 25px; }
.stage-msg b { color: #f3c34d; }

.fight { display: grid; gap: 8px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 10px 12px; }
.fight[hidden] { display: none; }
.fight .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fight .who { width: 120px; flex: none; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.fight .who .ic { width: 18px; height: 18px; }
.fight .row .card { --cw: 60px; }
.fight .row.deal .card { animation: dealIn .3s ease both; }
.fight .row .card.top { outline: 3px solid #f3c34d; outline-offset: 2px; }
.fight .verdict { font-weight: 700; font-size: 17px; }

/* loot found this round, side by side */
.finds { display: flex; flex-wrap: wrap; gap: 10px; }
.finds:empty { display: none; }
.find { display: grid; gap: 6px; background: rgba(217,162,27,.12); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.find .who { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.find .who .ic { width: 18px; height: 18px; color: var(--loot); flex: none; }
.find .f-cards { display: flex; gap: 6px; flex-wrap: wrap; }
.find .card { --cw: 66px; }
.find.deal .card { animation: dealIn .35s ease both; }

/* you */
.me { grid-area: me; background: rgba(30,111,217,.10); border: 2px solid #284b74; border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.me.is-zombie { background: rgba(63,122,31,.16); border-color: #355f22; }
.me.is-target { border-color: var(--danger-bright); }
.me-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.me-head .portrait { width: 48px; height: 48px; cursor: pointer; }
.me-head .who { display: flex; flex-direction: column; }
.me-head .who b { font-size: 18px; }
.me-head .myflag { margin-left: auto; }
.prompt { margin: 0; font-size: 18px; font-weight: 700; min-height: 26px; }
.prompt .sub { display: block; font-weight: 400; font-size: 16px; color: var(--muted); margin-top: 2px; }
.preview { margin: 0; font-size: 16px; min-height: 48px; color: var(--bone); }
.preview .verdict { display: block; font-weight: 700; margin-top: 2px; }
.preview .bad { color: #ff8a80; } .preview .good { color: #8fdc8a; } .preview .meh { color: #f3c34d; }
.hand { display: flex; gap: 12px; flex-wrap: nowrap; min-height: 230px; padding-top: 16px; padding-bottom: 18px; align-items: flex-end; --cw: 150px; }
.hand .slot { position: relative; transition: transform .15s; }
.hand .slot.selectable { cursor: pointer; }
.hand .slot.selectable:hover { transform: translateY(-4px); }
.hand .slot.selected { transform: translateY(-12px); }
.hand .slot.selected .card { outline: 4px solid #f3c34d; outline-offset: 2px; }
.hand .slot .pick { position: absolute; top: -10px; right: -8px; width: 28px; height: 28px; border-radius: 50%; background: #f3c34d; color: var(--ink); font-weight: 700;
  display: none; align-items: center; justify-content: center; font-size: 15px; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.hand .slot.selected .pick { display: flex; }
.hand .slot.new::after { content: 'NEW'; position: absolute; top: -10px; left: -6px; background: var(--survivor); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; }
.hand .slot.dim { opacity: .45; }
.hand .slot.forced .pick { background: var(--noise); color: #fff; }
.hand .slot.forced::before { content: 'MUST PLAY'; position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); z-index: 2; white-space: nowrap; background: var(--noise); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; }
.hand .slot.forced.selected .card { outline-color: var(--noise); }
/* three cards down (2 + a burden): they overlap a little to fit the seat */
.s-cards:has(.card:nth-child(3)) { --cw: 46px; gap: 4px; }
.s-cards:has(.card:nth-child(4)) { --cw: 34px; gap: 3px; }
.s-cards .card { box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.hand .empty { color: var(--muted); font-size: 16px; align-self: center; }
.hand button.slot { all: unset; position: relative; cursor: pointer; border-radius: 10px; }
.hand button.slot:focus-visible { outline: 3px solid var(--loot); outline-offset: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-height: var(--tap); }
.actions .spacer { flex: 1; }
.skipbtn { margin-left: auto; }

/* toast-ish narration line under the hud */
.narrate { grid-area: auto; }

/* game over */
.over { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10,9,8,.78); }
.over[hidden] { display: none; }
.over .box { background: var(--bone); color: var(--ink); border-radius: 18px; padding: 22px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.over h2 { font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.05; text-transform: uppercase; margin: 0 0 6px; }
.over p { margin: 0 0 14px; font-size: 18px; }
.standings { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.standings li { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 8px 10px; }
.standings .portrait { width: 40px; height: 40px; border-color: #cfc6b8; }
.standings .nm { font-weight: 700; flex: 1; }
.standings .res { font-size: 15px; color: var(--muted-dark); }
.standings .st { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--ink); }
.standings .st .ic { width: 16px; height: 16px; }
.standings li.win { box-shadow: inset 0 0 0 3px var(--loot); }

/* new game dialog */
.counts { display: flex; gap: 8px; flex-wrap: wrap; }
.counts label { position: relative; }
.counts input { position: absolute; opacity: 0; pointer-events: none; }
.counts span { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 12px; border: 2px solid #cfc6b8; font-weight: 700; font-size: 20px; cursor: pointer; background: #fff; }
.counts input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bone); }
.counts input:focus-visible + span { outline: 3px solid var(--loot); outline-offset: 2px; }
.faces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.faces label { position: relative; cursor: pointer; text-align: center; font-size: 13px; font-weight: 700; }
.faces input { position: absolute; opacity: 0; pointer-events: none; }
.faces img { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; background: #fff; display: block; margin-bottom: 3px; }
.faces input:checked + img { border-color: var(--ink); }
.faces input:focus-visible + img { outline: 3px solid var(--loot); outline-offset: 2px; }
.hint-note { font-size: 15px; color: var(--muted-dark); }
.deckgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; --cw: 100%; }
.deckgrid figure { margin: 0; }
.deckgrid figcaption { font-size: 14px; font-weight: 700; text-align: center; margin-top: 4px; }
.loglist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 16px; }
.loglist .r { font-family: var(--display); font-size: 18px; letter-spacing: .04em; text-transform: uppercase; margin-top: 10px; }

/* wider screens: seats on the right, the horde and your hand on the left */
@media (min-width: 1100px) {
  .table { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "hud hud" "horde seats" "me seats"; align-items: start; }
  .seats { grid-template-columns: 1fr; align-content: start; }
  /* in the side column the cards sit beside the name, so a seat doesn't grow when they land */
  .seat { grid-template-columns: 52px minmax(0, 1fr) 146px; }
  .seat .s-play { grid-column: 3; grid-row: 1 / 4; flex-direction: column; justify-content: center; align-self: center; gap: 6px; min-height: 0; }
}
@media (max-width: 720px) {
  .hand { --cw: calc((100vw - 2 * clamp(10px, 2.4vw, 24px) - 24px - 3 * 8px) / 4); gap: 8px; min-height: 0; }
  .hand .slot.selected { transform: translateY(-6px); }
  .seats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .seat { grid-template-columns: 40px 1fr; padding: 8px; min-height: 112px; }
  .seat .portrait { width: 40px; height: 40px; }
  .seat .s-name { font-size: 16px; }
  .s-cards { --cw: 52px; gap: 5px; }
  .s-cards:has(.card:nth-child(3)) { --cw: 47px; gap: 4px; }
  .s-cards:has(.card:nth-child(4)) { --cw: 36px; gap: 3px; }
  .seat .s-play { min-height: 74px; gap: 5px; }
  .fight .row .card { --cw: 50px; }
  .find .card { --cw: 56px; }
  .hc { --cw: 74px; } .hc .owner { max-width: 74px; }
  .horde-cards { min-height: 110px; gap: 8px; }
  .horde { min-height: 170px; }
  .prompt { font-size: 17px; }
  .faces { grid-template-columns: repeat(3, 1fr); }
  .fight .who { width: 100%; }
}
