/* ========== ROOT: DESIGN TOKENS ========== */
:root {
  /* Color Palette */
  --bg: #0e1621;
  --fg: #fff;
  --muted: #aeb7c2;
  --accent: #2ea6ff;

  /* Semantic Colors */
  --color-error: #ff4444;
  --color-success: #4caf50;
  --color-warning: #ff9800;
  --color-text-secondary: var(--muted);
  
  /* Theme-adaptive colors (set by JavaScript) */
  --card-bg: rgba(255, 255, 255, 0.04);
  --stroke-color: rgba(255, 255, 255, 0.08);
  --elem-bg: rgba(255, 255, 255, 0.06);
  --modal-bg: var(--bg);
  --icon-bg: rgba(255, 255, 255, 0.06);
  --color-border: var(--stroke-color);

  /* Typography Scale */
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-18: 18px;
  --fs-20: 20px;
  --fs-22: 22px;
  
  --lh-tight: 1.15;
  --lh-normal: 1.35;
  --lh-base: 1.45;

  /* Spacing Scale (8px module) */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 56px;

  /* Border Radius Scale */
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Telegram Theme Override */
  --tg-bg: var(--bg);
  --tg-tx: var(--fg);
  --tg-hint: var(--muted);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  
  /* Additional Colors */
  --color-accent-contrast: #00131f;
  --color-gold: #d4af37;
  --color-gold-shadow: rgba(212, 175, 55, 0.6);
  --color-info: #007AFF;
  
  /* Overlays & Shadows */
  --overlay-dark: rgba(0, 0, 0, 0.85);
  --overlay-medium: rgba(0, 0, 0, 0.4);
  --overlay-light: rgba(0, 0, 0, 0.25);
  --shadow-text: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.5);
  --shadow-text-default: 0 1px 3px rgba(0, 0, 0, 0.7), 0 0 8px rgba(0, 0, 0, 0.5);
  --bg-overlay-light: rgba(0, 0, 0, 0.15);
  
  /* Common Values */
  --border-default: 1px solid var(--color-border);
  --color-transparent: transparent;
  
  /* UI Element Sizes */
  --size-touch: 44px;
  --size-icon: 48px;
  --size-thumb-sm: 52px;
  --size-thumb-md: 88px;
  --size-avatar: 128px;
  
  /* Miscellaneous */
  --opacity-secondary: 0.7;
  --transition-fast: 0.1s ease;
  --transition-base: 0.2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font: var(--fs-16) / var(--lh-base) system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu;
  background: var(--tg-bg);
  color: var(--tg-tx);
  -webkit-font-smoothing: antialiased;
  max-width: 920px;
  margin: auto;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

main.container {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
  height: 100dvh;
}

.hidden,
.hidden-input,
.waves-empty.hidden,
.waves-meta-list--empty,
.thumbs-row:empty {
  display: none;
}

.topbar-action.hidden,
.lightbox.hidden,
.filter-modal.hidden {
  display: none !important;
}
.mt-sm { margin-top: var(--space-2); }

/* ========== TOPBAR ========== */
.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
  position: relative;
  padding: 0 var(--space-4);
}
.title { font-size: var(--fs-20); font-weight: 600; white-space: pre-line; text-align: center; }

.topbar-action {
  position: absolute;
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--card-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  gap: 4px;
  box-shadow: none;
  transition: transform 0.2s ease;
}

.topbar-action-left {
  right: auto;
  left: var(--space-4);
  width: auto;
  min-width: 44px;
  padding: 0 var(--space-3);
  gap: var(--space-2);
  justify-content: center;
}

.topbar-action img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.balance-value {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
}

/* ========== TOPBAR BALANCE - LIGHT THEME ========== */
/* Черное число магатамы в топбаре при светлой теме */
.theme-light .balance-value {
  color: #000;
}

/* Белое название карты в первой карточке на странице сюжет при светлой теме */
.theme-light .story-hero-card--with-bg .story-hero-title {
  color: #fff;
}

.topbar-action:active {
  transform: scale(0.94);
}

/* Чип баланса не кликабельный - статичный элемент */
#homeBalanceBtn {
  cursor: default;
  pointer-events: none;
}

#homeBalanceBtn:active {
  transform: none;
}

#homeBalanceBtn:focus-visible {
  outline: none;
}

/* Чип purified справа от топбара */
.topbar-action-right {
  margin-left: auto;
  margin-right: 0;
}

#homePurifiedBtn {
  cursor: default;
  pointer-events: none;
  width: auto;
  min-width: 44px;
  padding: 0 var(--space-3);
  gap: 4px;
}

#homePurifiedBtn:active {
  transform: none;
}

#homePurifiedBtn:focus-visible {
  outline: none;
}

.topbar-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ========== CARD ========== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
  padding: var(--space-4);
  position: relative;
}

.card:last-child { margin-bottom: 0; }

.card-title { 
  font-weight: 600; 
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-title-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ========== COMMENTS ========== */
.comments-list {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#publicCommentForm .input {
  margin-bottom: var(--space-1);
}

.comment-item {
  padding: var(--space-3);
  background: var(--elem-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.comment-author {
  font-weight: 600;
  font-size: var(--fs-14);
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}


.comment-date {
  font-size: var(--fs-12);
  color: var(--color-text-secondary);
}

.comment-text {
  font-size: var(--fs-14);
  line-height: var(--lh-base);
  color: var(--tg-tx);
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* ========== GRID & FIELDS ========== */
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.field label { font-size: var(--fs-12); color: var(--tg-hint); margin-bottom: var(--space-1); display: block; }
.value { font-size: var(--fs-15); word-break: break-word; }
.value.lines { white-space: pre-line; }

/* Custom username chip for participant detail page */
#participantDetailScreen .author-chip#participant_username {
  background: linear-gradient(135deg, rgba(51, 144, 236, 0.15) 0%, rgba(51, 144, 236, 0.15) 100%);
  color: var(--tg-button-color, #3390ec);
  border: 1px solid rgba(51, 144, 236, 0.3);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(51, 144, 236, 0.1);
  min-height: 28px;
  font-size: var(--fs-14);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

#participantDetailScreen .author-chip#participant_username .username-chip-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

/* ========== FORMS ========== */
.form { display: grid; }
.input label { font-size: var(--fs-13); color: var(--tg-hint); margin-bottom: var(--space-1); }
.input input,
.input textarea,
.input select {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--tg-tx);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
}
.input textarea {
  resize: none;
  min-height: calc(1em + 24px);
  max-height: 200px;
  overflow-y: auto;
}
.input select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aeb7c2' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px 8px;
  padding-right: calc(var(--space-3) + 12px + var(--space-2));
}
.input select option {
  background-color: var(--modal-bg);
  color: var(--tg-tx);
  padding: var(--space-2);
}
.input input:focus,
.input textarea:focus,
.input select:focus { 
  border-color: var(--accent); 
}
.input label.muted {
  color: var(--tg-hint);
  opacity: var(--opacity-secondary);
}
.birthday-selects {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.birthday-selects select {
  flex: 1;
  min-width: 80px;
}
.birthday-selects select:nth-child(2) {
  min-width: 120px;
}
.birthday-selects select:nth-child(3) {
  min-width: 100px;
}

/* ========== ACTIONS BAR ========== */
.actions-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: var(--space-4) ;
}
.actions-bar .wide {
  width: 100%;
  grid-column: 1 / -1;
}
/* Кнопка отправки заявки мастерства должна быть полной ширины */
#masteryApplicationCard .actions-bar .btn,
#top50ApplicationCard .actions-bar .btn,
#trophyApplicationCard .actions-bar .btn,
#seasonTrophyApplicationCard .actions-bar .btn,
#hellmodeApplicationCard .actions-bar .btn,
#additionalHellmodeApplicationCard .actions-bar .btn {
  width: 100%;
}
/* Убираем боковые отступы у actions-bar в карточках заявок */
#masteryApplicationCard .actions-bar,
#top50ApplicationCard .actions-bar,
#trophyApplicationCard .actions-bar,
#seasonTrophyApplicationCard .actions-bar,
#hellmodeApplicationCard .actions-bar,
#additionalHellmodeApplicationCard .actions-bar {
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
}

#homeFeedbackBtnContainer {
  margin-bottom: var(--space-0);
}

/* ========== UPLOAD & SHOTS ========== */
.shots-two {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: var(--space-2);
  justify-content: flex-start;
}

