:root {
  --bg: #07111c;
  --text: #e8f4ff;
  --hint: #8ea4b8;
  --line: rgba(56, 189, 248, 0.28);
  --card: rgba(8, 18, 34, 0.82);
  --good: #34d399;
  --gold: #fbbf24;
  --dock: 124px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(14, 165, 233, 0.18), transparent 42%),
    var(--bg);
  pointer-events: none;
}
.scene-grid {
  position: absolute;
  inset: -40%;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.09) 1px, transparent 1px);
  background-size: 46px 46px;
  animation: drift 16s linear infinite;
  mask-image: radial-gradient(circle at 50% 30%, #000 20%, transparent 75%);
}
.bit {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #22d3ee;
  opacity: 0.8;
  animation: floaty 11s linear infinite;
}
.bit:nth-child(2) { left: 12%; top: 62%; }
.bit:nth-child(3) { left: 18%; top: 72%; background: #a78bfa; animation-duration: 13s; }
.bit:nth-child(4) { left: 74%; top: 64%; animation-duration: 9s; animation-delay: -3s; }
.bit:nth-child(5) { left: 42%; top: 80%; width: 4px; height: 4px; background: #67e8f9; animation-duration: 15s; }
.bit:nth-child(6) { left: 88%; top: 48%; background: #c4b5fd; animation-duration: 12s; animation-delay: -6s; }
.bit:nth-child(7) { left: 8%; top: 40%; animation-duration: 17s; animation-delay: -2s; }
.bit:nth-child(8) { left: 56%; top: 58%; background: #a78bfa; width: 6px; height: 6px; animation-duration: 10s; }
.bit:nth-child(9) { left: 30%; top: 28%; animation-duration: 14s; animation-delay: -8s; }
.bit:nth-child(10) { left: 63%; top: 22%; background: #818cf8; animation-duration: 18s; }
.bit:nth-child(11) { left: 84%; top: 78%; animation-duration: 12s; animation-delay: -4s; }
.bit:nth-child(12) { left: 48%; top: 46%; background: #a78bfa; animation-duration: 16s; animation-delay: -1s; }
.bit:nth-child(13) { left: 22%; top: 16%; animation-duration: 19s; animation-delay: -9s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-46px, -46px, 0); }
}
@keyframes floaty {
  0% { transform: translateY(12px); opacity: 0; }
  12% { opacity: 0.9; }
  100% { transform: translateY(-140px); opacity: 0; }
}

.app-shell { position: relative; z-index: 1; min-height: 100%; }
.boot-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.content {
  padding: 16px 14px calc(var(--dock) + env(safe-area-inset-bottom));
}

.player, .hero, .wallet, .card, .tile {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 0 24px rgba(14, 165, 233, 0.05);
  backdrop-filter: blur(8px);
}

.player {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  border-radius: 18px;
  padding: 12px;
  color: inherit;
  text-align: left;
  font: inherit;
}
button.player {
  cursor: pointer;
  appearance: none;
}
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 800;
  object-fit: cover;
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.25), rgba(15, 23, 42, 0.4));
  border: 1px solid rgba(125, 211, 252, 0.45);
  flex-shrink: 0;
}
.player-main { min-width: 0; flex: 1; }
.player-top, .bar-label, .wallet, .stat-list > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.player-top strong { font-size: 1rem; }
.kicker, .muted, .bar-label, .hero-sub, .block-label {
  color: var(--hint);
  font-size: 0.75rem;
}
.player-top { margin-bottom: 8px; }
.lv {
  border: 1px solid rgba(125, 211, 252, 0.7);
  color: #7dd3fc;
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 0.72rem;
  font-weight: 800;
}
.bar {
  margin-top: 4px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fb7185, #fbbf24 55%, #fde68a);
}

.hero, .card {
  margin-top: 12px;
  border-radius: 18px;
  padding: 14px;
}
.map-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-copy { min-width: 0; flex: 1; }
.map-copy h2 { word-break: break-word; }
.map-change {
  margin-top: 10px;
  border: 0;
  border-radius: 10px;
  padding: 7px 14px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  color: white;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.map-media {
  width: 96px;
  height: 74px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: rgba(8, 18, 34, 0.8);
  flex-shrink: 0;
}
.map-option {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: inherit;
  font: inherit;
  margin-top: 8px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(8, 18, 34, 0.72);
  cursor: pointer;
}
.map-option img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
}
.map-option small { display: block; color: var(--hint); margin-top: 2px; }
.map-option.active { border-color: rgba(125, 211, 252, 0.9); }
.map-option:disabled { opacity: 0.45; cursor: default; }
.map-list { max-height: min(62vh, 520px); overflow: auto; margin-top: 8px; }
.hero h2, .page-head h2 {
  margin: 2px 0 0;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}
.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.hero-sub { margin: 8px 0 0; }

.block-label {
  display: flex;
  justify-content: space-between;
  margin: 16px 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.tile-grid.count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  grid-column: span 2;
  min-height: 58px;
  height: auto;
  border-radius: 14px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.05;
  cursor: pointer;
}
.tile-grid.count-4 .tile { grid-column: auto; }
.tile-grid.count-5 .tile:nth-child(4) { grid-column: 2 / span 2; }
.tile-grid.count-5 .tile:nth-child(5) { grid-column: 4 / span 2; }
.tile.active {
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.45), 0 0 18px rgba(34, 211, 238, 0.22);
}
.tile-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}
.tone-gold { background: linear-gradient(180deg, rgba(251, 191, 36, 0.16), rgba(8, 18, 34, 0.9)); }
.tone-cyan { background: linear-gradient(180deg, rgba(34, 211, 238, 0.14), rgba(8, 18, 34, 0.9)); }
.tone-green { background: linear-gradient(180deg, rgba(52, 211, 153, 0.16), rgba(8, 18, 34, 0.9)); }
.tone-violet { background: linear-gradient(180deg, rgba(167, 139, 250, 0.18), rgba(8, 18, 34, 0.9)); }
.tone-rose { background: linear-gradient(180deg, rgba(251, 113, 133, 0.16), rgba(8, 18, 34, 0.9)); }

