/* Mobile card and battle sizing fixes. */
@media (max-width: 560px) {
  .rarity-6 .cat { aspect-ratio: 3 / 4 !important; }
  .rarity-6 .cat img { padding: 6px 5px 0; object-position: center top !important; }
  .rarity-6 .card-info {
    position: relative;
    z-index: 5;
    min-height: 98px;
    background: linear-gradient(180deg, #311942, #140c19) !important;
  }
  .rarity-6 h3 {
    font-size: 17px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .units { gap: 4px; }
  .unit, .battle-screen .fighter { width: min(28%, 105px); max-height: 185px; }
  .portrait, .battle-screen .fighter .face { height: 125px; min-height: 78px; }
  .unit b, .unit small { font-size: 10px; }
}

.account-entry {
  border: 1px solid #d7ad5e;
  border-radius: 18px;
  background: #2b1b14;
  color: #ffe2a2;
  padding: 6px 10px;
  font-weight: 900;
  font-size: 11px;
  cursor: pointer;
}
.account-entry small { display: block; color: #cdbb9c; font-size: 8px; }
.account-modal { position: fixed; z-index: 1000; inset: 0; display: none; place-items: center; padding: 20px; background: #080504d9; backdrop-filter: blur(7px); }
.account-modal.open { display: grid; }
.account-panel { width: min(100%, 390px); padding: 22px; border: 1px solid #b98b49; border-radius: 20px; background: linear-gradient(145deg, #352119, #140e0c); box-shadow: 0 24px 60px #000; }
.account-panel h2 { margin: 0 0 8px; color: #ffe1a0; }
.account-panel p { color: #cdbda8; line-height: 1.6; }
.guest-bonus { margin: 15px 0; padding: 13px; border: 1px solid #67503a; border-radius: 12px; background: #110c0a; color: #f0cd83; }
.account-actions { display: grid; gap: 9px; }
.account-actions button { width: 100%; }
.account-close { float: right; border: 0; background: none; color: #dbc69f; font-size: 24px; }
.rename-input { width: 100%; margin: 10px 0 16px; padding: 13px 14px; border: 1px solid #8c6744; border-radius: 12px; background: #0d0908; color: #ffe7b0; font-size: 16px; outline: none; }
.rename-input:focus { border-color: #e4b960; box-shadow: 0 0 0 3px #e4b96022; }
@media (max-width: 430px) {
  .topbar { padding-inline: 10px; }
  .topbar h1 { font-size: 20px; }
  .resources { gap: 4px; }
  .resources span { padding: 6px; font-size: 11px; }
  .account-entry { padding: 5px 7px; }
  .territory-map { aspect-ratio: 3 / 4; }
  .city-node i { width: 29px; height: 29px; font-size: 13px; }
  .city-node b { max-width: 58px; overflow: hidden; text-overflow: ellipsis; font-size: 9px; }
  .city-node small { display: none; }
  .territory-map::after { font-size: 18px; opacity: .75; }
  .arena-defense img { aspect-ratio: 3 / 4; object-fit: contain; background: #100b09; }
  .opponent { padding: 10px; }
  .opponent .primary { padding: 10px 12px; font-size: 12px; }
}

.glow-6 { box-shadow: 0 0 14px #d15cff, 0 0 7px #ffe28a; }
.unit > .unit-name {
  position: static !important;
  display: block;
  width: 100%;
  max-width: 100%;
  transform: none !important;
  margin: 0;
  padding: 3px 4px !important;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.stage footer #attack.stop { background: linear-gradient(#74352f,#4d211e); color: #ffd6ca; border-color: #c7685c; }

.world-announcement {
  position: fixed;
  z-index: 1200;
  top: max(72px, env(safe-area-inset-top));
  left: 50%;
  width: min(92vw, 520px);
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid #e5bb63;
  border-radius: 22px;
  background: linear-gradient(90deg, #160c1bea, #4a1c61f2, #160c1bea);
  box-shadow: 0 8px 28px #000b, 0 0 20px #bd5aff77;
  color: #ffe7a8;
  white-space: nowrap;
  pointer-events: none;
  animation: world-pop 5.5s ease both;
}
.world-announcement span { display: inline-block; min-width: 100%; padding: 10px 22px; font-weight: 900; animation: world-scroll 5.5s linear both; }
.world-announcement b { color: #f3a4ff; }
.system-board { margin: 12px 0 16px; padding: 12px 14px; max-height: 180px; overflow-y: auto; border: 1px solid #84603d; border-radius: 14px; background: #130d0be8; box-shadow: inset 0 0 18px #d5a14b12; }
.system-board header { position: static; width: auto; height: auto; padding: 0 0 8px; transform: none; display: flex; justify-content: space-between; border: 0; background: none; }
.system-board header small { color: #bca98d; }
.system-board p { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid #ffffff12; color: #e5cfaa; font-size: 11px; line-height: 1.5; }
.system-board time { margin-right: 8px; color: #b58cff; }
.official-notice { color: #ffe19a !important; background: #4b331433; }
.official-notice time { color: #ffc95e !important; }
.draw-board { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #8b4ca8; border-radius: 14px; background: linear-gradient(135deg,#25102e,#120c14); }
.draw-board header { display: flex; justify-content: space-between; color: #f1c0ff; }
.draw-board header small { color: #b89bc1; }
.draw-feed p { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin: 7px 0 0; padding-top: 7px; border-top: 1px solid #ffffff14; font-size: 11px; }
.draw-feed b { color: #ffd06f; }
.draw-feed span { color: #e8d7ed; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-team-compact { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.home-team-compact span { display: grid; text-align: center; padding: 6px; border: 1px solid #70503b; border-radius: 12px; background: #17100e; overflow: hidden; }
.home-team-compact img { width: 100%; aspect-ratio: 3/4; object-fit: contain; border-radius: 8px; background: #0d0908; }
.home-team-compact b { margin-top: 5px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-team-compact small { color: #bdaa94; font-size: 9px; }
.return-focus { outline: 3px solid #f2c767 !important; box-shadow: 0 0 24px #f2c76799 !important; animation: return-pulse .9s ease-in-out 2; }
.ranking-list { max-height: 760px; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
.daily-mode-panel { margin: 4px 0 20px; padding: 18px; border: 1px solid #b8863e; border-radius: 20px; background: linear-gradient(145deg,#3a2417,#160e0b); box-shadow: 0 14px 34px #0009, inset 0 0 24px #d89b3d18; }
.daily-mode-panel header { display:flex; align-items:center; gap:12px; margin-bottom:14px; }.daily-mode-panel header>span{font-size:30px}.daily-mode-panel header b{display:block;color:#ffe09a;font-size:20px}.daily-mode-panel header small{color:#bfae95}.daily-mode-buttons{display:grid;grid-template-columns:1fr 1fr;gap:12px}.daily-mode-buttons button{display:flex;align-items:center;gap:12px;min-height:92px;padding:16px;border:1px solid #715039;border-radius:16px;background:#17100e;color:#ead6b6;text-align:left}.daily-mode-buttons button.active{border-color:#f0c568;background:linear-gradient(145deg,#6a421e,#2a190f);box-shadow:0 0 20px #d99d4055}.daily-mode-buttons i{font-style:normal;font-size:32px}.daily-mode-buttons b,.daily-mode-buttons small{display:block}.daily-mode-buttons b{font-size:17px;color:#ffe0a0}.daily-mode-buttons small{margin-top:4px;color:#bbaa92}@media(max-width:480px){.daily-mode-buttons{grid-template-columns:1fr}.daily-mode-buttons button{min-height:78px}}
.city-node.limit { filter: grayscale(.7); opacity: .7; pointer-events: none; }
.city-owner { position:absolute; left:50%; bottom:calc(100% + 4px); max-width:110px; transform:translateX(-50%); padding:3px 8px; border:1px solid #ffe08a; border-radius:10px; background:#24140eef; box-shadow:0 4px 12px #000b; color:#ffe6a8; font-size:10px; font-style:normal; font-weight:900; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.daily-loop{margin:12px 0 16px;padding:15px;border:1px solid #c49343;border-radius:18px;background:linear-gradient(145deg,#382214,#160e0b);box-shadow:0 12px 28px #0008}.daily-loop header{display:flex;align-items:center;justify-content:space-between}.daily-loop header b{display:block;color:#ffe09a;font-size:18px}.daily-loop header small,.daily-loop p{color:#bca98c;font-size:10px}.daily-loop header>span{padding:6px 10px;border-radius:14px;background:#a36b27;color:#fff0c5;font-weight:900}.daily-goals{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:12px 0}.daily-goals div{padding:10px 6px;border:1px solid #58402f;border-radius:12px;background:#130d0b;text-align:center}.daily-goals div.done{border-color:#d7aa50;background:#493018}.daily-goals i,.daily-goals b,.daily-goals small{display:block}.daily-goals i{font-style:normal;font-size:22px}.daily-goals b{margin:4px 0;color:#ead2ad;font-size:11px}.daily-goals small{color:#a9967c;font-size:9px}.daily-goals .done small{color:#ffd873}.daily-chest{width:100%}.daily-loop p{text-align:center;margin:8px 0 0}
.chapter.boss-stage{border-color:#e0a84c;background:linear-gradient(100deg,#421716,#1b100c);box-shadow:inset 0 0 24px #e74b2433,0 0 16px #d8963a33}.chapter.boss-stage .number{background:linear-gradient(#d04a28,#7d2118);color:#ffe5a1}.chapter.boss-stage h3 em{display:inline-block;margin-left:7px;padding:2px 6px;border:1px solid #ffca64;border-radius:8px;background:#8d261d;color:#ffe6a1;font-size:8px;font-style:normal;vertical-align:middle}.chapter.boss-stage .battle-link{background:linear-gradient(#e0ad48,#a94c20)}
.top-profile{display:flex;align-items:center;gap:8px;min-width:0;padding:5px 8px;border:1px solid #654735;border-radius:14px;background:#0f0a08;color:#f6deb1;text-align:left}.top-avatar{width:36px;height:36px;display:grid;place-items:center;flex:none;border:1px solid #d7a953;border-radius:50%;background:linear-gradient(#6d3e21,#24150e);font-size:21px}.top-profile b,.top-profile small{display:block;max-width:105px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-profile b{font-size:12px}.top-profile small{margin-top:2px;color:#a9977f;font-size:8px}.task-button{color:#ffe09a!important}.task-center-modal{position:fixed;z-index:1200;inset:0;display:grid;place-items:center;padding:14px;background:#060403df;backdrop-filter:blur(8px)}.task-center-panel{width:min(100%,500px);max-height:90dvh;overflow:hidden;border:1px solid #c28d40;border-radius:22px;background:linear-gradient(#352116,#120c09);box-shadow:0 28px 70px #000}.task-center-panel>header{display:flex;align-items:center;justify-content:space-between;padding:17px 18px;border-bottom:1px solid #72502f;background:#24150f}.task-center-panel h2{margin:0;color:#ffe09a}.task-center-panel header small{color:#bfa57d}.task-center-close{border:0;background:none;color:#f0d7ae;font-size:28px}.task-center-body{max-height:calc(90dvh - 76px);overflow-y:auto;padding:15px}.activity-track{padding:14px;border:1px solid #795435;border-radius:16px;background:#17100d}.activity-track header{display:flex;justify-content:space-between;color:#f3d89e}.activity-bar,.task-list article div>span{display:block;height:8px;overflow:hidden;border-radius:8px;background:#38281e}.activity-bar{margin:10px 0}.activity-bar i,.task-list article div>span i{display:block;height:100%;background:linear-gradient(90deg,#d99c38,#ffe37f)}.activity-chests{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}.activity-chests button{padding:7px 2px;border:1px solid #6d4d34;border-radius:9px;background:#251811;color:#e9cf9d}.activity-chests button:not(:disabled){border-color:#ffd56c;box-shadow:0 0 12px #dfaa4266}.activity-chests span,.activity-chests b,.activity-chests small{display:block}.activity-chests small{font-size:7px}.task-tabs{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin:13px 0}.task-tabs button{padding:10px 4px;border:1px solid #60432f;background:#17100d;color:#bbaa91}.task-tabs button.active{border-color:#e0af53;background:#5a361b;color:#ffe3a0}.task-list{display:grid;gap:8px}.task-list article{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:9px;padding:12px;border:1px solid #573d2d;border-radius:12px;background:#17100d}.task-list article.done{border-color:#9a733b}.task-list article div>b,.task-list article div>small{display:block}.task-list article div>small{color:#ae9b80;font-size:9px}.task-list strong{color:#ffd979;font-size:10px}.task-list article>button{padding:8px;border:0;border-radius:8px;background:#403027;color:#ac9b87}.task-list article.done>button{background:#8a622d;color:#ffe5a5}@media(max-width:420px){.top-profile{padding:4px}.top-avatar{width:31px;height:31px;font-size:18px}.top-profile b,.top-profile small{max-width:66px}.resources span{padding:5px!important}.resources .help-button:last-child{display:none}.activity-chests small{display:none}}
.mini-roster{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:14px}.mini-hero{position:relative;min-width:0;padding:5px;border:1px solid var(--rarity,#70503b);border-radius:11px;background:#120c0a;color:#ead4b4;overflow:hidden}.mini-hero img{display:block;width:100%;aspect-ratio:1/1.16;object-fit:cover;object-position:top;border-radius:7px;background:#090605}.mini-hero b,.mini-hero small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mini-hero b{margin-top:5px;font-size:10px}.mini-hero small{color:#b5a28a;font-size:8px}.mini-hero.locked{filter:grayscale(.8);opacity:.5}.mini-hero.in-team{outline:2px solid #ffe083}.mini-hero>i{position:absolute;right:4px;bottom:24px;padding:2px 4px;border-radius:5px;background:#b47a2c;color:#fff1c7;font-size:7px;font-style:normal}.mini-grade{position:absolute;z-index:1;top:7px;left:7px;padding:2px 4px;border-radius:5px;background:#080504dc;color:var(--rarity,#ffd36d);font-size:7px;font-weight:900}.hero-detail-modal{position:fixed;z-index:1250;inset:0;display:grid;place-items:center;padding:18px;background:#050302e6;backdrop-filter:blur(8px)}.hero-detail-panel{position:relative;width:min(100%,340px);max-height:92dvh;overflow-y:auto;padding:18px;border:1px solid #a7773c;border-radius:22px;background:#1b110d;box-shadow:0 28px 70px #000}.hero-detail-panel .card{width:100%}.hero-detail-close{position:absolute;z-index:2;top:8px;right:10px;border:0;background:#110b09cc;color:#ffe1a6;font-size:26px}.hero-detail-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}@media(max-width:360px){.mini-roster{gap:5px}.mini-hero{padding:3px}.mini-hero b{font-size:9px}}
.mini-faction{position:absolute;z-index:2;top:7px;right:7px;width:20px;height:20px;display:grid;place-items:center;border:1px solid #e7bd66;border-radius:50%;background:#25150ee8;color:#ffe4a0;font-size:9px;font-weight:900}.copy-count{position:absolute;z-index:2;right:6px;bottom:27px;padding:2px 5px;border:1px solid #e8bf68;border-radius:7px;background:#120b08e8;color:#ffe29a;font-size:8px;font-weight:900}.detail-copy-count{margin-top:10px;padding:9px;border:1px solid #6e4b31;border-radius:10px;background:#100b09;color:#f0d292;text-align:center;font-size:12px;font-weight:900}
@keyframes return-pulse { 50% { transform: scale(1.025); } }
@keyframes world-scroll { from { transform: translateX(90%); } to { transform: translateX(-105%); } }
@keyframes world-pop { 0%,100% { opacity: 0; } 8%,90% { opacity: 1; } }
