:root {
  --app-bg: linear-gradient(180deg, #0b1220 0%, #0f1a2e 100%);
  --shell-bg: linear-gradient(180deg, #0f1728 0%, #121d31 100%);
  --card-bg: linear-gradient(180deg, #131f34 0%, #1b2a45 100%);

  --text-main: #f3f7ff;
  --text-muted: #9aaccc;
  --text-soft: #dbe6ff;

  --line: rgba(255,255,255,0.06);
  --line-strong: rgba(255,255,255,0.08);

  --app-width: 420px;
  --body-padding: 20px;
  --body-padding-mobile: 10px;
  --page-padding: 16px;
  --page-padding-mobile: 14px;

  --radius-shell: 30px;
  --radius-shell-mobile: 24px;
  --radius-card: 30px;
  --radius-block: 20px;
  --radius-control: 14px;
  --radius-nav: 24px;

  --bottom-nav-height: 86px;
  --bottom-nav-height-mobile: 88px;

  --transition: 220ms ease;
  --transition-fast: 180ms ease;

  --shadow-shell:
    0 16px 40px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);

  --shadow-card:
    0 8px 20px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--app-bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--app-bg);
  background-attachment: fixed;
  color: #eaf1ff;
  display: flex;
  justify-content: center;
  padding: var(--body-padding);
}

.app-shell {
  position: relative;
  width: var(--app-width);
  max-width: 100%;
  height: calc(100dvh - 40px);
  min-height: calc(100dvh - 40px);
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: var(--radius-shell);
  background: var(--shell-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-shell);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

@supports not (height: 100dvh) {
  body {
    min-height: 100vh;
  }

  .app-shell {
    height: calc(100vh - 40px);
    min-height: calc(100vh - 40px);
  }

  @media (max-width: 420px) {
    .app-shell {
      height: calc(100vh - 20px);
      min-height: calc(100vh - 20px);
    }
  }
}

.app-shell::-webkit-scrollbar {
  display: none;
}

.page {
  min-height: 100%;
  padding: var(--page-padding);
  position: relative;
  z-index: 1;
}

.topbar {
  position: relative;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  min-height: 66px;
  margin-bottom: 16px;
  padding: 12px 14px;

  border-radius: 22px;
  background: var(--shell-bg);
  border: 1px solid var(--line);
  border-bottom: 1px solid rgba(255,255,255,0.05);

  box-shadow:
    0 10px 26px rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

.topbar-text {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.page-title {
  margin: 0;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.3;
}

.topbar-balance {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;

  min-height: 38px;
  padding: 8px 11px;
  border-radius: 16px;

  background:
    linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.055) 100%);
  border: 1px solid rgba(255,255,255,0.11);

  color: var(--text-main);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;

  box-shadow:
    0 8px 18px rgba(0,0,0,0.20),
    inset 0 1px 0 rgba(255,255,255,0.08);

  transition:
    transform var(--transition-fast),
    filter var(--transition-fast),
    border-color var(--transition-fast);
}

.topbar-balance:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  border-color: rgba(255,255,255,0.16);
}

.balance-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #f5b726;
  filter: drop-shadow(0 0 8px rgba(245,183,38,0.28));
}

.balance-value {
  letter-spacing: 0.1px;
}

.backdrop,
.sidebar,
.topbar-burger {
  display: none !important;
}

.profile-container {
  width: 100%;
  background: var(--shell-bg);
  border-radius: var(--radius-card);
  padding: var(--page-padding);
  border: 1px solid rgba(245,183,38,0.12);
  box-shadow: var(--shadow-shell);
}

.header,
.level-block,
details {
  background: var(--card-bg);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-card);
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  backdrop-filter: blur(10px);
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text-main);
}

.username {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 2px;
  line-height: 1.2;
}

.lives {
  width: 108px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.heart {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
  filter: drop-shadow(0 3px 4px rgba(166, 0, 47, 0.28));
  animation: heartFloat 2.6s ease-in-out infinite;
}

.heart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.heart:nth-child(2) {
  animation-delay: 0.15s;
}

.heart:nth-child(3) {
  animation-delay: 0.3s;
}

.level-block {
  position: relative;
  margin-top: 14px;
  border-radius: var(--radius-block);
  padding: 22px 20px 18px;
  text-align: center;
  overflow: hidden;
  color: white;
}

.level-block::before,
.level-block::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-block);
  pointer-events: none;
  z-index: 0;
}