.wallet {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 12px;
  border-radius: 18px;
  padding: 14px 12px;
}
.wallet strong { display: block; margin-top: 4px; font-size: 0.95rem; }
.wallet span { color: var(--hint); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }
.panel { margin-top: 4px; }
.gear-row, .score-card, .mile, .suit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: rgba(8, 18, 34, 0.78);
}
.gear-open, .gear-hit {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.gear-open img, .gear-emoji, .suit-row img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.7);
  flex-shrink: 0;
}
.gear-emoji { font-size: 1.2rem; }
.gear-copy { min-width: 0; }
.gear-copy strong, .suit-row strong { display: block; font-size: 0.82rem; }
.gear-copy small, .suit-row small { color: var(--hint); font-size: 0.68rem; }
.gear-use, .chip, .mile button {
  border: 0;
  border-radius: 8px;
  padding: 6px 8px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  color: white;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}
.gear-state { color: #34d399; font-size: 0.68rem; font-weight: 800; padding-right: 4px; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { background: rgba(8, 18, 34, 0.8); color: #d7f6ff; border: 1px solid rgba(103, 232, 249, 0.45); }
.chip.on { background: linear-gradient(180deg, #38bdf8, #1d4ed8); border: 0; }
.score-card { justify-content: space-between; text-align: center; }
.score-card b { display: block; font-size: 1.05rem; margin-top: 2px; }
.score-card span, .mile small { color: var(--hint); font-size: 0.72rem; }
.vs { color: #7dd3fc; font-weight: 800; }
.mile { justify-content: space-between; }
.mile strong { font-size: 0.78rem; }
.suit-row { justify-content: space-between; }
.page-only { padding-top: 8px; }
.preview-media {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 14px;
  margin-top: 12px;
}
.soon {
  margin-top: 12px;
  border-radius: 18px;
  border: 1px dashed rgba(125, 211, 252, 0.45);
  padding: 28px 16px;
  text-align: center;
  color: var(--hint);
}
.soon strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 6px; }

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px 16px;
  background: rgba(2, 8, 18, 0.35);
  backdrop-filter: blur(18px);
}
.profile-sheet {
  width: min(100%, 380px);
  border-radius: 22px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.28), transparent 42%),
    rgba(6, 16, 32, 0.92);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 16px;
}
.sheet-top { display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-kicker { margin: 0; color: #7dd3fc; letter-spacing: 0.16em; font-size: 0.68rem; font-weight: 800; }
.sheet-top h2 { margin: 2px 0 0; font-size: 1.7rem; }
.sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  background: transparent;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
}
.sheet-person { display: flex; gap: 14px; align-items: center; margin: 16px 0; }
.sheet-person img, .sheet-fallback {
  width: 84px;
  height: 84px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(125, 211, 252, 0.4);
}
.sheet-fallback {
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.7);
}
.sheet-person h3 { margin: 0; font-size: 1.25rem; }
.online { color: #34d399; font-size: 0.78rem; font-weight: 700; }
.sheet-stats { display: grid; gap: 8px; }
.sheet-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(2, 8, 20, 0.35);
}
.sheet-stats span { color: var(--hint); font-size: 0.75rem; }

.page-head { margin-bottom: 4px; }
.page-head h2 { font-size: 1.45rem; }
.cards { display: grid; gap: 10px; }
.card h3 { margin: 0 0 10px; font-size: 1rem; }
.stat-list { display: grid; gap: 7px; }
.stat-list > div {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.stat-list > div:last-child { border-bottom: 0; padding-bottom: 0; }

.btn {
  width: 100%;
  margin-top: 10px;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.btn-claim { background: linear-gradient(180deg, #4ade80, #16a34a); color: #052e16; }

.skeleton { color: var(--hint); padding: 28px 12px; text-align: center; }
.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(var(--dock) + env(safe-area-inset-bottom));
  z-index: 50;
  background: #0b1726;
  border: 1px solid var(--line);
  color: white;
  padding: 12px 14px;
  border-radius: 14px;
}
.hidden { display: none !important; }

.dock {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 14px 10px calc(12px + env(safe-area-inset-bottom));
  background: rgba(4, 10, 22, 0.58);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border-top: 1px solid rgba(125, 211, 252, 0.22);
  box-shadow: 0 -16px 36px rgba(2, 8, 20, 0.45);
}
.dock.dock-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dock button {
  border: 1px solid rgba(103, 232, 249, 0.75);
  background: rgba(6, 16, 32, 0.78);
  color: #dff8ff;
  border-radius: 18px;
  min-height: 68px;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font: inherit;
  font-size: 0.64rem;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.24), inset 0 0 12px rgba(34, 211, 238, 0.08);
}
.dock button span { max-width: 100%; }
.dock svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dock button.active {
  color: white;
  border: 0;
  min-height: 78px;
  background: linear-gradient(180deg, #38bdf8, #1d4ed8);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.5);
  transform: translateY(-12px);
}
