﻿@import url("https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Teko:wght@500;600;700&display=swap");

:root {
  --bg-0: #060912;
  --bg-1: #0b1322;
  --bg-2: #101b2f;
  --line: #2a5f89;
  --line-soft: rgba(123, 185, 232, 0.26);
  --text: #edf4ff;
  --muted: #9eb5cf;
  --ok: #6af2b9;
  --danger: #ff8f9d;
  --gold: #ffd46d;
  --accent: #ff7c82;

  --img-bg-home: url("./assets/tg_ui/bg_home_city.png");
  --img-panel-chain: url("./assets/tg_ui/panel_chain_blue.png");
  --img-btn-red: url("./assets/tg_ui/btn_red_rect.png");
  --img-btn-blue: url("./assets/tg_ui/btn_blue_rect.png");
  --img-btn-orange: url("./assets/tg_ui/btn_orange_hex.png");
  --img-strip-redblue: url("./assets/tg_ui/strip_redblue_top.png");
  --img-strip-orange: url("./assets/tg_ui/strip_orange_angle.png");
  --img-strip-blue: url("./assets/tg_ui/strip_blue_dark.png");
  --img-accent-red: url("./assets/tg_ui/accent_red_glow.png");
  --img-label-redblue: url("./assets/tg_ui/tile_redblue_label.png");
  --img-pack-crate: url("./assets/tg_ui/pack_crate.png");
  --img-marker-open: url("./assets/tg_ui/marker_open_red.png");
  --img-marker-running: url("./assets/tg_ui/marker_running_purple.png");
  --img-marker-claim: url("./assets/tg_ui/marker_claim_gold.png");
  --img-bg-dispatch: url("./assets/tg_ui/bg_dispatch_map.png");
  --bg-shift-x: 0px;
  --bg-shift-y: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  color: var(--text);
  font-family: "Rajdhani", "Segoe UI", Tahoma, sans-serif;
  background: #05080f;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 8, 15, 0.45), rgba(5, 8, 15, 0.88)), var(--img-bg-home) center top / cover no-repeat;
  z-index: -2;
  transform: translate3d(var(--bg-shift-x), var(--bg-shift-y), 0) scale(1.02);
  transition: transform 180ms ease-out;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 82% 14%, rgba(255, 98, 120, 0.15), transparent 34%),
    radial-gradient(circle at 18% 25%, rgba(80, 150, 255, 0.16), transparent 38%);
  z-index: -1;
  pointer-events: none;
}

#app {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 12px 16px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(7, 15, 27, 0.8), rgba(7, 11, 20, 0.9)),
    var(--img-strip-redblue) top center / 100% auto no-repeat,
    var(--img-panel-chain) center / cover no-repeat;
  box-shadow: 0 6px 22px rgba(4, 10, 20, 0.55);
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: var(--img-strip-orange) center / 100% 100% no-repeat;
  opacity: 0.9;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-btn {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid rgba(122, 172, 218, 0.5);
  background:
    linear-gradient(180deg, rgba(15, 27, 45, 0.2), rgba(9, 14, 25, 0.45)),
    var(--img-btn-blue) center / 100% 100% no-repeat;
  color: #dff1ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: filter 120ms ease, transform 120ms ease;
}

.chip-btn[aria-pressed="false"] {
  border-color: rgba(160, 165, 176, 0.5);
  color: #a9b4c8;
  filter: grayscale(0.28) brightness(0.84);
}

.chip-btn:active {
  transform: translateY(1px);
}

.claim-main-btn {
  min-width: 88px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 9px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 52px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: "Teko", sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
  color: #fbeeff;
  text-shadow: 0 0 8px rgba(255, 109, 132, 0.55);
  background:
    linear-gradient(160deg, rgba(21, 34, 58, 0.3), rgba(13, 21, 33, 0.7)),
    var(--img-label-redblue) center / cover no-repeat;
  border: 1px solid rgba(220, 240, 255, 0.18);
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-family: "Teko", sans-serif;
  font-size: 29px;
  line-height: 0.92;
  letter-spacing: 0.5px;
  font-weight: 600;
}

h2,
h3 {
  margin: 0 0 8px;
  font-family: "Teko", sans-serif;
  font-weight: 600;
  letter-spacing: 0.6px;
}

h2 {
  font-size: 30px;
  line-height: 0.95;
}

h3 {
  margin-top: 12px;
  font-size: 24px;
  line-height: 0.95;
}

#gachaModalTitle {
  display: flex;
  align-items: center;
  gap: 8px;
}

#gachaModalTitle::before {
  content: "";
  width: 28px;
  height: 28px;
  background: var(--img-pack-crate) center / contain no-repeat;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

