:root {
  color-scheme: dark;

  /* Core palette */
  --token-bg-primary: #0f1115;
  --token-surface-elevated: #151922;
  --token-surface-soft: #1b2230;
  --token-text-primary: #f5f7fa;
  --token-text-secondary: #a9b3c3;
  --token-text-muted: #7e8796;

  /* Accent and states */
  --token-accent-primary: #7c5cff;
  --token-accent-strong: rgb(76 29 149);
  --token-accent-rgb: 124 92 255;
  --token-accent-deep-rgb: 76 29 149;
  --token-success: #56c288;
  --token-warning: #e6b35a;
  --token-error: #e16b6b;

  /* Border, radii, shadow */
  --token-border-subtle: rgb(255 255 255 / 0.1);
  --token-radius-sm: 10px;
  --token-radius-md: 14px;
  --token-radius-lg: 18px;
  --token-shadow-soft: 0 6px 24px rgb(0 0 0 / 0.18);
  --token-focus-ring: 0 0 0 3px rgb(124 92 255 / 0.4);

  /* Typography */
  --token-font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  --token-font-narrative: "Literata", "Georgia", "Times New Roman", serif;
  --token-text-narrative: #ebe8f4;
  --token-fs-12: 12px;
  --token-fs-14: 14px;
  --token-fs-16: 16px;
  --token-fs-20: 20px;
  --token-fs-28: 28px;
  --token-lh-body: 1.5;
  --token-lh-title: 1.25;

  /* Motion */
  --token-motion-fast: 120ms;
  --token-motion-base: 180ms;
  --token-motion-slow: 240ms;
  --token-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --token-ease-in: cubic-bezier(0.4, 0, 1, 1);
}
:root {
  color-scheme: dark;
  /* Множитель для читаемых зон; выставляется из uiFontScale (профиль). */
  --ui-font-scale: 1;
  --bg-main: var(--token-bg-primary);
  --bg-elevated: var(--token-surface-elevated);
  --bg-muted: var(--token-surface-soft);
  --accent: var(--token-accent-primary);
  --accent-rgb: var(--token-accent-rgb);
  --accent-deep-rgb: var(--token-accent-deep-rgb);
  --accent-soft: rgb(var(--accent-rgb) / 0.18);
  --accent-strong: rgb(var(--accent-rgb) / 0.6);
  --dice-grad-1: #c4b5fd;
  --dice-grad-2: #7c3aed;
  --dice-grad-3: #4c1d95;
  --text-main: var(--token-text-primary);
  --text-muted: var(--token-text-secondary);
  --text-narrative: var(--token-text-narrative);
  --border-subtle: var(--token-border-subtle);
  --radius-lg: var(--token-radius-lg);
  --radius-md: var(--token-radius-md);
  --shadow-soft: var(--token-shadow-soft);
  --transition-fast: var(--token-motion-base);
  --body-background: radial-gradient(circle at top, #141b3b 0, #050816 55%, #02040a 100%);
  --header-background: linear-gradient(120deg, rgba(255, 255, 255, 0.04), rgb(var(--accent-rgb) / 0.18));
  --drawer-background: linear-gradient(165deg, #0f1430 0%, #080c1c 55%, #050816 100%);
  --home-opening-card-bg: linear-gradient(135deg, rgb(var(--accent-rgb) / 0.11), rgba(5, 8, 22, 0.55));
  --home-quote-bg: linear-gradient(160deg, rgb(var(--accent-rgb) / 0.16), rgba(7, 10, 28, 0.82));
  --home-quote-border: rgb(var(--accent-rgb) / 0.28);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  background: var(--body-background);
  background-attachment: fixed;
  color: var(--text-main);
  transition: background 0.35s ease-out, color 0.25s ease-out;
}

.app-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px)) calc(18px + env(safe-area-inset-left, 0px));
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--header-background);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  transition: background 0.35s ease-out;
}

.app-header-theme-swatches {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 7px;
  min-width: 0;
}

.app-header-theme-swatch {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 0.22);
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.38), var(--theme-swatch));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

.app-header-theme-swatch:hover {
  transform: scale(1.08);
  border-color: rgb(255 255 255 / 0.42);
}

.app-header-theme-swatch--active {
  transform: scale(1.12);
  box-shadow:
    0 0 0 2px var(--bg-main),
    0 0 0 4px rgb(var(--accent-rgb) / 0.75);
  border-color: rgb(255 255 255 / 0.5);
}

.app-header-theme-swatch--with-check.app-header-theme-swatch--active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.app-theme-picker {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.app-theme-picker--header {
  display: none;
}

.app-theme-picker-trigger {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
}

.app-theme-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 8, 22, 0.95);
  padding: 7px 9px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.app-theme-picker-swatches {
  flex: 0 0 auto;
  gap: 7px;
}

.app-theme-picker-swatch {
  width: 20px;
  height: 20px;
}

.app-header-theme-swatches--profile {
  justify-content: flex-start;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  gap: 8px;
  padding: 6px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.app-header-theme-swatch--profile {
  width: 24px;
  height: 24px;
}

.app-header-theme-swatch--profile.app-header-theme-swatch--active {
  box-shadow:
    0 0 0 2px var(--bg-main),
    0 0 0 3px rgb(var(--accent-rgb) / 0.75);
}

.app-header-theme-swatch:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.app-header-right--balance {
  width: 42px;
  min-width: 42px;
  flex-shrink: 0;
}

.app-header-onboarding-status {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: flex-end;
  gap: clamp(5px, 1.2vw, 10px);
  line-height: 1;
  min-width: 0;
  max-width: clamp(220px, 52vw, 420px);
}

.app-logo picture {
  display: inline-flex;
  flex-shrink: 0;
}

.app-logo-image {
  display: block;
  height: clamp(24px, 4.2vw, 42px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.45));
}

.app-logo-slogan {
  display: inline-flex;
  align-self: flex-end;
  align-items: flex-end;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  font-style: italic;
  font-size: clamp(16px, 2.55vw, 27px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: rgb(245 245 255 / 0.84);
  white-space: nowrap;
  transform: translateY(-3px);
}

.app-header--session .app-header-theme-swatch {
  width: 18px;
  height: 18px;
}

.app-header--session .app-header-theme-swatches {
  gap: 5px;
}

@media (max-width: 480px) {
  .app-logo {
    max-width: clamp(88px, 29vw, 132px);
  }

  .app-logo-image {
    height: clamp(20px, 6.6vw, 28px);
  }

  .app-header-theme-swatch {
    width: 16px;
    height: 16px;
  }

  .app-header-theme-swatches {
    gap: 4px;
  }

  .app-header-theme-swatches--profile {
    gap: 7px;
  }

  .app-header-theme-swatch--profile {
    width: 22px;
    height: 22px;
  }
}

button.app-logo {
  position: relative;
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.app-logo-news-hint {
  position: absolute;
  top: -1px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.95);
  box-shadow: 0 0 0 2px rgba(12, 12, 18, 0.85);
  pointer-events: none;
}

.app-nav-drawer-item-hint-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(var(--accent-rgb) / 0.95);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.14) inset;
}

button.app-logo:hover {
  opacity: 0.92;
}

button.app-logo:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 6px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.home-opening-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--home-opening-card-bg);
  transition: background 0.35s ease-out;
}

.home-opening-quote {
  position: relative;
  margin: 0.85rem 0 0.1rem;
  padding: 1rem 1rem 1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid var(--home-quote-border);
  border-left: 4px solid var(--accent);
  background: var(--home-quote-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 26px rgba(4, 6, 18, 0.45);
  color: var(--text-narrative);
  transition: background 0.35s ease-out, border-color 0.35s ease-out;
  font-size: clamp(16px, 2.6vw, 19px);
  line-height: 1.72;
  font-family: var(--token-font-narrative);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.home-opening-quote::before {
  content: "“";
  position: absolute;
  left: 0.55rem;
  top: -0.58rem;
  font-size: 2.55rem;
  line-height: 1;
  color: rgb(var(--accent-rgb) / 0.5);
  font-family: Georgia, "Times New Roman", serif;
  pointer-events: none;
}

@keyframes home-opening-quote-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-opening-quote--enter {
  animation: home-opening-quote-enter 0.42s var(--token-ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
  .home-opening-quote--enter {
    animation: none;
  }
}

.home-illustration-open {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin-top: 0.8rem;
  padding: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: var(--shadow-soft);
  cursor: zoom-in;
}

.home-illustration-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  object-fit: contain;
  object-position: center;
  animation: homeIllustrationFadeIn 0.45s var(--token-ease-out) both;
}

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

.app-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  row-gap: 6px;
  gap: 8px;
  max-width: min(100%, calc(100vw - 120px));
}

/* Во время сцены — меньше элементов в шапке; на узком экране не ломаем ряд */
.app-header--session .app-header-right {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
  max-width: min(100%, calc(100vw - 120px));
}

.app-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 8, 22, 0.7);
  color: var(--text-main);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform 0.08s ease-out;
}

.app-menu-toggle:hover {
  background: rgb(var(--accent-rgb) / 0.3);
  border-color: rgb(var(--accent-rgb) / 0.9);
  transform: translateY(-1px);
}

.app-menu-toggle-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.app-menu-toggle-bars > span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.app-nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 4, 10, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease-out;
  backdrop-filter: blur(4px);
}

.app-nav-drawer-backdrop--open {
  opacity: 1;
  pointer-events: auto;
}

.app-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(20rem, 88vw);
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--drawer-background);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55);
  transition: background 0.35s ease-out;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-nav-drawer--open {
  transform: translateX(0);
}

.app-nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.app-nav-drawer-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.app-nav-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.app-nav-drawer-close:hover {
  background: rgb(var(--accent-rgb) / 0.2);
  border-color: rgb(var(--accent-rgb) / 0.55);
}

.app-nav-drawer-scroll {
  flex: 1;
  overflow: auto;
  padding: 10px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-nav-drawer-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-nav-drawer-item:focus-visible,
.app-nav-drawer-close:focus-visible,
.app-menu-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.42);
}

.app-nav-drawer-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-nav-drawer-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.9);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.15) inset;
}

.app-nav-drawer-item--current .app-nav-drawer-item-badge {
  background: rgb(var(--accent-rgb) / 0.55);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.12) inset;
}

.app-nav-drawer-item--current .app-nav-drawer-item-hint-dot {
  background: rgb(var(--accent-rgb) / 0.75);
}

.app-nav-drawer-item:hover:not(:disabled) {
  background: rgb(var(--accent-rgb) / 0.18);
  border-color: rgb(var(--accent-rgb) / 0.45);
}

.app-nav-drawer-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-nav-drawer-item--current {
  background: rgb(var(--accent-rgb) / 0.24);
  border-color: rgb(var(--accent-rgb) / 0.55);
  box-shadow: inset 3px 0 0 var(--accent);
}

.app-nav-drawer-item--current:hover:not(:disabled) {
  background: rgb(var(--accent-rgb) / 0.32);
  border-color: rgb(var(--accent-rgb) / 0.65);
}

.app-nav-drawer-block--current {
  border-color: rgb(var(--accent-rgb) / 0.4);
  background: rgb(var(--accent-rgb) / 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.app-nav-drawer-item--danger:hover:not(:disabled) {
  background: rgba(220, 80, 80, 0.18);
  border-color: rgba(255, 120, 120, 0.35);
}

.app-nav-drawer-block {
  padding: 10px 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}

.app-nav-drawer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.app-nav-drawer-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.app-nav-drawer-select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 10px;
  font-size: 14px;
  background: rgba(5, 8, 22, 0.85);
  color: var(--text-main);
  cursor: pointer;
}

.app-nav-drawer-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .app-nav-drawer,
  .app-nav-drawer-backdrop {
    transition-duration: 0.01ms;
  }

  .app-menu-toggle {
    transition-duration: 0.01ms;
  }

  .app-menu-toggle:hover {
    transform: none;
  }
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(260px, 1.1fr);
  gap: 16px;
  height: 100%;
}

.app-main--workspace:not(.app-main--game) {
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
}

