/* --- Premium: matte black, rose gold, editorial typography --- */
:root {
  --bg: #0D0D0D;
  --bg-soft: #0a0a0a;
  --bg-card: rgba(18, 18, 18, 0.72);
  --bg-card-solid: rgba(22, 22, 22, 0.96);
  --text: #E8E8E8;
  --text-heading: #FAFAFA;
  --text-muted: #9a9a9a;
  --accent: #c9a89e;
  --accent-gold: #b8986a;
  --accent-hover: rgba(201, 168, 158, 0.95);
  --accent-glow: rgba(201, 168, 158, 0.12);
  --border: rgba(255, 255, 255, 0.04);
  --border-accent: rgba(201, 168, 158, 0.28);
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'Montserrat', sans-serif;
  --font-display: 'Cormorant Garamond', serif;
  --btn-text-dark: #1c1816;
  --space-sm: 16px;
  --space-md: 28px;
  --space-lg: 48px;
  --space-xl: 72px;
  --space-xxl: 100px;
}

/* Тема/градиент сайта (выбор пользователя в профиле) */
body.theme-blue {
  --accent: #7aa8d4;
  --accent-gold: #5a8ab8;
  --accent-hover: rgba(122, 168, 212, 0.95);
  --accent-glow: rgba(122, 168, 212, 0.12);
  --border-accent: rgba(122, 168, 212, 0.28);
}

body.theme-green {
  --accent: #7ab87a;
  --accent-gold: #5a9a5a;
  --accent-hover: rgba(122, 184, 122, 0.95);
  --accent-glow: rgba(122, 184, 122, 0.12);
  --border-accent: rgba(122, 184, 122, 0.28);
}

body.theme-purple {
  --accent: #a88ad4;
  --accent-gold: #8a6ab8;
  --accent-hover: rgba(168, 138, 212, 0.95);
  --accent-glow: rgba(168, 138, 212, 0.12);
  --border-accent: rgba(168, 138, 212, 0.28);
}

body.theme-amber {
  --accent: #d4b87a;
  --accent-gold: #b8985a;
  --accent-hover: rgba(212, 184, 122, 0.95);
  --accent-glow: rgba(212, 184, 122, 0.12);
  --border-accent: rgba(212, 184, 122, 0.28);
}

body.theme-coral {
  --accent: #d48a7a;
  --accent-gold: #b86a6a;
  --accent-hover: rgba(212, 138, 122, 0.95);
  --accent-glow: rgba(212, 138, 122, 0.12);
  --border-accent: rgba(212, 138, 122, 0.28);
}

/* theme-rose = значения по умолчанию из :root */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  letter-spacing: 0.02em;
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(40, 36, 34, 0.4), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  position: relative;
  z-index: 1;
}

/* --- Header (на весь экран) --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  min-height: 72px;
  max-height: 72px;
  padding: 0 var(--space-md);
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  min-width: 0;
}

/* Логотип + токены (на десктопе в ряд, на мобильном — лого выше, токены под ним) */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.header-tokens {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-tokens .token-balance {
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: var(--text-heading);
  text-transform: uppercase;
}

.logo-text {
  letter-spacing: inherit;
}

.nav {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: space-evenly;
  gap: 4px;
}

.nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.3s ease;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  margin-bottom: -4px;
  min-height: 1.2em;
  box-sizing: border-box;
}

/* Тонкая полоска между вкладками для удобства ориентации */
.nav a:not(:first-child) {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 12px;
  margin-left: 8px;
}

.nav a:hover {
  color: var(--text);
}

.nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Кнопка «гамбургер» для мобильного меню (скрыта на десктопе) */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.nav-burger:hover {
  border-color: var(--border-accent);
  color: var(--accent);
}
.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.header.open .nav-burger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.header.open .nav-burger span:nth-child(2) {
  opacity: 0;
}
.header.open .nav-burger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Token balance (in-game currency) --- */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  flex-shrink: 0;
}

.header-right .btn-ghost {
  padding: 6px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Вход и Регистрация — одна компактная «кнопка», зазор не зависит от высоты экрана */
.header-auth-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}
.header-auth-stack .header-auth-link {
  padding: 0 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  line-height: 1.1;
  min-height: 0;
  flex-shrink: 0;
}
.header-auth-stack .header-auth-link:last-child {
  margin-top: -2px;
}

