/* ============================================================
   DurkaBot MiniApp — тема «MADHOUSE» (v10.0)
   Стиль выдержан по ассетам игры: пергамент, тёмный камень,
   кроваво-красный акцент, грязное золото.
   ============================================================ */
:root {
  --bg: #14100b;
  --card-bg: #ecdcb8;
  --card-bg2: #e0cda6;
  --border: #7a6547;
  --border-dark: #5d4c34;
  --accent: #8b1e1e;
  --accent-hover: #a52727;
  --gold: #7a5510;
  --gold-bright: #c08a2d;
  --text: #2b2115;
  --text-on-dark: #f3e9d2;
  --text-muted: #6f5f49;
  --green: #3f6f2b;
  --green-bright: #568c3a;
  --red: #8b1e1e;
  --blue: #365f82;
  --leather: #372e26;
  --leather-hover: #453a2f;
}

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

body {
  background: var(--bg);
  color: var(--text-on-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  padding: 12px;
  padding-bottom: 70px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Едва заметная пергаментная текстура поверх тёмного фона — как чёрный
   холст игры под бумажным интерфейсом */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/static/img/game/bg-parchment.webp") center / cover no-repeat;
  opacity: 0.05;
  pointer-events: none;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: url("/static/img/game/panel-stone.webp") center / cover no-repeat;
  border: 1px solid #000;
  border-radius: 14px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.madhouse-logo {
  height: 34px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.top-header-user-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-header-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill {
  font-weight: 700;
  font-size: 14px;
  color: var(--gold-bright);
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.online-workers-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(63, 111, 43, 0.25);
  border: 1px solid rgba(86, 140, 58, 0.55);
  color: #9ccb7f;
  font-size: 12px;
  font-weight: 800;
  font-family: monospace;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.online-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-bright);
  display: inline-block;
  box-shadow: 0 0 6px rgba(86, 140, 58, 0.85);
  animation: onlinePulseGlow 2.4s ease-in-out infinite;
}

@keyframes onlinePulseGlow {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.9);
    box-shadow: 0 0 4px rgba(86, 140, 58, 0.45);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
    box-shadow: 0 0 10px #568c3a, 0 0 18px rgba(86, 140, 58, 0.55);
  }
}

