/* styles/settings.css
 * Модалка настроек (⚙️). Вкладки, пейн, строки, свитчи.
 * Фикс. ширина и высота через .modal:has(.settings-tabs).
 */

.settings-group { margin-bottom: 6px; }
.settings-group-title {
  font-size: 11px; color: #888; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 4px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 8px 0;
  border-bottom: 1px dotted #333;
}
.settings-row.settings-off { opacity: 0.45; }
.settings-text { min-width: 0; }
.settings-name { font-size: 13px; color: #e0d0a8; }
.settings-hint { font-size: 11px; color: #8a8378; margin-top: 2px; max-width: 280px; }
.settings-select {
  flex: 0 0 auto;
  background: #1a1a1a; color: #f0e0b0;
  border: 1px solid #555; border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px; font-family: sans-serif;
}
.settings-select:disabled { opacity: 0.5; }
.settings-range { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.settings-range input[type="range"] { width: 110px; accent-color: #7a8a4a; }
.settings-value {
  font-family: ui-monospace, monospace; font-size: 12px; color: #f0e0b0;
  min-width: 38px; text-align: right;
}

/* Двухпозиционный выбор графики в стартовом меню. */
.graphics-quality-toggle {
  display: flex; align-items: center; gap: 10px;
  color: #c8c0b0; font-size: 12px; white-space: nowrap;
}
.graphics-quality-caption { color: #e0d0a8; font-size: 13px; }
.graphics-quality-control {
  position: relative; display: flex; align-items: center; gap: 7px;
  cursor: pointer;
}
.graphics-quality-control input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
}
.graphics-quality-track {
  position: relative; width: 38px; height: 20px; box-sizing: border-box;
  background: #2a2a2a; border: 1px solid #555; border-radius: 10px;
}
.graphics-quality-track::before {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #999;
  transition: transform 0.15s, background 0.15s;
}
.graphics-quality-control input:checked + .graphics-quality-track {
  background: #33452a; border-color: #7a9a5a;
}
.graphics-quality-control input:checked + .graphics-quality-track::before {
  transform: translateX(18px); background: #cfe8a0;
}
.graphics-quality-control input:focus-visible + .graphics-quality-track {
  outline: 2px solid #cfe8a0; outline-offset: 2px;
}
.graphics-quality-toggle[data-quality="primitive"] [data-quality-label="primitive"],
.graphics-quality-toggle[data-quality="normal"] [data-quality-label="normal"] {
  color: #f4f0e8;
}

/* ===== Свитч ===== */
.settings-switch { position: relative; flex: 0 0 auto; width: 42px; height: 22px; }
.settings-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.settings-switch span {
  position: absolute; inset: 0;
  background: #2a2a2a;
  border: 1px solid #555; border-radius: 11px;
  transition: background 0.15s, border-color 0.15s;
}
.settings-switch span::before {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #999;
  transition: transform 0.15s, background 0.15s;
}
.settings-switch input:checked + span { background: #33452a; border-color: #7a9a5a; }
.settings-switch input:checked + span::before {
  transform: translateX(20px); background: #cfe8a0;
}
.settings-switch input:disabled + span { opacity: 0.4; }

/* ===== Заметки и сброс ===== */
.settings-note { margin-top: 10px; font-size: 12px; }
.settings-note.ok { color: #9aba7a; }
.settings-note.bad { color: #d09a6a; }
.settings-actions { margin-top: 14px; text-align: right; }
.settings-reset {
  background: #2a2a2a; color: #ccc;
  border: 1px solid #555; border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px; font-family: sans-serif;
  cursor: pointer;
}
.settings-reset:hover { background: #383838; color: #fff; }

/* ===== Вкладки ===== */
.settings-tabs {
  display: flex; flex-wrap: wrap; gap: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px;
  flex: 0 0 auto;
}
.settings-tab {
  padding: 8px 16px;
  font: inherit; color: inherit;
  background: transparent; border: none;
  cursor: pointer; opacity: 0.6;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: opacity 0.12s, border-color 0.12s;
}
.settings-tab:hover { opacity: 0.9; }
.settings-tab.active { opacity: 1; border-bottom-color: #7fb069; }

/* ===== Пейн ===== */
.settings-pane {
  height: min(calc(var(--ui-vh, 100vh) * 0.55), 520px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

/* Modal-body с вкладками — flex-колонка фикс. высоты. */
.modal-body:has(> .settings-tabs) {
  display: flex;
  flex-direction: column;
  height: min(calc(var(--ui-vh, 100vh) * 0.65), 640px);
  max-height: none;
  overflow: hidden;
  padding: 0;
}
.modal-body:has(> .settings-tabs) > .settings-tabs {
  padding: 0 12px;
}
.modal-body:has(> .settings-tabs) > .settings-pane {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  padding: 0 12px 12px;
  box-sizing: border-box;
}

/* Фикс. ширина именно для окна настроек. */
.modal:has(.settings-tabs) {
  width: 560px;
  min-width: 0;
  max-width: min(560px, calc(var(--ui-vw, 100vw) - 48px));
  box-sizing: border-box;
  padding: 20px 24px;
}

/* ===== Стек: настройки + прикреплённое окно подсказок ===== */
.settings-stack {
  display: flex; flex-direction: column;
  width: min(560px, calc(var(--ui-vw, 100vw) - 48px));
  height: min(760px, calc(var(--ui-vh, 100vh) - 24px));
  max-height: calc(var(--ui-vh, 100vh) - 24px);
  min-height: 0;
  box-sizing: border-box;
}
.settings-stack > .modal:has(.settings-tabs) {
  flex: 1 1 auto;
  width: 100%; min-width: 0; max-width: 100%;
  max-height: none; min-height: 0;
  border-radius: 8px 8px 0 0;
  border-bottom: 0;
}
.settings-stack > .modal:has(.settings-tabs) .modal-body:has(> .settings-tabs) {
  flex: 1 1 auto;
  height: auto; max-height: none; min-height: 0;
}

.settings-tips-window {
  flex: 0 0 auto;
  padding: 8px 12px 10px;
  border: 2px solid #555; border-top: 0;
  border-radius: 0 0 8px 8px;
  background: rgba(16, 16, 20, 0.98);
  box-sizing: border-box;
}
.settings-tips-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.settings-tips-title {
  font-size: 11px; color: #a8b090; text-transform: uppercase;
  letter-spacing: 1px;
}
.settings-tips-controls { display: flex; align-items: center; gap: 4px; min-width: 0; }
.settings-tips-note {
  margin-right: 4px; font-size: 10px; color: #6f6a60; white-space: nowrap;
}
.settings-tip-arrow {
  width: 24px; height: 24px; padding: 0;
  border: 1px solid #555; border-radius: 4px;
  background: #242424; color: #ddd;
  font: 16px/1 sans-serif; cursor: pointer;
}
.settings-tip-arrow:hover:not(:disabled) { background: #383838; color: #fff; }
.settings-tip-arrow:disabled { opacity: 0.3; cursor: default; }
.settings-tip-counter {
  min-width: 38px; text-align: center;
  font: 11px ui-monospace, monospace; color: #a8b090;
}
.settings-tips-track {
  display: flex;
  margin: 0; padding: 0; list-style: none;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.settings-tips-track::-webkit-scrollbar { display: none; }
.settings-tip-slide {
  flex: 0 0 100%; min-width: 100%;
  box-sizing: border-box;
  display: flex; align-items: center;
  padding: 2px 4px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.settings-tip-text {
  margin: 0; font-size: 12px; line-height: 1.35; color: #cfc7b8;
}
.settings-tip-text::before {
  content: '•'; margin-right: 6px; color: #7fb069;
}