/* One physical card size for god, temple, equipment and the resource row. */
.battle-page{--card-width:54px;--card-height:calc(var(--card-width) * 1039 / 744)}
.battle-page .topbar{height:45px}.battle-top{padding:6px 16px;min-height:40px;font-size:11px}.battle-top .row{gap:8px}.battle-top button{font-size:10px;padding:6px 8px}
.battle-layout{grid-template-columns:170px minmax(400px,1fr) 250px;min-height:calc(100dvh - 85px)}.battle-sidebar{padding:14px 12px}.battle-sidebar.right{display:block}.battle-sidebar button{margin-top:0}.battle-sidebar.right{position:sticky;top:0;align-self:start;max-height:calc(100dvh - 85px);overflow:auto}.battle-sidebar .full-preview{margin:8px auto}.battle-page .arena{padding:7px 14px 0}
.playmat{position:relative;z-index:1;display:grid;align-items:start;gap:3px 7px;padding:4px 7px;grid-template-columns:minmax(62px,1.1fr) .35fr 1fr 1fr 1fr .35fr minmax(62px,1.1fr);grid-template-rows:auto auto var(--card-height);grid-template-areas:"grave . . character . . evolution" "grave . temple weapon armor . evolution" "extra resources resources resources resources resources deck";border:1px solid #bfa25f26;border-radius:4px;background:linear-gradient(125deg,#b3a06407,#1c3c4825)}
.opponent-mat{grid-template-rows:var(--card-height) auto auto;grid-template-areas:"deck resources resources resources resources resources extra" "evolution . armor weapon temple . grave" "evolution . . character . . grave";background:linear-gradient(305deg,#b3a06407,#1c3c4825)}
.field-zone{min-width:0;text-align:center;position:relative}.field-character{grid-area:character}.field-temple{grid-area:temple}.field-weapon{grid-area:weapon}.field-armor{grid-area:armor}.field-extra{grid-area:extra}.field-deck{grid-area:deck}
.field-card{display:block;padding:0;margin:auto;width:var(--card-width);height:var(--card-height);border:1px solid #9a86565c;border-radius:3px;overflow:hidden;background:#101a22;box-shadow:0 3px 8px #0005}.field-card img{width:100%;height:100%;object-fit:contain}.field-card.field-master{border-color:var(--gold);box-shadow:0 0 16px #bfa25f26}.opponent-mat .field-master{border-color:var(--blue)}.field-empty{display:grid;place-content:center;border-style:dashed;background:#060e142e;box-shadow:none;color:#809097;font:18px var(--serif)}
.field-zone>small{display:block;font-size:8px;line-height:14px;height:14px;white-space:nowrap;color:#a1b1b8}.field-temple-count{height:14px;display:flex;justify-content:center;align-items:center;gap:3px;font-size:8px;color:#b6c0bd;white-space:nowrap}.field-temple-count img{width:11px;height:11px}.field-temple-count b{color:var(--gold);font-size:11px}.auto-label{font-size:9px;color:#83b7ac;white-space:nowrap}.field-temple-count .auto-label{font-size:7px}.stack-count{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);padding:2px 5px;white-space:nowrap;font-size:8px;background:#1c262c;border:1px solid #c2a66188;color:var(--gold);border-radius:3px}
.field-grave{grid-area:grave;display:flex;flex-direction:column;justify-content:center;align-self:stretch;gap:4px;min-width:0;padding:4px 0}.field-grave-title{font-size:10px;color:var(--gold);text-align:center;letter-spacing:.1em}.field-grave-title span{font:11px Georgia,serif;color:#a5b9c1;margin-left:4px}.grave-pile{width:100%;min-height:32px;display:flex;align-items:center;gap:5px;padding:4px 5px;border-color:#ac93574d;background:#0c18219e;border-radius:3px;text-align:left}.grave-art{display:grid;place-content:center;position:relative;width:23px;height:19px;flex:0 0 23px;overflow:hidden;color:#5f7783}.grave-art img{width:15px;height:21px;object-fit:contain;transform:rotate(90deg)}.grave-label{font-size:8px;white-space:nowrap;color:#b5c1c4;flex:1}.grave-pile>b{font:12px Georgia,serif;color:var(--gold)}.opponent-mat .field-grave-title{order:4}.opponent-mat .grave-series{order:1}.opponent-mat .grave-basic{order:2}.opponent-mat .grave-covered{order:3}
.field-pile{position:relative;display:flex;align-items:center;justify-content:center;gap:6px;border:1px solid #ab925758;background:#0b141e9e;border-radius:3px;width:100%;height:var(--card-height);padding:3px 4px 14px;overflow:hidden}.field-pile>img{width:calc(var(--card-width) * .58);height:calc(var(--card-height) * .58);object-fit:contain}.field-pile>b{font:19px Georgia,serif;color:var(--gold)}.field-pile>small{position:absolute;bottom:3px;left:0;right:0;line-height:1.2;font-size:8px;color:#adb9bb;text-align:center}
.field-resources{grid-area:resources;height:var(--card-height);min-width:0;display:flex;align-items:center;gap:6px;padding:0 4px;border:1px solid #b99d6255;border-radius:3px;background:#6a5a2b0e}.field-resource-title{font-size:9px;white-space:nowrap;color:var(--gold);padding-right:5px;border-right:1px solid #b99d623d}.field-resource-title span{font:12px Georgia,serif;margin-left:3px}.field-resource-title small{display:block;font-size:8px;color:#8ca3ad;margin-top:5px}.resource-cards{display:flex;align-items:center;gap:4px;min-width:0;flex:1;height:100%;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.resource-cards button{display:block;flex:0 0 var(--card-width);width:var(--card-width);height:100%;border:0;padding:0;border-radius:2px;background:none}.resource-cards img{height:100%;width:100%;object-fit:contain}.resource-empty{margin:auto;color:#657a8466}.opponent-mat .field-resources,.opponent-mat .resource-cards{flex-direction:row-reverse}.opponent-mat .field-resource-title{padding-left:5px;padding-right:0;border-left:1px solid #b99d623d;border-right:0}
.battle-page .duelist{min-height:32px;gap:10px}.battle-page .duelist-portrait{width:27px;height:27px}.battle-page .duelist h3{font-size:12px}.battle-page .duelist small{font-size:8px}.battle-page .hp b{font-size:23px}.battle-page .stat{font-size:16px}.battle-page .stat img{width:15px;height:15px}.battle-page .stat small{font-size:8px}.battle-page .stats{gap:12px}.opponent-info{display:flex;justify-content:space-between;align-items:center;height:15px;font-size:9px;color:#91a6af}.battle-page .opponent-hand img{height:11px;width:8px}.battle-page .opponent-hand{gap:3px}.battle-page .phase-rail{margin:3px 0;padding:4px 0;font-size:9px;gap:12px}.battle-page .phase-no{font-size:10px}.battle-page .player-mat+.duelist{margin-top:4px}.battle-page .player-actions{margin-top:4px;padding-top:5px;gap:5px;flex-wrap:wrap}.battle-page .player-actions button{padding:6px 8px;font-size:10px;min-height:30px}.battle-page .player-actions .row{gap:4px}.battle-page .hand{min-height:82px;padding-top:8px}.battle-page .hand-card{width:48px;flex-basis:48px}.battle-page .battle-notice{font-size:8px;padding:4px}
.history-controls{display:grid;gap:7px;margin-top:10px}.history-controls label{font-size:10px;color:#a1b4bc;display:flex;gap:8px;align-items:center}.history-controls select{min-width:0;width:100%;padding:5px;background:#14242e;border:1px solid #52636b;color:#cfdbdc;font:11px var(--sans)}.history-tabs{display:flex;gap:4px}.history-tabs button{padding:5px 7px;font-size:10px;flex:1;border-color:#667c8055}.history-tabs button.active{color:var(--gold);border-color:var(--gold);background:#a8975620}.turn-history{list-style:none;margin:10px 0;padding:0;max-height:28vh;overflow:auto}.turn-history li{display:flex;gap:8px;padding:10px 0;border-bottom:1px solid #5c717a33}.turn-history li>div{min-width:0}.turn-history strong,.turn-history span,.turn-history small{display:block}.turn-history strong{font-size:11px;font-weight:500;color:#e4dbbc;margin:3px 0}.turn-history small{font-size:9px;color:var(--gold)}.turn-history .cpu-event small{color:var(--blue)}.turn-history span{font-size:9px;color:#93a8b1}.turn-history p{margin:4px 0 0!important;font-size:10px!important;line-height:1.6!important;color:#a9c7be!important}.history-card{width:36px;flex:0 0 36px;padding:0;background:none;border:0;align-self:start}.history-card img{width:100%}.history-empty{color:#8199a4;font-size:11px;line-height:1.8}.turn-history.expanded{max-height:55vh}.evolution-panel{margin-top:12px;padding:10px;border:1px solid #8e804a4a;background:#101e2766}.evolution-panel strong{font-size:11px;color:#e2d6b4}.evo-metric{display:grid;grid-template-columns:1fr auto;gap:5px;margin-top:9px;font-size:10px;color:#9eb4bd}.evo-metric b{color:#e8d99e;font-size:13px;font-weight:400}.evo-metric small{font-size:9px;color:#90a5af}.evo-bar{grid-column:1/-1;height:3px;background:#43525966}.evo-bar i{display:block;height:100%;background:var(--gold)}.evo-costs{display:flex;flex-wrap:wrap;gap:5px 10px;margin-top:8px;font-size:9px;color:#899da6}.evo-costs .met{color:#91c3ae}.evolution-panel p{font-size:9px!important;margin:8px 0 0;line-height:1.6!important}
.effect-action{display:flex;flex-direction:column;align-items:start;gap:5px;margin-top:10px}.effect-action small{font-size:11px;color:#91aaa9}.effects-list{display:grid;gap:9px;margin-top:14px;max-height:65vh;overflow:auto}.effect-row{display:flex;gap:12px;align-items:center;border:1px solid #70868d44;padding:10px}.effect-row>button:first-child{width:46px;flex:0 0 46px;padding:0;border:0;background:none}.effect-row img{width:100%}.effect-row>div{flex:1;min-width:0}.effect-row strong{font-size:13px;display:block}.effect-row small,.effect-row span{display:block;font-size:11px;line-height:1.7;color:#91aab4}.effect-row>button:last-child{font-size:12px}.resolution-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(90px,1fr));gap:10px;margin-top:18px;max-height:58vh;overflow:auto}.pick-card,.revealed-card{display:flex;flex-direction:column;position:relative;align-items:center;padding:7px;border:1px solid #7e8d8d55;border-radius:3px;gap:5px;font-size:11px;line-height:1.5}.pick-card{cursor:pointer}.pick-card:has(input:checked){border-color:var(--gold);background:#c5a95b26}.pick-card input{position:absolute;top:8px;left:8px;width:19px;height:19px;accent-color:#bea26a}.pick-card img,.revealed-card img{width:100%;max-width:105px}.pick-card small{color:#8fa9b4}
@media(min-width:700px) and (max-height:850px){.battle-page{--card-width:43px}.grave-pile{min-height:26px;padding:3px 5px}.field-zone>small,.field-temple-count{font-size:7px;height:12px;line-height:12px}.field-temple-count img{width:9px}.battle-page .phase-rail{gap:10px}.playmat{gap:2px 6px;padding:3px 6px}.stack-count{bottom:12px;font-size:7px}.battle-sidebar .rule{margin-block:12px}}
@media(min-width:700px) and (min-height:1000px){.battle-page{--card-width:65px}.battle-page .hand-card{width:65px;flex-basis:65px}.battle-page .hand{min-height:106px}}
@media(max-width:1200px){.battle-layout{grid-template-columns:minmax(360px,1fr) 230px}.battle-sidebar.inspector-side{display:none}.battle-sidebar.right{display:block}}
@media(max-width:780px){.battle-layout{display:block}.battle-sidebar.right{display:none}.battle-page{--card-width:47px}.battle-page .arena{padding-inline:8px}.battle-top .screen-chip{display:none}.battle-top{padding:6px 8px;gap:5px;flex-wrap:wrap}.battle-top button{font-size:9px}.battle-page .topbar{height:45px}.playmat{grid-template-columns:minmax(52px,1.1fr) .1fr .95fr .95fr .95fr .1fr minmax(52px,1.1fr);gap:3px 3px;padding:4px}.field-zone>small,.field-temple-count{font-size:7px}.field-temple-count .auto-label{display:none}.field-grave-title{font-size:8px;letter-spacing:0}.field-grave{gap:4px}.grave-pile{padding:4px 3px;gap:3px;min-height:32px;flex-wrap:wrap;justify-content:space-between}.grave-art{width:16px;flex-basis:16px;height:13px}.grave-art img{width:10px;height:14px}.grave-label{order:3;flex:0 0 100%;font-size:7px;text-align:center;line-height:1}.field-pile{gap:3px}.field-pile>b{font-size:16px}.field-pile>small{font-size:7px}.field-resource-title{font-size:8px;padding-right:4px}.field-resource-title small{font-size:7px}.field-resource-title span{font-size:10px;margin-left:2px}.field-resources{gap:4px;padding-inline:3px}.battle-page .stats{gap:9px}.battle-page .stat{font-size:14px}.battle-page .stat img{width:12px;height:12px}.battle-page .phase-rail{gap:6px;font-size:8px}.battle-page .phase-no{font-size:9px;margin-right:2px}.battle-page .duelist h3{font-size:11px}.battle-page .duelist-portrait{width:24px;height:24px}.battle-page .duelist>.row{gap:6px}.battle-page .hp{gap:4px}.battle-page .player-actions button{font-size:9px;padding:6px}.battle-page .hand{min-height:86px}.battle-page .hand-card{width:50px;flex-basis:50px}.battle-notice{line-height:1.6}.stack-count{font-size:7px;padding:2px}}
@media(max-width:420px){.battle-page{--card-width:41px}.battle-top .row{gap:4px}.battle-top .tag{display:none}.field-pile>img{width:17px}.field-pile>b{font-size:14px}.battle-page .duelist-portrait{display:none}.battle-page .player-actions .row{gap:3px}.field-grave-title span{margin-left:1px}}

/* Battle uses the dedicated toolbar, leaving room for equally sized card zones. */
.battle-page .topbar{display:none}.battle-sidebar.right{max-height:calc(100dvh - 40px)}
@media(min-width:700px) and (max-height:800px){.battle-page .battle-notice{display:none}}

.history-controls label{white-space:nowrap}