#playerName {
  margin: 0;
  color: #b4c5da;
  font-size: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.stat {
  padding: 7px 6px;
  border: 1px solid rgba(132, 173, 224, 0.28);
  border-radius: 10px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(8, 16, 31, 0.78), rgba(7, 12, 22, 0.9)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.stat span {
  display: block;
  color: #8fa7c3;
  font-size: 11px;
  letter-spacing: 0.3px;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  line-height: 1;
  color: #f4fbff;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.tab-btn {
  min-height: 44px;
  border: 1px solid rgba(126, 180, 230, 0.35);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(13, 22, 39, 0.4), rgba(8, 14, 24, 0.8)),
    var(--img-btn-blue) center / 100% 100% no-repeat;
  color: #d8ecff;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: transform 140ms ease, filter 140ms ease;
}

.tab-btn.is-active {
  color: #fffaf3;
  border-color: rgba(255, 207, 133, 0.56);
  background:
    linear-gradient(180deg, rgba(37, 7, 12, 0.14), rgba(18, 7, 7, 0.32)),
    var(--img-btn-red) center / 100% 100% no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 145, 121, 0.22), 0 0 12px rgba(255, 90, 104, 0.33);
}

.tab-btn:active {
  transform: translateY(1px) scale(0.995);
}

.tab {
  display: none;
}

.tab.is-active {
  display: block;
  animation: tabFade 220ms ease;
}

@keyframes tabFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  position: relative;
  border: 1px solid rgba(88, 163, 201, 0.45);
  border-radius: 14px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(6, 13, 24, 0.8), rgba(5, 10, 18, 0.9)),
    var(--img-panel-chain) center / cover no-repeat;
  box-shadow: 0 10px 32px rgba(5, 9, 16, 0.6);
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 6px;
  background: var(--img-strip-redblue) center / cover no-repeat;
  opacity: 0.75;
  pointer-events: none;
}

.gacha-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.market-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(126, 178, 232, 0.4);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(10, 19, 34, 0.75), rgba(7, 13, 23, 0.92)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.market-item p {
  margin: 2px 0 0;
}

.market-item.wallet-item {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 8px;
}

.wallet-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.ton-connect-slot {
  min-height: 38px;
}

.ton-connect-slot > div {
  width: 100%;
}

#walletAddressText {
  display: block;
  word-break: break-all;
}

.wallet-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0;
}

.wallet-kpi {
  border: 1px solid rgba(121, 177, 231, 0.36);
  border-radius: 10px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(8, 16, 31, 0.84), rgba(7, 12, 21, 0.92)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.wallet-kpi span {
  display: block;
  color: #8fa8c2;
  font-size: 11px;
}

.wallet-kpi strong {
  display: block;
  margin-top: 2px;
  color: #ecf6ff;
  font-size: 16px;
  line-height: 1.1;
}

.wallet-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}

.wallet-action-card {
  border: 1px solid rgba(120, 176, 227, 0.4);
  border-radius: 11px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(9, 17, 30, 0.8), rgba(7, 12, 21, 0.92)),
    var(--img-panel-chain) center / cover no-repeat;
  display: grid;
  gap: 6px;
}

.wallet-action-card p {
  margin: 0;
}

.wallet-quick-row {
  gap: 6px;
}

.wallet-quick-row .btn {
  min-height: 34px;
  flex: 1 1 0;
}

.market-item.market-convert {
  border-color: rgba(255, 183, 124, 0.54);
  background:
    linear-gradient(180deg, rgba(35, 16, 4, 0.34), rgba(18, 11, 4, 0.62)),
    var(--img-btn-orange) center / 100% 100% no-repeat;
}

.market-convert-controls {
  display: grid;
  gap: 5px;
  min-width: 144px;
}

.market-convert-controls label {
  gap: 3px;
  font-size: 11px;
}

.market-convert-controls input {
  padding: 6px 8px;
  font-size: 12px;
}

.market-convert-controls small {
  font-size: 10px;
}

.market-convert-controls .btn {
  min-height: 34px;
  padding: 6px 8px;
}

.gacha-showcase {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 7px;
}

.gacha-showcase-hint {
  margin: 0 0 7px;
  font-size: 10px;
}

.gacha-pack-card {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 70px;
  border: 1px solid rgba(119, 176, 227, 0.38);
  border-radius: 11px;
  padding: 7px 8px;
  color: #edf6ff;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(11, 21, 38, 0.8), rgba(8, 14, 24, 0.9)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
  overflow: hidden;
}