.logout-btn {
  background: var(--leather);
  border: 1px solid var(--border-dark);
  color: var(--text-on-dark);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.logout-btn:hover {
  background: var(--leather-hover);
}

.hdr-sub-btn {
  background: linear-gradient(135deg, #9a6c20 0%, #7a5518 100%);
  border-color: var(--gold-bright);
  color: #fff7e0;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(154, 108, 32, 0.35);
}

.hdr-sub-btn:hover {
  background: linear-gradient(135deg, #b07f24 0%, #8a611c 100%);
}

.hdr-top-btn {
  background: rgba(20, 16, 11, 0.75);
  border-color: var(--gold);
  color: var(--gold-bright);
  font-weight: 800;
}

.hdr-top-btn:hover {
  background: rgba(35, 28, 19, 0.85);
}

.hdr-chat-btn {
  background: rgba(54, 95, 130, 0.3);
  border-color: rgba(84, 130, 168, 0.55);
  color: #a8cbe4;
  font-weight: 700;
}

.hdr-chat-btn:hover {
  background: rgba(54, 95, 130, 0.45);
}

.ref-header-btn {
  background: linear-gradient(135deg, rgba(154, 108, 32, 0.3) 0%, rgba(63, 111, 43, 0.24) 100%);
  border-color: rgba(192, 138, 45, 0.6);
  color: #e8c87a;
  font-weight: 700;
}

.ref-header-btn:hover {
  background: linear-gradient(135deg, rgba(154, 108, 32, 0.4) 0%, rgba(63, 111, 43, 0.32) 100%);
}

.ref-text-full,
.hdr-text-full {
  display: inline;
}

.ref-text-short {
  display: none;
}

@media (max-width: 599px) {
  .top-header {
    padding: 8px 10px;
    gap: 6px;
  }
  .top-header-actions {
    gap: 4px;
    width: 100%;
    justify-content: flex-start;
  }
  .user-pill {
    font-size: 12px;
  }
  .online-workers-pill {
    font-size: 11px;
    padding: 2px 7px;
  }
  .logout-btn {
    padding: 5px 7px;
    font-size: 11px;
    border-radius: 7px;
  }
  .ref-text-full,
  .hdr-text-full {
    display: none;
  }
  .ref-text-short {
    display: inline;
  }
}

.status-card {
  background: url("/static/img/game/panel-paper.webp") center / cover no-repeat;
  border: 2px solid var(--border-dark);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.badge-running {
  background: rgba(63, 111, 43, 0.22);
  color: var(--green);
  border: 1px solid var(--green);
}

.badge-stopped {
  background: rgba(139, 30, 30, 0.18);
  color: var(--red);
  border: 1px solid var(--red);
}

.master-btn {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn-start {
  background: linear-gradient(135deg, #4c7a34 0%, #375a24 100%);
  color: #f4ffe8;
  box-shadow: 0 4px 14px rgba(63, 111, 43, 0.45);
}

.btn-stop {
  background: linear-gradient(135deg, #8b1e1e 0%, #6d1515 100%);
  color: #ffecec;
  box-shadow: 0 4px 14px rgba(139, 30, 30, 0.45);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stat-box {
  background: rgba(43, 33, 21, 0.14);
  border: 1px solid rgba(122, 101, 71, 0.6);
  padding: 8px 6px;
  border-radius: 10px;
  text-align: center;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
}

.stat-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

/* Вкладки */
.nav-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  user-select: none;
  cursor: grab;
  scroll-behavior: smooth;
}

.nav-tabs:active {
  cursor: grabbing;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  background: url("/static/img/game/card-paper.webp") center / cover no-repeat;
  border: 1px solid var(--border-dark);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.nav-btn.active {
  background: linear-gradient(135deg, #8b1e1e 0%, #6d1515 100%);
  color: #ffecec;
  border-color: #a52727;
  box-shadow: 0 3px 10px rgba(139, 30, 30, 0.5);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Спойлеры этажей */
.spoiler-item {
  background: url("/static/img/game/panel-paper.webp") center / cover no-repeat;
  border: 2px solid var(--border-dark);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.spoiler-header {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: rgba(43, 33, 21, 0.12);
}

.spoiler-header:hover {
  background: rgba(43, 33, 21, 0.2);
}

.spoiler-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.spoiler-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(43, 33, 21, 0.22);
  color: var(--text-muted);
}

.spoiler-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

/* --- Заголовки этажей в стиле игры («ВЫБОР ЭТАЖА») --- */
.floor-title {
  min-width: 0;
  flex: 1;
}
.floor-eye {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: center / contain no-repeat;
  border-radius: 50%;
}
.floor-eye-on {
  background-image: url("/static/img/game/floor-eye-on.webp?v=2");
  filter: drop-shadow(0 0 3px rgba(238, 200, 84, 0.55));
}
.floor-eye-off {
  background-image: url("/static/img/game/floor-eye-off.webp?v=2");
}
/* Единая высота строки для всех текстовых элементов — без «лесенки» базовых линий */
.floor-title .floor-code,
.floor-title .floor-label,
.floor-title .spoiler-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  line-height: 1;
}
.floor-title .spoiler-badge {
  padding: 0 7px;
}
.floor-code {
  font-family: "Courier New", Courier, monospace;
  font-weight: 800;
  font-size: 13px;
  color: #7d2418;
  flex-shrink: 0;
}
.floor-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spoiler-header.is-locked {
  background-image: url("/static/img/game/floor-hatch.webp");
  background-repeat: repeat-x;
  background-position: center;
  background-size: 188px 39px;
}
.spoiler-header.is-locked .floor-label {
  opacity: 0.75;
}
.floor-lock {
  width: 15px;
  height: 18px;
  object-fit: contain;
  opacity: 0.85;
  flex-shrink: 0;
}

/* --- Заголовки секций списков этажей (как шапка «ВЫБОР ЭТАЖА») --- */
.floors-section-title {
  font-size: 12px;
  font-weight: 800;
  color: #e6d5b8;
  text-align: center;
  letter-spacing: 0.6px;
  margin: 12px 0 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid rgba(192, 138, 45, 0.35);
  font-family: "Courier New", Courier, monospace;
}
.floors-section-hint {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #b3a48c;
  letter-spacing: 0.2px;
  margin-top: 2px;
}

.spoiler-content {
  padding: 12px;
  display: none;
  border-top: 1px solid var(--border);
  background: rgba(236, 220, 184, 0.65);
}

.spoiler-content.open {
  display: block;
}

/* Элементы внутри этажа (чекбоксы) */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(246, 236, 210, 0.75);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.item-hp {
  font-size: 11px;
  color: var(--red);
  font-weight: 700;
}

/* Переключатели и чекбоксы */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Радио режимов */
.mode-card {
  background: url("/static/img/game/panel-paper.webp") center / cover no-repeat;
  border: 2px solid var(--border-dark);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  color: var(--text);
}

.mode-card.selected {
  border-color: var(--accent);
  background: rgba(139, 30, 30, 0.1);
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.mode-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-left: 28px;
}

/* Консоль терминала */
.terminal-box {
  background: #17120c;
  border: 1px solid #3a2f22;
  border-radius: 12px;
  padding: 12px;
  font-family: monospace;
  font-size: 11px;
  height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--text-on-dark);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
}

.log-line {
  margin-bottom: 3px;
  line-height: 1.4;
}

.log-success {
  color: #9ccb7f;
}

.log-warn {
  color: #d9a441;
}

.log-error {
  color: #d96a5b;
  font-weight: 700;
}

.log-info {
  color: #8fb8d9;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.action-btn {
  flex: 1;
  padding: 10px;
  background: var(--leather);
  border: 1px solid var(--border-dark);
  color: var(--text-on-dark);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.action-btn:hover {
  background: var(--leather-hover);
}

/* Экран входа */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 11, 0.95);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: url("/static/img/game/panel-paper.webp") center / cover no-repeat;
  border: 2px solid var(--border-dark);
  border-radius: 16px;
  padding: 20px 18px;
  max-width: 430px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.login-input {
  width: 100%;
  padding: 11px 12px;
  background: #f6ecd2;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  margin: 8px 0 10px 0;
  outline: none;
}

.login-input:focus {
  border-color: var(--accent);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(43, 33, 21, 0.15);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
}

.auth-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 8px 6px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.25;
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, rgba(139, 30, 30, 0.18) 0%, rgba(154, 108, 32, 0.14) 100%);
  border-color: rgba(139, 30, 30, 0.55);
  color: var(--accent);
}

.auth-pane {
  display: none;
  text-align: left;
}

.auth-pane.active {
  display: block;
}

.auth-callout {
  background: rgba(43, 33, 21, 0.12);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 12px;
}

.auth-callout.auth-callout-manual {
  border-left-color: var(--gold);
}

.auth-callout-title {
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  font-size: 11.5px;
}

.auth-feedback {
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  display: none;
}

.auth-feedback.error {
  display: block;
  background: rgba(139, 30, 30, 0.12);
  border: 1px solid rgba(139, 30, 30, 0.45);
  color: var(--red);
}

.auth-feedback.info {
  display: block;
  background: rgba(54, 95, 130, 0.12);
  border: 1px solid rgba(54, 95, 130, 0.45);
  color: var(--blue);
}

.auth-feedback.success {
  display: block;
  background: rgba(63, 111, 43, 0.12);
  border: 1px solid rgba(63, 111, 43, 0.45);
  color: var(--green);
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
  margin-top: 6px;
}

/* Smooth toast notifications replacing intrusive alert() */
.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}

.toast-msg {
  background: url("/static/img/game/card-paper.webp") center / cover no-repeat;
  border: 1px solid var(--border-dark);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease-out forwards;
  pointer-events: auto;
}

.toast-msg.toast-success {
  border-color: var(--green);
  background: rgba(214, 228, 196, 0.97);
  color: var(--green);
}

.toast-msg.toast-error {
  border-color: var(--red);
  background: rgba(240, 218, 210, 0.97);
  color: var(--red);
}

.toast-msg.toast-info {
  border-color: var(--gold);
  background: rgba(240, 229, 203, 0.97);
  color: var(--gold);
}

.toast-msg.toast-warning {
  border-color: var(--blue);
  background: rgba(214, 226, 236, 0.97);
  color: var(--blue);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Виджет сбора на аренду сервера (Twitch-стиль) --- */
.server-goal-pill {
  background: url("/static/img/game/panel-paper.webp") center / cover no-repeat;
  border: 2px solid rgba(154, 108, 32, 0.55);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  cursor: pointer;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.server-goal-pill:hover {
  border-color: rgba(192, 138, 45, 0.8);
  box-shadow: 0 6px 20px rgba(154, 108, 32, 0.25);
  transform: translateY(-1px);
}

.server-goal-pill:active {
  transform: scale(0.99);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  gap: 8px;
}

.goal-title-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.goal-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--green-bright);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--green-bright);
  animation: pulseGreen 1.8s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #568c3a; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.goal-countdown {
  color: var(--accent);
  font-family: monospace, monospace;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.goal-stats-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.goal-stars {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  font-family: monospace;
}

.goal-pct {
  background: rgba(154, 108, 32, 0.2);
  border: 1px solid rgba(154, 108, 32, 0.45);
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
}

.goal-progress-track {
  width: 100%;
  height: 12px;
  background: rgba(20, 16, 11, 0.75);
  border: 1px solid rgba(43, 33, 21, 0.4);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.goal-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9a6c20 0%, #3f6f2b 100%);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 0 10px rgba(63, 111, 43, 0.5);
  min-width: 0;
}

.goal-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmerMove 2.2s infinite;
}

@keyframes shimmerMove {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.goal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.goal-desc {
  color: var(--text-muted);
  font-weight: 500;
}

.goal-cta {
  color: var(--gold);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* Touch & Mobile Active Feedback */
button,
.action-btn,
.nav-btn,
.mode-card,
.spoiler-header,
.item-row,
.master-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.action-btn:active,
.nav-btn:active,
.master-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.item-row:active {
  background: rgba(43, 33, 21, 0.25);
}

/* Shared Section & Modal Layout Classes */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 5, 0.85);
  z-index: 9999;
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: url("/static/img/game/modal-clipboard.webp") center / cover no-repeat;
  border: 2px solid var(--border-dark);
  border-radius: 16px;
  padding: 26px 18px 18px;
  max-width: 400px;
  width: 100%;
  color: var(--text);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.8);
  margin: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(122, 101, 71, 0.6);
  padding-bottom: 10px;
}

.modal-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-callout {
  font-size: 11px;
  color: var(--text);
  line-height: 1.5;
  background: rgba(43, 33, 21, 0.12);
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 3px solid var(--gold);
  margin-bottom: 12px;
}

.donate-preset-btn {
  background: rgba(43, 33, 21, 0.15);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.donate-preset-btn.active {
  background: rgba(139, 30, 30, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Notification Drawer Filters, Settings & Feed Items */
.notif-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.notif-filter-tabs::-webkit-scrollbar {
  display: none;
}

.notif-filter-btn {
  background: #1e160c;
  border: 1px solid #4a3a26;
  color: #e6dac3;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.notif-filter-btn.active {
  background: rgba(74, 123, 171, 0.28);
  border-color: #6fa8dc;
  color: #ffffff;
}

.notif-settings-panel {
  background: #1b1712;
  border: 1px solid #4a3a26;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  color: #f3e9d2;
}

.notif-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: #f3e9d2;
  padding: 6px 0;
  cursor: pointer;
}

.notif-setting-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #c08a2d;
  cursor: pointer;
}

.notif-setting-row + .notif-setting-row {
  border-top: 1px solid rgba(192, 162, 112, 0.2);
}

.notif-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(246, 236, 210, 0.7);
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text);
}

.notif-row-unread {
  border-left: 3px solid var(--blue);
  background: rgba(240, 229, 203, 0.9);
}

.notif-row-cat-rare {
  border-color: rgba(154, 108, 32, 0.65);
}

.notif-row-cat-alert {
  border-color: rgba(139, 30, 30, 0.65);
}

/* Works Cycle Counter, Per-Floor Refresh & Targets */
.spoiler-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.floor-refresh-btn {
  background: rgba(54, 95, 130, 0.16);
  border: 1px solid rgba(84, 130, 168, 0.45);
  color: var(--blue);
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.floor-refresh-btn:hover {
  background: rgba(54, 95, 130, 0.3);
}

.floor-refresh-btn.is-locked {
  opacity: 0.4;
  background: rgba(43, 33, 21, 0.15);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.floor-refresh-btn.is-spinning {
  border-color: var(--gold);
  background: rgba(154, 108, 32, 0.22);
  color: var(--gold);
}

.works-scan-all-btn {
  background: linear-gradient(135deg, rgba(54, 95, 130, 0.22) 0%, rgba(63, 111, 43, 0.16) 100%);
  border-color: rgba(84, 130, 168, 0.5);
  color: var(--blue);
}

.works-scan-all-btn:hover {
  background: linear-gradient(135deg, rgba(54, 95, 130, 0.32) 0%, rgba(63, 111, 43, 0.24) 100%);
}

.works-scan-all-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.works-scan-banner {
  background: rgba(246, 236, 210, 0.75);
  border: 1px solid var(--blue);
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 10px;
  color: var(--text);
}

.works-scan-banner.is-queued {
  border-color: var(--gold);
}

.works-scan-banner.is-done {
  border-color: var(--green);
}

.works-scan-banner.is-error {
  border-color: var(--red);
}

.works-scan-banner-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.works-scan-banner-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.works-scan-step {
  font-family: monospace;
  font-size: 11px;
  color: var(--blue);
}

.works-scan-stop-btn {
  background: rgba(139, 30, 30, 0.16);
  border: 1px solid rgba(139, 30, 30, 0.5);
  color: var(--red);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.works-scan-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(20, 16, 11, 0.6);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.works-scan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #365f82 0%, #3f6f2b 100%);
  transition: width 0.3s ease;
}

.works-scan-action {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

.work-row-item {
  gap: 8px;
  align-items: center;
}

.work-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.work-cycle-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(54, 95, 130, 0.14);
  border: 1px solid rgba(54, 95, 130, 0.35);
  color: var(--blue);
}

.work-cycle-pill.work-cycle-locked {
  background: rgba(111, 95, 73, 0.12);
  border-color: rgba(111, 95, 73, 0.3);
  color: var(--text-muted);
}

.work-cycle-pill.work-cycle-done {
  background: rgba(63, 111, 43, 0.16);
  border-color: rgba(63, 111, 43, 0.45);
  color: var(--green);
}

.work-cycle-step-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}

.work-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.work-energy-badge {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}

.work-target-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.work-target-input {
  width: 52px;
  background: #f6ecd2;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  padding: 2px 4px;
  text-align: center;
  outline: none;
}

.work-target-input:focus {
  border-color: var(--accent);
}

.work-tgt-done {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--green);
}

.work-tgt-rem {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--gold);
}


/* ============================================================
   Тема «MADHOUSE» v10.1 — профиль игрока, чипы, иконки по смыслу
   + усиление контраста (читаемость текста/цифр)
   ============================================================ */

/* --- Контраст: плотный пергамент вместо полупрозрачного --- */
.item-row {
  background: #f5ead0;
}
.spoiler-content {
  background: #e7d6b3;
}
.notif-row {
  background: #f5ead0;
}
.notif-row-unread {
  background: #f8efdb;
}
.item-sub,
.mode-desc,
.spoiler-badge,
.work-target-wrap {
  color: #55452f;
}

/* --- Иконки вкладок --- */
.tab-ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -4px;
  margin-right: 5px;
  border-radius: 50%;
  background: rgba(43, 33, 21, 0.12);
  padding: 1px;
}

