:root {
  --bg-deep: #071928;
  --bg-panel: #0e273c;
  --bg-card: #143550;
  --bg-card-hover: #1a4364;
  --border-sea: #265982;
  --accent-cyan: #2ad4ff;
  --accent-gold: #ffbe2e;
  --accent-amber: #ff7b29;
  --accent-green: #2ee59d;
  --accent-red: #ff5263;
  --text-main: #f0f7fc;
  --text-muted: #9bc0dc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 50% 0%, #103754 0%, #05131f 100%);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

#app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

/* TOP HUD with Official Nav Texture */
.top-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px;
  background:
    linear-gradient(90deg, rgba(6, 20, 34, 0.88), rgba(10, 32, 52, 0.82)),
    url("assets/official/nav.1079bc3a.png") center/cover no-repeat;
  border-bottom: 2px solid var(--border-sea);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.official-logo {
  height: 44px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.3px;
}

.sub-tag {
  font-size: 10px;
  font-weight: 700;
  color: #111;
  background: linear-gradient(135deg, #ffdf6b, #ff9b21);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.brand-Power {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-Power strong {
  color: var(--accent-gold);
}

.resource-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.res-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 47, 72, 0.9);
  border: 1px solid var(--border-sea);
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
}

.res-pill.highlight-gem {
  border-color: #b36bff;
  background: rgba(58, 28, 94, 0.65);
}

.res-pill.highlight-bp {
  border-color: var(--accent-gold);
  background: rgba(82, 60, 14, 0.6);
}

.res-ico {
  font-size: 15px;
}

.res-val {
  font-weight: 700;
  color: #fff;
}

.res-val small {
  color: var(--text-muted);
  font-weight: 500;
}

.res-lbl {
  font-size: 10px;
  color: var(--text-muted);
}

.hud-actions {
  display: flex;
  gap: 7px;
}

