:root{color-scheme:dark}body{margin:0;min-width:320px;min-height:100vh}*{box-sizing:border-box;margin:0;padding:0}body{background:#0d0d1a;color:#ddd;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif}.battle-layout{position:relative;display:flex;gap:10px;padding:10px;align-items:flex-start;min-height:100vh}.side-panel{display:flex;flex-direction:column;gap:8px;width:280px;flex-shrink:0}.game-over-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#000000c7;display:flex;align-items:center;justify-content:center;z-index:200}.game-over-box{background:#1a1a2e;border:2px solid #f80;border-radius:10px;padding:2.5rem 3.5rem;text-align:center}.game-over-box h1{font-size:2.8rem;margin-bottom:.75rem;color:#ffd}.game-over-box p{font-size:1.1rem;color:#aaa;margin-bottom:1.5rem}.game-over-box button{padding:.6rem 2rem;font-size:1rem;background:#35a;color:#fff;border:none;border-radius:5px;cursor:pointer}.game-over-box button:hover{background:#46c}.spectator-badge{position:absolute;top:10px;left:50%;transform:translate(-50%);background:#141428d9;color:#ffd;padding:.3rem 1rem;border:1px solid #556;border-radius:6px;font-size:.95rem;z-index:10}.spectator-count{position:absolute;top:10px;right:10px;background:#141428b3;color:#aac;padding:.2rem .6rem;border-radius:6px;font-size:.85rem;z-index:10}.spectator-waiting{display:flex;align-items:center;justify-content:center;height:100vh}.unit-sprite-canvas{position:absolute;top:50%;left:50%;image-rendering:pixelated;pointer-events:none}@keyframes projectile-fly{0%{left:var(--from-left);top:var(--from-top);opacity:1}to{left:var(--to-left);top:var(--to-top);opacity:.3}}.projectile{position:absolute;width:10px;height:10px;background:radial-gradient(circle,#ffe066,#f90);border-radius:50%;animation:projectile-fly .6s linear forwards;pointer-events:none;z-index:20;transform:translate(-50%,-50%)}.spellbook-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0009;display:flex;align-items:center;justify-content:center;z-index:1000}.spellbook-book{--s: 2.7;position:relative;width:calc(272px * var(--s));height:calc(272px * var(--s));background-image:url(/Spellbook/Open_book.png);background-repeat:no-repeat;background-size:calc(1088px * var(--s)) calc(816px * var(--s));background-position:calc(-816px * var(--s)) calc(-544px * var(--s));image-rendering:auto}.spellbook-close{position:absolute;top:18%;right:6%;width:30px;height:30px;border:none;border-radius:50%;background:#28190fd9;color:#f0e0b0;font-size:15px;line-height:1;cursor:pointer;z-index:2}.spellbook-close:hover{background:#462d19f2}.spellbook-pages{position:absolute;top:31%;left:8.5%;right:8.5%;bottom:9%;display:flex;gap:7%}.spellbook-page{flex:1 1 0;min-width:0;overflow-y:auto;list-style:none;margin:0;padding:0 2px;display:flex;flex-direction:column;gap:5px}.spell-entry{display:flex;align-items:center;gap:8px;width:100%;padding:4px 6px;background:#4e341824;border:1px solid rgba(90,60,25,.55);border-left-width:4px;border-radius:4px;color:#3a2a12;text-align:left;cursor:pointer;font:inherit}.spell-entry:hover:not(:disabled){background:#78522247}.spell-entry:disabled{opacity:.42;cursor:default}.spell-icon{flex:0 0 auto;width:32px;height:32px;background-repeat:no-repeat;image-rendering:pixelated;border-radius:3px}.spell-text{display:flex;flex-direction:column;min-width:0;line-height:1.2}.spell-name{font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.spell-sub{font-size:10px;opacity:.75}.spell-entry.school-fire{border-left-color:#c8482a}.spell-entry.school-water{border-left-color:#2a6fc8}.spell-entry.school-air{border-left-color:#4aa6c8}.spell-entry.school-earth{border-left-color:#4a9a3a}.spell-entry.school-all{border-left-color:#8a5ac8}@media (max-width: 780px),(max-height: 780px){.spellbook-book{--s: 1.9}.spell-name{font-size:12px}}.history-screen{display:flex;justify-content:center;padding:2rem 1rem;min-height:100vh}.history-card{width:100%;max-width:640px;background:#14142a;border:1px solid #334;border-radius:10px;padding:1.5rem}.history-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.history-header h1{font-size:1.4rem;color:#ffd}.history-back{padding:.4rem 1rem;background:#35a;color:#fff;border:none;border-radius:5px;cursor:pointer}.history-status{color:#889;text-align:center;padding:1.5rem 0}.history-entry{border-left:3px solid #556;padding:.5rem .75rem;margin-bottom:.6rem;background:#1a1a30;border-radius:0 6px 6px 0}.history-entry.won{border-left-color:#4c4}.history-entry.lost{border-left-color:#c44}.history-line{display:flex;gap:10px;align-items:baseline}.history-result{font-weight:700;color:#ffd}.history-entry.won .history-result{color:#7d7}.history-entry.lost .history-result{color:#d77}.history-opponent{color:#aac}.history-date{margin-left:auto;color:#778;font-size:.8rem}.history-detail{font-size:.85rem;color:#99b;margin-top:2px}.history-detail.muted{color:#667}.history-pager{display:flex;justify-content:center;align-items:center;gap:12px;margin-top:1rem;color:#889}.history-pager button{padding:.3rem .8rem;background:#223;color:#aac;border:1px solid #334;border-radius:5px;cursor:pointer}.history-pager button:disabled{opacity:.4}.leaderboard-screen{display:flex;justify-content:center;padding:2rem 1rem;min-height:100vh}.leaderboard-card{width:100%;max-width:560px;background:#14142a;border:1px solid #334;border-radius:10px;padding:1.5rem}.leaderboard-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.leaderboard-header h1{font-size:1.4rem;color:#ffd}.leaderboard-back{padding:.4rem 1rem;background:#35a;color:#fff;border:none;border-radius:5px;cursor:pointer}.leaderboard-status{color:#889;text-align:center;padding:1.5rem 0}.leaderboard-table{width:100%;border-collapse:collapse;font-size:.95rem}.leaderboard-table th{text-align:left;color:#778;font-weight:400;padding:.3rem .5rem;border-bottom:1px solid #334}.leaderboard-table td{padding:.4rem .5rem;border-bottom:1px solid #223;color:#ccd}.leaderboard-table tr:first-child td{color:#ffd}.provisional{color:#886;margin-left:2px;cursor:help}.leaderboard-pager{display:flex;justify-content:center;align-items:center;gap:12px;margin-top:1rem;color:#889}.leaderboard-pager button{padding:.3rem .8rem;background:#223;color:#aac;border:1px solid #334;border-radius:5px;cursor:pointer}.leaderboard-pager button:disabled{opacity:.4}.auth-panel{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px;margin-bottom:1rem;font-size:.9rem;color:#aac}.auth-panel.open{flex-direction:column;align-items:stretch}.auth-panel input{padding:.45rem .6rem;background:#1a1a2e;border:1px solid #334;border-radius:5px;color:#ddd}.auth-actions{display:flex;gap:8px}.auth-actions button{flex:1;padding:.4rem .8rem;background:#35a;color:#fff;border:none;border-radius:5px;cursor:pointer}.auth-actions button:disabled{opacity:.6}.auth-link{background:none;border:none;color:#7af;cursor:pointer;text-decoration:underline;font-size:.9rem;padding:0}.auth-actions .auth-link{flex:0;text-decoration:none;color:#99a}.auth-error{color:#f77;font-size:.85rem}.auth-hint{color:#778}.lobby{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#0d0d1a;color:#ddd}.lobby-card{background:#1a1a2e;border:1px solid #334;border-radius:8px;padding:32px 40px;width:360px}.lobby-card h1{margin:0 0 24px;font-size:28px;text-align:center;color:#aac4ff}.lobby-section{margin-bottom:20px}.lobby-section label{display:block;font-size:12px;color:#888;margin-bottom:4px;text-transform:uppercase;letter-spacing:.5px}.lobby-section input{width:100%;box-sizing:border-box;background:#12122a;border:1px solid #445;border-radius:4px;color:#eee;font-size:14px;padding:7px 10px;outline:none}.lobby-section input:focus{border-color:#668}.lobby-divider{border:none;border-top:1px solid #334;margin:20px 0}.lobby-btn{width:100%;background:#2a3a7a;border:1px solid #446;border-radius:4px;color:#cce;font-size:14px;padding:9px;cursor:pointer;margin-bottom:8px}.lobby-btn:hover:not(:disabled){background:#3a4a9a}.lobby-btn:disabled{opacity:.4;cursor:default}.lobby-btn.ai{background:#2a5a2a;border-color:#484;color:#cec}.lobby-btn.ai:hover:not(:disabled){background:#3a7a3a}.lobby-error{margin-top:12px;color:#f88;font-size:12px;text-align:center}.lobby-status{margin-top:12px;color:#8f8;font-size:12px;text-align:center}.session-id-display{background:#12122a;border:1px solid #334;border-radius:4px;padding:6px 10px;font-size:12px;color:#aaf;word-break:break-all;margin-top:6px;cursor:pointer}.lobby-mode-tabs{display:flex;gap:4px;margin-bottom:12px}.mode-tab{flex:1;background:#12122a;border:1px solid #445;border-radius:4px;color:#888;font-size:12px;padding:6px;cursor:pointer}.mode-tab.active{background:#2a3a7a;border-color:#668;color:#cce}.game-config-form{background:#12122a;border:1px solid #334;border-radius:6px;padding:12px;margin-bottom:12px;max-height:340px;overflow-y:auto}.config-section{margin-bottom:12px}.config-section-title{font-size:11px;text-transform:uppercase;color:#668;letter-spacing:.5px;margin-bottom:6px}.config-row{display:flex;flex-wrap:wrap;gap:8px}.config-radio{display:flex;align-items:center;gap:4px;font-size:12px;color:#bbb;cursor:pointer}.config-resources{display:grid;grid-template-columns:1fr 1fr;gap:4px 8px;margin-bottom:6px}.config-resource-input{display:flex;align-items:center;gap:6px;font-size:12px;color:#bbb}.config-resource-input span{width:64px;text-align:right;flex-shrink:0}.config-resource-input input{width:70px;background:#1a1a2e;border:1px solid #445;border-radius:3px;color:#eee;font-size:12px;padding:3px 6px;outline:none}.config-factions{display:grid;grid-template-columns:1fr 1fr;gap:4px}.config-faction-check{display:flex;align-items:center;gap:4px;font-size:12px;color:#bbb;cursor:pointer}.config-hint{font-size:11px;color:#666;margin-top:4px}.lobby-card:has(.game-config-form){width:460px}.invite-link{width:100%;margin-top:8px;padding:8px;font-size:12px;font-family:monospace;color:#ddd;background:#1a1a1a;border:1px solid #444;border-radius:4px;box-sizing:border-box}.invite-copied{display:block;margin-top:6px;font-size:12px;color:#6c6}.hex-grid-wrapper{overflow:auto;background:#12122a;border:1px solid #333;border-radius:4px;cursor:none}.hex-grid{position:relative;background:#1a1a2e;width:1131px;height:721px}.hex-row{display:flex;position:absolute;left:0}.hex-row.odd-row{left:35px}.spell-targeting-banner{position:fixed;top:12px;left:50%;transform:translate(-50%);z-index:1001;padding:6px 16px;background:#1e1432eb;border:1px solid #8a5ac8;border-radius:6px;color:#f0e0ff;font-size:13px;pointer-events:none}.hex-cell-border{position:relative;width:70px;height:62px;margin:0 3px 3px 0;display:flex;align-items:center;justify-content:center;flex-shrink:0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='62'%3E%3Cpath fill-rule='evenodd' d='M35,0 L70,15.5 L70,46.5 L35,62 L0,46.5 L0,15.5 Z M35,2 L68,16 L68,46 L35,60 L2,46 L2,16 Z' fill='goldenrod'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:100% 100%}.hex-cell{width:66px;height:58px;position:relative;cursor:pointer;clip-path:polygon(50% 0%,100% 25%,100% 75%,50% 100%,0% 75%,0% 25%);background:transparent;display:flex;align-items:center;justify-content:center;transition:background .1s;-webkit-user-select:none;user-select:none}.hex-cell:hover{background:#ffffff14}.hex-cell.selected{background:#5577cc20}.hex-cell.reachable{background:#33663360;cursor:pointer}.hex-cell.attackable{background:#633;cursor:crosshair}.hex-cell.obstacle{background:#542;cursor:default}.hex-cell.active-unit{background:#78e}.hex-cell.approach{background:#88662276;cursor:crosshair}.unit-token{display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:38px;border-radius:4px;pointer-events:none}.unit-letter{font-size:14px;font-weight:700;color:#fff;line-height:1}.unit-count{font-size:10px;color:#ffffffd9;line-height:1}.tail-indicator{font-size:9px;color:#fff9}.coords{position:absolute;bottom:2px;right:4px;font-size:7px;color:#ffffff4d;pointer-events:none}.unit-info{background:#1e2040;border:1px solid #444;border-radius:4px;padding:8px 12px;font-size:13px;color:#ddd;min-height:80px}.unit-info h3{margin:0 0 6px;font-size:14px;color:#aac4ff}.unit-info .stats{display:flex;flex-wrap:wrap;gap:4px 12px}.unit-info .stat{white-space:nowrap}.unit-info .effects{margin-top:6px;font-size:11px;color:#f8a}.unit-info.empty{color:#666;display:flex;align-items:center;justify-content:center}.hero-info{background:#1e2040;border:1px solid #444;border-radius:4px;padding:8px 12px;font-size:13px;color:#ddd}.hero-info h3{margin:0 0 4px;font-size:14px;color:gold}.hero-info .hero-stats{display:flex;flex-wrap:wrap;gap:2px 10px;font-size:12px;margin-bottom:6px}.hero-info .open-spellbook-btn{display:flex;align-items:center;gap:8px;margin-top:6px;padding:4px 10px 4px 4px;background:#2a2c52;border:1px solid #5a5ca0;border-radius:4px;color:gold;font-size:13px;font-weight:600;cursor:pointer}.hero-info .open-spellbook-btn:before{content:"";width:26px;height:26px;background-image:url(/Spellbook/Open_book.png);background-repeat:no-repeat;background-size:400% 300%;background-position:0 0;border-radius:2px}.hero-info .open-spellbook-btn:hover{background:#35376a}.hero-info .mana{color:#8af}.hero-info.empty{color:#666}.action-bar{background:#1e2040;border:1px solid #444;border-radius:4px;padding:8px 12px;font-size:13px;color:#ddd}.action-bar .turn-info{margin-bottom:6px;font-size:12px;color:#aaa}.action-bar .turn-info.my-turn{color:#7f7}.action-bar .buttons{display:flex;gap:6px;flex-wrap:wrap}.action-bar button{background:#334;border:1px solid #557;border-radius:3px;color:#cce;font-size:12px;padding:4px 10px;cursor:pointer}.action-bar button:hover:not(:disabled){background:#446}.action-bar button:disabled{opacity:.4;cursor:default}.battle-log{background:#12122a;border:1px solid #333;border-radius:4px;padding:6px 8px;font-size:11px;color:#bbb;height:140px;overflow-y:auto;display:flex;flex-direction:column;gap:2px}.battle-log .log-entry{line-height:1.4}.battle-log .log-prefix{color:#667;margin-right:4px}.chat{background:#12122a;border:1px solid #333;border-radius:4px;display:flex;flex-direction:column;height:160px}.chat-messages{flex:1;overflow-y:auto;padding:6px 8px;font-size:12px;color:#ccc;display:flex;flex-direction:column;gap:2px}.chat-message .sender{color:#8af;font-weight:700;margin-right:4px}.chat-input-row{display:flex;border-top:1px solid #333}.chat-input-row input{flex:1;background:#1a1a30;border:none;outline:none;color:#ddd;font-size:12px;padding:5px 8px}.chat-input-row button{background:#334;border:none;border-left:1px solid #333;color:#aaf;font-size:12px;padding:5px 10px;cursor:pointer}.chat-input-row button:hover{background:#446}.prep-screen{min-height:100vh;background:#0d0d1a;color:#ddd;display:flex;flex-direction:column}.prep-header{background:#1a1a2e;border-bottom:1px solid #334;padding:12px 24px;display:flex;align-items:center;gap:24px}.prep-header h2{margin:0;font-size:20px;color:#aac4ff}.prep-layout{display:flex;flex:1;gap:0}.prep-main{flex:1;padding:24px;overflow-y:auto}.prep-sidebar{width:240px;background:#141428;border-left:1px solid #334;padding:16px;display:flex;flex-direction:column;gap:12px}.resource-display{display:flex;flex-wrap:wrap;gap:8px}.resource-item{display:flex;align-items:center;gap:4px;background:#12122a;border:1px solid #334;border-radius:4px;padding:2px 8px}.resource-icon{font-size:11px;font-weight:700}.resource-amount{font-size:13px;font-weight:600}.prep-step{background:#1a1a2e;border:1px solid #334;border-radius:8px;padding:20px;margin-bottom:16px}.prep-step-title{margin:0 0 16px;font-size:16px;color:#aac4ff}.chest-choices{text-align:center}.chest-options{display:flex;align-items:center;gap:16px;justify-content:center;margin-top:12px}.chest-option{background:#12122a;border:2px solid #334;border-radius:8px;padding:20px 32px;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;transition:border-color .15s}.chest-option.gold{border-color:#f5c518}.chest-option.xp{border-color:#7af}.chest-option:hover{opacity:.85}.chest-option-amount{font-size:24px;font-weight:700}.chest-option-label{font-size:12px;color:#888}.chest-or{color:#666}.chest-artifact p{margin:0 0 8px}.chest-reward-card.artifact{background:#2a1a3a;border:1px solid #84a;border-radius:6px;padding:10px 16px;margin-bottom:12px;color:#c8f}.hero-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px}.hero-card{background:#12122a;border:2px solid #334;border-radius:6px;padding:10px;cursor:pointer;text-align:left;transition:border-color .15s}.hero-card.selected{border-color:#668;background:#1a1a3a}.hero-card:hover:not(.selected){border-color:#557}.hero-name{font-size:13px;font-weight:600;color:#cce}.hero-class{font-size:11px;color:#888;margin-bottom:6px}.hero-stats{display:flex;gap:6px;font-size:11px;flex-wrap:wrap}.skill-offer-grid{display:flex;gap:12px;flex-wrap:wrap}.skill-card{flex:1;min-width:120px;background:#12122a;border:2px solid #334;border-radius:6px;padding:16px;cursor:pointer;text-align:center;transition:border-color .15s}.skill-card:hover{border-color:#557}.skill-name{font-size:14px;font-weight:600;color:#cce;margin-bottom:4px}.skill-level{font-size:11px;padding:2px 6px;border-radius:10px;display:inline-block}.level-basic{background:#224;color:#88f}.level-advanced{background:#240;color:#4f4}.level-expert{background:#420;color:#fa4}.faction-filter{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}.faction-btn{padding:4px 10px;border-radius:4px;border:1px solid #445;background:#12122a;color:#aaa;cursor:pointer;font-size:12px}.faction-btn.active{background:#2a2a5a;border-color:#668;color:#cce}.faction-btn:hover:not(.active){border-color:#557;color:#cce}.hero-portrait-placeholder{width:48px;height:64px;background:#1e1e3a;border:1px solid #445;border-radius:3px;margin:0 auto 8px}.army-unit-list{display:flex;flex-direction:column;gap:6px}.unit-pair-row{display:grid;grid-template-columns:1fr 1fr;gap:6px}.unit-cell{display:flex;align-items:center;gap:8px;background:#12122a;border:1px solid #334;border-radius:4px;padding:6px 8px;min-width:0}.unit-cell-empty{border-style:dashed;opacity:0;pointer-events:none}.unit-cell-info{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.unit-img-placeholder{width:40px;height:40px;background:#1e1e3a;border:1px solid #445;border-radius:3px;flex-shrink:0}.army-unit-name{font-size:12px;font-weight:600;color:#cce;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.army-unit-cost{font-size:10px;color:#f5c518}.army-unit-controls{display:flex;align-items:center;gap:4px;flex-shrink:0}.qty-btn{width:22px;height:22px;background:#2a2a4a;border:1px solid #445;border-radius:3px;color:#cce;cursor:pointer;font-size:14px;line-height:1;padding:0}.qty-btn:disabled{opacity:.3;cursor:default}.qty-input{width:40px;background:#12122a;border:1px solid #445;border-radius:3px;color:#cce;font-size:13px;text-align:center;padding:2px 4px}.qty-input::-webkit-inner-spin-button,.qty-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.placement-panel{margin-top:16px;border-top:1px solid #334;padding-top:12px}.placement-title{font-size:13px;color:#889;margin:0 0 8px;font-weight:600}.placement-slot{display:flex;align-items:center;gap:8px;padding:5px 8px;background:#12122a;border:1px solid #334;border-radius:4px;margin-bottom:4px}.placement-slot-label{width:54px;font-size:11px;color:#666;flex-shrink:0}.placement-slot-unit{flex:1;font-size:12px;color:#bbb}.placement-move-btn{background:#2a2a4a;border:1px solid #445;color:#888;padding:1px 7px;border-radius:3px;cursor:pointer;font-size:11px}.placement-move-btn:disabled{opacity:.2;cursor:default}.artifact-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px}.artifact-card{background:#12122a;border:2px solid #334;border-radius:6px;padding:10px;cursor:pointer;text-align:left;transition:border-color .15s}.artifact-card.selected{border-color:#884;background:#1a1a2a}.artifact-card:hover:not(.selected){border-color:#557}.artifact-name{font-size:12px;color:#cca;margin-bottom:4px}.artifact-class{font-size:10px;padding:1px 4px;border-radius:8px;display:inline-block;margin-bottom:4px}.class-minor{background:#224;color:#88f}.class-major{background:#242;color:#4f4}.class-relic{background:#420;color:#fa4}.artifact-cost{font-size:11px;color:#f5c518}.prep-sidebar-section{border-bottom:1px solid #334;padding-bottom:10px}.prep-sidebar-title{font-size:11px;text-transform:uppercase;color:#668;letter-spacing:.5px;margin-bottom:6px}.prep-army-row{display:flex;justify-content:space-between;font-size:12px;color:#bbb;padding:2px 0}.prep-hero-name,.prep-artifact-name{font-size:13px;color:#cce}.prep-opponent-status{font-size:13px}.prep-opponent-status.ready{color:#4f4}.prep-opponent-status.waiting{color:#888}.prep-ready-btn{width:100%;background:#2a5a2a;border:1px solid #484;border-radius:4px;color:#cec;font-size:15px;font-weight:600;padding:12px;cursor:pointer;margin-top:auto}.prep-ready-btn:hover{background:#3a7a3a}.prep-empty{font-size:12px;color:#666;font-style:italic}.prep-complete-msg{color:#888;text-align:center}.prep-waiting{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;gap:8px}.prep-waiting h2{color:#4f4}.prep-btn{background:#2a3a7a;border:1px solid #446;border-radius:4px;color:#cce;font-size:14px;padding:8px 16px;cursor:pointer}.prep-btn:hover{background:#3a4a9a}