.story-panel {
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-muted));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-prose {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.story-prose > .story-title,
.story-prose > .story-text,
.story-prose > .story-illustration {
  width: 100%;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.story-title {
  font-size: calc(21px * var(--ui-font-scale));
  font-weight: 600;
  margin: 0 0 4px;
}

.story-text {
  margin: 0;
  color: var(--text-narrative);
  line-height: 1.72;
  font-size: calc(16px * var(--ui-font-scale));
  font-family: var(--token-font-narrative);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.story-text__block {
  display: block;
  margin: 0 0 1.05em;
}

.story-text__block:last-child {
  margin-bottom: 0;
}

.story-generation-indicator {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0 0 0.35rem;
  padding: 0.95rem 1rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid rgb(var(--accent-rgb) / 0.28);
  background:
    radial-gradient(circle at 18% 14%, rgb(var(--accent-rgb) / 0.1), transparent 55%),
    rgba(7, 11, 28, 0.75);
}

.story-generation-indicator-title {
  margin: 0;
  font-size: calc(16px * var(--ui-font-scale));
  font-weight: 600;
  color: var(--text-main);
}

.story-generation-indicator-text {
  margin: 0.35rem 0 0;
  font-size: calc(14px * var(--ui-font-scale));
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.story-generation-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  flex-shrink: 0;
}

.story-generation-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.7);
  box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.22);
  animation: storyGenerationDotPulse 1.35s ease-in-out infinite;
}

.story-generation-dot--2 {
  animation-delay: 0.18s;
}

.story-generation-dot--3 {
  animation-delay: 0.36s;
}

.story-generation-progress {
  position: relative;
  margin-top: 0.58rem;
  height: 0.24rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgb(var(--accent-rgb) / 0.14);
}

.story-generation-progress-bar {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgb(var(--accent-rgb) / 0.35),
    rgb(var(--accent-rgb) / 0.92),
    rgb(var(--accent-rgb) / 0.35)
  );
  box-shadow: 0 0 10px rgb(var(--accent-rgb) / 0.35);
  animation: storyGenerationProgressSweep 1.7s ease-in-out infinite;
}

.story-generation-indicator-hint {
  margin: 0.35rem 0 0;
  font-size: calc(13px * var(--ui-font-scale));
  line-height: 1.4;
  color: rgb(255 255 255 / 0.66);
}

.story-generation-skeleton {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.36rem;
}

.story-generation-line {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.12);
  animation: storyGenerationLineBreathe 4.2s ease-in-out infinite;
}

.story-generation-line--phase-2 {
  animation-delay: 0.18s;
}

.story-generation-line--phase-3 {
  animation-delay: 0.36s;
}

.story-generation-line--long {
  width: 100%;
}

.story-generation-line--mid {
  width: 74%;
}

.story-generation-line--short {
  width: 52%;
}
@keyframes storyGenerationDotPulse {
  0% {
    transform: translateY(0) scale(0.86);
    box-shadow: 0 0 0 0 rgb(var(--accent-rgb) / 0.24);
    opacity: 0.5;
  }
  35% {
    transform: translateY(-1px) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(0.86);
    box-shadow: 0 0 0 0.28rem rgb(var(--accent-rgb) / 0);
    opacity: 0.55;
  }
}

@keyframes storyGenerationLineBreathe {
  0% {
    opacity: 0.62;
  }
  50% {
    opacity: 0.82;
  }
  100% {
    opacity: 0.62;
  }
}

@keyframes storyGenerationProgressSweep {
  0% {
    transform: translateX(-105%);
  }
  50% {
    transform: translateX(86%);
  }
  100% {
    transform: translateX(235%);
  }
}

.story-illustration {
  margin: 0 0 0.75rem;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  /* Подложка под letterboxing при object-fit: contain */
  background: rgba(0, 0, 0, 0.22);
}

.story-illustration-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity 0.28s ease-out;
}

.story-illustration-image--visible {
  opacity: 1;
}

/* Пока картинка грузится или не пришла с сервера — статичная подпись, без анимации-«шима». */
.story-illustration-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.story-illustration-pending-note {
  margin: 0 0 0.65rem;
  min-height: 1.2em;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--token-text-secondary);
}

.story-illustration-no-paint-note {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--token-text-secondary);
  background: rgba(120, 160, 255, 0.07);
  border-radius: 6px;
  border-left: 3px solid rgba(120, 160, 255, 0.35);
}

.story-illustration-placeholder--loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  align-items: unset;
  justify-content: unset;
  padding: 0;
  text-align: left;
  background: rgba(0, 0, 0, 0.14);
  pointer-events: none;
}

.story-illustration-placeholder--awaiting-file {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  align-items: unset;
  justify-content: unset;
  padding: 0;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
}

.story-illustration-placeholder-text {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--token-text-secondary);
  max-width: 22rem;
}

.dice-fx-block {
  display: inline-block;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.5);
  background: rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.12);
  transition:
    border-color 0.45s ease,
    background-color 0.45s ease,
    box-shadow 0.45s ease;
}

.dice-fx-block--revealed {
  box-shadow: 0 0 28px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.22);
}

.dice-fx-block--outcome-critical_fail,
.dice-fx-block--outcome-fail {
  --dice-fx-accent-rgb: 220 72 72;
  --dice-grad-1: #fecaca;
  --dice-grad-2: #dc2626;
  --dice-grad-3: #7f1d1d;
}

.dice-fx-block--outcome-strain {
  --dice-fx-accent-rgb: 232 138 52;
  --dice-grad-1: #fde6c8;
  --dice-grad-2: #ea8c2c;
  --dice-grad-3: #9a4a12;
}

.dice-fx-block--outcome-scrape {
  --dice-fx-accent-rgb: 214 178 62;
  --dice-grad-1: #faf0c4;
  --dice-grad-2: #d4af37;
  --dice-grad-3: #7a6118;
}

.dice-fx-block--outcome-success {
  --dice-fx-accent-rgb: 72 178 104;
  --dice-grad-1: #bbf7d0;
  --dice-grad-2: #22a06b;
  --dice-grad-3: #14532d;
}

.dice-fx-block--outcome-triumph,
.dice-fx-block--outcome-critical_success {
  --dice-fx-accent-rgb: 148 108 220;
  --dice-grad-1: #e9d5ff;
  --dice-grad-2: #9333ea;
  --dice-grad-3: #581c87;
}

.dice-fx-block--coop {
  margin-bottom: 0.75rem;
}

.dice-check-detail,
.story-dice-check-line .dice-check-detail {
  font-size: 0.92em;
  color: var(--text-muted);
}

.story-dice-check-line {
  line-height: 1.45;
}

.dice-check-step {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.94em;
}

.dice-fx-prompt {
  display: block;
  margin: 0 0 10px;
  color: var(--text-main);
  font-weight: 600;
  font-size: calc(16px * var(--ui-font-scale));
}

.dice-fx-continue-note {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: calc(15px * var(--ui-font-scale));
}

.dice-fx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dice-fx-rolling {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 6.5rem;
}

.dice-fx-d20-stage {
  perspective: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 2px;
  overflow: hidden;
}

.dice-fx-d20-spin {
  transform-style: preserve-3d;
  /* Центр вращения — как ось колеса, направленная на зрителя */
  transform-origin: 50% 50%;
  will-change: transform;
}

.dice-fx-d20-spin:not(.dice-fx-d20-spin--slowdown) {
  animation: d20Roll 3.15s linear infinite;
}

.dice-fx-d20-spin--slowdown {
  /* Линейная интерполяция между кадрами: сначала большой угол за короткое время, затем плавное замедление */
  animation: d20RollSlow 7.35s linear forwards;
}

.dice-fx-d20-graphic {
  width: 5.75rem;
  height: 5.75rem;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}

.dice-fx-d20-labels {
  fill: rgba(255, 255, 255, 0.96);
  font-size: 5.6px;
  font-weight: 800;
  paint-order: stroke fill;
  stroke: rgb(var(--accent-deep-rgb) / 0.78);
  stroke-width: 1.05px;
  letter-spacing: 0.06px;
  pointer-events: none;
}

.dice-fx-result {
  display: inline-block;
  margin: 0;
  color: var(--text-main);
}

.dice-fx-result--spinning {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.25rem;
  padding: 0.38rem 0.75rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.62);
  background:
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 42%),
    linear-gradient(
      135deg,
      rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.46),
      rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.72)
    );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 10px 24px rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.38),
    0 0 22px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.32);
  text-shadow: 0 1px 7px rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.65);
  animation: diceResultPulse 1.05s ease-in-out infinite;
}

.dice-fx-result--revealed {
  font-weight: 600;
  animation: diceOutcomeReveal 0.55s ease-out both;
}

.dice-fx-result--tier-strain {
  color: #f0b46a;
}

.dice-fx-result--tier-scrape {
  color: #e8d06a;
}

.dice-fx-result--tier-fail,
.dice-fx-result--tier-critical_fail {
  color: #f08a8a;
}

.dice-fx-result--tier-success {
  color: #7ddea3;
}

.dice-fx-result--tier-triumph,
.dice-fx-result--tier-critical_success {
  color: #d4b4ff;
}

@keyframes diceOutcomeReveal {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dice-fx-result-label {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-main);
  opacity: 0.9;
}

.dice-fx-result-divider {
  line-height: 1;
  transform: translateY(-1px);
  color: var(--text-muted);
}

.dice-fx-result-value {
  min-width: 1.65em;
  text-align: center;
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.015em;
  color: #ffffff;
  text-shadow:
    0 0 12px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.55),
    0 0 28px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.42);
}

.dice-fx-block--revealed .dice-fx-d20-labels {
  stroke: rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.78);
}

@keyframes diceResultPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.05) inset,
      0 10px 24px rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.38),
      0 0 22px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.32);
  }
  50% {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08) inset,
      0 12px 28px rgb(var(--dice-fx-accent-rgb, var(--accent-deep-rgb)) / 0.46),
      0 0 30px rgb(var(--dice-fx-accent-rgb, var(--accent-rgb)) / 0.46);
  }
}

/* Вращение в плоскости экрана (как колесо с осью на зрителя): по часовой = положительный rotateZ */
@keyframes d20RollSlow {
  0% {
    transform: rotateX(14deg) rotateZ(0deg);
    animation-timing-function: linear;
  }
  /* ~78% полного оборота за первую пятую времени — быстрый старт */
  20% {
    transform: rotateX(14deg) rotateZ(700deg);
    animation-timing-function: cubic-bezier(0.12, 0.72, 0.18, 1);
  }
  100% {
    transform: rotateX(14deg) rotateZ(900deg);
  }
}