.shots-two .upload-box {
  width: var(--size-thumb-md);
  height: var(--size-thumb-md);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--card-bg);
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.shots-two .shot-thumb {
  width: var(--size-thumb-md);
  height: var(--size-thumb-md);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  background: var(--elem-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.shots-two .shot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  border-radius: inherit;
}

/* ========== CHIPS ========== */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--tg-tx);
  cursor: pointer;
  font-size: var(--fs-15);
  min-height: var(--size-touch);
}
.chip-btn.active {
  background: var(--accent);
  border-color: transparent;
  color: var(--color-accent-contrast);
  font-weight: 600;
}

/* ========== BUTTONS ========== */
.btn {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  color: var(--tg-tx);
  cursor: pointer;
  min-height: var(--size-touch);
  font-size: var(--fs-16);
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn.primary { background: var(--accent); border-color: transparent; color: var(--color-accent-contrast); font-weight: 700; }
.btn.danger { background: var(--color-error); border-color: transparent; color: var(--color-accent-contrast); font-weight: 700; }

.btn-themed,
#sendFeedbackBtn,
#profileEditBtn,
#createBuildBtn,
#joinTelegramBtn,
#startScreenSaveBtn,
#filterModalOkBtn,
#giftSetStatusBtn,
#publishBuildBtn,
#feedbackSubmitBtn,
#top50ApplicationSubmitBtn,
#profileSaveBtn,
#buildSubmitBtn,
#buildEditSubmitBtn,
#masteryApplicationSubmitBtn,
#deleteBuildBtn,
button.btn.primary[type="submit"],
button.btn.primary[data-bg-image],
button.btn[data-bg-image] {
  background: none !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-color: var(--color-transparent) !important;
  position: relative;
  z-index: 1;
  color: #fff !important;
  text-shadow: var(--shadow-text-default);
}

.btn-themed::before,
#sendFeedbackBtn::before,
#profileEditBtn::before,
#createBuildBtn::before,
#joinTelegramBtn::before,
#startScreenSaveBtn::before,
#filterModalOkBtn::before,
#giftSetStatusBtn::before,
#publishBuildBtn::before,
#feedbackSubmitBtn::before,
#top50ApplicationSubmitBtn::before,
#profileSaveBtn::before,
#buildSubmitBtn::before,
#buildEditSubmitBtn::before,
#masteryApplicationSubmitBtn::before,
#deleteBuildBtn::before,
button.btn.primary[type="submit"]::before,
button.btn.primary[data-bg-image]::before,
button.btn[data-bg-image]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-overlay-light);
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
}

/* Синие кнопки (blue.png) */
#sendFeedbackBtn,
#profileEditBtn,
#createBuildBtn,
#joinTelegramBtn,
#startScreenSaveBtn,
#filterModalOkBtn,
#giftSetStatusBtn,
#publishBuildBtn:not(.btn--red):not(.danger),
button.btn[data-bg-image="blue"] {
  background-image: url('../assets/system/blue.png') !important;
}

/* Зеленые кнопки (green.png) */
#feedbackSubmitBtn,
#top50ApplicationSubmitBtn,
#profileSaveBtn,
#buildSubmitBtn,
#buildEditSubmitBtn,
#masteryApplicationSubmitBtn,
button.btn.primary[type="submit"],
button.btn.primary[data-bg-image="green"],
button.btn[data-bg-image="green"] {
  background-image: url('../assets/system/green.png') !important;
}

/* Красные кнопки (red.png) */
#deleteBuildBtn,
#publishBuildBtn.btn--red,
#publishBuildBtn.danger,
button.btn.primary[data-bg-image="red"],
button.btn[data-bg-image="red"] {
  background-image: url('../assets/system/red.png') !important;
}
.btn.wide { width: 100%; }
.btn:active { transform: translateY(1px); }

/* ========== HOME ========== */
#telegramGroupBtn {
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
/* Защита всех изображений и SVG от контекстного меню и перетаскивания */
img, svg {
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Разрешаем pointer-events для интерактивных элементов */
button img,
button svg,
a img,
a svg,
.build-icon img,
.build-stat-icon,
.mastery-icon,
.shot-thumb img,
.upload-box img {
  pointer-events: auto;
}

/* Разрешаем полное взаимодействие со скриншотами в детальном просмотре билда */
.shots-grid .shot-thumb img,
.story-scroll-images img,
.lightbox img {
  pointer-events: auto;
  -webkit-user-drag: auto;
  user-select: auto;
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
}

.story-scroll-images img {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  object-fit: cover;
}

.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: transform 0.2s ease-out;
  transform-origin: center center;
  touch-action: pan-x pan-y pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}

/* Логотип на главной странице */
.logo { 
  width: var(--size-avatar); 
  height: var(--size-avatar); 
  object-fit: contain; 
}

/* ========== WAVES ========== */
.waves-meta-card {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  color: var(--fg);
  min-height: 96px;
}
.waves-mod-icons {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  z-index: 2;
}
.waves-mod-icon {
  width: 36px;
  height: 36px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: rgba(14, 22, 33, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Ротация: мод-иконки в правом верхнем углу внутри кнопок */
.badge-btn .rotation-mod-icons {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  z-index: 2;
}

/* Таймер ротации */
.rotation-countdown-timer {
  font-size: var(--fs-16);
  font-weight: 600;
  letter-spacing: .5px;
}

/* Отступы заголовка таймера: сверху var(--space-3), снизу 0 */
.rotation-countdown-title {
  font-size: var(--fs-16);
  margin-top: var(--space-3);
  margin-bottom: 0;
}

/* Хедер карточек с правой кнопкой */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

/* Хиро-блок главной */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  padding-bottom: 0;
  margin-bottom: 0;
  text-align: center;
}

.home-hero-logo {
  width: 128px;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.home-hero-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(139, 0, 0, 0.25)) 
          drop-shadow(0 0 18px rgba(220, 20, 60, 0.2));
  animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  from {
    filter: drop-shadow(0 0 10px rgba(139, 0, 0, 0.25)) 
            drop-shadow(0 0 18px rgba(220, 20, 60, 0.2));
  }
  to {
    filter: drop-shadow(0 0 12px rgba(139, 0, 0, 0.3)) 
            drop-shadow(0 0 22px rgba(220, 20, 60, 0.25));
  }
}

.home-hero .actions-bar {
  width: 100%;
  margin: 0;
  grid-template-columns: 1fr;
  gap: 0;
}

.home-hero .actions-bar .btn {
  width: 100%;
}

/* Карточка с изображением */
.featured-image-card {
  position: relative;
  overflow: hidden;
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
}

.featured-image-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  filter: blur(8px);
  transform: scale(1.1);
  z-index: 0;
}

.featured-image-card-content {
  position: relative;
  width: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.featured-image-card-image {
  max-width: 95%;
  max-height: 85%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-lg);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3))
          drop-shadow(0 0 40px rgba(135, 206, 250, 0.4))
          drop-shadow(0 0 60px rgba(135, 206, 250, 0.2));
  box-shadow: 0 0 30px rgba(135, 206, 250, 0.5),
              0 0 60px rgba(135, 206, 250, 0.3),
              inset 0 0 20px rgba(255, 255, 255, 0.1);
  pointer-events: auto;
}

.featured-image-card-winner {
  background: rgba(0, 0, 0, 0.6);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: var(--fs-14);
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  margin-bottom: var(--space-3);
}

.featured-image-card-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  background: rgba(0, 0, 0, 0.6);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  backdrop-filter: blur(4px);
}

.featured-image-card-author,
.featured-image-card-theme {
  color: #fff;
  font-size: var(--fs-14);
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.start-screen-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.start-screen-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--elem-bg);
}

.start-screen-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.start-screen-option span {
  font-size: var(--fs-16);
  font-weight: 600;
  color: var(--fg);
}

.start-screen-actions {
  margin-top: var(--space-4);
  margin-left: 0;
  margin-right: 0;
  grid-template-columns: 1fr;
}

