:root{color-scheme:dark;--bg:#0a0e1a;--panel:#151b2e;--panel2:#1c2440;--text:#eef2ff;--muted:#a3adc7;--line:#364362;--gold:#f8ce80;--blue:#7ab9fb;--red:#ff877f;--green:#91d5a3;font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 80% -10%,#2c2754 0,transparent 40%),radial-gradient(circle at 10% 50%,#10213c 0,transparent 40%),var(--bg);color:var(--text);min-height:100vh}button{font:inherit;cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}.shell{width:min(100%,1160px);min-height:100vh;margin:auto}.topbar{display:flex;justify-content:space-between;align-items:center;padding:16px 22px;border-bottom:1px solid #ffffff15;background:#0c1120cc;position:sticky;top:0;z-index:10;backdrop-filter:blur(14px)}.brand{display:flex;align-items:center;gap:8px;font-size:24px;font-weight:850;letter-spacing:.03em}.brand-mark{font-size:40px;color:var(--gold);line-height:.75;text-shadow:0 0 20px #f9bd60}.brand small{display:block;font-size:9px;color:var(--muted);letter-spacing:.25em;font-weight:700}.topright{display:flex;align-items:center;gap:14px;font-size:13px;color:var(--muted)}.dust{background:#ffffff13;padding:7px 10px;border-radius:999px;color:var(--gold)}.tabs{display:flex;gap:5px;padding:8px 14px;background:#11172a;border-bottom:1px solid #ffffff12;position:sticky;top:70px;z-index:9}.tabs button{flex:1;min-width:0;padding:10px 4px;color:var(--muted);border:0;border-radius:9px;background:none;font-size:13px}.tabs button.active{color:var(--text);background:#33456a}.screen{padding:22px;min-height:70vh}.hero{display:grid;grid-template-columns:1.5fr 1fr;gap:18px;align-items:stretch;margin-bottom:20px}.hero-main{background:linear-gradient(135deg,#202951,#182039 55%,#39274f);border:1px solid #6a5d9440;border-radius:18px;padding:29px;min-height:240px;position:relative;overflow:hidden}.hero-main:after{content:'◇';position:absolute;right:16px;top:-80px;font-size:310px;color:#ffffff09;transform:rotate(16deg)}.eyebrow{color:var(--gold);text-transform:uppercase;letter-spacing:.15em;font-size:11px;font-weight:750}.hero h1{font-size:clamp(28px,4vw,48px);line-height:1.05;margin:14px 0}.hero p{max-width:520px;color:#c5cce0;line-height:1.5}.hero-side,.panel{background:var(--panel);border:1px solid #ffffff16;border-radius:18px;padding:20px}.hero-side h3,.panel h3{margin:0 0 12px}.actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:20px}.primary,.secondary,.danger,.subtle{border:1px solid transparent;border-radius:10px;padding:11px 15px;font-weight:700}.primary{background:linear-gradient(135deg,#f6d894,#e8a75b);color:#241b18}.secondary{background:#34496e;color:#f1f6ff}.danger{background:#4b2737;color:#ffb7b4}.subtle{background:#222b44;color:var(--muted);border-color:#34405c}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}.muted{color:var(--muted)}.small{font-size:12px}.pill{display:inline-block;border-radius:999px;padding:5px 8px;background:#ffffff14;font-size:12px;color:var(--muted)}.pill.good{color:var(--green);background:#3f755133}.pill.warn{color:var(--gold);background:#82653d33}.list{display:grid;gap:9px}.match-row{width:100%;text-align:left;background:#202a43;border:1px solid #3a4869;border-radius:12px;padding:13px;color:var(--text);display:flex;justify-content:space-between;align-items:center}.match-row:hover,.card:hover{border-color:var(--gold)}.battle{display:grid;gap:14px}.battle-header{display:flex;justify-content:space-between;gap:12px;align-items:center}.battle-header h1{margin:0;font-size:23px}.combatant{background:linear-gradient(90deg,#242b47,#1a2137);border:1px solid #ffffff16;border-radius:15px;padding:13px 15px;display:flex;justify-content:space-between;align-items:center;gap:12px}.combatant.enemy{border-color:#8e49465a}.combatant.self{border-color:#4c7e9a6b}.big-stat{font-size:20px;font-weight:800}.stats{display:flex;gap:9px;flex-wrap:wrap}.stats span{padding:6px 8px;border-radius:8px;background:#ffffff10}.battle-center{display:grid;grid-template-columns:minmax(0,1fr) 200px;gap:12px}.market{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.card{min-height:150px;background:linear-gradient(160deg,#27335a,#161e34);border:1px solid #4d5b7e;border-radius:12px;padding:10px;color:var(--text);text-align:left;display:flex;flex-direction:column;gap:6px;box-shadow:0 5px 12px #0003}.card.forge{border-color:#b97b59;background:linear-gradient(160deg,#51372f,#251e2b)}.card.swarm{border-color:#62a58c;background:linear-gradient(160deg,#264c4d,#172d38)}.card.echo{border-color:#8d83c8;background:linear-gradient(160deg,#403d63,#24233d)}.card.played{opacity:.7}.card .faction{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#d3daf2}.card strong{font-size:14px;line-height:1.13}.card .text{font-size:11px;line-height:1.35;color:#cbd3e8;flex:1}.card .cost{align-self:flex-end;background:#e9b86b;color:#241b1d;border-radius:50%;width:25px;height:25px;display:grid;place-items:center;font-weight:800;font-size:12px}.market-side{display:flex;flex-direction:column;gap:8px}.market-side .card{min-height:130px}.turnbar{display:flex;justify-content:space-between;align-items:center;gap:10px;background:#151d33;border:1px solid #ffffff16;border-radius:13px;padding:11px 14px}.clock{font-size:21px;font-variant-numeric:tabular-nums;font-weight:800;color:var(--gold)}.clock.urgent{color:var(--red)}.hand{display:grid;grid-template-columns:repeat(auto-fit,minmax(115px,1fr));gap:8px}.hand .card{min-height:145px}.section-label{display:flex;justify-content:space-between;align-items:center;margin:2px 0 7px;font-size:13px;text-transform:uppercase;letter-spacing:.1em;color:var(--muted)}.game-actions{display:flex;gap:8px;flex-wrap:wrap}.game-actions button{flex:1}.log{background:#0f1527;border:1px solid #ffffff10;border-radius:12px;padding:10px 14px;color:#aebad2;font-size:12px;max-height:120px;overflow:auto}.log div{padding:2px 0}.shop-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.product{background:var(--panel);border:1px solid #ffffff17;border-radius:14px;padding:17px}.product .art{font-size:36px;margin-bottom:12px}.product h3{margin:0 0 7px}.product p{font-size:13px;color:var(--muted);min-height:46px}.product button{width:100%}.result{text-align:center;padding:24px 10px}.result .symbol{font-size:72px;color:var(--gold);line-height:1}.result h1{font-size:34px;margin:8px}.ad-slot{min-height:0;margin:16px auto;max-width:650px}.ad-slot:not(:empty){min-height:80px}.loading{text-align:center;color:var(--muted);padding:65px 10px}.empty{padding:22px;text-align:center;color:var(--muted);border:1px dashed #55617c;border-radius:12px}.invite-box{background:#222d49;padding:12px;border-radius:10px;word-break:break-all;margin:15px 0;font-size:13px}.choice-dialog{border:1px solid #657391;border-radius:16px;background:#182038;color:var(--text);width:min(92vw,430px);padding:20px}.choice-dialog::backdrop{background:#050816b8}.choice-dialog h3{margin:0 0 12px}.choice-dialog #choice-list{display:grid;gap:7px;margin-bottom:10px}.choice-dialog #choice-list button{width:100%;text-align:left}.choice-dialog .subtle{width:100%}#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%) translateY(100px);opacity:0;z-index:100;background:#293652;color:white;padding:12px 16px;border:1px solid #64759b;border-radius:10px;box-shadow:0 12px 30px #0007;transition:.22s;max-width:min(90vw,500px)}#toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.battle.board-dark{background:radial-gradient(circle at 50% 35%,#30205d 0,#14142f 50%,#090d19 100%);border:1px solid #6650a0;border-radius:18px;padding:12px}.battle.back-back .hand .card{box-shadow:inset 0 0 0 2px #e6ad63,0 6px 17px #e6ad6333}.battle.back-dust_back .hand .card{box-shadow:inset 0 0 0 2px #6fd3db,0 6px 17px #6fd3db33}
@media(max-width:800px){.hero{grid-template-columns:1fr}.battle-center{grid-template-columns:1fr}.market-side{display:flex;flex-direction:row;align-items:center}.market-side .card{width:150px;min-width:150px}.market-side small{max-width:200px}.market{grid-template-columns:repeat(5,minmax(135px,1fr));overflow-x:auto;padding-bottom:4px}.screen{padding:14px}.grid2{grid-template-columns:1fr}}
@media(max-width:520px){.topbar{padding:11px 13px}.topright{font-size:12px}.tabs{top:58px;padding:6px}.tabs button{font-size:11px}.hero-main{padding:20px;min-height:210px}.combatant{font-size:12px}.market{grid-template-columns:repeat(5,134px)}.hand{grid-template-columns:repeat(3,minmax(0,1fr))}.hand .card{min-height:145px}.card{padding:8px}.card strong{font-size:12px}.card .text{font-size:10px}.game-actions button{font-size:12px;padding:10px 6px}}

/* Во время дуэли важные действия остаются над рынком на узком экране. */
@media(max-width:800px){
  .topbar{height:48px;min-height:48px;padding:5px 12px}.brand{font-size:19px}.brand-mark{font-size:29px}.brand small{font-size:7px}.topright{gap:7px;font-size:11px}.dust{padding:5px 7px}
  .tabs{top:48px;padding:3px 7px}.tabs button{padding:6px 2px;font-size:11px}.screen{padding:9px 10px}
  .battle{gap:8px;grid-template-areas:'header' 'enemy' 'turn' 'self' 'hand' 'actions' 'market' 'log'}
  .battle-header{grid-area:header}.battle-header h1{font-size:18px}.battle-header .eyebrow{font-size:9px}
  .combatant.enemy{grid-area:enemy}.combatant.self{grid-area:self}.combatant{padding:8px 10px;min-height:44px}.combatant .small{display:none}.stats{gap:5px}.stats span{padding:3px 6px}.big-stat{font-size:16px}
  .battle>.turnbar{grid-area:turn;padding:7px 10px;min-height:40px}.turnbar .small{display:none}.clock{font-size:19px}
  .battle>section:nth-of-type(1){grid-area:market;min-width:0}.battle>section:nth-of-type(2){grid-area:hand;min-width:0}
  .battle>.game-actions{grid-area:actions}.battle>details{grid-area:log;font-size:12px}
  .section-label{font-size:10px;letter-spacing:.05em;margin:0 0 4px}.section-label span+span{display:none}
  .hand{display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin;padding-bottom:3px}.hand .card{flex:0 0 107px;min-height:107px}
  .battle-center{display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin;padding-bottom:3px}.market{display:flex;gap:6px;overflow:visible;padding:0}.market .card,.market-side .card{flex:0 0 112px;width:112px;min-height:112px}.market-side{order:-1;display:flex;flex:0 0 auto}.market-side small{display:none}
  .card{padding:7px;gap:3px}.card .faction{font-size:9px}.card strong{font-size:11px}.card .text{font-size:10px;line-height:1.2}.card .cost{width:22px;height:22px}
  .game-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}.game-actions button{min-width:0;padding:8px 3px;font-size:11px}
  .hero{gap:9px;margin-bottom:10px}.hero-main{min-height:0;padding:16px}.hero h1{font-size:29px;margin:8px 0}.hero p{margin:8px 0;font-size:13px}.hero-side,.panel{padding:13px}.actions{margin-top:11px}.grid2{gap:9px}
  .daily-card{display:grid;grid-template-columns:1fr auto;align-items:center;gap:3px 10px}.daily-card .eyebrow,.daily-card h3,.daily-card p{grid-column:1}.daily-card h3{margin:0;font-size:16px}.daily-card p{margin:0}.daily-card button{grid-column:2;grid-row:1 / 4;align-self:center;padding:9px 10px;font-size:11px}
  .help-panel summary{font-size:15px;font-weight:700;cursor:pointer}.help-panel p{font-size:12px;line-height:1.35}
  .shop-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.product{padding:11px}.product .art{font-size:26px;margin-bottom:5px}.product h3{font-size:14px}.product p{min-height:0;margin:6px 0;font-size:11px}
}
@media(max-width:440px){.game-actions{grid-template-columns:repeat(2,minmax(0,1fr))}.hero-main:after{font-size:210px;right:-12px;top:-45px}.topright #user-name{display:none}.daily-card{grid-template-columns:1fr}.daily-card button{grid-column:1;grid-row:auto;justify-self:start}}

/* Рука, рынок и базовый модуль используют один размер карты. */
.battle{--card-size:156px}
.battle .market,.battle .hand{display:flex;gap:8px;min-width:0;overflow-x:auto;scrollbar-width:thin}
.battle .market .card,.battle .hand .card,.battle .market-side .card{box-sizing:border-box;flex:0 0 var(--card-size);width:var(--card-size);height:var(--card-size);min-height:0;overflow:hidden}
.battle .market-side .card{min-width:0}
.battle .card .effect-list{font-size:16px;line-height:1.2;white-space:normal}
.battle .card .ally-effects{font-size:13px;line-height:1.2;color:var(--gold)}
.battle .card .cost{margin-top:auto;flex:0 0 auto}
.game-actions{display:flex;flex-wrap:nowrap;gap:6px}.game-actions button{flex:1 1 0;min-width:0;min-height:42px;padding:5px;font-size:22px;line-height:1}
.icon-legend{padding:3px 0 8px;color:var(--gold);line-height:1.5;border-bottom:1px solid #ffffff20;margin-bottom:5px}
@media(max-width:800px){
  .battle{--card-size:126px}
  .battle .market{overflow:visible;gap:6px;padding:0}
  .battle .hand{gap:6px}
  .battle .market-side{align-items:stretch}
  .battle .card .effect-list{font-size:14px}
  .battle .card .ally-effects{font-size:12px}
  .game-actions{display:flex;grid-template-columns:none}
}
@media(max-width:440px){
  .battle{--card-size:118px}
  .battle .card .effect-list{font-size:13px}
  .battle .card .ally-effects{font-size:11px}
  .game-actions{display:flex;grid-template-columns:none}
}

/* Плотная сетка: карты без пустого низа и горизонтального скролла. */
.battle .battle-center,.battle .hand{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px;overflow:visible;padding:0;min-width:0}
.battle .market,.battle .market-side{display:contents}
.battle .market .card,.battle .hand .card,.battle .market-side .card{position:relative;box-sizing:border-box;flex:none;width:100%;height:88px;min-height:88px;padding:6px;gap:2px;overflow:hidden}
.battle .card .faction{font-size:9px;line-height:1.1;max-width:calc(100% - 23px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.battle .card strong{font-size:11px;line-height:1.1;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.battle .card .effect-list{font-size:12px;line-height:1.1}
.battle .card .ally-effects{font-size:10px;line-height:1.1}
.battle .card .cost{position:absolute;top:5px;right:5px;width:19px;height:19px;margin:0;font-size:11px}
.battle .market-side small{display:none}
.battle .market .empty,.battle .hand .empty{grid-column:1/-1}
.opponent-activity{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;padding:5px 8px;border:1px solid #39496b;border-radius:10px;background:#172238;font-size:11px;line-height:1.2}
.activity-label{color:var(--gold);font-weight:700}.activity-chip{padding:3px 6px;border-radius:6px;background:#31415e;color:#edf2ff}
@media(max-width:800px){.battle{grid-template-areas:'header' 'enemy' 'activity' 'turn' 'self' 'hand' 'actions' 'market' 'log'}.battle>.opponent-activity{grid-area:activity}}
@media(max-width:560px){.battle .battle-center,.battle .hand{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:430px){.battle .battle-center,.battle .hand{grid-template-columns:repeat(3,minmax(0,1fr))}}
.game-actions button:disabled{opacity:.32;filter:grayscale(.8)}
.log>div:not(.icon-legend){display:flex;align-items:flex-start;gap:6px}
.log-icon{flex:0 0 18px;text-align:center;line-height:1.2}

.shell.in-game .topbar,.shell.in-game .tabs{display:none}
.shell.in-game .screen{padding-top:7px}
.battle-header{justify-content:flex-start}
.battle-header .pill{margin-left:auto}
.battle-back{flex:0 0 auto;padding:7px 11px}
.log-row{display:flex;align-items:flex-start;gap:6px;padding:3px 0;border-bottom:1px solid #ffffff0b;flex-wrap:wrap}
.log-message{flex:1 1 180px}
.log-effects{color:#f4d192;font-weight:700;white-space:nowrap}
.log-effects b{font-weight:700;color:#a6d7fa}
.end-turn-dialog p{color:var(--muted);margin:0 0 10px}.end-turn-dialog ul{margin:0 0 18px;padding-left:20px;line-height:1.7}.dialog-actions{display:flex;gap:8px}.dialog-actions button{flex:1}
.lobby{display:grid;gap:14px;max-width:760px;margin:auto}.lobby .panel h1{margin:8px 0 10px}.lobby-status{padding:12px 14px;border:1px solid #435172;border-radius:10px;background:#202b46;color:var(--muted)}.lobby-status.searching{color:var(--gold);border-color:#a9874d}.social-panel{margin:16px 0}.social-row{display:flex;justify-content:space-between;align-items:center;gap:10px;background:#202b46;border:1px solid #3c4b6a;border-radius:10px;padding:10px 12px}.social-row span,.social-row b{min-width:0;overflow-wrap:anywhere}.social-row button{flex:0 0 auto}.lobby .social-panel{margin:0}
@media(max-width:430px){.social-row{align-items:stretch;flex-direction:column}.social-row button{width:100%}.dialog-actions{flex-direction:column}}
.lang-switch{min-width:39px;padding:5px 7px;font-size:11px;line-height:1.2;letter-spacing:.05em}.battle-header .lang-switch{margin-left:4px;flex:0 0 auto}
.feedback-form{display:grid;gap:10px;margin-top:14px}.feedback-form h3,.feedback-form p{margin:0}.feedback-form label{display:grid;gap:6px;font-size:13px;font-weight:700}.feedback-form textarea,.feedback-form select{width:100%;box-sizing:border-box;border:1px solid #465575;border-radius:9px;background:#10172a;color:var(--text);padding:10px;font:inherit;resize:vertical}.feedback-form textarea:focus,.feedback-form select:focus{outline:2px solid #8ea6dc;outline-offset:1px}.feedback-form button{justify-self:start}.admin-panel{margin:14px 0}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.panel-heading h3{margin:3px 0 0}.admin-stats{margin-top:12px}.admin-stats b{color:var(--gold)}
.first-run{margin:0 0 14px;border-color:#d6ad66;background:linear-gradient(125deg,#263756,#251f3c)}.first-run h2{margin:7px 0 10px;font-size:clamp(19px,3vw,24px)}.first-run ol{display:flex;gap:10px;list-style:none;counter-reset:step;padding:0;margin:0 0 10px}.first-run li{flex:1;counter-increment:step;padding:10px;border-radius:9px;background:#ffffff10;font-size:13px;line-height:1.3}.first-run li::before{content:counter(step);display:inline-grid;place-items:center;width:21px;height:21px;margin-right:7px;border-radius:50%;background:#e8b875;color:#211c29;font-weight:800}.first-run p{margin:0 0 12px}.first-run button{width:100%;max-width:320px}@media(max-width:560px){.first-run ol{display:grid;gap:5px}.first-run li{padding:7px 9px}}
.marketing-list{display:grid;gap:8px}.marketing-row{padding:9px 11px;border:1px solid #3c4b6a;border-radius:9px;background:#202b46}.marketing-row> b{display:block;margin-bottom:6px;color:var(--gold)}.marketing-counts{display:flex;flex-wrap:wrap;gap:5px 12px;font-size:12px;color:var(--muted)}.marketing-counts b{color:var(--text)}
