:root
{
  --portal-bg: var(--color-background);
  --surface: var(--color-surface-dark);
  --surface-hover: var(--color-background);
  --line: var(--color-mint-soft);
  --line-strong: var(--color-cyan-50);
  --text: var(--color-white);
  --muted: var(--color-silver-muted);
  --accent: var(--color-cyan);
  --gold: var(--color-gold);
  --content-width: 1080px;
}

*
{
  box-sizing: border-box;
}

html, body
{
  min-width: 320px;
}

html
{
  background: var(--color-background);
  scrollbar-gutter: stable;
}

body
{
  margin: 0;
  color: var(--color-white);
  background: radial-gradient( circle at 48% -8%, var(--color-mint-soft), transparent 34rem ), linear-gradient(155deg, var(--color-background) 0%, var(--color-background) 52%, var(--palette-2ce5d87145) 100%);
}

button, a
{
  -webkit-tap-highlight-color: transparent;
}

.portal-shell
{
  min-height: 100svh;
}

.mission-toast
{
  position: fixed;
  z-index: 2100;
  right: 24px;
  bottom: 24px;
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 260px;
  padding: 14px 18px;
  border: 1px solid var(--color-cyan-50);
  color: var(--color-white);
  background: linear-gradient(135deg, var(--color-background), var(--color-background));
  box-shadow: 0 0 30px var(--color-mint-soft), 0 18px 50px var(--color-overlay-dark-20);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.mission-toast[hidden]
{
  display: none;
}

.mission-toast.is-visible
{
  opacity: 1;
  transform: translateY(0);
}

.mission-toast > span
{
  color: var(--color-cyan);
  font-size: 27px;
}

.mission-toast div
{
  display: grid;
  gap: 3px;
}

.mission-toast small
{
  color: var(--color-cyan-pale);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.mission-toast strong
{
  font: 600 19px/1.1 "Cormorant Garamond",serif;
}

@media (max-width: 560px)
{
  .mission-toast
  {
    right: 12px;
    bottom: 12px;
    left: 12px;
    min-width: 0;
  }

}

/* Header */
.portal-header
{
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - var(--content-width)) / 2));
  border-bottom: 1px solid var(--color-mint-soft);
  background: var(--color-surface-dark);
  backdrop-filter: blur(18px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.brand
{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--color-white);
  text-decoration: none;
}

.brand-mark
{
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--color-cyan-50);
  border-radius: 50%;
  color: var(--color-cyan);
  font: 600 25px/1 "Cormorant Garamond", "Times New Roman", serif;
  box-shadow: inset 0 0 22px var(--color-mint-soft);
}

.brand-name
{
  font: 400 21px/1 "Cinzel Decorative", "Cormorant Garamond", "Times New Roman", serif;
  letter-spacing: -0.055em;
}

.header-link
{
  color: var(--color-cyan-pale);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms ease;
}

.header-link:hover
{
  color: var(--color-white);
}

