/* ============ СБРОС ============ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ============ ПЕРЕМЕННЫЕ ============ */
:root {
  --bg-dark: #0a0a0a;
  --bg-panel: #141414;
  --bg-slot: #1c1c1c;
  --border: #2a2a2a;
  --gold: #d4a85a;
  --gold-dim: #9a7a40;
  --bonus: #5c7c4f;
  --disbonus: #983a2b;
  --text: #e6e6e6;
  --text-dim: #8a8a8a;
}

/* ============ БАЗА ============ */
html, body {
  overflow-x: hidden;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-dark);
  background-image:
    radial-gradient(circle at 20% 0%, rgba(212, 168, 90, 0.04), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(212, 168, 90, 0.02), transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding: 16px 12px 40px;
  line-height: 1.5;
}

/* ============ ЗАГОЛОВОК + НАВИГАЦИЯ ============ */
.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  font-family: 'Cinzel Decorative', serif;
  font-weight: 700;
  font-size: 30px;
  color: var(--gold);
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(212, 168, 90, 0.25);
  margin-bottom: 10px;
}

.tabs-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-link {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tab-link:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

.tab-link.active {
  color: #0a0a0a;
  background: var(--gold-dim);
  border-color: var(--gold);
}

.lang-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  background: transparent;
  color: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ============ ОСНОВНОЙ КОНТЕЙНЕР ============ */
.app-main {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============ ПАНЕЛИ ============ */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.panel-title {
  font-family: 'Cormorant', serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.panel-title-note {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  margin-left: 8px;
  text-transform: none;
}

/* ============ ЭКИПИРОВКА — КРЕСТОВИНА ============ */
.equipment-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    "mnem1   head    mnem2"
    "weapon1 body    weapon2"
    "acc1    legs    acc2";
  gap: 6px;
  width: 100%;
  align-items: start;
  min-width: 0;
}

/* Мнемы — как были */
.slot-mnem[data-slot="mnem-1"] { grid-area: mnem1; }
.slot-mnem[data-slot="mnem-2"] { grid-area: mnem2; }

/* Квадратные слоты */
.slot-wrapper-head .slot,
.slot-wrapper-body .slot,
.slot-wrapper-legs .slot,
.slot-wrapper-accessory-1 .slot,
.slot-wrapper-accessory-2 .slot {
  aspect-ratio: 1 / 1;
}

/* Оружие — прямоугольник повыше */
.slot-wrapper-weapon-1 .slot,
.slot-wrapper-weapon-2 .slot {
  aspect-ratio: 1 / 1;
}

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  box-sizing: border-box;
  min-width: 0;
}

/* Квадратные слоты */
.slot-head,
.slot-body,
.slot-legs,
.slot-accessory,
.slot-mnem {
  aspect-ratio: 1 / 1;
}

/* Оружие — прямоугольник повыше */
.slot-weapon {
  aspect-ratio: 1 / 1.15;
}
.slot:active {
  border-color: var(--gold-dim);
  background: #242424;
}

.slot-icon-img {
  width: auto;
  height: 60%;
  max-width: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.slot-icon-img:not([src]),
.slot-icon-img[src=""],
.slot-icon-img[hidden] {
  display: none;
}

.slot-name {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.1;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  box-sizing: border-box;
}

.slot-stats {
  display: block;
  font-size: 8px;
  color: var(--gold);
  line-height: 1.15;
  text-align: center;
  white-space: normal;           /* ← было nowrap */
  overflow-wrap: break-word;
  word-break: break-word;
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
  box-sizing: border-box;
}

.slot-mnem {
  border-style: dashed;
  border-color: #3a3a3a;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
  aspect-ratio: auto;
  height: auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 600px) {
  .slot-mnem { padding: 6px; }
}

.slot-head,
.slot-body,
.slot-legs,
.slot-weapon,
.slot-accessory {
  border-color: var(--gold-dim);
  background: linear-gradient(180deg, #1f1f1f, #141414);
}

.slot.is-locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
  position: relative;
}

.slot.is-locked::after {
  content: '🔒';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  opacity: 0.8;
}

/* ============ ПЕРЕКЛЮЧАТЕЛЬ ТИПА В СЛОТЕ ============ */
.slot-mode-toggle {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 3;
}

.mode-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  background: #0a0a0a;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.mode-btn.active {
  background: var(--gold-dim);
  color: #0a0a0a;
  border-color: var(--gold);
}

/* ============ РЕЗУЛЬТАТЫ — ОБЩИЕ КАРТОЧКИ ============ */
/* Используются в «Фарме» и «Мнемах» */
.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.result-card-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.result-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-card-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-card-value {
  font-family: 'Cormorant', serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--gold);
  line-height: 1.1;
}

