/* The play board fits the viewport. Long reference dialogs keep their own scroll. */
html{height:100%;overflow:hidden;overscroll-behavior:none}
body{height:100vh;height:100dvh;min-height:0;overflow:hidden;display:grid;grid-template-rows:56px minmax(0,1fr);padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}
.topbar{min-height:0;height:100%;padding:6px 22px;gap:12px}.brand{font-size:20px}.brand-mark{font-size:34px}.brand small{font-size:9px;margin-top:3px}.topbar nav{gap:7px}.topbar .quiet,.topbar .icon-button{min-height:38px;padding:6px 11px}.fullscreen-button{white-space:nowrap}.app-shell{width:100%;height:100%;min-height:0;grid-template-columns:220px minmax(0,1fr);margin:0 auto;max-width:1800px}.sidebar{min-height:0;overflow:hidden;padding:18px;gap:0}.profile{margin-bottom:14px}.avatar{height:44px}.stats{gap:7px;margin:14px 0 18px}.dungeon-path{margin:12px 0 16px}.dungeon-path li{min-height:clamp(34px,5.5vh,58px);font-size:12px}.dungeon-path li:not(:last-child):after{top:calc(50% + 16px);height:calc(100% - 32px)}.relic-heading{padding-top:14px}.relics{gap:6px;margin:12px 0}.relic{height:36px;width:36px;font-size:21px}.side-bottom{padding-top:12px}.side-bottom p{display:none}.side-bottom>span{display:none}.deck-button{min-height:36px}.sidebar .profile h2{font-size:12px}
main{height:100%;min-height:0;min-width:0;padding:12px 22px;display:flex;flex-direction:column;gap:6px;position:relative}.chapter{margin:0;flex:0 0 auto;min-height:35px}.chapter h1{font-size:22px;line-height:1.2;margin:3px 0}.chapter .eyebrow{font-size:10px}.arena{height:auto;min-height:100px;flex:1 1 0;background-position:center 36%}.enemy-info{bottom:20px}.enemy-intent{left:auto;right:20px;bottom:20px;padding:7px 10px}.enemy-intent small{display:block}.enemy-health{max-width:50%}.enemy-info h2{font-size:24px}.enemy-rule{flex:0 0 26px;min-height:26px;display:flex;align-items:center;gap:8px;background:none;border:0;border-bottom:1px solid var(--line);padding:2px 0;text-align:left;min-width:0;color:#bdcaaf}.enemy-rule #enemyRule{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;flex:1;min-width:0}.enemy-rule b{font-size:12px;color:var(--gold);font-weight:500;flex:none}.battle-message{flex:0 0 29px;min-height:0;max-height:29px;padding:0;align-items:center;overflow:hidden}.battle-message p{font-size:13px;line-height:1.1;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.hand-area{flex:0 0 auto;min-height:0;display:flex;flex-direction:column;gap:5px}.hand-header{margin:0;min-height:30px;gap:10px}.hand-header>div:first-child{display:flex;align-items:center;gap:10px}.hand-header h2{font-size:16px}.hand-header>div>span{font-size:12px;margin:0}.hand-tools{gap:12px}.hand-tools .text-button,.potion{font-size:13px}.potion{padding:4px 8px;min-height:30px}.cards{grid-template-columns:repeat(8,minmax(0,1fr));gap:9px;padding:12px 5px 7px;max-width:1120px;width:100%;margin:0 auto}.cards .card{height:clamp(64px,14vh,135px);height:clamp(64px,14dvh,135px);min-width:0}.cards .card .corner{font-size:clamp(18px,2.8vh,24px)}.cards .card .suit{font-size:clamp(28px,5vh,44px)}.cards .card.selected{transform:translateY(-8px)}.cards .card.selected:hover:not(:disabled){transform:translateY(-10px)}.effect-preview{min-height:18px;max-height:32px;line-height:1.25;padding:0 4px;gap:2px 10px;font-size:12px;overflow:hidden}.action-panel{position:static;bottom:auto;flex-wrap:nowrap;min-height:56px;padding:8px 13px;gap:14px;box-shadow:none}.hand-score{min-width:140px}.hand-score small{font-size:9px;margin-bottom:3px}.hand-score strong{font-size:16px}.damage-score{padding-left:12px}.damage-score strong{font-size:28px}.action-buttons{flex:0 0 auto}.action-buttons .attack,.action-buttons .discard{min-height:40px;padding:8px 13px}.hand-footer{margin:0;min-height:20px;font-size:11px}.hand-footer .text-button{font-size:12px;padding:0}.mobile-relics{display:none!important}.travel-actions{position:absolute;inset:auto 22px 12px;z-index:6;margin:0;padding:12px;background:#17211af2;border:1px solid #74633d;border-radius:5px}.view-status{position:fixed;z-index:40;top:65px;right:18px;max-width:min(380px,calc(100vw - 36px));padding:12px 16px;background:#24321f;color:#e8eddc;border:1px solid var(--gold);border-radius:5px;box-shadow:0 8px 30px #0008;font-size:14px}.immersive .brand small{display:none}.immersive body{grid-template-rows:44px minmax(0,1fr)}
dialog{max-height:calc(100vh - 20px);max-height:calc(100dvh - 20px);overscroll-behavior:contain;overflow-y:auto}.dialog-inner{padding:24px}.deck-pages{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:15px}.deck-pages span{font-size:13px;color:#b9caa9}.deck-pages button{min-height:38px}.deck-grid{grid-template-columns:repeat(6,minmax(0,1fr))}.deck-grid .card{height:90px}
@media(max-height:760px) and (min-width:851px){.sidebar{padding:12px 16px}.sidebar .profile{margin-bottom:10px}.sidebar .stats{gap:5px;margin:10px 0}.sidebar .dungeon-path{margin:8px 0}.sidebar .relics{margin:8px 0}.sidebar .relics p{font-size:12px}.side-bottom{padding-top:4px}.sidebar .relic-heading{padding-top:9px}.sidebar .path-text small{display:none}.sidebar .side-title{font-size:11px}.sidebar .relic{height:30px;width:30px;font-size:18px}}
@media(max-height:620px) and (min-width:851px){.sidebar .profile small,.sidebar .side-title,.sidebar .dungeon-path,.sidebar .relics p{display:none}.sidebar .relics{margin:10px 0}.sidebar .deck-button{margin-top:auto}.chapter h1{font-size:18px}.chapter{min-height:30px}.enemy-title,.enemy-intent small{display:none}.enemy-info h2{font-size:21px}.arena-top{top:10px}.status-badges{top:44px}.cards .card .bottom{display:none}.cards .card .suit{position:absolute;right:9px;bottom:12px}.battle-message{flex-basis:24px;max-height:24px}.action-panel{min-height:48px}.hand-header{min-height:28px}}
@media(max-width:850px){body{grid-template-rows:50px minmax(0,1fr)}.app-shell{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:48px minmax(0,1fr)}.topbar{padding:5px 14px;gap:9px}.brand{font-size:18px;gap:7px}.brand-mark{font-size:30px}.brand small{font-size:8px}.save-state{display:none}.sidebar{height:48px;padding:6px 15px;display:grid;grid-template-columns:auto minmax(90px,1fr) minmax(185px,1.4fr);grid-template-rows:18px 7px;gap:4px 15px;align-content:center}.profile{grid-column:1;grid-row:1 / 3;margin:0}.profile .avatar{width:28px;height:30px;font-size:23px}.profile>div:last-child{display:none}.health-label{grid-column:2;grid-row:1;align-self:center;font-size:12px;margin:0}.meter.player{grid-column:2;grid-row:2}.stats{grid-column:3;grid-row:1 / 3;display:flex;margin:0;gap:10px;align-items:center}.stats>div{gap:4px;font-size:12px;flex:1;white-space:nowrap}.stats>div>span:nth-child(2){display:none}.stats>div>span:first-child{font-size:17px;width:auto}.stats b{margin-left:0}.sidebar>.side-title,.sidebar>.dungeon-path,.sidebar>.relics,.sidebar>.side-bottom,.sidebar>.deck-button{display:none}.mobile-deck{display:block;min-height:30px;padding:4px 9px;font-size:12px}.chapter{min-height:29px}.chapter h1{font-size:18px}.chapter .eyebrow{font-size:10px}main{padding:8px 15px;gap:4px}.enemy-info{bottom:48px;left:15px;right:15px}.enemy-intent{left:15px;right:auto;bottom:10px;padding:3px 7px;min-height:28px}.enemy-intent small{display:none}.enemy-health{max-width:95%;width:280px}.enemy-info h2{font-size:21px;margin:3px 0 7px}.enemy-title{display:none}.arena-top{top:10px;left:15px;right:15px;font-size:10px}.encounter-label{padding:4px 7px}.status-badges{top:42px;left:15px}.status-badge{font-size:10px;padding:2px 6px}.hand-header>div:first-child{display:flex}.hand-header>div>span{display:block}.action-panel{display:flex;gap:12px}.hand-score{min-width:120px}.action-buttons{display:flex;grid-column:auto}.damage-score{border:0;padding:0}.cards{gap:7px}.cards .card{height:clamp(68px,13dvh,115px)}.dialog-inner{padding:20px}.hand-footer{font-size:11px}.view-status{top:57px}}
@media(max-width:620px){.topbar{padding:4px 10px;gap:6px}.brand{font-size:16px;letter-spacing:.6px}.brand-mark{font-size:26px}.brand small{display:none}.topbar .quiet span{display:none}.topbar .quiet,.topbar .icon-button{min-width:36px;min-height:36px;padding:5px 8px}.topbar nav{gap:5px}.sidebar{padding:5px 11px;grid-template-columns:minmax(100px,1.2fr) minmax(150px,1.4fr);column-gap:20px}.profile{display:none}.health-label{grid-column:1}.meter.player{grid-column:1}.stats{grid-column:2}.chapter{min-height:24px}.chapter h1{display:none}.chapter .eyebrow{font-size:10px;letter-spacing:.7px}.chapter .mobile-deck{min-height:26px;padding:3px 8px}main{padding:6px 10px;gap:3px}.arena{min-height:105px}.enemy-info h2{font-size:18px}.enemy-info{bottom:44px;left:12px}.enemy-health{font-size:11px}.enemy-intent{left:12px;bottom:8px;padding:2px 6px}.enemy-intent div>span{font-size:12px}.intent-icon{font-size:16px}.arena-top{left:12px;right:12px;top:8px;font-size:9px}.status-badges{top:35px;left:12px}.enemy-rule{flex-basis:24px;min-height:24px}.enemy-rule #enemyRule{font-size:12px}.battle-message{flex-basis:28px;max-height:28px}.battle-message p{font-size:12px}.hand-area{gap:3px}.hand-header{min-height:29px}.hand-header>div:first-child{display:block}.hand-header h2{display:none}.hand-header>div>span{font-size:11px}.hand-tools{gap:9px}.hand-tools .text-button,.potion{font-size:12px}.potion{min-height:29px;padding:3px 6px}.cards{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,auto);gap:12px 9px;padding:9px 3px 5px;max-width:470px}.cards .card{height:clamp(48px,calc((100dvh - 440px) / 3),90px);border-radius:5px}.cards .card .corner{font-size:20px;top:5px;left:7px}.cards .card .corner i{font-size:13px}.cards .card .bottom{display:none}.cards .card .suit{position:absolute;right:10px;bottom:9px;font-size:32px}.cards .card .enchant-mark{top:5px;right:6px;width:16px;height:16px;font-size:12px}.cards .card:after{inset:4px}.selected-mark{bottom:-6px;width:14px;height:14px;line-height:14px;font-size:10px;left:calc(50% - 7px)}.effect-preview{min-height:15px;max-height:30px;font-size:11px;line-height:1.2;gap:1px 7px;padding:0}.action-panel{display:grid;grid-template-columns:minmax(65px,1fr) 30px auto;gap:7px;padding:7px 8px;min-height:51px}.hand-score{min-width:0}.hand-score small{display:none}.hand-score strong{font-size:12px;line-height:1.2;display:block}.damage-score{display:flex;flex-direction:column;gap:0;line-height:1.1;align-items:center}.damage-score strong{font-size:23px}.damage-score span{font-size:8px}.action-buttons{display:flex;gap:5px;grid-column:auto;flex:0 0 auto;margin:0}.action-buttons .attack,.action-buttons .discard{min-height:36px;padding:7px 8px;font-size:12px;white-space:nowrap}.discard span{font-size:10px;margin-left:4px}.hand-footer{min-height:19px;gap:8px;font-size:10px;line-height:1.2}.hand-footer .text-button{font-size:11px}.travel-actions{inset:auto 10px 6px;padding:7px}.travel-actions .attack{min-height:36px;margin:0}.deck-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.deck-grid .card{height:82px}.deck-pages button{font-size:12px}.deck-pages span{font-size:12px}.dialog-inner{padding:18px}.dialog-top h2{font-size:20px}.immersive body{grid-template-rows:40px minmax(0,1fr)}}
/* A landscape phone uses two columns instead of stacking the battlefield above cards. */
@media(max-height:540px) and (min-width:520px) and (orientation:landscape){body{grid-template-rows:42px minmax(0,1fr)}.app-shell{display:grid;grid-template-columns:1fr;grid-template-rows:38px minmax(0,1fr)}.sidebar{height:38px;display:grid;grid-template-columns:minmax(90px,1fr) minmax(200px,1fr);grid-template-rows:16px 6px;padding:3px 18px;gap:3px 30px;border-bottom:1px solid var(--line);border-right:0}.sidebar .profile,.sidebar>.side-title,.sidebar>.dungeon-path,.sidebar>.relics,.sidebar>.side-bottom,.sidebar>.deck-button{display:none}.sidebar .health-label{grid-column:1;grid-row:1;font-size:12px;margin:0}.sidebar .meter.player{grid-column:1;grid-row:2}.sidebar .stats{grid-column:2;grid-row:1 / 3;display:flex;margin:0;gap:15px}.sidebar .stats>div{flex:1;font-size:12px}.sidebar .stats>div>span:nth-child(2){display:none}.sidebar .stats b{margin-left:0}.topbar{padding:3px 16px}.topbar .brand small{display:none}.topbar .brand{font-size:17px}.topbar .quiet,.topbar .icon-button{min-height:32px;padding:3px 8px}.save-state{display:none}.brand-mark{font-size:25px}main{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);grid-template-rows:24px minmax(70px,1fr) 24px 28px;gap:5px 14px;padding:5px 14px}.chapter{grid-column:1;grid-row:1;min-height:0}.chapter h1{display:none}.chapter .mobile-deck{display:block;min-height:24px;padding:2px 8px}.arena{grid-column:1;grid-row:2;min-height:70px;height:100%}.enemy-rule{grid-column:1;grid-row:3;min-height:0}.battle-message{grid-column:1;grid-row:4;min-height:0}.hand-area{grid-column:2;grid-row:1 / 5;display:flex;gap:3px;min-height:0}.hand-header{min-height:27px}.hand-header h2{display:none}.hand-header>div>span{font-size:11px}.potion{min-height:27px;font-size:12px}.hand-tools .text-button{font-size:12px}.cards{flex:1;min-height:0;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));gap:10px 8px;padding:9px 4px 5px}.cards .card{height:100%;min-height:34px}.cards .card .corner{font-size:18px;top:4px;left:6px}.cards .card .corner i{font-size:12px}.cards .card .bottom{display:none}.cards .card .suit{position:absolute;right:9px;bottom:6px;font-size:28px}.effect-preview{font-size:10px;min-height:13px;max-height:24px}.action-panel{display:flex;min-height:44px;padding:5px 7px;gap:7px}.hand-score{min-width:0;flex:1}.hand-score small{display:none}.hand-score strong{font-size:12px}.damage-score{padding:0;gap:3px}.damage-score strong{font-size:22px}.damage-score span{display:none}.action-buttons{gap:5px}.action-buttons .attack,.action-buttons .discard{min-height:32px;padding:6px 8px;font-size:12px}.discard span{font-size:10px;margin-left:3px}.hand-footer{min-height:15px;font-size:10px;gap:8px}.hand-footer .text-button{font-size:10px}.enemy-info{bottom:40px;left:12px;right:12px}.enemy-info h2{font-size:18px;margin:3px 0 6px}.enemy-title{display:none}.enemy-health{max-width:100%;width:230px;font-size:11px}.enemy-intent{left:12px;right:auto;bottom:7px;padding:2px 6px}.enemy-intent small{display:none}.enemy-intent div>span{font-size:11px}.intent-icon{font-size:16px}.arena-top{top:7px;left:12px;right:12px;font-size:9px}.encounter-label{padding:3px 5px}.status-badges{top:33px;left:12px}.status-badge{font-size:9px}.travel-actions{inset:auto 14px 6px auto;width:50%;padding:6px}.view-status{top:47px}.dialog-inner{padding:14px 20px}.dialog-top h2{font-size:20px}}

@media(max-height:550px) and (max-width:519px){body{grid-template-rows:42px minmax(0,1fr)}.app-shell{grid-template-rows:40px minmax(0,1fr)}.sidebar{height:40px}.cards{grid-template-columns:repeat(8,minmax(0,1fr));grid-template-rows:auto;gap:4px;padding:8px 1px 5px}.cards .card{height:56px}.cards .card .corner{font-size:16px;left:4px;top:4px}.cards .card .corner i{font-size:12px}.cards .card .suit{display:none}.cards .card .enchant-mark{right:3px;top:auto;bottom:5px;width:12px;height:12px;font-size:9px}.arena{min-height:85px}.hand-footer{display:none}.chapter{min-height:20px}.enemy-info h2{font-size:16px}.enemy-info{bottom:35px}.enemy-intent{bottom:4px}.arena-top{font-size:8px}.status-badges{top:30px}.view-status{top:48px}}