.gacha-pack-card::before {
  content: "";
  position: absolute;
  right: -8px;
  bottom: -10px;
  width: 54px;
  height: 54px;
  background: var(--img-pack-crate) center / contain no-repeat;
  opacity: 0.55;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.gacha-pack-card .gacha-pack-card-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.gacha-pack-card .gacha-pack-card-rate {
  font-size: 10px;
  color: #c3d9f6;
}

.gacha-pack-card .gacha-pack-card-cost {
  font-size: 10px;
  color: #e6f1ff;
}

.gacha-pack-card .gacha-pack-card-open {
  margin-top: 1px;
  font-size: 10px;
  font-weight: 700;
  color: #95ffd0;
}

.gacha-pack-card.is-expensive .gacha-pack-card-open {
  color: #ffc2c2;
}

.gacha-pack-card.pack3,
.gacha-pack-card.pack4 {
  border-color: rgba(255, 206, 132, 0.48);
  background:
    linear-gradient(180deg, rgba(44, 19, 3, 0.45), rgba(18, 11, 3, 0.68)),
    var(--img-btn-orange) center / 100% 100% no-repeat;
}

.gacha-pack-card.pack1,
.gacha-pack-card.pack2 {
  border-color: rgba(122, 184, 236, 0.45);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  border-radius: 10px;
  border: 1px solid rgba(115, 164, 220, 0.42);
  background: rgba(7, 14, 25, 0.82);
  color: var(--text);
  padding: 8px;
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.gacha-pack-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.btn {
  min-height: 42px;
  border: 1px solid rgba(138, 188, 240, 0.36);
  border-radius: 10px;
  padding: 8px 10px;
  color: #eff8ff;
  font-family: "Rajdhani", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background:
    linear-gradient(180deg, rgba(14, 26, 45, 0.2), rgba(8, 14, 23, 0.45)),
    var(--img-btn-blue) center / 100% 100% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(190, 230, 255, 0.06);
  transition: transform 130ms ease, filter 130ms ease;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.btn-accent {
  border-color: rgba(255, 165, 155, 0.42);
  background:
    linear-gradient(180deg, rgba(36, 7, 11, 0.18), rgba(16, 6, 8, 0.34)),
    var(--img-btn-red) center / 100% 100% no-repeat;
}

.pack-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 58px;
  text-align: left;
  line-height: 1.1;
  padding-left: 8px;
  overflow: hidden;
}

.pack-btn::before {
  content: "";
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  background: var(--img-pack-crate) center / contain no-repeat;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.pack-btn::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 205, 138, 0), rgba(255, 205, 138, 0.95), rgba(255, 205, 138, 0));
  opacity: 0.5;
}

.pack-1::before {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55)) hue-rotate(-10deg) saturate(0.95);
}

.pack-2::before {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55)) saturate(1.1);
}

.pack-3::before {
  filter: drop-shadow(0 2px 7px rgba(255, 166, 92, 0.46)) hue-rotate(14deg) saturate(1.2);
}

.pack-4::before {
  filter: drop-shadow(0 2px 8px rgba(255, 205, 124, 0.55)) hue-rotate(22deg) saturate(1.35);
}

.pack-1,
.pack-2 {
  border-color: rgba(135, 176, 228, 0.43);
}

.pack-3,
.pack-4 {
  border-color: rgba(255, 214, 154, 0.5);
  background:
    linear-gradient(180deg, rgba(48, 18, 0, 0.1), rgba(23, 10, 2, 0.3)),
    var(--img-btn-orange) center / 100% 100% no-repeat;
  color: #fff4de;
}

.muted {
  color: var(--muted);
}

.pull-grid,
.hero-grid,
.mission-grid,
.modal-hero-list {
  display: grid;
  gap: 8px;
}

.mission-unlock-wrap {
  margin-bottom: 8px;
}

.mission-unlock-wrap p {
  margin: 0 0 6px;
  font-size: 12px;
}

.mission-unlock-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.mission-unlock-card {
  border: 1px solid rgba(120, 174, 224, 0.4);
  border-radius: 11px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(9, 17, 31, 0.78), rgba(7, 12, 22, 0.9)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
  display: grid;
  gap: 4px;
}

.mission-unlock-card.medium {
  border-color: rgba(126, 191, 239, 0.48);
}

.mission-unlock-card.hard {
  border-color: rgba(255, 192, 136, 0.56);
  background:
    linear-gradient(180deg, rgba(40, 18, 4, 0.35), rgba(20, 11, 4, 0.62)),
    var(--img-btn-orange) center / 100% 100% no-repeat;
}