/* Карточка последних наград */
.recent-events-list,
.recent-comments-list,
.upcoming-birthdays-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.recent-event-item,
.recent-comment-item,
.upcoming-birthday-item,
.week-hero-item {
  display: flex;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.recent-event-item,
.upcoming-birthday-item,
.week-hero-item {
  align-items: center;
}

.recent-comment-item {
  align-items: flex-start;
}

.recent-event-item:active,
.recent-comment-item:active,
.upcoming-birthday-item:active,
.week-hero-item:active {
  background-color: transparent;
  opacity: 1;
}

.recent-comment-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--elem-bg);
  border: 1px solid var(--color-border) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--fg);
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
  padding: 0;
  box-sizing: border-box;
  margin: 0;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.recent-comment-avatar img {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.recent-comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.recent-event-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-event-headline {
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: var(--lh-normal);
  color: var(--fg);
}

.recent-event-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.recent-event-link.recent-comment-avatar {
  border: 1px solid var(--color-border) !important;
}

.recent-event-details {
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: var(--lh-tight);
}

/* ========== RECENT EVENTS - LIGHT THEME ========== */
/* Черный текст в карточке "Последние награды" при светлой теме */
.theme-light .recent-event-headline {
  color: #000;
}

.theme-light .recent-event-details,
.theme-light .recent-comment-meta,
.theme-light .upcoming-birthday-date,
.theme-light .waves-subtitle,
.theme-light .build-author,
.theme-light .build-stat-count,
.theme-light .muted,
.theme-light .season-trophy-timer,
.theme-light .avatar-placeholder,
.theme-light .version-date {
  color: #666;
}

.recent-comments-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.recent-comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.recent-comment-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recent-comment-meta {
  font-size: var(--fs-13);
  color: var(--muted);
}

.recent-comment-author {
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: var(--lh-normal);
  color: var(--fg);
}

.recent-comment-build {
  font-size: var(--fs-15);
  font-weight: 600;
  cursor: pointer;
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: transparent;
  align-self: flex-start;
  max-width: 240px;
}
.recent-comment-build span {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-comment-text {
  font-size: var(--fs-15);
  line-height: 1.3;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Светлая тема для карточки комментариев */
.theme-light .recent-comment-author,
.theme-light .recent-comment-text {
  color: #000;
}

.theme-light .recent-comment-build img {
  filter: invert(1);
}

/* ========== UPCOMING BIRTHDAYS CARD ========== */
.upcoming-birthday-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upcoming-birthday-name {
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: var(--lh-normal);
  color: var(--fg);
}

.upcoming-birthday-link {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.upcoming-birthday-link.recent-comment-avatar {
  border: 1px solid var(--color-border) !important;
}

/* ========== WEEK HEROES CARD ========== */
.week-heroes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ========== WEEK HEROES CARD ========== */
.week-hero-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.week-hero-avatar--leader {
  border: 2px solid #DC143C !important;
  box-shadow: 0 0 12px rgba(220, 20, 60, 0.4);
}

.week-hero-item--leader {
  background: linear-gradient(135deg, rgba(220, 20, 60, 0.08), rgba(139, 0, 0, 0.03));
  border-radius: var(--radius-md);
  padding: var(--space-2);
  margin: calc(var(--space-2) * -1);
  border: 1px solid rgba(220, 20, 60, 0.2);
}

.week-hero-crown {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 20px;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: crown-glow 2s ease-in-out infinite;
}

@keyframes crown-glow {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 2px 8px rgba(220, 20, 60, 0.6));
  }
}

.week-hero-progress {
  width: 100%;
  height: 4px;
  background: var(--elem-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--space-2);
}

.week-hero-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #DC143C, #B22222);
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(220, 20, 60, 0.5);
}

.week-hero-item--leader .week-hero-progress-bar {
  background: linear-gradient(90deg, #DC143C, #FF1744);
  box-shadow: 0 0 12px rgba(220, 20, 60, 0.7);
}

.upcoming-birthday-date {
  font-size: var(--fs-13);
  color: var(--muted);
  line-height: var(--lh-tight);
}
.waves-mod-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ========== ROTATION MODE BUTTONS ========== */
#rotationScreen .badge-btn {
  min-height: calc(var(--size-touch) + var(--space-4) + var(--space-2));
  padding: var(--space-4);
}

.rotation-mode-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.rotation-mode-name {
  font-size: var(--fs-14);
  color: var(--tg-hint);
  font-weight: 500;
}

.rotation-mode-map {
  font-size: var(--fs-16);
  font-weight: 600;
  line-height: var(--lh-normal);
  word-break: break-word;
}

.rotation-mode-mod {
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: var(--lh-normal);
  word-break: break-word;
  margin-top: 2px;
}

.rotation-mode-hint {
  font-size: var(--fs-14);
  margin-top: 2px;
}

.rotation-mod-icons {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* Стили для числа награды в квадратике с magatama */
.waves-mod-icon {
  position: relative;
}

/* Прямоугольник с наградой внизу справа */
.badge-btn .quest-reward-badge,
.waves-meta-card .quest-reward-badge,
.story-hero-card .quest-reward-badge,
.trials-meta-card .quest-reward-badge {
  position: absolute !important;
  bottom: var(--space-3);
  right: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: rgba(14, 22, 33, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
  z-index: 3 !important;
  width: fit-content;
  min-width: fit-content;
}

.quest-reward-badge .quest-reward-value {
  font-size: var(--fs-14);
  font-weight: 600;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
}

.quest-reward-badge .quest-reward-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
}


/* ========== UPCOMING BIRTHDAYS - LIGHT THEME ========== */
/* Черные ники участников в карточке дней рождения при светлой теме */
.theme-light .upcoming-birthday-name {
  color: #000;
}

/* Уменьшаем размер иконки класса в карточке заданий */
.quest-card .waves-mod-icon--class img,
.waves-meta-card .waves-mod-icon--class img {
  width: 80%;
  height: 80%;
}

/* Стили для подсказки в карточке заданий */
.rotation-mode-hint {
  font-size: var(--fs-12);
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.65), 0 0 4px rgba(0, 0, 0, 0.45);
}

.badge-btn--with-bg .rotation-mode-hint {
  color: rgba(255, 255, 255, 0.8);
}

.waves-meta-card .waves-header {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}
.waves-title {
  font-size: var(--fs-18);
  font-weight: 600;
}
.waves-subtitle {
  font-size: var(--fs-15);
  color: var(--muted);
}
.waves-meta-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 22, 33, 0.2), rgba(14, 22, 33, 0.4));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 1;
  pointer-events: none;
}
.waves-meta-card--with-bg::before {
  opacity: 1;
}
.waves-meta-card--with-bg .waves-subtitle {
  color: rgba(255, 255, 255, 0.85);
}
.waves-meta-card--with-bg .waves-title,
.waves-meta-card--with-bg .waves-header {
  text-shadow: var(--shadow-text);
}

/* ========== STORY SCREEN ========== */
.story-hero-card {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: flex-end;
}

.story-hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 22, 33, 0.2), rgba(14, 22, 33, 0.4));
  z-index: 1;
  pointer-events: none;
}

.story-hero-mod-main {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
}

.story-hero-mod-chapters {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  gap: var(--space-2);
  z-index: 2;
}

.story-hero-header {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.story-hero-title {
  font-size: var(--fs-18);
  font-weight: 600;
}

.story-hero-subtitle {
  font-size: var(--fs-15);
}

.story-hero-card--with-bg .story-hero-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

.story-hero-card--with-bg .story-hero-title,
.story-hero-card--with-bg .story-hero-header {
  text-shadow: var(--shadow-text);
}

/* Увеличенные иконки модификаторов глав в карточке сюжета */
.story-hero-mod-chapters .waves-mod-icon {
  width: 44px;
  height: 44px;
}

/* ========== TRIALS META CARD ========== */
.trials-meta-card .waves-title,
.trials-meta-card .waves-header {
  text-shadow: var(--shadow-text);
}

.trials-meta-card--with-bg .waves-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

.trials-meta-card--with-bg .waves-title,
.trials-meta-card--with-bg .waves-header {
  text-shadow: var(--shadow-text);
}

/* ========== ТОП-50 СТРАНИЦА ========== */
#top50DetailContainer .story-hero-card,
#top50DetailContainer .trials-meta-card {
  min-height: 96px;
  align-items: flex-start;
}

#top50DetailContainer .story-hero-header {
  margin-top: 0;
}

/* ========== ТАБЛИЦА НАГРАД ТОП-50 ========== */
.top50-rewards-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-3);
}

.top50-rewards-table tbody tr {
  border-bottom: 1px solid var(--border);
}

.top50-rewards-table tbody tr:last-child {
  border-bottom: none;
}

.top50-rewards-table td {
  text-align: left;
}

.top50-rewards-table td:first-child {
  font-weight: 500;
}

.top50-rewards-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.story-mod-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.story-mod-row img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Дополнительный отступ после строки «Модификатор недели» перед блоком глав */
.story-mod-row + .muted {
  margin-top: var(--space-3);
}