.level-block::before {
  background:
    radial-gradient(circle at 50% 10%, rgba(255,255,255,0.08), transparent 30%),
    radial-gradient(circle at 50% 85%, rgba(80,170,255,0.08), transparent 36%);
}

.level-block::after {
  box-shadow:
    inset 0 0 40px rgba(0,0,0,0.20),
    inset 0 -10px 20px rgba(0,0,0,0.14);
}

.level-block .stars {
  animation: twinkle 4.6s ease-in-out infinite alternate;
}

.level-block .stars::before {
  opacity: 0.16;
  animation: twinkle 6.2s ease-in-out infinite alternate;
}

.level-block .stars::after {
  opacity: 0.10;
  animation: twinkle 5.2s ease-in-out infinite alternate;
}

.badge-wrap {
  width: 88px;
  height: 88px;
  margin: 6px auto 0;
  position: relative;
  z-index: 2;
  animation: badgeFloat 5.8s ease-in-out infinite;
  filter:
    drop-shadow(0 0 8px rgba(255,255,255,0.04))
    drop-shadow(0 0 16px rgba(103,255,137,0.18))
    drop-shadow(0 0 24px rgba(85,255,130,0.10));
}

.badge-wrap::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(94,255,145,0.26) 0%,
      rgba(94,255,145,0.12) 42%,
      rgba(94,255,145,0.03) 64%,
      transparent 76%);
  filter: blur(10px);
  z-index: 0;
  animation: badgePulse 4.8s ease-in-out infinite;
}

.badge-wrap::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.18), transparent 26%),
    radial-gradient(circle at 50% 50%, rgba(51,255,145,0.10), transparent 60%);
  filter: blur(2px);
  pointer-events: none;
  z-index: 6;
}

.lv-badge {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 50%;
  z-index: 1;
  animation: badgeEntrance 0.9s ease;
  overflow: hidden;
}

.lvl-icon {
  position: absolute;
  left: 50%;
  top: 65%;
  width: 112%;
  height: 112%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  display: block;
  filter:
    drop-shadow(0 4px 10px rgba(0,0,0,0.4))
    drop-shadow(0 0 10px rgba(255,255,255,0.15));
}

.level-title {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 700;
  animation: fadeUp 0.8s ease;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 1px rgba(0,0,0,0.18);
}

.progress-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.xp-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #eaf6ff;
  background: radial-gradient(circle at 30% 30%, #5fd0ff, #1e9bff 70%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 0 6px rgba(47,167,255,0.35);
  backdrop-filter: blur(2px);
  flex-shrink: 0;
}

.progress {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.22);
}

.progress-fill {
  width: 70%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2fa7ff 0%, #37c5ff 48%, #00deff 100%);
  box-shadow:
    0 0 12px rgba(47,167,255,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

.percent {
  background: rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 4px 8px;
  font-size: 12px;
  color: white;
  backdrop-filter: blur(4px);
  border: 1px solid var(--line);
}

.xp-text {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.82);
  position: relative;
  z-index: 2;
}

details {
  margin-top: 14px;
  border-radius: 18px;
  padding: 10px;
}

summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  color: var(--text-main);
}

summary::-webkit-details-marker {
  display: none;
}

.list {
  margin-top: 10px;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 6px;
  color: var(--text-soft);
}

.left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #223251;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 4px 10px rgba(0,0,0,0.18);
}

.done {
  color: #58d68d;
}

.lock {
  color: #8a98b8;
}

.current {
  background: rgba(64, 98, 156, 0.22);
  border-radius: 12px;
  border: 1px solid rgba(120,160,255,0.12);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: var(--app-width);
  max-width: calc(100% - 40px);
  height: var(--bottom-nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 12px 14px;
  background: linear-gradient(180deg, rgba(15, 23, 40, 0.88) 0%, rgba(10, 17, 30, 0.98) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-nav);
  box-shadow:
    0 20px 40px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(14px);
}

.bottom-nav-item {
  width: 20%;
  min-width: 0;
  min-height: 66px;
  color: #7f8a9b;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-block);
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  transform: translateZ(0);
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.bottom-nav-item:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.04);
  transform: translateY(-1px);
}