@media (min-width: 600px) {
  .result-card-value { font-size: 26px; }
}

.result-card-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

/* Метка «КАП / MAX» внутри карточки результата */
.result-card-cap {
  display: none;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  opacity: 0.5;
}

.result-card.is-capped .result-card-cap {
  display: inline;
}

/* Подсветка цифры при капе — как в обзоре */
.result-card.is-capped .result-card-value {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* ============ МНЕМЫ ============ */
.mnem-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  justify-content: center;
}

@media (min-width: 600px) {
  .mnem-rows { gap: 5px; }
}

.mnem-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 600px) {
  .mnem-row { gap: 3px; }
}

.mnem-select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 4px 4px;
  font-size: 9px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-overflow: ellipsis;
  box-sizing: border-box;
  line-height: 1.2;
  height: auto;
  min-height: 24px;
}

/* На широких экранах — крупнее */
@media (min-width: 600px) {
  .mnem-select {
    font-size: 11px;
    padding: 4px 6px;
    min-height: 24px;
  }
}

.mnem-select:focus {
  border-color: var(--gold-dim);
  outline: none;
}

.mnem-select option {
  background: var(--bg-panel);
  color: var(--text);
}

.mnem-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mnem-select option:disabled {
  color: #555;
  font-style: italic;
}

.mnem-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 4px 4px;
  font-size: 10px;
  font-family: 'Inter', sans-serif;
  text-align: center;
  color: var(--text);
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: all 0.15s ease;
  -moz-appearance: textfield;
  box-sizing: border-box;
  line-height: 1.2;
  height: auto;
  min-height: 24px;
}

/* На широких экранах — крупнее */
@media (min-width: 600px) {
  .mnem-input {
    font-size: 12px;
    padding: 4px 6px;
    min-height: 24px;
  }
}

.mnem-input::-webkit-outer-spin-button,
.mnem-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mnem-input:focus {
  border-color: var(--gold-dim);
  outline: none;
}

.mnem-input.is-error {
  border-color: #d46a5a;
  background: #2a1a1a;
  color: #ff8a7a;
}

/* ============ КЛАСС, СПЕЦИАЛИЗАЦИЯ, ПИТОМЕЦ ============ */
.class-pet-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  align-items: start;
}

.class-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.class-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.class-caption {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.class-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 6px;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}

.class-icon-wrap {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.class-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.class-icon[hidden],
.class-icon:not([src]) {
  display: none;
}

.class-icon-placeholder {
  font-size: 14px;
  color: #3a3a3a;
  font-weight: 700;
}

.class-select {
  min-width: 0;
  padding: 6px 22px 6px 8px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a7a' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.class-select:hover,
.class-select:focus {
  border-color: var(--gold-dim);
  outline: none;
}

.class-select option {
  background: var(--bg-panel);
  color: var(--text);
}

.class-bonus {
  font-size: 9px;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
  line-height: 1.2;
  align-self: center;
}

.pet-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  height: 100%;
  position: relative;
}

.pet-spacer {
  display: block;
  height: 14px;
  pointer-events: none;
}

.pet-box:hover .pet-image-wrap {
  border-color: var(--gold-dim);
}

.pet-box:hover .pet-name {
  color: var(--gold);
}

.pet-image-wrap {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.pet-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.pet-image[hidden],
.pet-image:not([src]) {
  display: none;
}

.pet-placeholder {
  font-size: 22px;
  color: #3a3a3a;
  font-weight: 700;
}

.pet-name {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: break-word;
  transition: color 0.15s ease;
}

/* ============ ПРОЧИЕ БОНУСЫ ============ */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.step-check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.step-check:hover {
  border-color: var(--gold-dim);
}

.step-check:checked {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.step-check:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #0a0a0a;
  font-weight: 700;
}

.consumables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.consumable-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  min-width: 0;        /* ← важно для grid-элемента */
  overflow: hidden;    /* ← обрезает длинный текст */
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  text-align: left;
}

.consumable-item:hover {
  border-color: var(--gold-dim);
  background: #242424;
}

.consumable-item input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.consumable-item input:hover {
  border-color: var(--gold-dim);
}

.consumable-item input:checked {
  background: var(--gold-dim);
  border-color: var(--gold);
}

.consumable-item input:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #0a0a0a;
  font-weight: 700;
}

