*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b1f3b 0, #050716 55%, #02030a 100%);
  color: #f5f7ff;
}

body.cosmos {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* adaptive center layout */
.layout-center {
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* cosmic card */
.card {
  background: rgba(12, 18, 46, 0.92);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
}

.card-main {
  width: 100%;
}

.card-section {
  margin-bottom: 16px;
}

.card-section:last-child {
  margin-bottom: 0;
}

.title-xl {
  font-size: 26px;
  margin: 0 0 8px;
}

.title-lg {
  font-size: 20px;
  margin: 0 0 6px;
}

.title-md {
  font-size: 16px;
  margin: 0 0 4px;
}

.text-muted {
  color: #9ca3c7;
}

.text-small {
  font-size: 13px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff;
  box-shadow: 0 10px 25px rgba(99,102,241,0.45);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(99,102,241,0.6);
}

.btn-secondary {
  background: rgba(15,23,42,0.9);
  color: #e5e7ff;
  border: 1px solid rgba(148, 163, 255, 0.35);
}

.btn-secondary:hover {
  background: rgba(24, 35, 69, 0.95);
}

.btn-ghost {
  background: transparent;
  border: 1px dashed rgba(148, 163, 255, 0.5);
  color: #c7d2ff;
}

.btn-ghost:hover {
  background: rgba(15,23,42,0.75);
}

.btn-chip {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(248,250,252,0.06);
  color: #e5e7ff;
}

/* layout helpers */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  margin-top: 12px;
}

.mt-md { margin-top: 12px; }
.mt-lg { margin-top: 18px; }

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-pill {
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(248,250,252,0.04);
  color: #c7d2ff;
}

/* progress ring and bars (simplified) */
.progress-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(#4ade80 var(--p, 0%), rgba(30,64,175,0.5) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.progress-ring::after {
  content: attr(data-label);
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #020617, #020617);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #e5e7ff;
}

.progress-bar {
  width: 100%;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  height: 8px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #a855f7);
  transition: width .25s ease-out;
}

/* mission / quest cards */
.mission-card,
.quest-card {
  position: relative;
  border-radius: 14px;
  padding: 12px 12px 10px;
  margin-bottom: 8px;
  background: radial-gradient(circle at top left, rgba(56,189,248,0.17), rgba(15,23,42,0.96));
  border: 1px solid rgba(148,163,255,0.3);
}

.quest-card {
  background: radial-gradient(circle at top left, rgba(244,114,182,0.25), rgba(15,23,42,0.96));
}

.mission-title,
.quest-title {
  font-size: 14px;
  margin: 0 0 4px;
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: #a5b4fc;
}

/* lock overlay */
.locked::after {
  content: "🔒 Квесты откроются после миссий";
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #e5e7ff;
  border-radius: inherit;
}

/* bottom nav */
.bottom-nav {
  position: sticky;
  bottom: -16px;
  margin: 16px -16px -16px;
  padding: 10px 14px 14px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  background: linear-gradient(to top, rgba(15,23,42,0.98), rgba(15,23,42,0.4));
  backdrop-filter: blur(12px);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid rgba(148,163,255,0.35);
}

.bottom-nav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 11px;
  color: #c7d2ff;
  padding: 6px 4px 4px;
  border-radius: 999px;
}

.bottom-nav a.active {
  background: rgba(15,23,42,0.95);
  border: 1px solid rgba(94, 234, 212, 0.6);
}

/* cards layout for inner pages */
.page-wrapper {
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  max-width: 960px;
}

.page-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .card {
    padding: 16px;
  }
  .title-xl {
    font-size: 22px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