.story-scroll-title {
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.story-scroll-images {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.story-scroll-images img {
  width: 50%;
}

.story-scroll-description {
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  color: var(--tg-tx);
}

.card.waves-table {
  padding: 0;
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
  width: calc(100% - (var(--space-4) * 2));
  box-sizing: border-box;
  overflow: hidden;
}

.waves-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: center;
}
.waves-table th,
.waves-table td {
  padding: 0 var(--space-1);
  font-size: var(--fs-14);
  border-bottom: 1px solid var(--color-border);
  height: 38px;
}
.waves-table td:first-child,
.waves-table td:nth-child(2),
.waves-table td:nth-child(3) {
  border-bottom: 1px solid var(--color-border);
}
.waves-table td {
  vertical-align: middle;
  font-size: var(--fs-14);
}
.waves-table th {
  font-weight: 600;
  color: var(--tg-hint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--fs-12);
}
.waves-icon {
  width: 42px;
  min-width: 42px;
  padding: 0;
  text-align: center;
}
.waves-icon-img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}
.waves-icon-badge {
  position: relative;
  width: 30px;
  height: 30px;
  margin: 0 auto;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}
.waves-icon-badge--objective {
  background: rgba(46, 166, 255, 0.18);
  border-color: rgba(46, 166, 255, 0.6);
  box-shadow: 0 0 12px rgba(46, 166, 255, 0.35);
}
.waves-icon-badge--mod {
  background: rgba(212, 175, 55, 0.18);
  border-color: rgba(212, 175, 55, 0.65);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.32);
}
.waves-icon-tag {
  position: absolute;
  top: -5px;
  right: -8px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}
.waves-icon-badge--objective .waves-icon-tag {
  background: #2ea6ff;
  color: #00131f;
}
.waves-icon-badge--mod .waves-icon-tag {
  background: #d4af37;
  color: #1c1200;
}
.waves-table tr:last-child td {
  border-bottom: none;
}
.waves-number {
  width: 3ch;
  min-width: 3ch;
  padding-left: var(--space-2);
  padding-right: var(--space-2);
  text-align: right;
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
}
.waves-spawns {
  text-align: left;
}
.waves-table tr.waves-strong {
  background: rgba(255, 82, 82, 0.12);
}
.waves-empty {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--space-4);
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
  text-align: center;
}
.waves-meta-extra {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: 0px;
}
.waves-meta-section-title {
  margin-top: var(--space-2);
}
.waves-meta-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.waves-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.waves-meta-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.waves-meta-text {
  flex: 1;
  font-size: var(--fs-14);
  line-height: var(--lh-base);
}

/* ========== WHAT'S NEW ========== */
.version-date {
  font-size: var(--fs-14);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.changelog-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-2);
}

.changelog-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  line-height: var(--lh-normal);
}

.changelog-icon {
  font-size: var(--fs-16);
  flex-shrink: 0;
  margin-top: 1px;
}

.changelog-text {
  flex: 1;
  font-size: var(--fs-15);
}

/* ========== LIST ========== */
.grid-list,
.list-buttons {
  display: grid;
  gap: var(--space-2);
}

.grid-list > .badge-btn {
  width: 100%;
}

/* Кнопки заданий должны иметь такую же высоту как на странице ротации */
.quest-card .badge-btn {
  min-height: calc(var(--size-touch) + var(--space-4) + var(--space-2));
  padding: var(--space-4);
}
.list-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--tg-tx);
  cursor: pointer;
  min-height: 64px;
  font-size: var(--fs-16);
}

.list-btn:active { 
  transform: translateY(1px); 
}

.list-btn.success {
  border-color: rgba(46, 166, 255, 0.6);
  box-shadow:
    0 0 0 1px rgba(46, 166, 255, 0.5),
    0 0 6px rgba(46, 166, 255, 0.24);
}

.list-btn.is-static {
  cursor: default;
  pointer-events: none;
}

.list-btn.is-static:active {
  transform: none;
}

.list-btn-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--elem-bg);
  border: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.list-btn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-btn-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.list-btn-trailing {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.list-btn-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.list-btn-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.list-btn-name {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mastery-icons {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.list-btn .mastery-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
  filter: none;
  /* Защита от контекстного меню и перетаскивания */
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.list-btn .right { 
  opacity: 0.7;
  margin-left: var(--space-2);
  flex-shrink: 0;
}

/* ========== FILE LINE ========== */
.fileline-btn {
  width: 100%;
  min-height: var(--size-touch);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--tg-tx);
  font-size: var(--fs-15);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  cursor: pointer;
}
.fileline-btn:active { transform: translateY(1px); }

/* ========== THUMBS ROW ========== */
.thumbs-row {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-1);
  flex-wrap: nowrap;
  overflow: visible;
}
.thumbs-row .preview-item,
.thumbs-row .preview-more {
  width: var(--size-thumb-sm);
  height: var(--size-thumb-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--elem-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 18px;
  flex: 0 0 auto;
  position: relative;
}
.thumbs-row .preview-item img {
  width: 100%; height: 100%;
  object-fit: cover; display: block; border-radius: inherit;
}
.thumbs-row .preview-more {
  border: 1px dashed var(--color-border);
  font-weight: 700; opacity: .9;
}

.preview-item.removable::after {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: var(--tg-tx);
  background: var(--overlay-light);
  opacity: .35;
  pointer-events: none;
}
.preview-item.removable:active::after { opacity: .6; }

.thumbs-row .preview-item.is-video {
  background: rgba(46, 166, 255, 0.2);
}
.preview-video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}
.preview-video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  border-radius: inherit;
}
.preview-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 1px 5px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

/* ========== ERROR & ANIMATIONS ========== */
.error { border-color: var(--color-error); }
.error-text { color: var(--color-error); font-size: var(--fs-12); margin-top: var(--space-1); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
}
.shake { animation: shake .3s; }

/* ========== BUILDS ========== */
.build-item {
  display: grid; grid-template-columns: var(--size-icon) 1fr; gap: var(--space-3); align-items: center;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border);
  background: transparent; cursor: pointer; min-height: var(--size-icon); color: var(--tg-tx);
}
.build-item:active { transform: translateY(1px); }
.build-item.published { border-color: var(--color-info); }
.build-icon {
  width: var(--size-icon); height: var(--size-icon); border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  background: var(--icon-bg); overflow: hidden;
}
.build-icon img { 
  width: 70%; 
  height: 70%; 
  object-fit: contain; 
  opacity: .95;
  pointer-events: auto;
}
.theme-light .build-icon img {
  filter: brightness(0) saturate(100%);
  opacity: 0.8;
}
.build-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: var(--space-1);
  font-size: var(--fs-16);
  color: var(--tg-tx);
}
.build-title > div:first-child {
  width: 100%;
  text-align: left;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: none;
  white-space: pre-line;
}
.build-author {
  font-size: var(--fs-13);
  color: var(--muted);
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.build-stats {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
}

.build-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: default;
}

.build-stat-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.8;
  pointer-events: auto;
}

.build-stat-count {
  font-size: var(--fs-12);
  color: var(--muted);
  line-height: 1;
}
.muted { color: var(--tg-hint); font-size: var(--fs-14); }
.is-dimmed { opacity: 0.5; }

/* ========== SHOTS GRID ========== */
.shots-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
.shots-grid .shot-thumb {
  width: 100%; height: 160px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
  overflow: hidden; background: var(--elem-bg);
  display: flex; align-items: center; justify-content: center;
}
.shot-thumb img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  pointer-events: auto;
}

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: var(--overlay-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  cursor: grab;
}
.lightbox:active { cursor: grabbing; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  user-select: none;
  -webkit-user-drag: none;
}

/* ========== BUILD DETAIL SCREENS ========== */
#buildDetailScreen .profile-grid,
#buildPublicDetailScreen .profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

/* Отступ для полей, чтобы не перекрывались с чипом номера билда */
#buildDetailScreen .card .profile-grid,
#buildPublicDetailScreen .card .profile-grid {
  margin-top: var(--space-8);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .profile-grid { grid-template-columns: 1fr; }
  .shots-grid { grid-template-columns: 1fr; }
  .shots-two { grid-template-columns: repeat(2, auto); gap: var(--space-2); }
  .actions-bar { grid-template-columns: 1fr; gap: var(--space-2); }
  .story-scroll-images {
    flex-direction: row;
  }
}
@media (max-width: 360px) {
  .thumbs-row { gap: var(--space-1); }
  .thumbs-row .preview-item,
  .thumbs-row .preview-more { width: 48px; height: 48px; }
}

/* ========== TOUCH ========== */
button, .list-btn, .chip-btn, .build-item, .upload-box, .class-tab {
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}

