  :root{
    --bg-void: #060a10;
    --bg-panel: #0d141d;
    --bg-panel-raised: #121b26;
    --line: #1f2e3d;
    --accent: #35e8c9;
    --accent-dim: #1c7a6b;
    --danger: #ff4d5e;
    --danger-dim: #6b1f27;
    --corrupt: #a855f7;
    --corrupt-dim: #4c2470;
    --gold: #ffcc4d;
    --text-hi: #eaf6f4;
    --text-mid: #8fa3ab;
    --text-low: #4d6068;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Consolas', 'SF Mono', monospace;
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  html,body{
    background:var(--bg-void);
    color:var(--text-hi);
    font-family:var(--font);
    height:100%;
    overflow:hidden;
    -webkit-user-select:none;
    user-select:none;
  }
  #app{
    position:relative;
    width:100vw; height:100vh;
    background:
      radial-gradient(ellipse at 50% -10%, rgba(53,232,201,0.08), transparent 60%),
      linear-gradient(180deg, #060a10 0%, #05080c 100%);
  }
  .screen{
    position:absolute; inset:0;
    display:none;
    flex-direction:column;
    animation: fadein .25s ease;
  }
  .screen.active{display:flex;}
  @keyframes fadein{from{opacity:0}to{opacity:1}}

  #chatBubble{
    position:absolute; top:14px; left:14px; z-index:500;
    width:34px; height:34px; border-radius:50%;
    background:var(--bg-panel-raised); border:1px solid var(--line);
    display:flex; align-items:center; justify-content:center;
    font-size:16px; cursor:pointer;
  }
  #chatBubble:hover{ border-color:var(--accent); }

  /* ---------- top bar ---------- */
  .topbar{
    display:flex; align-items:center; justify-content:space-between;
    padding:14px 20px 14px 56px;
    border-bottom:1px solid var(--line);
    background:linear-gradient(180deg, rgba(18,27,38,0.9), rgba(13,20,29,0.4));
    flex-shrink:0;
  }
  .brand{
    font-size:15px; font-weight:700; letter-spacing:0.5px;
    color:var(--text-hi);
    display:flex; align-items:center; gap:8px;
  }
  .brand .dot{
    width:8px; height:8px; border-radius:50%;
    background:var(--accent);
    box-shadow:0 0 8px var(--accent);
  }
  .res{
    display:flex; gap:16px; font-family:var(--font-mono); font-size:13px;
  }
  .res span{color:var(--gold);}

  /* ---------- LOADING ---------- */
  #screen-loading{
    align-items:center; justify-content:center; gap:22px;
  }
  .loading-logo h1{
    font-size:28px; font-weight:800; letter-spacing:1px; text-align:center;
    background:linear-gradient(90deg, var(--accent), #7ff5e0);
    -webkit-background-clip:text; background-clip:text; color:transparent;
  }
  .loading-logo p{ text-align:center; margin-top:6px; color:var(--text-mid); font-size:12px; letter-spacing:3px; }
  .loading-bar-wrap{
    width:280px; height:6px; background:var(--bg-panel-raised);
    border:1px solid var(--line); border-radius:3px; overflow:hidden;
  }
  .loading-bar-fill{
    height:100%; width:0%; background:linear-gradient(90deg, var(--accent-dim), var(--accent));
    transition:width .15s linear;
  }
  .loading-tip{ font-size:11px; color:var(--text-low); max-width:280px; text-align:center; }

  /* ---------- CITY HUB ---------- */
  #screen-city{ padding:0; }
  .city-body{ flex:1; display:flex; overflow:hidden; }
  .city-map{
    flex:1; position:relative;
    overflow-x:auto; overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
  }
  .city-map-inner{
    position:relative;
    width:220%; min-width:1600px; height:100%;
    background:
      radial-gradient(ellipse at 50% 20%, rgba(53,232,201,0.06), transparent 55%),
      url('https://chibi.iitranq.co.uk/7gkEoxRd6S5z.png');
    background-size:cover;
    background-position:center 40%;
  }
  .city-skyline{
    position:absolute; left:0; right:0; bottom:0; height:2px;
    background:linear-gradient(90deg, transparent, var(--line), transparent);
  }
  .building{
    position:absolute;
    display:flex; flex-direction:column; align-items:center; gap:6px;
    cursor:pointer;
  }
  .building .shape{
    width:100px; height:120px;
    background:var(--bg-panel-raised);
    border:1px solid var(--line);
    border-top:3px solid var(--accent);
    border-radius:4px 4px 2px 2px;
    display:flex; align-items:center; justify-content:center;
    font-size:38px;
    position:relative;
    transition:transform .15s, filter .15s;
    box-shadow:0 10px 24px rgba(0,0,0,0.4);
    overflow:hidden;
  }
  .building:hover .shape{ transform:translateY(-4px) scale(1.04); }
  .building[data-building="story"] .shape{
    width:150px; height:88px; border-radius:8px;
  }
  .building .shape::after{
    content:""; position:absolute; inset:0;
    background:linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%);
  }
  .building:hover .shape{ transform:translateY(-4px); box-shadow:0 16px 28px rgba(0,0,0,0.5); }
  .building.locked .shape{ border-top-color:var(--text-low); filter:grayscale(0.6) brightness(0.7); }
  .building.locked:hover .shape{ transform:none; }
  .building .b-label{
    font-size:11px; font-weight:700; color:var(--text-hi);
    background:rgba(6,10,16,0.75);
    padding:3px 8px; border-radius:3px;
    white-space:nowrap;
  }
  .building.locked .b-label{ color:var(--text-low); }
  .building .b-lock{ font-size:9px; color:var(--text-low); margin-top:-4px; }

  .city-side{
    width:60px; border-left:1px solid var(--line);
    background:var(--bg-panel);
    display:flex; flex-direction:column; align-items:center;
    padding:14px 0; gap:14px; flex-shrink:0;
  }
  .side-btn{
    width:40px; height:40px; border-radius:6px;
    background:var(--bg-panel-raised); border:1px solid var(--line);
    display:flex; align-items:center; justify-content:center;
    font-size:18px; cursor:pointer; color:var(--text-mid);
    position:relative;
  }
  .side-btn:hover{ border-color:var(--accent); color:var(--text-hi); }
  .side-btn.disabled{ opacity:0.4; cursor:not-allowed; }
  .side-badge{
    position:absolute; top:-3px; right:-3px; width:14px; height:14px; border-radius:50%;
    background:var(--danger); color:#fff; font-size:8px; font-weight:800;
    display:flex; align-items:center; justify-content:center;
  }

  .chat-dock{
    position:absolute; left:14px; bottom:14px; width:230px;
    background:rgba(13,20,29,0.85);
    border:1px solid var(--line); border-radius:6px;
    padding:8px 10px;
    font-size:11px; color:var(--text-low);
  }
  .chat-dock .chat-head{
    font-size:10px; letter-spacing:1px; color:var(--text-mid); margin-bottom:4px;
    display:flex; justify-content:space-between;
  }

  /* ---------- HOME ---------- */
  #screen-home{ align-items:center; justify-content:center; gap:28px; }
  .home-title{
    text-align:center;
  }
  .home-title h1{
    font-size:34px; font-weight:800; letter-spacing:1px;
    background:linear-gradient(90deg, var(--accent), #7ff5e0);
    -webkit-background-clip:text; background-clip:text; color:transparent;
  }
  .home-title p{
    margin-top:6px; color:var(--text-mid); font-size:13px; letter-spacing:2px;
  }
  .home-menu{ display:flex; flex-direction:column; gap:12px; width:280px; }
  .menu-btn{
    background:var(--bg-panel-raised);
    border:1px solid var(--line);
    color:var(--text-hi);
    padding:16px 20px;
    font-size:15px; font-weight:600;
    border-radius:4px;
    cursor:pointer;
    text-align:left;
    position:relative;
    transition:border-color .15s, background .15s;
  }
  .menu-btn:hover{ border-color:var(--accent); background:#152130; }
  .menu-btn .sub{ display:block; font-size:11px; color:var(--text-mid); font-weight:400; margin-top:3px; }
  .menu-btn.primary{ border-color:var(--accent); box-shadow:0 0 20px rgba(53,232,201,0.08) inset; }

  /* ---------- ROSTER ---------- */
  #screen-roster{ padding:0; }
  .roster-body{ flex:1; display:flex; overflow:hidden; }
  .roster-grid{
    flex:1; padding:18px; overflow-y:auto;
  }
  .hero-grid, .collection-grid{
    display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:12px;
    align-content:start;
  }
  .collection-toolbar{
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom:14px; font-size:11px; color:var(--text-mid);
  }
  .collection-toolbar select{
    background:var(--bg-panel-raised); color:var(--text-hi); border:1px solid var(--line);
    border-radius:4px; padding:4px 8px; font-size:11px; margin-left:6px;
  }
  .collection-count{ font-family:var(--font-mono); }
  .collection-section-title{
    font-size:11px; letter-spacing:1px; color:var(--text-mid); margin:20px 0 12px;
    text-transform:uppercase;
  }
  .collection-card{ position:relative; }
  .power-badge{
    position:absolute; top:6px; left:6px; z-index:2;
    background:rgba(6,10,16,0.8); color:var(--accent); font-family:var(--font-mono);
    font-size:11px; font-weight:700; padding:1px 5px; border-radius:3px;
  }
  .level-badge{
    position:absolute; top:6px; right:6px; z-index:2;
    background:rgba(6,10,16,0.8); color:var(--gold); font-size:9px; font-weight:700;
    padding:1px 5px; border-radius:3px;
  }
  .lock-progress-wrap{
    position:relative; height:14px; background:#000; border-radius:7px; margin-top:8px; overflow:hidden;
    border:1px solid rgba(255,255,255,0.08);
  }
  .lock-progress-fill{ height:100%; background:var(--corrupt-dim); }
  .lock-progress-text{
    position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    font-size:8px; color:var(--text-hi); font-family:var(--font-mono);
  }

  /* ---------- HERO DETAIL ---------- */
  .detail-body{ flex:1; display:flex; overflow:hidden; }
  .detail-left{
    width:220px; flex-shrink:0; padding:20px;
    display:flex; flex-direction:column; align-items:center; gap:10px;
    border-right:1px solid var(--line); background:var(--bg-panel);
  }
  .detail-portrait{
    width:160px; height:160px; border-radius:8px; background:#0a1119;
    display:flex; align-items:center; justify-content:center; font-size:70px;
    border:2px solid var(--line); overflow:hidden;
  }
  .detail-portrait img{ width:100%; height:100%; object-fit:cover; }
  .detail-meta{ text-align:center; }
  .detail-level{ font-size:13px; color:var(--text-mid); font-family:var(--font-mono); }
  .detail-stars{ font-size:16px; color:var(--gold); margin-top:4px; }
  .detail-power{ font-size:14px; color:var(--accent); font-weight:700; margin-top:6px; }
  .detail-rank{ font-size:12px; font-weight:700; margin-top:4px; letter-spacing:1px; }
  .detail-right{ flex:1; display:flex; flex-direction:column; overflow:hidden; }
  .detail-tabs{ display:flex; border-bottom:1px solid var(--line); }
  .detail-tab{
    flex:1; background:var(--bg-panel); border:none; border-bottom:2px solid transparent;
    color:var(--text-mid); padding:14px; font-weight:700; font-size:12px; cursor:pointer;
  }
  .detail-tab.active{ color:var(--accent); border-bottom-color:var(--accent); background:var(--bg-panel-raised); }
  .detail-content{ flex:1; overflow-y:auto; padding:20px; }
  .badge-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; max-width:320px; }
  .badge-slot{
    aspect-ratio:1; border-radius:50%; background:var(--bg-panel-raised);
    border:3px solid var(--line); display:flex; align-items:center; justify-content:center;
    font-size:28px; opacity:0.35; filter:grayscale(1);
  }
  .badge-slot.filled{ border-color:var(--accent); opacity:1; filter:none; }
  .promote-btn{
    margin-top:20px; background:var(--gold); color:#3a2a00; border:none;
    padding:12px 28px; border-radius:6px; font-weight:800; font-size:13px; cursor:pointer;
  }
  .promote-btn:disabled{ background:var(--line); color:var(--text-low); cursor:not-allowed; }
  .detail-stat-row{ display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--line); font-size:13px; }
  .skill-row{ display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); align-items:center; }
  .skill-row .skill-icon{ width:40px; height:40px; border-radius:50%; background:var(--bg-panel-raised); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }

  /* ---------- CHAT ---------- */
  .chat-messages{ flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:8px; }
  .chat-msg{ max-width:78%; padding:8px 12px; border-radius:10px; background:var(--bg-panel-raised); font-size:12px; align-self:flex-start; }
  .chat-msg.mine{ align-self:flex-end; background:var(--accent-dim); color:#04211c; }
  .chat-msg .chat-msg-name{ font-size:10px; font-weight:700; color:var(--accent); margin-bottom:2px; }
  .chat-msg.mine .chat-msg-name{ color:#04211c; opacity:0.7; }
  .chat-input-row{ display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--line); background:var(--bg-panel); }
  .chat-input-row input{
    flex:1; background:var(--bg-panel-raised); border:1px solid var(--line); border-radius:20px;
    padding:9px 16px; color:var(--text-hi); font-size:13px;
  }
  .chat-input-row input:focus{ outline:none; border-color:var(--accent); }

  /* ---------- PROFILE / CLUB ---------- */
  .profile-header{ display:flex; align-items:center; gap:16px; padding:16px; background:var(--bg-panel); border-radius:6px; }
  .profile-avatar{ width:64px; height:64px; border-radius:50%; background:var(--bg-panel-raised); border:2px solid var(--accent); display:flex; align-items:center; justify-content:center; font-size:32px; overflow:hidden; }
  .profile-avatar img{ width:100%; height:100%; object-fit:cover; }
  .profile-name-input{ background:var(--bg-panel-raised); border:1px solid var(--line); border-radius:4px; color:var(--text-hi); padding:8px 10px; font-size:14px; font-weight:700; width:100%; }
  .avatar-pick-grid{ display:grid; grid-template-columns:repeat(6,1fr); gap:8px; margin-top:10px; }
  .avatar-pick{ width:40px; height:40px; border-radius:50%; background:var(--bg-panel-raised); border:2px solid var(--line); display:flex; align-items:center; justify-content:center; font-size:18px; cursor:pointer; overflow:hidden; }
  .avatar-pick.selected{ border-color:var(--accent); }
  .avatar-pick img{ width:100%; height:100%; object-fit:cover; }
  .member-row{ display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid var(--line); }
  .member-row .mini-avatar{ width:32px; height:32px; border-radius:50%; background:var(--bg-panel-raised); display:flex; align-items:center; justify-content:center; font-size:16px; flex-shrink:0; overflow:hidden; }
  .member-row .mini-avatar img{ width:100%; height:100%; object-fit:cover; }
  .skill-row.locked{ opacity:0.4; }
  .skill-row h5{ font-size:13px; margin-bottom:2px; }
  .skill-row p{ font-size:11px; color:var(--text-mid); }
  .hero-card{
    background:var(--bg-panel);
    border:2px solid var(--line);
    border-radius:4px;
    padding:10px;
    cursor:pointer;
    position:relative;
    transition:transform .1s, border-color .15s;
  }
  .rank-badge{
    position:absolute; bottom:6px; left:6px; z-index:2;
    width:16px; height:16px; border-radius:3px;
    display:flex; align-items:center; justify-content:center;
    font-size:9px; font-weight:800; color:#04211c;
  }
  .hero-stars-overlay{
    position:absolute; bottom:6px; right:6px; z-index:2;
    font-size:9px; color:var(--gold); letter-spacing:1px;
    background:rgba(6,10,16,0.7); padding:1px 4px; border-radius:3px;
  }
  .tutorial-tag{
    position:absolute; top:6px; left:6px;
    font-size:8px; font-weight:800; letter-spacing:0.5px;
    background:var(--accent); color:#04211c;
    padding:2px 5px; border-radius:2px;
  }
  .hero-card:hover{ transform:translateY(-2px); border-color:var(--text-mid); }
  .hero-card.selected{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
  .hero-card.locked{ cursor:default; }
  .hero-card.locked .hero-name, .hero-card.locked .hero-role{ color:var(--text-low); }
  .locked-name{ margin-top:0; font-size:11px; text-align:center; }
  .lock-overlay{
    position:absolute; top:6px; right:6px; font-size:13px;
    background:rgba(0,0,0,0.6); border-radius:3px; padding:2px 5px;
  }
  .hero-card.selected::after{
    content:"✓"; position:absolute; top:6px; right:6px;
    width:16px; height:16px; border-radius:50%; background:var(--accent);
    color:#04211c; font-size:10px; font-weight:800;
    display:flex; align-items:center; justify-content:center;
  }
  .hero-portrait{
    width:100%; aspect-ratio:1; border-radius:3px;
    display:flex; align-items:center; justify-content:center;
    font-size:26px; margin-bottom:8px; overflow:hidden;
  }
  .hero-name{ font-size:12px; font-weight:700; }
  .hero-role{ font-size:10px; color:var(--text-mid); margin-top:2px; }
  .hero-stars{ font-size:11px; color:var(--gold); letter-spacing:1px; margin-top:4px; }
  .star-empty{ color:var(--text-low); }
  .star-extra{ color:var(--corrupt); font-weight:800; }
  .hero-level-row{ font-size:10px; color:var(--text-hi); margin-top:5px; font-family:var(--font-mono); }
  .hero-level-row .level-cap{ color:var(--text-low); }
  .rank-row{ font-size:9px; color:var(--text-mid); margin-top:3px; display:flex; align-items:center; gap:4px; }
  .rank-dot{ width:7px; height:7px; border-radius:50%; display:inline-block; flex-shrink:0; }
  .rank-btn{
    background:var(--bg-panel); border:1px solid var(--line); color:var(--text-mid);
    font-size:8px; padding:1px 5px; border-radius:3px; cursor:pointer; margin-left:auto;
  }
  .rank-btn:hover{ border-color:var(--text-hi); color:var(--text-hi); }
  .info-btn{
    position:absolute; top:6px; left:6px; z-index:3;
    background:rgba(6,10,16,0.7); border:1px solid var(--line); border-radius:50%;
    width:18px; height:18px; font-size:10px; cursor:pointer; padding:0;
    display:flex; align-items:center; justify-content:center;
  }
  .info-btn:hover{ border-color:var(--accent); }
  .xp-bar-wrap{ height:4px; background:#000; border-radius:2px; margin-top:2px; overflow:hidden; border:1px solid rgba(255,255,255,0.08); }
  .xp-bar-fill{ height:100%; background:var(--accent); }
  .rarity-bar{ height:3px; border-radius:2px; margin-top:6px; }
  .upgrade-btn{
    width:100%; margin-top:8px;
    background:var(--bg-panel); border:1px solid var(--line); color:var(--text-mid);
    font-size:10px; padding:5px 2px; border-radius:3px; cursor:pointer;
    font-family:var(--font-mono);
  }
  .upgrade-btn:hover:not(:disabled){ border-color:var(--gold); color:var(--gold); }
  .upgrade-btn:disabled{ opacity:0.5; cursor:not-allowed; }
  .chip-row{ font-size:10px; color:var(--text-hi); margin-top:6px; font-family:var(--font-mono); }
  .chip-fill{ background:var(--corrupt); }
  .rush-btn{ border-color:var(--corrupt-dim); color:var(--corrupt); font-size:9px; }
  .rush-btn:hover{ border-color:var(--corrupt); color:#d8b4fe; }
  .unlock-btn{ border-color:var(--corrupt-dim); color:var(--corrupt); }
  .unlock-btn:hover{ border-color:var(--corrupt); color:#d8b4fe; }
  .story-lock-btn{ border-color:var(--line); color:var(--text-low); font-size:9px; cursor:not-allowed; }
  .story-lock-btn:hover{ border-color:var(--line); color:var(--text-low); }

  .roster-side{
    width:230px; border-left:1px solid var(--line);
    background:var(--bg-panel);
    padding:16px; display:flex; flex-direction:column; gap:10px;
    flex-shrink:0;
  }
  .roster-side h3{ font-size:12px; letter-spacing:1px; color:var(--text-mid); text-transform:uppercase; }
  .team-slot{
    display:flex; align-items:center; gap:8px;
    background:var(--bg-panel-raised);
    border:1px dashed var(--line);
    border-radius:4px; padding:8px;
    font-size:12px; color:var(--text-low);
    min-height:38px;
  }
  .team-slot.filled{ border-style:solid; color:var(--text-hi); border-color:var(--line); }
  .team-slot .mini-portrait{
    width:22px; height:22px; border-radius:3px; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0;
  }

  .btn{
    background:var(--accent); color:#04211c;
    border:none; padding:11px; border-radius:4px;
    font-weight:700; font-size:13px; cursor:pointer;
    letter-spacing:0.3px;
  }
  .btn:disabled{ background:var(--line); color:var(--text-low); cursor:not-allowed; }
  .btn.ghost{
    background:transparent; border:1px solid var(--line); color:var(--text-mid);
  }

  /* ---------- STAGE SELECT ---------- */
  .stage-list{ flex:1; overflow-y:auto; padding:18px; display:flex; flex-direction:column; gap:10px; }
  .stage-card{
    background:var(--bg-panel);
    border:1px solid var(--line);
    border-left:3px solid var(--corrupt);
    border-radius:4px;
    padding:14px 16px;
    cursor:pointer;
    display:flex; justify-content:space-between; align-items:center;
  }
  .stage-card:hover{ background:#101a24; }
  .stage-thumb{
    width:44px; height:44px; border-radius:4px; flex-shrink:0;
    background-size:cover; background-position:center;
    border:1px solid var(--line);
  }
  .stage-card.locked{ opacity:0.45; cursor:not-allowed; border-left-color:var(--text-low); }
  .stage-card.locked:hover{ background:var(--bg-panel); }
  .elite-btn{
    background:var(--gold); color:#3a2a00; border:none; padding:6px 10px;
    border-radius:4px; font-weight:700; font-size:10px; cursor:pointer;
  }
  .elite-btn:hover{ filter:brightness(1.1); }
  .chest-card{ border-left-color:var(--gold); }
  .chest-card .chest-emoji{ font-size:30px; margin-right:6px; }
  .chest-card .chest-info{ display:flex; align-items:center; gap:10px; }
  .chest-card .chest-odds{ font-size:10px; color:var(--text-mid); margin-top:3px; }
  .chest-card .chest-buy-btn{
    background:var(--gold); color:#3a2a00; border:none; padding:8px 14px;
    border-radius:4px; font-weight:700; font-size:12px; cursor:pointer;
  }
  .chest-card .chest-buy-btn:disabled{ background:var(--line); color:var(--text-low); cursor:not-allowed; }
  .stage-card h4{ font-size:14px; }
  .stage-card .ep{ font-size:11px; color:var(--text-mid); margin-top:3px; }
  .stage-card .waves{ font-family:var(--font-mono); font-size:11px; color:var(--danger); }

  /* ---------- BATTLE ---------- */
  #screen-battle{ padding:0; }
  .battle-hud{
    display:flex; justify-content:space-between; align-items:center;
    padding:10px 16px; border-bottom:1px solid var(--line);
    background:var(--bg-panel);
  }
  .wave-indicator{ font-family:var(--font-mono); font-size:12px; color:var(--text-mid); }
  .wave-indicator b{ color:var(--accent); }
  .battle-arena{
    flex:1; position:relative; overflow:hidden;
    background:
      linear-gradient(180deg, rgba(168,85,247,0.05), transparent 40%),
      repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 40px),
      #070c12;
  }
  .lane-mid{
    position:absolute; left:0; right:0; top:50%;
    height:1px; background:linear-gradient(90deg, transparent, var(--line), transparent);
  }
  .unit{
    position:absolute;
    width:52px; height:52px;
    display:flex; align-items:center; justify-content:center;
    flex-direction:column;
    transition:left .35s linear, top .2s linear;
  }
  .unit .portrait{
    width:40px; height:40px; border-radius:6px;
    display:flex; align-items:center; justify-content:center;
    font-size:20px;
  }
  .unit.boss .portrait{ width:64px; height:64px; font-size:30px; }
  .unit .hpbar-wrap{
    width:44px; height:5px; background:#000; border-radius:3px; margin-top:3px; overflow:hidden;
    border:1px solid rgba(255,255,255,0.08);
  }
  .unit .hpbar{ height:100%; background:var(--accent); width:100%; transition:width .2s; }
  .unit.zombie .hpbar, .unit.corrupt .hpbar{ background:var(--danger); }
  .unit.hit{ filter:brightness(1.8); }
  .unit.dying{ opacity:0; transform:scale(0.6) rotate(15deg); transition:all .3s; }
  .dmg-float{
    position:absolute; font-size:12px; font-weight:800; color:var(--gold);
    animation: floatup .6s ease-out forwards; pointer-events:none;
  }
  @keyframes floatup{ from{transform:translateY(0); opacity:1;} to{transform:translateY(-30px); opacity:0;} }
  .ult-banner{
    position:absolute; top:14px; left:50%; transform:translateX(-50%);
    background:rgba(6,10,16,0.85); border:1px solid var(--gold);
    color:var(--gold); font-size:12px; font-weight:800; letter-spacing:0.5px;
    padding:6px 14px; border-radius:4px;
    animation: ultpop .4s ease-out, ultfade .4s ease-in 0.8s forwards;
    white-space:nowrap;
  }
  @keyframes ultpop{ from{transform:translate(-50%,-10px); opacity:0;} to{transform:translate(-50%,0); opacity:1;} }
  @keyframes ultfade{ to{opacity:0;} }

  .battle-bottom{
    padding:10px 14px 14px; border-top:1px solid var(--line);
    background:var(--bg-panel);
    display:flex; flex-direction:column; gap:8px;
  }
  .ult-row{ display:flex; gap:8px; }
  .ult-btn{
    flex:1; position:relative;
    background:var(--bg-panel-raised);
    border:1px solid var(--line);
    border-radius:5px;
    padding:8px 4px;
    display:flex; flex-direction:column; align-items:center; gap:4px;
    cursor:pointer;
    overflow:hidden;
    opacity:0.55;
  }
  .ult-btn.ready{ opacity:1; border-color:var(--gold); box-shadow:0 0 10px rgba(255,204,77,0.25); cursor:pointer; }
  .ult-btn .portrait{ width:26px; height:26px; border-radius:4px; display:flex; align-items:center; justify-content:center; font-size:14px; background:#0a1119; }
  .ult-btn .charge-fill{
    position:absolute; bottom:0; left:0; right:0; height:3px; background:var(--gold);
  }
  .ult-btn span{ font-size:9px; color:var(--text-mid); }
  .ult-btn.ready span{ color:var(--gold); font-weight:700; }
  .ult-btn.dead{ opacity:0.15; pointer-events:none; }

  .speed-row{ display:flex; gap:8px; align-items:center; justify-content:space-between; }
  .speed-controls{ display:flex; gap:6px; }
  .speed-btn{
    background:var(--bg-panel-raised); border:1px solid var(--line); color:var(--text-mid);
    padding:5px 10px; font-size:11px; border-radius:4px; cursor:pointer; font-family:var(--font-mono);
  }
  .speed-btn.active{ color:var(--accent); border-color:var(--accent); }

  /* ---------- RESULT ---------- */
  #screen-result{ align-items:center; justify-content:center; gap:18px; }
  .result-title{ font-size:26px; font-weight:800; letter-spacing:1px; }
  .result-title.win{ color:var(--accent); }
  .result-title.lose{ color:var(--danger); }
  .result-rewards{ display:flex; gap:14px; font-family:var(--font-mono); font-size:13px; color:var(--gold); }

  ::-webkit-scrollbar{ width:6px; }
  ::-webkit-scrollbar-thumb{ background:var(--line); border-radius:3px; }

  /* ---------- MODO MÓVIL ---------- */
  @media (max-width: 480px){
    .topbar{ padding:10px 12px 10px 46px; flex-wrap:wrap; gap:6px; }
    .brand{ font-size:12px; }
    .res{ gap:8px; font-size:11px; }

    .home-menu{ width:88%; }
    .loading-bar-wrap{ width:220px; }

    .roster-body{ flex-direction:column; }
    .roster-side{ width:100%; border-left:none; border-top:1px solid var(--line); padding:10px; }
    .roster-grid{ padding:12px; }
    .hero-grid, .collection-grid{ grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); gap:8px; }
    .hero-card{ padding:7px; }
    .hero-portrait{ font-size:20px; }
    .hero-name{ font-size:10px; }

    .city-side{ width:46px; gap:8px; padding:8px 0; }
    .side-btn{ width:32px; height:32px; font-size:14px; }
    .building .shape{ width:60px; height:70px; font-size:22px; }
    .building .b-label{ font-size:9px; }

    .stage-card{ padding:10px 12px; }
    .stage-card h4{ font-size:12px; }

    .battle-arena{ min-height:220px; }
    .unit{ width:42px; height:42px; }
    .unit .portrait{ width:30px; height:30px; font-size:15px; }
    .ult-row{ flex-wrap:wrap; }
    .ult-btn{ min-width:52px; }

    .detail-body{ flex-direction:column; overflow-y:auto; }
    .detail-left{ width:100%; border-right:none; border-bottom:1px solid var(--line); flex-direction:row; justify-content:flex-start; }
    .detail-portrait{ width:90px; height:90px; font-size:40px; }
    .detail-meta{ text-align:left; }
    .detail-tabs{ overflow-x:auto; }
    .detail-tab{ padding:10px 8px; font-size:10px; white-space:nowrap; }
    .badge-grid{ grid-template-columns:repeat(3,1fr); max-width:100%; gap:10px; }

    #chatBubble{ width:28px; height:28px; font-size:13px; top:10px; left:10px; }
  }