@keyframes d20Roll {
  0% {
    transform: rotateX(14deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(14deg) rotateZ(360deg);
  }
}

@keyframes d20RollReduced {
  0% {
    transform: rotateX(10deg) rotateZ(0deg);
  }
  100% {
    transform: rotateX(10deg) rotateZ(360deg);
  }
}

@keyframes d20RollSlowReduced {
  0% {
    transform: rotateX(10deg) rotateZ(0deg);
    animation-timing-function: linear;
  }
  20% {
    transform: rotateX(10deg) rotateZ(156deg);
    animation-timing-function: cubic-bezier(0.12, 0.72, 0.18, 1);
  }
  100% {
    transform: rotateX(10deg) rotateZ(200deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dice-fx-d20-spin:not(.dice-fx-d20-spin--slowdown) {
    animation: d20RollReduced 7.2s linear infinite;
  }

  .dice-fx-d20-spin--slowdown {
    animation: d20RollSlowReduced 7.5s linear forwards;
  }

  .dice-fx-result--spinning {
    animation: none;
    transform: none;
  }

  .story-generation-dot,
  .story-generation-line,
  .story-generation-progress-bar {
    animation: none;
  }
}

.status-text {
  font-size: calc(15px * var(--ui-font-scale));
  line-height: 1.45;
  color: var(--token-text-secondary);
}

.status-text--pad-xl {
  padding: 2rem;
}

.app-shell-init-placeholder {
  min-height: 3.5rem;
  padding: 2rem;
  box-sizing: border-box;
}

.branded-loading-handoff {
  display: flex;
  align-items: center;
  min-height: calc(1.5em * var(--ui-font-scale, 1));
}

.branded-loading-handoff__text {
  margin: 0;
  width: 100%;
}

.branded-loading-handoff__mark {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  opacity: 1;
}

.branded-loading-handoff__quill {
  height: calc(30px * var(--ui-font-scale, 1));
  width: auto;
  max-width: min(6rem, 100%);
  display: block;
  /* PNG с альфой: без mix-blend — перо лежит на реальном фоне карточки/страницы. */
  opacity: 1;
  filter: brightness(1.04) drop-shadow(0 0 8px rgb(255 255 255 / 0.22));
}

@media (prefers-reduced-motion: no-preference) {
  .branded-loading-handoff__mark {
    animation: branded-loading-handoff-soft-in 0.42s ease-out;
  }
}

@keyframes branded-loading-handoff-soft-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.status-text.error {
  color: #ff8080;
}

.side-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-card {
  background: radial-gradient(circle at top left, var(--accent-soft), var(--bg-elevated));
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Праздничный блок про бонус к первому пополнению (золото / мята, без «тревожного» красного) */
.sheets-first-purchase-promo {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.16) 0%,
    rgba(52, 211, 153, 0.12) 42%,
    rgba(96, 165, 250, 0.1) 100%
  );
  border: 1px solid rgba(250, 204, 21, 0.32);
  box-shadow: 0 0 28px rgba(250, 204, 21, 0.07);
}

.sheets-first-purchase-promo__lead {
  margin: 0 0 6px;
  font-weight: 650;
  font-size: calc(15px * var(--ui-font-scale));
  color: #fde68a;
  letter-spacing: 0.01em;
}

.sheets-first-purchase-promo__body {
  margin: 0;
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.45;
  color: var(--text-main);
}

.side-card.sheets-first-purchase-promo-card {
  background: linear-gradient(
    145deg,
    rgba(250, 204, 21, 0.14) 0%,
    rgba(45, 212, 191, 0.1) 38%,
    var(--bg-elevated) 72%
  );
  border-color: rgba(250, 204, 21, 0.35);
  box-shadow: 0 0 32px rgba(250, 204, 21, 0.06);
}

.sheets-first-purchase-promo-card__title {
  color: #fef3c7;
}

.sheets-first-purchase-promo-copy {
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.5;
  color: var(--text-main);
}

.sheets-first-purchase-promo-copy__lead {
  margin: 0 0 8px;
  font-weight: 600;
  color: #fde68a;
}

.sheets-first-purchase-promo-copy p:last-child {
  margin: 0;
}

.side-card.muted {
  background: linear-gradient(145deg, var(--bg-muted), var(--bg-main));
}

.side-title {
  font-size: calc(15px * var(--ui-font-scale));
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  margin: 0 0 2px;
  color: var(--text-main);
}

.side-placeholder {
  margin: 0;
  font-size: calc(15px * var(--ui-font-scale));
  line-height: 1.5;
  color: var(--token-text-secondary);
}

.profile-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-page .side-card--mt-lg {
  margin-top: 0;
}

.profile-page__hero {
  margin-bottom: 0.15rem;
}

.profile-page__title {
  margin: 0 0 0.35rem;
  font-size: calc(26px * var(--ui-font-scale));
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text-main);
}

.profile-page__lead {
  margin: 0;
  max-width: 40rem;
  font-size: calc(15px * var(--ui-font-scale));
  line-height: 1.55;
  color: var(--text-muted);
}

.profile-kv {
  display: grid;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
}

.profile-kv__row {
  display: grid;
  grid-template-columns: minmax(0, 7.75rem) minmax(0, 1fr);
  gap: 0.35rem 0.85rem;
  align-items: baseline;
}

@media (max-width: 420px) {
  .profile-kv__row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}

.profile-kv__k {
  font-size: calc(11px * var(--ui-font-scale));
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-kv__v {
  margin: 0;
  font-size: calc(15px * var(--ui-font-scale));
  line-height: 1.45;
  color: var(--text-main);
  word-break: break-word;
}

.profile-kv__v--muted {
  color: var(--text-muted);
}

.profile-font-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.profile-font-scale__btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: calc(12px * var(--ui-font-scale));
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    border-color var(--transition-fast),
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.profile-font-scale__btn:hover {
  color: var(--text-main);
  border-color: rgb(var(--accent-rgb) / 0.22);
  background: rgb(var(--accent-rgb) / 0.06);
}

.profile-font-scale__btn:focus-visible {
  outline: 2px solid rgb(var(--accent-rgb) / 0.75);
  outline-offset: 2px;
}

.profile-font-scale__btn--active {
  color: var(--text-main);
  border-color: rgb(var(--accent-rgb) / 0.38);
  background: rgb(var(--accent-rgb) / 0.1);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 0.12);
}

.profile-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(7, 11, 28, 0.45);
}

.profile-toc__sep {
  color: rgb(255 255 255 / 0.18);
  font-size: calc(11px * var(--ui-font-scale));
  user-select: none;
}

.profile-toc__link {
  font-size: calc(13px * var(--ui-font-scale));
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.profile-toc__link:hover {
  color: var(--text-main);
  border-bottom-color: rgb(var(--accent-rgb) / 0.45);
}

.profile-toc__link:focus-visible {
  outline: 2px solid rgb(var(--accent-rgb) / 0.75);
  outline-offset: 3px;
  border-radius: 4px;
}

.profile-anchor-target {
  scroll-margin-top: 1.1rem;
}

.profile-account-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.profile-details {
  border: 0;
  padding: 0;
  margin: 0;
}

.profile-details__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: calc(15px * var(--ui-font-scale));
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-main);
  padding: 0 0 0.35rem;
  user-select: none;
}

.profile-details__summary-main {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-details__hint {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.92em;
}

.profile-details__summary-main .profile-details__hint {
  margin-inline-start: 0.35em;
}

.profile-details__summary::-webkit-details-marker {
  display: none;
}

.profile-details__summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: auto;
  border-right: 2px solid rgb(255 255 255 / 0.35);
  border-bottom: 2px solid rgb(255 255 255 / 0.35);
  transform: rotate(45deg);
  translate: 0 -0.12rem;
  transition: transform var(--transition-fast);
}

.profile-details[open] > .profile-details__summary::after {
  transform: rotate(225deg);
  translate: 0 0.08rem;
}

.profile-details__body {
  padding-top: 0.35rem;
}

.profile-details--in-card {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
}

.profile-details--in-card > .profile-details__summary {
  padding-top: 0.1rem;
}

.profile-account-meta {
  margin-top: 0.15rem;
}

.profile-security-wrap,
.profile-support-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-margin-top: 1.1rem;
}

.profile-section__header {
  margin-bottom: 0;
}

.profile-section__title {
  margin-bottom: 0;
}

.profile-section__meta {
  margin-top: 0.25rem;
  font-size: calc(13px * var(--ui-font-scale));
}

.profile-section__collapsed-hint {
  margin: 0.35rem 0 0;
}

.profile-section__body {
  margin-top: 0.65rem;
}

.profile-section__collapse.collapsible-reveal--open .profile-section__body {
  margin-top: 0.65rem;
}

.profile-section--in-wrap {
  margin-top: 0;
}

.profile-section__nested-card {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.profile-illustrations-exchange {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
}

.profile-illustrations-exchange__title {
  margin: 0 0 0.5rem;
  font-size: calc(17px * var(--ui-font-scale));
}

.portrait-row {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.portrait-frame {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(219, 203, 165, 0.3),
    inset 0 0 0 5px rgba(18, 20, 34, 0.36);
}

.portrait-frame--variant-default::after {
  box-shadow:
    inset 0 0 0 2px rgba(219, 203, 165, 0.3),
    inset 0 0 0 5px rgba(18, 20, 34, 0.36);
}

.portrait-frame--variant-rare::after {
  box-shadow:
    inset 0 0 0 2px rgba(137, 191, 255, 0.48),
    inset 0 0 0 5px rgba(19, 32, 58, 0.42);
}

.portrait-frame-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.15) contrast(1.08);
}

.portrait-frame-image--reveal {
  animation: portraitReveal 0.42s ease-out;
}

.portrait-frame-open {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.portrait-frame-open--fill {
  display: block;
}

.portrait-zoom-button__pending {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 2.5rem;
  background: rgba(21, 15, 10, 0.45);
}

.portrait-frame-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 0.4rem;
}

.portrait-frame--char-list {
  width: 96px;
  height: 128px;
}

.portrait-frame--game-character {
  width: 72px;
  height: 96px;
}

.portrait-frame--coop {
  width: 40px;
  height: 54px;
  border-radius: 8px;
  flex-shrink: 0;
}

.portrait-frame--coop[data-empty="true"] .portrait-frame-placeholder {
  opacity: 0.45;
}

.portrait-frame--moment {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.moment-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem 0.85rem;
  align-items: start;
}

.moment-gallery-grid__empty {
  grid-column: 1 / -1;
}

.moment-gallery-card {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.moment-gallery-card--just-unlocked .moment-gallery-card__frame {
  animation: achievementBadgePop 0.42s var(--token-ease-out);
}

.moment-gallery-card__open {
  display: block;
}

.moment-gallery-card__image {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.moment-gallery-card__image--scene {
  filter: saturate(0.92) contrast(1.04);
}

.moment-gallery-card__chronicle {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: rgba(219, 203, 165, 0.88);
  font-style: italic;
}

.moment-gallery-card__emblem-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.2));
}

.moment-gallery-card__emblem-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.22;
  filter: blur(6px) saturate(0.2);
  transform: scale(1.08);
  pointer-events: none;
}

.moment-gallery-card__emblem {
  position: relative;
  z-index: 1;
  width: 72%;
  max-height: 70%;
}

.moment-emblem__glyph {
  fill: none;
  stroke: rgba(219, 203, 165, 0.92);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.moment-emblem__num {
  fill: rgba(219, 203, 165, 0.95);
  font-size: 11px;
  font-family: var(--font-serif, Georgia, serif);
  font-weight: 600;
}

.moment-coop-collage {
  display: grid;
  width: 100%;
  height: 100%;
  gap: 3px;
  padding: 3px;
  box-sizing: border-box;
}

.moment-coop-collage--1 {
  grid-template-columns: 1fr;
}

.moment-coop-collage--2 {
  grid-template-columns: 1fr 1fr;
}

.moment-coop-collage--3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.moment-coop-collage--3 .moment-coop-collage__cell:first-child {
  grid-column: 1 / -1;
}

.moment-coop-collage__cell {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  filter: saturate(0.2) contrast(1.05);
}

.moment-gallery-card__pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 100%;
  padding: 0.75rem;
  text-align: center;
}

.moment-gallery-card__pending-quill {
  width: 28px;
  height: 28px;
  opacity: 0.55;
  background: center / contain no-repeat url("/ui-handoff-quill.png");
}

.moment-gallery-card__pending-text {
  font-size: 0.78rem;
  color: var(--token-muted);
  line-height: 1.35;
}

.moment-gallery-card__caption {
  padding: 0 0.15rem;
}

.moment-gallery-card__title {
  display: block;
  font-size: 0.92rem;
  line-height: 1.3;
}

.moment-gallery-card__desc {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--token-muted);
}

.portrait-variant-strip {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0.45rem 0 0.6rem;
  padding: 0.1rem 0.45rem 0.2rem;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    rgba(0, 0, 0, 1) 10px,
    rgba(0, 0, 0, 1) calc(100% - 10px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    rgba(0, 0, 0, 1) 10px,
    rgba(0, 0, 0, 1) calc(100% - 10px),
    transparent 100%
  );
}

.portrait-variant-toggle {
  border: 1px solid rgba(194, 155, 89, 0.4);
  border-radius: 999px;
  background: rgba(17, 12, 9, 0.72);
  color: var(--text-main);
  font-size: 12px;
  line-height: 1.2;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.portrait-variant-toggle:hover {
  border-color: rgba(230, 202, 146, 0.88);
  background: rgba(30, 20, 12, 0.82);
  transform: translateY(-1px);
}

.portrait-variant-toggle:disabled {
  opacity: 0.65;
  cursor: default;
  transform: none;
}

.portrait-variant-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 68px;
  border-radius: 9px;
  border: 1px solid rgba(194, 155, 89, 0.35);
  overflow: hidden;
  padding: 0;
  background: rgba(21, 15, 10, 0.55);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.portrait-variant-thumb__select {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
}

.portrait-variant-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portrait-variant-thumb:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 199, 138, 0.9);
}

