/* styles/auth-history.css — split from styles.css (structural only) */

/* --- Auth / History panels (URL routing + persistence) --- */
.panel-screen {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0.35rem 1rem 2.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-screen .subtitle,
.history-screen .subtitle {
  text-align: center;
  margin: 0;
}

.auth-form,
.auth-actions,
.history-actions,
.daily-result-actions,
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* full-width auth/history/daily: morph + силуэтный ореол (btn-shell-stretch), не прямоугольный halo */
.auth-actions .btn-shell-stretch,
.history-actions .btn-shell-stretch,
.daily-result-actions .btn-shell-stretch,
.result-actions .btn-shell-stretch {
  display: flex;
  width: 100%;
  overflow: visible;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field-label {
  font-size: 0.85rem;
  opacity: 0.82;
}

.auth-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.auth-input-row .auth-input {
  flex: 1 1 auto;
  min-width: 0;
}

.auth-input {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
  color: inherit;
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
}

.auth-input:focus {
  outline: 2px solid color-mix(in srgb, var(--cyan) 55%, transparent);
  outline-offset: 1px;
}

.auth-login-check-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
  color: color-mix(in srgb, var(--cyan) 88%, #fff 12%);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 160ms ease;
}

.auth-password-toggle-btn {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 40%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
  color: color-mix(in srgb, var(--cyan) 88%, #fff 12%);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 160ms ease;
}

.auth-login-check-btn:hover,
.auth-login-check-btn:focus-visible,
.auth-password-toggle-btn:hover,
.auth-password-toggle-btn:focus-visible {
  border-color: color-mix(in srgb, var(--cyan) 70%, transparent);
  background: color-mix(in srgb, var(--cyan) 16%, var(--bg-soft));
  outline: none;
}

.auth-login-check-btn:active,
.auth-password-toggle-btn:active {
  transform: translateY(1px);
}

.auth-login-check-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.auth-login-check-icon,
.auth-password-toggle-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.auth-password-toggle-btn[aria-pressed="true"] {
  color: color-mix(in srgb, var(--cyan) 70%, #fff 30%);
  border-color: color-mix(in srgb, var(--cyan) 58%, transparent);
}

.auth-checklist {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0.35rem 0.55rem;
  display: grid;
  gap: 0.2rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

/* display:grid иначе перебивает [hidden] — чеклист виден до ввода */
.auth-checklist[hidden] {
  display: none !important;
}

.auth-checklist-item {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.8rem;
  line-height: 1.35;
  opacity: 0.88;
}

.auth-checklist-item::before {
  content: "○";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.78rem;
}

.auth-checklist-item.is-ok {
  color: color-mix(in srgb, #8dffb5 78%, #fff 22%);
}

.auth-checklist-item.is-ok::before {
  content: "✓";
}

.auth-checklist-item.is-bad {
  color: color-mix(in srgb, #ffb0bc 72%, #fff 28%);
}

.auth-checklist-item.is-bad::before {
  content: "×";
}

.auth-login-status {
  margin: 0.1rem 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-login-status.is-ok {
  color: color-mix(in srgb, #8dffb5 78%, #fff 22%);
}

.auth-login-status.is-bad {
  color: #ff8f9f;
}

.auth-login-status.is-pending {
  opacity: 0.78;
}

.auth-error {
  color: #ff8f9f;
  margin: 0;
  font-size: 0.92rem;
}

.auth-session-note {
  opacity: 0.8;
  margin: 0;
}

.history-toolbar {
  display: flex;
  justify-content: stretch;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0.75rem;
  width: 100%;
  overflow: visible;
}

.history-toolbar .history-clear-btn,
.history-toolbar > .btn-shell:has(.history-clear-btn) {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-self: stretch;
  box-sizing: border-box;
}

.history-toolbar > .btn-shell:has(.history-clear-btn) {
  display: flex;
}

.history-toolbar .history-clear-btn {
  width: 100%;
  max-width: 100%;
  justify-content: center;
}

.history-mode-filter-dropdown {
  flex: 1 1 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.history-mode-filter-dropdown > .btn-shell,
.history-mode-filter-dropdown > .btn-shell-stretch {
  display: flex;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.history-mode-filter-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  /* morph clip-path съедает края — запас как у intro debug dropdown */
  padding: 10px max(28px, 10%) 10px max(18px, 6%);
  box-sizing: border-box;
  overflow: visible;
}

.history-mode-filter-trigger .app-dropdown-trigger-label {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 6px;
}

.history-mode-filter-trigger .app-dropdown-trigger-caret {
  position: absolute;
  z-index: 2;
  /* % от ширины — иначе на wide morph caret уезжает за clip-path */
  right: max(22px, 8%);
  top: 50%;
  flex: 0 0 auto;
}

.history-mode-filter-options {
  left: 0;
  right: auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.history-list.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.history-pager {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.history-pager-btn {
  min-height: 40px;
}

.history-pager > .btn-shell:first-child,
.history-pager > .history-pager-btn:first-child {
  justify-self: start;
}

.history-pager > .btn-shell:last-child,
.history-pager > .history-pager-btn:last-child {
  justify-self: end;
}

.history-pager-label {
  text-align: center;
  font-size: 0.88rem;
  opacity: 0.82;
  white-space: nowrap;
}

.history-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: stretch;
}

.history-item-row--solo {
  grid-template-columns: minmax(0, 1fr);
}

.history-item {
  text-align: left;
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
  color: inherit;
  cursor: pointer;
  width: 100%;
  min-width: 0;
}

.history-item-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0 0.65rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
  color: inherit;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.78;
}

.history-item-delete:hover,
.history-item-delete:focus-visible {
  opacity: 1;
}

.history-item-mode {
  font-weight: 650;
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
}

.history-item-meta {
  font-size: clamp(0.92rem, 2.4vw, 1.02rem);
  opacity: 0.7;
}

.history-item-preview {
  font-size: clamp(1.12rem, 3.2vw, 1.35rem);
  opacity: 0.92;
  line-height: 1.35;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

/* Деталка истории = те же блоки, что result/daily после гадания */
.history-screen--detail {
  width: min(960px, 100%);
}

.history-screen--detail .result-screen {
  width: 100%;
  margin-top: 0;
}

.history-screen--detail .history-detail-meta {
  opacity: 0.78;
  font-size: 0.9rem;
}

.history-screen--detail .history-daily-result .daily-result {
  /* в истории без entrance-анимации выбора */
  opacity: 1;
  transform: none;
  transition: none;
}

.app-shell[data-stage="auth-login"] .top-bar,
.app-shell[data-stage="auth-register"] .top-bar,
.app-shell[data-stage="history"] .top-bar,
.app-shell[data-stage="profile"] .top-bar {
  margin-bottom: 0;
}

/* Auth brand: «Чертог» | ворон | «Ворона»; крупная типографика. */
.app-shell[data-stage="auth-login"],
.app-shell[data-stage="auth-register"] {
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand {
  position: relative;
  display: block;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: clamp(210px, 32vw, 300px);
  margin: 0 0 0.65rem;
  padding: 18px 0 10px;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth {
  --raven-w: clamp(220px, 32vw, 340px);
  --raven-h: clamp(145px, 21vw, 220px);
  --brand-gap: clamp(8px, 1.6vw, 24px);
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  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="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-auth-raven-stack,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-auth-raven-stack {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  z-index: 3;
  pointer-events: none;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-raven,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-raven {
  position: relative;
  left: auto;
  top: auto;
  width: var(--raven-w);
  height: var(--raven-h);
  margin: 0;
  transform: none;
  pointer-events: auto;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child {
  position: absolute;
  top: 50%;
  right: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  left: auto;
  transform: translateY(-50%);
  display: grid;
  width: max-content;
  max-width: min(40vw, 360px);
  padding: 8px 10px 14px;
  justify-items: end;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type {
  position: absolute;
  top: 50%;
  left: calc(50% + (var(--raven-w) / 2) + var(--brand-gap));
  right: auto;
  transform: translateY(-50%);
  display: grid;
  width: max-content;
  max-width: min(40vw, 360px);
  padding: 8px 10px 14px;
  justify-items: start;
  box-sizing: border-box;
  overflow: visible;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
  max-width: 100%;
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  white-space: nowrap;
  overflow: visible;
  animation: modeTitleLevitate 5.8s ease-in-out infinite;
  line-height: 1.05;
  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="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title {
  text-align: right;
  justify-self: end;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
  text-align: left;
  justify-self: start;
}

.app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-wrap::before,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .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="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-sparks,
.app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-title-sparks {
  position: absolute;
  inset: auto 4% 2px 4%;
  height: 34px;
  overflow: visible;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 760px) {
  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand {
    min-height: calc(28px + 210px);
    padding: 14px 0 8px;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth {
    --raven-w: clamp(180px, 46vw, 240px);
    --raven-h: clamp(118px, 30vw, 158px);
    --brand-gap: clamp(4px, 1.4vw, 12px);
    --brand-side: max(8px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:first-child,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth > .top-bar-title-wrap:last-of-type {
    max-width: calc(50% - (var(--raven-w) / 2) - var(--brand-gap) - var(--brand-side));
    padding: 4px 2px 10px;
  }

  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
  .app-shell[data-stage="auth-login"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-app-title,
  .app-shell[data-stage="auth-register"] > .top-bar.top-bar-auth-brand > .top-bar-brand-auth .top-bar-path-title {
    font-size: clamp(1.55rem, 8.2vw, 2.35rem);
  }
}

/* Profile */
.profile-screen {
  gap: 0.9rem;
}

.profile-screen .subtitle {
  margin: 0;
  opacity: 0.82;
  line-height: 1.45;
  text-align: center;
}

.profile-accordion {
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  border-radius: 16px;
  overflow: hidden;
}

.profile-assignments {
  display: grid;
  gap: 12px;
}

.profile-assignments-empty,
.profile-assignments-hint,
.profile-assignment-desc,
.profile-assignment-reward,
.profile-assignments-archive-item {
  margin: 0;
  color: color-mix(in srgb, var(--text) 78%, transparent);
  line-height: 1.45;
}

.profile-assignments-hint {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(132, 209, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(132, 209, 255, 0.14);
}

.profile-assignments-talk-btn {
  width: 100%;
}

.profile-assignment-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 76%, transparent);
}

.profile-assignment-title {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--text) 94%, var(--cyan) 12%);
  text-align: center;
  text-transform: uppercase;
}

.profile-assignment-reward {
  color: color-mix(in srgb, var(--gold) 84%, var(--text) 16%);
}

.profile-assignment-progress-list {
  display: grid;
  gap: 10px;
}

.profile-assignment-progress {
  display: grid;
  gap: 5px;
}

.profile-assignment-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: color-mix(in srgb, var(--text) 82%, transparent);
}

.profile-assignment-progress-count {
  white-space: nowrap;
  color: color-mix(in srgb, var(--cyan) 86%, var(--text) 14%);
}

.profile-assignment-progress-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  min-height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(120, 190, 255, 0.12);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cyan) 18%, transparent);
}

.profile-assignment-progress-bar > span {
  display: block;
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(132, 209, 255, 0.95), rgba(255, 215, 145, 0.95));
  box-shadow: 0 0 12px rgba(132, 209, 255, 0.48);
  transition: width 360ms ease;
}

.profile-assignment-progress.is-done .profile-assignment-progress-label {
  color: color-mix(in srgb, var(--gold) 76%, var(--text) 24%);
}

.profile-assignment-claim {
  width: 100%;
}

.profile-assignments-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.profile-assignments-actions:has(.profile-assignments-reset-btn) {
  grid-template-columns: 1fr 1fr;
}

.profile-assignments-actions > .btn-shell:has(.profile-assignments-talk-btn),
.profile-assignments-actions > .btn-shell-stretch:has(.profile-assignments-talk-btn) {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .profile-assignments-actions:has(.profile-assignments-reset-btn) {
    grid-template-columns: 1fr;
  }
}

.profile-assignments-actions > .btn-shell,
.profile-assignments-actions > .btn-shell-stretch {
  display: flex;
  width: 100%;
  min-width: 0;
}

.profile-assignments-talk-btn,
.profile-assignments-archive-btn,
.profile-assignments-reset-btn {
  width: 100%;
}

.assignments-archive-screen {
  gap: 0.85rem;
}

.assignments-archive-screen .subtitle {
  text-align: center;
  margin: 0;
}

.assignments-archive-list {
  display: grid;
  gap: 12px;
}

.assignments-archive-list.is-loading {
  opacity: 0.72;
}

.profile-assignments-archive {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-soft) 58%, transparent);
}

.profile-assignments-archive > summary {
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.raven-assignments-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  padding-top: max(
    12px,
    env(safe-area-inset-top, 0px),
    var(--raven-fly-clearance, 12px)
  );
  box-sizing: border-box;
  overflow: auto;
  /* Dim без backdrop-filter: иначе ворон попадает в sample blur. */
  background: rgba(5, 3, 14, 0.72);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Чтобы fixed-ворона считался от viewport, а не от shell. Шапку не трогаем. */
.app-shell.is-raven-assignments-open {
  transform: none !important;
  filter: none !important;
  will-change: auto;
}

/* Подлёт: fixed в домашней точке, затем только translate+scale (без resize canvas). */
.top-bar-raven.is-raven-assignments-elevated {
  position: fixed !important;
  margin: 0 !important;
  z-index: 1410 !important;
  pointer-events: none;
  transform-origin: center center;
  transition: transform 560ms cubic-bezier(0.22, 0.82, 0.28, 1);
  filter:
    drop-shadow(0 0 6px rgba(255, 220, 140, 0.85))
    drop-shadow(0 0 22px rgba(255, 188, 80, 0.62))
    drop-shadow(0 14px 36px rgba(0, 0, 0, 0.45)) !important;
}

@media (prefers-reduced-motion: reduce) {
  .top-bar-raven.is-raven-assignments-elevated {
    transition: none;
  }
}

.raven-assignments-panel {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  max-height: min(720px, calc(100dvh - var(--raven-fly-clearance, 12px) - 24px));
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 18px;
  margin: 0 auto;
  flex: 0 1 auto;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--cyan) 24%, transparent);
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--cyan) 15%, transparent), transparent 38%),
    color-mix(in srgb, var(--bg-soft) 90%, black 10%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

@media (max-width: 640px) {
  .raven-assignments-overlay {
    justify-content: safe center;
    padding-top: max(
      10px,
      env(safe-area-inset-top, 0px),
      calc(var(--raven-fly-clearance, 0px) * 0.78)
    );
  }

  .raven-assignments-panel {
    width: 100%;
    max-width: 100%;
    max-height: min(74dvh, calc(100dvh - var(--raven-fly-clearance, 0px) * 0.78 - 20px));
    padding: 14px;
    gap: 12px;
  }
}

.raven-assignments-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.raven-assignments-header h2 {
  margin: 0;
  grid-column: 2;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.raven-assignments-close {
  grid-column: 3;
  justify-self: end;
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  font-size: clamp(1.35rem, 4.5vw, 1.7rem);
}

.raven-assignments-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.raven-assignments-tabs > .btn-shell,
.raven-assignments-tabs > .btn-shell-stretch {
  width: 100%;
  min-width: 0;
}

.raven-assignments-tabs .raven-assignments-tab.app-plaque-button {
  width: 100%;
}

.raven-assignments-tab.is-active {
  filter: brightness(1.18);
}

.raven-assignments-tab.app-plaque-button,
.raven-assignments-talk-topic.app-plaque-button,
.raven-assignments-training-btn.app-plaque-button {
  --btn-font-size: 1.08rem;
  font-size: var(--btn-font-size);
  font-weight: 700;
}

.raven-assignments-tab .btn-label,
.raven-assignments-talk-topic .btn-label,
.raven-assignments-training-btn .btn-label {
  font-weight: inherit;
}

.raven-assignments-body,
.raven-assignments-talk,
.raven-assignments-training {
  display: grid;
  gap: 12px;
}

.raven-assignments-talk p,
.raven-assignments-training p {
  margin: 0;
  line-height: 1.5;
  color: color-mix(in srgb, var(--text) 84%, transparent);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.03em;
}

.raven-assignments-talk-topics {
  display: grid;
  gap: 8px;
}

.raven-assignments-talk-section {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
}

.raven-assignments-talk-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--text) 72%, transparent);
}

.raven-assignments-talk-topics > .btn-shell,
.raven-assignments-talk-topics > .btn-shell-stretch,
.raven-assignments-talk-section > .btn-shell,
.raven-assignments-talk-section > .btn-shell-stretch {
  display: flex;
  width: 100%;
  min-width: 0;
}

.raven-assignments-talk-topic,
.raven-assignments-training-btn {
  width: 100%;
}

.profile-accordion-toggle {
  appearance: none;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0.95rem 2.75rem;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.profile-section-icon,
.profile-accordion-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  color: color-mix(in srgb, var(--cyan) 72%, var(--text) 28%);
  opacity: 0.9;
  pointer-events: none;
}

.profile-section-icon svg,
.profile-accordion-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-accordion.is-open > .profile-accordion-toggle > .profile-section-icon,
.profile-accordion.is-open > .profile-accordion-toggle > .profile-accordion-icon {
  color: color-mix(in srgb, var(--cyan) 88%, var(--text) 12%);
  opacity: 1;
}

.profile-appearance-section > .profile-accordion-toggle > .profile-section-icon,
.profile-appearance-section > .profile-accordion-toggle > .profile-accordion-icon {
  width: 1.2rem;
  height: 1.2rem;
  left: 0.85rem;
}

.profile-accordion-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.2vw, 1.55rem);
  letter-spacing: 0.02em;
}

.profile-accordion-caret {
  position: absolute;
  right: 1rem;
  opacity: 0.7;
  transition: transform 280ms ease;
}

/* Только прямой потомок: иначе открытый «Оформление» держит открытыми вложенные Аватар/Карты */
.profile-accordion.is-open > .profile-accordion-toggle .profile-accordion-caret {
  transform: rotate(180deg);
}

.profile-accordion-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.profile-accordion.is-open > .profile-accordion-panel {
  grid-template-rows: 1fr;
}

.profile-accordion-panel-inner {
  overflow: hidden;
  min-height: 0;
  padding: 0 1rem;
  opacity: 0;
  transition:
    opacity 280ms ease,
    padding 320ms ease;
}

.profile-accordion.is-open > .profile-accordion-panel > .profile-accordion-panel-inner {
  padding: 0 1rem 1rem;
  opacity: 1;
}

.profile-appearance,
.profile-info,
.profile-crystals {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.profile-appearance-section {
  margin: 0;
  min-height: 0;
  flex-shrink: 0;
}

/* Вложенные секции: те же 0fr→1fr, что у остальных (auto ломает transition). */
.profile-appearance > .profile-appearance-section > .profile-accordion-toggle {
  position: relative;
  z-index: 2;
}

.profile-appearance > .profile-appearance-section > .profile-accordion-panel {
  min-height: 0;
}

.profile-appearance .profile-appearance-section .profile-accordion-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Открытый «Аватар»: свечение/float ника рисуются поверх шапки секции, не клипятся. */
.profile-appearance > .profile-appearance-section.is-open {
  overflow: visible;
}

.profile-appearance > .profile-appearance-section.is-open > .profile-accordion-panel,
.profile-appearance > .profile-appearance-section.is-open > .profile-accordion-panel > .profile-accordion-panel-inner {
  overflow: visible;
}

.profile-appearance > .profile-appearance-section.is-open .profile-avatar-preview-bundle {
  position: relative;
  z-index: 4;
}

.profile-appearance > .profile-appearance-section.is-open .profile-title-preview {
  z-index: 4;
}

/* Родитель «Оформление» тоже не клипит, иначе overflow предка режет glow. */
.profile-accordion.is-open:has(.profile-appearance-section.is-open) {
  overflow: visible;
}

.profile-accordion.is-open:has(.profile-appearance-section.is-open)
  > .profile-accordion-panel
  > .profile-accordion-panel-inner {
  overflow: visible;
}

.profile-appearance-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.15rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

.profile-appearance-reset-owned-btn {
  width: 100%;
}

.profile-crystals-balance {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-body, var(--font-ui, system-ui, sans-serif));
  line-height: 1;
}

.profile-crystals-balance-icon {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--cyan) 62%, #9ae8ff 38%);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--cyan) 48%, transparent));
}

.profile-crystals-balance-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: color-mix(in srgb, var(--cyan) 34%, transparent);
}

.profile-crystals-balance-value {
  font-family: var(--font-body, var(--font-ui, system-ui, sans-serif));
  font-size: clamp(1.85rem, 5.2vw, 2.45rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  color: color-mix(in srgb, var(--cyan) 72%, #fff 28%);
}

.profile-streak {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0 0.15rem;
  border-top: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

.profile-streak-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-streak-title,
.profile-streak-value {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.profile-streak-title {
  font-size: clamp(1.05rem, 2.8vw, 1.2rem);
}

.profile-streak-value {
  font-family: var(--font-currency);
  font-size: 0.98rem;
  opacity: 0.9;
  color: color-mix(in srgb, var(--cyan) 68%, #fff 32%);
  white-space: nowrap;
}

.profile-streak-track {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.profile-streak-pip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.2rem 0.1rem;
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.profile-streak-pip-reward {
  font-family: var(--font-body, var(--font-ui, system-ui, sans-serif));
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  opacity: 0.95;
  color: #fff;
}

.profile-streak-pip.is-filled {
  background: color-mix(in srgb, var(--cyan) 55%, #fff 10%);
  border-color: color-mix(in srgb, var(--cyan) 70%, transparent);
}

.profile-streak-pip.is-filled .profile-streak-pip-reward {
  opacity: 1;
  color: #fff;
}

.profile-streak-pip.is-current {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cyan) 45%, transparent);
}

.profile-crystals-tip {
  margin: 0;
  opacity: 0.78;
  line-height: 1.45;
  font-size: 0.95rem;
}

.profile-crystals-admin {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.2rem;
  padding-top: 0.7rem;
  border-top: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

.profile-crystals-admin-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.profile-crystals-admin-input {
  width: 5.5rem;
  min-width: 4.5rem;
  flex: 0 0 auto;
}

.profile-crystals-admin-btn {
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0;
  white-space: nowrap;
}

.profile-crystals-admin-row > .btn-shell {
  flex: 0 0 auto;
  width: auto;
}

.profile-crystals-admin-status {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.85;
}

@media (max-width: 520px) {
  .profile-crystals-admin-row {
    flex-wrap: wrap;
  }
}

.profile-avatar-preview-host {
  display: grid;
  place-items: center;
  padding: 0.2rem 0 0.35rem;
  gap: 0.55rem;
}

.profile-avatar-preview-bundle {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: 100%;
}

.profile-title-preview {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(100%, 22rem);
  z-index: 1;
}

.profile-title-identity {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 100%;
}

.profile-title-row {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  max-width: 100%;
  min-width: 0;
}

.profile-title-icon {
  display: inline-grid;
  place-items: center;
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  color: inherit;
  align-self: center;
  overflow: visible;
}

.profile-title-icon svg {
  width: 100%;
  height: 100%;
  transform: none;
  transform-origin: center;
}

.profile-title-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 2.6vw, 1.15rem);
  font-weight: inherit;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.profile-avatar-nick {
  margin: 0;
  max-width: min(100%, 12rem);
  width: auto;
  text-align: right;
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 2.6vw, 1.15rem);
  line-height: 1.25;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
  white-space: normal;
  text-shadow:
    0 0 14px rgba(155, 116, 238, 0.24),
    0 0 24px rgba(124, 198, 255, 0.12);
}

.profile-title-rarity-common {
  color: #d2c4ee;
}

.profile-title-rarity-unique {
  color: #9fd4b0;
}

.profile-title-rarity-rare {
  color: #7eb4ef;
}

.profile-title-rarity-mythic {
  color: #c4a8e8;
  text-shadow: 0 0 12px rgba(196, 168, 232, 0.32);
}

.profile-title-rarity-epic {
  color: #e8a8a8;
  text-shadow:
    0 0 12px rgba(232, 168, 168, 0.45),
    0 0 22px rgba(232, 168, 168, 0.22);
}

.profile-title-rarity-legendary {
  color: #e8c878;
  text-shadow:
    0 0 12px rgba(232, 200, 120, 0.45),
    0 0 22px rgba(232, 200, 120, 0.22);
}

.profile-title-rarity-sacral {
  color: #f2f0e8;
  text-shadow:
    0 0 10px rgba(255, 248, 220, 0.7),
    0 0 22px rgba(255, 236, 180, 0.45),
    0 0 36px rgba(255, 220, 140, 0.28);
}

/* Грейд singular — без общего цвета; цвет задаёт конкретный титул (напр. Создатель). */
.profile-title-rarity-singular {
  color: #e8e8ea;
}

.profile-title-label.profile-title-id-creator,
.profile-title-option-name.profile-title-id-creator {
  color: #ffffff;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.85),
    0 0 22px rgba(255, 255, 255, 0.45),
    0 0 36px rgba(240, 245, 255, 0.3);
}

.profile-title-sparks {
  inset: -8% -4% -18%;
}

.profile-avatar-preview-bundle.is-legendary-title .profile-title-sparks,
.profile-avatar-preview-bundle.is-epic-title .profile-title-sparks,
.profile-avatar-preview-bundle.is-mythic-title .profile-title-sparks,
.profile-avatar-preview-bundle.is-sacral-title .profile-title-sparks,
.profile-avatar-preview-bundle.is-singular-title .profile-title-sparks,
.profile-title-preview.is-legendary .profile-title-sparks,
.profile-title-preview.is-epic .profile-title-sparks,
.profile-title-preview.is-mythic .profile-title-sparks,
.profile-title-preview.is-sacral .profile-title-sparks,
.profile-title-preview.is-singular .profile-title-sparks {
  display: block;
}

.profile-title-preview.is-mythic .profile-title-sparks .mode-title-spark {
  background: rgba(224, 208, 255, 0.9);
  box-shadow: 0 0 8px rgba(180, 150, 230, 0.55);
}

.profile-title-preview.is-epic .profile-title-sparks .mode-title-spark {
  background: rgba(246, 210, 210, 0.92);
  box-shadow: 0 0 8px rgba(232, 168, 168, 0.55);
}

.profile-title-preview.is-legendary .profile-title-sparks .mode-title-spark {
  background: rgba(246, 230, 180, 0.92);
  box-shadow: 0 0 8px rgba(232, 200, 120, 0.55);
}

.profile-title-preview.is-sacral .profile-title-sparks .mode-title-spark {
  background: rgba(255, 250, 230, 0.95);
  box-shadow: 0 0 10px rgba(255, 236, 180, 0.7);
}

.profile-title-preview.is-singular.is-creator .profile-title-sparks .mode-title-spark,
.profile-title-preview.is-creator .profile-title-sparks .mode-title-spark {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
}

.profile-avatar-nick.is-legendary-nick-glow,
.profile-title-preview.is-legendary .profile-avatar-nick,
.profile-title-preview.is-epic .profile-avatar-nick,
.profile-title-preview.is-sacral .profile-avatar-nick,
.profile-title-preview.is-singular .profile-avatar-nick {
  animation: profileLegendaryNickPulse 2.8s ease-in-out infinite;
}

.profile-title-preview.is-legendary .profile-avatar-nick,
.profile-avatar-nick.is-legendary-nick-glow {
  text-shadow:
    0 0 10px rgba(232, 200, 120, 0.7),
    0 0 22px rgba(232, 200, 120, 0.42),
    0 0 36px rgba(255, 220, 140, 0.28);
}

.profile-title-preview.is-epic .profile-avatar-nick {
  text-shadow:
    0 0 10px rgba(232, 168, 168, 0.7),
    0 0 22px rgba(232, 168, 168, 0.42),
    0 0 36px rgba(255, 200, 200, 0.28);
}

.profile-title-preview.is-sacral .profile-avatar-nick {
  text-shadow:
    0 0 12px rgba(255, 250, 230, 0.85),
    0 0 24px rgba(255, 236, 180, 0.55),
    0 0 40px rgba(255, 220, 140, 0.35);
}

/* Создатель: ярко-белый ник + эффекты легендарки в белых тонах */
.profile-title-preview.is-creator .profile-avatar-nick {
  color: #ffffff !important;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 255, 255, 0.55),
    0 0 40px rgba(230, 240, 255, 0.35);
}

.profile-title-preview.is-legendary .profile-title-identity,
.profile-title-preview.is-sacral .profile-title-identity,
.profile-title-preview.is-singular .profile-title-identity {
  position: relative;
  padding-bottom: 0.35rem;
  animation: profileLegendaryTitleFloat 3.4s ease-in-out infinite;
}

.profile-title-preview.is-singular .profile-title-identity.has-identity-frame {
  padding: 0.1rem 0.28rem 0.12rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 0.35rem;
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.24),
    0 0 20px rgba(230, 240, 255, 0.12),
    inset 0 0 10px rgba(255, 255, 255, 0.06);
  background: color-mix(in srgb, #ffffff 5%, transparent);
}

.profile-title-preview.is-legendary .profile-title-identity::after,
.profile-title-preview.is-sacral .profile-title-identity::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 1px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(232, 200, 120, 0.18) 18%,
    rgba(246, 230, 180, 0.72) 50%,
    rgba(232, 200, 120, 0.18) 82%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(232, 200, 120, 0.28);
  pointer-events: none;
}

.profile-title-preview.is-sacral .profile-title-identity::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 248, 220, 0.2) 18%,
    rgba(255, 250, 235, 0.85) 50%,
    rgba(255, 248, 220, 0.2) 82%,
    transparent 100%
  );
  box-shadow: 0 0 10px rgba(255, 240, 200, 0.4);
}

/* Уникальный: рамка вместо нижней черты */
.profile-title-preview.is-singular .profile-title-identity::after {
  content: none;
}

.profile-title-icon .profile-title-sacral-light {
  display: block;
  width: 1.15em;
  height: 1.15em;
  overflow: visible;
  filter: drop-shadow(0 0 6px rgba(255, 240, 200, 0.55));
}

.profile-title-icon .profile-title-hope-star {
  display: block;
  width: 1.2em;
  height: 1.2em;
  overflow: visible;
  color: #ffffff;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.75));
  transform-origin: center;
  animation: profileHopeStarSpin 14s linear infinite;
}

.profile-title-icon .profile-title-hope-star .hope-star-halo {
  opacity: 0.28;
  transform-origin: 12px 12px;
  animation: profileHopeStarHaloPulse 2.8s ease-in-out infinite;
}

.profile-title-icon .profile-title-hope-star .hope-star-core {
  opacity: 0.98;
  transform-origin: 12px 12px;
  animation: profileHopeStarCorePulse 2.2s ease-in-out infinite;
}

.profile-title-icon .profile-title-sacral-light .sacral-halo {
  opacity: 0.18;
  transform-origin: 12px 12px;
  animation: profileSacralHaloPulse 2.6s ease-in-out infinite;
}

.profile-title-icon .profile-title-sacral-light .sacral-mid {
  opacity: 0.42;
  transform-origin: 12px 12px;
  animation: profileSacralMidPulse 2.2s ease-in-out infinite;
}

.profile-title-icon .profile-title-sacral-light .sacral-core {
  opacity: 0.95;
  transform-origin: 12px 12px;
  animation: profileSacralCorePulse 1.8s ease-in-out infinite;
}

.profile-title-icon .profile-title-sacral-light .sacral-rays {
  transform-origin: 12px 12px;
  animation: profileSacralRaysSpin 9s linear infinite;
  opacity: 0.72;
}

@keyframes profileSacralHaloPulse {
  0%,
  100% {
    opacity: 0.14;
    transform: scale(0.92);
  }
  50% {
    opacity: 0.28;
    transform: scale(1.08);
  }
}

@keyframes profileSacralMidPulse {
  0%,
  100% {
    opacity: 0.34;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.06);
  }
}

@keyframes profileSacralCorePulse {
  0%,
  100% {
    opacity: 0.88;
    transform: scale(0.94);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@keyframes profileSacralRaysSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes profileHopeStarSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes profileHopeStarHaloPulse {
  0%,
  100% {
    opacity: 0.18;
    transform: scale(0.94);
  }
  50% {
    opacity: 0.4;
    transform: scale(1.12);
  }
}

@keyframes profileHopeStarCorePulse {
  0%,
  100% {
    opacity: 0.9;
    transform: scale(0.96);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes profileLegendaryNickPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .profile-title-preview.is-legendary .profile-title-identity,
  .profile-title-preview.is-sacral .profile-title-identity,
  .profile-title-preview.is-singular .profile-title-identity {
    animation: none;
  }

  .profile-avatar-nick.is-legendary-nick-glow,
  .profile-title-preview.is-legendary .profile-avatar-nick,
  .profile-title-preview.is-epic .profile-avatar-nick,
  .profile-title-preview.is-sacral .profile-avatar-nick,
  .profile-title-preview.is-singular .profile-avatar-nick {
    animation: none;
  }

  .profile-title-icon .profile-title-sacral-light .sacral-halo,
  .profile-title-icon .profile-title-sacral-light .sacral-mid,
  .profile-title-icon .profile-title-sacral-light .sacral-core,
  .profile-title-icon .profile-title-sacral-light .sacral-rays,
  .profile-title-icon .profile-title-hope-star,
  .profile-title-icon .profile-title-hope-star .hope-star-halo,
  .profile-title-icon .profile-title-hope-star .hope-star-core {
    animation: none;
  }
}

.profile-title-option-thumb,
.profile-title-option-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: inherit;
}

.profile-title-option-thumb svg,
.profile-title-option-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.profile-avatar-preview {
  position: relative;
  width: clamp(78px, 15vw, 100px);
  height: clamp(78px, 15vw, 100px);
  border-radius: 28%;
  overflow: visible;
}

/* Общая particle-подложка (меню / аватар / чат). */
.particle-substrate {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.particle-substrate-wash {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 16% 22%, rgba(157, 124, 255, 0.36), rgba(157, 124, 255, 0) 44%),
    radial-gradient(circle at 84% 78%, rgba(94, 206, 255, 0.32), rgba(94, 206, 255, 0) 48%),
    linear-gradient(140deg, rgba(73, 44, 142, 0.72), rgba(44, 91, 160, 0.54), rgba(87, 44, 138, 0.72));
}

.particle-substrate .mode-card-inner-fx,
.particle-substrate .particle-substrate-fx {
  /* Без hover-morph карточки — стабильная видимость партиклов. */
  opacity: 0.68;
  z-index: 1;
}

.particle-substrate--avatar .particle-substrate-wash {
  /* Цвета из --avatar-wash-* на .profile-avatar-preview (по avatarColor). */
  background:
    radial-gradient(
      circle at 30% 24%,
      var(--avatar-wash-a, rgba(170, 140, 255, 0.4)),
      transparent 46%
    ),
    radial-gradient(
      circle at 78% 72%,
      var(--avatar-wash-b, rgba(110, 210, 255, 0.34)),
      transparent 50%
    ),
    linear-gradient(
      145deg,
      var(--avatar-wash-base-1, rgba(58, 36, 110, 0.88)),
      var(--avatar-wash-base-2, rgba(28, 58, 108, 0.78)),
      var(--avatar-wash-base-3, rgba(62, 34, 104, 0.9))
    );
}

.particle-substrate--avatar .mode-card-inner-fx {
  opacity: 0.78;
}

/* Окно в единый shared-particle-field (кнопки / аватар / mode-card). */
.shared-particle-port,
.profile-avatar-particle-port,
.mode-card-particle-port {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.shared-particle-port-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 1;
}

/* Медиа-лицо карты/рубашки: партиклы под SVG/PNG. */
.particle-media-face {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  isolation: isolate;
}

.profile-pack-thumb-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

/* Подложка строго в слоте превью (не уезжает от JS-позиционирования). */
.profile-pack-thumb-face > .particle-substrate,
.profile-pack-thumb-face > .particle-media-face-port,
.profile-pack-gallery-card-face > .particle-substrate,
.profile-pack-gallery-card-face > .particle-media-face-port {
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.particle-media-face-port,
.particle-media-wash-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.particle-media-face-img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}

.profile-grid-picker--card .particle-media-face-img,
.profile-grid-picker-overlay--card .particle-media-face-img {
  position: absolute;
  inset: 0;
  object-fit: contain;
  object-position: center center;
}

.particle-media-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.card-back.has-particle-media,
.card-front.has-particle-media {
  background-image: none !important;
  background-color: rgba(16, 12, 28, 0.45);
}

.card-back.has-particle-media .card-title-overlay,
.card-front.has-particle-media .card-title-overlay {
  z-index: 3;
}

.profile-avatar-particle-port {
  z-index: 1;
  border-radius: inherit;
}

.mode-card > .mode-card-particle-port {
  z-index: 1;
  clip-path: inherit;
  -webkit-clip-path: inherit;
}

.particle-substrate--shared {
  position: absolute;
  inset: 0;
  border-radius: 18px;
}

.avatar-stage {
  position: relative;
  isolation: isolate;
}

.avatar-stage > .particle-substrate--shared {
  z-index: 0;
}

.avatar-stage > .avatar-stage-slots {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.profile-avatar-preview-img,
.profile-avatar-preview-3d {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: block;
  box-shadow: 0 0 18px rgba(170, 140, 255, 0.28);
}

.profile-avatar-preview-img {
  object-fit: cover;
}

.profile-avatar-preview-3d {
  overflow: hidden;
  background: transparent;
}

.profile-avatar-preview-3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.profile-avatar-thumb--3d {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 0 2px;
  box-sizing: border-box;
}

.profile-avatar-3d-badge {
  flex: 0 0 auto;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  color: color-mix(in srgb, var(--cyan) 72%, #fff);
  text-shadow: 0 0 8px rgba(120, 200, 255, 0.35);
}

.profile-avatar-thumb--3d .profile-pack-thumb-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.profile-grid-picker-preview:has(.profile-avatar-thumb--3d),
.profile-grid-picker-option-thumb:has(.profile-avatar-thumb--3d) {
  width: 72px;
}

.profile-avatar-preview-fx {
  position: absolute;
  inset: -8%;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
}

.profile-avatar-spark {
  --spark-size: 4.2px;
  position: absolute;
  width: var(--spark-size);
  height: var(--spark-size);
  border-radius: 50%;
  background: rgba(255, 248, 255, 0.94);
  box-shadow:
    0 0 5px rgba(235, 220, 255, 0.85),
    0 0 11px rgba(190, 170, 255, 0.55),
    0 0 18px rgba(150, 210, 255, 0.32);
  opacity: 0;
  transform: translate(-50%, -50%);
}

.profile-avatar-preview.frame-sparks .profile-avatar-spark {
  --tx: 0px;
  --delay: 0ms;
  --dur: 3200ms;
  animation: profileAvatarSparkFall var(--dur) ease-out var(--delay) infinite;
}

.profile-avatar-rays {
  position: absolute;
  inset: -36%;
  pointer-events: none;
  overflow: visible;
  animation: profileAvatarRaysSpin 78s linear infinite;
}

/* Лучики света — поверх аватара. */
.profile-avatar-rays--over {
  z-index: 3;
}

/* Сияние — те же лучи, но под particle-подложкой. */
.profile-avatar-rays--under {
  z-index: 0;
}

.profile-avatar-rays-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 72%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(235, 220, 255, 0.55), rgba(180, 160, 255, 0.22) 42%, transparent 72%),
    radial-gradient(circle at 50% 58%, rgba(150, 210, 255, 0.28), transparent 60%);
  filter: blur(14px);
  animation: profileAvatarRaysGlow 3.6s ease-in-out infinite;
}

.profile-avatar-ray {
  --a: 0deg;
  --ray-len: 46%;
  --ray-w: 12px;
  --ray-delay: 0s;
  --ray-opacity: 0.65;
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--ray-w);
  height: var(--ray-len);
  margin-left: calc(var(--ray-w) / -2);
  transform-origin: 50% 0;
  transform: rotate(var(--a));
  border-radius: 999px;
  background: linear-gradient(
    to bottom,
    rgba(245, 235, 255, 0.75) 0%,
    rgba(200, 180, 255, 0.42) 28%,
    rgba(160, 200, 255, 0.16) 62%,
    transparent 100%
  );
  filter: blur(5.5px);
  opacity: var(--ray-opacity);
  animation: profileAvatarRayPulse 4.2s ease-in-out var(--ray-delay) infinite;
}

.profile-avatar-preview.frame-rays .profile-avatar-preview-img,
.profile-avatar-preview.frame-rays .profile-avatar-preview-3d,
.profile-avatar-preview.frame-shine .profile-avatar-preview-img,
.profile-avatar-preview.frame-shine .profile-avatar-preview-3d {
  box-shadow:
    0 0 16px rgba(220, 200, 255, 0.42),
    0 0 36px rgba(160, 190, 255, 0.28);
}

.profile-avatar-preview.frame-glow::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: inherit;
  background: radial-gradient(
    circle at 50% 48%,
    rgba(235, 220, 255, 0.62),
    rgba(190, 170, 255, 0.38) 38%,
    rgba(150, 180, 255, 0.16) 62%,
    transparent 78%
  );
  filter: blur(18px);
  opacity: 0.92;
  z-index: 0;
  pointer-events: none;
  animation: profileAvatarGlowSoft 3.2s ease-in-out infinite;
}

.profile-avatar-preview.frame-glow .profile-avatar-preview-img,
.profile-avatar-preview.frame-glow .profile-avatar-preview-3d {
  box-shadow:
    0 0 10px rgba(230, 210, 255, 0.48),
    0 0 22px rgba(190, 160, 255, 0.32),
    0 0 36px rgba(160, 180, 255, 0.18);
  animation: none;
}

.profile-avatar-preview.frame-orbit .profile-avatar-orbit-spark {
  top: 50%;
  left: 50%;
  opacity: 0.78;
  --spark-size: 3px;
  width: var(--spark-size);
  height: var(--spark-size);
  animation: profileAvatarOrbitChaos var(--orbit-dur, 12s) ease-in-out var(--orbit-delay, 0s) infinite;
}

@keyframes profileAvatarSparkFall {
  0% {
    transform: translate(-50%, -50%) translate(0, -2px) scale(0.75);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translate(var(--tx, 0px), 22px) scale(0.35);
    opacity: 0;
  }
}

@keyframes profileAvatarRaysSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes profileAvatarRaysGlow {
  0%,
  100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.06);
  }
}