/* --- Иконки строк списков по смыслу (CSS-only, без JS) --- */
#tab-bosses .item-name::before,
#tab-businesses .item-name::before,
#tab-works .item-name::before,
#tab-friends .item-name::before,
#tab-pets .item-name::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background: center / contain no-repeat;
  vertical-align: -3px;
  margin-right: 6px;
  border-radius: 50%;
}
#tab-bosses .item-name::before { background-image: url("/static/img/game/icon-skull2.webp"); }
#tab-businesses .item-name::before { background-image: url("/static/img/game/icon-backpack.webp"); }
#tab-works .item-name::before { background-image: url("/static/img/game/icon-beetle.webp"); }
#tab-friends .item-name::before { background-image: url("/static/img/game/icon-medcross.webp"); }
#tab-pets .item-name::before { background-image: url("/static/img/game/icon-pet.webp"); }

/* --- Профиль игрока (карточка статуса) --- */
.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.profile-mid {
  flex: 1;
  min-width: 0;
}
.nickname-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: url("/static/img/game/name-banner.webp") center / 100% 100% no-repeat;
  padding: 4px 14px 6px 14px;
  margin-bottom: 6px;
  max-width: 100%;
}
.nickname-banner > span:first-child {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.lvl-badge {
  background: #241c12;
  color: #ffe9b0;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid #57432c;
  white-space: nowrap;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.bar-ico {
  font-size: 11px;
  flex-shrink: 0;
}
.game-bar {
  flex: 1;
  height: 13px;
  background: #171208;
  border: 1px solid #3a2f1d;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6);
}
.game-bar-fill {
  height: 100%;
  background: url("/static/img/game/bar-red.webp") left / auto 100% repeat-x;
  transition: width 0.6s ease;
}
.game-bar-energy {
  background: url("/static/img/game/bar-exp.webp") left / auto 100% repeat-x;
}
.bar-num {
  font-size: 10px;
  font-weight: 800;
  font-family: monospace;
  color: var(--text);
  min-width: 46px;
  text-align: right;
  flex-shrink: 0;
}

/* --- Чипы валют --- */
.chips-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: url("/static/img/game/chip-paper.webp") center / 100% 100% no-repeat;
  padding: 6px 7px;
  min-width: 0;
}
.chip-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.chip-body {
  min-width: 0;
}
.chip-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}
.chip-val {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  font-family: monospace;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .chips-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Боевые характеристики (тёмные кожаные чипы) --- */
.cstats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.cstat {
  background: #241c12;
  border: 1px solid #3a2f1d;
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
}
.cstat-label {
  font-size: 10px;
  font-weight: 700;
}
.cstat-ico {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: -3px;
  margin-right: 3px;
  border-radius: 50%;
  background: rgba(240, 228, 200, 0.85);
  padding: 1px;
}
.cstat-val {
  font-size: 12px;
  font-weight: 800;
  color: #f3e9d2;
  font-family: monospace;
  margin-top: 1px;
}

@media (max-width: 380px) {
  .nickname-banner > span:first-child {
    max-width: 110px;
  }
}


/* ============================================================
   Тема «MADHOUSE» v10.2 — фикс путей ассетов (/static/img/game/)
   + страховка читаемости: цвет-подложка под каждой текстурой
   ============================================================ */

/* Подложки под текстурами: текст читается даже если картинка не догрузилась */
.chip {
  background-color: #f5ead0;
}
.nickname-banner {
  background-color: #f0e2c4;
}
.game-bar-fill {
  background-color: #a83232;
}
.game-bar-energy {
  background-color: #6fa05a;
}

/* Цифры на тёмных треках барам — кремовые, не тёмные */
.bar-num {
  color: #f3e9d2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Логотип в шапке: ограничим, чтобы битая картинка не распирала вёрстку */
.madhouse-logo {
  max-width: 120px;
  object-fit: contain;
}


/* ============================================================
   Тема «MADHOUSE» v10.3 — добивка navy-остатков в вкладках,
   логотип на пергаментном чипе, аватар/иконки крупнее
   ============================================================ */

/* Логотип MADHOUSE: тёмно-красный шрифт не читается на камне ->
   лёгкий пергаментный чип позади */
.madhouse-logo {
  height: 30px;
  max-width: 130px;
  background: #f0e2c4 url("/static/img/game/chip-paper.webp") center / 100% 100% no-repeat;
  padding: 3px 10px;
  border-radius: 8px;
}

/* Иконки вкладок чуть крупнее */
.tab-ico {
  width: 20px;
  height: 20px;
  vertical-align: -5px;
}


/* ============================================================
   Тема «MADHOUSE» v10.4 — КОНТРАСТ-ФИНАЛИЗАТОР
   Правило: тёмное на светлом, светлое на тёмном. Тон-в-тон запрещён.
   Любой контейнер с тёмной инлайн-подложкой получает светлый текст.
   ============================================================ */

:root {
  --text: #1f1508;
  --text-muted: #57432c;
}

/* Приглушённые подписи на пергаменте — темнее */
.item-sub,
.mode-desc,
.spoiler-badge,
.work-target-wrap,
.chip-label,
.stat-label,
.goal-desc,
.goal-footer,
.works-scan-action,
.work-cycle-step-hint {
  color: #4a3520;
}
.spoiler-badge {
  background: rgba(43, 33, 21, 0.14);
}

/* Тёмные инлайн-панели -> светлый текст (для классных детей) */
[style*="#241c12"] .item-name,
[style*="#1e160c"] .item-name,
[style*="#1c150c"] .item-name,
[style*="#171008"] .item-name,
[style*="#141009"] .item-name,
[style*="#2c2214"] .item-name,
[style*="#2f2415"] .item-name,
[style*="#372b1a"] .item-name,
[style*="#3a2f1d"] .item-name,
[style*="#221a0f"] .item-name,
[style*="#251c10"] .item-name,
[style*="#1e1620"] .item-name,
[style*="#1d1626"] .item-name,
[style*="#342a1a"] .item-name,
[style*="#3c2f1c"] .item-name,
[style*="#1e1a12"] .item-name,
[style*="#171208"] .item-name,
[style*="#241c12"] .mode-title,
[style*="#1e160c"] .mode-title,
[style*="#1c150c"] .mode-title,
[style*="#171008"] .mode-title,
[style*="#141009"] .mode-title,
[style*="#2c2214"] .mode-title,
[style*="#2f2415"] .mode-title,
[style*="#372b1a"] .mode-title,
[style*="#3a2f1d"] .mode-title,
[style*="#221a0f"] .mode-title,
[style*="#251c10"] .mode-title,
[style*="#1e1620"] .mode-title,
[style*="#1d1626"] .mode-title,
[style*="#342a1a"] .mode-title,
[style*="#3c2f1c"] .mode-title,
[style*="#1e1a12"] .mode-title,
[style*="#171208"] .mode-title,
[style*="#241c12"] .item-sub,
[style*="#1e160c"] .item-sub,
[style*="#1c150c"] .item-sub,
[style*="#171008"] .item-sub,
[style*="#141009"] .item-sub,
[style*="#2c2214"] .item-sub,
[style*="#2f2415"] .item-sub,
[style*="#372b1a"] .item-sub,
[style*="#3a2f1d"] .item-sub,
[style*="#221a0f"] .item-sub,
[style*="#251c10"] .item-sub,
[style*="#1e1620"] .item-sub,
[style*="#1d1626"] .item-sub,
[style*="#342a1a"] .item-sub,
[style*="#3c2f1c"] .item-sub,
[style*="#1e1a12"] .item-sub,
[style*="#171208"] .item-sub,
[style*="#241c12"] .mode-desc,
[style*="#1e160c"] .mode-desc,
[style*="#1c150c"] .mode-desc,
[style*="#171008"] .mode-desc,
[style*="#141009"] .mode-desc,
[style*="#2c2214"] .mode-desc,
[style*="#2f2415"] .mode-desc,
[style*="#372b1a"] .mode-desc,
[style*="#3a2f1d"] .mode-desc,
[style*="#221a0f"] .mode-desc,
[style*="#251c10"] .mode-desc,
[style*="#1e1620"] .mode-desc,
[style*="#1d1626"] .mode-desc,
[style*="#342a1a"] .mode-desc,
[style*="#3c2f1c"] .mode-desc,
[style*="#1e1a12"] .mode-desc,
[style*="#171208"] .mode-desc {
  color: #f3e9d2;
}
/* Тот же тёмный контейнер: наследуемый текст (без своего цвета) — светлый */
[style*="background:#241c12"], [style*="background: #241c12"],
[style*="background:#1e160c"], [style*="background: #1e160c"],
[style*="background:#1c150c"], [style*="background: #1c150c"],
[style*="background:#171008"], [style*="background: #171008"],
[style*="background:#141009"], [style*="background: #141009"],
[style*="background:#2c2214"], [style*="background: #2c2214"],
[style*="background:#2f2415"], [style*="background: #2f2415"],
[style*="background:#372b1a"], [style*="background: #372b1a"],
[style*="background:#3a2f1d"], [style*="background: #3a2f1d"],
[style*="background:#221a0f"], [style*="background: #221a0f"],
[style*="background:#251c10"], [style*="background: #251c10"],
[style*="background:#1e1620"], [style*="background: #1e1620"],
[style*="background:#1d1626"], [style*="background: #1d1626"],
[style*="background:#342a1a"], [style*="background: #342a1a"],
[style*="background:#3c2f1c"], [style*="background: #3c2f1c"],
[style*="background:#1e1a12"], [style*="background: #1e1a12"],
[style*="background:#171208"], [style*="background: #171208"] {
  color: #f3e9d2;
}

/* --- Цели боёв и очередь рейдов (Boss Targets / Queue) --- */
.boss-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}

.boss-target-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(180deg, #fff6e0 0%, #ead6b0 100%);
  border: 1.5px solid #8a6b3e;
  border-bottom: 2.5px solid #59411e;
  border-radius: 7px;
  color: #3a2710;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.boss-target-btn:hover {
  background: linear-gradient(180deg, #fff9ea 0%, #f1dfb9 100%);
  border-color: #9a6c20;
  color: #1f1508;
}

.boss-target-btn:active {
  transform: translateY(1px);
  border-bottom-width: 1.5px;
}

.boss-target-btn.has-target {
  background: linear-gradient(180deg, #332717 0%, #20170c 100%);
  border-color: #d69f38;
  border-bottom: 2.5px solid #6b4c14;
  color: #f6d892;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 232, 180, 0.14);
}

.boss-queue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #241c12;
  border: 1px solid #4a3d2c;
  border-radius: 8px;
  padding: 8px 10px;
  color: #f3e9d2;
}

.boss-queue-card.is-head {
  border-color: #c08a2d;
  box-shadow: 0 0 0 1px rgba(192, 138, 45, 0.25);
}

.bt-queue-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.bt-icon-btn {
  background: #171008;
  border: 1px solid #4a3d2c;
  color: #e6d5b8;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.1;
}

.bt-icon-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.bt-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 5px;
}

.bt-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c08a2d 0%, #6fa05a 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.bt-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.bt-mode-tab {
  background: rgba(43, 33, 21, 0.14);
  border: 1px solid rgba(122, 101, 71, 0.5);
  color: #4a3520;
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.bt-mode-tab.active {
  background: #241c12;
  border-color: #c08a2d;
  color: #f3d28a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.bt-preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.bt-preset-btn {
  background: #241c12;
  border: 1px solid #4a3d2c;
  color: #e6d5b8;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.bt-preset-btn:hover {
  border-color: #c08a2d;
  color: #f3d28a;
}

.bt-drop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.bt-drop-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #241c12;
  border: 1px solid #4a3d2c;
  color: #f3e9d2;
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.bt-drop-chip.is-undropped {
  border-color: rgba(192, 138, 45, 0.6);
}

.bt-dark-row {
  background: #241c12 !important;
  border: 1px solid #4a3d2c;
  color: #f3e9d2 !important;
}

.bt-dark-row .item-name {
  color: #f3e9d2 !important;
}

.bt-dark-row .item-sub {
  color: #cbbba0 !important;
}

#tab-bosses .bt-dark-row .item-name::before {
  display: none;
}