.portrait-variant-thumb.is-active {
  border-color: rgba(242, 217, 149, 1);
  box-shadow: 0 0 0 1px rgba(242, 217, 149, 0.45), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.portrait-variant-thumb__select:disabled,
.portrait-variant-thumb__zoom:disabled {
  opacity: 0.65;
  cursor: default;
}

.portrait-variant-thumb:has(.portrait-variant-thumb__select:disabled) {
  transform: none;
}

.portrait-variant-thumb__zoom {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid rgba(255, 231, 177, 0.45);
  border-radius: 999px;
  background: rgba(7, 8, 14, 0.78);
  color: rgba(255, 244, 218, 0.95);
  cursor: zoom-in;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  z-index: 1;
}

.portrait-variant-thumb__zoom:hover:not(:disabled) {
  border-color: rgba(242, 217, 149, 0.95);
  background: rgba(21, 15, 10, 0.92);
}

.portrait-variant-thumb__zoom-icon {
  width: 0.72rem;
  height: 0.72rem;
  display: block;
  background: currentcolor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M15.5 15.5 21 21'/%3E%3C/svg%3E") center / contain no-repeat;
}

.portrait-variant-thumb-label {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 244, 218, 0.95);
  background: rgba(7, 8, 14, 0.7);
  border: 1px solid rgba(255, 231, 177, 0.35);
  border-radius: 6px;
  padding: 2px 4px;
}

@keyframes portraitReveal {
  from {
    opacity: 0;
    transform: scale(0.96);
    filter: saturate(0.05) contrast(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: saturate(0.15) contrast(1.08);
  }
}

.portrait-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(1, 3, 8, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.portrait-lightbox-overlay--open {
  opacity: 1;
}

.portrait-lightbox-dialog {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 8, 22, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  width: min(96vw, 1280px);
  max-width: 96vw;
  max-height: 94vh;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.portrait-lightbox-dialog--open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portrait-lightbox-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 94vh;
  object-fit: contain;
}

.portrait-lightbox-close {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(2, 4, 10, 0.72);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.action-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 11, 30, 0.9);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
  margin-top: 4px;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform 0.08s ease-out,
    box-shadow var(--transition-fast);
}

.action-button:hover {
  background: rgb(var(--accent-rgb) / 0.16);
  border-color: rgb(var(--accent-rgb) / 0.8);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 0.35);
}

.action-button--selected {
  background: var(--accent-strong);
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.action-index {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(5, 8, 22, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.action-label {
  flex: 1;
  text-align: left;
}

.action-label strong {
  font-weight: 700;
}

.action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.custom-action-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.custom-action-form .cozy-form__input {
  width: 100%;
}

.custom-action-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 11, 30, 0.9);
  color: var(--text-main);
  font-size: calc(15px * var(--ui-font-scale));
  transition: border-color var(--transition-fast);
}

.custom-action-input::placeholder {
  color: var(--text-muted);
}

.custom-action-input:focus {
  outline: none;
  border-color: rgb(var(--accent-rgb) / 0.7);
}

.custom-action-input:disabled {
  opacity: 0.6;
}

select.custom-action-input option:disabled {
  color: var(--text-muted);
  opacity: 0.85;
}

/* Алиас primary-кнопки; базовые стили — в ui/primitives.css (.ui-button) */
.custom-action-submit {
  align-self: flex-start;
}

.app-main--auth {
  max-width: 36rem;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  grid-template-columns: 1fr;
}

.app-main--onboarding {
  max-width: 42rem;
  margin: 0 auto;
  grid-template-columns: 1fr;
}

.app-onboarding-alt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-bottom: 1rem;
}

.ui-text-link {
  margin: 0;
  padding: 0.5rem 0.15rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: none;
  font: inherit;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.4;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color var(--token-motion-fast) var(--token-ease-out);
}

.ui-text-link:hover:not(:disabled) {
  color: var(--text-main);
}

.ui-text-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.38);
  border-radius: 4px;
}

.ui-text-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.participant-chat-sound-hint {
  margin: 0 0 0.5rem;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--token-text-secondary);
}

.app-main--menu {
  max-width: 52rem;
  width: 100%;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
}

.story-create-card {
  padding: 16px 18px 18px;
  gap: 0;
}

.story-create, .cozy-form {
  display: grid;
  gap: 1.35rem;
}

.story-create__hero, .cozy-form__hero {
  display: grid;
  gap: 0.45rem;
  padding-bottom: 0.15rem;
}

.story-create__title, .cozy-form__title {
  margin: 0;
  font-size: calc(22px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-main);
}

.story-create__lead, .cozy-form__lead {
  margin: 0;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.5;
  color: var(--text-muted);
}

.story-create__error, .cozy-form__error {
  margin: 0;
}

.story-create__section, .cozy-form__section {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(160deg, rgb(var(--accent-rgb) / 0.05) 0%, var(--bg-elevated) 48%);
}

.story-create__section--advanced, .cozy-form__section--advanced {
  padding: 0;
  overflow: hidden;
}

.story-create__section-head, .cozy-form__section-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.story-create__step, .cozy-form__step {
  flex: 0 0 auto;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: 700;
  color: var(--text-main);
  background: rgb(var(--accent-rgb) / 0.16);
  border: 1px solid rgb(var(--accent-rgb) / 0.28);
}

.story-create__section-title, .cozy-form__section-title {
  margin: 0;
  font-size: calc(15px * var(--ui-font-scale, 1));
  font-weight: 650;
  color: var(--text-main);
}

.story-create__section-caption, .cozy-form__section-caption {
  margin: 0.2rem 0 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-muted);
}

.story-create__choice-row, .cozy-form__choice-row {
  display: grid;
  gap: 0.65rem;
}

.story-create__choice-row--duo, .cozy-form__choice-row--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-create__choice, .cozy-form__choice {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 4.5rem;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.42);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    background-color var(--token-motion-fast) var(--token-ease-out),
    box-shadow var(--token-motion-fast) var(--token-ease-out),
    transform var(--token-motion-fast) var(--token-ease-out);
}

.story-create__choice:hover:not(:disabled) , .cozy-form__choice:hover:not(:disabled)  {
  border-color: rgb(var(--accent-rgb) / 0.34);
  transform: translateY(-1px);
}

.story-create__choice--selected, .cozy-form__choice--selected {
  border-color: rgb(var(--accent-rgb) / 0.52);
  background: rgb(var(--accent-rgb) / 0.12);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 0.14);
}

.story-create__choice:focus-visible , .cozy-form__choice:focus-visible  {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.32);
}

.story-create__choice:disabled , .cozy-form__choice:disabled  {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.story-create__choice-icon, .cozy-form__choice-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin-top: 0.05rem;
}

.story-create__choice-copy, .cozy-form__choice-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.story-create__choice-title, .cozy-form__choice-title {
  font-size: calc(14px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.story-create__choice-hint, .cozy-form__choice-hint {
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.4;
  color: var(--text-muted);
}

.story-create__notice, .cozy-form__notice {
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgb(250 204 21 / 0.28);
  background: rgb(250 204 21 / 0.08);
}

.story-create__notice, .cozy-form__notice p {
  margin: 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-main);
}

.story-create__notice-action, .cozy-form__notice-action {
  justify-self: start;
}

.story-create__genre-grid, .cozy-form__genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr));
  gap: 0.55rem;
}

.story-create__genre, .cozy-form__genre {
  display: grid;
  gap: 0.25rem;
  justify-items: center;
  min-height: 5.1rem;
  padding: 0.65rem 0.45rem 0.55rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.38);
  color: var(--text-main);
  cursor: pointer;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    background-color var(--token-motion-fast) var(--token-ease-out),
    transform var(--token-motion-fast) var(--token-ease-out);
}

.story-create__genre:hover:not(:disabled) , .cozy-form__genre:hover:not(:disabled)  {
  border-color: rgb(var(--accent-rgb) / 0.34);
  transform: translateY(-1px);
}

.story-create__genre--selected, .cozy-form__genre--selected {
  border-color: rgb(var(--accent-rgb) / 0.55);
  background: rgb(var(--accent-rgb) / 0.14);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 0.12);
}

.story-create__genre--disabled, .cozy-form__genre--disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.story-create__genre:focus-visible , .cozy-form__genre:focus-visible  {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.32);
}

.story-create__genre-emoji, .cozy-form__genre-emoji {
  font-size: 1.45rem;
  line-height: 1;
}

.story-create__genre-name, .cozy-form__genre-name {
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}

.story-create__genre-badge, .cozy-form__genre-badge {
  font-size: calc(10px * var(--ui-font-scale, 1));
  color: var(--text-muted);
  text-transform: lowercase;
}

.story-create__genre-description, .cozy-form__genre-description {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-muted);
  background: var(--home-opening-card-bg);
  border: 1px solid var(--home-quote-border);
}

.story-create__field, .cozy-form__field {
  display: grid;
  gap: 0.4rem;
}

.story-create__field--wide, .cozy-form__field--wide {
  grid-column: 1 / -1;
}

.story-create__field-label, .cozy-form__field-label {
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.story-create__input, .cozy-form__input,
.story-create__textarea, .cozy-form__textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.55);
  color: var(--text-main);
  padding: 0.7rem 0.85rem;
  font-family: var(--token-font-family);
  font-size: calc(15px * var(--ui-font-scale, 1));
  line-height: 1.45;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    box-shadow var(--token-motion-fast) var(--token-ease-out);
}

.story-create__textarea, .cozy-form__textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.story-create__textarea--lg, .cozy-form__textarea--lg {
  min-height: 8.5rem;
}

.story-create__input:focus-visible,
.story-create__textarea:focus-visible,
.cozy-form__input:focus-visible,
.cozy-form__textarea:focus-visible {
  outline: none;
  border-color: rgb(var(--accent-rgb) / 0.52);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.24);
}

.story-create__input::placeholder,
.story-create__textarea::placeholder,
.cozy-form__input::placeholder,
.cozy-form__textarea::placeholder {
  color: var(--text-muted);
}

.story-create__char-count, .cozy-form__char-count {
  justify-self: end;
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--text-muted);
}

.story-create__field-grid, .cozy-form__field-grid {
  display: grid;
  gap: 0.75rem;
}

.story-create__inline-hint, .cozy-form__inline-hint {
  margin: 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-muted);
}

.story-create__ready-plots, .cozy-form__ready-plots {
  display: grid;
  gap: 0.5rem;
}

.story-create__ready-plots-scroll, .cozy-form__ready-plots-scroll {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.story-create__ready-plot, .cozy-form__ready-plot {
  flex: 0 0 min(14rem, 78vw);
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.38);
  color: var(--text-main);
  text-align: left;
  scroll-snap-align: start;
  cursor: pointer;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    background-color var(--token-motion-fast) var(--token-ease-out);
}

.story-create__ready-plot--selected, .cozy-form__ready-plot--selected {
  border-color: rgb(var(--accent-rgb) / 0.52);
  background: rgb(var(--accent-rgb) / 0.12);
}

.story-create__ready-plot-title, .cozy-form__ready-plot-title {
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 650;
}

.story-create__ready-plot-hint, .cozy-form__ready-plot-hint {
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.4;
  color: var(--text-muted);
}

.story-create__character-chips, .cozy-form__character-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.story-create__character-chip, .cozy-form__character-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.38);
  color: var(--text-main);
  font-size: calc(13px * var(--ui-font-scale, 1));
  cursor: pointer;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    background-color var(--token-motion-fast) var(--token-ease-out);
}

.story-create__character-chip--selected, .cozy-form__character-chip--selected {
  border-color: rgb(var(--accent-rgb) / 0.52);
  background: rgb(var(--accent-rgb) / 0.14);
}

.story-create__character-chip--disabled, .cozy-form__character-chip--disabled,
.story-create__character-chip:disabled , .cozy-form__character-chip:disabled  {
  opacity: 0.45;
  cursor: not-allowed;
}

.story-create__character-chip-badge, .cozy-form__character-chip-badge {
  font-size: calc(11px * var(--ui-font-scale, 1));
  color: var(--text-muted);
}

.story-create__advanced-toggle, .cozy-form__advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-size: calc(14px * var(--ui-font-scale, 1));
  font-weight: 650;
  cursor: pointer;
}

.story-create__advanced-toggle:focus-visible , .cozy-form__advanced-toggle:focus-visible  {
  outline: none;
  box-shadow: inset 0 0 0 2px rgb(var(--accent-rgb) / 0.38);
}

.story-create__advanced-chevron, .cozy-form__advanced-chevron {
  color: var(--text-muted);
}