/* ========== CLASS TABS ========== */
.class-tabs-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.class-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size-touch);
  height: var(--size-touch);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--icon-bg);
  cursor: pointer;
  padding: 0;
  transition: background-color var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
}

.class-tab:active {
  transform: translateY(1px);
}

.class-tab img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.theme-light .class-tab img {
  filter: brightness(0) saturate(100%);
  opacity: 0.7;
}

.class-tab.active {
  background: var(--accent);
  border-color: transparent;
}

.class-tab.active img {
  opacity: 1;
  filter: brightness(0) saturate(100%) invert(8%) sepia(19%) saturate(3011%) hue-rotate(179deg) brightness(95%) contrast(99%);
}

/* ========== MASTERY BADGES ========== */
.badge-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--tg-tx);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: calc(var(--size-touch) + var(--space-1));
  line-height: inherit;
  font-size: inherit;
  font-family: inherit;
  vertical-align: baseline;
  -webkit-appearance: none;
  appearance: none;
}

/* Полупрозрачный overlay для фоновых изображений */
.badge-btn[style*="background-image"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay-medium);
  border-radius: var(--radius-lg);
  pointer-events: none;
  z-index: 1;
}

/* Контент должен быть поверх overlay */
.badge-btn > * {
  position: relative;
  z-index: 2;
}
.badge-btn:active { transform: translateY(1px); }
.badge-btn:disabled {
  cursor: default;
  transform: none;
}

/* Выполненное еженедельное задание - затемнённый оверлей */
.badge-btn--completed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border-radius: var(--radius-lg);
  z-index: 5;
  pointer-events: none;
}

/* Текст выполненного задания поверх затемнения */
.badge-btn--completed .rotation-mode-text {
  z-index: 6;
}

/* Галочка для выполненного задания */
.badge-btn--completed::before {
  content: "✓" !important;
  position: absolute !important;
  top: 50% !important;
  left: auto !important;
  right: 16px !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  text-align: center !important;
  font-size: 1.25rem !important;
  font-weight: bold !important;
  color: #fff !important;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
  border-radius: 50% !important;
  z-index: 7 !important;
  pointer-events: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.2) !important;
}

.badge-btn.badge-btn--with-bg .mastery-level-name {
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.9);
}
.badge-btn.badge-btn--with-bg .mastery-category-name {
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.65),
    0 0 4px rgba(0, 0, 0, 0.45);
}
.badge-btn.badge-btn--with-bg .mastery-level-number {
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Ротация: текст на кнопках с фоном всегда белый, как в мастерстве */
.badge-btn.badge-btn--with-bg .rotation-mode-text,
.badge-btn.badge-btn--with-bg .rotation-mode-name,
.badge-btn.badge-btn--with-bg .rotation-mode-map {
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

/* ========== HELLMODE BUTTON ON HOME PAGE ========== */
/* Иконки HellMode на главной странице - сверху слева */
/* Скрываем кнопку HellMode, если задание выполнено */
#questCardHellmodeBtn[data-completed="true"],
#questCardHellmodeBtn.hidden-completed {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -9999px !important;
  pointer-events: none !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
}

#questCardHellmodeBtn .rotation-mod-icons,
#questCardAdditionalHellmodeBtn .rotation-mod-icons {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
}

/* Отступ для текста в кнопке HellMode, чтобы не перекрывался иконками слева */
#questCardHellmodeBtn .rotation-mode-text,
#questCardAdditionalHellmodeBtn .rotation-mode-text {
  padding-top: var(--size-touch);
}

/* Бейдж награды в кнопке основного HellMode - справа сверху */
#questCardHellmodeBtn .quest-reward-badge {
  bottom: auto;
  top: var(--space-3);
}

/* Контейнер для наград в кнопке дополнительного HellMode - справа сверху */
#questCardAdditionalHellmodeBtn .quest-reward-container {
  position: absolute !important;
  top: var(--space-3);
  right: var(--space-3);
  bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  z-index: 3 !important;
}

/* Бейдж награды в контейнере дополнительного HellMode - убираем position absolute */
#questCardAdditionalHellmodeBtn .quest-reward-container .quest-reward-badge {
  position: static !important;
  bottom: auto;
  top: auto;
}

.mastery-header-card.mastery-header-card--with-bg .reward-detail-header,
.mastery-header-card.mastery-header-card--with-bg .mastery-level-name,
.mastery-level-card.mastery-header-card--with-bg .mastery-level-name {
  color: #fff;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 0 6px rgba(0, 0, 0, 0.6),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

.mastery-header-card.mastery-header-card--with-bg .mastery-progress-container .mastery-level-number {
  color: #fff;
}
.theme-light .mastery-progress-svg [data-role="progress-bg"] {
  stroke: rgba(0, 0, 0, 0.16);
}

.theme-light .badge-btn:not(.badge-btn--with-bg) .mastery-progress-svg [data-role="progress-bg"],
.theme-light .mastery-header-card:not(.mastery-header-card--with-bg) .mastery-progress-svg [data-role="progress-bg"] {
  stroke: rgba(0, 0, 0, 0.28);
}

.badge-btn.badge-btn--with-bg .mastery-progress-svg [data-role="progress-bg"],
.mastery-header-card.mastery-header-card--with-bg .mastery-progress-svg [data-role="progress-bg"] {
  stroke: rgba(255, 255, 255, 0.45);
}

.theme-light .badge-btn.badge-btn--with-bg .mastery-progress-svg [data-role="progress-bg"],
.theme-light .mastery-header-card.mastery-header-card--with-bg .mastery-progress-svg [data-role="progress-bg"] {
  stroke: rgba(255, 255, 255, 0.7);
}
 
/* ========== MASTERY COMPONENTS ========== */
/* Контейнер для текста (левая часть badge) */
.mastery-text-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  z-index: 2;
  position: relative;
}

/* Название категории */
.mastery-category-name {
  font-size: var(--fs-14);
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.45);
}

/* Название уровня (используется и в кнопках, и в детальном экране) */
.mastery-level-name {
  font-size: var(--fs-16);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 8px rgba(0, 0, 0, 0.5);
  margin: 0;
  flex: 1;
  z-index: 2;
  position: relative;
}

/* Убираем свечение в карточке "Что нового" для светлой темы */
.theme-light #whatsNewPreviewCard .mastery-level-name,
.theme-light #whatsNewPreviewCard .mastery-category-name {
  text-shadow: none;
}

/* Контейнер для прогресса/иконки (правая часть badge) */
.mastery-progress-container {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  z-index: 2;
}

/* Иконка максимального уровня */
.mastery-icon {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.6)) drop-shadow(0 0 10px rgba(212, 175, 55, 0.35));
  opacity: 0.95;
  pointer-events: auto;
}

/* Цифра уровня в центре прогресса */
.mastery-level-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--tg-tx);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  line-height: 1;
}

/* SVG контейнер для прогресса */
.mastery-progress-svg {
  width: 100%;
  height: 100%;
}

/* Header card в детальном экране */
.mastery-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  position: relative;
  overflow: hidden;
}

/* Полупрозрачный overlay для фоновых изображений в header card */
.mastery-header-card[style*="background-image"]::before,
.mastery-level-card[style*="background-image"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay-medium);
  border-radius: var(--radius-lg);
  pointer-events: none;
  z-index: 1;
}

/* Контент должен быть поверх overlay */
.mastery-header-card > *,
.mastery-level-card > * {
  position: relative;
  z-index: 2;
}

/* ========== MASTERY SCREEN ========== */
.list-buttons#masteryButtonsContainer {
  gap: var(--space-2);
}

/* ========== TILE GRID ========== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
}

.tile-btn {
  aspect-ratio: 1;
  width: 100%;
  padding: 0;
  background: var(--elem-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.tile-btn:active {
  transform: scale(0.95);
}

.tile-btn.is-active {
  border-color: var(--accent);
  background: rgba(46, 166, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(46, 166, 255, 0.24);
}

.tile-icon {
  width: 60%;
  height: 60%;
  object-fit: contain;
  pointer-events: none;
}

.trophy-description {
  font-size: var(--fs-15);
  line-height: var(--lh-normal);
  color: var(--tg-tx);
  margin-top: var(--space-2);
}

.trophy-proof {
  font-size: var(--fs-14);
  color: var(--tg-hint);
  line-height: var(--lh-normal);
  white-space: pre-line;
}

.trophy-proof.with-divider {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* ========== SEASON TROPHY CARD ========== */
#seasonTrophyCard {
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
}

