:root {
  --app-height: 100svh;
  --ink: #2d2450;
  --ink-soft: rgba(45, 36, 80, 0.72);
  --accent: #7d6dff;
  --accent-soft: #d7cdfa;
  --card-line: rgba(102, 85, 176, 0.12);
  --card-shadow: 0 24px 50px rgba(104, 86, 168, 0.14);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 14%, rgba(164, 145, 255, 0.2), transparent 22%),
    radial-gradient(circle at 88% 86%, rgba(193, 180, 255, 0.22), transparent 24%),
    linear-gradient(180deg, #faf8ff 0%, #f0eaff 52%, #ece5fe 100%);
  color: var(--ink);
  font-family: 'Oswald', sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body { overflow-x: hidden; }

.page {
  width: 100%;
  max-width: 480px;
  min-height: var(--app-height);
  margin: 0 auto;
  padding: 46px 18px 28px;
  position: relative;
}

html.tg-mobile .page {
  padding-top: 46px;
}

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 18px 18px;
  background: linear-gradient(180deg, rgba(250, 248, 255, 0.96) 0%, rgba(250, 248, 255, 0.86) 72%, rgba(250, 248, 255, 0) 100%);
  backdrop-filter: blur(10px);
}

.topbar-menu {
  width: 24px;
  display: grid;
  gap: 5px;
  flex: 0 0 auto;
}

.topbar-menu span {
  display: block;
  height: 1.5px;
  border-radius: 999px;
  background: rgba(62, 47, 114, 0.8);
}

.topbar-menu span:nth-child(1) { width: 18px; }
.topbar-menu span:nth-child(2) { width: 24px; }
.topbar-menu span:nth-child(3) { width: 14px; }

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  letter-spacing: 0.28em;
  white-space: nowrap;
}

.topbar-brand-metta {
  color: rgba(49, 37, 88, 0.9);
}

.topbar-brand-divider {
  width: 1px;
  height: 22px;
  background: rgba(92, 73, 163, 0.18);
}

.topbar-brand-school {
  color: var(--accent);
}


.cards {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.mag-card {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--card-line);
  background: linear-gradient(180deg, rgba(255,255,255,0.86) 0%, rgba(249,246,255,0.94) 100%);
  box-shadow: var(--card-shadow);
  text-decoration: none;
  color: inherit;
}

.mag-card-thumb {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 8px;
}

.mag-card-thumb::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 18px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 20%,
    rgba(0, 0, 0, 0.14) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.mag-card-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
}


.mag-card-overlay {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 106px;
  padding: 0;
}

.mag-card-overlay h2 {
  margin: 0;
  min-height: 34px;
  font-family: 'Oswald', sans-serif;
  font-size: clamp(22px, 5.9vw, 34px);
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.96);
  text-transform: uppercase;
  text-shadow: 0 10px 22px rgba(23, 17, 49, 0.42);
}

.mag-card-overlay p {
  margin: 8px 0 0;
  max-width: 88%;
  min-height: 26px;
  font-size: 10px;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 8px 18px rgba(23, 17, 49, 0.34);
}

.accent-line {
  width: 38px;
  height: 2px;
  margin: 10px 0 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b78ff, rgba(255, 255, 255, 0.68));
  flex: 0 0 auto;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.98);
  text-shadow: 0 8px 18px rgba(23, 17, 49, 0.34);
}

.card-link strong {
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
}

@media (max-width: 390px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 14px 16px;
  }

  .topbar-brand {
    gap: 10px;
    font-size: 18px;
    letter-spacing: 0.22em;
  }

  .topbar-brand-divider {
    height: 18px;
  }

  .cards {
    gap: 10px;
    margin-top: 6px;
  }

  .mag-card-overlay {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .mag-card-overlay h2 {
    font-size: clamp(28px, 7.8vw, 44px);
  }

  .card-link {
    font-size: 12px;
  }
}

@media (min-width: 768px) {
  .page {
    max-width: 980px;
    padding: 26px 24px 40px;
  }

  .hero {
    min-height: 720px;
  }

  .hero-figure {
    left: 40px;
    top: 42px;
    width: 360px;
  }

  .cards {
    max-width: 680px;
    margin: -20px auto 0;
  }
}