.btn-mini {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-sea);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mini:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.btn-assets {
  background: linear-gradient(135deg, #0d5c8c, #083959);
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-afk {
  background: linear-gradient(135deg, #1b6b4f, #114b37);
  border-color: var(--accent-green);
}

.btn-code {
  background: linear-gradient(135deg, #6d4714, #4e310b);
  border-color: var(--accent-gold);
}

/* MAIN STAGE */
.main-stage {
  flex: 1;
  overflow: hidden;
  position: relative;
  padding: 10px 16px;
}

.tab-pane {
  display: none;
  height: 100%;
}

.tab-pane.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr 415px;
  gap: 14px;
  height: 100%;
}

.canvas-wrapper {
  position: relative;
  background: #061826;
  border: 2px solid var(--border-sea);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.canvas-overlay-top {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.weather-pill, .survivor-pill {
  background: rgba(6, 22, 36, 0.86);
  border: 1px solid rgba(42, 212, 255, 0.35);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.auto-collect-badge {
  background: rgba(255, 190, 46, 0.16);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

.auto-collect-badge.on {
  background: rgba(46, 229, 157, 0.18);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.canvas-overlay-bottom {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 10px;
  justify-content: center;
  pointer-events: none;
}

.action-fab {
  pointer-events: auto;
  background: linear-gradient(135deg, #ff9924, #e65c00);
  color: #fff;
  border: 2px solid #ffd27d;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease;
}

.action-fab:hover {
  transform: scale(1.04);
}

.action-fab.secondary {
  background: linear-gradient(135deg, #1b659e, #0f3f66);
  border-color: var(--accent-cyan);
}

/* SIDE PANEL */
.side-panel {
  background: var(--bg-panel);
  border: 2px solid var(--border-sea);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 10px 14px;
  background: rgba(7, 22, 36, 0.75);
  border-bottom: 1px solid var(--border-sea);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-art-badge {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.panel-header h2 {
  font-size: 15px;
  color: var(--accent-cyan);
  margin-bottom: 3px;
}

.panel-header p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.building-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.b-card {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.b-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.b-title {
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.b-lv {
  background: rgba(42, 212, 255, 0.18);
  color: var(--accent-cyan);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.b-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.b-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.b-worker {
  font-size: 11px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 7px;
}

.worker-mini-avatar {
  width: 28px;
  height: 36px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--accent-gold);
  background: #081c2e;
}

.btn-upgrade {
  background: linear-gradient(135deg, #22996e, #15694b);
  color: #fff;
  border: 1px solid var(--accent-green);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-upgrade:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* RELIC GRID */
.relic-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.relic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.relic-card.owned {
  border-color: var(--accent-gold);
  background: linear-gradient(90deg, rgba(66, 49, 12, 0.45), var(--bg-card));
}

.relic-info h4 {
  font-size: 13px;
  color: var(--accent-gold);
}

.relic-info p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* HEROES TAB & OFFICIAL ANIMATED GIF SHOWCASE */
.heroes-layout {
  display: grid;
  grid-template-columns: 1fr 395px;
  gap: 14px;
  height: 100%;
}

.heroes-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.official-hero-showcase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--accent-gold);
  background:
    linear-gradient(90deg, rgba(8, 25, 42, 0.92) 0%, rgba(12, 38, 62, 0.75) 60%, rgba(8, 25, 42, 0.45) 100%),
    url("assets/official/screen3.43359244.png") center/cover no-repeat;
  min-height: 142px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.showcase-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.showcase-desc-img {
  height: 92px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.65));
}

.showcase-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.showcase-role-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-gold);
}

.showcase-skill-txt {
  font-size: 12px;
  color: #e6f3fc;
  line-height: 1.35;
}

.aura-inline {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(6, 22, 36, 0.78);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(46, 229, 157, 0.35);
  width: fit-content;
}

.showcase-stage {
  position: relative;
  width: 175px;
  height: 126px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(42, 212, 255, 0.22) 0%, transparent 70%);
}

.showcase-gif {
  height: 132px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.75));
}

.showcase-asset-tag {
  position: absolute;
  bottom: -4px;
  right: 0;
  background: rgba(5, 16, 28, 0.85);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
}

.hero-roster {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 10px;
  padding-right: 4px;
}

.hero-card {
  background: var(--bg-card);
  border: 2px solid var(--border-sea);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 7px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.hero-card:hover {
  border-color: var(--accent-gold);
}

.hero-card.deployed {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(42, 212, 255, 0.2);
}

.hero-top-flex {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero-portrait-wrap {
  position: relative;
  width: 58px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--accent-gold);
  background: #071928;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-gif-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(255, 82, 99, 0.92);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
}

.hero-head-info {
  flex: 1;
  min-width: 0;
}

.hero-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 4px;
}

.hero-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.hero-stars {
  color: var(--accent-gold);
  font-size: 11px;
  margin-top: 2px;
}

.hero-faction {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 190, 46, 0.18);
  color: var(--accent-gold);
  font-weight: 700;
  white-space: nowrap;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  font-size: 11px;
  background: rgba(6, 20, 33, 0.55);
  padding: 5px 7px;
  border-radius: 6px;
  margin-top: 4px;
}

.hero-skill {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.32;
}

.hero-affix {
  font-size: 10.5px;
  color: var(--accent-cyan);
  background: rgba(42, 212, 255, 0.1);
  padding: 3px 6px;
  border-radius: 4px;
}

.hero-btns {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* GACHA PANEL */
.gacha-box {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.pity-bar-wrap {
  background: rgba(6, 20, 33, 0.7);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-sea);
}

.pity-label {
  font-size: 11px;
  margin-bottom: 5px;
  color: var(--text-muted);
}

.pity-track {
  height: 8px;
  background: #091d2e;
  border-radius: 99px;
  overflow: hidden;
}

.pity-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold));
  transition: width 0.25s ease;
}

.gacha-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gacha-card {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  border-radius: 9px;
  padding: 10px 12px;
  position: relative;
}

.gacha-card.featured {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, #2d210c, #143550);
}

.gc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(42, 212, 255, 0.2);
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.gc-badge.hot {
  background: var(--accent-amber);
  color: #fff;
}

.gacha-card h3 {
  font-size: 14px;
  margin-bottom: 3px;
}

.gacha-card p {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.btn-primary, .btn-gold {
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  border: none;
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, #1e88e5, #1565c0);
}

.btn-gold {
  background: linear-gradient(135deg, #ff9924, #d84315);
}

.selector-box {
  background: rgba(255, 190, 46, 0.1);
  border: 1px dashed var(--accent-gold);
  border-radius: 8px;
  padding: 8px 10px;
}

.selector-box h4 {
  font-size: 11px;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.selector-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gacha-log {
  background: rgba(5, 17, 28, 0.8);
  border: 1px solid var(--border-sea);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  min-height: 68px;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.45;
}

/* BATTLE SIDEBAR */
.battle-lineup {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border-sea);
}

.lineup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.lineup-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lineup-avatar {
  width: 26px;
  height: 34px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--accent-cyan);
}

.battle-log-box {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  background: rgba(5, 16, 26, 0.65);
}

#formation-select {
  background: #0d2a42;
  color: var(--accent-gold);
  border: 1px solid var(--accent-cyan);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
}

/* BOTTOM NAV */
.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #081c2e;
  border-top: 2px solid var(--border-sea);
  padding: 6px 16px;
  gap: 10px;
}

.nav-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab.active {
  background: linear-gradient(135deg, #1b659e, #0e3a5c);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 14px rgba(42, 212, 255, 0.3);
}

.nav-ico {
  font-size: 18px;
}

.nav-txt {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.nav-txt small {
  font-size: 10px;
  color: var(--accent-cyan);
  font-weight: 500;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-panel);
  border: 2px solid var(--accent-gold);
  border-radius: 12px;
  padding: 18px 20px;
  width: 390px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assets-modal-card {
  width: 980px;
  max-width: 94vw;
  max-height: 86vh;
  overflow: hidden;
}

.assets-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-sea);
  padding-bottom: 8px;
}

.assets-modal-head h3 {
  color: var(--accent-gold);
  font-size: 16px;
}

.assets-modal-head p {
  font-size: 11px;
  color: var(--text-muted);
}

.assets-modal-body {
  overflow-y: auto;
  padding-right: 6px;
}

.assets-modal-body h4 {
  font-size: 13px;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.asset-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.asset-hero-box {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  border-radius: 9px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.asset-hero-box img.ah-avatar {
  width: 50px;
  height: 67px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--accent-gold);
}

.asset-hero-box img.ah-gif {
  width: 82px;
  height: 74px;
  object-fit: contain;
}

.asset-hero-box img.ah-desc {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.asset-boards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.asset-board-card {
  background: var(--bg-card);
  border: 1px solid var(--border-sea);
  border-radius: 8px;
  padding: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.asset-board-card img {
  width: 100%;
  height: 115px;
  object-fit: cover;
  border-radius: 5px;
  margin-bottom: 4px;
}

.code-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  background: rgba(255, 190, 46, 0.18);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.code-input-row {
  display: flex;
  gap: 8px;
}

.code-input-row input {
  flex: 1;
  background: #071928;
  border: 1px solid var(--border-sea);
  color: #fff;
  padding: 7px 10px;
  border-radius: 6px;
}

.code-msg {
  font-size: 12px;
  min-height: 18px;
  color: var(--accent-green);
}
