/* The play surface has one height budget at every aspect ratio. Theme rules stay
   in a lower cascade layer, so historical breakpoints cannot override this grid. */
:root[data-view="game"]{--ui-gap:clamp(6px,calc(var(--app-height)*.012),12px);--inventory-height:clamp(46px,calc(var(--app-height)*.1),104px);--hand-height:clamp(112px,calc(var(--app-height)*.24),230px);--control-height:clamp(32px,calc(var(--app-height)*.055),44px);--inventory-card-width:clamp(29px,calc((var(--inventory-height) - 12px)*71/95),68px);--played-max:126px}
:root[data-view="game"],:root[data-view="game"] body{height:var(--app-height,100dvh);min-height:0;overflow:hidden}
:root[data-view="game"] #app{height:100%;min-height:0;display:flex;flex-direction:column}
:root[data-view="game"] .topbar{height:clamp(40px,calc(var(--app-height)*.07),60px);min-height:0;flex:none;padding:4px max(12px,env(safe-area-inset-right)) 4px max(12px,env(safe-area-inset-left))}
:root[data-view="game"] .brand img{width:clamp(64px,7vw,96px);height:100%;max-height:42px}
:root[data-view="game"] .brand-title{font-size:12px}
:root[data-view="game"] .top-actions .icon-btn{min-height:30px;padding:6px 11px;font-size:12px}
.workspace{height:calc(var(--app-height,100dvh) - var(--topbar-height,60px));min-height:0;max-width:1600px;width:100%;flex:1 1 0;margin:0 auto;padding:var(--ui-gap) max(10px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));display:grid;gap:var(--ui-gap);overflow:visible}
.game-main{min-height:0;min-width:0;display:grid;gap:var(--ui-gap);grid-template-rows:var(--inventory-height) minmax(0,1fr) 10px}
.game-main:has(.hand-zone){grid-template-rows:var(--inventory-height) minmax(0,1fr) var(--hand-height) 10px}
.inventory{height:var(--inventory-height);min-height:0;display:grid;grid-template-columns:minmax(0,1fr) clamp(112px,18vw,210px);gap:8px}
.inventory-zone{height:100%;min-height:0;padding:6px 9px;display:flex;align-items:center;gap:7px}
.inventory-zone .section-label{font-size:10px;letter-spacing:.3px;min-width:33px;margin:0;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:5px}
.inventory-zone .section-label span{font-size:13px}
.joker-row,.consumable-row{min-height:0;min-width:0;height:100%;display:flex;align-items:center;gap:6px;flex:1}
.inventory .card{--card-w:var(--inventory-card-width);height:calc(var(--inventory-card-width)*95/71);flex-shrink:0}
.empty-slot{width:var(--inventory-card-width);height:calc(var(--inventory-card-width)*95/71);flex:none;font-size:18px}
.table-stage{height:100%;min-height:0;min-width:0;flex:none;padding:clamp(8px,1.3vh,16px);display:flex;flex-direction:column;align-items:center;justify-content:flex-start;overflow:auto;scrollbar-width:thin}
.table-stage:has(.play-board){padding:0;overflow:visible;justify-content:center}
.table-stage>.stage-heading,.table-stage>.shop-head,.table-stage>.blind-options,.table-stage>.shop-grid,.table-stage>.pack-grid,.table-stage>.cashout{flex-shrink:0}
.play-board{width:100%;height:100%;min-height:0;min-width:0;display:grid;place-items:center;position:relative}
.play-board .scored-cards{--played-max:126px;--played-width:80px;width:100%;height:100%;min-height:0;min-width:0;margin:0;padding:20px 14px;display:flex;align-items:center;justify-content:center;gap:8px;grid-column:auto;grid-row:auto;flex:none}
.scored-cards>.played-card{--card-w:var(--played-width);width:var(--played-width);height:calc(var(--played-width)*95/71);min-width:var(--played-width);max-width:var(--played-width);min-height:calc(var(--played-width)*95/71);max-height:calc(var(--played-width)*95/71);aspect-ratio:71/95;align-self:center;flex:0 0 var(--played-width);transform-origin:center;opacity:1;will-change:transform}
.scored-cards>.played-card.not-scoring{opacity:.45}
.scored-cards>.played-card.scoring{box-shadow:0 0 0 2px var(--yellow),0 5px 0 #09291d66;opacity:1}
.board-empty{max-width:100%;font-size:12px;text-align:center;line-height:1.8;color:#8eb49c85;letter-spacing:1px}
.hand-zone{height:var(--hand-height);min-height:0;min-width:0;padding:0;display:grid;grid-template-rows:22px minmax(0,1fr) var(--control-height);gap:4px}
.hand-topline{height:22px;min-height:0;margin:0;gap:5px}
.hand-topline .section-label{font-size:11px;letter-spacing:.4px;white-space:nowrap}
.sort-buttons{font-size:10px;gap:5px}
.sort-buttons button{padding:4px 8px;font-size:10px}
.hand-topline .deck-stack{font-size:13px;min-height:24px;padding:2px 5px!important}
.deck-mini{width:16px;height:22px}
.hand-cards{--hand-card-width:64px;height:100%;min-height:0;min-width:0;padding:18px 6px 4px;display:flex;align-items:flex-end;justify-content:center;max-width:100%;isolation:isolate}
.hand-cards .hand-card{--card-w:var(--hand-card-width);width:var(--hand-card-width);height:calc(var(--hand-card-width)*95/71);min-height:0;flex:0 0 var(--hand-card-width);margin-left:0}
.hand-cards .hand-card.selected{transform:translateY(-16px);z-index:6}
.hand-actions{height:var(--control-height);min-height:0;padding:0;gap:9px;display:flex;align-items:center;justify-content:center}
.hand-actions .btn{height:var(--control-height);min-height:var(--control-height);min-width:96px;padding:4px 16px;font-size:13px}
.hand-actions .icon-btn{height:var(--control-height);min-height:var(--control-height);padding:4px 12px}
.selected-counter{font-size:16px;min-width:47px}
.keyboard-hint{display:none}
.game-foot{height:10px;min-height:0;padding:0;font-size:9px;white-space:nowrap;gap:4px;line-height:1}
.game-foot button{font-size:9px}
:root[data-view="game"][data-phase="shop"]{--inventory-height:clamp(32px,calc(var(--app-height)*.06),56px);--inventory-card-width:clamp(20px,calc((var(--inventory-height) - 6px)*71/95),42px)}
:root[data-phase="shop"] .inventory-zone{padding:3px 7px}
:root[data-phase="shop"] .inventory-zone .section-label{gap:3px;font-size:9px;line-height:1.1}
:root[data-phase="shop"] .inventory-zone .section-label span{font-size:11px;line-height:1.1}
:root[data-phase="shop"][data-layout="narrow"] .workspace{--hud-height:60px}
:root[data-phase="shop"][data-layout="narrow"] .score-panel{display:flex;align-items:center}
:root[data-phase="shop"][data-layout="narrow"] .score-panel>.score-label,:root[data-phase="shop"][data-layout="narrow"] .score-panel>.score-value,:root[data-phase="shop"][data-layout="narrow"] .score-panel>.progress-track{display:none}
:root[data-phase="shop"][data-layout="narrow"] .stats-grid{width:100%;margin:0}
:root[data-phase="shop"][data-layout="narrow"] .round-panel{padding:3px 5px}
:root[data-phase="shop"][data-layout="narrow"] .blind-label{font-size:10px;line-height:16px;margin:0;padding:0}
:root[data-phase="shop"][data-layout="narrow"] .target-value{font-size:24px}
:root[data-phase="shop"][data-layout="narrow"] .reward{margin-top:2px}
.table-stage:has(.shop-layout){overflow:visible;display:block}
.shop-layout{width:100%;height:100%;min-height:0;display:grid;grid-template-rows:28px minmax(0,1fr) 42px;gap:6px;position:relative}
.shop-layout>.shop-head{height:28px;margin:0;gap:8px}
.shop-head>div:first-child{display:flex;align-items:center;gap:12px;min-width:0}
.shop-head .eyebrow{display:none}
.shop-head h2{font-size:22px;line-height:1.2;letter-spacing:2px;white-space:nowrap}
.shop-head p{font-size:11px;margin:0}
.shop-head>.price-tag{font-size:24px}
.shop-content{min-height:0;min-width:0;overflow:visible;padding:0}
.shop-grid{height:100%;min-height:0;min-width:0;display:grid;gap:8px;align-items:stretch}
.shop-grid[data-arrangement="stack"]{grid-template-columns:minmax(0,1fr) minmax(0,2fr);grid-template-rows:repeat(2,minmax(0,1fr))}
.shop-grid[data-arrangement="stack"]>.shop-section:first-child{grid-column:1/-1}
.shop-grid[data-arrangement="row"]{grid-template-columns:minmax(0,var(--stock-weight,2fr)) minmax(0,var(--voucher-weight,1fr)) minmax(0,2fr);grid-template-rows:minmax(0,1fr)}
.shop-grid .shop-section{grid-column:auto;min-width:0;min-height:0;display:grid;grid-template-rows:14px minmax(0,1fr);gap:4px;padding:6px 8px}
.shop-section>.section-label{height:14px;min-width:0;margin:0;font-size:10px;letter-spacing:0;line-height:14px}
.shop-section>.section-label span{display:none}
.shop-items{height:100%;min-height:0;min-width:0;display:grid;grid-template-columns:repeat(var(--item-count,1),minmax(0,1fr));gap:6px;align-items:stretch;justify-items:center}
.shop-items>.shop-card{height:100%;width:100%;max-width:128px;min-height:0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;padding:0 0 5px;flex:none}
.shop-items .shop-card>.card{--card-w:var(--shop-card-width,44px);width:var(--card-w);height:calc(var(--card-w)*95/71);flex:none}
.shop-items .shop-card>strong{height:24px;min-height:24px;line-height:12px;font-size:11px;display:flex;align-items:center;justify-content:center;text-align:center;overflow-wrap:anywhere;flex:none}
.shop-item-actions{width:100%;height:30px;display:grid;grid-template-columns:max-content minmax(0,1fr);align-items:center;gap:4px;flex:none}
.shop-item-actions .price-tag{font-size:16px;white-space:nowrap}
.shop-item-actions .price-tag.free{font-size:10px}
.shop-item-actions>.btn{height:30px;min-height:30px;min-width:0;padding:3px;font-size:10px;flex:none}
.shop-item-actions>.btn:disabled{opacity:.52}
.shop-layout>.shop-footer{height:42px;position:static;inset:auto;background:transparent;padding:4px 0 5px;margin:0;z-index:auto;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px}
.shop-layout>.shop-footer .btn{height:32px;min-height:32px;padding:5px 13px;font-size:12px}
.shop-section .sold-out{font-size:11px;line-height:1.6;padding:8px 0;grid-column:1/-1}
@media(max-width:600px){.shop-head p{display:none}.shop-grid{gap:6px}.shop-grid .shop-section{padding:5px}.shop-items{gap:5px}.shop-items>.shop-card{gap:3px}.shop-items .shop-card>strong{font-size:10px;line-height:10px;height:20px;min-height:20px}}
:root[data-short="true"] .shop-layout>.shop-head h2{font-size:18px}
:root[data-short="true"] .shop-head p{display:none}
:root[data-short="true"] .shop-layout{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:28px minmax(0,1fr)}
:root[data-short="true"] .shop-layout>.shop-head{grid-area:1/1/2/2;justify-content:flex-start;gap:8px}
:root[data-short="true"] .shop-head>.price-tag{font-size:19px}
:root[data-short="true"] .shop-layout>.shop-content{grid-area:2/1/3/3}
:root[data-short="true"] .shop-layout>.shop-footer{grid-area:1/2/2/3;height:28px;padding:0;border:0;gap:7px}
:root[data-short="true"] .shop-layout>.shop-footer .btn{height:26px;min-height:26px;padding:3px 10px;font-size:11px}

/* Details always float outside the layout; opening them never moves products. */
.card-info{position:fixed;inset:auto;margin:0;width:min(236px,calc(100vw - 16px));max-width:none;padding:12px;border:1px solid #d7c67a88;border-radius:9px;background:#102f28;color:var(--ink);box-shadow:0 8px 28px #061d19a6;z-index:50;font-size:12px;line-height:1.75;overflow:auto;text-align:left}
.card-info[hidden]{display:none!important}
.card-info::backdrop{background:transparent;pointer-events:none}
.card-info-head{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;margin-bottom:6px}
.card-info-head h3{font-size:14px;line-height:1.5;color:var(--yellow)}
.info-close{flex:none;background:transparent;border:0;color:#a5bfa6;min-width:26px;min-height:26px;padding:0;line-height:1;font-size:20px;margin:-5px -6px -3px 0}
.card-info p{overflow-wrap:anywhere}
.card-info .edition-label{font-size:10px;padding:1px 5px;margin:0 0 5px}
.card-info .info-note{font-size:10px;color:var(--muted);margin-top:6px}
.card-info-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.card-info-actions .btn{min-height:30px;padding:5px 10px;font-size:11px;flex:1 1 auto}
.blackboard-debug{padding:12px;border:1px solid #d7c67a66;border-radius:8px;margin:12px 0;background:#0d2e27}
.blackboard-debug h3{font-size:14px;color:var(--yellow);margin-bottom:6px}
.blackboard-debug p{font-size:11px;line-height:1.7;color:var(--muted);margin-top:5px;overflow-wrap:anywhere}
.debug-held{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.debug-held-card{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:11px;min-width:55px;max-width:100px}
.debug-held-card .card{--card-w:39px;--card-h:calc(39px * 95 / 71);width:39px;height:calc(39px * 95 / 71);flex:none}
.debug-held-card small{font-size:9px;text-align:center;color:#a0c4aa}
.debug-held-card.blocks small{color:#ff998b}
.debug-held-card.blocks .card{outline:2px solid #ed7161;outline-offset:2px}
.debug-actions{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.debug-replay-result{line-height:1.7;margin-bottom:12px}
[data-action="detail"][aria-expanded="true"]{outline:2px solid var(--yellow);outline-offset:3px}

/* Hand examples use the original Lua sample cards, with scoring flags shown. */
dialog.hands-modal{width:min(94vw,760px)}
.hands-modal .modal-head{padding:14px 18px 12px}
.hands-modal .modal-body{padding:12px 16px 16px}
.hands-intro{font-size:11px;color:var(--muted);line-height:1.6;margin-bottom:10px}
.hands-table{table-layout:fixed;width:100%;font-size:12px}
.hands-table .hand-name-col{width:90px}
.hands-table .hand-level-col{width:45px}
.hands-table .hand-chips-col{width:65px}
.hands-table .hand-mult-col{width:50px}
.hands-table th,.hands-table td{padding:3px 5px;vertical-align:middle}
.hands-table tbody th{font-size:12px;color:var(--ink);font-weight:600;white-space:nowrap}
.hands-table thead th{font-size:11px;padding-bottom:8px}
.hands-table td:nth-child(n+3){font-family:Balatro,monospace;font-size:21px;text-align:right;white-space:nowrap}
.hands-table thead th:nth-child(n+3){text-align:right}
.hand-example{display:flex;align-items:center;justify-content:flex-start;gap:4px;min-width:0;padding:2px 0}
.hand-example .card{--card-w:28px;width:var(--card-w);height:calc(var(--card-w)*95/71);flex:0 0 var(--card-w);box-shadow:0 2px 0 #071e1866;vertical-align:middle}
.hand-example .example-kicker{opacity:.33;filter:saturate(.55);transform:translateY(2px)}
@media(max-width:540px){
  .hands-modal .modal-head{padding:12px}
  .hands-modal .modal-head h2{font-size:17px}
  .hands-modal .modal-body{padding:9px 10px 12px}
  .hands-intro{font-size:10px;margin-bottom:7px}
  .hands-table .hand-name-col{width:19%}
  .hands-table .hand-level-col{width:10%}
  .hands-table .hand-chips-col{width:14%}
  .hands-table .hand-mult-col{width:13%}
  .hands-table th,.hands-table td{padding:4px 2px}
  .hands-table tbody th,.hands-table thead th{font-size:10px}
  .hands-table td:nth-child(n+3){font-size:17px}
  .hand-example{gap:0;padding:3px 0 5px}
  .hand-example .card{--card-w:clamp(20px,5.5vw,29px);margin-right:-2px}
}

/* Shared readout, physically inside the information rail rather than the table. */
.hand-score-panel{min-width:0;padding:12px 10px}
.hand-score-panel .play-summary{display:flex;flex-direction:column;align-items:stretch;gap:5px;width:100%;min-width:0;text-align:center}
.hand-score-panel .hand-type{min-height:0;font-size:19px;line-height:1.25;letter-spacing:1px}
.hand-score-panel .level-tag{font-size:11px;margin-left:5px;padding:2px 4px;vertical-align:middle}
.hand-score-panel .math{display:grid;grid-template-columns:minmax(0,1fr) 12px minmax(0,1fr);align-items:center;gap:5px;margin:1px 0 3px}
.hand-score-panel .math .term{min-width:0;padding:5px 4px;font-size:30px;line-height:1.05;border-radius:5px}
.hand-score-panel .math .term small{font-size:8px;line-height:1.2;letter-spacing:1px;margin-bottom:2px}
.hand-score-panel .math .times{font-size:20px}
.hand-score-panel [data-score-value]{display:block;white-space:nowrap}
.hand-score-panel .last-score{margin:2px 0;font-size:22px;line-height:1.1;white-space:nowrap}
.hand-score-panel .last-score small{display:block;margin:0 0 2px;font-size:9px;line-height:1.2}
.hand-score-panel .scoring-status{min-height:14px;margin:0;font-size:10px;line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hand-score-panel .btn{min-height:26px;padding:4px 5px;margin:2px 0 0!important;position:static;font-size:10px!important;white-space:nowrap}
.last-score[hidden]{display:none}

:root[data-layout="wide"] .workspace{grid-template-columns:clamp(130px,17vw,228px) minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
:root[data-layout="wide"] .sidebar{height:100%;min-height:0;display:flex;flex-direction:column;gap:var(--ui-gap);overflow:auto;scrollbar-width:thin}
:root[data-layout="wide"] .sidebar>section{flex:none}
:root[data-layout="wide"] .round-panel{order:1;padding:12px 10px}
:root[data-layout="wide"] .hand-score-panel{order:2}
:root[data-layout="wide"] .score-panel{order:3;padding:12px 10px}
:root[data-layout="wide"] .side-tools{order:4;padding:10px;gap:7px}
:root[data-layout="wide"] .blind-label{font-size:13px;padding-bottom:7px;margin-bottom:8px;white-space:nowrap}
:root[data-layout="wide"] .blind-label .blind-chip{width:28px;height:28px;background-size:588px 868px;vertical-align:middle}
:root[data-layout="wide"] .target-label{font-size:10px}
:root[data-layout="wide"] .target-value{font-size:34px;line-height:1.1}
:root[data-layout="wide"] .reward{font-size:11px;margin-top:4px}
:root[data-layout="wide"] .score-label{font-size:10px}
:root[data-layout="wide"] .score-value{font-size:34px;line-height:1;margin:4px 0 8px}
:root[data-layout="wide"] .progress-track{height:4px}
:root[data-layout="wide"] .stats-grid{grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}
:root[data-layout="wide"] .stat{padding:6px 3px}
:root[data-layout="wide"] .stat label{font-size:10px}
:root[data-layout="wide"] .stat strong{font-size:26px;line-height:1.1;margin-top:2px}

/* Portrait windows, including short desktop windows, keep a compact two-row HUD. */
:root[data-layout="narrow"] .workspace{--hud-height:clamp(96px,calc(var(--app-height)*.14),116px);grid-template-columns:minmax(0,1fr);grid-template-rows:var(--hud-height) minmax(0,1fr)}
:root[data-layout="narrow"] .workspace:has(.hand-score-panel){--hud-height:clamp(140px,calc(var(--app-height)*.18),156px)}
:root[data-layout="narrow"] .sidebar{height:100%;min-height:0;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.35fr);grid-template-rows:minmax(0,1fr);gap:5px;overflow:visible}
:root[data-layout="narrow"] .sidebar:has(.hand-score-panel){grid-template-rows:minmax(0,1fr) 44px}
:root[data-layout="narrow"] .round-panel{grid-column:1;grid-row:1;padding:5px 7px;min-height:0;display:flex;flex-direction:column;justify-content:center}
:root[data-layout="narrow"] .score-panel{grid-column:2;grid-row:1;padding:5px 7px;min-height:0}
:root[data-layout="narrow"] .hand-score-panel{grid-column:1/-1;grid-row:2;padding:4px 7px;height:44px}
:root[data-layout="narrow"] .side-tools{display:none}
:root[data-layout="narrow"] .blind-label{padding:0 0 3px;margin:0 0 3px;border:0;font-size:11px;line-height:18px}
:root[data-layout="narrow"] .blind-label .blind-chip{width:18px;height:18px;background-size:378px 558px;vertical-align:middle;margin-right:3px}
:root[data-layout="narrow"] .target-label{display:none}
:root[data-layout="narrow"] .target-value{font-size:27px;line-height:1}
:root[data-layout="narrow"] .reward{font-size:9px;line-height:1;margin:3px 0 0}
:root[data-layout="narrow"] .score-label{font-size:9px;line-height:1}
:root[data-layout="narrow"] .score-value{font-size:25px;line-height:1;margin:2px 0 4px}
:root[data-layout="narrow"] .progress-track{height:3px}
:root[data-layout="narrow"] .stats-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;margin-top:4px}
:root[data-layout="narrow"] .stat{padding:3px 1px}
:root[data-layout="narrow"] .stat label{font-size:9px;line-height:1}
:root[data-layout="narrow"] .stat strong{font-size:19px;line-height:1;margin:1px 0 0}
:root[data-layout="narrow"] .hand-score-panel .play-summary{height:100%;display:grid;grid-template-columns:minmax(55px,.8fr) minmax(110px,1.25fr) minmax(55px,.75fr);align-items:center;gap:7px}
:root[data-layout="narrow"] .hand-score-panel .hand-type{font-size:13px;line-height:1.1;letter-spacing:0}
:root[data-layout="narrow"] .hand-score-panel .hand-type{grid-area:1/1/2/2}
:root[data-layout="narrow"] .hand-score-panel .math{grid-area:1/2/2/3}
:root[data-layout="narrow"] .hand-score-panel .last-score{grid-area:1/3/2/4}
:root[data-layout="narrow"] .hand-score-panel .level-tag{font-size:9px;padding:1px 3px;margin-left:2px}
:root[data-layout="narrow"] .hand-score-panel .math{grid-template-columns:minmax(0,1fr) 10px minmax(0,1fr);gap:4px;margin:0}
:root[data-layout="narrow"] .hand-score-panel .math .term{padding:2px 3px;font-size:21px;box-shadow:0 2px 0 #09291d55}
:root[data-layout="narrow"] .hand-score-panel .math .term small{font-size:7px;line-height:1;margin:0;letter-spacing:0}
:root[data-layout="narrow"] .hand-score-panel .math .times{font-size:16px}
:root[data-layout="narrow"] .hand-score-panel .last-score{font-size:17px;margin:0;line-height:1}
:root[data-layout="narrow"] .hand-score-panel .last-score small{font-size:8px;margin:0 0 2px;line-height:1}
:root[data-layout="narrow"] .hand-score-panel .scoring-status,:root[data-layout="narrow"] .hand-score-panel .btn{display:none}
:root[data-layout="narrow"] .hand-score-panel .math:has(+.last-score[hidden]){grid-column:2/4}
:root[data-layout="narrow"] .inventory{grid-template-columns:minmax(0,1fr) clamp(94px,25vw,138px);gap:6px}
:root[data-layout="narrow"] .inventory-zone{padding:5px 7px;gap:5px}
:root[data-layout="narrow"] .inventory-zone .section-label{font-size:9px;min-width:28px}
:root[data-layout="narrow"] .inventory-zone .section-label span{font-size:11px}
:root[data-layout="narrow"] .hand-actions .btn{min-width:96px;font-size:12px}
:root[data-layout="narrow"] .hand-topline .section-label{font-size:10px}
:root[data-layout="narrow"] .hand-topline .row{gap:6px!important}
:root[data-layout="narrow"] .brand-divider,:root[data-layout="narrow"] .topbar .sub,:root[data-layout="narrow"] .topbar .pill{display:none}
:root[data-layout="narrow"] .brand{gap:9px}
:root[data-layout="narrow"] .brand img{width:65px}
:root[data-layout="narrow"] .brand-title{font-size:11px}
:root[data-layout="narrow"] .top-actions{gap:6px}
:root[data-layout="narrow"] .top-actions .icon-btn{font-size:11px;padding:5px 8px}
:root[data-layout="narrow"] .fullscreen{display:none}

:root[data-short="true"]{--inventory-height:46px;--inventory-card-width:29px;--hand-height:112px;--control-height:32px;--ui-gap:6px}
:root[data-short="true"] .topbar .sub,:root[data-short="true"] .topbar .pill,:root[data-short="true"] .brand-divider{display:none}
:root[data-short="true"] .side-tools{display:none}
:root[data-short="true"][data-layout="wide"] .round-panel{padding:6px 7px}
:root[data-short="true"][data-layout="wide"] .blind-label{font-size:10px;line-height:18px;margin:0 0 3px;padding:0 0 3px;border:0}
:root[data-short="true"][data-layout="wide"] .blind-label .blind-chip{width:18px;height:18px;background-size:378px 558px;margin-right:3px}
:root[data-short="true"][data-layout="wide"] .target-label{font-size:8px;line-height:1}
:root[data-short="true"][data-layout="wide"] .target-value{font-size:27px;line-height:1}
:root[data-short="true"][data-layout="wide"] .reward{font-size:9px;line-height:1;margin-top:2px}
:root[data-short="true"] .hand-score-panel{padding:6px 7px}
:root[data-short="true"] .hand-score-panel .play-summary{gap:3px}
:root[data-short="true"] .hand-score-panel .hand-type{font-size:14px;line-height:1.1}
:root[data-short="true"] .hand-score-panel .level-tag{font-size:9px;padding:1px 3px}
:root[data-short="true"] .hand-score-panel .math .term{font-size:21px;padding:2px 3px}
:root[data-short="true"] .hand-score-panel .math .term small{font-size:7px;line-height:1;margin:0}
:root[data-short="true"] .hand-score-panel .last-score{font-size:17px;line-height:1;margin:1px 0}
:root[data-short="true"] .hand-score-panel .last-score small{font-size:8px;line-height:1;display:inline;margin-right:3px}
:root[data-short="true"] .hand-score-panel .scoring-status{display:none}
:root[data-short="true"] .hand-score-panel .btn{font-size:9px!important;min-height:19px;padding:2px 4px}
:root[data-short="true"][data-layout="wide"] .score-panel{padding:6px 7px}
:root[data-short="true"][data-layout="wide"] .score-label{font-size:9px;line-height:1}
:root[data-short="true"][data-layout="wide"] .score-value{font-size:27px;line-height:1;margin:3px 0 5px}
:root[data-short="true"][data-layout="wide"] .stats-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;margin-top:6px}
:root[data-short="true"][data-layout="wide"] .stat{padding:3px 1px}
:root[data-short="true"][data-layout="wide"] .stat label{font-size:8px;line-height:1}
:root[data-short="true"][data-layout="wide"] .stat strong{font-size:18px;line-height:1;margin:2px 0 0}
:root[data-short="true"] .hand-topline .section-label,:root[data-short="true"] .sort-buttons{font-size:9px}
:root[data-short="true"] .hand-actions .btn{font-size:11px;min-width:84px}
:root[data-short="true"] .game-foot,:root[data-short="true"] .game-foot button{font-size:8px}
:root[data-short="true"] .play-board .scored-cards{padding:12px 10px;gap:6px}
:root[data-tiny="true"]{--hand-height:102px;--inventory-height:40px;--inventory-card-width:25px;--control-height:28px;--ui-gap:5px}
:root[data-tiny="true"] .topbar{height:34px}
:root[data-tiny="true"] .workspace{padding-top:5px;padding-bottom:5px}
:root[data-tiny="true"] .hand-zone{grid-template-rows:18px minmax(0,1fr) var(--control-height)}
:root[data-tiny="true"] .hand-score-panel .last-score{font-size:15px}
:root[data-tiny="true"] .hand-score-panel .btn{display:none}
:root[data-tiny="true"] .game-foot{visibility:hidden}

@media(max-height:820px){
  :root[data-layout="wide"] .side-tools{display:none}
  :root[data-layout="wide"] .round-panel{padding:8px}
  :root[data-layout="wide"] .target-value{font-size:30px}
  :root[data-layout="wide"] .score-panel{padding:8px}
  :root[data-layout="wide"] .score-value{font-size:30px}
  :root[data-layout="wide"] .stat strong{font-size:23px;white-space:nowrap}
  :root[data-layout="wide"] .hand-score-panel{padding:8px}
  :root[data-layout="wide"] .hand-score-panel .play-summary{gap:4px}
  :root[data-layout="wide"] .hand-score-panel .hand-type{font-size:17px}
  :root[data-layout="wide"] .hand-score-panel .math .term{font-size:26px;padding:3px}
  :root[data-layout="wide"] .hand-score-panel .last-score{font-size:19px}
  :root[data-layout="wide"] .hand-score-panel .last-score small{display:inline;margin-right:4px;font-size:8px}
  :root[data-layout="wide"] .hand-score-panel .scoring-status{font-size:9px;line-height:1.2;min-height:12px}
  :root[data-layout="wide"] .hand-score-panel .btn{min-height:23px;padding:3px;font-size:9px!important}
}
:root[data-short="true"][data-layout="wide"] .round-panel,:root[data-short="true"][data-layout="wide"] .score-panel,:root[data-short="true"][data-layout="wide"] .hand-score-panel{padding:6px}
:root[data-short="true"][data-layout="wide"] .target-value,:root[data-short="true"][data-layout="wide"] .score-value{font-size:25px}
:root[data-short="true"][data-layout="wide"] .hand-score-panel .hand-type{font-size:14px}
:root[data-short="true"][data-layout="wide"] .hand-score-panel .math .term{font-size:21px;padding:2px}
:root[data-short="true"][data-layout="wide"] .hand-score-panel .last-score{font-size:17px}
:root[data-short="true"][data-layout="wide"] .hand-score-panel .scoring-status{display:none}
:root[data-short="true"][data-layout="wide"] .hand-score-panel .btn{min-height:19px;padding:2px}
:root[data-short="true"][data-layout="wide"] .stat strong{font-size:16px;white-space:nowrap}
:root[data-short="true"][data-layout="wide"] .stat.cash strong,:root[data-short="true"][data-layout="wide"] .stat.ante strong{font-size:14px}
:root[data-tiny="true"][data-layout="wide"] .hand-score-panel .play-summary{gap:2px}
:root[data-tiny="true"][data-layout="wide"] .hand-score-panel .last-score{font-size:15px}
:root[data-tiny="true"][data-layout="wide"] .round-panel{padding:4px 6px}
:root[data-tiny="true"][data-layout="wide"] .hand-score-panel{padding:5px 6px}
:root[data-tiny="true"][data-layout="wide"] .score-panel{padding:5px 6px}

/* Task 17 additions. Functional text remains live and can wrap in either locale. */
[class~="17-game-ui-field"]{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:9px 0;font-size:13px}
[class~="17-game-ui-field"] select{min-width:0;max-width:68%;padding:8px;border:1px solid var(--line);border-radius:6px;background:#173c33;color:var(--ink);font:inherit;min-height:36px}
[class~="17-game-ui-field"] input[type="checkbox"]{width:24px;height:24px;accent-color:var(--yellow)}
[class~="17-game-ui-field"] input[type="range"]{width:50%;accent-color:var(--yellow)}
[class~="17-game-ui-menu-actions"]{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 8px}
[class~="17-game-ui-challenges"],[class~="17-game-ui-profiles"]{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px}
[class~="17-game-ui-challenges"] .panel,[class~="17-game-ui-profiles"] .panel{padding:12px;display:flex;flex-direction:column;justify-content:space-between;gap:12px}
[class~="17-game-ui-progress"]{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:10px}
[class~="17-game-ui-progress-title"]{margin-top:18px}
[class~="17-game-ui-pack-origin"]{font-size:11px;color:var(--muted)}
:root[data-17-game-ui-contrast="true"] .card{outline:1px solid #e9edcf;filter:saturate(1.2)}
:root[data-view="menu"] .menu-copy h1{font-size:clamp(30px,4vw,48px);overflow-wrap:anywhere}
:root[data-view="menu"] .new-game-box .deck-info select{width:100%;max-width:100%;font-size:13px}
:root[data-view="menu"] .top-actions{flex-wrap:wrap;justify-content:flex-end;gap:5px}
html[lang="en"] .game-foot{font-size:8px}
html[lang="en"] .hands-table tbody th{white-space:normal;line-height:1.1}
html[lang="en"] .hand-topline .section-label{font-size:10px}
html[lang="en"] .shop-items .shop-card>strong{line-height:11px}
:root[data-view="game"] .top-actions .icon-btn{padding-inline:7px}
@media(max-width:540px){
  .topbar .brand-title,.topbar .brand-divider,.topbar .sub{display:none}
  :root[data-view="game"] .top-actions .icon-btn{font-size:10px;min-height:30px;padding:5px}
  :root[data-view="game"] .brand img{width:66px}
  :root[data-view="menu"] .menu{padding-top:12px}
  :root[data-view="menu"] .menu-copy h1{font-size:30px}
  [class~="17-game-ui-menu-actions"] .btn{flex:1 1 90px}
  .hand-topline>.row{gap:4px}
  .game-foot{overflow:hidden}
}
@media(max-height:500px) and (orientation:landscape){
  :root[data-view="menu"] .menu{overflow-y:auto;max-height:calc(var(--app-height) - var(--topbar-height));display:grid;grid-template-columns:minmax(0,.8fr) minmax(280px,1fr);gap:15px}
  :root[data-view="menu"] .menu-art{display:flex;flex-direction:column;justify-content:center}
  :root[data-view="menu"] .menu-copy h1{font-size:25px;margin-bottom:5px}
  :root[data-view="menu"] .menu-copy .intro{font-size:12px;line-height:1.4;margin-bottom:10px}
  :root[data-view="menu"] .hero-cards{margin-top:8px}
  :root[data-view="menu"] .new-game-box{padding:10px}
}
/* Multi-voucher offers share the lower row by actual item count. */
.shop-grid[data-arrangement="stack"]{grid-template-columns:minmax(0,var(--voucher-weight,1fr)) minmax(0,2fr)}
@container(max-width:90px){
  .shop-card .shop-item-actions{height:52px;grid-template-columns:minmax(0,1fr);grid-template-rows:18px 30px;gap:4px;justify-items:stretch}
  .shop-card .shop-item-actions .price-tag{font-size:14px;text-align:center;line-height:1}
  .shop-card .shop-item-actions>.btn{height:30px;min-height:30px;padding:2px;font-size:10px}
}
[class~="17-game-ui-profile-name"],#profile-new-name{width:100%;min-width:0;min-height:34px;border:1px solid var(--line);border-radius:6px;background:#173c33;color:var(--ink);font:inherit;padding:5px}
.hand-actions .icon-btn{min-width:40px}
@media(max-width:340px){.hand-actions .btn{min-width:88px;padding-inline:8px}}
:root[data-17-game-ui-reduced="true"] .card,:root[data-17-game-ui-reduced="true"] .score-feedback{animation:none!important;transition:none!important}
/* Long category labels leave a measured row for real cards and empty slots. */
.inventory-zone .section-label{min-width:0;max-width:50px;flex:0 1 auto;overflow-wrap:anywhere;white-space:normal}
.inventory-zone .section-label span{white-space:nowrap}
.joker-row,.consumable-row{min-width:0;flex:1 1 0}
/* Round2: real run inventory/notice controls; none join the shop product grid. */
[class~="17-game-ui-run-assets-hud"]{grid-column:1/-1;display:flex;align-items:center;gap:5px;min-width:0;max-width:100%;overflow-x:auto;scrollbar-width:thin}
[class~="17-game-ui-run-assets-hud"]>.icon-btn{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;min-width:28px;min-height:28px;padding:2px 5px}
[class~="17-game-ui-run-assets-hud"] [class*="tag-icon"]{width:24px;height:24px}
[class~="17-game-ui-boss-reroll"]{display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;margin-top:6px;font-size:12px}
[class~="17-game-ui-notice-badge"]{padding:3px 5px;min-width:28px;color:var(--yellow,#f0ce62)}
[class~="17-game-ui-notice"]{position:fixed;z-index:18;top:64px;right:8px;width:min(260px,70vw);padding:8px 32px 8px 10px;border:1px solid #d7b95d;border-radius:8px;background:#172f29eF;box-shadow:0 4px 14px #0005;pointer-events:none;font-size:12px}
[class~="17-game-ui-notice"] p{margin:3px 0;max-height:2.8em;overflow:hidden}
[class~="17-game-ui-notice-dismiss"]{position:absolute;right:2px;top:2px;min-width:28px;min-height:28px;pointer-events:auto}
[class~="17-game-ui-notice-row"]{padding:8px;border-bottom:1px solid #ffffff20}
.game-foot{flex-wrap:wrap}.game-foot>span:last-child{display:flex;flex-wrap:wrap;gap:3px}
@media(max-width:500px){[class~="17-game-ui-skip"]{font-size:10px;padding:3px 5px;min-height:26px}.top-actions{gap:4px}}
[class~="17-game-ui-boss-controls"]{display:flex;gap:4px;justify-content:center;align-items:stretch;flex-wrap:wrap;width:100%}
[class~="17-game-ui-boss-controls"]>[class~="17-game-ui-boss-reroll"]{margin:0;flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
[class~="17-game-ui-boss-controls"]>.btn{flex:1;min-width:0}
[class~="17-game-ui-boss-controls"] [class~="17-game-ui-boss-reroll"]>.btn{width:100%;white-space:normal;line-height:1.15;min-height:32px}
[class~="17-game-ui-boss-controls"] [class~="17-game-ui-boss-reroll"]>span{font-size:10px;line-height:1.1}
html[data-short=true] [class~="17-game-ui-boss-controls"] .btn{font-size:11px;padding:5px 4px;min-height:28px}
/* Bound blind targets in short windows and narrow portrait; shop keeps its own grid. */
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage:has(.blind-options){overflow:hidden;gap:5px;padding:6px}
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage:has(.blind-options)>.stage-heading{margin:0;flex:none}
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage:has(.blind-options)>.stage-heading h2{font-size:16px;line-height:1.2}
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage:has(.blind-options)>.stage-heading p,
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage:has(.blind-options)>.stage-heading .eyebrow{display:none}
:root:is([data-short="true"],[data-layout="narrow"]) .table-stage>.blind-options{flex:1 1 0;min-height:0;width:100%;gap:6px}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-option{min-height:0;display:flex;flex-direction:column}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-type{padding:4px!important;line-height:1.1}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content{min-height:0;flex:1;padding:5px;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:11px}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content .blind-chip{width:20px;height:20px;background-size:420px 620px;margin:0;flex:none}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content .number{font-size:23px;line-height:1;margin:0}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content .desc{min-height:0;flex:1;overflow:auto;max-width:100%;font-size:10px;line-height:1.15}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content .reward{margin:0;font-size:9px}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content>.btn{width:100%;min-height:28px;padding:4px;font-size:10px;flex:none}
:root:is([data-short="true"],[data-layout="narrow"]) .blind-content .skip{width:100%;padding:3px 0;line-height:1.1;min-height:28px;flex:none}

/* Portrait controls keep a full touch target; short windows retain the existing compact limit. */
:root[data-layout="narrow"][data-short="false"] .blind-content>.btn,
:root[data-layout="narrow"][data-short="false"] .blind-content .skip{min-height:44px}

/* Keep each consumable face reachable; excess cards use a touch-scroll lane. */
.consumable-row{overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;touch-action:pan-x}
:root[data-layout="narrow"] .inventory-zone:has(.consumable-row){flex-direction:column;align-items:stretch;gap:2px;padding:3px 5px}
:root[data-layout="narrow"] .inventory-zone:has(.consumable-row)>.section-label{flex:0 0 auto;flex-direction:row;align-items:center;justify-content:space-between;gap:4px;max-width:none;line-height:1;white-space:nowrap}
:root[data-layout="narrow"] .consumable-row{height:auto;flex:1 1 0;gap:4px}

/* UI17 blind-selection action targets: real button boxes, including nested Boss actions. */
:root[data-view="game"][data-phase="blind"] .table-stage>.blind-options button:is([data-action="blind"],[data-action="skip"],[data-action="reroll-boss"]){min-height:44px;height:auto;min-width:44px;max-width:100%;flex-shrink:0;white-space:normal;overflow-wrap:break-word}
:root[data-view="game"][data-phase="blind"] .table-stage>.blind-options [class~="17-game-ui-boss-controls"]>[class~="17-game-ui-boss-reroll"]{min-width:44px;max-width:100%}
:root[data-view="game"][data-phase="blind"] .table-stage>.blind-options [class~="17-game-ui-boss-controls"]{gap:2px}
/* Recover decorative space in the existing compact blind layouts; retain every text/action. */
:root[data-view="game"][data-phase="blind"]:is([data-short="true"],[data-layout="narrow"]) .table-stage>.blind-options .blind-content{padding:2px;gap:1px}
:root[data-view="game"][data-phase="blind"]:is([data-short="true"],[data-layout="narrow"]) .table-stage>.blind-options .blind-content>.blind-chip{width:12px;height:12px;background-size:252px 372px}
:root[data-view="game"][data-phase="blind"][data-short="true"] .table-stage>.blind-options .blind-content>.desc{min-height:2.3em}

/* UI17 app-owned modal header: reserve the close button's actual touch box. */
dialog#modal>.modal-head{gap:8px}
dialog#modal>.modal-head>#modal-title{min-width:0;overflow-wrap:anywhere}
dialog#modal>.modal-head>.icon-btn[data-action="close"]{min-width:44px;min-height:44px;flex-shrink:0}

/* UI23: one inset frame follows the actual card, including focus and score states. */
:is(.card,.task-02-card-view-card):is(.selected,[data-02-card-view-selected="true"],:focus-visible,[aria-expanded="true"],.scoring,.drop-target){outline:none!important;box-shadow:none!important;overflow:hidden}
:is(.card,.task-02-card-view-card):is(.selected,[data-02-card-view-selected="true"],:focus-visible,[aria-expanded="true"],.scoring,.drop-target)::after{content:"";position:absolute;inset:0;z-index:6;border:2px solid var(--yellow,#f5c75d);border-radius:inherit;background:none;box-shadow:none;pointer-events:none}

/* UI23: a compact home screen, bounded by the browser's visible viewport. */
:root[data-view="menu"],:root[data-view="menu"] body{height:var(--app-height,100dvh);min-height:0;overflow:hidden}
:root[data-view="menu"] #app{height:100%;min-height:0;display:flex;flex-direction:column}
:root[data-view="menu"] .topbar{height:clamp(40px,7dvh,60px);min-height:0;flex:none;padding:4px 12px}
:root[data-view="menu"] .brand img{width:80px;height:40px;object-fit:contain}
:root[data-view="menu"] .top-actions{flex-wrap:nowrap;gap:5px}
:root[data-view="menu"] .top-actions .icon-btn{min-height:32px;padding:6px 9px;font-size:12px}
:root[data-view="menu"] .menu{width:100%;max-width:1000px;min-height:0;max-height:none;flex:1 1 0;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;align-content:stretch;align-items:center;gap:12px 32px;padding:16px 24px 10px;overflow:visible}
:root[data-view="menu"] .menu-art{min-width:0;min-height:0;height:100%;position:relative;display:grid;place-items:center;isolation:isolate}
:root[data-view="menu"] .big-logo{position:absolute;inset:0;margin:auto;z-index:2;max-width:100%;width:100%;max-height:100%;height:100%;object-fit:contain}
:root[data-view="menu"] .hero-cards{position:absolute;z-index:0;inset:0;margin:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;pointer-events:none}
:root[data-view="menu"] .hero-cards .card{--card-w:clamp(66px,9vw,108px);margin:0 -5px}
:root[data-view="menu"] .hero-cards .card:nth-child(1){transform:rotate(-20deg) translate(-12%,-10%)}
:root[data-view="menu"] .hero-cards .card:nth-child(2){transform:rotate(-8deg) translateY(-22%)}
:root[data-view="menu"] .hero-cards .card:nth-child(3){transform:rotate(8deg) translateY(-22%)}
:root[data-view="menu"] .hero-cards .card:nth-child(4){transform:rotate(20deg) translate(12%,-10%)}
:root[data-view="menu"] .menu-copy{min-width:0;min-height:0;max-width:460px;width:100%;justify-self:center;display:grid;grid-template-rows:minmax(0,1fr) auto;gap:8px}
:root[data-view="menu"] .new-game-box{min-height:0;padding:16px;display:grid;grid-template-columns:minmax(0,1fr);gap:9px}
:root[data-view="menu"] .box-heading{margin:0;font-size:15px}
:root[data-view="menu"] .deck-picker{margin:0;gap:12px;min-width:0}
:root[data-view="menu"] .deck-picker .card{--card-w:54px}
:root[data-view="menu"] .menu-selects{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:8px}
:root[data-view="menu"] .menu-selects label{display:grid;gap:3px;min-width:0;font-size:11px;color:var(--muted)}
:root[data-view="menu"] .menu-selects select{width:100%;max-width:100%;min-height:34px;padding:5px 18px 5px 7px;font-size:12px;color:var(--ink)}
:root[data-view="menu"] .deck-info p{margin:5px 0 0;font-size:11px;line-height:1.35;overflow-wrap:anywhere}
:root[data-view="menu"] .seed-row{margin:0;min-width:0;gap:8px}
:root[data-view="menu"] .seed-row input{width:0;min-height:34px;padding:7px 9px;letter-spacing:0;font-size:11px}
:root[data-view="menu"] .new-game-box>.btn{margin:0;min-height:38px;padding:7px 12px;font-size:13px}
:root[data-view="menu"] .new-game-box>.btn.yellow{min-height:42px}
:root[data-view="menu"] [class~="17-game-ui-menu-actions"]{margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
:root[data-view="menu"] [class~="17-game-ui-menu-actions"] .btn{min-height:32px;min-width:0;padding:5px;font-size:11px;white-space:normal}
:root[data-view="menu"] .menu-footer{min-height:0;grid-column:1/-1;margin:0;padding:0;border:0;display:flex;justify-content:center}
:root[data-view="menu"] .menu-footer .icon-btn{min-height:20px;padding:2px 8px;font-size:10px}
.menu-assistive{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:600px) and (orientation:portrait){
 :root[data-view="menu"] .topbar{padding:3px 8px;gap:6px}
 :root[data-view="menu"] .brand img{width:64px;height:34px}
 :root[data-view="menu"] .brand-title,:root[data-view="menu"] .brand-divider,:root[data-view="menu"] .sub,:root[data-view="menu"] .pill,:root[data-view="menu"] .fullscreen{display:none}
 :root[data-view="menu"] .top-actions .icon-btn{min-height:30px;padding:5px 6px;font-size:10px}
 :root[data-view="menu"] .menu{grid-template-columns:minmax(0,1fr);grid-template-rows:clamp(64px,calc((var(--app-height,100dvh) - 400px)*.7),144px) minmax(0,1fr) 20px;gap:6px;padding:6px 12px 8px;align-items:center}
 :root[data-view="menu"] .menu-art{height:100%}
 :root[data-view="menu"] .big-logo{height:100%;width:100%}
 :root[data-view="menu"] .hero-cards .card{--card-w:clamp(42px,12vw,64px);margin:0 -4px}
 :root[data-view="menu"] .menu-copy{max-width:400px;gap:6px}
 :root[data-view="menu"] .new-game-box{padding:10px;gap:6px}
 :root[data-view="menu"] .box-heading{font-size:13px}
 :root[data-view="menu"] .deck-picker{gap:9px}
 :root[data-view="menu"] .deck-picker .card{--card-w:42px}
 :root[data-view="menu"] .menu-selects{gap:5px}
 :root[data-view="menu"] .menu-selects label{font-size:10px}
 :root[data-view="menu"] .menu-selects select{min-height:30px;font-size:11px}
 :root[data-view="menu"] .deck-info p{font-size:10px;line-height:1.3}
 :root[data-view="menu"] .seed-row input{min-height:30px;padding:5px 7px}
 :root[data-view="menu"] .new-game-box>.btn{min-height:32px;padding:6px;font-size:12px}
 :root[data-view="menu"] .new-game-box>.btn.yellow{min-height:38px}
}
@media(max-height:550px){
 :root[data-view="menu"] .menu{padding:5px 12px;gap:5px 18px}
 :root[data-view="menu"] .new-game-box{padding:8px;gap:5px}
 :root[data-view="menu"] .new-game-box>.btn{min-height:30px;padding:4px 7px;font-size:11px}
 :root[data-view="menu"] .new-game-box>.btn.yellow{min-height:34px}
 :root[data-view="menu"] .deck-picker .card{--card-w:36px}
 :root[data-view="menu"] .menu-selects select{min-height:28px}
 :root[data-view="menu"] .deck-info p{font-size:10px}
 :root[data-view="menu"] .seed-row input{min-height:28px;padding:4px 7px}
 :root[data-view="menu"] .menu-footer .icon-btn{min-height:18px}
}

/* Shop: reserve the full workspace for owned cards and products. */
:root[data-view="game"][data-phase="shop"] .workspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
:root[data-view="game"][data-phase="shop"] .workspace>.sidebar{display:none}
:root[data-view="game"][data-phase="shop"]{--inventory-height:clamp(76px,calc(var(--app-height)*.12),128px);--inventory-card-width:clamp(28px,calc((var(--inventory-height) - 12px)*71/95),82px)}
:root[data-view="game"][data-phase="shop"] .inventory{grid-template-rows:minmax(0,1fr)}
:root[data-view="game"][data-phase="shop"] .inventory:has([class~="17-game-ui-run-assets-hud"]){grid-template-rows:minmax(0,1fr) 28px;--inventory-card-width:clamp(22px,calc((var(--inventory-height) - 42px)*71/95),68px);row-gap:2px}
:root[data-view="game"][data-phase="shop"] .inventory-zone{height:auto;min-height:0}
:root[data-view="game"][data-phase="shop"] [class~="17-game-ui-run-assets-hud"]{height:28px;min-height:0}

:root[data-view="menu"] .menu-save-policy{font-size:10px;line-height:1.35;margin:0}

/* Narrow adjacent card information must wrap its heading and retain its close target. */
.card-info-head h3{min-width:0;overflow-wrap:anywhere}
.card-info-head .info-close{flex-shrink:0}