.story-create__advanced-body, .cozy-form__advanced-body {
  display: grid;
  gap: 0.85rem;
  padding: 0 1rem 1rem;
}

.story-create__toggle-card, .cozy-form__toggle-card {
  border-radius: 10px;
  border: 1px solid var(--home-quote-border);
  background: var(--home-opening-card-bg);
  padding: 0.7rem 0.75rem;
}

.story-create__toggle, .cozy-form__toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.story-create__toggle--flat, .cozy-form__toggle--flat {
  padding: 0.15rem 0;
}

.story-create__toggle, .cozy-form__toggle input {
  margin-top: 0.2rem;
  flex: 0 0 auto;
}

.story-create__toggle-copy, .cozy-form__toggle-copy {
  display: grid;
  gap: 0.2rem;
}

.story-create__toggle-title, .cozy-form__toggle-title {
  font-size: calc(14px * var(--ui-font-scale, 1));
  font-weight: 600;
  color: var(--text-main);
}

.story-create__toggle-hint, .cozy-form__toggle-hint {
  font-size: calc(12px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-muted);
}

.story-create__style-grid, .cozy-form__style-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.story-create__style-pill, .cozy-form__style-pill {
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgb(7 11 28 / 0.38);
  color: var(--text-main);
  font-size: calc(12px * var(--ui-font-scale, 1));
  cursor: pointer;
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    background-color var(--token-motion-fast) var(--token-ease-out);
}

.story-create__style-pill--selected, .cozy-form__style-pill--selected {
  border-color: rgb(var(--accent-rgb) / 0.52);
  background: rgb(var(--accent-rgb) / 0.14);
}

.story-create__footer, .cozy-form__footer {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.25rem;
}

.story-create__slots, .cozy-form__slots {
  margin: 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  color: var(--text-muted);
}

.story-create__slots--warn, .cozy-form__slots--warn {
  color: #f5c98a;
}

.story-create__slots-block, .cozy-form__slots-block {
  display: grid;
  gap: 0.55rem;
}

.story-create__submit, .cozy-form__submit {
  width: 100%;
  justify-content: center;
}

.story-create__choice--compact, .cozy-form__choice--compact {
  min-height: 3.25rem;
  padding: 0.55rem 0.65rem;
}

.story-create__choice--compact .story-create__choice-icon,
.story-create__choice--compact .cozy-form__choice-icon,
.cozy-form__choice--compact .story-create__choice-icon,
.cozy-form__choice--compact .cozy-form__choice-icon {
  font-size: 1.1rem;
}

.story-create__section--sticky, .cozy-form__section--sticky {
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.story-create__filter-group, .cozy-form__filter-group {
  display: grid;
  gap: 0.45rem;
}

.cozy-form__filters-body {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.35rem;
}

.story-create__notice--info, .cozy-form__notice--info {
  border-color: rgb(var(--accent-rgb) / 0.28);
  background: rgb(var(--accent-rgb) / 0.08);
}

.app-nav-drawer__cozy-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.app-main--auth .cozy-form__section {
  margin-top: 0.25rem;
}

.cozy-form__auth-card {
  margin-top: 0.35rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .story-create-card {
    padding: 12px 12px 14px;
  }

  .story-create__choice-row--duo, .cozy-form__choice-row--duo {
    grid-template-columns: minmax(0, 1fr);
  }

  .story-create__genre-grid, .cozy-form__genre-grid {
    grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr));
  }
}

.auth-form {
  display: grid;
  gap: 0.75rem;
}

.auth-form .auth-form-submit {
  width: 100%;
  margin-top: 1rem;
  align-self: stretch;
  justify-content: center;
}

.auth-form--section {
  margin-top: 1rem;
}

.auth-label {
  display: grid;
  gap: 0.35rem;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-label--checkbox-inline {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.auth-label--checkbox-top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.auth-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.auth-switch {
  margin-top: 1.5rem;
}

.stack-md {
  display: grid;
  gap: 0.75rem;
}

.row-wrap-sm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mt-sm {
  margin-top: 0.5rem;
}

.mt-md {
  margin-top: 0.75rem;
}

.mt-lg {
  margin-top: 1rem;
}

.mt-xl {
  margin-top: 1.5rem;
}

.mb-sm {
  margin-bottom: 0.5rem;
}

.mb-md {
  margin-bottom: 0.75rem;
}

.mb-lg {
  margin-bottom: 1rem;
}

.mb-compact {
  margin-bottom: 0.6rem;
}

.note-tight {
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.side-card--mt-md {
  margin-top: 0.75rem;
}

.side-card--mt-lg {
  margin-top: 1rem;
}

.side-card--mt-xl {
  margin-top: 1.5rem;
}

.side-card--mb-md {
  margin-bottom: 0.75rem;
}

.side-card--mb-compact {
  margin-bottom: 0.6rem;
}

/* Публичные истории: в свёрнутом блоке подсказка только на широком экране */
@media (max-width: 960px) {
  .public-collapsible-section__collapsed-hint {
    display: none;
  }
}

.admin-tab-groups {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.admin-tab-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
}

.admin-tab-group__title {
  margin: 0 0 0.45rem;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.moderation-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.moderation-priority--ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.16);
}

.moderation-priority--warning {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.14);
}

.moderation-priority--critical {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.52);
  background: rgba(239, 68, 68, 0.16);
}

.admin-list {
  display: grid;
  gap: 0.55rem;
}

.admin-list-row {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
}

.admin-list-row--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.admin-list-row--clickable:hover,
.admin-list-row--clickable:focus-visible {
  border-color: rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.08);
  outline: none;
}

.admin-list-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.admin-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.admin-status-chip--pending {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.16);
}

.admin-status-chip--resolved {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.16);
}

.admin-status-chip--rejected {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.14);
}

.admin-status-chip--all,
.admin-status-chip--info {
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.16);
}

.admin-status-chip--active {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.16);
}

.admin-status-chip--blocked {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.16);
}

.admin-status-chip--processed {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.16);
}

.admin-status-chip--warning {
  border-color: rgba(234, 179, 8, 0.5);
  background: rgba(234, 179, 8, 0.15);
}

.admin-chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 0.25rem 0.1rem;
}

.admin-chat-message {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
}

.admin-chat-message--deleted {
  opacity: 0.72;
  border-style: dashed;
  background: rgba(239, 68, 68, 0.06);
}

.admin-chat-message__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.admin-chat-message__body {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.admin-filter-sticky-wrap {
  position: sticky;
  top: 0.45rem;
  z-index: 4;
  padding: 0.4rem 0.45rem 0.25rem;
  margin: 0 0 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(7, 11, 28, 0.82);
  backdrop-filter: blur(4px);
}

.admin-home-illustration-schedule-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-home-illustration-preview {
  display: block;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--token-radius-md, 10px);
  border: 1px solid color-mix(in srgb, var(--token-border) 70%, transparent);
}

.admin-period-stats-table-wrap {
  overflow-x: auto;
  margin-top: 0.35rem;
}

