:root {
  --bg: #060914;
  --bg-2: #0b1228;
  --card: rgba(9, 16, 34, 0.8);
  --card-2: rgba(12, 22, 45, 0.92);
  --text: #edf7ff;
  --hint: #89a2c5;
  --line: rgba(95, 176, 255, 0.28);
  --line-soft: rgba(95, 176, 255, 0.16);
  --cyan: #41e9ff;
  --pink: #ff4ee1;
  --button: linear-gradient(135deg, #2ca3ff, #41e9ff);
  --button-text: #06101f;
  --good: #2cffbf;
  --bad: #ff6b9e;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(800px 420px at 7% -5%, rgba(65, 233, 255, 0.18), transparent 60%),
    radial-gradient(860px 470px at 100% 0%, rgba(255, 78, 225, 0.2), transparent 65%),
    radial-gradient(760px 700px at 50% 110%, rgba(16, 78, 169, 0.18), transparent 60%),
    linear-gradient(180deg, #050812 0%, #060914 45%, #0a1023 100%);
  font-family: "Space Grotesk", ui-sans-serif, system-ui;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.topbar {
  padding: 14px 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(7, 13, 29, 0.95), rgba(7, 13, 29, 0.72));
  backdrop-filter: blur(12px);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

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

.brand__mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background:
    radial-gradient(22px 18px at 28% 25%, rgba(255, 255, 255, 0.9), transparent 65%),
    linear-gradient(140deg, rgba(255, 216, 94, 0.95), rgba(65, 233, 255, 0.95));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    0 0 22px rgba(65, 233, 255, 0.48),
    0 8px 20px rgba(0, 0, 0, 0.5);
}

.brand__name {
  font-family: "Instrument Serif", serif;
  font-size: 26px;
  line-height: 0.95;
  letter-spacing: 0.3px;
}

.brand__tag {
  margin-top: 4px;
  font-size: 12px;
  color: var(--hint);
}

.fuel {
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid rgba(65, 233, 255, 0.34);
  border-radius: 16px;
  background: rgba(5, 13, 28, 0.72);
  box-shadow:
    inset 0 0 26px rgba(65, 233, 255, 0.07),
    0 0 18px rgba(65, 233, 255, 0.15);
}

.fuel__label {
  font-size: 11px;
  color: var(--hint);
}

.fuel__value {
  font-size: 20px;
  font-weight: 700;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 14px 10px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(13, 24, 49, 0.92), rgba(10, 18, 37, 0.88)),
    radial-gradient(500px 120px at -20% 0%, rgba(65, 233, 255, 0.12), transparent 55%),
    radial-gradient(440px 120px at 130% 0%, rgba(255, 78, 225, 0.12), transparent 65%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.nav__btn {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 11px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.nav__btn[aria-current="page"] {
  border-color: rgba(65, 233, 255, 0.7);
  background:
    linear-gradient(135deg, rgba(65, 233, 255, 0.16), rgba(255, 78, 225, 0.15));
  box-shadow:
    inset 0 0 20px rgba(65, 233, 255, 0.13),
    0 0 18px rgba(65, 233, 255, 0.22);
}

.main {
  padding: 0 0 14px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0 14px 0 14px;
  display: none;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  animation: pop 220ms ease-out;
}

.view::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.main[data-active="profile"] .view[data-view="profile"] { display: flex; }
.main[data-active="feed"] .view[data-view="feed"] { display: flex; }
.main[data-active="battle"] .view[data-view="battle"] { display: flex; }
.main[data-active="squad"] .view[data-view="squad"] { display: flex; }
.main[data-active="top"] .view[data-view="top"] { display: flex; }

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

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(17, 29, 57, 0.85), rgba(9, 16, 34, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 0 1px rgba(65, 233, 255, 0.08),
    var(--shadow);
  padding: 12px;
}

.row {
  display: flex;
  align-items: center;
}

.title {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 15px;
  font-weight: 700;
}

.muted {
  color: var(--hint);
  font-size: 12px;
}

.btn {
  border: 0;
  background: var(--button);
  color: var(--button-text);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 100ms ease, filter 100ms ease;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.stats {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(7, 13, 28, 0.6);
  padding: 10px;
}

.stat__label {
  color: var(--hint);
  font-size: 11px;
}

.stat__value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
}

.settings-list {
  margin-top: 10px;
}

.settings-refresh {
  margin-top: 10px;
  width: 100%;
}

.profile-actions {
  display: grid;
  gap: 8px;
}

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

@media (min-width: 520px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.gift {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: rgba(7, 13, 28, 0.72);
}

.gift img,
.gift .tgs-media {
  display: block;
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.tgs-media {
  position: relative;
  overflow: hidden;
}

.tgs-media > img,
.tgs-media > canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.gift .gift__meta {
  padding: 8px;
  font-size: 11px;
  color: var(--hint);
  line-height: 1.2;
}

.stage {
  display: grid;
  gap: 12px;
}

.card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(7, 13, 28, 0.78);
  overflow: hidden;
  box-shadow: var(--shadow);
  will-change: transform, opacity;
  transition: transform 140ms ease, opacity 140ms ease;
  cursor: pointer;
  touch-action: pan-y;
}

.card__imgwrap {
  display: grid;
  place-items: center;
  padding: 12px 0 10px;
  position: relative;
  background:
    radial-gradient(420px 240px at 20% 10%, rgba(65, 233, 255, 0.08), transparent 60%),
    radial-gradient(420px 240px at 80% 90%, rgba(255, 78, 225, 0.08), transparent 60%),
    #060d21;
}

.card__img {
  width: min(88%, 540px);
  display: block;
  aspect-ratio: 1/1;
  object-fit: cover;
  image-rendering: auto;
  padding: 0;
  border-radius: 20px;
  border: 1px solid var(--line-soft);
}

.card__img.tgs-media > img,
.card__img.tgs-media > canvas {
  object-fit: cover;
}

.chip {
  position: absolute;
  right: 10px;
  top: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(4, 10, 24, 0.78);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.card__meta {
  padding: 8px 12px 12px;
  font-size: 16px;
  color: #e8f6ff;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 46px;
}

.card__headline {
  font-size: 16px;
  font-weight: 700;
  color: #e8f6ff;
  letter-spacing: 0.2px;
}

.swipe-hint {
  position: absolute;
  top: 20px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 120ms linear, transform 120ms ease;
  pointer-events: none;
}

.swipe-hint--good {
  right: 20px;
  border: 1px solid rgba(44, 255, 191, 0.52);
  color: #bffff1;
  background: rgba(11, 46, 39, 0.6);
}

.swipe-hint--bad {
  left: 20px;
  border: 1px solid rgba(255, 107, 158, 0.55);
  color: #ffd4e3;
  background: rgba(58, 24, 38, 0.62);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pill {
  border: 0;
  border-radius: 16px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

.pill--good {
  background: rgba(44, 255, 191, 0.16);
  color: #bffff1;
  border: 1px solid rgba(44, 255, 191, 0.4);
}

.pill--bad {
  background: rgba(255, 107, 158, 0.16);
  color: #ffd4e3;
  border: 1px solid rgba(255, 107, 158, 0.38);
}

.empty {
  text-align: center;
  color: var(--hint);
  padding: 18px 12px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pair__card {
  position: relative;
  padding: 0;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(7, 13, 28, 0.75);
  overflow: hidden;
  cursor: pointer;
  will-change: transform, opacity;
  transition: transform 140ms ease, opacity 140ms ease;
}

.pair__passport {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(65, 233, 255, 0.55);
  background: rgba(6, 15, 32, 0.82);
  color: #9feeff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.pair__card img,
.pair__card .tgs-media {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: contain;
  display: block;
  padding: 10px;
  background:
    radial-gradient(280px 140px at 20% 10%, rgba(65, 233, 255, 0.08), transparent 60%),
    radial-gradient(280px 140px at 80% 90%, rgba(255, 78, 225, 0.08), transparent 60%),
    #060d21;
}

.pair__card .tgs-media > img,
.pair__card .tgs-media > canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pair__meta {
  padding: 10px 10px 12px;
  font-size: 12px;
  color: var(--hint);
  display: grid;
  gap: 5px;
}

.pair__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pair__line span {
  color: var(--hint);
}

.pair__line b {
  color: #dff4ff;
  font-weight: 700;
  text-align: right;
}

.pair__number {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: #74e7ff;
  letter-spacing: 0.3px;
  text-align: right;
}

.pair__card:active {
  transform: scale(0.99);
}

.champ__img {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.champ__img.tgs-media > img,
.champ__img.tgs-media > canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.list__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line-soft);
  background: rgba(7, 13, 28, 0.58);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(4, 10, 24, 0.85);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  max-width: min(520px, calc(100vw - 24px));
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 16, 0.72);
  backdrop-filter: blur(2px);
}

.modal__panel {
  position: relative;
  margin: 16px;
  max-height: calc(100dvh - 32px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 24, 49, 0.98), rgba(10, 18, 37, 0.98));
  overflow: auto;
  box-shadow: var(--shadow);
}

.modal__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 15, 33, 0.94);
}

.modal__title {
  font-size: 16px;
  font-weight: 700;
}

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

.modal__icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
}

.modal__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.modal__image {
  width: 100%;
  display: block;
  aspect-ratio: 1/1;
  object-fit: contain;
  padding: 12px;
}

.modal__image.tgs-media > img,
.modal__image.tgs-media > canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal__hero {
  position: relative;
  background:
    radial-gradient(480px 240px at 18% 5%, rgba(65, 233, 255, 0.16), transparent 60%),
    radial-gradient(480px 240px at 82% 92%, rgba(255, 78, 225, 0.16), transparent 60%),
    #07112a;
}

.modal__heroText {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  display: grid;
  gap: 4px;
  text-align: center;
}

.modal__giftTitle {
  font-size: 28px;
  font-family: "Instrument Serif", serif;
  line-height: 1.05;
  color: #eaf7ff;
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.modal__giftSub {
  font-size: 14px;
  color: #93daff;
  letter-spacing: 0.3px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.58);
}

.modal__table {
  display: grid;
  grid-template-columns: 120px 1fr;
  border-top: 1px solid var(--line-soft);
}

.modal__cell {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.modal__cell--name {
  color: var(--hint);
  border-right: 1px solid var(--line-soft);
}