@keyframes profileAvatarRayPulse {
  0%,
  100% {
    opacity: calc(var(--ray-opacity) * 0.72);
    filter: blur(3.5px);
  }
  50% {
    opacity: var(--ray-opacity);
    filter: blur(2.6px);
  }
}

@keyframes profileAvatarGlow {
  0%,
  100% {
    filter: brightness(1);
    opacity: 0.92;
  }
  50% {
    filter: brightness(1.18);
    opacity: 1;
  }
}

@keyframes profileAvatarGlowSoft {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes profileAvatarOrbitChaos {
  0% {
    transform:
      rotate(var(--orbit-start, 0deg))
      translateX(var(--orbit-r, 52px))
      translateY(0)
      scale(0.85);
    opacity: 0.25;
  }
  18% {
    opacity: 0.9;
  }
  35% {
    transform:
      rotate(calc(var(--orbit-start, 0deg) + 110deg))
      translateX(calc(var(--orbit-r, 52px) + var(--wobble, 10px)))
      translateY(calc(var(--wobble, 10px) * -0.35))
      scale(1);
  }
  62% {
    transform:
      rotate(calc(var(--orbit-start, 0deg) + 230deg))
      translateX(calc(var(--orbit-r, 52px) - var(--wobble, 10px) * 0.45))
      translateY(calc(var(--wobble, 10px) * 0.4))
      scale(0.75);
    opacity: 0.55;
  }
  100% {
    transform:
      rotate(calc(var(--orbit-start, 0deg) + 360deg))
      translateX(var(--orbit-r, 52px))
      translateY(0)
      scale(0.85);
    opacity: 0.25;
  }
}

.profile-nick-sample {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.4vw, 1.7rem);
}