.header-actions
{
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name
{
  max-width: 240px;
  overflow: hidden;
  color: var(--color-cyan-pale);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toggle
{
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 11px;
  place-content: center;
  gap: 5px;
  border: 1px solid var(--color-mint-soft);
  border-radius: 13px;
  color: var(--color-white);
  background: var(--color-white-50);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.menu-toggle__mission-dot
{
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--palette-7c29b22ba9);
  border-radius: 50%;
  background: var(--color-cyan);
  box-shadow: 0 0 7px var(--color-cyan), 0 0 16px var(--color-cyan-50);
  animation: mission-signal 1.8s ease-in-out infinite;
}

.menu-toggle__mission-dot[hidden]
{
  display:none;
}

.menu-toggle:hover, .menu-toggle[aria-expanded="true"]
{
  border-color: var(--color-cyan-50);
  background: var(--color-mint-soft);
}

.menu-toggle:active
{
  transform: scale(0.97);
}

.menu-toggle span
{
  display: block;
  width: 19px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1)
{
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2)
{
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3)
{
  transform: translateY(-6.5px) rotate(-45deg);
}

.account-menu
{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(320px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--color-cyan-50);
  border-radius: 16px;
  background: var(--color-background);
  box-shadow: 0 22px 60px var(--color-overlay-dark-20);
  backdrop-filter: blur(20px);
}

.account-menu:not([hidden])
{
  animation: menu-in 150ms ease-out;
}

.account-menu__user
{
  display: grid;
  gap: 5px;
  padding: 18px;
  border-bottom: 1px solid var(--color-mint-soft);
}

.account-menu__label
{
  color: var(--color-cyan-pale);
  font-size: 12px;
}

.account-menu__user strong
{
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button
{
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
  border: 0;
  color: var(--color-white);
  background: transparent;
  font: 500 14px/1 "Inter", sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease;
}

.logout-button:hover
{
  background: var(--color-white-50);
}

.logout-button svg
{
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

/* Main content */
.portal-main
{
  width: min(var(--content-width), calc(100% - 48px));
  margin-inline: auto;
  padding: clamp(54px, 7vh, 78px) 0 64px;
}

.hero
{
  max-width: 680px;
  margin-bottom: 44px;
}

.hero-kicker
{
  margin: 0 0 10px;
  color: var(--color-cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.hero h1
{
  margin: 0;
  font: 500 clamp(38px, 4.4vw, 52px)/1 "Cormorant Garamond", serif;
  letter-spacing: 0.01em;
}

.page-heading-kicker
{
  margin: 0 0 10px;
  color: var(--color-cyan);
  font: 700 12px/1.25 Inter, sans-serif;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.hero-description
{
  margin: 20px 0 0;
  color: var(--color-cyan-pale);
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.55;
}

/* Cards */
.direction-grid
{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.direction-card
{
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 160px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--color-mint-soft);
  border-radius: 20px;
  color: var(--color-white);
  background: linear-gradient(145deg, var(--color-cyan-05), transparent 46%), var(--color-surface-dark);
  box-shadow: inset 0 1px 0 var(--color-white-50);
  text-decoration: none;
  transition: border-color 200ms ease, transform 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.direction-card::after
{
  position: absolute;
  right: -90px;
  bottom: -110px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: var(--color-cyan-05);
  filter: blur(12px);
  content: "";
}

.direction-card:hover
{
  border-color: var(--color-cyan-50);
  background: linear-gradient(145deg, var(--color-mint-soft), transparent 48%), var(--color-forest);
  box-shadow: inset 0 1px 0 var(--color-white-50), 0 16px 42px var(--color-overlay-dark-20);
  transform: translateY(-4px);
}

.direction-card__heading
{
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 15px;
  padding-right: 44px;
}

.direction-card__heading h2
{
  margin: 0;
  font: 600 clamp(28px, 2.5vw, 36px)/1.02 "Cormorant Garamond", serif;
  letter-spacing: -0.025em;
}

.direction-card__number
{
  position: absolute;
  top: 23px;
  right: 24px;
  color: var(--color-white-50);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.direction-card__icon
{
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--color-mint-soft);
  border-radius: 14px;
  color: var(--color-cyan);
  background: var(--palette-d33d859679);
}

.direction-card__icon svg
{
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.35;
}

.direction-card__content
{
  position: relative;
  z-index: 1;
  align-self: end;
  margin: 0;
  padding: 16px 0 0;
}

.direction-card p
{
  max-width: 360px;
  margin: 0;
  color: var(--color-cyan-pale);
  font-size: 14px;
  line-height: 1.55;
}

@keyframes menu-in
{
  from
  {
    opacity: 0;
    transform: translateY(-6px);
  }

  to
  {
    opacity: 1;
    transform: translateY(0);
  }

}

/* Responsive */
@media (max-width: 760px)
{
  .portal-header
  {
    min-height: 68px;
    padding: 12px 18px;
  }

  .brand-mark
  {
    width: 36px;
    height: 36px;
    font-size: 23px;
  }

  .brand-name
  {
    font-size: 19px;
  }

  .user-name
  {
    display: none;
  }

  .menu-toggle
  {
    width: 42px;
    height: 42px;
  }

  .portal-main
  {
    width: min(100% - 28px, 560px);
    padding: 44px 0 48px;
  }

  .hero
  {
    margin-bottom: 34px;
  }

  .hero h1
  {
    font-size: clamp(36px, 11vw, 48px);
  }

  .hero-description
  {
    font-size: 16px;
  }

  .direction-grid
  {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .direction-card
  {
    min-height: 150px;
    padding: 21px;
    border-radius: 18px;
  }

  .direction-card__heading
  {
    gap: 13px;
    padding-right: 42px;
  }

  .direction-card__heading h2
  {
    font-size: 32px;
  }

  .direction-card__content
  {
    padding: 18px 0 0;
  }

  .direction-card__number
  {
    top: 20px;
    right: 21px;
  }

}

@media (max-width: 420px)
{
  .brand-name
  {
    font-size: 18px;
  }

  .portal-main
  {
    padding-top: 36px;
  }

  .hero-kicker
  {
    letter-spacing: 0.14em;
  }

  .direction-card
  {
    min-height: 145px;
    padding: 18px;
  }

  .direction-card__icon
  {
    width: 44px;
    height: 44px;
  }

  .direction-card__heading h2
  {
    font-size: 28px;
  }

  .direction-card__content
  {
    padding-top: 16px;
  }

}

@media (prefers-reduced-motion: reduce)
{
  *, *::before, *::after
  {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

}

/* Locked card for guests */
.direction-card--locked
{
  cursor: not-allowed;
  opacity: 0.62;
  user-select: none;
}

.direction-card--locked:hover, .direction-card--locked:focus-visible
{
  border-color: var(--color-mint-soft);
  background: linear-gradient(145deg, var(--color-cyan-05), transparent 46%), var(--color-surface-dark);
  box-shadow: inset 0 1px 0 var(--color-white-50);
  transform: none;
  outline: none;
}

.direction-card--locked:focus-visible
{
  border-color: var(--color-cyan-50);
  box-shadow: 0 0 0 3px var(--color-mint-soft);
}

.direction-card__lock
{
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--color-gold-40);
  border-radius: 50%;
  color: var(--color-cyan);
  background: var(--color-border-soft);
}

.direction-card__lock svg
{
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.direction-card__locked-label
{
  position: absolute;
  right: 28px;
  bottom: 27px;
  z-index: 2;
  color: var(--color-white-50);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.direction-card__tooltip
{
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 30;
  width: max-content;
  max-width: min(330px, calc(100vw - 36px));
  padding: 10px 13px;
  border: 1px solid var(--color-cyan-50);
  border-radius: 11px;
  color: var(--color-white);
  background: var(--color-background);
  box-shadow: 0 12px 34px var(--color-overlay-dark-20);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.direction-card__tooltip::after
{
  position: absolute;
  top: 100%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-right: 1px solid var(--color-cyan-50);
  border-bottom: 1px solid var(--color-cyan-50);
  background: var(--color-background);
  content: "";
  transform: translate(-50%, -4px) rotate(45deg);
}

.direction-card--locked:hover .direction-card__tooltip, .direction-card--locked:focus-visible .direction-card__tooltip
{
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}

@media (max-width: 760px)
{
  .direction-card__locked-label
  {
    right: 22px;
    bottom: 22px;
  }

  .direction-card__tooltip
  {
    bottom: auto;
    top: calc(100% + 10px);
  }

  .direction-card__tooltip::after
  {
    top: auto;
    bottom: 100%;
    border: 0;
    border-top: 1px solid var(--color-cyan-50);
    border-left: 1px solid var(--color-cyan-50);
    transform: translate(-50%, 4px) rotate(45deg);
  }

}

/* Locked "Самопознание" card: allow the tooltip to leave the card bounds. */
.direction-card--locked
{
  overflow: visible;
  cursor: default;
  z-index: 5;
}

.direction-card--locked::after
{
  display: none;
}

.direction-card--locked .direction-card__lock
{
  position: absolute;
  top: 28px;
  right: 0px;
  z-index: 4;
}

.direction-card--locked:hover, .direction-card--locked:focus-visible
{
  z-index: 20;
}

@media (max-width: 760px)
{
  .direction-card--locked .direction-card__lock
  {
    top: 22px;
    right: 22px;
  }

}

/* Shared navigation */
.header-back
{
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--color-cyan-pale);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.header-back:hover
{
  color: var(--color-white);
  border-color: var(--color-mint-soft);
  background: var(--color-white-50);
}

.header-back svg
{
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu__nav
{
  padding: 8px;
  border-bottom: 1px solid var(--color-mint-soft);
}

.account-menu__link--settings
{
  margin-top:8px;
  border-top:1px solid var(--color-mint-soft);
}

.account-menu__link
{
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 10px;
  color: var(--color-white);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 160ms ease;
}

.account-menu__link:hover
{
  background: var(--color-white-50);
}

.account-menu__link--new
{
  color:var(--color-cyan-pale);
  background:var(--palette-ef57820e56);
  box-shadow:inset 0 0 18px var(--color-cyan-05);
}

.account-menu__badge
{
  min-width:21px;
  height:21px;
  margin-left:auto;
  padding:0 6px;
  border:1px solid var(--color-cyan-50);
  border-radius:999px;
  color:var(--color-cyan);
  background:var(--color-mint-soft);
  font:700 10px/19px Inter,sans-serif;
  text-align:center;
  box-shadow:0 0 12px var(--color-mint-soft);
}

.account-menu__badge[hidden]
{
  display:none;
}

.account-menu__link svg
{
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mission-new-notice
{
  position:relative;
  display:grid;
  grid-template-columns:28px 1fr;
  gap:9px;
  align-items:center;
  max-width:290px;
  min-height:44px;
  padding:8px 13px;
  border:1px solid var(--color-cyan-50);
  color:var(--color-white);
  background:linear-gradient(135deg,var(--color-background),var(--color-background));
  box-shadow:0 0 22px var(--color-mint-soft);
  text-decoration:none;
  opacity:0;
  transform:translateX(8px);
  transition:opacity 180ms ease,transform 180ms ease,border-color 160ms ease;
}

.mission-new-notice.is-visible
{
  opacity:1;
  transform:translateY(0);
}

.mission-new-notice:hover
{
  border-color:var(--color-cyan);
}

.mission-new-notice > span
{
  color:var(--color-cyan);
  font-size:21px;
  text-align:center;
  animation:mission-signal 1.8s ease-in-out infinite;
}

.mission-new-notice div
{
  display:grid;
  gap:3px;
}

.mission-new-notice small
{
  color:var(--color-cyan-pale);
  font:700 9px/1 Inter,sans-serif;
  letter-spacing:.18em;
  text-transform:uppercase;
}

.mission-new-notice strong
{
  font:600 16px/1.1 "Cormorant Garamond",serif;
  white-space:nowrap;
}

@keyframes mission-signal
{
  0%,100%
  {
    opacity:.72;
    filter:brightness(.9)
  }

  50%
  {
    opacity:1;
    filter:brightness(1.35)
  }

}

@media (max-width:700px)
{
  .mission-new-notice
  {
    width:44px;
    min-height:44px;
    padding:0;
    place-items:center;
    grid-template-columns:1fr
  }

  .mission-new-notice div
  {
    display:none
  }

  .mission-new-notice>span
  {
    font-size:22px
  }

}

@media (prefers-reduced-motion:reduce)
{
  .menu-toggle__mission-dot,.mission-new-notice>span
  {
    animation:none
  }

}

@media (max-width: 560px)
{
  .header-back span
  {
    display: none;
  }

  .header-back
  {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .brand-name
  {
    display: none;
  }

}