.bt-empty-box {
  background: #241c12;
  border: 1px dashed #4a3d2c;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 11px;
  color: #cbbba0;
}

.bt-invite-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.bt-invite-tab {
  background: rgba(43, 33, 21, 0.14);
  border: 1px solid rgba(122, 101, 71, 0.5);
  color: #4a3520;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
}

.bt-invite-tab.active {
  background: #241c12;
  border-color: #c08a2d;
  color: #f3d28a;
}

.bt-invite-tab[data-bt-inv="solo"].active {
  background: #2a1919;
  border-color: #b45353;
  color: #f7c5c5;
}

.bt-invite-tab[data-bt-inv="send"].active {
  background: #1a2816;
  border-color: #5b9142;
  color: #bfe8ab;
}

.bt-inv-chip {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}

.bt-inv-chip.is-solo {
  background: rgba(180, 83, 83, 0.22);
  border: 1px solid rgba(180, 83, 83, 0.5);
  color: #f4b8b8;
}

.bt-inv-chip.is-send {
  background: rgba(91, 145, 66, 0.22);
  border: 1px solid rgba(91, 145, 66, 0.5);
  color: #bfe8ab;
}

#tab-bosses .spoiler-title {
  flex-wrap: wrap;
  gap: 6px;
}

.boss-summary-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(43, 33, 21, 0.14);
  color: #4a3520;
  border: 1px solid rgba(122, 101, 71, 0.35);
}

