/* Compact, desktop-first play surface for the Field Notes itch edition. */
@media (min-width:800px) and (min-height:500px){
  html[data-kortzale-look=handwritten] body{display:block!important;min-height:100dvh!important;height:100dvh!important;padding-top:58px!important;overflow:hidden!important}
  html[data-kortzale-look=handwritten] body>main,
  html[data-kortzale-look=handwritten] body>#app{
    box-sizing:border-box!important;
    width:min(1100px,calc(100vw - 36px))!important;
    max-width:var(--field-stage-width)!important;
    height:calc(100dvh - 58px)!important;
    min-height:0!important;
    max-height:calc(100dvh - 58px)!important;
    margin:0 auto!important;
    padding:15px 20px 15px 31px!important;
    overflow:hidden!important;
    box-shadow:4px 5px 0 #6c7b7055!important;
  }
  html[data-kortzale-look=handwritten] body>main:before,
  html[data-kortzale-look=handwritten] body>#app:before{display:none!important}
  html[data-kortzale-game=silt] body>.game{width:min(540px,calc(100vw - 36px))!important}
  html[data-kortzale-game=repeal] body>#app{width:min(720px,calc(100vw - 36px))!important}
  html[data-kortzale-look=handwritten][data-kortzale-game=doorman] body>#app,
  html[data-kortzale-look=handwritten][data-kortzale-game=quarry] body>#app{width:min(1000px,calc(100vw - 36px))!important;max-width:1000px!important}

  /* The two portrait games keep their stacked play loop, with shorter cards. */
  html[data-kortzale-game=silt] .game{gap:7px!important;padding-top:12px!important;padding-bottom:10px!important}
  html[data-kortzale-game=repeal] #app{gap:6px!important}
  html[data-kortzale-game=repeal] #monster{min-height:200px!important}
  html[data-kortzale-game=repeal] #log{height:70px!important;padding:6px 10px!important}
  html[data-kortzale-game=repeal] #hand{min-height:75px!important}
  html[data-kortzale-game=repeal] .card{height:70px!important}
  html[data-kortzale-game=repeal] #actions button{min-height:44px!important;padding:7px!important}

  /* Investigation games: evidence and decisions sit beside the board. */
  html[data-kortzale-game=doorman] #app,
  html[data-kortzale-game=quarry] #app{display:grid!important;grid-template-columns:minmax(250px,.8fr) minmax(0,1.2fr);gap:7px 16px!important;align-content:start}
  html[data-kortzale-game=doorman] #app>header,
  html[data-kortzale-game=quarry] #app>header{grid-column:1/-1}
  html[data-kortzale-game=doorman] #app>.threshold{grid-column:1;grid-row:2}
  html[data-kortzale-game=doorman] #app>.phase-row{grid-column:1;grid-row:3}
  html[data-kortzale-game=doorman] #app>#legacyNotice{grid-column:1;grid-row:4}
  html[data-kortzale-game=doorman] #app>#evidence{grid-column:1;grid-row:5}
  html[data-kortzale-game=doorman] #app>#announcement{grid-column:1;grid-row:6}
  html[data-kortzale-game=doorman] #app>#probeZone,
  html[data-kortzale-game=doorman] #app>#predictionZone{grid-column:2;grid-row:2/7;align-self:start}
  html[data-kortzale-game=quarry] #app>.scan-row{grid-column:1;grid-row:2}
  html[data-kortzale-game=quarry] #app>#trail{grid-column:1;grid-row:3}
  html[data-kortzale-game=quarry] #app>#announcement{grid-column:1;grid-row:4}
  html[data-kortzale-game=quarry] #app>#questionZone,
  html[data-kortzale-game=quarry] #app>#claimZone{grid-column:1;grid-row:5}
  html[data-kortzale-game=quarry] #app>#board{grid-column:2;grid-row:2/6;align-self:start}

  /* The wharf uses the wide screen for a river and a separate boat hand. */
  html[data-kortzale-game=wake] body>main{display:grid!important;grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr);grid-template-rows:auto auto auto auto 1fr;gap:6px 15px!important;align-content:start}
  html[data-kortzale-game=wake] main>header,
  html[data-kortzale-game=wake] main>.scorebar{grid-column:1/-1;margin:0!important}
  html[data-kortzale-game=wake] main>.river{grid-column:1;grid-row:3/6;align-self:start;padding:8px!important}
  html[data-kortzale-game=wake] main>#handZone{grid-column:2;grid-row:3;align-self:start}
  html[data-kortzale-game=wake] main>#announcement{grid-column:2;grid-row:4;margin:0!important}
  html[data-kortzale-game=wake] main>#seasonZone,
  html[data-kortzale-game=wake] main>#ending{grid-column:2;grid-row:5;align-self:start}
  html[data-kortzale-game=wake] main>.river .horizon{height:28px!important}
  html[data-kortzale-game=wake] main>.river .board{gap:6px!important}
  html[data-kortzale-game=wake] main>.river .mooring{height:59px!important;min-height:59px!important;padding:10px 2px 4px!important;border-bottom-width:5px!important}
  html[data-kortzale-game=wake] main>.river .boat-art{height:20px!important}
  html[data-kortzale-game=wake] main>.river .flow{margin-top:4px!important}

  /* Markets and gardens gain a side ledger instead of a long vertical stack. */
  html[data-kortzale-game=carry] body>main,
  html[data-kortzale-game=heaviest] body>main,
  html[data-kortzale-game=cairn] body>main,
  html[data-kortzale-game=assay] body>main,
  html[data-kortzale-game=widening] body>main,
  html[data-kortzale-game=tending] body>main{display:grid!important;grid-template-columns:minmax(270px,.42fr) minmax(0,.58fr);gap:5px 16px!important;align-content:start}
  html[data-kortzale-game=carry] main>header,
  html[data-kortzale-game=heaviest] main>header,
  html[data-kortzale-game=cairn] main>header,
  html[data-kortzale-game=assay] main>header,
  html[data-kortzale-game=widening] main>header,
  html[data-kortzale-game=tending] main>header{grid-column:1/-1;margin:0!important}
  html[data-kortzale-game=carry] main>.camp{grid-column:1;grid-row:2/4;margin:0!important}
  html[data-kortzale-game=carry] main>.camp .sky{height:45px!important}
  html[data-kortzale-game=carry] main>.tally{grid-column:1;grid-row:4;padding:5px 0!important}
  html[data-kortzale-game=carry] main>.route{grid-column:1;grid-row:5;margin:0!important}
  html[data-kortzale-game=carry] main>.contract-heading{grid-column:2;grid-row:2;margin:0!important}
  html[data-kortzale-game=carry] main>.contracts{grid-column:2;grid-row:3/7;gap:6px!important;align-self:start}
  html[data-kortzale-game=carry] main>.contracts .contract{min-height:98px!important}
  html[data-kortzale-game=carry] main>.contracts .contract-details{flex-direction:row!important;justify-content:space-between;gap:4px!important}
  html[data-kortzale-game=carry] main>.contracts .contract-value strong{font-size:18px!important}
  html[data-kortzale-game=carry] main>.signed{grid-column:1;grid-row:6;padding:4px 0!important}
  html[data-kortzale-game=carry] main>#announcement{grid-column:1;grid-row:7;margin:0!important}
  html[data-kortzale-game=carry] main>#passBtn{grid-column:1;grid-row:8}
  html[data-kortzale-game=carry] main>footer{grid-column:2;grid-row:7/9;margin:0!important;align-self:end}

  html[data-kortzale-game=heaviest] main>header .switches{flex-direction:row!important}
  html[data-kortzale-game=heaviest] main>header h1{margin:2px 0 0!important;font-size:30px!important}
  html[data-kortzale-game=heaviest] main>.arcade{grid-column:1;grid-row:2/4;align-self:start}
  html[data-kortzale-game=heaviest] main>.arcade .arches{height:24px!important;margin:0 0 5px!important}
  html[data-kortzale-game=heaviest] main>.arcade .purse{padding:7px!important}
  html[data-kortzale-game=heaviest] main>.arcade .purse strong{font-size:23px!important}
  html[data-kortzale-game=heaviest] main>.turnbar{grid-column:1;grid-row:4;margin:0!important;padding:5px 0!important}
  html[data-kortzale-game=heaviest] main>.market{grid-column:2;grid-row:2/7;align-self:start;display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px!important}
  html[data-kortzale-game=heaviest] main>.market .stall{min-width:0;margin:0!important}
  html[data-kortzale-game=heaviest] main>.market .stall h2{font-size:16px!important;margin:0 0 4px!important}
  html[data-kortzale-game=heaviest] main>.market .goods{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px!important}
  html[data-kortzale-game=heaviest] main>.market .good{min-height:86px!important;padding:5px 3px!important;gap:1px!important}
  html[data-kortzale-game=heaviest] main>.market .good-icon{height:18px!important}
  html[data-kortzale-game=heaviest] main>.market .good-name{font-size:13px!important}
  html[data-kortzale-game=heaviest] main>.market .good-price,
  html[data-kortzale-game=heaviest] main>.market .good-worth{font-size:13px!important;line-height:1.15!important;color:#293b47!important}
  html[data-kortzale-game=heaviest] main>.bought{grid-column:1;grid-row:5;margin:0!important;padding-top:3px!important;min-height:25px!important}
  html[data-kortzale-game=heaviest] main>#announcement{grid-column:1;grid-row:6;margin:0!important;min-height:30px!important}
  html[data-kortzale-game=heaviest] main>#passBtn{grid-column:1;grid-row:7;min-height:44px!important}
  html[data-kortzale-game=heaviest] main>footer{grid-column:2;grid-row:7;margin:0!important;align-self:end}

  html[data-kortzale-game=cairn] main>.garden{grid-column:1;grid-row:2;margin:0!important;height:72px!important}
  html[data-kortzale-game=cairn] main>#drawArea{grid-column:1;grid-row:3}
  html[data-kortzale-game=cairn] main>#instruction{grid-column:1;grid-row:4;margin:0!important}
  html[data-kortzale-game=cairn] main>#board{grid-column:2;grid-row:2/8;align-self:start;gap:8px!important}
  html[data-kortzale-game=cairn] main>#board .column{min-height:390px!important}
  html[data-kortzale-game=cairn] main>#announcement{grid-column:1;grid-row:5;margin:0!important}
  html[data-kortzale-game=cairn] main>#scrapped{grid-column:1;grid-row:6}
  html[data-kortzale-game=cairn] main>footer{grid-column:1;grid-row:7;margin:0!important}

  html[data-kortzale-game=assay] main>.survey-tools,
  html[data-kortzale-game=widening] main>.observatory-tools,
  html[data-kortzale-game=tending] main>.garden-tools{grid-column:1;grid-row:2}
  html[data-kortzale-game=assay] main>.turnbar,
  html[data-kortzale-game=widening] main>.readout,
  html[data-kortzale-game=tending] main>.readout{grid-column:1;grid-row:3}
  html[data-kortzale-game=assay] main>#instruction{grid-column:1;grid-row:4;margin:0!important}
  html[data-kortzale-game=assay] main>#board,
  html[data-kortzale-game=widening] main>#board,
  html[data-kortzale-game=tending] main>#board{grid-column:2;grid-row:2/8;align-self:start}
  html[data-kortzale-game=widening] main>.actions{grid-column:1;grid-row:4}
  html[data-kortzale-game=assay] main>#announcement{grid-column:1;grid-row:5;margin:0!important}
  html[data-kortzale-game=widening] main>#announcement,
  html[data-kortzale-game=tending] main>#announcement{grid-column:1;grid-row:5;margin:0!important}
  html[data-kortzale-game=assay] main>footer,
  html[data-kortzale-game=widening] main>footer,
  html[data-kortzale-game=tending] main>footer{grid-column:1;grid-row:6;margin:0!important;align-self:end}

  /* The two shelved concepts use their illustration as a side vignette. */
  html[data-kortzale-game=row] main,
  html[data-kortzale-game=still] main{display:grid!important;grid-template-columns:minmax(180px,.25fr) minmax(0,.75fr);gap:6px 16px!important;align-content:start}
  html[data-kortzale-game=row] main>.mast,
  html[data-kortzale-game=still] main>.mast{grid-column:1/-1}
  html[data-kortzale-game=row] main>.scene,
  html[data-kortzale-game=still] main>.scene{grid-column:1;grid-row:2/5;margin:0!important;height:130px!important}
  html[data-kortzale-game=row] main>.dashboard,
  html[data-kortzale-game=still] main>.dashboard{grid-column:2;grid-row:2}
  html[data-kortzale-game=row] main>#instruction,
  html[data-kortzale-game=still] main>#instruction{grid-column:2;grid-row:3;margin:0!important;text-align:left}
  html[data-kortzale-game=row] main>.row-scroll,
  html[data-kortzale-game=still] main>.tokens{grid-column:2;grid-row:4}
  html[data-kortzale-game=row] main>.row-scroll .sites{min-width:0!important}
  html[data-kortzale-game=row] main>.row-scroll .site{min-height:120px!important}
  html[data-kortzale-game=still] main>.tokens .token{min-height:120px!important}
  html[data-kortzale-game=row] main>.scale,
  html[data-kortzale-game=still] main>.action-bar{grid-column:2;grid-row:5;margin:0!important}
  html[data-kortzale-game=row] main>footer,
  html[data-kortzale-game=still] main>footer{grid-column:1;grid-row:5;margin:0!important;align-self:end}

  /* Wide market cards keep their full labels instead of squeezing into a rail. */
  html[data-kortzale-game=carry] main>header h1{font-size:30px!important;margin:0!important}
  html[data-kortzale-game=carry] main>header .switches{flex-wrap:nowrap!important}
  html[data-kortzale-game=carry] main>.camp{grid-column:1;grid-row:2}
  html[data-kortzale-game=carry] main>.tally{grid-column:2;grid-row:2;padding:4px 0!important}
  html[data-kortzale-game=carry] main>.tally strong{font-size:24px!important}
  html[data-kortzale-game=carry] main>.route{grid-column:1/-1;grid-row:3;margin:0!important}
  html[data-kortzale-game=carry] main>.contract-heading{grid-column:1/-1;grid-row:4;margin:0!important}
  html[data-kortzale-game=carry] main>.contracts{grid-column:1/-1;grid-row:5;align-self:start}
  html[data-kortzale-game=carry] main>.contracts .contract{min-height:100px!important;padding:8px 10px!important;gap:3px!important}
  html[data-kortzale-game=carry] main>.signed{grid-column:1;grid-row:6}
  html[data-kortzale-game=carry] main>#announcement{grid-column:2;grid-row:6}
  html[data-kortzale-game=carry] main>#passBtn{grid-column:1;grid-row:7}
  html[data-kortzale-game=carry] main>footer{grid-column:2;grid-row:7;align-self:center}

  html[data-kortzale-game=heaviest] main>header h1{font-size:27px!important;line-height:1!important;white-space:nowrap}
  html[data-kortzale-game=heaviest] main>.arcade{grid-column:1;grid-row:2/6}
  html[data-kortzale-game=heaviest] main>.turnbar{grid-column:2;grid-row:2}
  html[data-kortzale-game=heaviest] main>.bought{grid-column:2;grid-row:3}
  html[data-kortzale-game=heaviest] main>#announcement{grid-column:2;grid-row:4}
  html[data-kortzale-game=heaviest] main>#passBtn{grid-column:2;grid-row:5;max-width:280px!important}
  html[data-kortzale-game=heaviest] main>.market{grid-column:1/-1;grid-row:6}
  html[data-kortzale-game=heaviest] main>.market .good{min-height:92px!important;padding:6px!important;gap:2px!important}
  html[data-kortzale-game=heaviest] main>.market .good-name{font-size:15px!important}
  html[data-kortzale-game=heaviest] main>.market .good-price,
  html[data-kortzale-game=heaviest] main>.market .good-worth{font-size:13px!important;color:#293b47!important}
  html[data-kortzale-game=heaviest] main>footer{grid-column:1/-1;grid-row:7;justify-content:flex-end}

  /* Results replace the play surface and can scroll within their own page. */
  html[data-kortzale-look=handwritten] body>main>#ending:not([hidden]),
  html[data-kortzale-look=handwritten] body>#app>#ending:not([hidden]),
  html[data-kortzale-game=silt] body>.game>.ending:not([hidden]){
    position:fixed!important;z-index:900!important;top:70px!important;bottom:auto!important;left:50%!important;right:auto!important;
    transform:translateX(-50%)!important;width:min(650px,calc(100vw - 40px))!important;height:auto!important;
    max-height:calc(100dvh - 84px)!important;overflow:auto!important;margin:0!important;padding:20px!important;
    background:#fffaf0!important;color:#293b47!important;border:2px solid #315c75!important;
    box-shadow:0 0 0 100vmax #293b47b3,7px 9px 0 #293b4770!important;
  }
}

@media (min-width:800px) and (min-height:500px) and (max-height:620px){
  html[data-kortzale-look=handwritten] body>main,
  html[data-kortzale-look=handwritten] body>#app{padding-top:8px!important;padding-bottom:8px!important}
  html[data-kortzale-game=carry] body>main,
  html[data-kortzale-game=heaviest] body>main,
  html[data-kortzale-game=cairn] body>main,
  html[data-kortzale-game=assay] body>main{row-gap:3px!important}
  html[data-kortzale-game=cairn] main>#board .column{min-height:365px!important}
  html[data-kortzale-game=heaviest] main>.market .good{min-height:86px!important}
}

@media (min-width:800px) and (min-height:500px) and (max-width:1000px){
  html[data-kortzale-game=still] main>.tokens .token{min-height:98px!important}
  html[data-kortzale-game=row] main{grid-template-columns:minmax(170px,.26fr) minmax(0,.74fr)!important}
  html[data-kortzale-game=row] main>.scene{grid-column:1;grid-row:2/4;height:108px!important}
  html[data-kortzale-game=row] main>.dashboard{grid-column:2;grid-row:2}
  html[data-kortzale-game=row] main>#instruction{grid-column:2;grid-row:3}
  html[data-kortzale-game=row] main>.row-scroll{grid-column:1/-1;grid-row:4}
  html[data-kortzale-game=row] main>.row-scroll .sites{grid-template-columns:repeat(9,minmax(0,1fr))!important;gap:5px!important}
  html[data-kortzale-game=row] main>.row-scroll .site{padding-left:2px!important;padding-right:2px!important;min-height:110px!important}
  html[data-kortzale-game=row] main>.row-scroll .site .number{font-size:34px!important}
  html[data-kortzale-game=row] main>.scale{grid-column:1/-1;grid-row:5}
  html[data-kortzale-game=row] main>footer{grid-column:1/-1;grid-row:6;margin-top:2px!important}
}

/* A very short fullscreen window keeps every control reachable. */
@media (min-width:800px) and (min-height:500px) and (max-height:580px){
  html[data-kortzale-look=handwritten] body>main,
  html[data-kortzale-look=handwritten] body>#app{overflow-y:auto!important;overflow-x:hidden!important}
}

/* A bound notebook sits on a dark desktop mat; paper stays inside the frame. */
@media (min-width:800px) and (min-height:500px){
  html[data-kortzale-look=handwritten]{--field-stage-width:min(1100px,calc(100vw - 36px))}
  html[data-kortzale-game=silt]{--field-stage-width:min(540px,calc(100vw - 36px))}
  html[data-kortzale-game=repeal]{--field-stage-width:min(720px,calc(100vw - 36px))}
  html[data-kortzale-game=doorman],
  html[data-kortzale-game=quarry]{--field-stage-width:min(1000px,calc(100vw - 36px))}
  html[data-kortzale-look=handwritten] body,
  html[data-look=handwritten] body{background:#263a45!important}
  /* Opening screens sit on the same dark mat as the shelf and play pages. */
  html[data-kortzale-look=handwritten] :is(.intro,#intro){background:#263a45!important}
  html[data-kortzale-look=handwritten] body>main,
  html[data-kortzale-look=handwritten] body>#app,
  html[data-look=handwritten] body>main{
    border:3px solid #315c75!important;
    box-shadow:0 0 0 6px #c7b99d,0 0 0 8px #244558,0 22px 52px #08192388!important;
  }
  html[data-kortzale-look=handwritten] .field-toolbar{
    left:50%!important;right:auto!important;transform:translateX(-50%)!important;
    width:var(--field-stage-width)!important;
    padding:6px 16px!important;
    border-left:3px solid #315c75;border-right:3px solid #315c75;
  }
  /* Opening screens: a little less top padding and slightly smaller copy so their Begin control fits a 720px-tall window. */
  html[data-kortzale-look=handwritten] :is(.intro,#intro){padding-top:62px!important;padding-bottom:16px!important}
  html[data-kortzale-look=handwritten] :is(.intro,#intro) :is(p,li){font-size:15px!important;line-height:1.45!important}
  html[data-kortzale-look=handwritten] :is(.intro,#intro) :is(.intro-card,.intro-inner,.inner){padding-top:18px!important;padding-bottom:18px!important}
  html[data-look=handwritten] body>main{
    box-sizing:border-box;width:min(1100px,calc(100vw - 36px))!important;
    max-width:1100px!important;margin:16px auto 0!important;padding:22px 30px 16px 52px!important;
  }
  /* One-screen shelf: compact header, thirteen short cards in five columns. */
  html[data-look=handwritten] .hero{margin:0 0 12px!important;padding-bottom:10px!important}
  html[data-look=handwritten] .hero .eyebrow{margin:0 0 4px!important}
  html[data-look=handwritten] .hero h1{font-size:clamp(38px,5vw,60px)!important;margin:0 0 4px!important}
  html[data-look=handwritten] .hero .lead{font-size:16px!important}
  html[data-look=handwritten] .hero .count{display:none}
  html[data-look=handwritten] .shelf{grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:9px!important}
  html[data-look=handwritten] .shelf .game{min-height:0!important;padding:10px 10px 10px!important;grid-template-columns:20px minmax(0,1fr) 14px!important;gap:4px!important}
  html[data-look=handwritten] .shelf .game .theme{display:none}
  html[data-look=handwritten] .shelf .game strong{font-size:20px!important;margin:0 0 4px!important}
  html[data-look=handwritten] .shelf .game .hook{font-size:13px!important;line-height:1.25!important}
  html[data-look=handwritten] .shelf .game .open{font-size:17px!important}
  html[data-look=handwritten] footer{margin-top:12px!important;padding-top:8px!important}
  html[data-look=handwritten] footer p{margin:2px 0!important;font-size:13px!important}
}