.token-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.token-balance:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 12px rgba(74, 124, 186, 0.15);
}
.token-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(165deg, #5b8fd4 0%, #3a6ba8 50%, #2a5290 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 2px 6px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
.token-balance-num {
  min-width: 2ch;
  text-align: right;
}

.token-balance-beta .token-icon-beta,
.token-icon-beta {
  background: linear-gradient(165deg, #e09a50 0%, #c07830 50%, #a06020 100%);
  color: #fff;
}

.token-balance-beta:hover {
  border-color: rgba(224, 154, 80, 0.4);
  box-shadow: 0 0 12px rgba(224, 154, 80, 0.15);
}

.token-icon-sm {
  width: 20px;
  height: 20px;
  font-size: 0.7rem;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-switch {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  font-family: var(--font-sans);
  transition: color 0.2s ease;
}

.messages-page {
  padding: 24px 20px 40px;
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
}

.container--messages {
  max-width: 1200px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-page-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 16px;
  color: var(--text-heading);
  flex-shrink: 0;
}

.messages-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.messages-sidebar {
  background: rgba(18, 18, 18, 0.95);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.messages-sidebar-header {
  margin-bottom: 12px;
}

.messages-sidebar-title {
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
  margin: 0 0 4px;
}

.messages-sidebar-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.messages-empty {
  padding: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.messages-chat-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  font-size: 1rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 360px;
}

.messages-dialog-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.messages-dialog {
  display: flex;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
  border: 1px solid transparent;
}

.messages-dialog--active {
  background: radial-gradient(circle at top left, rgba(230, 184, 175, 0.22), rgba(13, 13, 13, 0.9));
  border-color: rgba(230, 184, 175, 0.5);
  transform: translateY(-1px);
}

.messages-dialog:hover:not(.messages-dialog--active) {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.messages-dialog-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 0%, #e6b8af, #4a2c2c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.messages-dialog-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.messages-dialog-name {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-dialog-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.messages-dialog-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-dialog-meta {
  margin-top: 2px;
  font-size: 0.75rem;
}

.messages-dialog-streak {
  color: #ffb869;
  font-weight: 500;
}

.messages-dialog-streak--low {
  color: #ffd08a;
}

.messages-dialog-streak--zero {
  color: var(--text-muted);
}

.messages-chat {
  background: rgba(15, 15, 15, 0.98);
  display: flex;
  flex-direction: column;
  min-height: 480px;
  padding: 20px 24px;
}

.messages-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 10px;
}

.messages-chat-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.messages-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 0%, #d4af37, #4a3820);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
}

.messages-chat-user-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-chat-user-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.messages-chat-user-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.messages-chat-streak {
  max-width: 320px;
  text-align: right;
}

.messages-streak-label {
  font-size: 0.9rem;
  color: #ffd08a;
  font-weight: 500;
}

.messages-streak-days {
  white-space: nowrap;
}

.messages-streak-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.messages-chat-body {
  flex: 1 1 auto;
  margin: 8px 0 10px;
  padding-right: 2px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messages-chat-day-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 10px;
}

.messages-chat-day-separator::before,
.messages-chat-day-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.16));
}

.messages-chat-day-separator::after {
  background: linear-gradient(to left, transparent, rgba(255, 255, 255, 0.16));
}

.messages-chat-day-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 8px;
}

.messages-message {
  max-width: 75%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.messages-message--incoming {
  align-self: flex-start;
}

.messages-message--outgoing {
  align-self: flex-end;
}

.messages-message-bubble {
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(40, 40, 40, 0.9);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.messages-message--incoming .messages-message-bubble {
  border-bottom-left-radius: 4px;
}

.messages-message--outgoing .messages-message-bubble {
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.35), rgba(230, 184, 175, 0.35));
  border-bottom-right-radius: 4px;
}

.messages-message-bubble--gift {
  border: 1px solid rgba(224, 154, 80, 0.6);
}

.messages-message-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.messages-chat-input {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.messages-input-field {
  width: 100%;
  resize: vertical;
  min-height: 44px;
  max-height: 120px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 10, 10, 0.9);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.messages-input-field:focus {
  outline: none;
  border-color: var(--border-accent);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35);
}

.messages-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.messages-input-actions .btn-ghost {
  padding-inline: 10px;
  font-size: 0.8rem;
}

.messages-input-actions .btn-primary {
  padding-inline: 14px;
  font-size: 0.85rem;
}

@media (max-width: 960px) {
  .messages-layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 70vh;
  }

  .messages-chat {
    min-height: 420px;
  }

  .messages-chat-placeholder {
    min-height: 280px;
  }

  .messages-chat-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .messages-chat-streak {
    max-width: none;
    text-align: left;
  }

  .messages-message {
    max-width: 82%;
  }
}