.bottom-nav-item.active {
  color: #f5b726;
  background:
    radial-gradient(circle at 50% 20%, rgba(245,183,38,0.18), transparent 58%),
    rgba(245,183,38,0.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 18px rgba(245,183,38,0.10);
  transform: translateY(-3px);
}

.bottom-nav-item:active {
  transform: scale(0.94);
}

.bottom-nav-item.active:active {
  transform: translateY(-3px) scale(0.94);
}

.bottom-nav-icon,
.bottom-nav-icon svg {
  width: 26px;
  height: 26px;
}

.bottom-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: scale(1.08);
}

.bottom-nav-label {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.bottom-nav-more-backdrop {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(0,0,0,0.36);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

body.more-open .bottom-nav-more-backdrop {
  opacity: 1;
  visibility: visible;
}

.bottom-nav-more-sheet {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%) translateY(18px);
  width: var(--app-width);
  max-width: calc(100% - 40px);
  z-index: 106;
  padding: 14px;
  border-radius: var(--radius-nav);
  background: linear-gradient(180deg, rgba(15, 23, 40, 0.98) 0%, rgba(10, 17, 30, 0.99) 100%);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    0 18px 42px rgba(0,0,0,0.48),
    inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--transition),
    visibility var(--transition),
    transform var(--transition);
}

body.more-open .bottom-nav-more-sheet {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.more-sheet-title {
  padding: 4px 6px 12px;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 800;
}

.more-sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.more-sheet-item {
  min-height: 58px;
  padding: 12px;
  border-radius: 16px;
  color: var(--text-soft);
  text-decoration: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  transition:
    background var(--transition),
    color var(--transition),
    transform var(--transition);
}

.more-sheet-item:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

.more-sheet-item.active {
  color: #f5b726;
  background: rgba(245,183,38,0.10);
  border-color: rgba(245,183,38,0.22);
}

.more-sheet-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.more-sheet-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}

.app-shell.has-bottom-nav .page {
  padding-bottom: 118px;
}

@keyframes heartFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-2px) scale(1.04);
  }
}

@keyframes twinkle {
  from {
    opacity: 0.18;
  }

  to {
    opacity: 0.58;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes badgeEntrance {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes badgeFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.02);
  }
}

@keyframes badgePulse {
  0%, 100% {
    opacity: 0.42;
    transform: scale(1);
  }

  50% {
    opacity: 0.88;
    transform: scale(1.08);
  }
}

@media (max-width: 420px) {
  body {
    padding: var(--body-padding-mobile);
  }

  .app-shell {
    width: 100%;
    height: calc(100dvh - 20px);
    min-height: calc(100dvh - 20px);
    border-radius: var(--radius-shell-mobile);
  }

  .page {
    padding: var(--page-padding-mobile);
  }

  .topbar {
    min-height: 62px;
    margin-bottom: 14px;
    padding: 11px 12px;
    border-radius: 20px;
  }

  .page-title {
    font-size: 23px;
  }

  .profile-container {
    border-radius: var(--radius-shell-mobile);
  }

  .topbar-balance {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 13px;
    border-radius: 14px;
  }

  .balance-icon {
    width: 17px;
    height: 17px;
  }

  .bottom-nav {
    bottom: 10px;
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    height: var(--bottom-nav-height-mobile);
  }

  .bottom-nav-item {
    min-height: 68px;
  }

  .bottom-nav-icon,
  .bottom-nav-icon svg {
    width: 27px;
    height: 27px;
  }

  .bottom-nav-label {
    font-size: 11.5px;
  }

  .bottom-nav-more-sheet {
    bottom: 98px;
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
  }
}

.app-shell.has-bottom-nav .page {
  padding-bottom: 118px;
}

@media (min-width: 768px) {
  :root {
    --app-width: 720px;
    --page-padding: 20px;
  }

  body {
    padding: 24px;
  }

  .app-shell {
    height: calc(100dvh - 48px);
    min-height: calc(100dvh - 48px);
  }

  .bottom-nav,
  .bottom-nav-more-sheet {
    width: var(--app-width);
    max-width: calc(100% - 48px);
  }
}

@media (min-width: 1200px) {
  :root {
    --app-width: 1040px;
    --page-padding: 24px;
  }

  .app-shell {
    border-radius: 34px;
  }

  .page-title {
    font-size: 28px;
  }

  .bottom-nav,
  .bottom-nav-more-sheet {
    width: 720px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}