.pull-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.hero-grid {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.mission-grid {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.mission-hero-roster {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.mission-hero-roster::-webkit-scrollbar {
  height: 6px;
}

.mission-hero-roster::-webkit-scrollbar-track {
  background: rgba(9, 16, 29, 0.42);
  border-radius: 999px;
}

.mission-hero-roster::-webkit-scrollbar-thumb {
  background: rgba(126, 184, 236, 0.42);
  border-radius: 999px;
}

.mission-roster-hint {
  margin: 2px 0 0;
  font-size: 11px;
}

.mission-hero-chip {
  flex: 0 0 156px;
  border: 1px solid rgba(110, 174, 226, 0.35);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(9, 16, 30, 0.82), rgba(7, 13, 24, 0.92)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
  color: #e6f3ff;
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  padding: 6px;
  text-align: left;
  align-items: center;
  scroll-snap-align: start;
}

.mission-hero-chip img,
.mission-hero-fallback {
  width: 44px;
  height: 56px;
  border-radius: 7px;
  object-fit: cover;
  grid-row: span 2;
}

.mission-hero-fallback {
  display: grid;
  place-items: center;
  background: rgba(10, 21, 38, 0.95);
  border: 1px solid rgba(132, 172, 221, 0.34);
  color: #cfe6ff;
  font-weight: 700;
}

.mission-hero-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.mission-hero-state {
  font-size: 11px;
  color: #aac8e6;
}

.mission-hero-chip.is-injured {
  border-color: rgba(255, 145, 153, 0.66);
}

.mission-hero-chip.is-locked {
  border-color: rgba(160, 171, 220, 0.54);
  opacity: 0.82;
}

.mission-hero-chip.is-ready {
  border-color: rgba(122, 212, 180, 0.52);
}

.dispatch-map-wrap {
  margin-bottom: 9px;
  border-radius: 12px;
  border: 1px solid rgba(116, 178, 229, 0.4);
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(6, 12, 21, 0.48), rgba(5, 9, 17, 0.74)),
    var(--img-panel-chain) center / cover no-repeat;
}

.dispatch-map {
  position: relative;
  width: 100%;
  min-height: 248px;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  border: 1px solid rgba(106, 168, 221, 0.35);
  background:
    linear-gradient(180deg, rgba(6, 11, 19, 0.14), rgba(6, 11, 19, 0.6)),
    var(--img-bg-dispatch) center / cover no-repeat;
  overflow: hidden;
}

.dispatch-map::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(130, 170, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 170, 220, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.dispatch-map::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 44%, transparent 22%, rgba(5, 9, 16, 0.52) 100%),
    radial-gradient(circle at 90% 12%, rgba(255, 104, 124, 0.17), transparent 45%);
  pointer-events: none;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #d7e7ff;
  font-weight: 700;
  font-size: 15px;
}

.map-hint {
  margin: 0 0 8px;
  font-size: 12px;
}

.map-marker {
  position: absolute;
  width: 64px;
  height: 70px;
  transform: translate(-50%, -58%);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  transition: transform 150ms ease;
}

.map-marker:active {
  transform: translate(-50%, -58%) scale(0.96);
}

.map-marker-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  transform: translate(-50%, -58%);
  background: var(--img-marker-open) center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 132, 145, 0.6));
  animation: markerPulse 1.45s ease-in-out infinite;
}

.map-marker.marker-running .map-marker-core {
  background-image: var(--img-marker-running);
  filter: drop-shadow(0 0 10px rgba(176, 150, 255, 0.55));
}

.map-marker.marker-claim .map-marker-core {
  background-image: var(--img-marker-claim);
  filter: drop-shadow(0 0 12px rgba(255, 228, 119, 0.72));
}

.map-marker-alert {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -95%);
  color: #fff9df;
  font-family: "Teko", sans-serif;
  font-size: 30px;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 120, 120, 0.95);
  pointer-events: none;
}

.map-marker.marker-running .map-marker-alert {
  color: #ece3ff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(175, 153, 255, 0.9);
}

.map-marker.marker-claim .map-marker-alert {
  color: #fff4c7;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 224, 123, 0.95);
}

.map-marker-label {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -10px);
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid rgba(147, 183, 224, 0.45);
  background: rgba(8, 14, 25, 0.72);
  color: #e9f3ff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  pointer-events: none;
}

.map-marker-sub {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 7px);
  color: #b9d3ee;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

@keyframes markerPulse {
  0% {
    transform: translate(-50%, -58%) scale(0.96);
  }
  55% {
    transform: translate(-50%, -58%) scale(1.02);
  }
  100% {
    transform: translate(-50%, -58%) scale(0.96);
  }
}

.card {
  border: 1px solid rgba(117, 165, 220, 0.31);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 16, 30, 0.84), rgba(7, 12, 22, 0.88)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.card.card-injured {
  border-color: rgba(255, 134, 150, 0.58);
  box-shadow: 0 0 0 1px rgba(255, 134, 150, 0.22), 0 8px 20px rgba(10, 5, 10, 0.45);
}

.card img {
  width: 100%;
  aspect-ratio: 188 / 254;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 8px;
  display: grid;
  gap: 4px;
}

.upgrade-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 4px;
}

.upgrade-select {
  width: 100%;
}

.hero-radar-wrap {
  margin-top: 6px;
  border: 1px solid rgba(115, 172, 219, 0.34);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 35%, rgba(28, 49, 71, 0.88) 0%, rgba(13, 22, 35, 0.9) 72%, rgba(7, 12, 20, 0.95) 100%);
  padding: 6px;
}

.hero-radar-svg {
  width: 100%;
  height: auto;
  display: block;
}