.season-trophy-card {
  width: 100%;
  min-height: 120px;
  padding: var(--space-4);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  text-align: left;
  /* Красивый цветной градиент: красный, бордовый, оранжевый, черный, белый */
  background: linear-gradient(
    135deg,
    rgba(255, 0, 0, 0.5) 0%,
    rgba(128, 0, 32, 0.5) 25%,
    rgba(255, 165, 0, 0.5) 50%,
    rgba(0, 0, 0, 0.6) 75%,
    rgba(255, 255, 255, 0.3) 100%
  );
  background-size: 200% 200%;
  animation: season-trophy-gradient 8s ease infinite;
  
  /* Блестящая рамка с анимацией через box-shadow */
  box-shadow: 
    0 0 0 2px rgba(212, 175, 55, 0.3),
    0 0 10px rgba(212, 175, 55, 0.2),
    0 0 20px rgba(255, 215, 0, 0.1);
  animation: season-trophy-border-glow 3s ease-in-out infinite, season-trophy-gradient 8s ease infinite;
}

/* Фон с паттерном из иконки трофея (повернутый на 45 градусов) */
.season-trophy-bg {
  position: absolute;
  /* Увеличиваем размер, чтобы покрыть повернутый паттерн и заполнить углы */
  top: -75%;
  left: -75%;
  width: 250%;
  height: 250%;
  /* Фон устанавливается через inline стиль в JS */
  /* Размер ячейки паттерна - 50px (создается через canvas в JS) */
  background-size: 50px 50px;
  background-repeat: repeat;
  background-position: 0 0;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
  transform: rotate(45deg);
  transform-origin: center center;
}

/* Дополнительный слой для затемнения фона и улучшения читаемости */
.season-trophy-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(14, 22, 33, 0.2) 0%,
    rgba(14, 22, 33, 0.35) 100%
  );
  pointer-events: none;
  z-index: 1;
  border-radius: var(--radius-lg);
}

/* Блестящий эффект через отдельный элемент внутри карточки */
.season-trophy-shine {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  animation: season-trophy-shine 4s linear infinite;
  pointer-events: none;
  z-index: 2;
}

/* Анимация градиента фона */
@keyframes season-trophy-gradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Анимация свечения рамки */
@keyframes season-trophy-border-glow {
  0%, 100% {
    box-shadow: 
      0 0 0 2px rgba(212, 175, 55, 0.4),
      0 0 15px rgba(212, 175, 55, 0.3),
      0 0 25px rgba(255, 215, 0, 0.2),
      inset 0 0 20px rgba(212, 175, 55, 0.1);
  }
  50% {
    box-shadow: 
      0 0 0 2px rgba(255, 215, 0, 0.6),
      0 0 20px rgba(255, 215, 0, 0.4),
      0 0 35px rgba(255, 255, 255, 0.3),
      inset 0 0 30px rgba(255, 215, 0, 0.15);
  }
}


@keyframes season-trophy-shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
  }
}

.season-trophy-card:active {
  transform: scale(0.98);
}

.season-trophy-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  position: relative;
  z-index: 3;
  background: rgba(14, 22, 33, 0.3);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.season-trophy-icon-wrapper {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--elem-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.season-trophy-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.season-trophy-text-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.season-trophy-text {
  font-size: var(--fs-22);
  font-weight: 700;
  color: var(--fg);
  text-shadow: var(--shadow-text);
  line-height: var(--lh-tight);
}

.season-trophy-timer {
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--muted);
  text-shadow: var(--shadow-text);
  opacity: 0.9;
}

/* ========== HELLMODE QUEST DETAIL ========== */
/* Иконки HellMode на странице деталей - сверху слева */
#hellmodeQuestDetailContainer .waves-meta-card .waves-mod-icons {
  right: auto;
  left: var(--space-3);
}

/* Отступ для заголовка в карточке HellMode, чтобы не перекрывался иконками */
#hellmodeQuestDetailContainer .waves-meta-card .waves-header {
  padding-top: 36px;
}

/* Бейдж награды в карточке HellMode на странице деталей - справа сверху */
#hellmodeQuestDetailContainer .waves-meta-card .quest-reward-badge {
  bottom: auto;
  top: var(--space-3);
}

/* ========== ADDITIONAL HELLMODE QUEST DETAIL ========== */
/* Иконки дополнительного HellMode на странице деталей - сверху слева (как в основном) */
#additionalHellmodeQuestDetailContainer .waves-meta-card .waves-mod-icons {
  right: auto;
  left: var(--space-3);
}

/* Отступ для заголовка в карточке дополнительного HellMode, чтобы не перекрывался иконками */
#additionalHellmodeQuestDetailContainer .waves-meta-card .waves-header {
  padding-top: 36px;
}

/* Контейнер наград в карточке дополнительного HellMode на странице деталей - справа наверху */
#additionalHellmodeQuestDetailContainer .waves-meta-card .quest-reward-container {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 3;
}

/* Бейдж награды в контейнере дополнительного HellMode на странице деталей - убираем position absolute */
#additionalHellmodeQuestDetailContainer .waves-meta-card .quest-reward-container .quest-reward-badge {
  position: static !important;
  bottom: auto;
  top: auto;
  right: auto;
}

/* ========== HELLMODE QUEST DETAIL - LIGHT THEME ========== */
/* Инвертирование иконок в карточке "Описание" при светлой теме (кроме магатамы) */
.theme-light #hellmodeQuestDetailContainer .profile-grid .value img:not([alt="Награда"]) {
  filter: brightness(0) saturate(100%);
  opacity: 0.8;
}

/* Инвертирование иконки share на странице детального просмотра билда при светлой теме */
.theme-light .build-edit-btn img[src*="share.svg"] {
  filter: brightness(0) saturate(100%);
  opacity: 0.8;
}

/* Черный текст в карточке "Доказательство" при светлой теме */
.theme-light #hellmodeQuestDetailContainer .trophy-proof {
  color: #000 !important;
}

.card.current-level {
  border-left: 4px solid var(--color-success);
}

.card.next-level {
  border-left: 4px solid var(--accent);
  opacity: 0.95;
}

.card.max-level {
  border-left: 4px solid var(--color-gold-shadow);
  background: rgba(212, 175, 55, 0.05);
}

.mastery-description {
  font-size: var(--fs-15);
  line-height: var(--lh-normal);
  color: var(--tg-tx);
  margin-top: var(--space-2);
}

.mastery-proof {
  font-size: var(--fs-14);
  color: var(--tg-hint);
  line-height: var(--lh-normal);
}

/* ========== MASTERY DETAIL SCREEN ========== */
/* Контейнер для иконки категории */
.mastery-detail-icon-wrapper,
.trophy-detail-icon-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-4) 0;
}

/* Иконка категории (128x128) */
.mastery-detail-icon,
.trophy-detail-icon {
  width: 128px;
  height: 128px;
  object-fit: contain;
  animation: mastery-icon-glow 2s ease-in-out infinite;
}

/* Анимация свечения для иконки мастерства */
@keyframes mastery-icon-glow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.3)) drop-shadow(0 0 12px rgba(212, 175, 55, 0.15));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5)) drop-shadow(0 0 20px rgba(212, 175, 55, 0.25));
  }
}

/* Текст в карточке про иконку/максимальный уровень */
.mastery-detail-main-text {
  text-align: left;
  line-height: 1.5;
}

/* Заголовок "Следующий уровень:" перед карточкой */
.mastery-next-level-title {
  font-size: var(--fs-16);
  font-weight: 600;
  margin: var(--space-4) var(--space-4) var(--space-2) var(--space-4);
}

/* Текст с прогрессом "Завершено X из Y" (по размеру как топбар) */
.mastery-progress-summary {
  font-size: var(--fs-20);
  font-weight: 600;
  text-align: center;
  margin: var(--space-4) 0;
}

/* Карточка уровня */
.mastery-level-card {
  position: relative;
  overflow: hidden;
  min-height: 60px;
  display: flex;
  align-items: center;
}

/* Заголовок карточки уровня (название + галочка) */
.mastery-level-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  position: relative;
  z-index: 2;
  width: 100%;
}

/* Контейнер для галочки */
.mastery-level-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

/* Иконка галочки */
.mastery-level-check-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