#tab-bosses .boss-cfg-row .item-name::before {
  display: none !important;
}

.boss-subcard {
  background: #241c12;
  border: 1px solid #4a3d2c;
  border-radius: 9px;
  padding: 9px 10px;
  color: #f3e9d2;
}

.boss-subcard-head {
  font-size: 11px;
  font-weight: 800;
  color: #f3d28a;
  margin-bottom: 6px;
}

.boss-seg-grid {
  display: grid;
  gap: 5px;
}

.boss-seg-2 {
  grid-template-columns: 1fr 1fr;
}

.boss-seg-3 {
  grid-template-columns: repeat(3, 1fr);
}

.boss-seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #171008;
  border: 1px solid #4a3d2c;
  border-radius: 7px;
  padding: 7px 5px;
  color: #cbbba0;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}

.boss-seg-btn small {
  font-size: 9px;
  font-weight: 600;
  color: #8d7b63;
}

.boss-seg-btn.active {
  background: #2e2214;
  border-color: #c08a2d;
  color: #f3d28a;
  box-shadow: 0 0 0 1px rgba(192, 138, 45, 0.25);
}

.boss-seg-btn.active small {
  color: #d6c29d;
}

.boss-seg-btn[data-boss-out-mode="solo"].active,
.boss-seg-btn[data-boss-in-mode="none"].active {
  background: #2a1919;
  border-color: #b45353;
  color: #f7c5c5;
}