.hero-radar-svg .radar-shell {
  fill: rgba(25, 31, 47, 0.82);
  stroke: #d6e3ff;
  stroke-width: 1.1;
}

.hero-radar-svg .radar-ring {
  fill: none;
  stroke: rgba(177, 193, 223, 0.32);
  stroke-width: 0.8;
}

.hero-radar-svg .radar-axis {
  stroke: rgba(177, 193, 223, 0.26);
  stroke-width: 0.8;
}

.hero-radar-svg .radar-fill {
  fill: rgba(231, 236, 243, 0.45);
  stroke: rgba(250, 252, 255, 0.92);
  stroke-width: 1.15;
}

.hero-radar-svg .radar-node {
  fill: #f3f7ff;
  stroke: rgba(12, 17, 28, 0.7);
  stroke-width: 0.8;
}

.hero-radar-svg .radar-label {
  fill: #adf4e8;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.35px;
}

.hero-radar-svg.is-mini .radar-shell {
  stroke-width: 0.9;
}

.hero-radar-svg.is-mini .radar-fill {
  stroke-width: 0.95;
}

.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(124, 174, 230, 0.46);
  color: #d7ebff;
  width: max-content;
  background: rgba(9, 18, 33, 0.82);
}

.tag.rarity-UR {
  color: #ffd6de;
  border-color: rgba(255, 157, 170, 0.7);
}

.tag.rarity-SSR {
  color: #efd5ff;
  border-color: rgba(188, 148, 248, 0.75);
}

.mission {
  border: 1px solid rgba(113, 170, 220, 0.38);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(8, 15, 28, 0.82), rgba(7, 12, 21, 0.9)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.mission-actions {
  display: flex;
  justify-content: flex-end;
}

.mission-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.pill {
  border: 1px solid rgba(129, 184, 230, 0.46);
  border-radius: 999px;
  font-size: 11px;
  padding: 2px 7px;
  color: #cce2ff;
  background: rgba(8, 16, 31, 0.72);
}

.pill.ok {
  border-color: rgba(90, 222, 172, 0.78);
  color: #9ff8d2;
}

.pill.warn {
  border-color: rgba(255, 160, 166, 0.78);
  color: #ffd1d1;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.78);
  display: grid;
  place-items: end center;
  z-index: 40;
  backdrop-filter: blur(2px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(920px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid rgba(96, 164, 212, 0.48);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(8, 15, 28, 0.86), rgba(7, 12, 22, 0.94)),
    var(--img-panel-chain) center / cover no-repeat;
}

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

.dispatch-modal-card {
  max-height: 92vh;
}

.dispatch-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.dispatch-brief {
  border: 1px solid rgba(121, 176, 223, 0.38);
  border-radius: 12px;
  padding: 10px;
  background: rgba(7, 13, 24, 0.78);
  display: grid;
  gap: 7px;
}

.dispatch-brief-chip {
  width: max-content;
  border-radius: 999px;
  border: 1px solid rgba(129, 185, 234, 0.48);
  color: #d6e9ff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(9, 17, 31, 0.8);
}

.dispatch-client-name {
  font-size: 15px;
  color: #f2f8ff;
}

.dispatch-request-text {
  margin: 0;
  line-height: 1.35;
}

.dispatch-need-list {
  display: grid;
  gap: 5px;
}

.dispatch-need-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  border: 1px solid rgba(112, 169, 218, 0.32);
  border-radius: 8px;
  padding: 5px 7px;
  background: rgba(8, 15, 27, 0.86);
}

.dispatch-need-row span {
  color: #adc8e5;
}

.dispatch-need-row strong {
  color: #f0f7ff;
}

.dispatch-team-pane {
  display: grid;
  gap: 8px;
}

.dispatch-team-pane .modal-hero-list {
  max-height: min(50vh, 420px);
  overflow: auto;
  padding-right: 2px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 140, 140, 0.62);
  border-radius: 9px;
  color: #fff3f4;
  font-size: 14px;
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(26, 9, 13, 0.2), rgba(12, 5, 6, 0.45)),
    var(--img-btn-red) center / 100% 100% no-repeat;
}

.select-hero {
  display: grid;
  grid-template-columns: 22px 40px 64px 1fr;
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(112, 170, 221, 0.34);
  border-radius: 10px;
  padding: 6px;
  background: rgba(7, 13, 24, 0.84);
}

