:root {
  --panel: rgba(8, 18, 40, 0.58);
  --line: rgba(106, 236, 255, 0.35);
  --text: #e7f5ff;
  --accent: #64f2ff;
  --accent2: #8dff6a;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); font-family: "Segoe UI", sans-serif; min-height: 100vh; overflow-x: hidden; }
.topbar,
.main-nav,
.home-shell,
.full-layout {
  width: min(1280px, calc(100% - 24px));
  margin-left: auto;
  margin-right: auto;
}
.game-bg { position: fixed; inset: 0; background: linear-gradient(rgba(7,11,20,.16), rgba(7,11,20,.3)), url('/game-bg.svg') center center/cover no-repeat; z-index: -2; filter: saturate(1.25) contrast(1.1); }
.bubble-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
}
.bubble-layer span {
  position: absolute;
  bottom: -120px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(180,245,255,.9), rgba(123,214,255,.24));
  box-shadow: 0 0 10px rgba(120, 220, 255, .32);
  opacity: .65;
  animation: bubble-rise linear infinite;
}
.bubble-layer span:nth-child(1) { left: 6%; animation-duration: 12s; animation-delay: 0s; width: 8px; height: 8px; }
.bubble-layer span:nth-child(2) { left: 14%; animation-duration: 16s; animation-delay: 2s; width: 14px; height: 14px; }
.bubble-layer span:nth-child(3) { left: 22%; animation-duration: 10s; animation-delay: 4s; }
.bubble-layer span:nth-child(4) { left: 30%; animation-duration: 18s; animation-delay: 1s; width: 16px; height: 16px; }
.bubble-layer span:nth-child(5) { left: 40%; animation-duration: 13s; animation-delay: 5s; }
.bubble-layer span:nth-child(6) { left: 50%; animation-duration: 19s; animation-delay: 0.5s; width: 18px; height: 18px; }
.bubble-layer span:nth-child(7) { left: 60%; animation-duration: 11s; animation-delay: 3s; }
.bubble-layer span:nth-child(8) { left: 68%; animation-duration: 15s; animation-delay: 1.5s; width: 12px; height: 12px; }
.bubble-layer span:nth-child(9) { left: 76%; animation-duration: 14s; animation-delay: 6s; }
.bubble-layer span:nth-child(10) { left: 84%; animation-duration: 17s; animation-delay: 2.5s; width: 15px; height: 15px; }
.bubble-layer span:nth-child(11) { left: 91%; animation-duration: 12.5s; animation-delay: 4.5s; }
.bubble-layer span:nth-child(12) { left: 96%; animation-duration: 20s; animation-delay: .8s; width: 13px; height: 13px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); background: rgba(2, 9, 22, 0.42); border-radius: 0 0 16px 16px; }
.topbar h1 { margin: 0; color: var(--accent); }
.topbar p { margin: 4px 0 0; }
.topbar > div:first-child { position: relative; }
.wallet-zone {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}
.wallet-zone .main-nav {
  flex-basis: 100%;
  justify-content: flex-end;
  margin-left: auto;
}
.wallet-select {
  min-width: 170px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(2, 9, 22, 0.6);
  color: var(--text);
  padding: 0 10px;
}
.actions select,
.actions input[type="number"],
.actions input[type="text"] {
  min-width: 130px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(2, 9, 22, 0.62);
  color: var(--text);
  padding: 0 10px;
}
.actions select:focus,
.actions input[type="number"]:focus,
.actions input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(100, 242, 255, 0.2);
}
.wallet-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(100, 242, 255, 0.2);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
#walletAddr {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(0,0,0,.22);
  font-size: 13px;
}
#walletAddr.wallet-clickable {
  cursor: pointer;
  border-color: var(--accent);
}
.wallet-menu {
  position: absolute;
  top: 42px;
  right: 0;
  left: auto;
  min-width: 220px;
  z-index: 60;
  display: none;
  background: rgba(2, 9, 22, 0.95);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
}
.wallet-zone.open-menu .wallet-menu { display: block; }
.wallet-menu button {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.main-nav { display: flex; gap: 10px; padding: 10px 0 0; flex-wrap: wrap; justify-content: flex-start; }
.nav-item { border: 1px solid var(--line); background: rgba(2, 9, 22, 0.42); color: var(--text); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.nav-item.active { background: linear-gradient(130deg, var(--accent), var(--accent2)); color: #00131f; font-weight: 700; }
.view { display: none; }
.view.active { display: block; }
.full-layout { padding: 18px 22px 30px; display: grid; grid-template-columns: 1fr; gap: 18px; }
.home-shell { padding: 18px 22px 30px; display: grid; gap: 18px; }
.home-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-areas:
    "intro game"
    "board game";
  gap: 18px;
  align-items: stretch;
}
.intro-panel { grid-area: intro; }
.board-panel { grid-area: board; }
.game-panel { grid-area: game; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; backdrop-filter: blur(4px); }
.game-panel,
.board-panel { display: flex; flex-direction: column; height: 100%; }
.game-panel .mission-box { display: flex; flex-direction: column; flex: 1; min-height: 220px; }
.hero-panel h2 { margin: 0; font-size: 2rem; }
.hero-copy { opacity: .9; max-width: 70ch; }
.kicker { margin: 0 0 8px; color: var(--accent); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; }
.stat-strip { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.stat-box { border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 10px; background: rgba(0,0,0,.2); }
.stat-box span { font-size: .78rem; opacity: .82; display: block; }
.stat-box strong { font-size: 1.02rem; display: block; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel h3 { margin-top: 0; }
.countdown-text { margin: -4px 0 10px; color: #b6dcff; font-size: 13px; }
.page-hero {
  background: linear-gradient(120deg, rgba(16,41,66,.75), rgba(10,24,45,.55));
}
.page-hero h2 { margin: 0; font-size: 1.9rem; }
.page-hero p { margin: 8px 0 0; opacity: .9; }
.panel-head p { margin: 8px 0 0; color: #b6dcff; }
.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  justify-content: center;
  gap: 16px;
}
.nft-card { border: 1px solid rgba(255,255,255,.25); border-radius: 12px; padding: 8px; background: rgba(0,0,0,.28); }
.nft-card {
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  padding: 0;
}
.nft-card::before {
  content: "";
  position: absolute;
  inset: -120% auto auto -40%;
  width: 80%;
  height: 260%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
  animation: nft-sheen 5.5s linear infinite;
  pointer-events: none;
}
.nft-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(120, 245, 255, 0.7);
  box-shadow: 0 18px 40px rgba(27, 176, 255, 0.28);
}
.nft-card img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: rgba(0, 0, 0, 0.28);
}
.nft-counter { padding: 8px 10px 10px; font-weight: 700; font-size: 13px; color: #b8e8ff; }
.nft-card-summary {
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding: 0;
}
.nft-card-summary img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}
.nft-card-summary .nft-counter {
  border-top: 1px solid rgba(255,255,255,.18);
  background: rgba(5, 16, 30, 0.72);
  text-align: center;
  font-size: 14px;
}
.box-controls {
  padding: 10px 10px 12px;
  text-align: center;
}
.box-controls .actions {
  justify-content: center;
  margin-bottom: 0;
}
.btn { background: linear-gradient(130deg, var(--accent), var(--accent2)); border: 0; color: #00131f; font-weight: 700; border-radius: 10px; padding: 10px 12px; cursor: pointer; margin-top: 8px; }
.btn-secondary { background: linear-gradient(130deg, #7fd8ff, #9bf7d3); color: #052235; }
.btn-accent { background: linear-gradient(130deg, #ffd37a, #ffb86b); color: #2b1700; }
.btn:disabled,
.btn-secondary:disabled,
.btn-accent:disabled,
.btn-ghost:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
#msg { min-height: 24px; color: #ffc87d; }
.mission-box { border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 12px; background: rgba(0,0,0,.2); }
#activeDeployList { display: grid; gap: 8px; align-content: start; flex: 1; }
#activeDeployList article { border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 8px 10px; background: rgba(7,20,34,.45); }
#activeDeployList p { margin: 4px 0 0; opacity: .9; }
.pager-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; }
.pager-row .btn { margin-top: 0; padding: 6px 10px; }
.box-open-anim {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 20, 0.58);
  backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.box-open-panel {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid rgba(106, 236, 255, 0.35);
  border-radius: 18px;
  padding: 20px 20px 16px;
  background: linear-gradient(160deg, rgba(5, 16, 37, 0.95), rgba(3, 10, 25, 0.92));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255,255,255,.06);
  text-align: center;
}
.box-open-anim .btn { margin-top: 12px; padding: 12px 24px; font-size: 16px; }
.box-open-anim.hidden { display: none; }
.box-open-wrap {
  position: relative;
  width: min(300px, 60vw);
  margin: 0 auto;
  perspective: 1000px;
  min-height: 400px;
}
.box-face {
  position: absolute;
  inset: 0;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  backface-visibility: hidden;
}
.box-face-front {
  transform: rotateY(180deg);
}
.box-flip-card {
  transform-style: preserve-3d;
  transition: transform 620ms ease;
}
.box-flip-card.flipped {
  transform: rotateY(180deg);
}
.box-open-glow {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.32), transparent 65%);
  opacity: 0;
  transition: opacity 360ms ease;
}
.box-open-anim.opening .box-flip-card {
  animation: box-open-shake 700ms ease;
}
.box-open-anim.opening .box-open-glow {
  opacity: 1;
  animation: box-open-flash 900ms ease;
}
#boxAnimText {
  margin: 10px 0 0;
  color: #bfe9ff;
  font-size: 15px;
  letter-spacing: .02em;
}
.intel-list { display: grid; gap: 10px; }
.intel-list article { border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 10px; background: rgba(0,0,0,.2); }
.intel-list p { margin: 6px 0 0; opacity: .88; }
.profile-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
table { width: 100%; border-collapse: collapse; }
th, td { border-top: 1px solid rgba(255,255,255,.15); padding: 8px; text-align: left; }
.panel input[readonly],
.panel textarea[readonly] {
  opacity: .9;
  background: rgba(8, 23, 41, 0.78);
}
@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "game"
      "board";
  }
}
@media (max-width: 920px) {
  .topbar,
  .home-shell,
  .full-layout {
    width: min(1280px, calc(100% - 12px));
  }
  .topbar { flex-direction: column; align-items: flex-start; }
  .stat-strip, .nft-grid { grid-template-columns: 1fr; }
  .profile-overview-grid { grid-template-columns: 1fr; }
  .box-open-anim {
    padding: 12px;
  }
  .box-open-panel { width: min(520px, calc(100vw - 24px)); }
}

@keyframes bubble-rise {
  0% { transform: translateY(0) translateX(0) scale(.8); opacity: 0; }
  10% { opacity: .45; }
  50% { transform: translateY(-55vh) translateX(10px) scale(1); }
  100% { transform: translateY(-115vh) translateX(-8px) scale(1.2); opacity: 0; }
}

@keyframes nft-sheen {
  0%, 72% { left: -60%; }
  100% { left: 140%; }
}

@keyframes box-open-shake {
  0% { transform: scale(1) rotate(0); }
  20% { transform: scale(1.04) rotate(-2deg); }
  40% { transform: scale(1.05) rotate(2deg); }
  60% { transform: scale(1.03) rotate(-1deg); }
  80% { transform: scale(1.01) rotate(1deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes box-open-flash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