.boss-seg-btn[data-boss-in-mode="vip"].active {
  background: #192431;
  border-color: #4a7bab;
  color: #b7d7f4;
}

.boss-pause-card.selected {
  border-color: #8d7b63;
  background: rgba(43, 33, 21, 0.16);
}

#btnToggleLootFilterPanel.has-active-filter {
  border-color: #c08a2d;
  color: #f3d28a;
  box-shadow: 0 0 0 1px rgba(192, 138, 45, 0.35);
}

/* ============================================================
   Компактная пилюля подписки в шапке + Live HUD боя с боссом
   ============================================================ */

.top-header-user-group {
  flex-wrap: wrap;
}

.sub-compact-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(20, 16, 11, 0.78);
  border: 1px solid rgba(192, 138, 45, 0.5);
  color: #e8c87a;
  font-size: 11.5px;
  font-weight: 800;
  font-family: monospace;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.sub-compact-pill:hover {
  transform: translateY(-1px);
}

.sub-compact-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c08a2d;
  flex-shrink: 0;
}

.sub-compact-pill.sub-state-active {
  background: rgba(63, 111, 43, 0.28);
  border-color: rgba(86, 140, 58, 0.7);
  color: #b4e49a;
}
.sub-compact-pill.sub-state-active .sub-compact-dot {
  background: #568c3a;
  box-shadow: 0 0 6px #568c3a;
}