.profile-grid-picker {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-setting-label {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.78;
}

.profile-grid-picker-trigger {
  appearance: none;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 32%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.profile-grid-picker-preview,
.profile-grid-picker-option-thumb,
.profile-frame-swatch {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg-soft) 90%, #000 10%);
  border: 1px solid color-mix(in srgb, var(--cyan) 20%, transparent);
}

/* Колоды / рубашки — превью как карта (2:3). */
.profile-grid-picker--card .profile-grid-picker-trigger {
  grid-template-columns: 56px 1fr auto;
  min-height: 88px;
}

.profile-grid-picker--card .profile-grid-picker-preview {
  position: relative;
  width: 48px;
  height: 72px;
  border-radius: 7px;
  overflow: hidden;
  border: none;
  background: transparent;
}

.profile-grid-picker--card .profile-grid-picker-option-thumb,
.profile-grid-picker-overlay--card .profile-grid-picker-option-thumb {
  position: relative;
  width: min(100%, 128px);
  /* Сбрасываем квадрат 56×56 из общего .profile-grid-picker-option-thumb */
  height: auto;
  max-height: none;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  display: block;
  border: none;
  background: transparent;
  place-items: unset;
}

/* Явная высота слота (width×1.5) — надёжнее aspect-ratio при absolute-детях. */
.profile-grid-picker--card .profile-grid-picker-option-thumb::before,
.profile-grid-picker-overlay--card .profile-grid-picker-option-thumb::before {
  content: "";
  display: block;
  width: 100%;
  padding-top: 150%;
  pointer-events: none;
}

.profile-grid-picker--card .profile-grid-picker-grid,
.profile-grid-picker-overlay--card .profile-grid-picker-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.profile-pack-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.profile-grid-picker--card .profile-pack-thumb-img,
.profile-grid-picker-overlay--card .profile-pack-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

/* Long-press колоды/рубашки: не давать браузеру «Сохранить изображение» */
.profile-grid-picker-option-thumb img,
.profile-grid-picker-option-thumb .particle-media-face-img,
.profile-grid-picker-preview img,
.profile-grid-picker-preview .particle-media-face-img {
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.profile-pack-thumb-fallback {
  font-size: 0.95rem;
  opacity: 0.85;
}

.profile-frame-swatch.frame-sparks {
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 245, 255, 0.95), transparent 36%),
    radial-gradient(circle at 78% 30%, rgba(180, 210, 255, 0.7), transparent 40%),
    radial-gradient(circle at 50% 82%, rgba(210, 180, 255, 0.55), transparent 42%),
    linear-gradient(140deg, #5a4578, #3d2f5c);
}

.profile-frame-swatch.frame-rays {
  background:
    radial-gradient(circle at 50% 50%, rgba(240, 230, 255, 0.7), transparent 42%),
    repeating-conic-gradient(
      from 8deg,
      rgba(220, 200, 255, 0.55) 0 6deg,
      transparent 6deg 36deg
    ),
    #3d2f5c;
}

.profile-frame-swatch.frame-shine {
  background:
    radial-gradient(circle at 50% 50%, rgba(240, 230, 255, 0.5), transparent 50%),
    repeating-conic-gradient(
      from 18deg,
      rgba(170, 200, 255, 0.38) 0 5deg,
      transparent 5deg 40deg
    ),
    #2a3558;
}

.profile-frame-swatch.frame-glow {
  box-shadow:
    inset 0 0 14px rgba(230, 210, 255, 0.85),
    0 0 10px rgba(190, 160, 255, 0.55);
  background: #7a62a4;
}

.profile-frame-swatch.frame-orbit {
  background:
    radial-gradient(circle at 50% 50%, #cbb6ef 0 14%, transparent 16%),
    radial-gradient(circle at 78% 28%, #fff 0 5%, transparent 7%),
    radial-gradient(circle at 22% 68%, rgba(180, 220, 255, 0.9) 0 4%, transparent 6%),
    #4a3968;
}

.profile-frame-swatch.frame-none {
  background: #46375f;
}

.profile-grid-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(6, 4, 14, 0.55);
  backdrop-filter: blur(6px);
}

/* display:grid иначе перебивает [hidden] и все пикеры лежат друг на друге */
.profile-grid-picker-overlay[hidden] {
  display: none !important;
}

.profile-grid-picker-panel {
  width: min(560px, 100%);
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 92%, #120d1f);
  padding: 0.85rem;
  animation: profilePickerIn 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.profile-grid-picker-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.profile-grid-picker-scroll-viewport {
  flex: 1 1 auto;
  min-height: 0;
  /* Явный потолок: иначе height:100% не срабатывает при height:auto у панели
     и контент просто клипится без overflow → кастомный rail не появляется. */
  max-height: min(calc(78vh - 5.5rem), 560px);
}

@keyframes profilePickerIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.profile-grid-picker-panel-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  flex: 0 0 auto;
  text-align: center;
}

.profile-grid-picker-panel-title {
  font: inherit;
  line-height: 1.2;
  text-align: center;
}

.profile-grid-picker-panel-hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0.72;
}

.profile-grid-picker-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}

