.auto-battle{border:0;border-radius:18px;padding:24px;width:min(1280px,96vw);max-width:none;max-height:94dvh;background:#f4f7f6;color:#172e2b;overflow:auto;box-sizing:border-box}.auto-battle::backdrop{background:#122b29cc}.auto-header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}.auto-header h2{margin:0}.auto-battle button{border:1px solid #136f63;background:#fff;color:#136f63;border-radius:8px;padding:8px 12px;cursor:pointer;min-height:40px;font:inherit}.auto-battle button:hover{background:#e2f2ed}.auto-battle button:disabled{opacity:.4;cursor:default}.auto-battle button:focus-visible,.auto-battle select:focus-visible{outline:3px solid #dd9900;outline-offset:2px}.auto-setup{max-width:850px;margin:auto;line-height:1.7}.auto-scope{background:#fff4d9;padding:16px;border-radius:12px;border:1px solid #e5ce95}.auto-selects{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:24px 0}.auto-selects label{display:grid;gap:8px}.auto-selects select{padding:10px;max-width:100%;font:inherit;border-radius:8px;border:1px solid #adbfba}.auto-status{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;background:#136f63;color:white;border-radius:12px;padding:14px}.auto-status span{font-size:13px}.auto-error{color:#a32a23;white-space:pre-wrap}.auto-error:empty{display:none}.auto-boards{display:flex;flex-direction:column;gap:18px;margin:18px 0}.auto-board{border:1px solid #c5d5d0;background:#fff;border-radius:14px;padding:16px;min-width:0}.auto-board h3{margin:0 0 6px;font-size:16px}.auto-board header{line-height:1.6;margin-bottom:14px}.auto-field{display:flex;overflow-x:auto;gap:10px;padding:4px 0 14px;align-items:flex-start}.auto-card{min-width:150px;width:160px;display:flex;flex-direction:column;gap:7px;flex-shrink:0;border:1px solid #b8d3c9;border-radius:12px;padding:10px;background:#f8fcfa;font-size:13px;box-sizing:border-box}.auto-card img{width:100%;height:135px;object-fit:contain}.auto-card.is-rested{border:2px dashed #9c7646;background:#fff8ed}.auto-card.is-selected{outline:3px solid #136f63}.auto-badge{display:inline-block;color:#125d4f;background:#dceee8;font-size:11px;border-radius:4px;padding:3px 5px}.auto-badge.pending{background:#fff0ce;color:#7c4c08}.auto-hand{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}.auto-hand article{display:flex;flex-direction:column;gap:8px;padding:12px;border:1px solid #d3ddd9;border-radius:10px}.auto-hand small,.auto-card small{color:#586b63;overflow-wrap:anywhere}.auto-battle details{font-size:13px}.auto-battle details p{white-space:normal;line-height:1.7}.auto-controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap;position:sticky;bottom:0;z-index:2;background:#f4f7f6f5;border:1px solid #cedbd5;border-radius:12px;padding:12px}.auto-log{margin:18px 0;line-height:1.7}.auto-hidden-hand{color:#64766e}.auto-selection{position:sticky;top:0;background:#fff4d9;padding:10px;z-index:3;border-radius:8px}@media(max-width:600px){.auto-battle{padding:14px;width:98vw;max-height:98dvh}.auto-selects{grid-template-columns:1fr}.auto-board{padding:12px}.auto-card{min-width:135px;width:135px}.auto-hand{grid-template-columns:repeat(2,minmax(0,1fr))}.auto-header h2{font-size:22px}.auto-header{align-items:flex-start}.auto-controls button{flex:1}.auto-field{scroll-snap-type:x proximity}.auto-card{scroll-snap-align:start}}
.provisional-badge{display:inline-block;background:#fff0ce;color:#7c4c08;font-size:11px;border-radius:5px;padding:4px 6px;margin:4px 0}.provisional-source{font-size:12px;color:#136f63}.eb05-gallery{max-width:1200px;margin:auto;padding:24px}.eb05-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:16px}.eb05-grid article{padding:12px;background:white;border:1px solid #c5d5d0;border-radius:12px}.eb05-grid img{width:100%;aspect-ratio:458/640;object-fit:contain}.eb05-grid h3{font-size:15px}.eb05-gallery input{padding:12px;font:inherit;width:min(100%,500px);margin:12px 0;box-sizing:border-box}.eb05-gallery small{display:block;color:#586b63}
.auto-battle.is-playing{position:fixed;inset:0;margin:0;width:100vw;height:100dvh;max-width:100vw;max-height:100dvh;border-radius:0;padding:8px;background:var(--bg,#f7f8fb)}.auto-battle.is-playing .auto-header{display:none}.auto-battle.is-playing #autoContent{height:100%;min-height:0}.auto-battle .auto-solo-game{height:100%;min-height:0;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;gap:4px}.auto-battle.is-playing .battlefield{min-height:0;overflow:auto}.auto-battle.is-playing .auto-controls{position:static;padding:3px;border:0;background:transparent;min-height:0}.auto-battle.is-playing .auto-controls:empty{display:none}.auto-battle.is-playing .solo-toolbar button{min-height:28px;padding:3px 8px;border:1px solid var(--line);font-size:12px;background:#fff;color:var(--ink)}.auto-turn-label{font-size:13px}.auto-battle.is-playing .battle-actions button{min-height:22px;padding:2px 5px;font-size:11px}.auto-battle .playmat [role=button]{cursor:pointer}.auto-battle .auto-selected{outline:3px solid #136f63}.auto-battle .auto-target{outline:3px solid #f8cc56;box-shadow:0 0 0 2px #704600;cursor:crosshair}.auto-battle .auto-hidden-card img{width:100%;aspect-ratio:5/7;object-fit:contain}.auto-zone-viewer{position:fixed;inset:0;z-index:50;display:grid;place-items:center;background:#10201cbb;padding:16px}.auto-zone-viewer>.zone-viewer-panel{background:#fff;color:#172e2b;padding:14px;border-radius:12px;max-height:90dvh;overflow:auto;width:min(850px,94vw)}.auto-inspector-body{display:grid;grid-template-columns:minmax(110px,220px) 1fr;gap:16px;line-height:1.7}.auto-inspector-body>.battle-card-img{width:100%;max-width:220px;height:auto}.auto-inspector-actions{display:flex;gap:8px;flex-wrap:wrap}.auto-battle [role=button]:focus-visible{outline:3px solid #f8cc56;outline-offset:2px}.auto-battle .cost-area .don-row button{min-height:0;padding:0}.auto-battle .solo-notice{margin:0}.auto-zone-viewer .zone-viewer-body .battle-card-img{max-width:120px;width:100%}@media(max-width:720px){.auto-battle.is-playing{padding:2px;height:var(--visual-viewport-height,100dvh)}body.solo-active .auto-battle .auto-solo-game{grid-template-rows:auto auto minmax(0,1fr) auto;gap:1px}body.solo-active .auto-battle .auto-turn-label{font-size:10px;flex-basis:100%}body.solo-active .auto-battle .solo-toolbar button{flex:1 1 48px;min-height:24px;padding:2px 3px;font-size:10px}body.solo-active .auto-battle .auto-controls{flex-wrap:wrap;gap:2px}body.solo-active .auto-battle .auto-controls button{min-height:30px;font-size:11px}body.solo-active .auto-battle .solo-notice{font-size:10px;min-height:18px}.auto-inspector-body{grid-template-columns:100px 1fr;gap:10px;font-size:12px}.auto-inspector-actions button{min-height:40px}.auto-battle.is-playing .playmat .battle-actions{display:none}.auto-battle.is-playing .don-deck-pile{pointer-events:none}}
.auto-battle{--solo-hand-card:64px;--solo-field-card:64px}.auto-battle .hand-card{flex:0 0 var(--solo-hand-card);width:var(--solo-hand-card);min-width:0}.auto-battle .center-area .leader-slot{width:54px}.auto-battle .auto-hidden-card img{max-height:90px}@media(max-width:720px){.auto-battle .center-area .leader-slot{width:var(--solo-center-card)}.auto-battle .auto-hidden-card img{max-height:none}}
.auto-result-dialog{position:fixed;inset:0;margin:auto;box-sizing:border-box;width:min(440px,calc(100vw - 28px));max-width:none;max-height:calc(100dvh - 40px);overflow:auto;padding:28px 24px 24px;border:1px solid #e6bf65;border-radius:24px;background:radial-gradient(ellipse at 50% 0,#375851 0,transparent 65%),#112b27;color:#fff;text-align:center;box-shadow:0 28px 90px #0009;animation:result-appear .22s ease-out}.auto-result-dialog::backdrop{background:#071310cf;backdrop-filter:blur(5px)}.auto-result-mark{font-size:42px;line-height:1.1;color:#ffd47c;margin-bottom:10px}.auto-result-eyebrow{font-size:12px;font-weight:800;letter-spacing:.25em;color:#ffd47c;margin:0 0 12px}.auto-result-dialog h2{font-size:clamp(40px,12vw,64px);font-weight:950;letter-spacing:-.05em;line-height:1.05;margin:0;color:#ffe0a0;text-shadow:0 3px 24px #efbd4b44}.auto-result-caption{font-size:20px;font-weight:800;margin:14px 0 22px}.auto-result-winner{font-size:14px;font-weight:700;margin:0 0 8px;overflow-wrap:anywhere;color:#f1f6f3}.auto-result-reason{font-size:13px;line-height:1.6;color:#c9dad4;margin:0 0 24px}.auto-result-actions{display:grid;gap:9px}.auto-battle .auto-result-actions button{min-height:46px;padding:10px 14px;font-size:15px;font-weight:800;border:1px solid #ffffff44;background:#ffffff0d;color:#f5faf7;border-radius:10px}.auto-battle .auto-result-actions button:first-child{background:#ffdb8a;color:#222a24;border-color:#ffdb8a}.auto-battle .auto-result-actions button:hover{filter:brightness(1.1)}.auto-battle .auto-result-actions button:focus-visible{outline:3px solid white;outline-offset:3px}.auto-result-dialog.result-lose{border-color:#91aecb;background:radial-gradient(ellipse at 50% 0,#3c506d 0,transparent 65%),#182234}.result-lose .auto-result-mark,.result-lose h2,.result-lose .auto-result-eyebrow{color:#d4e5ff}.auto-battle .result-lose .auto-result-actions button:first-child{background:#d4e5ff;border-color:#d4e5ff;color:#182234}@keyframes result-appear{from{opacity:0;transform:translateY(10px) scale(.97)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.auto-result-dialog{animation:none}}@media(max-height:550px){.auto-result-dialog{padding:18px}.auto-result-mark{font-size:26px;margin-bottom:5px}.auto-result-caption{margin:10px 0}.auto-result-reason{margin-bottom:14px}.auto-result-dialog h2{font-size:40px}}
.auto-battle [data-auto-drag]{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab}.auto-battle [data-auto-drag] img{pointer-events:none;-webkit-user-drag:none}.auto-battle .auto-drag-origin{opacity:.35}.auto-battle .auto-drop-over{outline:3px solid #ffdf77!important;outline-offset:-3px;background:#f3ce5766!important}.auto-drag-ghost{position:fixed;z-index:1000;pointer-events:none;transform:translate(-50%,-75%) rotate(-4deg);filter:drop-shadow(0 8px 10px #0008);border:2px solid #ffe29b;border-radius:5px;overflow:hidden;background:#173a31}.auto-drag-ghost img{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none}.auto-battle .cost-area .don-row{gap:8px}.auto-battle .cost-area .don-row.is-stacked button+button{margin-left:0}
.drop-placement-panel .drop-play-card{display:block;width:min(180px,45vw);height:auto;aspect-ratio:5/7;object-fit:contain;margin:12px auto}
.auto-battle .auto-solo-game{margin:0}

.auto-learning-info{margin-top:20px;padding:16px;border:1px solid #b8d4cf;border-radius:12px;background:#edf7f4;color:#153f37}.auto-learning-info p{font-size:13px;line-height:1.6}.auto-learning-result{font-size:13px;line-height:1.6;color:#c8f2e7;margin:16px 0 0}

.auto-effect-overlay{z-index:1600}.auto-effect-panel{max-height:88dvh;overflow:auto;width:min(680px,calc(100vw - 24px));padding:18px}.auto-effect-panel h3{margin:0 0 8px;font-size:19px}.auto-effect-panel p{font-size:13px;line-height:1.5}.auto-effect-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin:16px 0}.auto-effect-option{display:flex;flex-direction:column;align-items:center;gap:7px;min-height:70px;padding:9px;border:2px solid #c2d6d1;border-radius:12px;background:#fff;color:#143e35;font-size:13px;overflow-wrap:anywhere}.auto-effect-option img{height:130px;width:auto;max-width:100%;object-fit:contain}.auto-effect-option.is-chosen{border-color:#126b54;background:#e3f8ef}.auto-effect-confirm{display:flex;flex-wrap:wrap;gap:8px;position:sticky;bottom:-18px;padding:12px 0;background:#fff}.auto-effect-confirm button{flex:1;min-width:130px;min-height:44px}

body.solo-active .auto-battle.is-playing .auto-effect-option .battle-card-img{width:auto;height:140px;max-height:140px;max-width:100%;object-fit:contain}.auto-battle .auto-effect-overlay>.auto-effect-panel{width:min(680px,calc(100vw - 24px));max-height:88dvh;box-sizing:border-box}

.auto-effect-preview{display:flex;gap:8px;overflow:auto}.auto-effect-preview figure{flex:0 0 100px;margin:0;font-size:12px}body.solo-active .auto-battle .auto-effect-preview .battle-card-img{height:140px;width:auto;max-width:100%;object-fit:contain}
/* Keep the duel on the mat; red arrows and labelled frames identify both cards. */
.auto-battle.is-playing{background:repeating-linear-gradient(3deg,#725235 0,#67472f 35px,#755337 72px)}
.auto-battle.is-playing .playmat{background:linear-gradient(145deg,#e3e9bc,#9dbb7d);border-color:#d1be83;box-shadow:inset 0 0 0 1px #f2edcc}
.auto-battle.is-playing .opponent-board .playmat{background:linear-gradient(35deg,#dce7b5,#9ab77c)}
.auto-battle.is-playing .playmat.active-turn{border-color:#f0d67c;box-shadow:inset 0 0 0 1px #fff3b7}
.auto-battle.is-playing .playmat-header{background:#1c412dcc;color:#fff;border-radius:3px;padding:1px 3px}
.auto-battle.is-playing .character-area,.auto-battle.is-playing .center-area,.auto-battle.is-playing .cost-area,.auto-battle.is-playing .hand-area{background:#f5f6d51f;border-color:#f3ebc397}
.auto-battle.is-playing .solo-notice{white-space:normal;line-height:1.35;min-height:26px;padding:3px 5px;border-color:#b5c78f;background:#eef4db;color:#223e2a}
.auto-battle.is-playing .auto-turn-label{color:#fff7dd;text-shadow:0 1px 2px #291a10}
.auto-battle .auto-attacking{position:relative!important;outline:3px solid #ff3348!important;outline-offset:2px;box-shadow:0 0 0 4px #570b17b3!important}
.auto-battle .auto-defending{position:relative!important;outline:3px solid #ffd355!important;outline-offset:2px;box-shadow:0 0 0 4px #644400b3!important}
.auto-battle-marker{position:absolute;bottom:1px;left:1px;z-index:5;background:#c52236;color:#fff;border-radius:3px;padding:1px 3px;font-weight:800;font-size:9px;line-height:1.25;white-space:nowrap;pointer-events:none}
.auto-defending>.auto-battle-marker{background:#ffd355;color:#442c00}
.auto-attack-arrow{display:none;position:fixed;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;z-index:40}
.auto-arrow-outline{stroke:#4c0618;stroke-width:7;fill:none;stroke-linecap:round;opacity:.85}
.auto-arrow-line{stroke:#ff3348;stroke-width:4;fill:none;stroke-linecap:round}
@media(max-width:720px){.auto-battle-marker{font-size:8px}.auto-arrow-line{stroke-width:3.5}.auto-arrow-outline{stroke-width:6}.auto-battle.is-playing .solo-notice{font-size:10px;min-height:28px}}
@media(min-width:721px) and (max-height:600px) and (orientation:landscape){
 .auto-battle.is-playing .auto-solo-game{grid-template-columns:minmax(0,1fr) 180px;grid-template-rows:auto auto minmax(0,1fr);gap:8px}
 .auto-battle.is-playing .auto-solo-game>.solo-toolbar{grid-column:2;grid-row:1;align-content:start}
 .auto-battle.is-playing .auto-solo-game>.solo-notice{grid-column:2;grid-row:2}
 .auto-battle.is-playing .auto-solo-game>.battlefield{grid-column:1;grid-row:1 / span 3;display:flex;flex-direction:column;min-height:0;height:100%;width:min(440px,100%);justify-self:center;align-items:stretch;gap:4px;overflow:visible}
 .auto-battle.is-playing .auto-solo-game>.auto-controls{grid-column:2;grid-row:3;align-self:end}
 .auto-battle.is-playing .battle-actions{display:none}
 .auto-battle.is-playing .playmat-header{gap:3px}
}
/* Primary actions always follow the mat at the bottom of the viewport. */
.auto-battle .auto-status-bar{min-height:16px;line-height:16px}
.auto-battle .auto-bottom{min-width:0;display:flex;flex-direction:column;gap:3px;padding-bottom:env(safe-area-inset-bottom,0px)}
.auto-battle .auto-main-controls{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:4px}
.auto-battle.is-playing .auto-main-controls button{min-height:40px;padding:4px 3px;font-size:12px}
.auto-battle .auto-main-controls [data-auto="request-end"]{background:#175c45;color:#fff;font-weight:800;border-color:#b9d790}
.auto-settings-overlay,.auto-end-overlay{z-index:1700}
.auto-battle .auto-settings-panel,.auto-battle .auto-end-panel{width:min(440px,94vw);box-sizing:border-box}
.auto-setting-choice{display:flex;align-items:center;gap:10px;min-height:48px;font-size:16px;line-height:1.6}
.auto-setting-choice input{width:22px;height:22px;flex:none}
.auto-end-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.auto-end-actions button{min-height:46px}
@media(max-width:480px){.auto-battle .auto-main-controls{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:721px) and (max-height:600px) and (orientation:landscape){
 .auto-battle.is-playing .auto-solo-game{grid-template-rows:auto auto minmax(0,1fr) auto}
 .auto-battle.is-playing .auto-solo-game>.auto-status-bar{grid-column:2;grid-row:1}
 .auto-battle.is-playing .auto-solo-game>.auto-bottom{grid-column:1 / -1;grid-row:4}
 .auto-battle.is-playing .auto-solo-game>.battlefield{align-items:stretch}
 .auto-battle .auto-main-controls{grid-template-columns:repeat(6,minmax(0,1fr))}
}

.auto-battle .auto-battle-power{position:absolute!important;left:50%!important;top:52%!important;bottom:auto!important;transform:translate(-50%,-50%)!important;writing-mode:horizontal-tb!important;white-space:nowrap;z-index:8;pointer-events:none;font-size:clamp(22px,6vw,38px)!important;font-weight:950;line-height:1.1;letter-spacing:-.035em;color:#fff;background:#172331d9;border:2px solid #ffe38c;border-radius:6px;padding:2px 5px;text-shadow:0 2px 3px #000;box-shadow:0 2px 8px #0008}.auto-battle .auto-defending>.auto-battle-power{color:#ffe38c}.auto-battle .auto-attack-confirm-panel{width:min(400px,calc(100vw - 24px))}.auto-battle .auto-attack-confirm-panel p{overflow-wrap:anywhere}
.auto-battle .leader-rested>.auto-battle-power,.auto-battle .battle-card.rested>.auto-battle-power{transform:translate(-50%,-50%) rotate(-90deg)!important}
.auto-battle .battle-card,.auto-battle .leader-slot{position:relative}.auto-effect-marks{position:absolute;top:20%;right:-3px;z-index:10;display:flex;gap:2px;pointer-events:none}.auto-effect-mark{display:block;width:30px;height:30px;filter:drop-shadow(0 1px 2px #0008)}.auto-effect-mark svg{display:block;width:100%;height:100%}.auto-battle .leader-rested>.auto-effect-marks,.auto-battle .battle-card.rested>.auto-effect-marks{transform:rotate(-90deg);transform-origin:center}@media(max-width:720px){.auto-effect-mark{width:25px;height:25px}}