.sub-compact-pill.sub-state-trial {
  background: rgba(154, 108, 32, 0.28);
  border-color: rgba(192, 138, 45, 0.7);
  color: #f3d28a;
}
.sub-compact-pill.sub-state-trial .sub-compact-dot {
  background: #c08a2d;
  box-shadow: 0 0 6px #c08a2d;
}

.sub-compact-pill.sub-state-trial-avail {
  background: rgba(54, 95, 130, 0.3);
  border-color: rgba(74, 123, 171, 0.7);
  color: #b7d7f4;
}
.sub-compact-pill.sub-state-trial-avail .sub-compact-dot {
  background: #4a7bab;
  box-shadow: 0 0 6px #4a7bab;
}

.sub-compact-pill.sub-state-expired {
  background: rgba(139, 30, 30, 0.32);
  border-color: rgba(180, 83, 83, 0.75);
  color: #f5b4b4;
}
.sub-compact-pill.sub-state-expired .sub-compact-dot {
  background: #b3453a;
  box-shadow: 0 0 6px #b3453a;
}

/* Двухколоночный Live HUD боя на главной карточке */
.battle-arena-hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 9px;
  background: rgba(36, 28, 18, 0.92);
  border: 1px solid #4a3d2c;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.06);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.battle-arena-hud.hud-live {
  border-color: rgba(192, 138, 45, 0.7);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 225, 165, 0.08);
}

