:root{color-scheme:dark;--bg:#101925;--bg-2:#142132;--panel:#1d2a3b;--panel-soft:#233247;--border:#344459;--text:#f7f4ee;--muted:#a5b2c4;--gold:#ffcb85;--orange:#f49d74;--blue:#7fd8d1;--red:#fc827c;--paper:#fff9e8;--ease:cubic-bezier(.21,.86,.27,1);font-synthesis:none}
*{box-sizing:border-box}html{min-height:100%;background:var(--bg);overscroll-behavior-y:none}body{min-height:100vh;margin:0;overflow-x:hidden;color:var(--text);font-family:"Noto Sans Arabic","Segoe UI",Tahoma,Arial,sans-serif;font-size:14px;line-height:1.65;-webkit-tap-highlight-color:transparent}button,select,input{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.46}button:focus-visible,input:focus-visible{outline:3px solid var(--blue);outline-offset:3px}button:active:not(:disabled){transform:translateY(1px)}.ambient{pointer-events:none;z-index:0;position:fixed;border-radius:50%;filter:blur(80px);opacity:.31}.ambient-one{width:430px;height:430px;top:-225px;left:-170px;background:#705143}.ambient-two{width:400px;height:500px;bottom:-290px;right:-170px;background:#1b7b7a;opacity:.12}.app-shell{position:relative;z-index:1;width:min(100%,1040px);min-height:100vh;margin:auto;display:flex;flex-direction:column;padding:0 22px}.topbar{display:flex;justify-content:space-between;align-items:center;padding:24px 0 19px;border-bottom:1px solid rgba(255,255,255,.10)}.brand{display:flex;align-items:center;gap:10px;color:inherit;border:0;background:transparent;padding:0;text-align:start;direction:ltr}.brand-mark{width:43px;height:43px;display:grid;place-items:center;border-radius:13px;background:#273144;border:1px solid #405168;box-shadow:0 5px 17px #0003}.brand-name{display:flex;flex-direction:column;gap:0;line-height:1.25}.brand-name strong{font-family:system-ui,sans-serif;letter-spacing:1.3px;font-size:16px;font-weight:900}.brand-name em{font-style:normal;color:var(--orange)}.brand-name small{color:var(--muted);font-size:11px;text-align:end;font-weight:600;margin-top:4px}.header-actions{display:flex;gap:9px;align-items:center}.icon-button,.language-switch{height:38px;min-width:39px;border:1px solid var(--border);border-radius:11px;background:#223044;color:var(--text);font-size:15px;font-weight:800}.language-switch{padding:0 11px;font-size:12px;letter-spacing:.7px}.help-btn{font-size:21px}.footer{display:flex;gap:12px;justify-content:center;align-items:center;flex-wrap:wrap;margin-top:auto;padding:28px 0 17px;color:#64778d;font-size:9px;letter-spacing:1.5px;font-family:system-ui,Arial,sans-serif;font-weight:800}.footer span+span:before{content:'·';margin-inline-end:11px}.footer-version{opacity:.7}main{width:100%;flex:1}.hero{display:grid;grid-template-columns:1.08fr .92fr;gap:33px;align-items:center;margin-top:34px;margin-bottom:25px}.eyebrow{display:inline-flex;align-items:center;gap:8px;border:1px solid #665141;border-radius:100px;padding:5px 13px;background:#584a382f;color:#ffd3a0;font-size:11px;font-weight:800}.eyebrow .spark{font-size:13px}.hero-title{font-size:clamp(34px,5vw,63px);line-height:1.18;letter-spacing:-1.9px;margin:20px 0 15px;font-weight:900}.hero-title span{display:block;color:var(--gold)}.hero-description{max-width:480px;color:#c0cbd8;font-size:15px;line-height:1.9;margin:0}.hero-art{position:relative;max-width:410px;width:100%;justify-self:center;aspect-ratio:1.34;background:#fff4d7;border:9px solid #e1d8bb;border-radius:16px;box-shadow:0 30px 70px #0005,0 0 0 1px #fff1;overflow:hidden;transform:rotate(-3deg)}.hero-art:before{content:'';position:absolute;inset:0;background:repeating-linear-gradient(0deg,transparent 0,transparent 24px,#7fb5c324 25px,#7fb5c3 26px);opacity:.26}.hero-art:after{content:'';position:absolute;z-index:1;left:50%;top:0;bottom:0;width:4px;transform:translateX(-50%);background:linear-gradient(90deg,#b2a58b,#fff5d9 60%,#b2a58b);box-shadow:0 0 10px #8b795975}.hero-soldier{position:absolute;width:49px;height:70px;z-index:2;fill:none;stroke:#405e6b;stroke-width:3.8;stroke-linecap:round;stroke-linejoin:round}.hero-soldier.enemy{stroke:#b35e54}.hero-soldier.s1{left:10%;top:13%;transform:rotate(-13deg)}.hero-soldier.s2{left:29%;top:58%;transform:rotate(10deg)}.hero-soldier.s3{right:10%;top:20%;transform:rotate(9deg)}.hero-soldier.s4{right:27%;top:57%;transform:rotate(-9deg)}.hero-dot{z-index:4;position:absolute;display:grid;place-items:center;background:#ec6969;border-radius:50%;width:12px;height:12px;box-shadow:0 0 0 7px #ee88872b}.hero-dot.d1{left:34%;top:25%}.hero-dot.d2{right:21%;bottom:22%}.hero-fold-corner{position:absolute;z-index:5;right:0;bottom:0;width:0;height:0;border-top:83px solid transparent;border-right:83px solid #e7d5ad;filter:drop-shadow(-4px -5px 3px #30251630)}.hero-micro{position:absolute;color:#728a91;z-index:4;font-family:system-ui;font-size:10px;font-weight:800;letter-spacing:2px;bottom:12px;left:18px;transform:rotate(-5deg)}.settings-panel{background:linear-gradient(145deg,rgba(32,48,66,.98),rgba(22,34,49,.98));border:1px solid #3a4b5d;border-radius:24px;padding:23px 25px;box-shadow:0 13px 40px #0002;max-width:750px;margin:0 auto 25px}.section-title{display:flex;gap:9px;align-items:center;font-weight:800;font-size:15px;margin-bottom:14px}.section-title .icon-tile{display:grid;place-items:center;width:26px;height:26px;border-radius:8px;background:#ffd09c1c;color:var(--gold)}.mode-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.mode-card{display:flex;align-items:center;gap:12px;background:#253448;border:1.5px solid #405267;border-radius:14px;text-align:start;color:var(--text);padding:13px 15px;min-height:73px;transition:background .2s,border-color .2s}.mode-card.selected{border-color:var(--gold);background:#3a3840;box-shadow:inset 0 0 0 1px #eabd8540}.mode-card .mode-icon{font-size:26px;flex:none}.mode-card strong{display:block;font-size:13px}.mode-card small{display:block;color:var(--muted);font-size:11px;margin-top:2px}.mode-card.selected small{color:#d8bca2}.setting-row{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-top:21px}.setting-label{color:#dce5ef;font-weight:750}.chips{display:flex;gap:7px;flex-wrap:wrap}.chip{padding:8px 14px;min-width:55px;border:1px solid #45576c;background:#243247;border-radius:11px;color:#dbe6f0;font-size:12px;font-weight:800}.chip.selected{color:#202637;background:var(--gold);border-color:var(--gold)}.chip.selected.cool{background:var(--blue);border-color:var(--blue)}.primary-btn{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:53px;padding:11px 20px;color:#232b35;border:0;border-radius:13px;background:linear-gradient(130deg,#ffdba2,#f5ac79);font-weight:900;font-size:14px;box-shadow:0 7px 16px #17121336}.primary-btn:hover{filter:brightness(1.04)}.primary-btn.blue{background:linear-gradient(120deg,#a1e8e3,#6fcbc9)}.primary-btn.wide{width:100%;margin-top:22px}.secondary-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:43px;padding:10px 16px;color:#eff2f4;border:1px solid #4a5c70;border-radius:12px;background:#283a50;font-size:12px;font-weight:800}.ghost-btn{border:0;background:transparent;color:#a9bdcf;font-weight:800;padding:9px 10px;border-radius:9px;font-size:12px}.ghost-btn:hover{background:#334054}.mini-stats{display:flex;align-items:center;justify-content:center;gap:24px;margin-top:14px;color:#a5b9c9}.mini-stat{display:flex;align-items:center;gap:7px;font-size:12px}.mini-stat strong{color:#fff0d2;font-family:system-ui}.instruction-link{display:inline-flex;align-items:center;gap:8px;margin:18px auto 0;border:0;background:transparent;color:#b4c7d7;font-weight:700;font-size:12px}.home-bottom{display:flex;align-items:center;justify-content:center}.game-wrap{max-width:700px;margin:25px auto 0}.screen-header{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;margin:6px 0 16px}.step-label{display:inline-block;color:var(--gold);font-size:11px;font-weight:900;letter-spacing:1px}.screen-header h1{margin:4px 0 5px;font-size:clamp(22px,4vw,30px);line-height:1.4}.screen-header p{margin:0;color:var(--muted);font-size:12px;line-height:1.8}.badge-count{min-width:65px;border-radius:14px;padding:12px;background:#283a4e;border:1px solid #42566e;text-align:center;flex:none}.badge-count strong{display:block;color:#ffdc9d;font-size:25px;line-height:1;font-family:system-ui}.badge-count span{display:block;color:#a4b7c8;font-size:10px;margin-top:5px}.paper-frame{padding:9px;background:#e9ddc2;border-radius:16px;box-shadow:0 12px 33px #0003,0 0 0 2px #f6e6be22;position:relative}.paper-frame::before{position:absolute;content:'';width:3px;background:#d1bea0;inset-block:14px;inset-inline-start:7px;z-index:2}.paper-canvas{display:block;width:100%;height:auto;border:1px solid #c0b9a5;border-radius:7px;background:var(--paper);touch-action:none;user-select:none;-webkit-user-select:none;cursor:crosshair}.deploy-paper{width:100%;max-width:540px;margin:auto}.deploy-paper .paper-canvas{aspect-ratio:1.4}.deploy-paper.vertical-layout .paper-canvas{aspect-ratio:.70}.board-paper .paper-canvas{aspect-ratio:.7}.board-paper.vertical-layout .paper-canvas{aspect-ratio:1.45}.paper-instruction{display:flex;justify-content:space-between;gap:7px;align-items:center;margin:12px 2px 6px;color:#b7c5d2;font-size:11px}.instruction-dot{width:7px;height:7px;display:inline-block;background:#8fdfd8;border-radius:100%;margin-inline-end:5px}.draw-tools{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin:13px 0}.draw-tools button{min-width:0}.draw-tools .primary-btn{min-height:46px}.deploy-progress{display:flex;justify-content:center;gap:8px;margin-top:13px}.soldier-node{height:9px;width:22px;border-radius:100px;background:#3d5263;border:1px solid #617386}.soldier-node.done{background:var(--blue);border-color:#b3fcf5}.tiny-callout{display:flex;align-items:center;gap:8px;padding:11px 13px;border-radius:10px;border:1px dashed #466278;background:#28405252;color:#a8bfcd;font-size:11px;line-height:1.8}.tiny-callout strong{color:#dce4ea}.round-card{max-width:620px;margin:55px auto 30px;background:linear-gradient(145deg,#23354a,#192a3d);border:1px solid #496078;border-radius:27px;padding:38px 25px;text-align:center;box-shadow:0 20px 50px #0003}.round-icon{display:grid;place-items:center;margin:auto auto 17px;width:78px;height:78px;border-radius:24px;font-size:40px;background:#ffd69b22;border:1px solid #cbab7440}.round-card h1{font-size:29px;margin:0 0 9px}.round-card p{margin:0 auto 18px;max-width:430px;color:#b8c9d5;line-height:1.9}.round-card .primary-btn{width:min(100%,320px)}.round-card .ghost-btn{display:block;margin:16px auto 0}.battle-header{display:flex;align-items:center;gap:10px;justify-content:space-between;margin:23px 0 13px}.player-score{flex:1;min-width:0;border:1px solid #3b5063;border-radius:14px;padding:9px 10px;background:#223348;transition:border-color .2s,background .2s}.player-score.active{background:#293d52;border-color:#e4b976}.player-score.enemy.active{border-color:#7bdbd2}.player-score .player-name{display:flex;align-items:center;justify-content:space-between;gap:5px;font-size:12px;font-weight:900}.player-score .player-name .player-mark{width:10px;height:10px;background:var(--orange);border-radius:50%;flex:none}.player-score.enemy .player-name .player-mark{background:var(--blue)}.player-score .score-desc{font-size:11px;color:#b4c6d4;margin-top:3px}.score-track{display:flex;gap:4px;margin-top:9px;direction:ltr}.score-dot{width:12px;height:7px;background:#faaf7b;border-radius:10px}.enemy .score-dot{background:#84dcd2}.score-dot.dead{background:#556a7c;opacity:.55}.vs-badge{width:35px;height:35px;display:grid;place-items:center;flex:none;color:#debd89;border-radius:50%;border:1px solid #475267;background:#1b293a;font-family:system-ui;font-size:11px;font-weight:900}.turn-banner{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid #405770;background:#21364c;padding:10px 12px;border-radius:12px;margin-bottom:12px;font-weight:750;font-size:12px}.turn-banner .turn-dot{display:inline-block;border-radius:100px;width:8px;height:8px;background:#f3bd88;margin-inline-end:5px}.turn-banner .turn-caption{color:#9eb6c8;font-weight:600;font-size:10px}.board-stage{position:relative}.board-paper{padding:7px;overflow:hidden}.board-surface{position:relative;overflow:hidden;border-radius:7px}.board-surface canvas{border-radius:7px}.board-overlay{position:absolute;pointer-events:none;inset:0;overflow:hidden;perspective:1100px;z-index:3;border-radius:7px}.fold-sheet{position:absolute;background:repeating-linear-gradient(0deg,#f6eed6,#f6eed6 24px,#e2e5dc 25px,#f6eed6 26px);opacity:.95;box-shadow:0 10px 27px #6c5c4750;backface-visibility:visible;animation-duration:.88s;animation-timing-function:cubic-bezier(.18,.67,.26,1);animation-fill-mode:forwards}.fold-sheet:before{content:'•';position:absolute;color:#e36b64;font-size:36px;line-height:1;left:42%;top:45%;text-shadow:0 2px 8px #efb7a3}.fold-sheet.side-top{left:0;top:0;width:100%;height:50%;transform-origin:center bottom;animation-name:fold-top}.fold-sheet.side-bottom{left:0;bottom:0;width:100%;height:50%;transform-origin:center top;animation-name:fold-bottom}.fold-sheet.side-left{left:0;top:0;width:50%;height:100%;transform-origin:right center;animation-name:fold-left}.fold-sheet.side-right{right:0;top:0;width:50%;height:100%;transform-origin:left center;animation-name:fold-right}@keyframes fold-top{0%{transform:rotateX(0deg)}55%{transform:rotateX(-110deg)}100%{transform:rotateX(-180deg);opacity:0}}@keyframes fold-bottom{0%{transform:rotateX(0deg)}55%{transform:rotateX(110deg)}100%{transform:rotateX(180deg);opacity:0}}@keyframes fold-left{0%{transform:rotateY(0deg)}55%{transform:rotateY(112deg)}100%{transform:rotateY(180deg);opacity:0}}@keyframes fold-right{0%{transform:rotateY(0deg)}55%{transform:rotateY(-112deg)}100%{transform:rotateY(-180deg);opacity:0}}.fold-center-label{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:11px;background:#eee0c4;border:1px dashed #a39376;padding:3px 10px;border-radius:40px;color:#71644d;box-shadow:0 2px 8px #0002;pointer-events:none;font-weight:900;direction:rtl}.board-controls{margin:15px 0 8px;display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}.board-controls .primary-btn{flex:1;min-width:165px}.battle-message{min-height:40px;display:flex;align-items:center;gap:8px;font-size:12px;color:#b9cbd5;flex:2;line-height:1.7}.battle-message strong{color:#f9d79d}.battle-message.good{color:#88e2d8}.battle-message.warn{color:#f4ac9b}.pvp-turn-cover{position:absolute;z-index:4;inset:0;display:grid;place-items:center;background:#17293aeb;border-radius:10px;text-align:center;backdrop-filter:blur(6px);padding:22px}.pvp-turn-cover h3{font-size:23px;margin:8px 0}.pvp-turn-cover p{font-size:13px;color:#c1d0de}.pvp-turn-cover .primary-btn{min-width:180px}.result-stars{font-size:40px;letter-spacing:6px;margin:3px auto 8px}.result-recap{display:flex;gap:10px;align-items:center;justify-content:center;margin:23px auto}.result-stat{min-width:90px;border:1px solid #3e5164;background:#2b3b4e;border-radius:12px;padding:10px;font-size:11px;color:#b8c8d6}.result-stat strong{display:block;font-size:22px;color:#ffda9e;font-family:system-ui}.result-btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;max-width:410px;margin:12px auto}.result-btns button{width:100%}.toast{position:fixed;z-index:99;bottom:max(24px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:max-content;max-width:min(94vw,440px);border-radius:12px;border:1px solid #65859a;background:#23384e;color:#fff7eb;padding:10px 15px;text-align:center;font-size:12px;font-weight:800;box-shadow:0 10px 40px #0008;animation:toast-in .24s both}.toast[hidden],.dialog-host[hidden]{display:none!important}@keyframes toast-in{from{transform:translate(-50%,10px);opacity:0}to{transform:translate(-50%,0);opacity:1}}.dialog-host{position:fixed;z-index:50;inset:0;display:grid;place-items:center;padding:16px;background:#08121bc9;backdrop-filter:blur(9px)}.dialog-panel{width:min(100%,480px);max-height:90vh;overflow:auto;border:1px solid #4c6578;border-radius:23px;background:linear-gradient(145deg,#273b4d,#1b293b);padding:24px;box-shadow:0 25px 60px #0007}.dialog-panel h2{font-size:23px;margin:0 0 9px}.dialog-panel p{font-size:13px;color:#c2ceda;line-height:1.9}.dialog-panel .how-list{counter-reset:how;display:grid;gap:13px;margin:18px 0 24px}.dialog-panel .how-row{display:flex;gap:11px;align-items:flex-start}.dialog-panel .how-num{flex:none;display:grid;place-items:center;width:27px;height:27px;border-radius:9px;background:#ffcb85;color:#283348;font-family:system-ui;font-weight:900}.dialog-panel .how-row span:last-child{color:#d8e0e9;font-size:12px}.dialog-panel .primary-btn{width:100%}.landscape-hint{display:none}.impact-text{position:absolute;pointer-events:none;left:50%;top:50%;transform:translate(-50%,-50%);z-index:5;background:#182837e0;color:#ffe0a1;padding:6px 15px;border-radius:100px;border:1px solid #cbae76;font-weight:900;letter-spacing:.2px}
html[dir=ltr] .hero-title{letter-spacing:-1px}html[dir=ltr] .hero-art{transform:rotate(3deg)}html[dir=ltr] .brand-name small{text-align:left}html[dir=ltr] .paper-frame::before{left:7px;right:auto}
@media(min-width:740px){.settings-panel{margin-top:4px}.game-wrap{margin-top:31px}.board-paper{max-width:670px;margin:auto}.board-paper:not(.vertical-layout){max-width:460px}.hero{margin-top:38px}}
@media(max-width:739px){.app-shell{padding:0 14px}.topbar{padding:16px 1px 14px}.hero{grid-template-columns:1fr;gap:23px;margin-top:24px;margin-bottom:19px}.hero-title{font-size:37px;line-height:1.22;margin:13px 0 10px;letter-spacing:-1.3px}.hero-description{font-size:12px}.hero-art{width:min(100%,335px);aspect-ratio:2.0;max-width:335px;border-width:6px}.hero-soldier{height:55px;width:37px}.hero-soldier.s2,.hero-soldier.s4{top:50%}.hero-fold-corner{border-top-width:60px;border-right-width:60px}.settings-panel{padding:17px 15px;border-radius:19px}.mode-card{padding:10px 9px;min-height:69px;gap:8px}.mode-card .mode-icon{font-size:21px}.mode-card strong{font-size:11px}.mode-card small{font-size:10px}.setting-row{margin-top:15px}.chip{padding:8px 11px;min-width:45px}.primary-btn.wide{margin-top:17px}.game-wrap{margin-top:19px}.paper-frame{padding:6px;border-radius:12px}.deploy-paper{max-width:510px}.footer{padding-top:18px}.screen-header h1{font-size:21px}.round-card{margin-top:42px;padding:30px 21px}.battle-header{margin:18px 0 12px}.player-score{padding:7px 8px}.player-score .player-name{font-size:11px}.board-controls{gap:8px}.board-controls .primary-btn{min-width:140px}.battle-message{font-size:11px}.landscape-hint{display:inline-block}}
@media(max-width:390px){.hero-title{font-size:34px}.mode-card{gap:6px}.mode-card .mode-icon{font-size:18px}.screen-header h1{font-size:19px}.draw-tools{gap:7px}.draw-tools button{font-size:11px;padding:8px 9px}.paper-instruction{font-size:10px}.header-actions{gap:6px}.battle-message{flex-basis:100%}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* Online 1v1 room, optional text and voice chat */
.online-lobby{margin-top:30px;display:flex;flex-direction:column;gap:12px;align-items:stretch}
.online-lobby h1{margin:0;font-size:clamp(19px,4vw,26px)}
.online-lobby p{margin:0 0 10px;color:#b9cbd7}
.online-lobby .ghost-btn{align-self:center}
.form-label{font-weight:800;font-size:12px;color:#dfebf0;display:flex;flex-direction:column;gap:7px}
.form-label input{width:100%;background:#17283b;border:1px solid #536c7e;color:#fff5db;border-radius:11px;padding:13px;font-size:16px;min-height:49px}
.form-label input::placeholder,.chat-compose input::placeholder{color:#9bb0c0}
.lobby-separator{text-align:center;font:800 11px system-ui;color:#879bae;margin:2px}
.room-display{display:flex;align-items:center;justify-content:space-between;background:#18283c;border:1px solid #4e697d;border-radius:14px;padding:14px}
.room-display span{color:#bfd1d9;font-size:12px}
.room-display strong{color:#ffd18b;font-size:clamp(25px,6vw,36px);letter-spacing:4px;font-family:system-ui,Arial}
.invite-box{display:flex;flex-direction:column;gap:6px;min-width:0}
.invite-box span{font-size:12px;color:#aec1ce}
.invite-box code{font-size:11px;overflow-wrap:anywhere;color:#90e2db;background:#17283b;padding:12px;border-radius:10px;text-align:left}
.lobby-players{display:grid;gap:8px;margin-top:8px}
.lobby-person{display:flex;align-items:center;gap:9px;background:#27394b;border:1px solid #43566d;border-radius:10px;padding:12px;font-weight:800}
.lobby-person span{margin-inline-start:auto;font-size:11px;color:#87cfc9}
.online-social{margin:17px auto 28px;width:100%;max-width:750px;background:#1e2f42;border-radius:19px;border:1px solid #40566b;padding:14px}
.social-top{display:flex;justify-content:space-between;gap:15px;align-items:center;padding-bottom:10px}
.social-top strong{font-size:13px}
.social-status{color:#90d3cf;font-size:11px;font-weight:700}
.chat-log{display:flex;flex-direction:column;gap:8px;overflow-y:auto;min-height:65px;max-height:180px;background:#162638;border:1px solid #31485c;border-radius:11px;padding:10px}
.chat-empty{color:#7a91a4;text-align:center;margin:auto}
.chat-item{max-width:88%;align-self:flex-start;padding:7px 11px;border-radius:11px;background:#2b3e53;display:flex;flex-direction:column;word-break:break-word;text-align:start}
.chat-item.mine{align-self:flex-end;background:#2a575b}
.chat-item b{font-size:10px;color:#ffca88}
.chat-item span{font-size:12px;color:#f1f7fb;white-space:pre-wrap}
.chat-compose{margin-top:10px;display:flex;gap:8px}
.chat-compose input{background:#152537;color:#edf4fd;border:1px solid #53687d;border-radius:11px;padding:10px 12px;flex:1;width:30px;font-size:14px;min-width:0}
.chat-compose .secondary-btn{padding:8px 11px;flex:none}
.voice-controls{display:flex;align-items:center;gap:11px;margin-top:11px}
.voice-controls .secondary-btn{min-width:135px;flex:none;padding:8px 12px}
.voice-status{font-size:10px;color:#95bacb;line-height:1.55}
@media(max-width:520px){.voice-controls{align-items:flex-start;flex-direction:column}.online-lobby{margin-top:20px}.chat-log{max-height:130px}.room-display strong{letter-spacing:2px}}

.mode-grid .mode-card:last-child:nth-child(odd){grid-column:1/-1;justify-content:center}


/* v2.1 Mobile battle HUD and a standalone keyboard-safe chat sheet */
[hidden]{display:none!important}
.topbar{position:sticky;top:0;z-index:20;background:rgba(16,25,37,.94);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);padding-block:13px}
.header-actions{flex-shrink:0}
.chat-toggle,.quick-mic{position:relative;display:inline-grid;place-items:center;width:39px;padding:0;line-height:1}
.chat-toggle{color:#ffe0a8;border-color:#8a704f}
.chat-toggle svg,.quick-mic svg{display:block}
.chat-unread{position:absolute;top:-8px;right:-7px;min-width:19px;height:19px;padding:0 4px;border:2px solid #101925;background:#f7a56d;color:#182638;border-radius:999px;font:900 10px/16px system-ui,Arial,sans-serif;text-align:center}
.quick-mic.mic-active{color:#8be6ce;background:#1c514b;border-color:#65bea8}
.quick-mic.mic-ready{color:#ffdaa3;border-color:#e9bd79}
.in-battle .game-wrap{margin-top:9px}
.in-battle .battle-header{margin:7px 0 9px}
.in-battle .turn-banner{margin-bottom:9px}
.in-battle .footer{display:none}
.board-paper:not(.vertical-layout){width:min(100%,43dvh,460px);margin-inline:auto}
.board-controls{margin-top:9px}
.board-controls .primary-btn{min-height:49px}
.in-battle .tiny-callout{margin:9px auto 13px;max-width:600px}
.player-name span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.turn-banner>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.turn-banner .turn-caption{flex-shrink:0}

/* The chat panel stays mounted outside the rerendered game area. */
body.chat-open{overflow:hidden;touch-action:pan-y}
.chat-layer{position:fixed;z-index:90;left:0;right:0;top:var(--chat-viewport-top,0px);height:var(--chat-viewport-height,100dvh);display:flex;justify-content:center;align-items:flex-end;isolation:isolate}
.chat-backdrop{position:absolute;inset:0;background:rgba(5,12,23,.75);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px)}
.chat-sheet{position:relative;z-index:1;width:min(100%,520px);height:min(76%,650px);min-height:220px;max-height:100%;display:flex;flex-direction:column;gap:0;background:#1b2b3e;border:1px solid #5a6f83;border-bottom:0;box-shadow:0 -12px 45px #0008;border-radius:23px 23px 0 0;padding:10px 16px max(12px,env(safe-area-inset-bottom));overflow:hidden}
.chat-grip{width:45px;height:5px;border-radius:100px;background:#637789;flex:none;margin:0 auto 11px}
.chat-panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-bottom:10px;border-bottom:1px solid #34495f}
.chat-heading-text{display:flex;flex-direction:column;gap:0;min-width:0}
.chat-heading-text strong{font-size:15px;color:#ffddb1}
.chat-close{width:38px;height:38px;flex:none;background:#2a4053;border:1px solid #62778b;color:#fff2d9;border-radius:12px;font-size:19px;line-height:1}
.chat-sheet .chat-log{min-height:0;max-height:none;flex:1;overflow-y:auto;overscroll-behavior:contain;border:none;background:transparent;padding:14px 4px 9px;scrollbar-width:thin}
.chat-sheet .chat-compose{margin:5px 0 0;display:flex;align-items:stretch;gap:8px;flex:none}
.chat-sheet .chat-compose input{min-height:48px;min-width:0;flex:1;font-size:16px;line-height:normal;color:#f5f7fb;background:#142436;border:1px solid #5a7085;padding:10px 13px;border-radius:13px}
.chat-send{min-height:48px;min-width:69px;flex:none;padding:8px 12px;border:0;border-radius:12px;background:linear-gradient(130deg,#ffdfa9,#f2ad80);color:#223044;font-weight:900;font-size:13px}
.chat-sheet .voice-controls{display:flex;flex-direction:row;align-items:center;gap:9px;flex:none;margin-top:10px;min-height:42px}
.chat-sheet .voice-controls .secondary-btn{min-width:110px;min-height:38px;padding:7px 10px;font-size:11px}
.chat-sheet .voice-controls .voice-status{font-size:10px;line-height:1.45}
.chat-sheet .chat-item{max-width:85%;padding:9px 12px}
.chat-sheet .chat-item span{font-size:13px}
@media(min-width:700px){.chat-layer{align-items:center}.chat-sheet{height:min(72%,650px);border-bottom:1px solid #5a6f83;border-radius:22px;padding-bottom:16px}.chat-backdrop{background:rgba(5,12,23,.80)}}
@media(max-width:740px){
  .topbar{padding:9px 1px 9px}
  .app-shell{padding-inline:12px}
  .game-wrap{margin-top:12px}
  .in-battle .game-wrap{margin-top:7px}
  .in-battle .battle-header{gap:7px;margin:6px 0}
  .player-score{padding:6px 9px;border-radius:12px}
  .player-score .score-track{margin-top:5px}
  .score-dot{height:6px}
  .vs-badge{width:27px;height:27px;font-size:10px}
  .turn-banner{padding:8px 11px;font-size:11px;gap:7px}
  .in-battle .turn-banner{margin-bottom:7px}
  .board-controls{display:flex;flex-direction:column;align-items:stretch;gap:5px;margin:7px 0}
  .board-controls .battle-message{flex:auto;min-height:28px;line-height:1.5}
  .board-controls .primary-btn{width:100%;flex:auto}
  .in-battle .tiny-callout{padding:8px 10px;margin-top:8px}
}
@media(max-width:390px){
  .brand-mark{width:34px;height:34px;border-radius:10px}
  .brand-mark svg{width:27px;height:27px}
  .brand-name strong{font-size:12px;letter-spacing:.6px}
  .brand-name small{font-size:9px;margin-top:2px}
  .brand{gap:6px}
  .header-actions{gap:5px}
  .icon-button,.language-switch{height:35px;min-width:35px;border-radius:9px}
  .chat-toggle,.quick-mic{width:35px}
  .language-switch{padding:0 6px;font-size:11px}
  .turn-banner{font-size:10px}
  .chat-sheet{padding-inline:11px}
}
@media(max-width:350px){.brand-name small{display:none}.help-btn{display:none}}
@media(max-height:690px) and (orientation:portrait){.board-paper:not(.vertical-layout){width:min(100%,39dvh,420px)}.in-battle .tiny-callout{display:none}}
@media(max-height:500px) and (orientation:landscape){.in-battle .game-wrap{margin-top:4px}.board-paper.vertical-layout{max-width:min(96%,95dvh)}.in-battle .tiny-callout{display:none}.chat-sheet{height:94%;min-height:0}.chat-sheet .voice-controls{display:none}}
@media(min-width:1000px) and (min-height:650px){.board-paper:not(.vertical-layout){width:min(100%,52dvh,460px)}}
@media(max-height:500px) and (orientation:landscape){.board-paper:not(.vertical-layout){width:min(100%,58dvh,400px)}}

/* Native room sharing with a separate copy-link fallback. */
.invite-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-block:12px}
.invite-actions>button{min-width:0;width:100%;white-space:normal;margin:0}
@media(max-width:350px){.invite-actions{grid-template-columns:1fr}}

/* Fold & Fire V3 -- social features without changing the classic paper mechanics. */
.social-top-button{flex-shrink:0;border:1px solid rgba(255,255,255,.14);font-size:19px}
.online-discovery{display:flex;gap:9px;margin:12px 0;flex-wrap:wrap}
.online-discovery>button{flex:1;min-width:130px}
.room-mode-pill{display:inline-flex;align-items:center;border-radius:30px;padding:7px 13px;background:rgba(109,204,215,.1);border:1px solid rgba(109,204,215,.25);font-size:12px;margin:8px auto}
.exit-online-btn{width:min(100%,280px);margin:12px auto 0;display:block;font-size:13px}
.v3-army-palette{background:#1d3143;border:1px solid #345066;border-radius:15px;padding:12px;margin-bottom:12px;color:#dbe4eb}
.v3-palette-head{font-weight:750;margin-bottom:8px;font-size:13px}
.v3-palette-buttons{display:flex;flex-wrap:wrap;gap:7px}
.unit-choice{display:flex;align-items:center;flex-direction:column;gap:2px;flex:1;min-width:65px;max-width:100px;border-radius:10px;padding:7px 3px;background:#263c51;color:#eff9fb;border:1px solid #36536b;font-size:23px;cursor:pointer}
.unit-choice.active{border-color:#ffd089;background:#3b4d59}
.unit-choice:disabled{opacity:.38;cursor:not-allowed}
.unit-choice small{font-size:10px;line-height:1.3}
.social-layer{position:fixed;inset:0;z-index:1300;display:grid;place-items:end center;overflow:hidden}
.social-layer[hidden]{display:none!important}
.social-backdrop{position:absolute;inset:0;border:0;background:rgba(2,10,20,.74)}
.social-sheet{position:relative;background:#142434;color:#e7f0f8;border:1px solid #395269;border-radius:20px 20px 0 0;box-shadow:0 -18px 45px rgba(0,0,0,.45);width:min(100%,550px);height:min(86dvh,780px);display:flex;flex-direction:column;overflow:hidden}
.social-head{display:flex;align-items:center;justify-content:space-between;padding:13px 16px;border-bottom:1px solid #31485d}
.social-head button{border:0;background:#2a3c50;border-radius:50%;color:white;width:33px;height:33px;font-size:21px}
.social-tabs{display:flex;gap:3px;overflow-x:auto;padding:9px 10px;border-bottom:1px solid #354b60;flex:none}
.social-tabs button{flex:0 0 auto;padding:9px 11px;border-radius:10px;border:0;background:transparent;color:#aabcca;font-size:12px}
.social-tabs button.selected{background:#35506c;color:#fff;font-weight:bold}
.social-content{flex:1;overflow-y:auto;padding:14px;overscroll-behavior:contain;padding-bottom:max(30px,env(safe-area-inset-bottom))}
.social-content h3{margin:4px 0 8px}.social-content p{color:#adc1cf;font-size:13px;line-height:1.7}
.social-content .primary-btn,.social-content .secondary-btn{padding:11px 13px;border-radius:10px;min-height:38px}
.social-content input{width:100%;min-width:0;box-sizing:border-box;min-height:44px;background:#eaf2f9;border-radius:10px;border:1px solid #4a6578;padding:8px 10px;color:#172b40;font-size:16px}
.social-content label{display:block;font-size:13px;margin-bottom:12px}
.social-profile-card{display:flex;gap:12px;background:#263c51;padding:14px;border-radius:14px;align-items:center}
.social-profile-card>div{display:flex;flex-direction:column;gap:4px}.social-profile-card strong{font-size:17px}
.social-profile-card small,.social-box small{display:block;color:#b5c6d4;font-size:12px}
.social-avatar{font-size:38px}
.social-box{display:grid;gap:10px;padding:12px;background:#1f3246;border-radius:12px;margin:10px 0}
.social-add{display:flex;gap:7px;margin-bottom:15px}.social-add button{flex:none}
.social-list-item{display:flex;justify-content:space-between;align-items:center;gap:9px;padding:12px 8px;border-bottom:1px solid #344a5e}
.social-list-item>div:first-child{display:flex;flex-direction:column;min-width:0;gap:6px;overflow-wrap:anywhere}
.social-list-item small{color:#a9bbc9;font-size:11px}
.social-item-actions{display:flex;gap:5px;flex:none}
.social-item-actions button{font-size:12px;min-width:36px}
.social-shop{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.social-shop-item{display:flex;flex-direction:column;align-items:center;gap:6px;background:#24384a;border-radius:12px;padding:12px 8px;text-align:center}
.social-shop-item .unit-emoji{font-size:35px}.social-shop-item small{color:#acc1ce;font-size:11px}
.social-waiting{text-align:center;padding:30px 10px}.social-waiting>span{font-size:54px}
body.social-open{overflow:hidden}
@media(min-width:700px){.social-layer{place-items:center}.social-sheet{border-radius:19px;height:min(83dvh,750px)}}
@media(max-width:350px){.social-shop{grid-template-columns:1fr}.unit-choice{min-width:57px}}

/* Leaderboard actions remain reachable on narrow mobile displays. */
.leaderboard-person>span{font-variant-numeric:tabular-nums;min-width:20px}
.leaderboard-person>div:first-of-type{flex:1;min-width:0}
.leaderboard-person .social-item-actions button{white-space:nowrap;min-width:58px}
@media(max-width:350px){.leaderboard-person{gap:5px;padding-inline:3px}.leaderboard-person .social-item-actions button{font-size:11px;padding:8px 6px}}