.mission-hero-actions {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn.btn-small {
  font-size: 11px;
  padding: 4px 9px;
  min-height: 28px;
}

.select-hero img {
  width: 40px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
}

.select-hero-radar {
  width: 64px;
  height: 64px;
  border: 1px solid rgba(118, 173, 220, 0.35);
  border-radius: 9px;
  background: radial-gradient(circle at 50% 35%, rgba(28, 49, 71, 0.84) 0%, rgba(12, 20, 32, 0.9) 72%, rgba(8, 13, 21, 0.95) 100%);
  padding: 4px;
}

.meter-wrap {
  margin: 10px 0;
}

.hero-inspect-modal-card {
  max-width: 740px;
}

.hero-inspect-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.hero-inspect-portrait {
  border: 1px solid rgba(114, 171, 220, 0.36);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(7, 13, 24, 0.84);
}

.hero-inspect-portrait img {
  width: 100%;
  display: block;
  aspect-ratio: 188 / 254;
  object-fit: cover;
}

.hero-inspect-main {
  display: grid;
  gap: 8px;
}

.hero-inspect-radar {
  border: 1px solid rgba(114, 169, 216, 0.36);
  border-radius: 12px;
  padding: 8px;
  background: radial-gradient(circle at 50% 35%, rgba(26, 47, 68, 0.9) 0%, rgba(11, 20, 33, 0.95) 74%, rgba(6, 10, 18, 0.96) 100%);
}

.hero-inspect-stats {
  display: grid;
  gap: 5px;
}

.hero-inspect-stat-row {
  display: flex;
  justify-content: space-between;
  border: 1px solid rgba(109, 163, 210, 0.3);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(8, 14, 25, 0.82);
  font-size: 12px;
}

.meter {
  font-family: "Consolas", "Courier New", monospace;
  color: #a9edff;
  background: rgba(6, 12, 22, 0.86);
  border: 1px solid rgba(114, 173, 222, 0.42);
  border-radius: 9px;
  padding: 7px 8px;
}

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 10px;
  border: 1px solid rgba(103, 172, 228, 0.42);
  background: rgba(7, 14, 26, 0.94);
  color: #f2f8ff;
  max-width: min(92vw, 720px);
  padding: 10px 12px;
  z-index: 60;
}

.toast.hidden {
  display: none;
}

.toast.is-show {
  animation: toastIn 240ms ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 72;
  overflow: hidden;
}

.fx-burst {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  opacity: 0.95;
  animation: fxBurst 720ms ease-out forwards;
}

.fx-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: fxFlash 460ms ease-out forwards;
}

.fx-flash.success {
  background: radial-gradient(circle at 50% 55%, rgba(85, 255, 198, 0.2), rgba(20, 80, 62, 0) 56%);
}

.fx-flash.fail {
  background: radial-gradient(circle at 50% 55%, rgba(255, 111, 145, 0.16), rgba(104, 23, 48, 0) 56%);
}

@keyframes fxBurst {
  0% {
    transform: translate3d(0, 0, 0) scale(0.25);
    opacity: 0.9;
  }
  100% {
    transform: translate3d(var(--dx, 0), var(--dy, 0), 0) scale(1.25);
    opacity: 0;
  }
}

@keyframes fxFlash {
  0% {
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(5, 8, 14, 0.88), rgba(4, 7, 13, 0.94)),
    var(--img-bg-home) center / cover no-repeat;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.boot-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-card {
  width: min(420px, 100%);
  border-radius: 14px;
  border: 1px solid rgba(124, 183, 232, 0.44);
  padding: 16px 14px;
  background:
    linear-gradient(180deg, rgba(8, 15, 28, 0.8), rgba(7, 11, 19, 0.92)),
    var(--img-panel-chain) center / cover no-repeat;
  box-shadow: 0 14px 44px rgba(1, 4, 9, 0.72);
}

.boot-logo {
  font-family: "Teko", sans-serif;
  font-size: 44px;
  line-height: 0.85;
  letter-spacing: 1px;
  color: #f5fbff;
  text-shadow: 0 0 14px rgba(111, 186, 255, 0.38);
}

.boot-sub {
  margin-top: 4px;
  font-size: 13px;
  color: #b5c8dd;
  letter-spacing: 0.7px;
}

.boot-bar {
  margin-top: 14px;
  border: 1px solid rgba(105, 169, 220, 0.52);
  border-radius: 999px;
  height: 13px;
  padding: 2px;
  background: rgba(4, 10, 18, 0.66);
}

.boot-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(115, 208, 255, 0.9), rgba(255, 124, 146, 0.9)),
    var(--img-accent-red) center / cover no-repeat;
  transition: width 250ms ease;
}

.boot-status {
  margin: 10px 0 0;
  color: #d9e8f8;
  font-size: 13px;
}

.boot-tip {
  margin: 6px 0 0;
  color: #93a9c4;
  font-size: 11px;
}

.claim-card {
  width: min(580px, 100%);
}

.gacha-modal-card {
  width: min(820px, 100%);
}

.settings-modal-card {
  width: min(520px, 100%);
}

.settings-audio-block {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(122, 183, 233, 0.35);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(10, 18, 32, 0.8), rgba(7, 12, 22, 0.92)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.settings-audio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-audio-top strong {
  font-size: 14px;
}

#musicVolumeRange {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #7dd5ff;
}