.profile-grid-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  min-width: 0;
  overflow-x: hidden;
}

.profile-grid-picker-option {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  border-radius: 14px;
  color: inherit;
  font: inherit;
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  align-content: start;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.profile-grid-picker-overlay--card .profile-grid-picker-option {
  overflow: visible;
}

.profile-grid-picker-option.is-active {
  border-color: color-mix(in srgb, var(--cyan) 65%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cyan) 35%, transparent);
}

.profile-grid-picker-option.is-locked {
  position: relative;
}

.profile-grid-picker-option.is-locked .profile-grid-picker-option-thumb {
  filter: grayscale(0.55) brightness(0.72);
  opacity: 0.78;
}

.profile-grid-picker-lock {
  /* Flat-top hex: боковые «шапки» фиксированы, верх/низ растягиваются с суммой */
  --lock-hex-cap: 0.58rem;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  box-sizing: border-box;
  min-width: calc(2 * var(--lock-hex-cap) + 0.85em);
  min-height: 1.85rem;
  height: auto;
  width: max-content;
  /* Боковой padding ≥ cap, чтобы цифры не заходили на скосы */
  padding: 0.28rem calc(var(--lock-hex-cap) + 0.22rem) 0.18rem;
  display: inline-grid;
  place-items: center;
  border: none;
  border-radius: 0;
  font-family: var(--font-currency);
  font-size: clamp(1.2rem, 3.4vw, 1.55rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #f4eefc;
  background: color-mix(in srgb, #1a1230 72%, var(--cyan) 28%);
  clip-path: polygon(
    var(--lock-hex-cap) 0%,
    calc(100% - var(--lock-hex-cap)) 0%,
    100% 50%,
    calc(100% - var(--lock-hex-cap)) 100%,
    var(--lock-hex-cap) 100%,
    0% 50%
  );
  /* border/box-shadow clip-path обрезает — контур и тень через drop-shadow */
  filter:
    drop-shadow(0 0 0.6px color-mix(in srgb, var(--cyan) 55%, transparent))
    drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

html[data-design="classic"] .profile-grid-picker-lock,
html[data-theme="classic"] .profile-grid-picker-lock,
body.design-classic .profile-grid-picker-lock {
  border-radius: 0;
  background: color-mix(in srgb, #1a1230 68%, var(--cyan) 32%);
  filter:
    drop-shadow(0 0 0.55px color-mix(in srgb, var(--cyan) 50%, transparent))
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.32));
}

/* Окно подтверждения покупки / unlock / мудрость ворона */
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding:
    max(16px, calc(env(safe-area-inset-top, 0px) + 12px))
    max(16px, calc(env(safe-area-inset-right, 0px) + 12px))
    max(16px, calc(env(safe-area-inset-bottom, 0px) + 12px))
    max(16px, calc(env(safe-area-inset-left, 0px) + 12px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: color-mix(in srgb, #080616 62%, transparent);
  opacity: 0;
  transition: opacity 180ms ease;
}

.app-confirm-overlay.is-open {
  opacity: 1;
}

.app-confirm-panel {
  width: min(100%, 380px);
  max-height: min(80vh, 80dvh, 80svh);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.15rem 1.2rem 1.1rem;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 88%, #120c22 12%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-confirm-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.2vw, 1.45rem);
  letter-spacing: 0.02em;
  text-align: center;
}

.app-confirm-panel.is-title-center .app-confirm-title {
  text-align: center;
}

.app-confirm-overlay.is-locked {
  cursor: default;
}

.app-confirm-message {
  margin: 0;
  white-space: pre-line;
  line-height: 1.45;
  opacity: 0.88;
  font-size: 0.98rem;
  text-align: center;
}

.app-confirm-input-wrap {
  display: grid;
  gap: 0.45rem;
}

.app-confirm-input-label {
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  opacity: 0.78;
  text-align: center;
}

.app-confirm-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.72rem 0.85rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 34%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
  color: inherit;
  font: inherit;
  font-size: 1rem;
  outline: none;
}

.app-confirm-input:focus {
  border-color: color-mix(in srgb, var(--cyan) 62%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cyan) 28%, transparent);
}

.app-confirm-input-error {
  margin: 0;
  font-size: 0.85rem;
  color: color-mix(in srgb, #ffb4b4 80%, var(--text) 20%);
  text-align: center;
}

.app-confirm-input-wrap.is-invalid .app-confirm-input {
  border-color: color-mix(in srgb, #ff8a9a 55%, transparent);
}

.app-confirm-choices {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.app-confirm-choice-group {
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  overflow: hidden;
}

.app-confirm-choice-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.app-confirm-choice-group-head::-webkit-details-marker {
  display: none;
}

.app-confirm-choice-group-head .app-confirm-choice-group-master-input {
  flex: 0 0 auto;
}

.app-confirm-choice-group-title {
  flex: 1 1 auto;
  min-width: 0;
}

.app-confirm-choice-group-caret {
  flex: 0 0 auto;
  margin-left: auto;
  opacity: 0.7;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform 280ms ease;
}

.app-confirm-choice-group[open] .app-confirm-choice-group-caret {
  transform: rotate(180deg);
}

.app-confirm-choice-group-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 0.55rem 0.55rem;
}

.app-confirm-choice-group-body .app-confirm-choice {
  background: color-mix(in srgb, var(--bg) 35%, transparent);
}

.app-confirm-choice-group-body .app-confirm-choice-input:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.app-confirm-choice-group:has(.app-confirm-choice-group-master-input:checked) {
  border-color: color-mix(in srgb, var(--cyan) 55%, transparent);
  background: color-mix(in srgb, var(--cyan) 12%, var(--bg-soft));
}

.app-confirm-choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
  cursor: pointer;
  user-select: none;
}

.app-confirm-choice:has(.app-confirm-choice-input:checked) {
  border-color: color-mix(in srgb, var(--cyan) 55%, transparent);
  background: color-mix(in srgb, var(--cyan) 12%, var(--bg-soft));
}

.app-confirm-choice-input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--cyan);
  flex: 0 0 auto;
  cursor: pointer;
}

.app-confirm-choice-label {
  font-size: 0.98rem;
  line-height: 1.25;
}

.app-confirm-actions .primary-button:disabled,
.app-confirm-actions .primary-button:disabled .app-button-label {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.app-confirm-actions .primary-button,
.app-confirm-actions .ghost-button {
  flex: 1 1 8rem;
}

.app-confirm-actions.is-single {
  justify-content: center;
  margin-top: 0.55rem;
}

.app-confirm-actions.is-single .primary-button,
.app-confirm-actions.is-single > .btn-shell {
  flex: 0 0 auto;
  width: min(100%, 18rem);
  min-width: 11rem;
}

.app-confirm-panel.is-alert .app-confirm-actions.is-single {
  justify-content: center;
}

/* ACK в «Мудрость Ворона» и др. alert — чуть крупнее обычной primary, без xl */
.app-confirm-panel.is-alert .app-confirm-actions .app-button {
  --btn-font-size: clamp(1.05rem, 3.2vw, 1.35rem);
  font-size: var(--btn-font-size);
  min-height: 2.85rem;
  padding: 0.7rem 1.2rem;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .app-confirm-overlay {
    padding:
      max(12px, calc(env(safe-area-inset-top, 0px) + 10px))
      max(12px, calc(env(safe-area-inset-right, 0px) + 10px))
      max(20px, calc(env(safe-area-inset-bottom, 0px) + 16px))
      max(12px, calc(env(safe-area-inset-left, 0px) + 10px));
    align-content: center;
  }

  .app-confirm-panel {
    width: min(100%, 360px);
    max-height: min(78svh, 78dvh, 78vh);
    padding: 1rem 1.05rem 0.95rem;
  }

  .app-confirm-message {
    font-size: 0.92rem;
  }
}

html[data-design="classic"] .app-confirm-panel,
html[data-theme="classic"] .app-confirm-panel,
body.design-classic .app-confirm-panel,
html[data-design="classic"] .app-confirm-choice,
html[data-theme="classic"] .app-confirm-choice,
body.design-classic .app-confirm-choice,
html[data-design="classic"] .app-confirm-choice-group,
html[data-theme="classic"] .app-confirm-choice-group,
body.design-classic .app-confirm-choice-group {
  border-radius: 8px;
}

.profile-grid-picker-option-label {
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.2;
  opacity: 0.88;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.profile-grid-picker-option-subtitle {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
  opacity: 0.72;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Пикер титулов: имя как ник (display), крупнее; подпись редкости; цветная подложка */
.profile-grid-picker-option-label.profile-title-option-name {
  font-family: var(--font-display);
  font-size: clamp(0.92rem, 2.5vw, 1.12rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 1;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.profile-grid-picker-option-subtitle.profile-title-option-rarity {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.82;
}

.profile-grid-picker-option-thumb.profile-title-option-face {
  position: relative;
  color: inherit;
}

.profile-grid-picker-option-thumb.profile-title-option-face .profile-title-option-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 62%;
  height: 62%;
}

.profile-grid-picker-option-thumb.profile-title-option-face .profile-title-option-icon svg {
  width: 100%;
  height: 100%;
}

.profile-title-option-sparks {
  display: block;
  inset: -8% -2% -14%;
  z-index: 0;
}

.profile-grid-picker-option.is-title-fx {
  position: relative;
  overflow: hidden;
}

.profile-grid-picker-option-extra {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.profile-grid-picker-option.is-title-fx .profile-title-option-sparks {
  inset: -6% -4% -10%;
  z-index: 2;
}

.profile-grid-picker-option.is-title-mythic .profile-title-option-sparks .mode-title-spark {
  background: rgba(224, 208, 255, 0.92);
  box-shadow: 0 0 8px rgba(180, 150, 230, 0.55);
}

.profile-grid-picker-option.is-title-epic .profile-title-option-sparks .mode-title-spark {
  background: rgba(246, 210, 210, 0.92);
  box-shadow: 0 0 8px rgba(232, 168, 168, 0.55);
}

.profile-grid-picker-option.is-title-legendary .profile-title-option-sparks .mode-title-spark {
  background: rgba(246, 230, 180, 0.92);
  box-shadow: 0 0 8px rgba(232, 200, 120, 0.55);
}

.profile-grid-picker-option.is-title-sacral .profile-title-option-sparks .mode-title-spark {
  background: rgba(255, 250, 230, 0.95);
  box-shadow: 0 0 10px rgba(255, 236, 180, 0.7);
}

.profile-grid-picker-option.is-title-creator .profile-title-option-sparks .mode-title-spark {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
}

.profile-grid-picker-option.is-title-epic .profile-title-option-name {
  text-shadow:
    0 0 10px rgba(232, 168, 168, 0.55),
    0 0 18px rgba(232, 168, 168, 0.28);
}

.profile-grid-picker-option.is-title-legendary .profile-title-option-name {
  text-shadow:
    0 0 10px rgba(232, 200, 120, 0.55),
    0 0 18px rgba(232, 200, 120, 0.28);
}

.profile-grid-picker-option.is-title-sacral .profile-title-option-name {
  text-shadow:
    0 0 12px rgba(255, 248, 220, 0.7),
    0 0 22px rgba(255, 236, 180, 0.4);
}

.profile-grid-picker-option.is-title-creator .profile-title-option-name {
  color: #ffffff;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.85),
    0 0 22px rgba(255, 255, 255, 0.45);
}

.profile-grid-picker-option.is-title-epic {
  box-shadow: 0 0 16px color-mix(in srgb, #e8a8a8 22%, transparent);
}

.profile-grid-picker-option.is-title-legendary {
  box-shadow: 0 0 16px color-mix(in srgb, #e8c878 22%, transparent);
  animation: profileLegendaryTitleFloat 3.4s ease-in-out infinite;
}

.profile-grid-picker-option.is-title-sacral {
  box-shadow: 0 0 18px color-mix(in srgb, #f2f0e8 28%, transparent);
  animation: profileLegendaryTitleFloat 3.4s ease-in-out infinite;
}

.profile-grid-picker-option.is-title-singular,
.profile-grid-picker-option.is-title-creator {
  box-shadow: 0 0 18px color-mix(in srgb, #ffffff 30%, transparent);
  animation: profileLegendaryTitleFloat 3.4s ease-in-out infinite;
  border-color: color-mix(in srgb, #ffffff 40%, transparent);
}

.profile-grid-picker-option.is-title-sacral .profile-title-option-icon .profile-title-sacral-light {
  width: 70%;
  height: 70%;
}

.profile-grid-picker-option.is-title-creator .profile-title-option-icon .profile-title-hope-star {
  width: 72%;
  height: 72%;
  color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .profile-grid-picker-option.is-title-legendary,
  .profile-grid-picker-option.is-title-sacral,
  .profile-grid-picker-option.is-title-singular,
  .profile-grid-picker-option.is-title-creator {
    animation: none;
  }
}

.profile-grid-picker-option-thumb.profile-title-rarity-common {
  background: color-mix(in srgb, #d2c4ee 34%, var(--bg-soft) 66%);
  border-color: color-mix(in srgb, #d2c4ee 52%, transparent);
  color: #e6dcf8;
}

.profile-grid-picker-option-thumb.profile-title-rarity-unique {
  background: color-mix(in srgb, #9fd4b0 36%, var(--bg-soft) 64%);
  border-color: color-mix(in srgb, #9fd4b0 58%, transparent);
  color: #c8edd6;
}

.profile-grid-picker-option-thumb.profile-title-rarity-rare {
  background: color-mix(in srgb, #7eb4ef 42%, var(--bg-soft) 58%);
  border-color: color-mix(in srgb, #7eb4ef 68%, transparent);
  color: #c5dffc;
}

.profile-grid-picker-option-thumb.profile-title-rarity-mythic {
  background: color-mix(in srgb, #c4a8e8 40%, var(--bg-soft) 60%);
  border-color: color-mix(in srgb, #c4a8e8 66%, transparent);
  color: #e6d8f8;
  box-shadow: 0 0 12px color-mix(in srgb, #c4a8e8 24%, transparent);
}

.profile-grid-picker-option-thumb.profile-title-rarity-epic {
  background: color-mix(in srgb, #e8a8a8 38%, var(--bg-soft) 62%);
  border-color: color-mix(in srgb, #e8a8a8 64%, transparent);
  color: #f6d6d6;
  box-shadow: 0 0 14px color-mix(in srgb, #e8a8a8 28%, transparent);
}

.profile-grid-picker-option-thumb.profile-title-rarity-legendary {
  background: color-mix(in srgb, #e8c878 36%, var(--bg-soft) 64%);
  border-color: color-mix(in srgb, #e8c878 62%, transparent);
  color: #f6e6b4;
  box-shadow: 0 0 14px color-mix(in srgb, #e8c878 28%, transparent);
}

.profile-grid-picker-option-thumb.profile-title-rarity-sacral {
  background: color-mix(in srgb, #f2f0e8 42%, var(--bg-soft) 58%);
  border-color: color-mix(in srgb, #f2f0e8 70%, transparent);
  color: #fffaf0;
  box-shadow: 0 0 16px color-mix(in srgb, #fff4d0 36%, transparent);
}

.profile-grid-picker-option-thumb.profile-title-rarity-singular,
.profile-grid-picker-option-thumb.profile-title-id-creator {
  background: color-mix(in srgb, #ffffff 28%, var(--bg-soft) 72%);
  border-color: color-mix(in srgb, #ffffff 55%, transparent);
  color: #ffffff;
  box-shadow: 0 0 16px color-mix(in srgb, #ffffff 34%, transparent);
}

.profile-grid-picker-option.is-long-pressing {
  position: relative;
}

.profile-grid-picker-option.is-long-pressing::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 6px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cyan) 75%, #fff 10%);
  transform-origin: left center;
  transform: scaleX(0);
  animation: profileLongPressFill var(--long-press-ms, 1500ms) linear forwards;
  pointer-events: none;
}

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

/* Полноэкранный просмотр карты / рубашки (openCardInspect) — всегда в бандле профиля */
.card-inspect-overlay {
  position: fixed;
  inset: 0;
  /* Выше profile-grid-picker-overlay (80), ниже confirm (1200) */
  z-index: 200;
  display: grid;
  place-items: center;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background: rgba(4, 3, 12, 0);
  backdrop-filter: blur(0);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 240ms ease, background 240ms ease, backdrop-filter 240ms ease;
}

.card-inspect-overlay.is-open {
  opacity: 1;
  background: rgba(4, 3, 12, 0.88);
  backdrop-filter: blur(12px);
}

.card-inspect-stage {
  display: grid;
  place-items: center;
  gap: 14px;
  width: min(100%, 420px);
  perspective: 900px;
}

.card-inspect-card {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 3 / 5;
  border-radius: 16px;
  transform-style: preserve-3d;
  transform: translateY(var(--tilt-lift, 0px)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
    scale(calc(0.94 + var(--tilt-depth, 0) * 0.04));
  transition: transform 120ms ease-out, filter 120ms ease-out;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.55));
  cursor: zoom-out;
}

.card-inspect-overlay.is-open .card-inspect-card {
  animation: cardInspectEnter 420ms cubic-bezier(0.2, 0.9, 0.22, 1) both;
}

.card-inspect-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background-color: rgba(16, 12, 28, 0.55);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.card-inspect-face.has-particle-media {
  background-image: none !important;
}

.card-inspect-face .particle-media-art,
.card-inspect-face .particle-media-face-port,
.card-inspect-face .particle-media-wash-host {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.card-inspect-face .particle-media-art {
  z-index: 2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-inspect-face .particle-media-wash-host,
.card-inspect-face .particle-substrate-wash {
  opacity: 0;
}

.card-inspect-caption {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  text-align: center;
  color: #f2ecff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

html.card-inspecting,
body.card-inspecting {
  overflow: hidden !important;
  touch-action: none;
}

@keyframes cardInspectEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(var(--tilt-lift, 0px)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
      scale(calc(1 + var(--tilt-depth, 0) * 0.04));
  }
}

/* Просмотр всех карт колоды (long-press) */
.profile-pack-gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: stretch;
  padding: 0;
  background: rgba(6, 4, 14, 0.72);
  backdrop-filter: blur(8px);
}

.profile-pack-gallery-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: color-mix(in srgb, var(--bg-soft) 94%, #120d1f);
  color: inherit;
}

.profile-pack-gallery-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  flex: 0 0 auto;
  text-align: center;
}

.profile-pack-gallery-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  font-weight: 500;
  text-align: center;
}

.profile-pack-gallery-close {
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font-size: clamp(1.6rem, 6.5vw, 2rem);
  line-height: 1;
  opacity: 0.88;
  cursor: pointer;
  min-width: 48px;
  min-height: 48px;
}

.profile-pack-gallery-scroll {
  flex: 1 1 auto;
  min-height: 0;
}

.profile-pack-gallery-scroll-viewport {
  height: 100%;
  padding: 1rem 1rem 2rem;
}

.profile-pack-gallery-empty {
  margin: 2rem 0;
  text-align: center;
  opacity: 0.75;
}

.profile-pack-gallery-section + .profile-pack-gallery-section {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
}

.profile-pack-gallery-section-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  opacity: 0.9;
}

.profile-pack-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.75rem 0.55rem;
}

.profile-pack-gallery-card {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  cursor: zoom-in;
}

.profile-pack-gallery-card-face {
  position: relative;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
}

.profile-pack-gallery-card-face::before {
  content: "";
  display: block;
  width: 100%;
  padding-top: 150%;
}

.profile-pack-gallery-card-img {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  object-position: center center;
  border-radius: 8px;
  background: transparent;
  display: block;
  pointer-events: none;
}

.profile-pack-gallery-card-face .profile-pack-gallery-card-img {
  position: absolute;
  inset: 0;
  max-width: none;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
}

.profile-pack-gallery-card-caption {
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.2;
  opacity: 0.78;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.profile-pack-gallery-zoom {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: rgba(4, 3, 12, 0.88);
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}

.profile-pack-gallery-zoom[hidden] {
  display: none !important;
}

.profile-pack-gallery-zoom-img {
  width: min(100%, 420px);
  max-height: min(78vh, 720px);
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.profile-pack-gallery-zoom-caption {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-align: center;
  opacity: 0.9;
  pointer-events: none;
}

.profile-pack-gallery-overlay.is-zoomed .profile-pack-gallery-panel {
  pointer-events: none;
}

body.profile-pack-gallery-open {
  overflow: hidden;
}

@media (min-width: 760px) {
  .profile-pack-gallery-overlay {
    place-items: center;
    padding: 2vh 2vw;
  }

  .profile-pack-gallery-panel {
    width: min(920px, 100%);
    height: min(92vh, 960px);
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
    overflow: hidden;
  }

  .profile-pack-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

.profile-info-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-info-password-block,
.profile-info-name-block,
.profile-info-login-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.profile-password-checklist,
.profile-name-checklist,
.profile-login-checklist {
  margin: 0;
}

.profile-info-save {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px solid color-mix(in srgb, var(--cyan) 16%, transparent);
}

.profile-info-note {
  margin: 0;
  opacity: 0.78;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.35rem;
}

.profile-actions-bottom {
  margin-top: 0.75rem;
}

.profile-actions .btn-shell-stretch {
  display: flex;
  width: 100%;
}

.profile-delete-btn {
  color: #ffb0bc;
}

/* Admin */
.profile-admin {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.profile-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.profile-admin-settings-title {
  margin: 0.25rem 0 0;
}

.profile-admin-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-admin-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.75rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--cyan) 18%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 55%, transparent);
  cursor: pointer;
}

.profile-admin-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.profile-admin-toggle-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.profile-admin-toggle-hint {
  font-size: 0.85rem;
  opacity: 0.72;
  line-height: 1.35;
}

.profile-admin-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-admin-toggle-switch {
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
  position: relative;
  transition: background 220ms ease;
}

.profile-admin-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 88%, transparent);
  transition: transform 220ms ease;
}

.profile-admin-toggle-input:checked + .profile-admin-toggle-switch {
  background: color-mix(in srgb, var(--cyan) 42%, transparent);
}

.profile-admin-toggle-input:checked + .profile-admin-toggle-switch::after {
  transform: translateX(20px);
}

.admin-impersonation-banner {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
}

.admin-impersonation-banner-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.35;
}

.admin-users-toolbar {
  align-items: stretch;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.admin-users-search {
  flex: 1 1 12rem;
  min-width: 0;
  display: block;
}

.admin-users-search-input {
  width: 100%;
}

.admin-users-toolbar > .btn-shell-stretch {
  flex: 0 0 auto;
}

.admin-users-screen--create .admin-create-user {
  margin-top: 0.35rem;
}

.admin-stats-list,
.profile-stats-list {
  gap: 0.55rem;
}

.admin-stats-item,
.profile-stats-item {
  cursor: default;
}

.admin-stats-actions {
  margin-top: 1rem;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.admin-crystal-ledger-toolbar {
  align-items: stretch;
}

.admin-crystal-ledger-balance {
  margin-top: 0.35rem;
}

.admin-crystal-ledger-item--credit .history-item-preview {
  color: color-mix(in srgb, var(--accent) 78%, var(--text));
}

.admin-crystal-ledger-item--debit .history-item-preview {
  color: color-mix(in srgb, var(--danger, #c45b5b) 70%, var(--text));
}

.admin-user-search-select {
  position: relative;
  flex: 1 1 14rem;
  min-width: 0;
}

.admin-user-search-select-trigger {
  width: 100%;
  justify-content: flex-start;
}

.admin-user-search-select-trigger .btn-shell-stretch,
.admin-user-search-select-trigger.btn-shell-stretch {
  width: 100%;
}

.admin-user-search-select-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  display: none;
  gap: 0.45rem;
  padding: 0.55rem;
  border-radius: var(--radius-md, 12px);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  box-shadow: 0 12px 28px color-mix(in srgb, #000 22%, transparent);
}

.admin-user-search-select.is-open .admin-user-search-select-panel,
.admin-user-search-select-panel:not([hidden]) {
  display: grid;
}

.admin-user-search-select-panel[hidden] {
  display: none !important;
}

.admin-user-search-select-input {
  width: 100%;
}

.admin-user-search-select-list {
  display: grid;
  gap: 0.25rem;
  max-height: 14rem;
  overflow: auto;
}

.admin-user-search-select-option {
  display: grid;
  gap: 0.1rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.admin-user-search-select-option:hover,
.admin-user-search-select-option.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.admin-user-search-select-option-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
}

.admin-user-search-select-option-login,
.admin-user-search-select-empty {
  margin: 0;
  opacity: 0.72;
  font-size: 0.86rem;
}

.profile-stats-add-btn {
  margin-top: 0;
  width: 100%;
}

.profile-stats-actions {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.profile-stats-ledger-btn {
  width: 100%;
}

.profile-stats-units-fields {
  display: grid;
  gap: 0.45rem;
  margin: 0.35rem 0 0.85rem;
}

.profile-stats-units-amount-row {
  width: 100%;
}

.profile-stats-units-amount-row > .btn-shell {
  flex: 0 0 auto;
  width: auto;
}

.profile-stats-units-dropdown {
  min-width: 0;
}

html[data-design="classic"] .profile-admin-toggle,
html[data-theme="classic"] .profile-admin-toggle,
body.design-classic .profile-admin-toggle,
html[data-design="classic"] .admin-impersonation-banner,
html[data-theme="classic"] .admin-impersonation-banner,
body.design-classic .admin-impersonation-banner {
  border-radius: 8px;
}

body.profile-picker-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .profile-grid-picker-overlay {
    padding: 0;
    place-items: stretch;
  }

  .profile-grid-picker-panel {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    overflow: hidden;
    animation: profilePickerInMobile 300ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .profile-grid-picker-scroll-viewport {
    max-height: none;
  }

  .profile-grid-picker-panel-head {
    font-size: clamp(1.55rem, 6.2vw, 1.9rem);
    margin-bottom: 1.1rem;
    padding: 0.15rem 0.1rem 0.35rem;
  }

  .profile-grid-picker-close {
    font-size: clamp(1.7rem, 7vw, 2.1rem);
    padding: 0.35rem 0.55rem;
    opacity: 0.88;
    min-width: 48px;
    min-height: 48px;
  }

  .profile-grid-picker--card .profile-grid-picker-option-thumb,
  .profile-grid-picker-overlay--card .profile-grid-picker-option-thumb {
    width: min(100%, 140px);
    height: auto;
    max-height: none;
    aspect-ratio: 2 / 3;
  }

  .profile-grid-picker-overlay:not(.profile-grid-picker-overlay--card) .profile-grid-picker-option-thumb,
  .profile-grid-picker-overlay:not(.profile-grid-picker-overlay--card) .profile-frame-swatch {
    width: 64px;
    height: 64px;
  }

  .profile-grid-picker-preview:has(.profile-avatar-thumb--3d),
  .profile-grid-picker-option-thumb:has(.profile-avatar-thumb--3d) {
    width: 84px;
  }

  @keyframes profilePickerInMobile {
    from {
      opacity: 0.4;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .profile-grid-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-grid-picker--card .profile-grid-picker-grid,
  .profile-grid-picker-overlay--card .profile-grid-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Число кристаликов слева от кристалла профиля */
.profile-crystals-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6em;
  padding: 0.15em 0;
  margin-right: -18px;
  position: relative;
  z-index: 2;
  font-family: var(--font-currency);
  font-size: clamp(1.35rem, 3.8vw, 1.85rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1;
  color: color-mix(in srgb, var(--cyan) 68%, #fff 32%);
  text-shadow:
    0 0 12px color-mix(in srgb, var(--cyan) 45%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.35);
  user-select: none;
  pointer-events: none;
}

.profile-crystals-badge-value {
  display: block;
}

/* 3D кристалл → профиль (вместо pack/theme в controls) */
.profile-crystal-button {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  width: clamp(86px, 8.2vw, 106px);
  height: clamp(86px, 8.2vw, 106px);
  cursor: pointer;
  border-radius: 0;
  position: relative;
  overflow: visible;
  filter: var(--ui-intro-figure-glow);
  transition: transform 220ms ease, filter 220ms ease;
}

.profile-crystal-button:hover,
.profile-crystal-button:focus-visible {
  transform: translateY(-1px) scale(1.04);
  filter: var(--ui-intro-figure-glow-hover);
  outline: none;
}

.profile-crystal-button:active {
  transform: translateY(0) scale(0.98);
}

.profile-crystal-host {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.profile-crystal-host.mode-card-icon-3d,
.profile-crystal-host .mode-card-icon-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}

html[data-design="classic"] .profile-accordion,
html[data-theme="classic"] .profile-accordion,
body.design-classic .profile-accordion,
html[data-design="classic"] .profile-grid-picker-trigger,
html[data-theme="classic"] .profile-grid-picker-trigger,
body.design-classic .profile-grid-picker-trigger,
html[data-design="classic"] .profile-grid-picker-option,
html[data-theme="classic"] .profile-grid-picker-option,
body.design-classic .profile-grid-picker-option {
  border-radius: 8px;
}

/* Boot splash — пока authReady/gate не готовы */
.boot-splash {
  min-height: min(70vh, 560px);
  display: grid;
  place-items: center;
  text-align: center;
}

.boot-splash-label {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  letter-spacing: 0.04em;
  opacity: 0.72;
  animation: boot-splash-pulse 1.6s ease-in-out infinite;
}

@keyframes boot-splash-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

.app-shell[data-stage="boot"] .top-bar {
  display: none;
}

html[data-design="classic"] .auth-input,
html[data-theme="classic"] .auth-input,
body.design-classic .auth-input,
html[data-design="classic"] .auth-login-check-btn,
html[data-theme="classic"] .auth-login-check-btn,
body.design-classic .auth-login-check-btn,
html[data-design="classic"] .auth-checklist,
html[data-theme="classic"] .auth-checklist,
body.design-classic .auth-checklist {
  border-radius: 8px;
}

html[data-design="classic"] .history-item,
html[data-theme="classic"] .history-item,
body.design-classic .history-item,
html[data-design="classic"] .history-item-delete,
html[data-theme="classic"] .history-item-delete,
body.design-classic .history-item-delete {
  border-radius: 8px;
}