@media (max-width: 640px) {
  .messages-page {
    padding: 16px 12px 24px;
  }

  .messages-chat {
    padding: 16px;
    min-height: 380px;
  }

  .messages-chat-placeholder {
    min-height: 260px;
  }

  .messages-sidebar {
    padding: 10px 8px;
  }
}
.lang-switch:hover {
  color: var(--text);
}

.lang-switch.active {
  color: var(--accent);
}

.lang-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
  user-select: none;
}

/* --- Buttons: refined, minimal --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.35s ease, border-color 0.25s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
}

.btn-primary {
  background: linear-gradient(165deg, var(--accent-gold) 0%, var(--accent) 50%, var(--accent-gold) 100%);
  background-size: 200% 100%;
  color: var(--btn-text-dark);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:hover {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 6px 24px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.btn-outline:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 0.85rem;
}

/* --- Hero --- */
.hero {
  padding: var(--space-xxl) 0;
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 var(--space-md);
  color: var(--text-heading);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.hero-text {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto var(--space-lg);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Sections --- */
.section {
  padding: var(--space-xl) 0;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  text-align: center;
  margin: 0 0 var(--space-lg);
  color: var(--text-heading);
}

/* --- Home layout --- */
.home-layout {
  height: calc(100vh - 72px);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.home-layout .container {
  max-width: none;
  width: 100%;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.home-layout-inner {
  display: grid;
  grid-template-columns: 0.8fr 3fr 0.8fr;
  gap: var(--space-md);
  width: 100%;
}

.home-chat-half {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  min-height: 0;
}

.home-side {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  max-height: 100%;
  overflow: hidden;
  padding: 6px 0 6px var(--space-sm);
}

.home-side-left {
  padding-left: 0;
  padding-right: var(--space-sm);
  min-height: 0;
  overflow-y: auto;
}

.home-side-right {
  padding-left: var(--space-sm);
  padding-right: 0;
  overflow-y: auto;
  min-height: 0;
}

.home-side .section-title {
  text-align: left;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  margin-top: 0;
}

.home-side .section-compact {
  padding-top: 6px;
  padding-bottom: 6px;
}

.home-side .section:first-child .section-compact {
  padding-top: 0;
}

.home-side .features-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-side .pricing-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-side .pricing-card,
.home-side .feature-card {
  width: 100%;
  padding: 10px 12px;
}

.home-side .feature-card h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.home-side .feature-card p {
  font-size: 0.78rem;
  line-height: 1.45;
}

.home-side .feature-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 6px;
}

.home-side .feature-icon::before {
  width: 4px;
  height: 4px;
}

.home-side .feature-icon--second::before {
  width: 6px;
  height: 1.5px;
}

.home-side .pricing-card h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.home-side .pricing-card .price {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.home-side .pricing-card .price span {
  font-size: 0.8rem;
}

.home-side .pricing-card ul {
  margin-bottom: 10px;
}

.home-side .pricing-card li {
  font-size: 0.78rem;
  padding: 3px 0;
}

.home-side .pricing-card .btn {
  padding: 8px 14px;
  font-size: 0.7rem;
}

.home-side .pricing-note {
  font-size: 0.72rem;
  margin-top: 4px;
  margin-bottom: 0;
}

.home-side .pricing-grid,
.home-side .features-grid,
.home-side .vip-table-wrap {
  font-size: 0.8rem;
}

.home-side .cta .section-title {
  margin-bottom: 4px;
}

.home-side .cta-text {
  font-size: 0.75rem;
  line-height: 1.45;
  margin-bottom: 0;
}

.hero-title-small {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-sm);
  color: var(--text-heading);
}

.hero-text-small {
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hero-compact {
  padding-top: 0;
  padding-bottom: var(--space-md);
}

.section-compact {
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.home-info-half .section-title {
  text-align: left;
}

/* --- Cards: premium glass --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
}

.feature-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.25), 0 0 0 1px var(--border-accent);
}

.feature-icon {
  display: block;
  width: 32px;
  height: 32px;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  position: relative;
}

.feature-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.8;
}

.feature-icon--second::before {
  width: 8px;
  height: 2px;
  border-radius: 0;
  background: var(--accent);
}

.feature-card h3 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-sm);
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-heading);
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* --- Pricing --- */
.pricing {
  background: transparent;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
  max-width: 640px;
  margin: 0 auto var(--space-md);
}

.pricing-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.pricing-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.25), 0 0 0 1px var(--border-accent);
}

.pricing-card-accent {
  border-color: var(--border-accent);
}

.badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(165deg, var(--accent-gold), var(--accent));
  color: var(--btn-text-dark);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.pricing-card h3 {
  font-family: var(--font-display);
  margin: 0 0 var(--space-sm);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-heading);
}

.pricing-card .price {
  margin: 0 0 var(--space-md);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.pricing-card .price span {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
}

.pricing-card li {
  padding: 6px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pricing-card li::before {
  content: "✓ ";
  color: var(--accent);
  font-weight: 500;
}

.pricing-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* --- VIP Table --- */
.vip-table-wrap {
  overflow-x: auto;
  max-width: 500px;
  margin: 0 auto;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.vip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.vip-table th,
.vip-table td {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.vip-table th {
  background: transparent;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.vip-table tr:last-child td { border-bottom: none; }

.vip-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* --- CTA --- */
.cta {
  text-align: center;
}

.cta-text {
  max-width: 480px;
  margin: 0 auto var(--space-md);
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Footer --- */
.footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  justify-content: center;
  text-align: center;
}

.footer-links {
  margin: 0;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-sep {
  margin: 0 6px;
  font-weight: 400;
}

/* --- Средние экраны: бургер-меню, шапка фиксированной высоты, бургер справа не наезжает --- */
@media (max-width: 1100px) {
  .header-inner {
    position: relative;
    height: 72px;
    min-height: 72px;
    max-height: 72px;
    flex-wrap: nowrap;
    overflow: visible;
    padding-right: 48px;
  }

  .logo {
    min-width: 0;
    flex-shrink: 1;
  }

  .nav-burger {
    display: flex;
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    flex-shrink: 0;
  }
  .header.open .nav-burger {
    transform: translateY(-50%);
  }

  .nav {
    display: none;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 72px - env(safe-area-inset-bottom));
    flex-direction: column;
    gap: 0;
    background: var(--bg-card-solid);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 99;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .header.open .nav {
    display: flex;
  }

  .nav a {
    padding: 14px max(var(--space-sm), env(safe-area-inset-left));
    min-height: 48px;
    min-width: 44px;
    display: flex;
    align-items: center;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
    margin-left: 0;
    font-size: 0.95rem;
    box-sizing: border-box;
    width: 100%;
  }

  .nav a.active {
    border-left-color: var(--accent);
    border-bottom-color: transparent;
  }

  .header-right {
    margin-left: 0;
    flex: 0 1 auto;
    min-width: 0;
  }
}

/* Мобильные: только чат на весь экран, без скролла страницы */
@media (max-width: 768px) {
  body[data-page="index"] {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
  }
  body[data-page="index"] .header {
    flex-shrink: 0;
  }
  body[data-page="index"] .home-layout {
    flex: 1;
    min-height: 0;
  }
  .home-layout {
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    overflow: hidden;
  }
  .home-layout .container {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    max-width: 100%;
    width: 100%;
    height: 100%;
    min-width: 0;
  }
  .home-layout-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .home-side-left,
  .home-side-right {
    display: none;
  }
  .home-chat-half {
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-height: 0;
    min-width: 0;
    padding: 4px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
  }
  .home-chat-half .hero-title-small {
    flex-shrink: 0;
    margin: 0 0 2px;
    font-size: 1.1rem;
  }
  .home-chat-half .hero-text-small {
    flex-shrink: 0;
    margin: 0 0 4px;
    font-size: 0.72rem;
  }
  .home-chat-half .chat-container {
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-height: 0;
    min-width: 0;
    padding: 0 0 env(safe-area-inset-bottom) 0;
    display: flex;
    flex-direction: column;
  }
  .home-chat-half .chat-top {
    flex-shrink: 0;
    margin-bottom: 4px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .home-chat-half .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px max(10px, env(safe-area-inset-left)) 8px max(10px, env(safe-area-inset-right));
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  .home-chat-half .chat-input-wrap,
  .home-chat-half .chat-input {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .home-chat-half .chat-input-wrap {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  body[data-page="index"] .footer {
    display: none;
  }
}

/* --- Responsive: удобность на телефоне --- */
@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }
  .container {
    padding-left: max(var(--space-sm), env(safe-area-inset-left));
    padding-right: max(var(--space-sm), env(safe-area-inset-right));
  }

  .header-inner {
    position: relative;
    min-height: 72px;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .nav-burger {
    display: flex;
    margin-left: auto;
  }

  .nav {
    display: none;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 72px - env(safe-area-inset-bottom));
    flex-direction: column;
    gap: 0;
    background: var(--bg-card-solid);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 99;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .header.open .nav {
    display: flex;
  }

  .nav a {
    padding: 14px max(var(--space-sm), env(safe-area-inset-left));
    min-height: 48px;
    min-width: 44px;
    display: flex;
    align-items: center;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
    margin-left: 0;
    font-size: 0.95rem;
    box-sizing: border-box;
    width: 100%;
  }

  .nav a.active {
    border-left-color: var(--accent);
    border-bottom-color: transparent;
  }

  .header-right {
    margin-left: 0;
    flex: 0 1 auto;
    min-width: 0;
    gap: 4px;
    justify-content: flex-start;
    padding-left: 2px;
  }
  /* Шапка: место под бургер справа зарезервировано, вкладки сдвинуты влево */
  .header-inner {
    align-items: center;
    flex-wrap: nowrap;
    height: 72px;
    min-height: 72px;
    max-height: 72px;
    padding-top: 0;
    padding-bottom: 0;
    padding-right: 48px;
    overflow: hidden;
    gap: 4px 6px;
    position: relative;
  }
  .header-brand {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-height: 0;
    max-height: 72px;
    flex-shrink: 1;
    min-width: 0;
  }
  .header-tokens {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
  }
  .header-tokens .token-balance {
    padding: 3px 6px;
    gap: 4px;
    font-size: 0.7rem;
    min-height: 28px;
    min-width: 0;
    flex-shrink: 0;
  }
  .header-tokens .token-icon,
  .header-tokens .token-icon-beta {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
  /* На страницах без header-brand токены остаются в header-right — компактно, всегда с зазором */
  .header-right .token-balance {
    padding: 3px 6px;
    gap: 4px;
    font-size: 0.7rem;
    min-height: 28px;
    min-width: 0;
    flex-shrink: 0;
  }
  .header-right .token-icon,
  .header-right .token-icon-beta {
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
  }
  .header-right .lang-switcher {
    gap: 2px;
  }
  .header-right .lang-switch {
    padding: 4px 6px;
    font-size: 0.7rem;
  }
  .header-right .btn-ghost {
    padding: 4px 8px;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .header-inner {
    position: relative;
    gap: 4px 4px;
    padding-left: 4px;
    padding-right: 48px;
  }
  .logo {
    flex-shrink: 1;
    min-width: 0;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
  }
  .logo-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Три полоски закреплены справа, вкладки остаются слева */
  .nav-burger {
    position: absolute;
    right: max(4px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  .header.open .nav-burger {
    transform: translateY(-50%);
  }
  .nav-burger span {
    width: 16px;
    height: 1.5px;
  }
  .header.open .nav-burger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  .header.open .nav-burger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .hero { padding: var(--space-lg) 0 var(--space-md); }
  .section { padding: var(--space-lg) 0; }
  .home-layout {
    height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
  }
  .home-layout .container {
    height: 100%;
    min-height: 0;
  }
  body[data-page="index"] {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
  }
  body[data-page="index"] .home-layout {
    flex: 1;
    min-height: 0;
  }
  body:not([data-page="index"]) {
    overflow: auto;
  }

  /* Удобные зоны нажатия для кнопок и ссылок на телефоне */
  .btn,
  .lang-switch,
  .token-balance {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* Токены под логотипом — компактные */
  .header-tokens .token-balance {
    min-height: 28px;
    min-width: 0;
  }
}

/* Очень узкие экраны */
@media (max-width: 380px) {
  .logo {
    font-size: 0.8rem;
    letter-spacing: 0.06em;
  }
  .header-right .lang-switcher .lang-switch {
    padding: 3px 5px;
    font-size: 0.65rem;
  }
  .header-right .btn-ghost {
    padding: 3px 6px;
    font-size: 0.65rem;
  }
  .header-auth-stack .header-auth-link {
    padding: 0 4px;
    font-size: 0.62rem;
    line-height: 1.05;
    min-height: 0;
  }
  .header-auth-stack .header-auth-link:last-child {
    margin-top: -2px;
  }
  .header-tokens {
    gap: 8px;
  }
  .header-tokens .token-balance {
    padding: 2px 4px;
    font-size: 0.65rem;
    flex-shrink: 0;
  }
  .header-tokens .token-icon,
  .header-tokens .token-icon-beta {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
  }
  .nav-burger {
    width: 36px;
    height: 36px;
  }
  .nav-burger span {
    width: 14px;
  }
}

/* Модалка подарков (chat + profile) */
.gift-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gift-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.gift-modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gift-modal-content h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-heading);
}

.gift-modal-recipient,
.gift-modal-balance {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.gift-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.gift-modal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: rgba(15, 15, 15, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.gift-modal-item:hover:not(.gift-modal-item-disabled) {
  border-color: var(--accent);
  background: rgba(201, 168, 158, 0.1);
}

.gift-modal-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gift-modal-icon {
  font-size: 1.5rem;
}

.gift-modal-cost {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-gift-btn-wrap {
  margin-bottom: 16px;
}