.admin-period-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-period-stats-table th,
.admin-period-stats-table td {
  border: 1px solid rgba(148, 163, 184, 0.32);
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.admin-period-stats-table th {
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

.admin-period-stats-table td:first-child {
  text-align: left;
  min-width: 11rem;
}

.admin-period-stats-table td:not(:first-child) {
  text-align: right;
  white-space: nowrap;
}

.admin-sheets-purchases-table th,
.admin-sheets-purchases-table td {
  vertical-align: top;
}

.admin-sheets-purchases-table tfoot th,
.admin-sheets-purchases-table tfoot td {
  font-weight: 600;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
}

.admin-period-stats-table td.admin-period-revenue-cell {
  white-space: normal;
  text-align: left;
  max-width: 14rem;
}

.side-card--sticky {
  margin-top: 1rem;
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.textarea-md {
  min-height: 6rem;
  resize: vertical;
}

.textarea-sm {
  min-height: 4rem;
  resize: vertical;
}

.textarea-note {
  min-height: 5rem;
  resize: vertical;
}

.textarea-lg {
  min-height: 7rem;
  resize: vertical;
}

.hint-block {
  display: block;
  margin-top: 0.35rem;
}

.list-muted {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 14px;
}

.list-muted li {
  margin-bottom: 0.65rem;
}

.panel-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-header-row--sm {
  gap: 0.5rem;
}

.panel-header-row--lg {
  gap: 1rem;
}

.panel-header-row .side-title {
  margin: 0;
}

.excerpt-block {
  margin-top: 0.25rem;
}

.mt-xs {
  margin-top: 0.35rem;
}

.mt-compact {
  margin-top: 0.4rem;
}

.row-wrap-md {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.row-wrap-soft {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.row-wrap-xs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.row-center {
  align-items: center;
}

.my-games-continue-card {
  gap: 0;
}

.my-games-continue-card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.game-list-illustration-thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: rgb(0 0 0 / 0.18);
}

.game-list-illustration-thumb__img,
.game-list-illustration-thumb__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-list-illustration-thumb__placeholder {
  background: linear-gradient(135deg, rgb(var(--accent-rgb) / 0.12), rgb(var(--accent-rgb) / 0.04));
}

.my-games-continue-card__body {
  display: flex;
  flex: 1 1 12rem;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.my-games-continue-card__title {
  font-size: calc(15px * var(--ui-font-scale));
  line-height: 1.35;
  word-break: break-word;
}

.justify-between {
  justify-content: space-between;
}

.row-start {
  align-items: flex-start;
}

.stack-sm {
  display: grid;
  gap: 0.5rem;
}

.stack-xs {
  display: grid;
  gap: 0.4rem;
}

.stack-xxs {
  display: grid;
  gap: 0.35rem;
}

.self-end {
  align-self: flex-end;
}

.w-full {
  width: 100%;
}

.flex-1 {
  flex: 1;
}

.flex-1-min-12 {
  flex: 1 1 12rem;
}

.flex-1-min-16 {
  flex: 1 1 16rem;
}

.flex-1-min-22 {
  flex: 1;
  min-width: 220px;
}

.side-title--flush {
  margin-top: 0;
}

.side-title--sm {
  font-size: calc(14px * var(--ui-font-scale));
}

.side-title--archive {
  margin-top: 0;
  margin-bottom: 0.35rem;
  font-size: calc(16px * var(--ui-font-scale));
}

.side-placeholder--flush {
  margin-top: 0;
}

.side-placeholder--compact {
  margin-top: 0.25rem;
}

.side-placeholder--caption {
  margin-top: 0.35rem;
  margin-bottom: 0;
  font-size: 0.9em;
}

.side-placeholder--meta {
  margin: 0;
  font-size: 0.88em;
}

.item-divider-md {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.item-divider-sm {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
}

.item-divider-compact {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.text-main {
  color: var(--text-main);
}

.font-semibold {
  font-weight: 600;
}

.ml-sm {
  margin-left: 0.5rem;
}

.mr-xs {
  margin-right: 0.35rem;
}

.section-divider-top {
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
}

.soft-panel {
  border-radius: 12px;
  border: 1px solid var(--home-quote-border);
  background: var(--home-opening-card-bg);
  padding: 0.75rem 0.85rem;
}

.ui-button--danger-soft {
  border-color: rgb(214 86 86 / 0.36);
}

.ui-button--tiny {
  padding: 0.1rem 0.45rem;
  font-size: 12px;
}

.ui-button--split {
  justify-content: space-between;
}

.pre-wrap {
  white-space: pre-wrap;
}

.break-word {
  word-break: break-word;
}

.break-all {
  word-break: break-all;
}

.detail-box {
  margin-top: 0.55rem;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.reader-text {
  white-space: pre-wrap;
  line-height: 1.45;
}

.chat-scroll-panel {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 0.92rem;
  line-height: 1.35;
}

.chat-message-row {
  margin-bottom: 0.45rem;
  display: flex;
  gap: 0.35rem;
  justify-content: space-between;
  align-items: flex-start;
}

.chat-message-body {
  flex: 1;
  min-width: 0;
}

.chat-message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.ui-button--chat-delete {
  flex-shrink: 0;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.skill-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.skill-progress {
  margin-top: 0.35rem;
  height: 7px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.12);
}

.skill-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dice-grad-3), var(--dice-grad-2) 55%, var(--dice-grad-1));
}

.skill-meta {
  margin-top: 0.3rem;
  font-size: 12px;
}

.modal-card--sm {
  max-width: 28rem;
  width: 100%;
}

.modal-card--lg {
  max-width: 44rem;
  width: 100%;
}

.admin-violation-review__text {
  max-height: min(52vh, 28rem);
  overflow: auto;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.9rem;
  line-height: 1.45;
}

.admin-violation-review__snippet {
  max-height: 6rem;
  overflow: auto;
}

.game-check-help {
  font-size: calc(14px * var(--ui-font-scale));
  line-height: 1.45;
}

.game-check-help__lead {
  margin: 0 0 1rem;
}

.game-check-help__section {
  margin-bottom: 1.1rem;
}

.game-check-help__section:last-child {
  margin-bottom: 0;
}

.game-check-help__heading {
  margin: 0 0 0.45rem;
  font-size: calc(15px * var(--ui-font-scale));
  font-weight: 600;
}

.game-check-help__formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.game-check-help__formula-part {
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface-elevated, rgba(255, 255, 255, 0.06));
}

.game-check-help__formula-eq,
.game-check-help__formula-op {
  color: var(--text-muted);
  font-weight: 500;
}

.game-check-help__example {
  margin: 0;
}

.game-check-help__table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0;
}

.game-check-help__table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(13px * var(--ui-font-scale));
}

.game-check-help__table th,
.game-check-help__table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.game-check-help__table th {
  color: var(--text-muted);
  font-weight: 600;
}

.game-check-help__list {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.game-check-help__list li + li {
  margin-top: 0.25rem;
}

.side-title--xs {
  font-size: calc(13px * var(--ui-font-scale));
}

.font-semibold-sm {
  font-weight: 600;
  font-size: 0.95rem;
}

.row-pad-xs {
  padding: 0.25rem 0;
}

.row-pad-sm {
  padding: 0.5rem 0;
}

.muted-85 {
  opacity: 0.9;
}

.muted-65 {
  opacity: 0.78;
}

.check-offset {
  margin-top: 0.2rem;
}

.app-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: 24rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.app-toast__text {
  line-height: 1.45;
  font-size: 14px;
}

.app-toast__footer {
  display: flex;
  justify-content: flex-end;
}

.app-toast__ok {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.app-toast__ok:hover {
  background: rgba(255, 255, 255, 0.32);
}

.app-toast--attention {
  max-width: min(24rem, calc(100vw - 2rem));
}

.app-toast--success {
  background: rgba(16, 185, 129, 0.92);
}

.app-toast--error {
  background: rgba(239, 68, 68, 0.92);
}

.app-toast--info {
  background: rgba(59, 130, 246, 0.92);
}

.register-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 0.55rem;
  line-height: 1.45;
}

.register-consent-label input[type="checkbox"] {
  margin-top: 0.14rem;
}

.register-captcha-wrap {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  min-height: 4.25rem;
}

.yandex-smartcaptcha-field {
  width: 100%;
  display: flex;
  justify-content: center;
}

.register-inline-link {
  border: 0;
  background: none;
  padding: 0;
  color: rgb(var(--accent-rgb) / 0.96);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font: inherit;
}

.register-inline-link:hover {
  color: #ddd3ff;
}

.register-note {
  margin: 0.4rem 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.register-legal-button {
  margin-top: 0.55rem;
  border: 1px solid rgb(var(--accent-rgb) / 0.4);
  border-radius: var(--radius-md);
  background: rgb(var(--accent-rgb) / 0.14);
  color: var(--text-main);
  text-align: left;
  padding: 0.6rem 0.72rem;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.register-legal-button:hover {
  border-color: rgb(var(--accent-rgb) / 0.72);
  background: rgb(var(--accent-rgb) / 0.22);
}

.register-age-badge {
  margin-top: 0.8rem;
  width: fit-content;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cookie-banner {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 130;
  max-width: 54rem;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.cookie-banner-title {
  margin: 0;
  font-weight: 700;
}

.cookie-banner-text {
  margin: 0.45rem 0 0;
  color: var(--text-main);
  line-height: 1.45;
}

.cookie-banner-link {
  color: rgb(var(--accent-rgb) / 0.96);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner-options {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.45rem;
}

.cookie-banner-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--text-main);
  font-size: 13px;
}

.cookie-banner-option input[type="checkbox"] {
  margin-top: 0.15rem;
}

.cookie-banner-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

html[data-cookie-banner-visible="1"] .app-root {
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px) + 5.5rem);
}

html[data-cookie-banner-visible="1"] .pwa-install-hint {
  bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
}

.game-view-network-error {
  margin-bottom: 0.65rem;
}

@media (max-width: 600px) {
  .cookie-banner {
    left: 0.6rem;
    right: 0.6rem;
    bottom: 0.6rem;
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
  }
}

.legal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(1, 3, 8, 0.78);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.legal-modal-card {
  width: min(52rem, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(145deg, var(--bg-elevated), var(--bg-muted));
  box-shadow: var(--shadow-soft);
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.legal-modal-title {
  margin: 0;
  font-size: 1.05rem;
}

.legal-modal-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.legal-modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.legal-modal-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
}

.legal-modal-section h2 {
  margin: 0;
  font-size: 1rem;
}

.legal-modal-section p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.legal-doc-section {
  margin-top: 0.9rem;
}

.legal-doc-toc {
  margin-top: 0.8rem;
  padding: 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
}

.legal-doc-toc-title {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.legal-doc-toc-links {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.legal-doc-toc-link {
  border: 1px solid rgb(var(--accent-rgb) / 0.35);
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--text-main);
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 0.32rem 0.58rem;
  cursor: pointer;
}

.legal-doc-toc-link:hover {
  border-color: rgb(var(--accent-rgb) / 0.62);
  background: rgb(var(--accent-rgb) / 0.2);
}

.legal-doc-section-title {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-main);
}

.legal-doc-paragraph {
  margin: 0.5rem 0 0;
  color: var(--text-main);
  font-size: 0.86rem;
  line-height: 1.55;
}

.legal-doc-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  color: var(--text-main);
  font-size: 0.86rem;
  line-height: 1.55;
}

.legal-doc-list li + li {
  margin-top: 0.35rem;
}

.legal-doc-section-actions {
  margin-top: 0.65rem;
  display: flex;
  justify-content: flex-end;
}

.legal-doc-back-to-top {
  border: 1px solid rgb(var(--accent-rgb) / 0.35);
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.08);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.26rem 0.52rem;
  cursor: pointer;
}

.legal-doc-back-to-top:hover {
  border-color: rgb(var(--accent-rgb) / 0.62);
  color: var(--text-main);
  background: rgb(var(--accent-rgb) / 0.16);
}

.site-footer {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.site-footer-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed rgb(255 255 255 / 0.24);
}

.site-footer-link:hover {
  color: var(--text-main);
  border-bottom-color: rgb(255 255 255 / 0.45);
}

.site-footer-separator {
  opacity: 0.45;
}

.site-footer-age {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.legal-static-page {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: radial-gradient(circle at top left, var(--accent-soft), var(--bg-elevated));
  box-shadow: var(--shadow-soft);
  padding: 12px 14px 14px;
}

.app-main--legal {
  max-width: 58rem;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  grid-template-columns: 1fr;
}

.auth-busy-slot {
  min-height: 1.5rem;
}

.status-text--warn {
  margin: 0.35rem 0 0;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: #e8c4a8;
}

.legal-static-subtitle,
.legal-static-updated {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

.legal-static-section {
  margin-top: 1rem;
}

.legal-static-section-title {
  margin: 0;
  font-size: 1rem;
}

.legal-static-paragraph {
  margin: 0.52rem 0 0;
  line-height: 1.55;
}

.legal-static-list {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  line-height: 1.55;
}

.age-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(1, 3, 8, 0.86);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.age-gate-card {
  width: min(46rem, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.1rem;
}

.age-gate-title {
  margin: 0;
  font-size: 1.1rem;
}

.age-gate-body {
  margin-top: 0.7rem;
  color: var(--text-main);
  line-height: 1.55;
  font-size: 0.92rem;
}

.age-gate-body p {
  margin: 0.55rem 0 0;
}

.age-gate-body ul {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
}

.age-gate-body li + li {
  margin-top: 0.35rem;
}

.age-gate-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.age-gate-card--welcome {
  text-align: center;
  padding: 1.35rem 1.25rem 1.15rem;
}

.age-gate-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.age-gate-logo {
  width: min(220px, 72vw);
  height: auto;
  display: block;
}

.age-gate-lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--text-main);
}

.age-gate-emoji {
  display: inline-block;
}

.age-gate-actions--stacked {
  margin-top: 1.1rem;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.age-gate-actions--stacked .ui-button {
  width: 100%;
  justify-content: center;
}

.age-gate-btn-primary {
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.age-gate-legal {
  margin: 1rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, rgba(255, 255, 255, 0.72));
}

.age-gate-legal-link {
  color: var(--accent, #c9a227);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.product-onboarding {
  position: fixed;
  inset: 0;
  z-index: 215;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px)) calc(18px + env(safe-area-inset-left, 0px));
  background: var(--body-background);
  overflow: hidden;
}

.product-onboarding__header {
  flex-shrink: 0;
}

.product-onboarding__main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: auto;
}

.product-onboarding__card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: min(56rem, 100%);
  margin: 0 auto;
  min-height: min(100%, 32rem);
  border-radius: var(--radius-lg);
  border: 1px solid rgb(255 255 255 / 0.08);
  background: var(--header-background);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  padding: clamp(1rem, 3vw, 1.6rem);
}

.product-onboarding__card--sandbox {
  border-color: rgb(var(--accent-rgb) / 0.22);
  background:
    radial-gradient(ellipse 95% 70% at 8% 0%, rgb(var(--accent-rgb) / 0.11), transparent 58%),
    var(--header-background);
}

.product-onboarding__layout {
  flex: 1 1 auto;
  display: grid;
  gap: clamp(1rem, 3vw, 1.75rem);
  align-items: center;
}

.product-onboarding-illustration {
  order: 1;
}

.product-onboarding__copy {
  order: 2;
}

@media (min-width: 768px) {
  .product-onboarding__layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  }

  .product-onboarding__copy {
    order: 1;
  }

  .product-onboarding-illustration {
    order: 2;
  }
}

.product-onboarding__kicker {
  margin: 0 0 0.45rem;
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.product-onboarding__title {
  margin: 0;
  font-size: calc(22px * var(--ui-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--text-main);
}

.product-onboarding__flavor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.product-onboarding__flavor-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgb(var(--accent-rgb) / 0.22);
  background: rgb(var(--accent-rgb) / 0.08);
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.35;
  color: var(--text-main);
  white-space: nowrap;
}

.product-onboarding__copy--intro {
  align-self: center;
}

@media (min-width: 768px) {
  .product-onboarding__layout--sandbox {
    gap: clamp(1.15rem, 3vw, 2rem);
  }
}

.product-onboarding__body {
  margin-top: 0.85rem;
}

.product-onboarding__paragraph {
  margin: 0.55rem 0 0;
  line-height: 1.55;
  font-size: calc(14px * var(--ui-font-scale, 1));
  color: var(--text-muted);
}

.product-onboarding__paragraph--lead {
  margin-top: 0;
  font-size: calc(16px * var(--ui-font-scale, 1));
  font-weight: 500;
  color: var(--text-main);
}

.product-onboarding__body > .product-onboarding__paragraph:first-child {
  margin-top: 0;
}

.product-onboarding__list {
  margin: 0.65rem 0 0;
  padding-left: 1.2rem;
  line-height: 1.55;
  font-size: calc(16px * var(--ui-font-scale, 1));
  color: var(--text-main);
}

.product-onboarding__list li + li {
  margin-top: 0.35rem;
}

.product-onboarding-illustration {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: min(42vh, 22rem);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 0.06);
}

.product-onboarding-illustration--step1 {
  background:
    radial-gradient(circle at 30% 25%, rgb(var(--accent-rgb) / 0.45), transparent 55%),
    radial-gradient(circle at 70% 80%, rgb(var(--accent-deep-rgb) / 0.35), transparent 50%),
    linear-gradient(145deg, var(--bg-elevated), var(--bg-main));
  box-shadow:
    inset 0 0 0 1px rgb(var(--accent-rgb) / 0.18),
    0 0 2.2rem rgb(var(--accent-rgb) / 0.12);
}

.product-onboarding-illustration--step1::after {
  content: "✨";
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  z-index: 1;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
  text-shadow: 0 0 14px rgb(var(--accent-rgb) / 0.55);
}

.product-onboarding__layout--sandbox .product-onboarding__copy--intro {
  padding: 0.15rem 0;
}

.product-onboarding-illustration--step2 {
  background:
    linear-gradient(90deg, var(--bg-muted) 0%, var(--bg-muted) 48%, var(--bg-elevated) 52%, var(--bg-main) 100%),
    radial-gradient(circle at 22% 40%, rgb(var(--accent-rgb) / 0.3), transparent 45%),
    radial-gradient(circle at 78% 35%, rgb(var(--accent-rgb) / 0.22), transparent 48%);
}

.product-onboarding-illustration--step3 {
  background:
    radial-gradient(circle at 50% 55%, rgb(var(--accent-rgb) / 0.2), transparent 60%),
    linear-gradient(160deg, var(--bg-elevated), var(--bg-main));
}

.product-onboarding-illustration__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.product-onboarding__footer {
  flex-shrink: 0;
  margin-top: clamp(1rem, 3vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.product-onboarding__dots {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
}

.product-onboarding__dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.22);
  cursor: pointer;
  transition: transform var(--token-motion-fast) var(--token-ease-out),
    background var(--token-motion-fast) var(--token-ease-out);
}

.product-onboarding__dot--active {
  background: var(--accent);
  transform: scale(1.2);
}

.product-onboarding__dot:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.45);
}