#musicVolumeValue {
  font-weight: 700;
}

.gacha-modal-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 10px;
}

.gacha-modal-controls .btn {
  width: 100%;
}

.gacha-reel-wrap {
  position: relative;
  border: 1px solid rgba(113, 171, 221, 0.4);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(9, 17, 31, 0.82), rgba(7, 12, 22, 0.92)),
    var(--img-panel-chain) center / cover no-repeat;
  overflow: hidden;
  padding: 14px 0;
}

.gacha-reel-wrap::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 9px;
  background: var(--img-accent-red) center / 100% 100% no-repeat;
  opacity: 0.7;
}

.gacha-reel-viewport {
  overflow: hidden;
  width: 100%;
}

.gacha-reel-track {
  display: flex;
  gap: 10px;
  padding: 4px 10px;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.gacha-reel-marker {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 232, 140, 0.98), rgba(255, 122, 122, 0.92));
  box-shadow: 0 0 14px rgba(255, 210, 122, 0.88);
  z-index: 2;
}

.gacha-reel-item {
  flex: 0 0 102px;
  border: 1px solid rgba(109, 169, 220, 0.34);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 20, 35, 0.86), rgba(8, 13, 22, 0.9)),
    var(--img-strip-blue) center / 100% 100% no-repeat;
}

.gacha-reel-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.gacha-reel-item .no-image {
  height: 120px;
  display: grid;
  place-items: center;
  color: #daeaff;
  font-weight: 700;
  background: linear-gradient(140deg, #233758, #1b2943);
}

.gacha-reel-item .meta {
  padding: 6px;
  display: grid;
  gap: 3px;
}

.gacha-reel-item .name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  min-height: 28px;
}

.gacha-reel-item .sub {
  font-size: 10px;
  color: #9fb3d8;
}

.gacha-reel-item.is-win {
  border-color: rgba(255, 220, 150, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 223, 140, 0.85), 0 0 18px rgba(255, 198, 107, 0.55);
}

.gacha-spin-result {
  min-height: 24px;
  margin-top: 8px;
  font-weight: 700;
  color: #fff2d3;
}

.claim-card.is-rolling {
  box-shadow: 0 0 0 1px rgba(148, 178, 235, 0.28), 0 12px 34px rgba(25, 36, 62, 0.5);
}

.claim-board-wrap {
  margin: 12px 0 8px;
  border: 1px solid rgba(112, 171, 222, 0.39);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 18%, rgba(37, 56, 80, 0.8) 0%, rgba(14, 24, 37, 0.87) 62%, rgba(9, 14, 21, 0.94) 100%);
  padding: 8px;
}

.claim-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(13, 18, 31, 0.92), rgba(10, 14, 24, 0.95));
}

.claim-legend {
  margin-top: 6px;
  color: #b8c8dd;
  font-size: 11px;
}

.claim-verdict {
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.claim-verdict.success {
  color: var(--ok);
}

.claim-verdict.fail {
  color: #ffc5c5;
}

.claim-card .buttons {
  justify-content: flex-end;
  margin-top: 12px;
}

/* Farmerton-style mobile shell */
#app {
  max-width: 396px;
  min-height: 100dvh;
  padding: 8px 8px calc(90px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 6px;
  z-index: 12;
  margin-bottom: 6px;
  padding: 8px 8px;
  backdrop-filter: blur(6px);
}

.content {
  display: block;
  padding-bottom: 6px;
}

.stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.stat {
  min-height: 50px;
  padding: 6px 5px;
}

.hero-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tabs {
  position: fixed;
  left: 50%;
  bottom: calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(412px, calc(100vw - 10px));
  margin: 0;
  padding: 5px;
  gap: 5px;
  border-radius: 14px;
  border: 1px solid rgba(105, 165, 215, 0.45);
  background:
    linear-gradient(180deg, rgba(7, 14, 24, 0.88), rgba(5, 10, 17, 0.94)),
    var(--img-panel-chain) center / cover no-repeat;
  box-shadow: 0 12px 34px rgba(2, 6, 12, 0.72);
  z-index: 38;
}

.tab-btn {
  position: relative;
  min-height: 44px;
  padding-top: 13px;
  font-size: 11px;
  border-radius: 10px;
}

.tab-btn::before {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Teko", sans-serif;
  font-size: 12px;
  line-height: 1;
  opacity: 0.9;
}

.tab-btn[data-tab="gacha"]::before {
  content: "MK";
}

.tab-btn[data-tab="wallet"]::before {
  content: "W";
}

.tab-btn[data-tab="heroes"]::before {
  content: "H";
}

.tab-btn[data-tab="missions"]::before {
  content: "M";
}

.tab-btn.is-active {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 98, 116, 0.26);
}

.panel {
  border-radius: 12px;
  padding: 8px;
}

