:root {
  --cream:#f5dcb4; --ink:#352422; --felt:#20372f; --grape:#532d56; --teal:#235354;
  --edge:#976e5c; color-scheme:light;
}
html,body { width:100%; height:100%; margin:0; overflow:hidden; }
body { padding:clamp(4px,1vw,13px); background:#382431 radial-gradient(ellipse at center,#674154,transparent 75%); }
#screen { height:100%; max-width:1600px; }
#screen>.panel {
  height:100%; min-height:0; border:2px solid #8a6058; border-radius:9px;
  background-color:var(--felt);
  background-image:repeating-linear-gradient(114deg,#ffffff04 0 1px,#00000005 1px 3px),radial-gradient(ellipse at top,#496155,transparent 72%);
}
#notice {position:fixed; left:12px; right:12px; bottom:1rem; width:fit-content; max-width:96%; z-index:10; padding:.5rem; background:#fff0d2;border-radius:4px}
#notice:empty {display:none}
button {
  border:2px solid #513531; border-radius:7px; padding:clamp(4px,1.3vh,11px) .66em;
  background:linear-gradient(#f7e1bc,#e5bb88); box-shadow:0 2px #332326; color:var(--ink);
  font-weight:900;
}
button.primary,.camp-button { color:#fff2d3; background:linear-gradient(#74416f,#46244d);border-color:#d1a978;text-shadow:1px 1px #241829}
button.camp-button {background:linear-gradient(#397373,#163d40)}
button:active:enabled {transform:translateY(2px);box-shadow:none}
button.text-button{box-shadow:none;text-decoration:none}
.home .menu,.player-mat,.story figure,.winner figure,.rule-cards article {
  color:var(--ink); background:radial-gradient(ellipse at center,#fae8ca,#e4bf8b);
  border:2px solid #b28a67; border-radius:9px; box-shadow:inset 0 0 0 2px #f7ddba,0 3px #34262390;
}
#screen>.home {display:grid;grid-template-columns:minmax(190px,35%) minmax(0,1fr);gap:clamp(6px,1.4vw,18px); padding:clamp(6px,1.6vw,18px)}
.home .menu {height:100%;min-height:0;display:flex;flex-direction:column;justify-content:center;padding:clamp(8px,2vw,28px);gap:clamp(3px,1vh,10px)}
.home .menu h1 {font-size:clamp(1.75rem,min(5.3vw,11vh),5.6rem);margin:0 0 .15em;transform:none}
.home .menu-scene {height:100%;min-height:0;border-radius:9px;box-shadow:0 3px #34262390}
.home .menu-scene::after{display:none}
.home .menu-art {object-position:50% 44%}
.setup,.story {color:#fff1d7;padding:clamp(7px,1.5vw,22px)}
.setup h1,.story h1 {font-size:clamp(1.25rem,min(4.2vw,7vh),3.8rem);line-height:1.05}
.setup form {height:calc(100% - 62px);display:flex;flex-direction:column;gap:.3rem}
.setup fieldset {margin:.35rem 0;min-height:0;flex:1;display:flex; flex-direction:column}
.setup .cast {min-height:0;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));flex:1;gap:6px}
.setup .villain {min-height:0;grid-template-rows:minmax(0,1fr) auto;font-size:clamp(.61rem,min(2vw,2.8vh),1rem);padding:3px}
.setup .villain img {width:auto;height:100%;max-width:100%;object-fit:contain}
.setup .fields input{width:min(190px,36vw);padding:.24rem}
.setup .fields {font-size:.84rem}
.setup .fields label{gap:2px}
.setup button[data-action="take-seat"] {align-self:center}
.story {display:flex;flex-direction:column;align-items:center;gap:clamp(5px,1.4vh,14px);text-align:center}
.story>p {max-width:640px;font-size:clamp(.74rem,2.6vh,1.04rem)}
.story-cast {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));min-height:0;flex:1;gap:6px;width:min(760px,100%)}
.story figure {display:flex;flex-direction:column;align-items:center;margin:0;min-height:0;min-width:0;padding:3px;font-weight:bold}
.story figure img {min-height:0;height:0;flex:1;width:100%;object-fit:contain}
.story figcaption {font-size:clamp(.62rem,2.4vh,1rem);padding:3px}
.winner-cards {display:flex;justify-content:center;min-height:0;flex:1;width:100%;gap:8px}
.winner-cards figure {width:min(220px,28%)}
.final-scores {display:flex; flex-wrap:wrap; justify-content:center; gap:4px 14px;font-size:clamp(.7rem,2.4vh,1rem)}
.final-scores strong{color:#ffe1a0}
dialog {width:min(830px,94vw);max-width:none;max-height:94dvh;overflow:hidden;background:#233c34;color:#fff1d7;padding:clamp(6px,2vw,18px);text-align:center}
dialog h2{margin-bottom:6px}
.rule-cards {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;margin-bottom:8px}
.rule-cards article {padding:4px;font-size:clamp(.68rem,2.4vh,1rem);line-height:1.2}
.rule-cards img{width:100%;height:clamp(34px,22vh,135px);object-fit:cover;border-radius:4px}
.rule-cards h3{margin:.3rem 0}
#screen>.board {display:grid;grid-template-columns:minmax(130px,25%) minmax(0,1fr);gap:clamp(4px,1vw,13px);padding:clamp(4px,1vw,12px);color:#fae6c2}
.player-mat {display:grid;grid-template-rows:auto minmax(0,1fr) auto auto auto;gap:clamp(3px,1vh,8px);min-height:0;padding:clamp(4px,.85vw,11px);text-align:center}
.game-mark {font-size:clamp(.7rem,min(2.4vw,4vh),1.8rem);line-height:1;font-weight:900;text-transform:uppercase;color:#482947}
.game-mark small{font-size:.57em}
.hero-villain {width:100%;height:100%;min-height:0;object-fit:contain;mix-blend-mode:multiply}
.hero-name { display:grid;background:#ecd0a5;border:1px solid #986e60;border-radius:5px;padding:2px;font-size:clamp(.66rem,min(2.3vw,3vh),1.18rem);line-height:1.1 }
.hero-name small {color:#6c3c61}
.player-gold {display:grid;gap:4px;margin:0;font-size:clamp(.7rem,min(2.2vw,3vh),1.12rem)}
.player-gold div {display:flex;justify-content:space-between;align-items:center;padding:3px 7px;border:1px solid #ad805f;border-radius:4px;background:#f6dfb9}
.player-gold dd {margin:0;font-size:1.25em;font-weight:bold;color:#472e3c}
.mat-actions {display:grid;gap:4px;min-width:0;font-size:clamp(.65rem,min(2.3vw,3vh),1.14rem)}
.mat-actions button {text-transform:uppercase;line-height:1.05}
.play-area {display:grid;grid-template-rows:auto minmax(0,1fr) auto minmax(0,1.4fr);gap:clamp(3px,1vh,8px);min-width:0;min-height:0}
.board-heading {display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:5px;text-align:center}
.board-heading h1,.board-heading>span {color:#3a2729;background:#edcea3;border:1px solid #a77d5d;border-radius:5px;padding:3px;line-height:1.1}
.board-heading h1 {font-size:clamp(.83rem,min(3.6vw,5.5vh),2.5rem);text-transform:uppercase}
.board-heading>span {font-size:clamp(.58rem,1.8vw,.94rem);font-weight:bold}
.board-heading button {color:#fff0cf;padding:.1rem .26rem}
.tabletop {min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);border:0;box-shadow:none;background:none;overflow:visible}
.tabletop-top {height:clamp(18px,4vh,32px);padding:0 1px;font-size:clamp(.62rem,2.2vh,.95rem)}
.tabletop-top nav {display:flex;align-items:center;gap:5px}
.tabletop-top nav button {font-size:1em;padding:0 .42em;line-height:1.05}
.deck-back {width:14px;height:18px}
.trail {grid-template-columns:repeat(5,minmax(0,1fr));margin:0;padding:3px 2px;min-height:0;--gap:clamp(3px,1vw,12px)}
.tile-face {min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto auto; border:2px solid #d9b681; border-radius:5px}
.tile-face>img {width:100%;height:100%;min-height:0;object-fit:cover}
.tile-face>strong {font-size:clamp(.53rem,min(1.6vw,2.7vh),1.02rem);padding:2px;line-height:1.06}
.tile-face>small {font-size:clamp(.49rem,min(1.2vw,2vh),.73rem);padding:1px 2px}
.tile.tip .tile-face {outline-offset:0}
.loose {top:1px;right:1px;font-size:clamp(.53rem,1.7vh,.75rem)}
.board-status {color:#392823;background:#efd1a2;border-radius:5px;text-align:center;padding:3px 5px;font-size:clamp(.61rem,min(1.65vw,2.55vh),.97rem);line-height:1.15;}
.decisions {min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr);gap:3px}
.decisions h2 {text-align:center;font-size:clamp(.74rem,min(2.4vw,3.4vh),1.33rem);font-style:italic}
.decision-spread {display:grid;grid-template-columns:1.2fr repeat(calc(var(--seats) - 1),minmax(0,1fr));gap:clamp(3px,.85vw,10px);min-height:0}
.action-card {min-height:0;min-width:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;text-align:center;background:#efd4a6;color:#352422;border:2px solid #ecc79a;border-radius:7px;overflow:hidden;box-shadow:0 3px #161a19;font-size:clamp(.54rem,min(1.65vw,2.6vh),1.05rem)}
.action-card header,.action-card strong {display:block;padding:2px;overflow-wrap:anywhere;font-weight:900;line-height:1.06}
.action-card header {background:#69374f;color:#fff0d2}
.action-card strong {color:#fff1d1;background:#73384f;text-transform:uppercase}
.action-card.return strong {background:#225252}
.action-card img {min-height:0;width:100%;height:100%;object-fit:cover;object-position:center 43%}
.action-card small {font-size:.86em;padding:2px}
.action-card.featured {border-color:#ffdd89;box-shadow:0 0 0 1px #fbd48b,0 3px #161a19}
.face-down img {filter:saturate(.63);object-position:center}
.reveal-card {animation:turn-card 520ms ease-out both;position:relative}
.turn-reveal .flip-tile {animation:place-tile 280ms 290ms ease-out both}
.turn-reveal .tile.tip .pawns {animation:land-pawns 210ms 430ms ease-out both}
@keyframes turn-card {
  0%{transform:perspective(540px) rotateY(-35deg);filter:brightness(.35)}
  43%{transform:perspective(540px) rotateY(-88deg);filter:brightness(.55)}
  55%{transform:perspective(540px) rotateY(68deg);filter:brightness(1.16)}
  100%{transform:none;filter:none}
}
@keyframes land-pawns{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}
@media(max-width:600px) and (orientation:portrait) {
  #screen>.board {grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr)}
  .player-mat {grid-template-columns:38px minmax(0,1fr) auto;grid-template-rows:auto auto;align-items:center;padding:4px}
  .game-mark {display:none}
  .hero-villain{grid-row:1/3;height:40px;width:38px}
  .player-gold{grid-column:3;grid-row:1/3;gap:1px}
  .hero-name{grid-column:2;grid-row:1}
  .mat-actions{display:flex;grid-column:2;grid-row:2;justify-content:center;gap:3px}
  .mat-actions button{padding:3px;font-size:.59rem}
  .play-area{grid-template-rows:auto minmax(0,1fr) auto minmax(0,1.18fr)}
  .action-card{font-size:clamp(.57rem,2.35vw,.84rem)}
  .tile-face>strong{font-size:clamp(.51rem,2.2vw,.76rem)}
  #screen>.home{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) auto}
  .home .menu{grid-row:2}
  .home .menu-scene{grid-row:1}
  .rule-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rule-cards img{height:clamp(30px,13vh,100px)}
}
.reveal-card::after {
  content:"✦"; position:absolute; inset:0; display:grid; place-items:center;
  color:#f9d784; font-size:clamp(1.3rem,6vh,3rem); border:4px double #edc481;
  background:repeating-linear-gradient(45deg,#633d63 0 6px,#573351 6px 12px);
  animation:card-back 520ms step-end both; pointer-events:none;
}
@keyframes card-back{0%{visibility:visible}50%,100%{visibility:hidden}}
@media(prefers-reduced-motion:reduce){.reveal-card::after{display:none}}
.story .text-button,.setup .text-button {color:#ffe8c2;text-decoration:underline}
.board-heading h1,.board-heading>span,.player-gold div,.hero-name,.board-status {
  background-image:repeating-linear-gradient(107deg,#ab755407 0 1px,#fff1ca16 1px 3px),linear-gradient(#f5dfba,#e9c496);
  box-shadow:inset 0 0 0 1px #f4dfb8;
}
.action-card {border:3px solid #e9c393;box-shadow:inset 0 0 0 1px #8b5d48,0 3px #19191a}
.action-card.featured {transform:rotate(-1.4deg);position:relative;z-index:1}
.action-card.return header {background:#295c59}
.action-card.face-down header {background:#54384f}
.tile-face {box-shadow:inset 0 0 0 1px #764e43,0 3px 5px #191f1c}
.slide-in {animation:land-pawns 210ms 420ms ease-out both}

/* Reserve a real footer row for Enter Camp at every player height. */
#screen>.setup {display:flex;flex-direction:column;gap:clamp(3px,1vh,9px)}
.setup>[data-action="home"]{align-self:flex-start;padding:0 4px}
.setup h1{margin:0}
.setup form{flex:1;height:auto;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:clamp(3px,1vh,9px)}
.setup .cast-field{display:grid;grid-template-rows:auto minmax(0,1fr);min-height:0;gap:4px}
.setup .cast-field h2{font-size:clamp(.72rem,3vh,1.25rem)}
.setup .cast-field small{font-size:.75em;font-weight:normal;margin-left:.35rem}
.setup .fields input{color:#352422}
.setup button[data-action="take-seat"]{justify-self:center;align-self:end}
.action-card.loss{background:#f2c2af;border-color:#dd9277}
.action-card.loss header,.action-card.loss strong{background:#7e352f}
.final-scores{display:grid;width:min(480px,100%);gap:3px;list-style:none;margin:0;padding:0}
.final-scores li{display:grid;grid-template-columns:2em auto minmax(0,1fr) auto;align-items:center;text-align:left;gap:.45em;background:#eed4ae;color:#392823;border:1px solid #a7805b;border-radius:5px;padding:2px 6px}
.final-scores img{height:clamp(15px,4.2vh,32px);width:clamp(15px,4.2vh,32px);object-fit:cover;border-radius:3px}
.final-scores small{margin-left:.45em;font-size:.72em}
.final-scores strong{color:#603725;white-space:nowrap}
.placement{font-weight:bold;text-align:center;color:#573052}