.product-onboarding__next {
  width: min(22rem, 100%);
  justify-content: center;
  font-size: calc(16px * var(--ui-font-scale, 1));
  padding: 0.8rem 1.25rem;
}

.product-onboarding__skip {
  align-self: flex-end;
  margin-top: 0.25rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: calc(14px * var(--ui-font-scale, 1));
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  text-align: right;
}

.product-onboarding__skip:hover {
  color: var(--text-main);
}

.product-onboarding__skip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.38);
  border-radius: 4px;
}

.guest-register-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(1, 3, 8, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.guest-register-card {
  width: min(28rem, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--header-background);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
  padding: 1.15rem 1.2rem;
}

.guest-register-title {
  margin: 0;
  font-size: 1.15rem;
}

.guest-register-text {
  margin: 0.65rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-main);
}

.guest-register-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guest-register-actions .ui-button {
  width: 100%;
  justify-content: center;
}

.app-main--guest-gate,
.app-main--welcome {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: min(70vh, 520px);
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
}

.guest-section-gate {
  width: min(32rem, 100%);
  margin: 0 auto;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.guest-section-gate__title {
  margin: 0;
  font-size: 1.15rem;
}

.guest-section-gate__text {
  margin: 0.75rem 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-main);
}

.guest-section-gate__actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.guest-section-gate__actions .ui-button {
  width: 100%;
  justify-content: center;
}

.guest-section-gate__login {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.72));
}

.guest-world-picker {
  width: min(42rem, 100%);
  margin: 0 auto;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  box-shadow: var(--shadow-soft);
}

.guest-world-picker__own-story {
  margin-top: 1rem;
}

.guest-world-picker__grid,
.welcome-landing__worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.featured-world-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.featured-world-card--busy {
  opacity: 0.82;
}

.featured-world-card:disabled {
  cursor: wait;
}

.featured-world-card:hover:not(:disabled),
.featured-world-card:focus-visible:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
}

.featured-world-card__cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.35);
}

.featured-world-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.featured-world-card__title,
.featured-world-card__tagline,
.featured-world-card__genre,
.featured-world-card__cta {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.featured-world-card__title {
  font-size: 0.98rem;
  font-weight: 600;
}

.featured-world-card__tagline {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted, rgba(255, 255, 255, 0.72));
}

.featured-world-card__genre {
  font-size: 0.75rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.55));
}

.featured-world-card__cta {
  margin-top: 0.15rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent, #7dd3c0);
}

.featured-world-card--compact .featured-world-card__tagline {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guest-world-picker__back {
  margin-top: 1rem;
}

.welcome-landing {
  width: min(46rem, 100%);
  margin: 0 auto;
  padding: 0 0.15rem;
}

.product-intro-hero {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.35rem);
  padding: clamp(1.15rem, 3.2vw, 1.65rem);
  border-radius: var(--radius-lg);
  border: 1px solid rgb(var(--accent-rgb) / 0.2);
  background:
    radial-gradient(ellipse 95% 75% at 0% 0%, rgb(var(--accent-rgb) / 0.14), transparent 58%),
    radial-gradient(ellipse 70% 55% at 100% 100%, rgb(var(--accent-deep-rgb) / 0.1), transparent 62%),
    linear-gradient(165deg, rgb(255 255 255 / 0.04), transparent 72%);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.product-intro-hero__headline {
  display: grid;
  gap: 0.55rem;
}

.product-intro-hero__title {
  margin: 0;
  font-size: clamp(1.7rem, 4.8vw, 2.25rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.product-intro-hero__tagline {
  margin: 0 auto;
  max-width: 30ch;
  font-size: calc(16px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: var(--text-muted);
}

.product-intro-hero__highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-intro-hero__highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 4.6rem;
  padding: 0.7rem 0.45rem;
  border-radius: var(--radius-md);
  border: 1px solid rgb(255 255 255 / 0.08);
  background: rgb(0 0 0 / 0.14);
}

.product-intro-hero__highlight-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.product-intro-hero__highlight-label {
  font-size: calc(12.5px * var(--ui-font-scale, 1));
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-main);
}

.product-intro-hero__perks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.product-intro-hero__perk {
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  font-size: calc(12px * var(--ui-font-scale, 1));
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  border: 1px solid rgb(var(--accent-rgb) / 0.3);
  background: rgb(var(--accent-rgb) / 0.1);
}

.product-intro-hero--onboarding {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}

@media (min-width: 768px) {
  .product-intro-hero--onboarding .product-intro-hero__tagline {
    margin-left: 0;
    max-width: 34ch;
  }

  .product-intro-hero--onboarding .product-intro-hero__perks {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .product-intro-hero__highlights {
    grid-template-columns: 1fr;
  }

  .product-intro-hero__highlight {
    flex-direction: row;
    justify-content: flex-start;
    min-height: 0;
    padding: 0.65rem 0.8rem;
    text-align: left;
  }
}

.welcome-landing__actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
}

.welcome-landing__cta {
  width: min(22rem, 100%);
  justify-content: center;
  font-size: calc(16px * var(--ui-font-scale, 1));
  padding: 0.85rem 1.35rem;
}

.welcome-landing__benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.welcome-landing__benefit {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.14);
}

.welcome-landing__benefit-title {
  margin: 0;
  font-size: 0.95rem;
}

.welcome-landing__benefit-text {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted, rgba(255, 255, 255, 0.78));
}

.welcome-landing__worlds {
  margin-top: 1.75rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  box-shadow: var(--shadow-soft);
}

.welcome-landing__worlds-title {
  margin: 0;
  font-size: 1.05rem;
}

.welcome-landing__worlds-lead {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted, rgba(255, 255, 255, 0.78));
}

.welcome-landing__worlds-more {
  margin-top: 0.85rem;
  display: flex;
  justify-content: center;
}

.welcome-landing__login {
  margin: 1.1rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted, rgba(255, 255, 255, 0.72));
}

@media (max-width: 960px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .side-panels--game {
    flex-direction: column;
    overflow: visible;
    gap: 10px;
  }

  .side-panels:not(.side-panels--game) .side-card {
    min-width: 0;
  }
}

/* Сворачиваемые боковые секции в игре (узкий экран) */
.side-panel-section {
  border: none;
  margin: 0;
  padding: 0;
}

.side-panel-section__summary {
  width: 100%;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.side-panel-section__title {
  margin: 0;
  flex: 1 1 auto;
}

.side-panel-section__badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.22);
  color: var(--text-main);
}

.side-panel-section__chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform var(--token-motion-base) var(--token-ease-out);
  flex-shrink: 0;
  margin-right: 2px;
}

.side-panel-section--open .side-panel-section__chevron {
  transform: rotate(-135deg) translateY(2px);
}

.collapsible-reveal {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 320ms var(--token-ease-out);
}

.collapsible-reveal--open {
  grid-template-rows: 1fr;
}

.collapsible-reveal__inner {
  min-height: 0;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-reveal {
    transition: none;
  }
}

/* Сворачивается на любой ширине (справка «Броски и статы» в режиме Игра) */
.side-panels--game .side-panel-section--always-collapsible .side-panel-section__summary {
  display: flex;
}

.side-panels--game .side-panel-section--always-collapsible.side-panel-section--open .side-panel-section__collapse {
  margin-top: 8px;
}

.side-panels--game
  .side-panel-section--always-collapsible
  .side-panel-section__collapse
  > .collapsible-reveal__inner
  > .side-panel-section__body {
  display: flex;
  flex-direction: column;
}

@media (max-width: 960px) {
  .side-panels--game .side-panel-section__body > .side-title:first-child {
    display: none;
  }

  .side-panels--game .side-panel-section__summary {
    display: flex;
  }

  .side-panels--game .side-panel-section--open .side-panel-section__collapse {
    margin-top: 8px;
  }

  .side-panels--game .side-panel-section__collapse > .collapsible-reveal__inner > .side-panel-section__body {
    display: flex;
    flex-direction: column;
  }
}

.cozy-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0.5rem 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgb(214 86 86 / 0.28);
  background: rgb(214 86 86 / 0.08);
}

.cozy-error__icon {
  flex-shrink: 0;
  width: 1.35rem;
  margin-top: 0.05rem;
  font-size: 1.1rem;
  line-height: 1;
  text-align: center;
  color: rgb(245 196 196 / 0.85);
}

.cozy-error__body {
  flex: 1 1 auto;
  min-width: 0;
}

.cozy-error--network {
  border-color: rgb(var(--accent-rgb) / 0.32);
  background: rgb(var(--accent-rgb) / 0.08);
}

.cozy-error--network .cozy-error__icon {
  color: rgb(var(--accent-rgb) / 0.75);
}

.cozy-error--network .cozy-error__title {
  color: var(--text-main);
}

.cozy-error--network .cozy-error__text {
  color: var(--text-muted);
}

.cozy-error--sheets-gift {
  border-color: rgb(var(--accent-rgb) / 0.38);
  background:
    radial-gradient(circle at 12% 18%, rgb(var(--accent-rgb) / 0.14), transparent 52%),
    rgb(var(--accent-rgb) / 0.07);
}

.cozy-error--sheets-gift .cozy-error__icon {
  color: rgb(var(--accent-rgb) / 0.9);
}

.cozy-error--sheets-gift .cozy-error__title {
  color: var(--text-main);
}

.cozy-error__title {
  margin: 0 0 0.35rem;
  font-size: calc(14px * var(--ui-font-scale, 1));
  font-weight: 600;
  color: #f5c4c4;
}

.cozy-error__text {
  margin: 0;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.5;
  color: var(--text-main);
}

.cozy-error__retry {
  margin-top: 0.65rem;
}

.ui-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  gap: 0.45rem;
}

.ui-empty-state__mark {
  width: 40px;
  height: auto;
  opacity: 0.88;
  margin-bottom: 0.25rem;
}

.ui-empty-state__title {
  margin: 0;
  font-size: calc(15px * var(--ui-font-scale, 1));
  font-weight: 600;
  color: var(--text-main);
}

.ui-empty-state__text {
  margin: 0;
  max-width: 22rem;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.5;
  color: var(--text-muted);
}

.ui-empty-state__action {
  margin-top: 0.5rem;
}

.ui-empty-state--compact {
  padding: 0.65rem 0.5rem;
}

.ui-empty-state--compact .ui-empty-state__mark {
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.35rem;
}

.ui-empty-state--in-card {
  padding: 0.85rem 0.5rem;
}

.ui-empty-state--in-card .ui-empty-state__mark {
  width: 32px;
}

.achievement-badge-grid__empty {
  grid-column: 1 / -1;
}

.ui-empty-state__text--align-start {
  text-align: left;
  max-width: none;
}

.home-news-feed {
  display: flex;
  flex-direction: column;
  margin-top: 0.65rem;
}

.home-news-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.home-news-item:first-child {
  padding-top: 0.15rem;
}

