body{font-family:Arial,sans-serif;background:#14161f;color:#f4f4f4;margin:0}
*{scrollbar-width:thin;scrollbar-color:#556393 #1b2136}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-track{background:#1b2136;border-radius:999px}
*::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#5f72b4,#4b79ff);border-radius:999px;border:2px solid #1b2136}
*::-webkit-scrollbar-thumb:hover{background:linear-gradient(180deg,#6d84d1,#66e0ff)}
#topbar{position:sticky;top:0;z-index:50}
.global-topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;background:#1d2233;border-bottom:1px solid #2f3550}
.topbar-left,.topbar-center,.topbar-right{display:flex;align-items:center;gap:10px}
.topbar-left{min-width:280px}
.topbar-center{justify-content:center;flex:1}
.topbar-center h1{margin:0;font-size:22px}
.topbar-right{justify-content:flex-end;min-width:280px}
.topbar-player-meta{display:flex;flex-direction:column;gap:4px;min-width:200px}
.name-level{font-weight:700}
.xp-line{font-size:12px;color:#b8c2e8}
.xp-bar{height:8px;border-radius:999px;background:#0f1423;border:1px solid #394466;overflow:hidden}
.xp-fill{height:100%;background:linear-gradient(90deg,#4b79ff,#66e0ff)}
.player-icon{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;border:2px solid #4b79ff;background:#242b42;font-weight:700;color:#fff}
.player-icon.small{width:32px;height:32px;font-size:14px}
.player-icon.medium{width:54px;height:54px;font-size:20px}
.player-icon.large{width:88px;height:88px;font-size:32px}
.player-icon img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.icon-button{border:none;background:transparent;padding:0;cursor:pointer}
.icon-button:disabled{opacity:.45;cursor:default}
.topbar-gift-btn{position:relative;font-size:24px;line-height:1;margin-left:6px}
.home-notify-dot{position:static;margin-left:6px;vertical-align:middle}
.home-btn{font-size:20px;color:#fff}
.panel{background:#1d2233;border:1px solid #313a5a;border-radius:8px;padding:12px;margin:12px}
.row{display:flex;gap:8px;flex-wrap:wrap}
.col{display:flex;gap:8px;flex-direction:column}
.card{padding:8px;border:1px solid #45507a;border-radius:8px;background:#242b42}
.card-front{width:100%;height:auto;aspect-ratio:5/7;object-fit:contain;border-radius:6px;display:block}
.card-front-grid{aspect-ratio:5/7;max-height:120px;margin:0 auto 6px}
.card-front-mini{aspect-ratio:5/7;max-height:88px;margin:0 auto 6px}
.card-front-zoom{width:min(72vw,380px);height:auto;max-height:82vh;margin:0 auto}
.card-front-battle{width:100%;height:100%;aspect-ratio:5/7;object-fit:contain;border-radius:6px}
.card-front-reveal{width:100%;height:100%;aspect-ratio:5/7;object-fit:contain}
.card-name-label{font-size:11px;line-height:1.2;text-align:center;word-break:break-word}
.card-primary{display:flex;align-items:center;justify-content:center;width:100%;height:100%}
.button{background:#4b79ff;color:white;border:none;padding:8px 12px;border-radius:6px;cursor:pointer}
.button.secondary{background:#3b3f54}
.button:focus-visible,.icon-button:focus-visible,input:focus-visible,select:focus-visible,.starter-preview:focus-visible,.collectable-tile:focus-visible,.home-profile-hud:focus-visible,.profile-icon-trigger:focus-visible{outline:3px solid #66e0ff;outline-offset:2px}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}
.hidden{display:none}
input,select{padding:8px;border-radius:6px;border:1px solid #45507a;background:#121726;color:#fff}
.auth-panel{max-width:480px}
.login-page{min-height:calc(100vh - 24px);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:12px;transform:translateY(-50px)}
.login-title{display:block;max-width:min(720px,90vw);width:100%;height:auto}
.login-page .auth-panel{width:min(480px,100%);margin:0}
.hint{font-size:12px;color:#b8c2e8}
.hint.good{color:#7ced9f}
.hint.bad{color:#ff8b8b}
.starter-grid{display:grid;grid-template-columns:repeat(2,minmax(220px,1fr));gap:12px}
.starter-card{background:#242b42;border:1px solid #45507a;border-radius:8px;padding:12px;display:flex;flex-direction:column;gap:10px}
.starter-title{width:100%}
.starter-preview{width:100%;display:flex;flex-direction:column;align-items:center;gap:8px;background:#1b2136;border:1px solid #45507a;color:#fff;border-radius:8px;padding:10px;cursor:pointer;font-weight:700}
.starter-kitten-icon{width:82px;height:82px;object-fit:cover;border-radius:50%;border:2px solid #4b79ff}
.starter-kitten-icon-fallback{width:82px;height:82px;border-radius:50%;border:2px solid #4b79ff;display:flex;align-items:center;justify-content:center;background:#2b3252;font-size:12px;text-align:center;padding:6px}
.tick-wrap{display:flex;align-items:center;gap:6px}
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;padding:20px;z-index:100}
.overlay-panel{position:relative;background:#1d2233;border:1px solid #313a5a;border-radius:8px;padding:12px;max-width:1100px;max-height:90vh;overflow:auto;width:100%}
.deck-grid{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:8px}
.profile-panel{max-width:720px;margin:20px auto}
.profile-center{display:flex;flex-direction:column;align-items:center;gap:10px}
.profile-icon-trigger{background:transparent;border:none;cursor:pointer}
.profile-xp{width:320px;max-width:100%}
.icon-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin-bottom:10px}
.icon-card{display:flex;flex-direction:column;align-items:center;gap:8px;padding:10px;border:1px solid #45507a;border-radius:8px;background:#242b42}
.collectables-layout{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.collectable-tile{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;background:#242b42;border:1px solid #45507a;border-radius:10px;padding:14px;cursor:pointer;color:#fff}
.collectable-preview{min-height:110px;display:flex;align-items:center;justify-content:center}
.collectable-preview-image{width:clamp(84px,7.35vw,108px);height:clamp(110px,15.03vh,142px);max-width:100%;object-fit:contain;border-radius:8px;border:1px solid #45507a;background:transparent}
.collectable-meta{display:flex;flex-direction:column;gap:4px}
.collectable-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;margin-bottom:12px}
.collectable-overlay-preview{display:flex;align-items:center;justify-content:center;min-height:74px}
.collectable-overlay-image{width:clamp(84px,7.35vw,108px);height:clamp(110px,15.03vh,142px);max-width:100%;object-fit:contain;border-radius:8px;border:1px solid #45507a;background:transparent}
.collectable-preview .player-icon,.collectable-overlay-preview .player-icon{background:transparent}


.home-layout{display:grid;grid-template-columns:1fr 1fr;grid-template-areas:"story story" "left cards" "friends friends" "daily daily";gap:12px;max-width:780px;margin:0 auto}
.home-profile-hud-box{display:flex;justify-content:center;margin:8px 0 14px}
.home-profile-hud{display:flex;align-items:center;gap:12px;background:#242b42;border:1px solid #45507a;border-radius:12px;padding:12px 16px;cursor:pointer;color:inherit;max-width:560px;width:100%;text-align:left}
.home-profile-hud .topbar-player-meta{min-width:240px}
.home-profile-hud .player-icon.large{width:72px;height:72px;font-size:24px}
.home-story{grid-area:story}
.home-friends{grid-area:friends}
.home-daily{grid-area:daily}
.home-cards{grid-area:cards;min-height:128px}
.home-tile{width:100%;padding:18px 12px;font-size:18px;font-weight:700}
.home-tile:disabled{opacity:1;cursor:not-allowed}
.disabled-tile{background:#6f7485;color:#eceff9;border:1px solid #838aa1;box-shadow:none}
.home-left-col{display:flex;flex-direction:column;gap:12px;grid-area:left}
@media (max-width:700px){
  .home-layout{grid-template-columns:1fr;grid-template-areas:"story" "left" "cards" "friends" "daily"}
  .home-cards{min-height:auto}
}

.story-difficulty-box{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:10px;border:1px solid #45507a;border-radius:8px;background:#242b42;margin-bottom:10px}
.story-difficulty-label{font-weight:700;min-width:84px}
.story-difficulty-buttons{display:flex;flex-wrap:wrap;gap:8px}
.story-flow-note{font-size:12px;color:#b8c2e8;margin-bottom:10px}
.story-stage-list{display:flex;flex-direction:column;gap:8px}
.story-kitten-row{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:10px;border:1px solid #45507a;border-radius:8px;background:#242b42}
.story-kitten-title{min-width:120px;font-weight:700}
.story-stages{display:flex;flex-wrap:wrap;gap:8px}
.story-stage{background:#4b79ff;color:#fff;border:none;padding:6px 10px;border-radius:6px;cursor:pointer}
.story-stage.locked,.story-stage:disabled{background:#6f7485;color:#eceff9;cursor:not-allowed}

.decks-top-btn{width:100%;margin-bottom:12px;padding:12px;font-size:18px}
.collection-controls{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.collection-box{border:1px solid #45507a;border-radius:8px;background:#121726;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:10px;max-height:560px;overflow-y:auto}
.card-tile{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;cursor:pointer}
.card-tile-meta{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px}
.card-tile-name{font-size:12px;text-align:left;word-break:break-word;flex:1}
.card-shape{width:100%;aspect-ratio:5/7;border:1px solid #45507a;border-radius:8px;background:linear-gradient(180deg,#1c2338,#121726);display:flex;align-items:center;justify-content:center;padding:10px}
.card-shape-grid{max-height:120px}
.card-shape-zoom{width:min(72vw,380px);max-height:82vh;padding:16px}
.card-shape-name{font-size:14px;line-height:1.25;text-align:center;word-break:break-word}
.qty-box{background:#0f1423;border:1px solid #45507a;border-radius:4px;padding:2px 8px;white-space:nowrap}
.overlay-card-big{display:flex;align-items:center;justify-content:center;padding:0;background:transparent;border:none;min-width:auto;min-height:auto}
.story-deck-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.deck-slot-btn{border:none;background:transparent;padding:0;cursor:pointer}
.deck-slot-inner{border:2px solid #45507a;border-radius:8px;padding:16px;min-height:130px;background:#242b42;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}
.deck-slot-inner.selected{border-color:#4ad66d;box-shadow:0 0 0 2px rgba(74,214,109,.2)}
.deck-slot-tile{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.deck-slot-card-btn{border:2px solid #45507a;background:#242b42;padding:0;cursor:pointer;border-radius:12px;width:200px;aspect-ratio:5/7;display:flex;align-items:center;justify-content:center;overflow:hidden}
.deck-slot-card-btn.selected{border-color:#4ad66d;box-shadow:0 0 0 2px rgba(74,214,109,.2)}
.deck-slot-card-btn.blank{background:linear-gradient(180deg,#2a3350,#1a2033)}
.deck-plus{font-size:56px;line-height:1}
.deck-back{font-weight:700;width:100%;height:100%;display:flex;align-items:center;justify-content:center}
.deck-back-image{width:100%;height:100%;object-fit:cover;border-radius:10px}
.deck-editor-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.deck-editor-top input{max-width:180px}
.deck-count{text-align:right;font-weight:700;margin:6px 0}
.deck-cards-strip{display:flex;gap:8px;overflow-x:auto;padding-bottom:8px}
.deck-mini{min-width:140px;position:relative;padding-top:26px}
.remove-mini{position:absolute;top:4px;right:4px;border:none;background:#913131;color:#fff;border-radius:50%;width:22px;height:22px;cursor:pointer}
.deck-available-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px;max-height:340px;overflow-y:auto}
.avail-card{display:flex;flex-direction:column;gap:8px}
.card-name{border:none;background:transparent;color:#fff;text-align:left;cursor:pointer;padding:0;font-weight:700}
.qty-step{display:flex;align-items:center;gap:8px}
.qty-step button{width:28px;height:28px;border:none;border-radius:4px;background:#4b79ff;color:#fff;cursor:pointer}
.qty-step button:disabled{background:#6f7485;cursor:not-allowed}
.right-actions{justify-content:flex-end}
.site-loading-screen{position:fixed;inset:0;background:rgba(10,12,20,.92);display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .22s ease;z-index:2500}
.site-loading-screen.visible{opacity:1;pointer-events:auto}
.site-loading-panel{display:flex;flex-direction:column;align-items:center;gap:10px;padding:20px 28px;border:1px solid #45507a;border-radius:12px;background:#1e2436;min-width:min(360px,90vw)}
.site-loading-text{font-weight:700;letter-spacing:.02em}
.site-loading-progress{width:100%;height:12px;background:#2a3150;border:1px solid #45507a;border-radius:999px;overflow:hidden}
.site-loading-progress-bar{height:100%;width:0;background:linear-gradient(90deg,#5bc2ff,#4a7bff);transition:width .2s ease}
.site-loading-percent{font-size:12px;color:#b9c3e7}
@media (max-width:700px){.collection-box,.story-deck-grid{grid-template-columns:1fr}.deck-slot-card-btn{width:min(78vw,200px)}}


.battle-screen{padding:12px;display:flex;flex-direction:column;gap:10px;height:calc(100vh - 72px);overflow:hidden}
.battle-status{display:flex;justify-content:space-between;align-items:center;gap:10px;background:#1d2233;border:1px solid #313a5a;border-radius:8px;padding:8px 10px;flex-wrap:wrap}
.battle-layout{display:grid;grid-template-columns:200px minmax(0,1fr) 200px;gap:10px;flex:1;min-height:0;align-items:stretch}
.battle-hand-panel{background:#1d2233;border:1px solid #313a5a;border-radius:10px;padding:8px;display:flex;flex-direction:column;gap:8px;min-height:0}
.player-hand-panel{align-items:flex-start}
.opponent-hand-panel{align-items:flex-end}
.player-hand,.opponent-hand{display:flex;flex-direction:column;gap:8px;overflow-y:auto;overflow-x:hidden;padding:2px;width:100%;align-items:center;scrollbar-width:thin;scrollbar-color:#6a78a8 rgba(24,28,44,.55)}
.player-hand::-webkit-scrollbar,.opponent-hand::-webkit-scrollbar{width:10px}
.player-hand::-webkit-scrollbar-track,.opponent-hand::-webkit-scrollbar-track{background:rgba(24,28,44,.55);border-radius:999px}
.player-hand::-webkit-scrollbar-thumb,.opponent-hand::-webkit-scrollbar-thumb{background:linear-gradient(180deg,#7d8fc9,#55679e);border-radius:999px;border:2px solid rgba(24,28,44,.65)}
.playmat-frame{display:flex;justify-content:center;flex:1;min-height:0}
.playmat{--battle-slot-width:80px;position:relative;background-size:100% 100%;background-position:center;border:1px solid #45507a;border-radius:10px;padding:14px;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:14px;align-items:center;width:min(100%,1100px);max-height:100%;margin:0 auto}
.battle-lane-wrap{position:relative}
.battle-lane-wrap.left{transform:translate(60px,34px)}
.battle-lane-wrap.right{transform:translate(-80px,34px)}
.battle-lane{display:grid;grid-template-columns:repeat(4,var(--battle-slot-width));justify-content:center;column-gap:15px;min-height:0;align-self:center}
.battle-lane-wrap.right .battle-lane{direction:rtl}
.battle-lane-wrap.right .battle-lane>*{direction:ltr}
.battle-stack{display:flex;flex-direction:column;gap:10px;min-height:0}
.battle-stack-title{font-size:11px;font-weight:700;text-align:center;color:#d4dcff;letter-spacing:.2px}
.battle-stack-slots{display:flex;flex-direction:column;gap:75px}
.battle-center{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:12px;align-self:center;position:relative;height:100%;min-height:420px}
.battle-lulu-group{display:flex;flex-direction:column;align-items:center;gap:75px;width:var(--battle-slot-width);position:absolute;top:50%;transform:translateY(-50%)}
.battle-lulu-group.player{left:-500px}
.battle-lulu-group.enemy{right:-500px}
.battle-lulu-group.enemy .battle-lives{order:1}
.battle-lulu-group.enemy .enemy-lulu-main{order:2}
.battle-lulu-group.enemy .enemy-lulu-attachment{order:3}
.battle-lulu-group.player .battle-lives{order:1}
.battle-lulu-group.player .player-lulu-attachment{order:2}
.battle-lulu-group.player .player-lulu-main{order:3}
.battle-house{position:absolute;z-index:2;width:var(--battle-slot-width);aspect-ratio:5/7;min-height:0}
.battle-house-lane{left:50%;transform:translateX(-50%);top:-100px}
.battle-slot{border:1px dashed #6b7395;background:rgba(20,22,31,.72);border-radius:8px;display:flex;align-items:center;justify-content:center;padding:0;text-align:center;width:var(--battle-slot-width);aspect-ratio:5/7;min-height:0;overflow:hidden}
.battle-slot.valid{border:2px solid #fff;box-shadow:0 0 0 2px rgba(255,255,255,.2) inset}
.battle-slot.drop-ghost{outline:3px solid #4ad66d;outline-offset:2px}
.battle-slot.clickable{cursor:pointer}
.battle-card{width:100%;height:100%;max-width:100%;background:#2a3250;border:1px solid #7e8dc0;border-radius:8px;padding:6px;display:flex;flex-direction:column;justify-content:space-between;font-size:12px}
.battle-card strong{font-size:12px}
.battle-card small{color:#cfd7ff;margin-top:4px}
.battle-card.mini{max-width:100%;font-size:11px}
.ghost-card{opacity:.78;border-style:dashed;pointer-events:none}
.battle-card.back{padding:0;overflow:hidden}
.battle-card.back img{width:100%;height:100%;object-fit:cover}
.battle-card-back{padding:0;overflow:hidden}
.battle-card-back img{width:100%;height:100%;object-fit:cover;display:block}
.playmat-facedown{background:#1d2237}
.hand-card{width:90px;aspect-ratio:5/7;max-width:90px;flex:0 0 auto;border:none;background:transparent;padding:0;cursor:pointer}
.hand-card .battle-card{aspect-ratio:5/7;height:100%}
.hand-card.selected{transform:translateY(-4px)}
.battle-lives{font-weight:700}
.lulu-slot{width:var(--battle-slot-width);max-width:none}
.coin-overlay{position:fixed;inset:0;background:rgba(5,8,15,.82);display:flex;align-items:center;justify-content:center;z-index:120}
.coin-panel{background:#1d2233;border:1px solid #45507a;border-radius:12px;padding:20px;display:flex;flex-direction:column;align-items:center;gap:12px;min-width:260px}
.coin-flip-wrap{width:110px;height:110px;display:flex;align-items:center;justify-content:center;animation:coin-spin .6s linear 3}
.coin-flip-wrap.done{animation:none}
.coin-flip-coin{width:100%;height:100%;object-fit:contain}
.kitten-battle-overlay{position:fixed;inset:0;background:rgba(5,8,15,.88);display:flex;align-items:center;justify-content:center;z-index:130}
.kitten-battle-panel{position:relative;width:min(50vw,760px);aspect-ratio:16/9;background-size:cover;background-position:center;border:2px solid #8693c4;border-radius:12px;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;padding:18px}
.kitten-battle-half{display:flex;flex-direction:column;align-items:center;gap:18px}
.kitten-battle-card-row{display:flex;align-items:center;gap:10px}
.kitten-battle-kitten,.kitten-battle-attachment-slot{width:110px;aspect-ratio:5/7;background:rgba(24,29,44,.86);border:1px solid #8492c2;border-radius:10px;display:flex;align-items:center;justify-content:center;text-align:center;padding:6px;font-weight:700}
.kitten-battle-attachment-slot.empty{border-style:dashed;color:#92a0cf}
.kitten-battle-attachment-slot.facedown{padding:0;overflow:hidden}
.kitten-battle-attachment-slot.facedown img{width:100%;height:100%;object-fit:cover}
.kitten-battle-attachment-slot.faceup.claw{border-color:#f0bd53;box-shadow:0 0 8px rgba(240,189,83,.5)}
.kitten-battle-cp-paw{position:relative;width:108px;height:108px}
.kitten-battle-cp-paw .paw-base{width:100%;height:100%;object-fit:contain}
.kitten-battle-cp-paw .paw-number{position:absolute;inset:0;margin:auto;width:42px;height:42px;object-fit:contain}
.kitten-battle-vs-wrap{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px}
.kitten-battle-vs{font-size:44px;font-weight:800;color:#fff;text-shadow:0 4px 14px rgba(0,0,0,.65)}
.kitten-battle-countdown{font-size:78px;font-weight:900;color:#fff;animation:battleCountdownPulse .95s ease-in-out infinite;text-shadow:0 6px 18px rgba(0,0,0,.7);line-height:1}
.kitten-battle-result{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;background:rgba(2,4,10,.72);z-index:131}
@keyframes coin-spin{0%{transform:rotateY(0deg)}100%{transform:rotateY(1080deg)}}
@keyframes battleCountdownPulse{0%{opacity:.2;transform:scale(.76)}50%{opacity:1;transform:scale(1)}100%{opacity:.2;transform:scale(.76)}}
@media (max-width:1200px){.battle-layout{grid-template-columns:170px minmax(0,1fr) 170px}.playmat{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}}

@media (max-width:900px) and (orientation:portrait){
  .global-topbar{gap:6px;padding:8px 10px;align-items:flex-start}
  .topbar-left,.topbar-right{min-width:0;flex:1}
  .topbar-center{min-width:0;gap:6px}
  .topbar-center h1{font-size:15px;text-align:center;line-height:1.1}
  .topbar-player-meta{min-width:0}
  .name-level{font-size:12px}
  .xp-line{font-size:10px}
  .icon-button{font-size:16px}

  .home-panel{height:calc(100dvh - 78px);overflow:hidden;display:flex;flex-direction:column}
  .home-panel h2{margin:0 0 8px;text-align:center}
  .home-profile-hud-box{margin:4px 0 8px}
  .home-profile-hud{padding:8px 10px;gap:8px}
  .home-profile-hud .player-icon.large{width:56px;height:56px;font-size:20px}
  .home-profile-hud .topbar-player-meta{min-width:0}
  .home-layout{grid-template-columns:1fr;grid-template-areas:"story" "left" "cards" "friends" "daily";gap:8px;max-width:520px;width:100%;margin:0 auto;justify-items:center}
  .home-left-col,.home-layout>.col{width:100%;max-width:360px}
  .home-tile{padding:12px 10px;font-size:16px}

  .deck-selection-overlay{max-height:min(90dvh,680px);display:flex;flex-direction:column}
  .deck-selection-overlay .story-deck-grid{grid-template-columns:1fr;grid-template-rows:repeat(6,minmax(84px,1fr));overflow-y:auto;padding-right:4px;min-height:0}
}

@media (max-width:900px) and (orientation:portrait){
  .battle-screen{padding:8px;gap:8px;height:calc(100dvh - 64px)}
  .battle-status{font-size:12px;gap:6px;padding:6px 8px}
  .battle-layout{grid-template-columns:1fr;grid-template-areas:"opponent" "playmat" "player";gap:8px}
  .player-hand-panel{grid-area:player}
  .playmat-frame{grid-area:playmat;min-height:0}
  .opponent-hand-panel{grid-area:opponent}
  .battle-hand-panel{padding:6px;gap:6px;min-height:76px;max-height:15dvh}
  .player-hand-panel,.opponent-hand-panel{align-items:stretch}
  .player-hand,.opponent-hand{flex-direction:row;gap:6px;overflow-x:auto;overflow-y:hidden;justify-content:flex-start;align-items:center;padding-bottom:2px}
  .hand-card{width:62px;max-width:62px}
  .playmat{
    --battle-slot-width:clamp(30px,min(7.8vw,4.6dvh),52px);
    width:100%;
    height:100%;
    max-height:100%;
    padding:8px;
    gap:8px;
    grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
    align-items:center;
    overflow:hidden;
  }
  .battle-lane-wrap.left,.battle-lane-wrap.right{transform:none}
  .battle-lane{grid-template-columns:repeat(4,var(--battle-slot-width));column-gap:6px}
  .battle-stack{gap:4px}
  .battle-stack-title{font-size:9px}
  .battle-stack-slots{gap:8px}
  .battle-center{min-height:0;gap:8px}
  .battle-lulu-group{gap:8px;width:var(--battle-slot-width);position:static;transform:none}
  .battle-lulu-group.player{align-items:flex-start}
  .battle-lulu-group.enemy{align-items:flex-end}
  .battle-house{position:static;width:var(--battle-slot-width);aspect-ratio:5/7;padding:0}
  .battle-house .battle-card{width:100%;height:100%}
  .battle-house-lane{left:auto;top:auto;transform:none}
  .battle-card{padding:3px;font-size:9px}
  .battle-card strong{font-size:9px}
  .battle-card small{font-size:8px;margin-top:2px}
}
@media (max-width:900px) and (orientation:landscape){
  .battle-layout{grid-template-columns:1fr;grid-template-areas:"player" "playmat" "opponent"}
  .player-hand-panel{grid-area:player}
  .playmat-frame{grid-area:playmat}
  .opponent-hand-panel{grid-area:opponent}
  .player-hand,.opponent-hand{flex-direction:row;overflow-x:auto;overflow-y:hidden;justify-content:flex-start}
  .playmat{display:flex;flex-direction:column;gap:10px}
  .battle-lane-wrap{transform:none}
  .battle-lane{grid-template-columns:repeat(4,var(--battle-slot-width));overflow-x:auto}
  .battle-center{position:static;min-height:0}
  .battle-lulu-group{position:static;transform:none;width:var(--battle-slot-width)}
  .battle-house{position:static;width:var(--battle-slot-width);aspect-ratio:5/7;padding:0;transform:none}
}

.home-admin{grid-column:1 / -1}
.admin-users-btn{min-width:220px}
.admin-overlay{max-width:760px}
.admin-user-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px}
.admin-user-card{display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left}
.admin-user-card.selected{border:2px solid #4ad66d}
.admin-tools-row{flex-wrap:wrap;gap:10px}
.admin-code-form{display:grid;grid-template-columns:1fr;gap:6px}
.admin-code-form input,.admin-code-form select{width:100%}
.admin-codes-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.admin-code-card{display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left}

.shop-main{gap:12px;max-width:680px;margin:0 auto;}
.shop-full-btn{width:100%;}
.shop-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
.shop-block-btn{min-height:70px;}
.shop-msg-box{margin-top:10px;padding:10px;border:1px solid #ccc;border-radius:8px;background:#fff;}
.overlay-close-btn{position:absolute;right:12px;top:8px;background:#b00;color:#fff;border:0;border-radius:50%;width:28px;height:28px;cursor:pointer;}
.shop-selected{outline:3px solid #31b54b !important;}
.booster-page{max-width:860px;margin:0 auto;}
.booster-page-header{justify-content:space-between;align-items:center;}
.booster-pack-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:10px 0 14px;}
.booster-pack-tab{display:flex;flex-direction:column;gap:4px;align-items:flex-start;min-height:64px;}
.booster-kitten-box{border:1px solid #313a5a;border-radius:8px;padding:12px;background:#121827;}
.booster-kitten-grid-page{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;}
.booster-kitten-card{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-height:200px;text-align:center;}
.booster-kitten-card img{width:100%;max-width:142px;aspect-ratio:5/7;object-fit:cover;border-radius:6px;}
.pack-open-overlay{min-width:420px;text-align:center;}
.booster-pack-large{margin:20px auto;padding:48px;border:2px dashed #666;cursor:pointer;}
.pack-card-surface{width:min(214px,58vw);height:min(300px,81.4vw);aspect-ratio:5/7;margin:0 auto 10px;border-radius:12px;overflow:hidden;}
.card-back{cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:space-between;overflow:hidden;background:#111;}
.card-back img{width:100%;height:100%;object-fit:cover;display:block;}
.pack-reveal-card{cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;text-align:center;padding:16px;box-sizing:border-box;border:1px solid #8f97bd;background:linear-gradient(180deg,#f2f4ff 0%,#d9def8 100%);color:#182034;}
.new-badge{position:absolute;top:6px;right:6px;background:#1f7;padding:2px 6px;border-radius:8px;font-size:12px;}
.new-glow{box-shadow:0 0 12px #6f6;}
.gold-glow{box-shadow:0 0 14px #ffcc00;}
.pack-results-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;}
.pack-results-card{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;}
.card-front-pack-results{width:100%;max-width:108px;height:auto;aspect-ratio:5/7;object-fit:contain;margin:0 auto 6px;}
.trade-pile-wrap{margin-top:16px;}
.trade-pile-scroll{display:flex;gap:8px;overflow-x:auto;padding:8px;border:1px solid #ccc;border-radius:8px;min-height:68px;}
.trade-pill{position:relative;min-width:170px;}
.trade-convert-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px;}
.trade-select-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:12px;}
.trade-select-card{position:relative;min-height:96px;}
.qty-add{position:absolute;top:6px;right:6px;border:0;border-radius:50%;width:26px;height:26px;cursor:pointer;background:#2a5;color:#fff;}

.mission-card{padding:12px;text-align:left}
.mission-head{justify-content:space-between;align-items:center;position:relative}
.mission-claim-btn{position:relative}
.notify-dot{display:inline-block;width:8px;height:8px;background:#e22;border-radius:999px;position:absolute;top:2px;right:2px}

.profile-friend-code{font-family:monospace;font-size:13px;color:#9fb4ff}
.friends-panel{max-width:860px;margin:20px auto}
.friends-header{display:grid;grid-template-columns:auto 1fr auto;gap:10px;align-items:center;margin-bottom:10px}
.friends-search{width:100%}
.friends-box{display:flex;flex-direction:column;gap:8px}
.friends-row{display:flex;align-items:center;gap:12px;justify-content:space-between}
.friends-meta{display:flex;flex-direction:column;gap:4px;flex:1}
.friends-overlay{max-width:640px}
.friend-code-input{font-family:monospace;letter-spacing:1px}
.friends-lookup-card{margin-top:8px}
.request-row{align-items:center}

.admin-card-list{max-height:320px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:6px;margin:10px 0;}

@media (max-width:900px) and (orientation:portrait){
  html{-webkit-text-size-adjust:100%}
  body{overflow-x:hidden}
  .panel{margin:8px;padding:10px;border-radius:10px}
  .row{gap:10px}
  .button,input,select,.starter-preview,.collectable-tile,.home-profile-hud,.icon-button{min-height:44px}
  .button,input,select{font-size:16px}
  .deck-grid,.collection-box,.booster-kitten-grid-page,.pack-results-grid,.trade-select-grid,.admin-user-grid,.admin-codes-list,.admin-card-list{grid-template-columns:1fr}
  .booster-pack-tabs{grid-template-columns:1fr 1fr}
  .friends-header{grid-template-columns:1fr}
  .friends-row,.trade-convert-row,.booster-page-header{flex-direction:column;align-items:stretch}

  .global-topbar{display:grid;grid-template-columns:1fr;grid-template-areas:"center" "left" "right";gap:8px;padding:10px;align-items:stretch}
  .topbar-center,.topbar-left,.topbar-right{min-width:0;width:100%}
  .topbar-center{grid-area:center;justify-content:space-between;flex-wrap:wrap}
  .topbar-left{grid-area:left}
  .topbar-right{grid-area:right;justify-content:space-between;flex-wrap:wrap;gap:8px}
  .topbar-center h1{flex:1 1 100%;font-size:16px;line-height:1.2;text-align:center;margin-top:4px}
  .topbar-player-meta,.home-profile-hud .topbar-player-meta{min-width:0;width:100%}
  .icon-button{min-width:44px;padding:8px;border-radius:8px}

  .overlay{padding:10px;align-items:flex-end}
  .overlay-panel,.admin-overlay,.friends-overlay,.stamina-overlay,.pack-open-overlay,.deck-selection-overlay{width:100%;max-width:100%;min-width:0;max-height:88dvh;border-radius:14px 14px 0 0;overflow:auto}
  .pack-open-overlay{text-align:center}
  .pack-card-surface{width:min(72vw,260px);height:auto;aspect-ratio:5/7}
  .booster-pack-large{padding:24px 16px}

  .home-panel,.battle-screen{height:auto;min-height:calc(100dvh - 64px);overflow:visible}
  .battle-layout,.playmat-frame,.player-hand-panel,.opponent-hand-panel{min-height:0}
  .battle-status{font-size:13px}
  .battle-stack-title,.battle-card strong,.battle-card small,.card-name-label{font-size:11px;line-height:1.2}
  .battle-card{padding:4px;font-size:11px}
  .hand-card{width:72px;max-width:72px}
  .battle-hand-panel{max-height:18dvh}

  input,select,.button{width:100%;box-sizing:border-box}
  .tick-wrap{align-items:flex-start}
  .tick-wrap input[type="checkbox"]{width:20px;height:20px;margin-top:2px;flex:0 0 auto}

  .login-page{min-height:100dvh;justify-content:center;transform:none;padding:20px 12px}
  .login-title{max-width:92vw}
}