.battle-arena-hud.hud-afk {
  border-color: rgba(180, 83, 83, 0.6);
}

.battle-arena-hud.hud-idle .hud-side-boss,
.battle-arena-hud.hud-recent .hud-side-boss {
  opacity: 0.82;
}

.hud-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  border-radius: 6px;
  transition: background 0.35s ease, box-shadow 0.35s ease;
}

.hud-side-player.hud-heal-flash {
  animation: hudHealPulse 2.1s ease-out;
}

@keyframes hudHealPulse {
  0% {
    background: rgba(86, 140, 58, 0.38);
    box-shadow: 0 0 0 1px rgba(86, 140, 58, 0.75);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

.hud-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.hud-side-title {
  font-size: 10px;
  font-weight: 800;
  color: #e6d5b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-boss-name {
  color: #f3d28a;
}

.hud-side-num {
  font-size: 9.5px;
  font-weight: 800;
  font-family: monospace;
  color: #f3e9d2;
  white-space: nowrap;
  flex-shrink: 0;
}

.hud-progress-track {
  flex: none;
  width: 100%;
  height: 10px;
  background: rgba(15, 11, 7, 0.88);
  border: 1px solid #3a2f1d;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.72);
}

.hud-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-progress-fill-player {
  background: linear-gradient(90deg, #278a6a 0%, #3eb98d 100%);
  box-shadow: 0 0 8px rgba(62, 185, 141, 0.42);
}

.hud-progress-fill-boss {
  background: linear-gradient(90deg, #9b2226 0%, #e04d3d 100%);
  box-shadow: 0 0 8px rgba(224, 77, 61, 0.42);
}

.hud-sub-meta {
  font-size: 9.5px;
  font-weight: 700;
  color: #b3a48c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.hud-sub-meta.is-heal {
  color: #8ee074;
}

.hud-sub-meta.is-afk {
  color: #f2a29b;
}

.hud-sub-meta.is-quota-done {
  color: #8ee074;
}

/* Нижняя строка статуса: РАБОТАЕТ + кнопка участников боя */
.status-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.status-meta-row .status-badge {
  margin-bottom: 0;
}

.bp-btn {
  background: linear-gradient(180deg, #322719 0%, #20180e 100%);
  color: #f3d28a;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 9px;
  border: 1.5px solid #9c7943;
  border-bottom: 3px solid #4f3a1c;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 240, 200, 0.16);
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.bp-btn:hover {
  border-color: #d9a74a;
  background: linear-gradient(180deg, #3c2f1f 0%, #281e12 100%);
}

.bp-btn:active {
  transform: translateY(1px);
  border-bottom-width: 1.5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.bp-btn.bp-btn-live {
  background: linear-gradient(180deg, #9e2626 0%, #6d1616 100%);
  border-color: #eab95c;
  border-bottom: 3px solid #6b4610;
  color: #fff6df;
  box-shadow: 0 2px 10px rgba(158, 38, 38, 0.45), inset 0 1px 0 rgba(255, 236, 190, 0.25);
}

.bp-btn.bp-btn-recent {
  background: linear-gradient(180deg, #382b1b 0%, #251c10 100%);
  border-color: #b98a3f;
  border-bottom: 3px solid #593e18;
  color: #f5e6c5;
}

/* Модалка участников боя */
.bp-modal-summary {
  background: #171008;
  border: 1px solid #3a2f1d;
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 10px;
  color: #f3e9d2;
}

.bp-participants-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

.bp-empty-state {
  text-align: center;
  color: #6f5f49;
  font-size: 12px;
  padding: 18px 8px;
}

.bp-part-row {
  background: #1a130b;
  border: 1px solid #3a2f1d;
  border-radius: 8px;
  padding: 7px 9px;
  color: #f3e9d2;
}

.bp-part-row.is-me {
  background: #1f2617;
  border-color: #568c3a;
}

.bp-part-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.bp-part-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
}

.bp-part-rank {
  font-family: monospace;
  font-size: 11px;
  color: #c08a2d;
  flex-shrink: 0;
}

.bp-part-nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-part-me-tag {
  background: rgba(86, 140, 58, 0.28);
  border: 1px solid rgba(86, 140, 58, 0.65);
  color: #b4e49a;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 5px;
  flex-shrink: 0;
}

.bp-part-lvl {
  font-size: 10px;
  color: #b3a48c;
  flex-shrink: 0;
}

.bp-part-dmg {
  font-family: monospace;
  font-size: 11.5px;
  font-weight: 800;
  color: #f3d28a;
  white-space: nowrap;
  flex-shrink: 0;
}

.bp-part-bar-track {
  height: 4px;
  background: #0d0905;
  border-radius: 3px;
  overflow: hidden;
}

.bp-part-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9a6c20 0%, #c08a2d 100%);
  border-radius: 3px;
}

.bp-part-row.is-me .bp-part-bar-fill {
  background: linear-gradient(90deg, #4c7a34 0%, #74b84f 100%);
}

@media (max-width: 420px) {
  .battle-arena-hud {
    gap: 8px;
    padding: 7px 7px;
  }
  .hud-side-num {
    font-size: 8.8px;
  }
  .sub-compact-pill {
    font-size: 10.5px;
    padding: 2px 7px;
  }
}