.home-news-item:last-child {
  border-bottom: none;
  padding-bottom: 0.1rem;
}

.home-news-item__meta {
  display: block;
  margin: 0 0 0.3rem;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.35;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.home-news-item__title {
  margin: 0 0 0.35rem;
  font-size: calc(16px * var(--ui-font-scale, 1));
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
}

.home-news-item__body {
  font-size: calc(15px * var(--ui-font-scale, 1));
  line-height: 1.55;
  color: var(--token-text-secondary);
}

.home-tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.home-tip-card {
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid rgb(var(--accent-rgb) / 0.14);
  background: rgb(0 0 0 / 0.12);
}

.home-tip-card--cta {
  border-color: rgb(var(--accent-rgb) / 0.28);
  background: linear-gradient(145deg, rgb(var(--accent-rgb) / 0.12), rgba(0, 0, 0, 0.18));
}

.home-tip-card__title {
  margin: 0;
  font-size: calc(15px * var(--ui-font-scale, 1));
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
}

.home-tip-card__text {
  margin: 0.4rem 0 0;
  font-size: calc(14px * var(--ui-font-scale, 1));
  line-height: 1.5;
  color: var(--text-muted);
}

.home-tip-card__action {
  margin-top: 0.65rem;
}

.form-field-hint {
  margin: 0.35rem 0 0;
  font-size: calc(13px * var(--ui-font-scale, 1));
  line-height: 1.45;
  color: #e8c4a8;
}

.participant-chat-empty {
  margin: 0 0 0.5rem;
}

.story-dice-checks-card {
  margin-top: 0;
}

.pwa-install-hint {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  max-width: 54rem;
  margin: 0 auto;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--header-background);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-app-game-view="1"] .app-main--game {
  scroll-padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 960px) {
  html[data-app-game-view="1"] .app-header {
    scroll-margin-top: env(safe-area-inset-top, 0px);
  }
}

html[data-cookie-banner-visible="1"] .app-main--game .side-panels--game,
html[data-pwa-install-hint-visible="1"] .app-main--game .side-panels--game {
  padding-bottom: 5.5rem;
}

html[data-cookie-banner-visible="1"][data-pwa-install-hint-visible="1"] .app-main--game .side-panels--game {
  padding-bottom: calc(5.5rem + 4.5rem);
}

html[data-cookie-banner-visible="1"][data-app-game-view="1"] .pwa-install-hint {
  bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
}

html[data-app-game-view="1"] .app-main--game .custom-action-form {
  scroll-margin-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 600px) {
  .pwa-install-hint {
    left: 0.6rem;
    right: 0.6rem;
    bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
  }
}

.pwa-install-hint__title {
  margin: 0 0 0.25rem;
  font-size: 14px;
  font-weight: 600;
}

.pwa-install-hint__text {
  margin: 0 0 0.65rem;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.pwa-install-instructions--emphasis {
  color: var(--text);
  outline: 2px solid rgb(var(--accent-rgb) / 0.55);
  outline-offset: 4px;
  border-radius: 8px;
  transition: outline-color 0.2s ease, color 0.2s ease;
}

.pwa-install-hint__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (prefers-reduced-motion: reduce) {
  .achievement-badge--just-unlocked .achievement-badge__icon-img,
  .achievement-congrats-modal__glyph {
    animation: none !important;
  }

  .app-main--view-fade {
    animation: none !important;
  }

  .home-illustration-image {
    animation: none !important;
  }

  .story-generation-progress,
  .story-generation-progress-bar,
  .story-generation-dot,
  .story-generation-line {
    animation: none !important;
  }
}

.app-main--view-fade {
  animation: appMainViewFade 0.24s var(--token-ease-out) both;
}

@keyframes appMainViewFade {
  from {
    opacity: 0.82;
  }
  to {
    opacity: 1;
  }
}

.profile-sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0.5rem;
}

.profile-sound-row + .profile-sound-row {
  margin-top: 0.35rem;
}

.profile-sound-preview {
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 640px) {
  .app-logo-slogan {
    display: none;
  }

  .app-header {
    border-radius: 16px;
    align-items: center;
    padding: 10px 12px;
  }

  .app-header-right {
    align-items: center;
    max-width: min(100%, calc(100vw - 90px));
    gap: 6px;
  }

  .app-root {
    padding: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px))
      calc(14px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
  }

  .story-panel {
    padding: 14px 14px 16px;
  }

  .app-header--session .ui-button {
    padding: 5px 10px;
    font-size: 12px;
  }

  .age-gate-actions {
    justify-content: stretch;
  }

  .age-gate-actions .ui-button,
  .age-gate-actions .custom-action-submit {
    width: 100%;
  }
}

.achievement-badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 5.5rem;
  max-width: 10rem;
  padding: 0.45rem 0.4rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
}

.achievement-badge--unlocked {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.08);
}

.achievement-badge--just-unlocked .achievement-badge__icon-img {
  animation: achievementBadgePop 0.42s var(--token-ease-out);
}

@keyframes achievementBadgePop {
  0% {
    transform: scale(0.88);
    opacity: 0.75;
  }
  55% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.achievement-badge__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.achievement-badge__icon-img {
  display: block;
  width: 2.65rem;
  height: 2.65rem;
  max-width: 100%;
  object-fit: contain;
  opacity: 0.98;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 8px rgba(212, 175, 55, 0.18));
}

.achievement-badge--secret .achievement-badge__icon-img {
  opacity: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 10px rgba(180, 160, 220, 0.22));
}

.achievement-badge__label {
  font-size: calc(11px * var(--ui-font-scale, 1));
  text-align: center;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.88);
}

.achievement-full-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.achievement-progress-toggle {
  margin-top: 0.7rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.4rem 0.8rem;
  background: rgba(5, 8, 22, 0.65);
  color: var(--text-main);
  font-size: calc(13px * var(--ui-font-scale, 1));
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.achievement-progress-toggle:hover {
  background: rgb(var(--accent-rgb) / 0.22);
  border-color: rgb(var(--accent-rgb) / 0.7);
}

.achievement-progress-toggle__chevron {
  flex-shrink: 0;
  font-size: 0.85rem;
  opacity: 0.85;
  transition: transform 0.22s ease;
}

.achievement-progress-toggle[aria-expanded="true"] .achievement-progress-toggle__chevron {
  transform: rotate(180deg);
}

.achievement-progress-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.24s ease, opacity 0.2s ease;
}

.achievement-progress-collapse--expanded {
  grid-template-rows: 1fr;
  opacity: 1;
}

.achievement-progress-collapse__inner {
  min-height: 0;
  overflow: hidden;
}

.achievement-full-list__row {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.achievement-full-list__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.achievement-progress-track {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.35rem 0 0.2rem;
  overflow: hidden;
}

.achievement-progress-track__fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.75), rgba(56, 189, 248, 0.65));
  min-width: 0;
  transition: width 0.25s ease;
}

.achievement-congrats-modal {
  text-align: center;
  max-width: 22rem;
}

.achievement-congrats-modal__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  margin-bottom: 0.35rem;
}

.achievement-congrats-modal__glyph {
  width: 4rem;
  height: 4rem;
  object-fit: contain;
  opacity: 0.98;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 14px rgba(212, 175, 55, 0.2));
  animation: achievementBadgePop 0.45s var(--token-ease-out);
}

.achievement-congrats-modal__title {
  font-size: calc(17px * var(--ui-font-scale, 1));
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.achievement-secret-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  color: rgba(253, 224, 71, 0.95);
  vertical-align: middle;
}

.achievement-badge--secret {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.1);
}

.achievement-full-list__row--secret {
  opacity: 0.92;
}

/* Персонажи из библиотеки: недоступные (занятые) пункты списка — приглушённый текст */
select.character-library-select option:disabled {
  color: rgba(150, 155, 175, 0.75);
}

.site-broadcast-backdrop {
  z-index: 13050;
}

.site-broadcast-modal {
  max-height: min(80vh, 32rem);
  overflow-y: auto;
}

.ui-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--token-font-family);
  font-size: var(--token-fs-14);
  font-weight: 600;
  line-height: 1;
  transition:
    background-color var(--token-motion-base) var(--token-ease-out),
    border-color var(--token-motion-base) var(--token-ease-out),
    color var(--token-motion-base) var(--token-ease-out),
    transform var(--token-motion-fast) var(--token-ease-out),
    box-shadow var(--token-motion-fast) var(--token-ease-out);
  cursor: pointer;
}

.ui-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.ui-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.38);
}

.ui-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.ui-button--primary {
  color: var(--text-main);
  background: rgb(var(--accent-rgb) / 0.13);
  border-color: rgb(var(--accent-rgb) / 0.34);
}

.ui-button--primary:hover:not(:disabled) {
  background: rgb(var(--accent-rgb) / 0.2);
  border-color: rgb(var(--accent-rgb) / 0.46);
}

.ui-button--secondary {
  color: var(--token-text-primary);
  background: transparent;
  border-color: var(--token-border-subtle);
}

.ui-button--secondary:hover:not(:disabled) {
  background: rgb(var(--accent-rgb) / 0.09);
  border-color: rgb(var(--accent-rgb) / 0.32);
}

.ui-button--ghost {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
}

.ui-button--ghost:hover:not(:disabled) {
  color: var(--text-main);
  background: rgb(var(--accent-rgb) / 0.06);
  border-color: transparent;
}

.ui-button--danger {
  color: #fcecec;
  background: rgb(214 86 86 / 0.18);
  border-color: rgb(214 86 86 / 0.38);
}

.ui-button--danger:hover:not(:disabled) {
  background: rgb(214 86 86 / 0.26);
  border-color: rgb(214 86 86 / 0.48);
}

.ui-card {
  border-radius: var(--token-radius-md);
  border: 1px solid var(--token-border-subtle);
  background: var(--token-surface-elevated);
  box-shadow: var(--token-shadow-soft);
  transition:
    transform var(--token-motion-base) var(--token-ease-out),
    border-color var(--token-motion-base) var(--token-ease-out);
}

.ui-card--interactive:hover {
  transform: translateY(-1px);
  border-color: rgb(var(--accent-rgb) / 0.32);
}

.ui-card__inner {
  padding: 16px;
}

.ui-input-wrap {
  display: grid;
  gap: 6px;
}

.ui-input-label {
  font-size: var(--token-fs-12);
  font-weight: 600;
  color: var(--token-text-secondary);
}

.ui-input {
  width: 100%;
  min-height: 44px;
  border-radius: var(--token-radius-md);
  border: 1px solid var(--token-border-subtle);
  background: rgb(7 11 28 / 0.72);
  color: var(--token-text-primary);
  padding: 0 14px;
  font-family: var(--token-font-family);
  font-size: var(--token-fs-16);
  transition:
    border-color var(--token-motion-fast) var(--token-ease-out),
    box-shadow var(--token-motion-fast) var(--token-ease-out);
}

.ui-input::placeholder {
  color: var(--token-text-muted);
}

.ui-input:focus-visible {
  outline: none;
  border-color: rgb(var(--accent-rgb) / 0.52);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.28);
}

.ui-input--error {
  border-color: rgb(225 107 107 / 0.75);
}

.ui-input-error {
  margin: 0;
  font-size: var(--token-fs-12);
  color: var(--token-error);
}

/* Единый вид с ui-button--primary для legacy-класса custom-action-submit */
button.custom-action-submit,
.custom-action-submit {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgb(var(--accent-rgb) / 0.34);
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--token-font-family);
  font-size: var(--token-fs-14);
  font-weight: 600;
  line-height: 1;
  color: var(--text-main);
  background: rgb(var(--accent-rgb) / 0.13);
  transition:
    background-color var(--token-motion-base) var(--token-ease-out),
    border-color var(--token-motion-base) var(--token-ease-out),
    color var(--token-motion-base) var(--token-ease-out),
    transform var(--token-motion-fast) var(--token-ease-out),
    box-shadow var(--token-motion-fast) var(--token-ease-out);
  cursor: pointer;
}

button.custom-action-submit:hover:not(:disabled),
.custom-action-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgb(var(--accent-rgb) / 0.2);
  border-color: rgb(var(--accent-rgb) / 0.46);
}

button.custom-action-submit:focus-visible,
.custom-action-submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.38);
}

button.custom-action-submit:disabled,
.custom-action-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