/* ========== FILTER MODAL ========== */
.filter-modal {
  position: fixed;
  inset: 0;
  background: var(--overlay-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: var(--space-4);
}

.filter-modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.filter-modal-title {
  font-size: var(--fs-18);
  font-weight: 600;
  margin-bottom: var(--space-3);
  text-align: center;
}

.filter-modal-options {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-category-section {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-category-section:last-child {
  margin-bottom: 0;
}

.filter-category-title {
  font-size: var(--fs-18);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: var(--space-2);
}

.theme-light .filter-category-title {
  color: #000;
}

/* Стили для страницы участников - выравнивание инпута и кнопки фильтра */
#participantsScreen .input input {
  height: var(--size-touch);
  padding: 0 var(--space-3);
  box-sizing: border-box;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--elem-bg);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
}

.filter-option span {
  font-size: var(--fs-16);
  font-weight: 600;
  color: var(--fg);
}

/* ========== FILTER MODAL ACTIONS BAR ========== */
.filter-modal-content .actions-bar {
  margin-top: var(--space-4);
  margin-left: 0;
  margin-right: 0;
  grid-template-columns: 1fr;
}

/* ========== START SCREEN MODAL - LIGHT THEME ========== */
.theme-light .filter-modal-title,
.theme-light .start-screen-option span,
.theme-light .filter-option span {
  color: #000;
}

/* ========== GIFT MODAL - LIGHT THEME ========== */
.theme-light .gift-recipient-search input {
  color: #000;
  background: #fff;
}

.theme-light .gift-recipient-search input::placeholder {
  color: #666;
}

.theme-light .gift-recipient-name {
  color: #000;
}

/* Стили для модалок модификации и разборки снаряжения в светлой теме */
.theme-light #gearModificationConfirmModal p,
.theme-light #gearDisassembleConfirmModal p {
  color: #000 !important;
}

.theme-light .gift-view-name {
  color: #000;
}

.theme-light .gift-info-title {
  color: #666;
}

.theme-light .gift-info-sender-name {
  color: #000;
}

/* ========== AUTHOR FIELD ========== */
.author-field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.author-field label {
  margin-bottom: 0;
  flex-shrink: 0;
}

/* ========== AUTHOR CHIP ========== */
.author-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--tg-tx);
  cursor: pointer;
  font-size: var(--fs-14);
  min-height: 28px;
  transition: transform 0.1s ease;
  text-align: left;
  width: auto;
  max-width: 200px;
}

.author-chip:active {
  transform: translateY(1px);
}

/* ========== РЕАКЦИИ (ЛАЙКИ/ДИЗЛАЙКИ) ========== */
.reactions-field {
  margin-top: var(--space-3);
}

.reactions-container {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke-color);
  background: var(--elem-bg);
  color: var(--fg);
  font-size: var(--fs-14);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.reaction-chip:active {
  transform: scale(0.96);
}

.reaction-chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* При активном состоянии - красим только контур (border), не фон */
.reaction-chip.liked {
  background: var(--elem-bg); /* Оставляем стандартный фон */
  border-color: #4caf50; /* Зеленый контур */
}

.reaction-chip.disliked {
  background: var(--elem-bg); /* Оставляем стандартный фон */
  border-color: #ff4444; /* Красный контур */
}

.reaction-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.reaction-count {
  font-size: var(--fs-14);
  font-weight: 500;
  min-width: 1ch;
  text-align: center;
}

#profileScreen,
#buildsScreen,
#buildCreateScreen,
#buildDetailScreen,
#buildPublicDetailScreen {
  padding-top: 0;
}

#buildsScreen .actions-bar:first-of-type,
#buildDetailScreen .actions-bar:first-of-type {
  margin-top: 0;
}

#profileEditScreen .actions-bar,
#buildCreateScreen .actions-bar,
#buildDetailScreen .actions-bar:last-of-type,
#themePreviewScreen .actions-bar {
  margin-bottom: 0;
}

/* ========== iOS KEYBOARD IMPROVEMENTS ========== */
/* Улучшения для работы с клавиатурой на iOS */

/* Предотвращаем зум при фокусе на полях ввода на iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  .input input,
  .input textarea {
    font-size: 16px; /* Минимальный размер шрифта для предотвращения зума */
  }
}

/* Улучшаем визуальную обратную связь при тапе */
.input input:active,
.input textarea:active {
  transform: scale(0.98);
  transition: transform var(--transition-fast);
}

/* Стили для лучшего отображения клавиатуры на iOS */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari */
  .input input,
  .input textarea {
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--radius-md);
  }
  
  /* Убираем стандартные стили iOS для полей ввода */
  .input input[type="text"],
  .input input[type="email"],
  .input input[type="password"],
  .input textarea {
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: var(--radius-md);
    border-radius: var(--radius-md);
  }
}

/* Дополнительные стили для улучшения UX на мобильных устройствах */
@media (max-width: 768px) {
  .input input,
  .input textarea {
    /* Увеличиваем область тапа для лучшего UX */
    min-height: var(--size-touch);
    padding: var(--space-3) var(--space-3);
  }
  
  /* Улучшаем читаемость текста на мобильных */
  .input input::placeholder,
  .input textarea::placeholder {
    opacity: var(--opacity-secondary);
  }
}

/* Build edit button */
.build-edit-btn {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.8;
  z-index: 10;
  transition: opacity var(--transition-base);
}

.build-edit-btn--left {
  left: var(--space-3);
  right: auto;
}

.build-edit-btn:active {
  opacity: 1;
}

.build-edit-btn img,
.build-edit-btn svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

/* Avatar upload button */
.avatar-upload-btn,
.avatar-display {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--elem-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 10;
}

.avatar-upload-btn {
  border: 2px dashed var(--color-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-preview,
.avatar-display img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-placeholder {
  font-size: 32px;
  color: var(--muted);
  user-select: none;
}

.avatar-upload-btn.has-avatar {
  border-style: solid;
  border-width: 1px;
}

/* Avatar display (read-only, for participant profile) */
.avatar-display {
  border: 1px solid var(--color-border);
}

/* ========== BOTTOM NAVIGATION ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--color-border);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-2));
  padding-top: var(--space-1);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 0;
  z-index: 1000;
  max-width: 920px;
  margin: 0 auto;
}

.bottom-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--tg-bg);
  opacity: 0.7;
  z-index: -1;
}

.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  background: transparent;
  border: none;
  cursor: pointer;
  min-height: 44px;
  transition: opacity var(--transition-base);
  position: relative;
}

/* Индикатор активной вкладки (синяя полоска сверху) */
.bottom-nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
  transition: width 0.3s ease;
  z-index: 1;
}

.bottom-nav-btn.active::before {
  width: 60%;
}

.bottom-nav-icon {
  width: 30px;
  height: 30px;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55),
              opacity var(--transition-base);
  object-fit: contain;
}

.bottom-nav-btn.active .bottom-nav-icon {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(46, 166, 255, 0.5)) grayscale(0%);
  transform: scale(1.15);
}

.bottom-nav-btn:not(.active) .bottom-nav-icon {
  opacity: 0.6;
  filter: grayscale(50%);
}

#bottomNavGroupBtn .bottom-nav-icon {
  opacity: 1;
  filter: grayscale(0%);
}

.bottom-nav-btn:active {
  opacity: 0.7;
}

.bottom-nav-btn:active .bottom-nav-icon {
  transform: scale(0.9);
}

/* ============================================
   МАГАЗИН
   ============================================ */

/* Карточка баланса */
.shop-balance-card {
  background: linear-gradient(145deg, #1a0a0a 0%, #2d1515 50%, #1a0a0a 100%);
  border: 1px solid rgba(180, 40, 40, 0.3);
  border-radius: var(--radius-lg);
  margin: var(--space-4);
  margin-bottom: var(--card-spacing, var(--space-4));
  padding: var(--space-5);
  position: relative;
}

/* Декоративная линия сверху */
.shop-balance-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #b22222, transparent);
  border-radius: 2px;
}

.shop-balance-glow {
  display: none;
}

.shop-balance-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.shop-balance-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-balance-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255, 180, 80, 0.5));
  animation: shopMagatamaFloat 2.5s ease-in-out infinite;
}

@keyframes shopMagatamaFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-3px) rotate(5deg);
  }
}

.shop-balance-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.shop-balance-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.shop-balance-value {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}

/* Сетка товаров */
.shop-items-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--space-4);
  padding-top: 0;
}

/* Карточка товара */
.shop-item-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.15s ease, opacity 0.15s ease;
  position: relative;
  overflow: hidden;
}

.shop-item-card:active {
  transform: scale(0.98);
  opacity: 0.85;
}

/* Анимация появления карточек */
.shop-item-card:nth-child(1) {
  animation: shopCardSlide 0.4s ease-out 0.1s both;
}