.gacha-pack-buttons {
  grid-template-columns: 1fr;
}

.brand {
  gap: 8px;
}

.logo {
  width: 42px;
  height: 30px;
  font-size: 20px;
}

h1 {
  font-size: 22px;
  white-space: nowrap;
}

h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

h3 {
  font-size: 15px;
  margin-top: 8px;
}

#playerName {
  font-size: 10px;
}

.chip-btn {
  min-height: 24px;
  padding: 0 7px;
  font-size: 9px;
}

.claim-main-btn {
  min-width: 70px;
  min-height: 26px;
  padding: 3px 8px;
  font-size: 10px;
}

.stat span {
  font-size: 10px;
}

.stat strong {
  font-size: 16px;
}

.card img {
  aspect-ratio: 188 / 254;
}

.card-body {
  padding: 6px;
  gap: 3px;
}

.card-body strong {
  font-size: 13px;
  line-height: 1.1;
}

.card-body small,
.tag,
.pill {
  font-size: 10px;
}

.hero-radar-wrap {
  margin-top: 4px;
  padding: 4px;
}

.hero-grid .card {
  max-width: 182px;
  margin: 0 auto;
}

.mission {
  padding: 8px;
  gap: 4px;
}

.mission small {
  font-size: 10px;
}

@media (min-width: 640px) {
  #app {
    max-width: 396px;
  }

  .market-item.wallet-item {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .wallet-controls {
    min-width: 180px;
  }

  .gacha-controls {
    grid-template-columns: 128px 1fr;
  }

  .wallet-actions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gacha-pack-buttons {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mission-hero-chip {
    flex-basis: 166px;
  }

  .mission-unlock-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .upgrade-row {
    grid-template-columns: 1fr auto;
  }

  .gacha-modal-controls {
    flex-direction: row;
    align-items: end;
  }

  .gacha-modal-controls label {
    min-width: 128px;
  }

  .gacha-modal-controls .btn {
    width: auto;
    min-width: 190px;
  }

  .gacha-reel-item {
    flex-basis: 116px;
  }

  .gacha-reel-item img,
  .gacha-reel-item .no-image {
    height: 132px;
  }

  .select-hero {
    grid-template-columns: 28px 44px 78px 1fr;
    gap: 8px;
  }

  .select-hero img {
    width: 44px;
    height: 58px;
  }

  .select-hero-radar {
    width: 78px;
    height: 78px;
  }

  .modal-card {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
  }

  .dispatch-modal-layout {
    grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
    align-items: start;
  }

  .hero-inspect-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: start;
  }
}

@media (max-width: 420px) {
  #app {
    max-width: 100%;
    padding: 7px 6px calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    top: 4px;
    padding: 7px 7px;
  }

  .logo {
    width: 38px;
    height: 28px;
    font-size: 18px;
  }

  h1 {
    font-size: 20px;
  }

  .stat strong {
    font-size: 15px;
  }

  .btn {
    font-size: 11px;
    padding: 6px 6px;
  }

  .gacha-showcase {
    gap: 5px;
  }

  .market-item {
    grid-template-columns: 1fr;
  }

  .market-convert-controls {
    min-width: 0;
  }

  .gacha-pack-card {
    min-height: 64px;
    padding: 6px 7px;
  }

  .gacha-pack-card .gacha-pack-card-title {
    font-size: 11px;
  }

  .gacha-pack-card .gacha-pack-card-rate,
  .gacha-pack-card .gacha-pack-card-cost,
  .gacha-pack-card .gacha-pack-card-open {
    font-size: 9px;
  }

  .top-actions {
    gap: 4px;
  }

  .chip-btn {
    min-height: 23px;
    font-size: 9px;
    padding: 0 6px;
  }

  .claim-main-btn {
    min-width: 66px;
    min-height: 25px;
  }

  .tabs {
    width: calc(100vw - 8px);
    bottom: calc(4px + env(safe-area-inset-bottom));
    padding: 4px;
    gap: 4px;
  }

  .tab-btn {
    min-height: 41px;
    padding-top: 12px;
    font-size: 10px;
  }

  .tab-btn::before {
    top: 2px;
    font-size: 11px;
  }

  .hero-grid {
    gap: 5px;
  }

  .mission-hero-chip {
    flex-basis: 146px;
  }

  .hero-grid .card {
    max-width: 170px;
  }

  .wallet-kpi strong {
    font-size: 14px;
  }

  .dispatch-map {
    min-height: 218px;
  }

  .mission-unlock-wrap p,
  .mission-unlock-card small,
  .mission-unlock-card strong {
    font-size: 10px;
  }

  .map-marker {
    width: 56px;
    height: 62px;
  }

  .map-marker-core {
    width: 46px;
    height: 46px;
  }

  .map-marker-alert {
    font-size: 26px;
  }

  .map-marker-sub {
    font-size: 9px;
  }
}
