/* styles/mode-select.css — split from styles.css (structural only) */

/* mode-select: без сдвига shell — иначе оголяется app-bg под орбитой/подложкой */
.app-shell[data-stage="mode-select"].stage-enter[data-transition-direction="forward"],
.app-shell[data-stage="mode-select"].stage-enter[data-transition-direction="back"] {
  transform: none;
}

.app-shell[data-stage="mode-select"].stage-leave[data-transition-direction="forward"].stage-leave-active,
.app-shell[data-stage="mode-select"].stage-leave[data-transition-direction="back"].stage-leave-active {
  transform: none;
}

/*
  mode-select brand: ворон pinned к центру top-bar (left:50%),
  надписи в равных зонах слева/справа — не зависят от длины текста.
*/
.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand {
  --raven-w: clamp(140px, 14vw, 200px);
  --raven-h: clamp(88px, 9vw, 124px);
  --brand-gap: clamp(2px, 0.5vw, 8px);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  /* иначе наследует grid-column:2 из .top-bar-brand и центрируется в правой колонке */
  grid-column: 1 / -1;
  justify-self: stretch;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-raven {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--raven-w);
  height: var(--raven-h);
  margin: 0;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  /* только ширина текста — иначе ::before/sparks тянутся на полшапки */
  width: max-content;
  max-width: min(36vw, 340px);
  min-width: 0;
  padding: 10px 12px 16px;
  box-sizing: border-box;
  overflow: visible;
  contain: none;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:first-child {
  left: auto;
  right: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  justify-items: end;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:last-of-type {
  left: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  right: auto;
  justify-items: start;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-app-title,
.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title {
  max-width: 100%;
  font-size: clamp(1.48rem, 2.7vw, 2.65rem);
  white-space: nowrap;
  overflow: visible;
  animation: modeTitleLevitate 5.8s ease-in-out infinite;
  text-shadow:
    0 0 10px rgba(210, 180, 255, 0.55),
    0 0 22px rgba(150, 210, 255, 0.4),
    0 0 36px rgba(174, 132, 255, 0.32),
    0 6px 18px rgba(8, 6, 24, 0.45);
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-wrap .top-bar-app-title {
  text-align: right;
  justify-self: end;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-wrap .top-bar-path-title {
  text-align: left;
  justify-self: start;
  grid-area: 1 / 1;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title.is-path-out {
  position: absolute;
  left: 12px;
  top: 10px;
  margin: 0;
  pointer-events: none;
  animation: topBarPathTitleOut 520ms cubic-bezier(0.22, 0.08, 0.28, 1) both;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title.is-path-in {
  pointer-events: none;
  animation: topBarPathTitleIn 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes topBarPathTitleOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

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

/* пятно строго под текстом (wrap = max-content) */
.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-wrap::before {
  left: 6%;
  right: 6%;
  bottom: 4px;
  height: 28px;
  filter: blur(14px);
  opacity: 0.78;
  pointer-events: none;
}

.app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-sparks {
  position: absolute;
  inset: auto 4% 2px 4%;
  height: 34px;
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}

/* Desktop: omen/controls по краям поверх бренда */
@media (min-width: 761px) {
  .app-shell[data-stage="mode-select"] {
    position: relative;
    --raven-w: clamp(168px, 17vw, 240px);
    --raven-h: clamp(104px, 11vw, 150px);
    /* тексты шапки почти вплотную к ворону */
    --brand-gap: clamp(2px, 0.45vw, 6px);
    /* узкий резерв ≈ ширина «Чертог Ворона» в display-шрифте (~7.2em) */
    --brand-title-reserve: calc(clamp(1.48rem, 2.7vw, 2.65rem) * 7.2);
    --menu-side-pad: clamp(14px, 2.2vw, 32px);
    --menu-omen-gap: 6px;
  }

  .app-shell[data-stage="mode-select"] .top-bar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(8px, 1.4vw, 18px);
    min-height: clamp(120px, 15vw, 168px);
    padding-left: var(--menu-side-pad);
    padding-right: var(--menu-side-pad);
  }

  .app-shell[data-stage="mode-select"] .top-bar > .top-bar-brand {
    --raven-w: inherit;
    --raven-h: inherit;
    --brand-gap: inherit;
    grid-column: 1 / -1;
    justify-self: stretch;
    padding: 0;
    z-index: 40;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap {
    max-width: min(36vw, 340px);
    padding: 8px 4px 14px;
  }

  /* Footer: children участвуют в shell; disclaimer — вниз */
  .app-shell[data-stage="mode-select"] > .mode-select-controls-footer {
    display: contents;
  }

  /* Desktop: omen-row прозрачен — шепот слева, controls справа как раньше */
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row {
    display: contents;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls {
    position: absolute;
    top: 0;
    right: var(--menu-side-pad);
    z-index: 36;
    display: flex;
    align-items: center;
    gap: 0;
    height: clamp(120px, 15vw, 168px);
    margin: 0;
    pointer-events: auto;
  }

  /* Desktop: счётчик как шёпот — слот в раскладке, виден только по hover/focus */
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls .profile-crystals-badge {
    opacity: 0;
    transform: translateY(3px);
    transition:
      opacity 560ms cubic-bezier(0.22, 0.61, 0.36, 1),
      transform 560ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  /* reveal через JS (is-hover-revealed) — не :hover, иначе sticky после drag */
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls.is-hover-revealed:not(.is-hover-suppressed) .profile-crystals-badge,
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls:focus-within:not(.is-hover-suppressed) .profile-crystals-badge {
    opacity: 1;
    transform: translateY(0);
  }

  .app-shell[data-stage="mode-select"] > .mode-select-controls-footer > .app-disclaimer {
    width: 100%;
    margin-top: auto;
  }

  /* Шепот: слот left→right до названия всегда; текст только fade по hover */
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: absolute;
    top: 0;
    left: var(--menu-side-pad);
    right: calc(
      50% + (var(--raven-w) / 2) + var(--brand-gap) + var(--brand-title-reserve) + var(--menu-omen-gap)
    );
    z-index: 34;
    box-sizing: border-box;
    width: auto;
    max-width: none;
    min-width: 0;
    height: clamp(120px, 15vw, 168px);
    margin: 0;
    padding: 2px 4px 3px 0;
    text-align: left;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    opacity: 1;
    pointer-events: auto;
    overflow: visible;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell::before {
    content: none !important;
    display: none !important;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .mode-predictions-text {
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .mode-predictions-label {
    font-size: clamp(0.52rem, 0.82vw, 0.6rem);
    margin-bottom: 1px;
    line-height: 1.2;
    text-align: left;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .menu-omen {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
    font-size: clamp(0.66rem, 1.05vw, 0.8rem);
    line-height: 1.32;
    text-align: left;
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .omen-day-artifact {
    flex: 0 0 clamp(86px, 8.2vw, 106px);
    width: clamp(86px, 8.2vw, 106px);
    height: clamp(86px, 8.2vw, 106px);
    max-width: clamp(86px, 8.2vw, 106px);
    max-height: clamp(86px, 8.2vw, 106px);
    align-self: center;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .app-shell[data-stage="mode-select"] {
    --brand-gap: 2px;
    --brand-title-reserve: calc(clamp(1.32rem, 2.45vw, 2.15rem) * 7.2);
    --menu-omen-gap: 4px;
  }

  .app-shell[data-stage="mode-select"] .top-bar {
    column-gap: 10px;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .omen-day-artifact {
    flex: 0 0 clamp(82px, 7.8vw, 100px);
    width: clamp(82px, 7.8vw, 100px);
    height: clamp(82px, 7.8vw, 100px);
    max-width: clamp(82px, 7.8vw, 100px);
    max-height: clamp(82px, 7.8vw, 100px);
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-app-title,
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title {
    font-size: clamp(1.32rem, 2.45vw, 2.15rem);
  }
}

/* Mobile: один скролл (html), body без своего overflow */
@media (max-width: 760px) {
  html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  #app {
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .app-bg,
  .noise {
    position: fixed !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  .app-shell[data-stage="mode-select"] {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    left: 0;
    transform: none !important;
    overflow: visible;
    min-height: 0;
  }

  .app-shell[data-stage="mode-select"] > .mode-screen-orbit,
  .app-shell[data-stage="mode-select"] > .mode-screen-underlay {
    position: fixed !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    transform: none !important;
    contain: none !important;
    pointer-events: none !important;
  }

  .app-shell[data-stage="mode-select"] > .mode-screen {
    width: 100%;
    max-width: 100%;
    margin: 0;
    left: 0;
    overflow: visible;
  }

  .app-shell[data-stage="mode-select"] .mode-screen-content {
    margin: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 12px;
    padding-right: 12px;
    box-sizing: border-box;
    transform: none !important;
  }

  .app-shell[data-stage="mode-select"] > .top-bar {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: calc(4px + env(safe-area-inset-top, 0px) + 112px);
    margin: 0;
    padding: calc(4px + env(safe-area-inset-top, 0px)) 0 0;
    box-sizing: border-box;
    overflow: visible;
  }

  /*
    Mobile brand: ворон по центру; надписи в зонах слева/справа
    (крупный кегль + перенос; glow не клипается)
  */
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand {
    --raven-w: clamp(110px, 30vw, 148px);
    --raven-h: clamp(72px, 19vw, 96px);
    --brand-gap: clamp(2px, 0.8vw, 6px);
    --brand-side: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    display: block;
    z-index: 30;
    overflow: visible;
    background: transparent;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-raven {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--raven-w);
    height: var(--raven-h);
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap,
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:first-child,
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:last-of-type {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    min-width: 0;
    max-width: none;
    padding: 6px 2px 14px;
    box-sizing: border-box;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
    /* visible — иначе ::before/text-shadow обрезаются */
    overflow: visible;
  }

  /* мягкая подсветка/искры — без «молочной пластины» на всю шапку */
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-wrap::before {
    content: "" !important;
    display: block !important;
    left: 4%;
    right: 4%;
    bottom: 0;
    height: 28px;
    filter: blur(12px);
    opacity: 0.7;
    visibility: visible !important;
    background:
      radial-gradient(ellipse 70% 90% at 50% 55%, rgba(188, 148, 255, 0.36), rgba(188, 148, 255, 0) 72%),
      radial-gradient(circle at 50% 50%, rgba(132, 209, 255, 0.28), rgba(132, 209, 255, 0) 68%);
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-title-sparks {
    display: block !important;
    visibility: visible !important;
    opacity: 0.85 !important;
    position: absolute;
    inset: auto 4% -2px 4%;
    height: 32px;
    overflow: visible;
    z-index: 2;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:first-child {
    left: var(--brand-side);
    right: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
    justify-items: end;
    justify-self: auto;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand > .top-bar-title-wrap:last-of-type {
    left: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
    right: var(--brand-side);
    justify-items: start;
    justify-self: auto;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-app-title,
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title {
    font-size: clamp(1.08rem, 4.8vw, 1.65rem);
    line-height: 1.08;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    overflow: visible;
    text-overflow: clip;
    background: transparent !important;
    text-shadow:
      0 0 10px rgba(210, 180, 255, 0.55),
      0 0 20px rgba(150, 210, 255, 0.38),
      0 0 32px rgba(174, 132, 255, 0.28),
      0 4px 12px rgba(8, 6, 24, 0.45);
  }

  /* Mobile: шепот + кристалл профиля в одном ряду, по центру ширины */
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2.5vw, 14px);
    box-sizing: border-box;
    width: min(100%, 560px);
    max-width: 100%;
    margin: 0 auto 2px;
    padding: 0 clamp(10px, 3vw, 16px);
    position: relative;
    z-index: 5;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    align-self: center;
    gap: 8px;
    box-sizing: border-box;
    position: relative;
    top: auto;
    left: auto;
    z-index: 5;
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 0;
    text-align: left;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    opacity: 1;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell::before {
    content: none !important;
    display: none !important;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .mode-predictions-text {
    align-items: flex-start;
    flex: 1 1 auto;
    min-width: 0;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .mode-predictions-label,
  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .menu-omen {
    text-align: left;
    width: 100%;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .mode-predictions-frame--shell .omen-day-artifact {
    --omen-figure-size: clamp(82px, 8vw, 100px);
    flex: 0 0 var(--omen-figure-size);
    width: var(--omen-figure-size);
    height: var(--omen-figure-size);
    min-width: var(--omen-figure-size);
    min-height: var(--omen-figure-size);
    max-width: var(--omen-figure-size);
    max-height: var(--omen-figure-size);
    aspect-ratio: 1;
    align-self: center;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: auto;
    margin: 0;
    gap: 0;
    position: relative;
    top: auto;
    right: auto;
    height: auto;
    min-height: 0;
    pointer-events: auto;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls .profile-crystals-badge {
    font-size: clamp(1.25rem, 3.4vw, 1.7rem);
    margin-right: -14px;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-omen-row > .controls .profile-crystal-button {
    --omen-figure-size: clamp(86px, 8.2vw, 106px);
    width: var(--omen-figure-size);
    height: var(--omen-figure-size);
    min-width: var(--omen-figure-size);
    min-height: var(--omen-figure-size);
    margin: 0;
    align-self: center;
  }

  .app-shell[data-stage="mode-select"] > .mode-select-controls-footer {
    display: flex;
    flex-direction: column;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 14px 8px max(16px, env(safe-area-inset-bottom, 0px) + 10px);
    overflow: visible;
    pointer-events: auto;
    position: relative;
    z-index: 30;
  }
}

.app-shell[data-stage="mode-select"] > .app-disclaimer {
  margin-top: auto;
  width: 100%;
  align-self: center;
  padding-top: 32px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 0px) + 14px);
}

:where(.app-button, .mode-card)::before,
:where(.app-button, .mode-card)::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.app-shell[data-stage="mode-select"] {
  /* shell прозрачный — виден сетчатый app-bg; без вуали-затемнения */
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: transparent;
  isolation: isolate;
  overflow-x: clip;
  overflow-y: visible;
  max-width: 100%;
  min-height: 100vh;
  /* will-change ломал fixed-слои на mobile Safari */
}

/* blur на enter делает fixed относительным — на mode-select только opacity */
.app-shell[data-stage="mode-select"].stage-enter,
.app-shell[data-stage="mode-select"].stage-leave-active {
  filter: none;
}

.app-shell[data-stage="mode-select"].stage-enter .mode-screen,
.app-shell[data-stage="mode-select"].stage-enter-active .mode-screen {
  opacity: 1;
  transform: none;
  filter: none;
  transition: none;
}

/* drift-фон фигур — на весь viewport (child shell) */
.app-shell[data-stage="mode-select"] > .mode-screen-orbit {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  z-index: 0;
  overflow: hidden;
  opacity: 0.58;
  filter: none;
  pointer-events: none;
}

/* тёмная вуаль над drift, под контентом — строго на весь viewport */
.app-shell[data-stage="mode-select"] > .mode-screen-underlay {
  display: block;
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 75% 70% at 50% 44%,
      rgba(8, 10, 24, 0.04) 0%,
      rgba(4, 5, 14, 0.26) 55%,
      rgba(2, 2, 8, 0.52) 100%
    ),
    linear-gradient(
      180deg,
      rgba(6, 8, 18, 0.24),
      rgba(8, 10, 22, 0.34) 45%,
      rgba(6, 8, 20, 0.44)
    );
}

.app-shell[data-stage="mode-select"] > .top-bar,
.app-shell[data-stage="mode-select"] > .top-bar-empty {
  position: relative;
  z-index: 30;
  overflow: visible;
}

.app-shell[data-stage="mode-select"] > .mode-screen {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  /* visible: иначе ореол первого ряда режется «шапкой»; клип не на shell */
  overflow: visible;
  margin-top: 0;
  padding-bottom: 2px;
}

.app-shell[data-stage="mode-select"] .mode-screen-content {
  /* запас сверху под blur/scale ореола (~inset -12 + blur) */
  padding: 22px 14px 8px;
}

.mode-screen {
  position: relative;
  overflow: visible;
  display: block;
  gap: 0;
}

.mode-screen-orbit-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.mode-screen-content {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  overflow: visible;
  padding: 10px 14px 28px;
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.mode-screen-title-wrap {
  position: relative;
  display: inline-grid;
  justify-items: start;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding: 6px 0 2px 6px;
  margin: -6px 0 -2px -6px;
}

.mode-screen-title-wrap::before {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -6px;
  height: 22px;
  pointer-events: none;
  background:
    radial-gradient(circle at 38% 48%, rgba(174, 132, 255, 0.28), rgba(174, 132, 255, 0) 62%),
    radial-gradient(circle at 62% 44%, rgba(132, 209, 255, 0.22), rgba(132, 209, 255, 0) 66%);
  filter: blur(12px);
  opacity: 0.62;
  animation: modeTitleGlowPulse 2.8s ease-in-out infinite;
}

.mode-title-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.mode-title-spark {
  --x: 50%;
  --delay: 0ms;
  --dur: 3600ms;
  position: absolute;
  left: var(--x);
  top: 72%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(235, 229, 255, 0.74);
  box-shadow: 0 0 7px rgba(181, 224, 255, 0.42);
  opacity: 0;
  animation: modeTitleSparkFall var(--dur) ease-out var(--delay) infinite;
}

.mode-screen-title {
  margin: 0;
  position: relative;
  z-index: 1;
  letter-spacing: 0.04em;
  color: rgba(241, 232, 255, 0.95);
  text-shadow:
    0 0 18px rgba(155, 116, 238, 0.3),
    0 0 34px rgba(124, 198, 255, 0.2);
  animation: modeTitleLevitate 5.6s ease-in-out infinite;
}

.mode-predictions-frame {
  position: relative;
  justify-self: start;
  align-self: start;
  width: fit-content;
  max-width: min(92%, 760px);
  padding: 8px 10px 7px;
  border-radius: 18px;
  background: rgba(10, 10, 18, 0.18);
  border: none;
  box-shadow: 0 8px 16px rgba(7, 8, 16, 0.24);
  opacity: 0.82;
  overflow: hidden;
  animation: none;
}

.mode-predictions-frame.mode-predictions-frame--with-artifact {
  overflow: visible;
}

.app-shell[data-stage="mode-select"] .top-bar > .mode-predictions-frame.top-bar-omen {
  /* legacy: шепот больше не в top-bar */
  display: none !important;
}

.mode-predictions-frame::before {
  content: "";
  position: absolute;
  inset: 0.5px;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)) padding-box,
    linear-gradient(
      118deg,
      rgba(176, 138, 255, 0.03) 0%,
      rgba(176, 138, 255, 0.2) 18%,
      rgba(132, 209, 255, 0.22) 37%,
      rgba(176, 138, 255, 0.09) 52%,
      rgba(132, 209, 255, 0.2) 71%,
      rgba(176, 138, 255, 0.18) 88%,
      rgba(176, 138, 255, 0.03) 100%
    );
  background-size: 100% 100%, 260% 260%;
  background-position: 50% 50%, 0% 50%;
  opacity: 0.24;
  filter: blur(1.2px);
  clip-path: polygon(
    3% 15%,
    10% 6%,
    22% 4%,
    36% 7%,
    50% 4%,
    64% 7%,
    78% 5%,
    90% 11%,
    96% 24%,
    97% 38%,
    98% 52%,
    97% 66%,
    95% 80%,
    88% 91%,
    74% 95%,
    58% 93%,
    43% 96%,
    29% 94%,
    15% 90%,
    7% 80%,
    4% 66%,
    3% 51%,
    3% 35%
  );
  -webkit-clip-path: polygon(
    3% 15%,
    10% 6%,
    22% 4%,
    36% 7%,
    50% 4%,
    64% 7%,
    78% 5%,
    90% 11%,
    96% 24%,
    97% 38%,
    98% 52%,
    97% 66%,
    95% 80%,
    88% 91%,
    74% 95%,
    58% 93%,
    43% 96%,
    29% 94%,
    15% 90%,
    7% 80%,
    4% 66%,
    3% 51%,
    3% 35%
  );
  animation: modePredictionEdge 11.8s ease-in-out infinite, modePredictionContourMorph 14.8s ease-in-out infinite alternate;
}

.mode-predictions-label {
  position: relative;
  z-index: 1;
  margin: 0 0 3px;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(197, 184, 226, 0.72);
}

.menu-omen {
  position: relative;
  z-index: 1;
  justify-self: start;
  max-width: 100%;
  margin: 0;
  padding: 0 1px 1px;
  border-radius: 0;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: rgba(216, 207, 238, 0.84);
  background: transparent;
  border: none;
  box-shadow: none;
  opacity: 0;
  transform: translateY(8px);
  animation: menuOmenFade 1300ms ease-out forwards;
}

.mode-predictions-frame--with-artifact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.mode-predictions-text {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Desktop: слот текста всегда в раскладке; появляется только fade (без сжатия ширины) */
@media (min-width: 761px) {
  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover
    .mode-predictions-text {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    opacity: 0;
    transform: translateY(3px);
    /* visibility не трогаем: слот всегда в раскладке и ловит hover */
    transition:
      opacity 560ms cubic-bezier(0.22, 0.61, 0.36, 1),
      transform 560ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover.is-hover-revealed:not(.is-hover-suppressed)
    .mode-predictions-text,
  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover:focus-within:not(.is-hover-suppressed)
    .mode-predictions-text,
  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover.is-omen-whisper-open:not(.is-hover-suppressed)
    .mode-predictions-text {
    opacity: 1;
    transform: translateY(0);
  }

  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover
    .menu-omen {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover
    .mode-predictions-dust {
    opacity: 0;
    transition: opacity 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover.is-hover-revealed:not(.is-hover-suppressed)
    .mode-predictions-dust,
  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover:focus-within:not(.is-hover-suppressed)
    .mode-predictions-dust,
  .app-shell[data-stage="mode-select"]
    > .mode-select-omen-row
    > .mode-predictions-frame--shell.mode-predictions-frame--whisper-hover.is-omen-whisper-open:not(.is-hover-suppressed)
    .mode-predictions-dust {
    opacity: 1;
  }
}

.omen-day-artifact {
  position: relative;
  z-index: 2;
  flex: 0 0 clamp(76px, 7.2vw, 92px);
  width: clamp(76px, 7.2vw, 92px);
  height: clamp(76px, 7.2vw, 92px);
  min-width: clamp(76px, 7.2vw, 92px);
  min-height: clamp(76px, 7.2vw, 92px);
  max-width: clamp(76px, 7.2vw, 92px);
  max-height: clamp(76px, 7.2vw, 92px);
  aspect-ratio: 1;
  margin: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  overflow: visible;
  box-sizing: border-box;
  /* как у .profile-crystal-button */
  filter: var(--ui-intro-figure-glow);
  transition: transform 220ms ease, filter 220ms ease;
}

.omen-day-artifact--nav {
  appearance: none;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}

.omen-day-artifact--nav:hover,
.omen-day-artifact--nav:focus-visible {
  transform: translateY(-1px) scale(1.04);
  filter: var(--ui-intro-figure-glow-hover);
  outline: none;
}

.omen-day-artifact--nav.is-long-pressing::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 4px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cyan) 75%, #fff 10%);
  transform-origin: left center;
  transform: scaleX(0);
  animation: omenLongPressFill var(--long-press-ms, 1500ms) linear forwards;
  pointer-events: none;
  z-index: 3;
}

@keyframes omenLongPressFill {
  to {
    transform: scaleX(1);
  }
}

.omen-day-artifact--nav:active {
  transform: translateY(0) scale(0.98);
}

.omen-day-artifact.mode-card-icon-3d {
  /* размеры задаёт .omen-day-artifact — не height:100% (иначе хост схлопывается) */
  display: block;
  box-sizing: border-box;
}

.omen-day-artifact .mode-card-icon-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.mode-predictions-dust {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.mode-predictions-dust-particle {
  --x: 50%;
  --y: 50%;
  --delay: 0ms;
  --dur: 5800ms;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(226, 221, 245, 0.42);
  box-shadow: 0 0 5px rgba(185, 165, 244, 0.2);
  transform: translate(-50%, -50%);
  animation: modePredictionDust var(--dur) ease-in-out var(--delay) infinite;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px;
  overflow: visible;
  align-items: stretch;
}

.mode-card-group {
  grid-column: 1 / -1;
}

.mode-card.mode-card-group-face {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
  padding: 22px 24px 20px;
  cursor: default;
  --btn-background: linear-gradient(140deg, rgba(27, 36, 66, 0.34), rgba(44, 21, 74, 0.38));
  background: var(--btn-background);
  border-color: rgba(206, 185, 255, 0.1);
  box-shadow: 0 10px 22px rgba(8, 6, 24, 0.2);
}

.mode-card.mode-card-group-face.active,
.mode-card.mode-card-group-face.active:hover,
.mode-card.mode-card-group-face.active:focus-visible {
  background: var(--btn-background);
  border-color: rgba(206, 185, 255, 0.1);
  box-shadow: 0 10px 22px rgba(8, 6, 24, 0.2);
}

.mode-card.mode-card-group-face::before {
  opacity: 0.32;
}

.mode-card.mode-card-group-face::after {
  opacity: 0.08;
}

.mode-card.mode-card-group-face.active:hover,
.mode-card.mode-card-group-face.active:focus-visible {
  cursor: default;
}

.mode-card-group-face > .mode-card-group-head .mode-card-copy h3,
.mode-card-group-face > .mode-card-group-head .mode-card-icon {
  animation: none;
}

.mode-card-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.mode-card-group-head .mode-card-copy {
  align-self: center;
}

.mode-card-group-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  width: 100%;
}

.mode-card-shell.mode-card-group > .mode-card-halo {
  inset: -5px;
}

.mode-card-shell.mode-card-group > .mode-card-halo .mode-card-halo-core,
.mode-card-shell.mode-card-group > .mode-card-halo .mode-card-halo-outer {
  inset: 5px;
  transform: none;
}

.mode-card-shell.mode-card-group > .mode-card-halo .mode-card-halo-core {
  filter: blur(4px);
  opacity: 0.58;
}

.mode-card-shell.mode-card-group > .mode-card-halo .mode-card-halo-outer {
  filter: blur(7px);
  opacity: 0.28;
}

.mode-card-shell.mode-card-group.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-core,
.mode-card-shell.mode-card-group.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-core {
  filter: blur(5px);
  transform: none;
  opacity: 0.7;
}

.mode-card-shell.mode-card-group.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-outer,
.mode-card-shell.mode-card-group.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-outer {
  filter: blur(8px);
  transform: none;
  opacity: 0.34;
}

.mode-card-shell.mode-card-shell-nested {
  height: auto;
  min-height: 0;
}

.mode-card.mode-card-nested {
  min-height: 92px;
  padding: 12px 12px 10px;
  gap: 10px;
}

.mode-card-shell-nested .mode-card-icon-wrap {
  width: 44px;
  height: 44px;
}

.mode-card-shell-nested .mode-card-icon-wrap.mode-card-icon-3d,
.mode-card-shell-nested .mode-card-icon-canvas {
  width: 44px;
  height: 44px;
}

.mode-card.mode-card-nested .mode-card-copy h3 {
  font-size: clamp(1.05rem, 2.6vw, 1.28rem);
}

.mode-card-shell {
  --hover-morph: 0;
  --hover-bump: 0px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
  overflow: visible;
  /* flat: иначе card (translateZ) и halo по-разному проецируются при rotateX */
  transform-style: flat;
}

/* .motion-tilt задаёт preserve-3d — на меню это рвёт ореол от кнопки */
.app-shell[data-stage="mode-select"] .mode-card-shell.motion-tilt {
  transform-style: flat;
}

.mode-card-shell.is-active:has(> .mode-card:hover),
.mode-card-shell.is-active:has(> .mode-card:focus-visible) {
  --hover-bump: -2px;
}

.mode-card-shell.is-active.motion-tilt:has(> .mode-card:hover),
.mode-card-shell.is-active.motion-tilt:has(> .mode-card:focus-visible) {
  transform: translateY(calc(var(--tilt-lift, 0px) + var(--hover-bump, 0px)))
    rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
    scale(calc(1.02 + var(--tilt-depth, 0) * 0.04));
}

/* Карточка не должна иметь свой transform — иначе отстаёт от ореола на shell */
.app-shell[data-stage="mode-select"] .mode-card {
  transform: none;
  will-change: clip-path;
}

.app-shell[data-stage="mode-select"] .mode-card.active:hover,
.app-shell[data-stage="mode-select"] .mode-card.active:focus-visible {
  transform: none;
}

/* Силуэтный ореол вокруг карточки — те же токены, что у .btn-halo */
.mode-card-halo {
  position: absolute;
  inset: -12px;
  z-index: 0;
  pointer-events: none;
  opacity: var(--ui-edge-halo-opacity);
  transition: opacity 360ms ease, filter 420ms ease;
  will-change: opacity;
}

.mode-card-halo-core,
.mode-card-halo-outer {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  transform-origin: center center;
  transition: opacity 360ms ease, transform 420ms ease, filter 420ms ease;
}

.mode-card-halo-fill {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
}

.mode-card-halo-core {
  filter: blur(7px);
  transform: scale(1.05);
  opacity: 0.72;
}

.mode-card-halo-core .mode-card-halo-fill {
  background: var(--ui-edge-halo-core);
}

.mode-card-halo-outer {
  filter: blur(12px);
  transform: scale(1.1);
  opacity: 0.4;
}

.mode-card-halo-outer .mode-card-halo-fill {
  background: var(--ui-edge-halo-outer);
}

.mode-card-shell.is-soon .mode-card-halo {
  opacity: 0.18;
  filter: saturate(0.75) brightness(0.9);
}

.mode-card-shell.is-soon .mode-card-halo-core {
  transform: scale(1.04);
  opacity: 0.5;
}

.mode-card-shell.is-soon .mode-card-halo-outer {
  transform: scale(1.08);
  opacity: 0.3;
}

.mode-card-shell.is-active:has(> .mode-card:hover) > .mode-card-halo,
.mode-card-shell.is-active:has(> .mode-card:focus-visible) > .mode-card-halo {
  opacity: var(--ui-edge-halo-opacity-hover);
  filter: none;
}

.mode-card-shell.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-core,
.mode-card-shell.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-core {
  filter: blur(8px);
  transform: scale(1.07);
  opacity: 0.88;
}

.mode-card-shell.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-core .mode-card-halo-fill,
.mode-card-shell.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-core .mode-card-halo-fill {
  background: var(--ui-edge-halo-core);
}

.mode-card-shell.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-outer,
.mode-card-shell.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-outer {
  filter: blur(14px);
  transform: scale(1.14);
  opacity: 0.52;
}

.mode-card-shell.is-active:has(> .mode-card:hover) > .mode-card-halo .mode-card-halo-outer .mode-card-halo-fill,
.mode-card-shell.is-active:has(> .mode-card:focus-visible) > .mode-card-halo .mode-card-halo-outer .mode-card-halo-fill {
  background: var(--ui-edge-halo-outer);
}

.mode-card-shell > .mode-card {
  position: relative;
  z-index: 1;
  width: 100%;
  /* shell тянется по самой высокой в ряду — кнопка и ореол должны совпадать */
  flex: 1 1 auto;
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.mode-card {
  position: relative;
  border: 1px solid rgba(206, 185, 255, 0.1);
  text-align: left;
  border-radius: 20px;
  min-height: 120px;
  padding: 18px 18px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  overflow: visible;
  isolation: isolate;
  transition:
    transform 820ms cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 760ms ease,
    border-color 760ms ease,
    background 760ms ease;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: clip-path, transform;
}

.mode-card > :not(.mode-card-inner-fx):not(.mode-card-underfx):not(.mode-card-edge-sparks):not(.mode-card-particle-port):not(.shared-particle-port-canvas) {
  position: relative;
  z-index: 2;
}

.mode-card::before,
.mode-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.mode-card::before {
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 16% 22%, rgba(157, 124, 255, 0.32), rgba(157, 124, 255, 0) 42%),
    radial-gradient(circle at 84% 78%, rgba(94, 206, 255, 0.3), rgba(94, 206, 255, 0) 46%),
    linear-gradient(140deg, rgba(73, 44, 142, 0.66), rgba(44, 91, 160, 0.5), rgba(87, 44, 138, 0.66));
  opacity: 1;
}

.mode-card::after {
  inset: 8%;
  z-index: 0;
  opacity: calc(0.1 + var(--hover-morph, 0) * 0.28);
  filter: blur(calc(14px + var(--hover-morph, 0) * 10px));
  transform: scale(calc(0.86 + var(--hover-morph, 0) * 0.18));
  border-radius: 56% 44% 58% 42% / 42% 58% 39% 61%;
  background:
    radial-gradient(circle at 34% 30%, rgba(246, 238, 255, 0.22), rgba(246, 238, 255, 0) 50%),
    radial-gradient(circle at 70% 64%, rgba(173, 241, 255, 0.2), rgba(173, 241, 255, 0) 54%),
    radial-gradient(circle at 52% 50%, rgba(153, 124, 255, 0.14), rgba(153, 124, 255, 0) 62%);
  transition: opacity 520ms ease, filter 600ms ease, transform 760ms ease, border-radius 920ms ease;
}

.mode-card-inner-fx {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  clip-path: inherit;
  -webkit-clip-path: inherit;
  overflow: hidden;
  border-radius: inherit;
  opacity: calc(0.38 + var(--hover-morph, 0) * 0.22);
}

.mode-card-particle-port {
  opacity: calc(0.72 + var(--hover-morph, 0) * 0.28);
}

.mode-card-firefly {
  position: absolute;
  left: var(--fx);
  top: var(--fy);
  width: var(--size, 4px);
  height: var(--size, 4px);
  border-radius: 50%;
  background: hsla(var(--hue, 290), 100%, 84%, 0.88);
  box-shadow:
    0 0 8px hsla(var(--hue, 290), 100%, 78%, 0.82),
    0 0 16px hsla(var(--hue, 290), 100%, 72%, 0.5);
  transform: translate(-50%, -50%) scale(var(--fz, 1));
  mix-blend-mode: screen;
  opacity: 0.78;
  animation:
    modeFireflyOrbit var(--dur, 6200ms) ease-in-out var(--delay, 0ms) infinite alternate,
    modeFireflyPulse calc(var(--dur, 6200ms) * 0.55) ease-in-out var(--delay, 0ms) infinite;
}

.mode-card-firefly-lg {
  background: radial-gradient(
    circle,
    hsla(var(--hue, 290), 100%, 92%, 0.95) 0%,
    hsla(var(--hue, 290), 100%, 78%, 0.55) 48%,
    hsla(var(--hue, 290), 100%, 70%, 0) 72%
  );
  box-shadow:
    0 0 12px hsla(var(--hue, 290), 100%, 80%, 0.78),
    0 0 22px hsla(var(--hue, 290), 100%, 72%, 0.4);
  opacity: 0.66;
}

.mode-card.soon .mode-card-inner-fx {
  opacity: calc(0.24 + var(--hover-morph, 0) * 0.16);
}

.mode-card.soon .mode-card-particle-port {
  opacity: calc(0.4 + var(--hover-morph, 0) * 0.2);
}

.mode-card.soon .mode-card-firefly {
  opacity: 0.42;
  animation-duration: calc(var(--dur, 6200ms) * 1.35), calc(var(--dur, 6200ms) * 0.8);
}

.mode-card.active {
  color: #f5f0ff;
  border-color: rgba(206, 185, 255, 0.18);
  background: linear-gradient(140deg, rgba(27, 36, 66, 0.92), rgba(44, 21, 74, 0.94));
  box-shadow:
    0 14px 28px rgba(8, 6, 24, 0.52),
    0 0 18px rgba(124, 95, 228, 0.16);
  /* ореол — .mode-card-halo; drop-shadow дублирует силуэт */
  filter: var(--btn-glow);
}

.mode-card.active:hover,
.mode-card.active:focus-visible {
  /* transform на .mode-card-shell.motion-tilt — иначе ореол отстаёт от карточки */
  box-shadow:
    0 18px 34px rgba(12, 8, 34, 0.58),
    0 0 22px rgba(168, 229, 255, 0.18);
  filter: var(--btn-glow-hover);
}

.mode-card:focus-visible {
  outline: none;
}

.mode-card.soon {
  color: #6e6a84;
  background: linear-gradient(145deg, rgba(27, 28, 40, 0.82), rgba(15, 16, 26, 0.9));
  border-color: rgba(136, 132, 160, 0.14);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  filter: saturate(0.42) brightness(0.82);
  cursor: default;
}

.mode-card.soon::before {
  opacity: 0.24;
  filter: grayscale(0.4) saturate(0.5) brightness(0.78);
}

.mode-card.soon::after {
  opacity: calc(0.12 + var(--hover-morph, 0) * 0.2);
}

.mode-card-mobile {
  clip-path: polygon(
    4% 16%,
    11% 7%,
    23% 5%,
    36% 8%,
    49% 5%,
    63% 8%,
    76% 6%,
    89% 12%,
    96% 24%,
    97% 38%,
    99% 52%,
    97% 67%,
    96% 82%,
    87% 93%,
    73% 96%,
    58% 94%,
    43% 97%,
    28% 95%,
    14% 92%,
    6% 80%,
    3% 66%,
    2% 50%,
    3% 34%
  );
  -webkit-clip-path: polygon(
    4% 16%,
    11% 7%,
    23% 5%,
    36% 8%,
    49% 5%,
    63% 8%,
    76% 6%,
    89% 12%,
    96% 24%,
    97% 38%,
    99% 52%,
    97% 67%,
    96% 82%,
    87% 93%,
    73% 96%,
    58% 94%,
    43% 97%,
    28% 95%,
    14% 92%,
    6% 80%,
    3% 66%,
    2% 50%,
    3% 34%
  );
}

.mode-card-underfx {
  display: none !important;
}

.mode-card-edge-sparks {
  position: absolute;
  inset: -12%;
  z-index: 5;
  pointer-events: none;
  clip-path: none;
  -webkit-clip-path: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.mode-card-edge-spark {
  position: absolute;
  width: 2px;
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(245, 240, 255, 0.95), rgba(149, 236, 255, 0.15));
  box-shadow:
    0 0 10px rgba(223, 197, 255, 0.7),
    0 0 14px rgba(141, 227, 255, 0.6);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  animation: modeEdgeSparkBurst var(--dur, 1800ms) ease-out var(--sd, 0ms) infinite;
  animation-play-state: paused;
}

.mode-card.active:hover .mode-card-edge-sparks,
.mode-card.active:focus-visible .mode-card-edge-sparks {
  opacity: 0.95;
}

.mode-card.active:hover .mode-card-edge-spark,
.mode-card.active:focus-visible .mode-card-edge-spark {
  animation-play-state: running;
}

.mode-card-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: start;
  transform: translateY(0);
  position: relative;
  overflow: visible;
}

.mode-card-icon-wrap.mode-card-icon-3d {
  width: 56px;
  height: 56px;
  /* дешевле, чем filter на анимированном canvas */
  filter: drop-shadow(0 0 8px rgba(140, 200, 255, 0.28));
}

.mode-card-icon-canvas {
  width: 56px;
  height: 56px;
  display: block;
  pointer-events: none;
}

.mode-card-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #efe9ff;
  animation: modeIconLevitate 4.4s ease-in-out var(--icon-phase, 0s) infinite;
  transform-origin: 50% 70%;
}

.mode-card-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.mode-card-copy {
  display: grid;
  gap: 5px;
  align-self: center;
}

.mode-card-title-wrap {
  position: relative;
  display: inline-grid;
  justify-items: start;
  width: fit-content;
}

.mode-card-copy h3 {
  margin: 0;
  position: relative;
  z-index: 1;
  font-size: clamp(1.35rem, 3.2vw, 1.65rem);
  letter-spacing: 0.02em;
  color: rgba(241, 233, 255, 0.96);
  text-shadow:
    0 0 14px rgba(160, 118, 244, 0.28),
    0 0 26px rgba(130, 205, 255, 0.18);
  animation: modeCardTitleLevitate 5.4s ease-in-out infinite;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.mode-card-title-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.mode-card-title-spark {
  --x: 50%;
  --delay: 0ms;
  --dur: 3400ms;
  position: absolute;
  left: var(--x);
  top: 70%;
  width: 1.6px;
  height: 1.6px;
  border-radius: 50%;
  background: rgba(232, 226, 255, 0.74);
  box-shadow: 0 0 6px rgba(162, 217, 255, 0.4);
  opacity: 0;
  animation: modeTitleSparkFall var(--dur) ease-out var(--delay) infinite;
}

.mode-card-subtitle {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 0.76rem;
  color: rgba(196, 185, 223, 0.64);
  letter-spacing: 0.02em;
  line-height: 1.35;
  /* одинаковая «полка» под 2 строки — длинный hint не раздувает одну карточку */
  min-height: calc(1.35em * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* СКОРО / ЗАВТРА — сразу под пояснением, без пустой второй строки полки */
.mode-card-copy:has(> .mode-card-status) .mode-card-subtitle {
  min-height: 0;
}

.mode-card-status {
  margin: 2px 0 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(177, 167, 204, 0.74);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.25;
}

@media (prefers-reduced-motion: reduce) {
  .app-button {
    --btn-motion-transform-dur: 0ms;
    --btn-motion-visual-dur: 0ms;
    --btn-hover-scale: 1;
    --btn-hover-lift: 0px;
  }

  .app-button::before,
  .app-button::after {
    animation: none !important;
    filter: blur(5px);
    transform: scale(0.98);
    opacity: 0.22;
  }

  .app-button:not(.btn-variant-menu).btn-morph-on {
    clip-path: none;
    -webkit-clip-path: none;
  }

  .mode-screen .mode-predictions-dust-particle,
  .mode-screen .mode-card-firefly,
  .mode-screen .mode-card-edge-spark,
  .mode-screen .mode-card-title-spark,
  .mode-screen .mode-title-spark,
  .mode-screen .hall-ray-spark,
  .mode-screen .mode-card-icon,
  .mode-screen .mode-card-copy h3 {
    animation: none !important;
    transition-duration: 0ms !important;
    transform: none !important;
  }

  .mode-screen .mode-card-edge-sparks {
    opacity: 0.16;
  }

  .mode-screen .mode-card-halo {
    opacity: 0.22;
    transition: none;
    filter: none;
  }

  .mode-screen .mode-card-shell.is-soon .mode-card-halo {
    opacity: 0.1;
  }

  .mode-screen .mode-card-halo-core {
    transform: scale(1.03);
  }

  .mode-screen .mode-card-halo-outer {
    transform: scale(1.06);
  }

  .mode-screen .mode-card-underfx {
    opacity: 0.18;
    transform: translateY(4px);
    animation: none !important;
  }

  .mode-screen .mode-card-underfx::before {
    filter: blur(14px);
    transform: scale(1);
    opacity: 0.45;
  }

  .mode-screen .mode-card-underfx::after {
    display: none;
  }
}

/* --- Карта чертога (временная: залы = mode-card, лучи, влёт) --- */

.mode-screen-content--halls {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.hall-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: min(58vh, 620px);
  width: 100%;
  overflow: visible;
}

.hall-interior-stash {
  display: none !important;
}

.hall-map-viewport {
  position: relative;
  width: 100%;
  min-height: min(62vh, 680px);
  height: 100%;
  overflow: visible;
}

.app-shell[data-stage="mode-select"]:has(.mode-screen.is-entering-hall) > .mode-screen {
  z-index: 40;
}

.mode-screen.is-entering-hall .hall-stage {
  overflow: hidden;
}

.hall-map-rays {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.hall-map-rays-mist {
  filter: blur(26px);
}

.hall-map-rays-glow {
  filter: blur(14px);
}

.hall-ray {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hall-ray--mist {
  stroke: color-mix(in srgb, var(--violet) 62%, var(--cyan));
  stroke-width: 56;
  --ray-op-min: 0.16;
  --ray-op-max: 0.34;
  animation: hallRayShimmer 5.4s ease-in-out infinite, hallRayIridesce 8.4s ease-in-out infinite;
}

.hall-ray--glow {
  stroke: color-mix(in srgb, var(--cyan) 58%, var(--violet));
  stroke-width: 28;
  --ray-op-min: 0.14;
  --ray-op-max: 0.32;
  animation: hallRayShimmer 4.2s ease-in-out infinite reverse, hallRayIridesce 6.6s ease-in-out infinite reverse;
}

.hall-map-ray-sparks {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

.hall-ray-spark {
  --delay: 0ms;
  --dur: 2800ms;
  --jx: 0px;
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cyan) 28%, var(--ink));
  box-shadow:
    0 0 8px color-mix(in srgb, var(--cyan) 70%, transparent),
    0 0 16px color-mix(in srgb, var(--violet) 45%, transparent);
  opacity: 0;
  pointer-events: none;
}

.hall-ray-spark--twinkle {
  margin: -1.5px 0 0 -1.5px;
  animation: modeTitleSparkFall var(--dur) ease-out var(--delay) infinite;
}

.hall-ray-spark--drift {
  width: 4px;
  height: 4px;
  offset-rotate: 0deg;
  animation: hallRaySparkDrift var(--dur) linear var(--delay) infinite;
}

.mode-screen.is-entering-hall.is-in-hall .hall-map-viewport,
.mode-screen.is-hall-reveal .hall-map-viewport {
  pointer-events: none;
}

.mode-screen.is-hall-reveal .hall-map-viewport {
  position: relative;
  z-index: 1;
}

.mode-screen.is-hall-reveal .hall-interior {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: auto;
  z-index: 90;
  opacity: 0;
  animation: hallInteriorIn 280ms ease 200ms both;
}

.hall-map-viewport.is-entering .hall-map-rays,
.hall-map-viewport.is-entering .hall-map-ray-sparks {
  opacity: 0;
  transition: opacity 220ms ease;
}

.hall-map-viewport.is-leaving .hall-map-ray-sparks {
  opacity: 0;
  animation: hallRaySparksIn 360ms ease 280ms both;
}

.hall-map-viewport.is-entering .hall-map-island:not(.is-fly-target) {
  animation: none;
}

.hall-map-island {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--island-w, min(248px, 42vw));
  z-index: 2;
  transform: translateY(0);
  transform-origin: 50% 50%;
  animation: hallIslandBob var(--bob-dur, 5.8s) ease-in-out var(--bob-delay, 0s) infinite;
  visibility: hidden;
}

.hall-map-viewport.is-map-ready .hall-map-island {
  visibility: visible;
}

.hall-map-island .mode-card-shell {
  height: auto;
  min-height: 0;
}

.hall-map-island.is-fly-aside {
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}

.hall-map-island.is-fly-target {
  z-index: 8;
  animation: none;
}

.hall-map-island.is-fly-source {
  visibility: hidden !important;
}

.hall-map-island.is-fly-proxy {
  z-index: 9;
  pointer-events: none;
}

.hall-map-island.is-fly-proxy *,
.hall-map-island.is-fly-proxy *::before,
.hall-map-island.is-fly-proxy *::after {
  animation-play-state: paused !important;
  transition: none !important;
}

.mode-screen.is-hall-reveal .hall-interior .mode-card-shell.motion-tilt {
  transform: none;
}

.hall-map-island.is-entering-center {
  animation: hallEnterIsland 560ms cubic-bezier(0.64, 0, 0.78, 0) both;
  pointer-events: none;
}

.hall-map-island.is-entering-center .mode-card-copy,
.hall-map-island.is-enter-hold .mode-card-copy {
  opacity: 0;
}

.hall-map-island.is-entering-center .mode-card,
.hall-map-island.is-leaving-center .mode-card {
  will-change: auto;
}

.hall-map-island.is-enter-hold {
  animation: none;
  transform: scale(12);
  opacity: 0;
  pointer-events: none;
}

.hall-map-island.is-leaving-center {
  animation: hallLeaveIsland 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
  pointer-events: none;
}

.hall-interior {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 14px;
  width: 100%;
}

.hall-interior[hidden] {
  display: none !important;
}

.hall-interior.is-visible .mode-card-shell {
  animation: none;
}

.hall-interior .mode-card {
  transform: none;
  will-change: clip-path;
  transition-property: box-shadow, border-color, background;
}

@keyframes hallIslandBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

@keyframes hallRayShimmer {
  0%,
  100% {
    opacity: var(--ray-op-min, 0.2);
  }
  50% {
    opacity: var(--ray-op-max, 0.4);
  }
}

@keyframes hallRayIridesce {
  0%,
  100% {
    stroke: color-mix(in srgb, var(--cyan) 62%, var(--violet));
  }
  50% {
    stroke: color-mix(in srgb, var(--violet) 58%, var(--ink));
  }
}

@keyframes hallRaySparkDrift {
  0% {
    offset-distance: 8%;
    opacity: 0;
    transform: translate(var(--jx), -2px) scale(0.7);
  }
  16% {
    opacity: 0.95;
    transform: translate(var(--jx), 4px) scale(1.15);
  }
  100% {
    offset-distance: 92%;
    opacity: 0;
    transform: translate(var(--jx), 18px) scale(0.35);
  }
}

@keyframes hallEnterIsland {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  72% {
    transform: scale(7.2);
    opacity: 0;
  }
  100% {
    transform: scale(12);
    opacity: 0;
  }
}

@keyframes hallLeaveIsland {
  0% {
    transform: scale(12);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes hallRaySparksIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hallInteriorIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

html[data-theme="classic"] .hall-ray--mist {
  stroke: color-mix(in srgb, var(--violet) 52%, var(--cyan));
}

html[data-theme="classic"] .hall-ray--glow {
  stroke: color-mix(in srgb, var(--cyan) 50%, var(--violet));
}

@media (max-width: 760px) {
  .hall-stage {
    min-height: min(68vh, 720px);
  }

  .hall-map-viewport {
    min-height: min(70vh, 760px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hall-map-island,
  .hall-ray--mist,
  .hall-ray--glow,
  .hall-ray-spark,
  .hall-interior.is-visible .mode-card-shell {
    animation: none !important;
    transition: none !important;
  }

  .hall-map-island.is-entering-center,
  .hall-map-island.is-leaving-center,
  .hall-map-island.is-enter-hold {
    transform: none;
    opacity: 1;
    filter: none;
  }

  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title.is-path-out,
  .app-shell[data-stage="mode-select"] > .top-bar > .top-bar-brand .top-bar-path-title.is-path-in {
    animation: none !important;
    filter: none;
    transform: none;
    opacity: 1;
  }

  .mode-screen.is-hall-reveal .hall-interior {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