.shop-item-card:nth-child(2) {
  animation: shopCardSlide 0.4s ease-out 0.2s both;
}

.shop-item-card:nth-child(3) {
  animation: shopCardSlide 0.4s ease-out 0.3s both;
}

@keyframes shopCardSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Тема профиля - фиолетово-синий */
.shop-item-card--theme {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Подарки - розово-красный */
.shop-item-card--gifts {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

/* Первое место - золотисто-оранжевый */
.shop-item-card--top {
  background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
  box-shadow: 0 4px 15px rgba(247, 151, 30, 0.3);
}

.shop-item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  flex-shrink: 0;
  padding: 8px;
}

.shop-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shop-item-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.shop-item-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.shop-item-arrow {
  font-size: 24px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
}

/* ============================================
   ПОДАРКИ
   ============================================ */

/* Сетка подарков - 4 колонки */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Прямоугольный блок подарка (квадрат + цена снизу) */
.gift-item {
  border: none;
  border-radius: var(--radius-md);
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  width: 100%;
}

.gift-item:active {
  transform: scale(0.95);
  opacity: 0.9;
}

/* Верхняя часть - квадрат с иконкой (цветной фон) */
.gift-item-icon-wrapper {
  aspect-ratio: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
}

/* Контейнер иконки подарка */
.gift-item-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
}

.gift-item-icon-static {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gift-item-icon-static svg {
  width: 100%;
  height: 100%;
  max-width: 80%;
  max-height: 80%;
}

/* Нижняя часть - полоска с ценой */
.gift-item-price-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--card-bg);
  padding: 4px 8px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  flex-shrink: 0;
  min-height: 24px;
}

.gift-item-price-chip img {
  width: 14px;
  height: 14px;
}

.theme-light .gift-item-price-chip {
  color: #000;
}

/* Инвертация цвета иконки KI для светлой темы */
.theme-light .gift-item-price-chip img[src*="ki-icon.svg"] {
  filter: invert(1);
}

/* Белый контур и белый текст для модалки просмотр купленного снаряжения (светлая тема) */
.theme-light #gearOwnedViewModal .btn.wide:not(.primary) {
  border-color: #fff;
  color: #fff;
}

/* Черный контур и текст для кнопки "Отмена" в модалке покупки снаряжения (светлая тема) */
.theme-light #gearViewModal .btn.wide:not(.primary) {
  border-color: #000;
  color: #000;
}


/* ========== МОДАЛЬНОЕ ОКНО ПРОСМОТРА ПОДАРКА ========== */
.gift-view-modal-content {
  max-width: 320px;
  width: 100%;
  text-align: center;
}

.gift-view-icon,
.theme-view-preview {
  width: 150px;
  height: 150px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gift-view-icon svg,
.theme-view-preview svg {
  width: 100%;
  height: 100%;
  max-width: 90%;
  max-height: 90%;
}

/* Активная тема в сетке */
.gift-item.theme-active {
  border: 2px solid var(--color-primary);
}

.gift-view-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.gift-view-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: var(--space-4);
}

.gift-view-price img {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.gift-view-modal-content .actions-bar {
  margin-top: 0;
  gap: var(--space-2);
  margin-bottom: 0;
}

/* ========== МОДАЛЬНОЕ ОКНО ПРОСМОТРА КУПЛЕННОГО СНАРЯЖЕНИЯ ========== */
.gear-owned-view-modal-content {
  max-width: 360px;
  width: 100%;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.gear-owned-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.gear-owned-view-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
}

.gear-owned-view-id-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.gear-owned-view-id-chip span {
  color: #fff;
  font-weight: 700;
}

.gear-owned-view-ki {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

.gear-owned-view-ki img {
  width: 28px;
  height: 28px;
}

.gear-owned-view-item-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gear-owned-view-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gear-class-icon {
  display: inline-block;
  vertical-align: middle;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.gear-owned-view-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
  text-align: left;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.gear-owned-view-name span {
  display: inline-block;
}

.gear-owned-view-type {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-3);
  text-align: left;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gear-owned-view-type span {
  display: inline-block;
}

.gear-owned-view-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: var(--space-3) 0;
}

.gear-owned-view-properties {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.gear-owned-view-property {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 15px;
  color: #fff;
  gap: 12px;
}

.gear-owned-view-property-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  line-height: 1.4;
}

.gear-owned-view-property-value {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  flex-shrink: 0;
}

.gear-owned-view-perks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.gear-owned-view-perk {
  font-size: 17px;
  font-weight: 500;
  color: #b74643;
  text-align: left;
  text-transform: uppercase;
}

.gear-owned-view-modal-content .actions-bar {
  margin-top: var(--space-4);
  gap: var(--space-2);
}

/* Модалка выбора получателя */
.gift-recipient-modal-content {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.gift-recipient-search {
  margin-bottom: var(--space-3);
}

.gift-recipient-search input {
  width: 100%;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--card-bg);
  color: #fff;
  font-size: 14px;
}

.gift-recipient-search input::placeholder {
  color: var(--color-muted);
}

.gift-recipient-list {
  flex: 1;
  overflow-y: auto;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-3);
}

/* Элемент списка получателей */
.gift-recipient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--space-3);
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease;
}

.gift-recipient-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.gift-recipient-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.gift-recipient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-recipient-name {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
}

.gift-recipient-modal-content .actions-bar {
  margin-top: 0;
  margin-bottom: 0;
}

/* ========== МИНИ-МОДАЛКА ИНФОРМАЦИИ О ПОДАРКЕ ========== */
.gift-info-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: var(--space-4);
}

.gift-info-modal.hidden {
  display: none;
}

.gift-info-modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  max-width: 280px;
  width: 100%;
  text-align: center;
  animation: gift-info-appear 0.2s ease-out;
}

@keyframes gift-info-appear {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gift-info-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
}

.gift-info-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-info-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

.gift-info-senders {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.gift-info-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.gift-info-sender-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.gift-info-sender-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-info-sender-name {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.gift-info-more {
  font-size: 13px;
  color: var(--color-muted);
  padding-top: var(--space-2);
}

/* Кнопка установки эмодзи-статуса */
.gift-set-status-btn {
  width: 100%;
  margin-top: var(--space-4);
}

/* Карточка подарков в профиле */
.profile-gifts-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.profile-gift-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.profile-gift-icon {
  width: 48px;
  height: 48px;
}

.profile-gift-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.profile-gift-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
}

/* ========== SNOW EFFECT ========== */
.snow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -20px;
  pointer-events: none;
  animation: snowfall linear infinite;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

.snowflake svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.9));
}

@keyframes snowfall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translateY(50vh) translateX(var(--drift, 0)) rotate(180deg);
    opacity: 0.9;
  }
  100% {
    transform: translateY(100vh) translateX(calc(var(--drift, 0) * 1.5)) rotate(360deg);
    opacity: 0;
  }
}

/* ========== ЭКРАН МОДИФИКАЦИИ СНАРЯЖЕНИЯ ========== */
.gear-modification-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.gear-modification-buttons .btn {
  width: 100%;
}

/* Стили для карточки предмета в модификации (копия из модалки) */
.gear-modification-item-card .gear-owned-view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.gear-modification-item-card .gear-owned-view-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.gear-modification-item-card .gear-owned-view-id-chip {
  font-size: var(--fs-12);
  color: rgba(255, 255, 255, 0.6);
}

.gear-modification-item-card .gear-owned-view-ki {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
}

.gear-modification-item-card .gear-owned-view-ki img {
  width: 28px;
  height: 28px;
}

.gear-modification-item-card .gear-owned-view-item-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gear-modification-item-card .gear-owned-view-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gear-modification-item-card .gear-owned-view-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0;
  text-align: left;
}

.gear-modification-item-card .gear-owned-view-type {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-3);
  text-align: left;
  text-transform: uppercase;
}

.gear-modification-item-card .gear-owned-view-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: var(--space-3) 0;
}

.gear-modification-item-card .gear-owned-view-properties {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.gear-modification-item-card .gear-owned-view-property {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 15px;
  color: #fff;
  gap: 12px;
}

.gear-modification-item-card .gear-owned-view-property-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
  line-height: 1.4;
}

.gear-modification-item-card .gear-owned-view-property-value {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  flex-shrink: 0;
}

.gear-modification-item-card .gear-owned-view-perks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.gear-modification-item-card .gear-owned-view-perk {
  font-size: 17px;
  font-weight: 500;
  color: #b74643;
  text-align: left;
  text-transform: uppercase;
}

/* ========== ТЕМЫ ПРОФИЛЯ ========== */