.consumable-item span {
  font-size: 11px;
  color: var(--text);
  line-height: 1.2;
}

.consumables-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  padding: 10px 0;
}

/* ============ ПОДВАЛ ============ */
.app-footer {
  text-align: center;
  margin-top: 30px;
  font-size: 11px;
  color: var(--text-dim);
}

.app-footer p {
  margin: 0;
  line-height: 1.4;
}

.app-footer p + p {
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.75;
}

.app-footer a {
  color: var(--gold-dim);
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-footer a:hover {
  color: var(--gold);
  text-decoration: underline;
}

/* ============ ШИРОКИЕ ЭКРАНЫ ============ */
@media (min-width: 600px) {
  body { padding: 24px 16px 60px; }

  .app-header h1 { font-size: 36px; }

  .panel { padding: 18px; }
  .panel-title { font-size: 18px; }

  .equipment-layout {
    gap: 10px;
    max-width: 480px;
    margin: 0 auto;
  }

.slot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

  .slot-name  { font-size: 10px; }
  .slot-stats { font-size: 9px; }
}

/* ============ МОДАЛКА ============ */

/* ============ МОДАЛКА ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay[hidden] { display: none; }

.modal-window {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%; max-width: 480px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: 'Cormorant', serif;
  font-size: 16px; color: var(--gold); font-weight: 500;
}

.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer;
}
.modal-close:hover { color: #d46a5a; border-color: #d46a5a; }

.modal-search { padding: 10px 14px; border-bottom: 1px solid var(--border); }

.modal-search-input {
  width: 100%; padding: 8px 10px;
  font-size: 13px; font-family: 'Inter', sans-serif;
  color: var(--text); background: #0a0a0a;
  border: 1px solid var(--border); border-radius: 6px;
}
.modal-search-input:focus { border-color: var(--gold-dim); outline: none; }

.modal-body { flex: 1; overflow-y: auto; padding: 6px; }

.modal-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  cursor: pointer; transition: background 0.1s ease;
}
.modal-item:hover { background: var(--bg-slot); }

.modal-item-icon {
  width: 40px; height: 40px;
  object-fit: contain; image-rendering: pixelated;
  flex-shrink: 0;
}

.modal-item-info { flex: 1; min-width: 0; }

.modal-item-name {
  font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.modal-item-meta { font-size: 11px; color: var(--gold); margin-top: 2px; }

.modal-empty {
  padding: 20px; text-align: center;
  color: var(--text-dim); font-size: 13px; font-style: italic;
}

.modal-footer {
  padding: 10px 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

.modal-clear {
  padding: 6px 12px; font-size: 12px;
  font-family: 'Inter', sans-serif;
  background: transparent; color: #d46a5a;
  border: 1px solid #4a2a2a; border-radius: 6px;
  cursor: pointer;
}
.modal-clear:hover { background: #2a1a1a; }

/* Подпись «Питомец» сверху */

/* Имя питомца — снизу, только когда выбран */

/* Качество — селект под слотом (актуальные стили — в общих блоках ниже) */

.slot-quality:hover,
.slot-quality:focus {
  border-color: var(--gold-dim);
  outline: none;
}

/* Крестик сброса в слоте */
.slot-reset {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  background: #0a0a0a;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.slot:has([data-item-id]) .slot-reset,
.slot.has-item .slot-reset {
  display: flex;
}

.slot-reset:hover {
  color: #d46a5a;
  border-color: #d46a5a;
}

/* Индикатор режима weapon/offhand */
.slot-mode-toggle[data-mode="weapon"] .mode-btn[data-mode="weapon"],
.slot-mode-toggle[data-mode="offhand"] .mode-btn[data-mode="offhand"] {
  background: var(--gold-dim);
  color: #0a0a0a;
  border-color: var(--gold);
}

.pet-reset {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  background: #0a0a0a;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

/* Подпись «Питомец» */
.pet-caption {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

/* Имя питомца */
.pet-name {
  font-size: 10px;
  color: var(--text);
  text-align: center;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Бонус питомца: три строки уровней уз */
.pet-bonus {
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-width: 100%;
}

.pet-bonus-line {
  white-space: nowrap;
}

.pet-bonus-line.is-available {
  color: var(--bonus);
}

.pet-bonus[hidden] { display: none; }
.pet-name[hidden] { display: none; }

/* Питомец заблокирован */
.pet-box.pet-locked {
  cursor: not-allowed;
}

.pet-box.pet-locked .pet-image-wrap {
  border-color: var(--border);
  opacity: 0.4;
}

/* Крестик сброса питомца */
.pet-reset {
  position: absolute;
  top: 0;
  right: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  background: #0a0a0a;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}

.pet-reset:hover {
  color: #d46a5a;
  border-color: #d46a5a;
}

/* ============ БОНУС-СЕКЦИИ ============ */
.bonus-section {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.bonus-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.bonus-caption {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.consumables-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  padding: 6px 0;
}

.consumable-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.consumable-icon-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-dim);
  background: #0a0a0a;
  border-radius: 4px;
}

.consumable-name {
  font-size: 10px;
  color: var(--text);
  text-align: center;
  line-height: 1.1;
}

.consumable-effect {
  font-size: 9px;
  color: var(--gold);
  text-align: center;
  line-height: 1.1;
}

/* Иконка шагов */
.step-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.consumable-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.consumable-name {
  font-size: 11px;
  color: var(--text);
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: break-word;
}

.consumable-effect {
  font-size: 9px;
  color: var(--gold);
  line-height: 1.1;
  white-space: normal;
}

/* ============ ГЕММЫ (список) ============ */
.gems-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.gem-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.gem-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.gem-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gem-percent {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  flex-shrink: 0;
  margin-right: auto;   /* ← прижимает всё остальное вправо */
}

.gem-count {
  width: 25%;            /* ← 1/4 ширины строки */
  min-width: 60px;       /* ← не меньше 60px */
  max-width: 90px;       /* ← не больше 90px */
  padding: 6px 4px;
  font-size: 14px;
  font-family: 'Cormorant', serif;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  -moz-appearance: textfield;
  flex-shrink: 0;
}

/* Только ввод, без стрелок-спиннеров (как в «Обзоре») */
.gem-count::-webkit-outer-spin-button,
.gem-count::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gems-total-slots {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gems-slots-value {
  font-family: 'Cormorant', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.gems-total-slots--split {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.gems-slots-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gems-slots-input:disabled {
  opacity: 0.4;
}

.gems-summary {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  min-height: 20px;
}

.gems-summary .ok {
  color: var(--gold);
}

.gems-summary .error {
  color: #d46a5a;
}

/* ============ НАСТРАДАНИЕ — ПОВЕРХ ПРЕДМЕТА ============ */
.slot[data-atonement="1"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('https://playorna.com/static/img/fx/anguished.png');
  background-size: cover;
  background-position: center;
  pointer-events: none;
  border-radius: 8px;
  z-index: 1;
  opacity: 0.7;
  image-rendering: pixelated;
}

/* ============ ЗАГОЛОВОК-ССЫЛКА ============ */
.app-title-link {
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s ease;
}

.app-title-link:hover h1 {
  color: #e6c17a;
  text-shadow: 0 0 25px rgba(212, 168, 90, 0.4);
}

/* ============ ЧЕКБОКС В УГЛУ ПАНЕЛИ (PVP в «Варде», Ниндзя в «Дебаффах») ============ */
.ward-pvp-label {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
  background: var(--bg-panel);
  z-index: 2;
}

.ward-pvp-label:hover {
  border-color: var(--gold-dim);
}

.ward-pvp-label input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
  cursor: pointer;
}

.ward-pvp-label input:checked + span {
  color: var(--gold);
  font-weight: 600;
}

/* ============ КНОПКА ДОБАВЛЕНИЯ СТРОКИ ============ */
.add-row-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--gold-dim);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.add-row-btn:hover {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201, 162, 39, 0.05);
}

/* ============ КНОПКА УДАЛЕНИЯ СТРОКИ ============ */
.gem-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: #888;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.gem-remove:hover {
  color: #f44336;
  border-color: #f44336;
}

/* ============ КНОПКА СБРОСА ============ */
.reset-row {
  display: flex;
  width: 100%;
  margin: 0;
}

.reset-btn {
  width: 100%;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.reset-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.05);
}

.reset-btn:active {
  transform: scale(0.99);
}

/* Плашка-предупреждение размером с кнопку сброса (обводка и текст — цвет дисбонуса) */
.reset-note {
  width: 100%;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.5px;
  text-align: center;
  text-transform: uppercase;
  color: var(--disbonus);
  background: transparent;
  border: 1px solid var(--disbonus);
  border-radius: 8px;
}

/* У мнемов нет slot-name и slot-stats */
.slot-mnem .slot-name,
.slot-mnem .slot-stats {
  display: none;
}

/* ============ ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА (ФЛАГИ) ============ */
.lang-switcher {
  display: flex;
  gap: 8px; /* Расстояние между флагами */
  margin-left: 12px;
  align-items: center;
}

.lang-btn-ru,
.lang-btn-en {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0;
  width: 28px;
  height: 20px; /* Пропорции флага */
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5; /* Неактивные флаги чуть бледнее */
}

.lang-btn-ru:hover,
.lang-btn-en:hover {
  opacity: 0.8;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Активный флаг (класс ставит JS, data-lang — инлайн-скрипт до отрисовки) */
.lang-btn-ru.active,
.lang-btn-en.active,
html[data-lang="ru"] .lang-btn-ru,
html[data-lang="en"] .lang-btn-en {
  opacity: 1;
  border-color: #d4af37; /* Золотая рамка (под цвет заголовков) */
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.3); /* Легкое свечение */
}

/* Сами картинки внутри кнопок */

/* ============ ШАПКА С НАЗВАНИЕМ И ФЛАГАМИ ============ */
.app-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 0;
}

.lang-switcher {
  display: flex;
  gap: 6px;
  margin-left: 12px; /* Отступ от текста */
  /* Если нужно абсолютное позиционирование: */
  /* position: absolute; */
  /* left: calc(50% + 110px); */ /* Подогнать под ширину текста */
}

.app-title {
  margin: 0;
  font-size: 24px; /* Или как у тебя было */
  line-height: 1;
}

.app-title-link {
  text-decoration: none;
  color: inherit; /* Цвет заголовка */
}

/* ============ ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА (ФЛАГИ) ============ */
.lang-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lang-btn-ru,
.lang-btn-en {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0;
  width: 26px;
  height: 18px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4; /* Неактивный флаг бледный */
}

.lang-btn-ru:hover,
.lang-btn-en:hover {
  opacity: 0.8;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Активный флаг */
.lang-btn-ru.active,
.lang-btn-en.active,
html[data-lang="ru"] .lang-btn-ru,
html[data-lang="en"] .lang-btn-en {
  opacity: 1;
  border-color: #d4af37; /* Золотая рамка */
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

.lang-btn-ru img,
.lang-btn-en img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder-text {
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

.ward-content {
  padding: 20px 0;
  text-align: center;
}

/* ============ ЦИФРОВЫЕ ШРИФТЫ ============ */
/* Cinzel Decorative — только числа в полях ввода. */
input[inputmode="decimal"],
input[type="number"] {
  font-family: 'Cinzel Decorative', serif;
  font-weight: 400;
}

/* ============================================================
   ОБЩИЕ БЛОКИ — Фарм / Обзор / Вард / Мнемы
   ============================================================ */
.calc-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.calc-popup[hidden] { display: none; }

.calc-popup-inner {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 16px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.calc-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calc-popup-close:hover {
  color: #d46a5a;
  border-color: #d46a5a;
}

.calc-popup-title {
  font-family: 'Cormorant', serif;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  padding-right: 32px;
  border-bottom: 1px solid var(--border);
}

.calc-popup-step {
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

.calc-popup-step-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.calc-popup-step-label {
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.calc-popup-step-value {
  color: var(--gold);
  font-family: 'Cinzel Decorative', serif;
  font-weight: 400;
  flex-shrink: 0;
}

.calc-popup-total {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 0;
  margin-top: 8px;
  font-size: 14px;
  border-top: 2px solid var(--gold-dim);
  color: var(--gold);
  font-weight: 700;
}

.calc-popup-step-formula {
  font-size: 10px;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  padding-left: 8px;
  margin-top: 3px;
  line-height: 1.5;
  opacity: 0.85;
}

.calc-popup-step-formula > div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calc-popup-step-cap {
  background: rgba(255, 90, 90, 0.08);
  border-left: 2px solid rgba(255, 90, 90, 0.5);
}

.calc-popup-num,
.calc-popup-mult,
.calc-popup-total-value {
  font-family: 'Cinzel Decorative', serif;
  font-weight: 400;
}

/* Множитель в заголовке — мельче и бледнее */
.calc-popup-mult {
  opacity: 0.5;
  font-size: 0.8em;
}

/* Единица измерения — обычным шрифтом */
.calc-popup-unit {
  font-family: 'Inter', sans-serif;
  opacity: 0.7;
}

.custom-select-row {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s;
}

.custom-select-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.custom-select-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.custom-select-text {
  font-size: 14px;
  color: #888; /* Цвет плейсхолдера */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-text.custom-select-has-value {
  color: #fff; /* Цвет выбранного элемента */
}

.custom-select-arrow {
  font-size: 10px;
  color: #666;
  margin-left: 8px;
  line-height: 1;
}

.bonus-positive {
  color: var(--bonus);
  font-weight: 500;
}

.bonus-negative {
  color: var(--disbonus);
  font-weight: 500;
}

/* Разделитель между бонусами — белый (сами бонусы золотые) */
.bonus-sep {
  color: var(--text);
}

.slot-quality {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  padding: 2px 4px;
  font-size: 9px; /* Сам блок оставляем маленьким */
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--gold);
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  z-index: 2;
}

.slot-quality option {
  background: #141414;
  color: var(--gold);
  font-weight: 700; /* Сделал ещё жирнее */
  font-size: 12px;  /* Увеличил размер текста */
  font-family: 'Inter', sans-serif;
  padding: 4px; /* Добавил отступы внутри пункта, чтобы текст дышал */
}

.slot-quality[hidden] { display: none; }

.slot-quality:focus {
  border-color: var(--gold-dim);
  outline: none;
}

/* ============ УЗКИЕ ЭКРАНЫ: ЗАГОЛОВКИ (≤ 480px) ============ */
/* Заголовок сайта всегда в одну строку: шрифт подстраивается под ширину экрана,
   флаги языка чуть компактнее, чтобы не отнимать место. Заголовки панелей
   тоже мельче — чтобы влезали в строку вместе с примечанием. */
@media (max-width: 480px) {
  .app-title-row {
    padding: 6px 0;
  }

  .lang-switcher {
    gap: 4px;
    margin-left: 6px;
  }

  .lang-btn-ru,
  .lang-btn-en {
    width: 22px;
    height: 16px;
  }

  .app-header h1 {
    white-space: nowrap;
    font-size: clamp(18px, calc((100vw - 100px) / 11.3), 30px);
  }

  /* Заголовки панелей — мельче, чтобы влезали в строку вместе с примечанием */
  .panel-title {
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .panel-title-note {
    font-size: 9px;
    margin-left: 6px;
  }

  /* Название геммы — переносится на две строки вместо обрезки «…» */
  .gem-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.2;
  }

  /* Итоговые цифры (орны, золото, опыт, удача) — компактнее,
     чтобы «400%» и метка «КАП» влезали в карточку на 320–400px. */
  .result-card {
    gap: 8px;
    padding: 8px;
  }

  .result-card-icon {
    width: 28px;
    height: 28px;
  }

  .result-card-label {
    font-size: 9px;
    letter-spacing: 0.3px;
  }

  .result-card-value {
    font-size: 18px;
  }

  .result-card-line {
    gap: 4px;
  }

  .result-card-cap {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
}

/* ============ УЗКИЕ ЭКРАНЫ: КЛАСС И СПЕЦИАЛИЗАЦИЯ (≤ 399px) ============ */
/* Название сверху, бонусы снизу — строка выше, текст обрезается меньше. */
@media (max-width: 399.98px) {
  .class-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "icon text arrow"
      "icon bonus arrow";
    align-items: center;
    gap: 1px 6px;
    padding: 5px 6px;
  }

  .class-icon-wrap {
    grid-area: icon;
    width: 24px;
    height: 24px;
  }

  .class-icon-placeholder {
    font-size: 12px;
  }

  .custom-select-display {
    grid-area: text;
    align-self: end;
  }

  .custom-select-text {
    font-size: 12px;
  }

  .class-bonus {
    grid-area: bonus;
    align-self: start;
    min-width: 0;
    text-align: left;
    font-size: 8px;
    line-height: 1.3;
  }

  .custom-select-arrow {
    grid-area: arrow;
    margin-left: 4px;
    font-size: 8px;
  }
}

/* ============ УЗКИЕ ЭКРАНЫ (≤ 399px) ============ */
/* Глобальная вёрстка не меняется — правила работают только на маленьких экранах. */
@media (max-width: 399.98px) {
  /* Вкладки — компактнее, текст не переносится */
  .tabs-nav {
    gap: 4px;
  }

  .tab-link {
    padding: 4px 8px;
    font-size: 10px;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }

  /* Красное предупреждение — текст подстраивается под ширину */
  .reset-note {
    padding: 6px 10px;
    font-size: min(12px, 3.2vw);
    line-height: 1.3;
    letter-spacing: 0.2px;
  }

  /* Осколки — компактнее, высота по содержимому, а не по высоте ряда */
  .slot-mnem {
    padding: 2px;
    align-self: start;
  }

  .mnem-rows {
    gap: 1px;
  }

  /* Сверху выбор типа бонуса, снизу значение */
  .mnem-row {
    gap: 1px;
  }

  .mnem-select {
    min-height: 18px;
    padding: 1px 3px;
    font-size: 8px;
  }

  .mnem-input {
    min-height: 16px;
    padding: 1px 2px;
    font-size: 9px;
  }
}

/* ============ ПЛАШКИ ИВЕНТОВ И РАСХОДНИКОВ (≤ 399px) ============ */
/* До 380px — по одной плашке в строке: название и эффект влезают целиком.
   381–399px — две колонки, но текст мельче и переносится по словам,
   а не по буквам (как было из-за overflow-wrap: break-word). */
@media (max-width: 399.98px) {
  .consumable-item {
    gap: 6px;
    padding: 5px 7px;
  }

  .consumable-icon {
    width: 28px;
    height: 28px;
  }

  .consumable-name {
    font-size: 10px;
    overflow-wrap: normal;
    word-break: normal;
  }

  /* Шаги: «6000 шагов · Орны +25% · Удача +25%» — в одну строку */
  .step-row {
    gap: 6px;
    font-size: 11px;
    white-space: nowrap;
  }

  .step-check {
    width: 16px;
    height: 16px;
  }

  .step-icon {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 380px) {
  .consumables-grid {
    grid-template-columns: 1fr;
  }

  .step-row {
    font-size: 10px;
  }
}
