/* ==========================================================================
   Mattress Advisor 30s (Release 19 / Sprint 3.5)
   Distinct themes:
   - [data-quiz-site="topm"] -> Nordic Slate-Blue & Crisp White
   - [data-quiz-site="mspb"] -> St. Petersburg Warm-Cream & Emerald-Teal
   ========================================================================== */

/* Header Button Modernization (topm & mspb) */
.main-menu-item a.topm-quiz-header-btn,
.main-menu-item a.main-menu-link1.topm-quiz-header-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 13px !important;
  margin: 4px 0 4px 6px;
  border-radius: 18px;
  background: linear-gradient(135deg, #1a6aa8 0%, #114b7a 100%) !important;
  color: #ffffff !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
  text-transform: none !important;
  line-height: 1.25 !important;
  box-shadow: 0 2px 6px rgba(17, 75, 122, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none !important;
}
.main-menu-item a.topm-quiz-header-btn:hover,
.main-menu-item a.main-menu-link1.topm-quiz-header-btn:hover {
  background: linear-gradient(135deg, #217bc0 0%, #15598f 100%) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(17, 75, 122, 0.3);
}
.topm-quiz-header-btn__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 10.5px;
  font-weight: 600;
}

/* MSPB Header Rail & Mobile Strip Button */
.mspb-quiz-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 7px 14px;
  border-radius: 8px;
  background: #0d9488;
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
  white-space: nowrap;
  border: 1px solid #0f766e;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
  transition: background 0.15s ease, transform 0.15s ease;
}
.mspb-quiz-nav-btn:hover,
.mspb-quiz-nav-btn:focus {
  background: #0f766e;
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px);
}
.mspb-mob-quiz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 8px;
  background: #fdfaf2;
  border: 1px solid #0d9488;
  color: #0f766e !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  white-space: nowrap;
}
.topm-mobile-catalog-strip {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topm-mobile-catalog-strip .topm-mobile-catalog-strip__btn {
  flex: 1 1 auto;
}

/* ==========================================================================
   Quiz Container & Theme Variables
   ========================================================================== */
.tmq-wrap {
  --tmq-bg: #f6f9fc;
  --tmq-surface: #ffffff;
  --tmq-border: #dbe5f0;
  --tmq-accent: #1967a3;
  --tmq-accent-hover: #124f7e;
  --tmq-accent-soft: #e8f2fb;
  --tmq-accent-border: #8abbe0;
  --tmq-heading: #12324a;
  --tmq-text: #2c3e50;
  --tmq-muted: #5f7285;
  --tmq-badge-bg: #e1effb;
  --tmq-badge-txt: #145485;
  --tmq-radius: 14px;
  margin: 18px 0 22px;
  font-family: inherit;
  box-sizing: border-box;
}
.tmq-wrap[data-mattress-quiz="catalog"] {
  margin: 26px 0 24px;
}
.tmq-wrap[data-quiz-site="mspb"] {
  --tmq-bg: #fdfaf2;
  --tmq-surface: #ffffff;
  --tmq-border: #e3d8c1;
  --tmq-accent: #0d9488;
  --tmq-accent-hover: #0f766e;
  --tmq-accent-soft: #e6f7f5;
  --tmq-accent-border: #6cc5bc;
  --tmq-heading: #1e352f;
  --tmq-text: #2f3a36;
  --tmq-muted: #696356;
  --tmq-badge-bg: #dff4f1;
  --tmq-badge-txt: #0b645c;
  --tmq-radius: 12px;
}
.tmq-wrap *,
.tmq-modal-backdrop * {
  box-sizing: border-box;
}

.tmq-card {
  background: var(--tmq-bg);
  border: 1px solid var(--tmq-border);
  border-radius: var(--tmq-radius);
  padding: 20px 22px;
  box-shadow: 0 4px 18px rgba(18, 50, 74, 0.05);
}
.tmq-wrap[data-quiz-site="mspb"] .tmq-card {
  box-shadow: 0 4px 18px rgba(62, 50, 28, 0.06);
}

.tmq-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tmq-border);
}
.tmq-head__left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.tmq-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--tmq-badge-bg);
  color: var(--tmq-badge-txt);
  font-size: 12px;
  font-weight: 700;
}
.tmq-title {
  margin: 0 !important;
  font-size: 19px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  color: var(--tmq-heading) !important;
}
.tmq-sub {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--tmq-muted);
}
.tmq-custom-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tmq-accent) !important;
  text-decoration: none !important;
}
.tmq-custom-link:hover {
  text-decoration: underline !important;
}

/* Two-Column Interactive Body: Controls Left + Live Expert Recommendation Right */
.tmq-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.95fr);
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 991px) {
  .tmq-body {
    grid-template-columns: 1fr;
  }
}

.tmq-steps {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.tmq-step {
  background: var(--tmq-surface);
  border: 1px solid var(--tmq-border);
  border-radius: 10px;
  padding: 11px 13px;
}
.tmq-step__lbl {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--tmq-heading);
  margin-bottom: 8px;
}
.tmq-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tmq-accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  flex: 0 0 20px;
}
.tmq-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tmq-opt {
  appearance: none;
  border: 1px solid var(--tmq-border);
  background: #fff;
  color: var(--tmq-text);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
  text-align: left;
}
.tmq-opt:hover {
  border-color: var(--tmq-accent-border);
  background: var(--tmq-accent-soft);
}
.tmq-opt.is-active {
  background: var(--tmq-accent);
  border-color: var(--tmq-accent);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.tmq-opt--size {
  padding: 5px 9px;
  font-size: 12.5px;
}

/* Right Column: Live Showroom Result Panel */
.tmq-result {
  background: var(--tmq-surface);
  border: 2px solid var(--tmq-accent-border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.tmq-result__top {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.tmq-result__img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--tmq-border);
  flex: 0 0 72px;
  background: #f3f5f7;
}
.tmq-result__kicker {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tmq-accent);
  margin-bottom: 3px;
}
.tmq-result__name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--tmq-heading);
  margin: 0 0 5px;
}
.tmq-result__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.tmq-spec-chip {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--tmq-bg);
  border: 1px solid var(--tmq-border);
  color: var(--tmq-text);
  font-weight: 600;
}
.tmq-result__why {
  font-size: 13px;
  line-height: 1.5;
  color: var(--tmq-text);
  margin: 0;
}
.tmq-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--tmq-accent);
  color: #ffffff !important;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none !important;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.tmq-cta-btn:hover,
.tmq-cta-btn:focus {
  background: var(--tmq-accent-hover);
  color: #ffffff !important;
  transform: translateY(-1px);
}
.tmq-alts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--tmq-border);
}
.tmq-alts__lbl {
  font-size: 11.5px;
  color: var(--tmq-muted);
}
.tmq-alt-link {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--tmq-bg);
  border: 1px solid var(--tmq-border);
  color: var(--tmq-accent) !important;
  text-decoration: none !important;
  font-weight: 600;
}
.tmq-alt-link:hover {
  background: var(--tmq-accent-soft);
  border-color: var(--tmq-accent-border);
}

/* ==========================================================================
   Modal Overlay (opened from Header "Подобрать матрас" on any page)
   ========================================================================== */
.tmq-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(15, 28, 42, 0.62);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.tmq-modal-backdrop.is-open {
  display: flex;
}
.tmq-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border-radius: 16px;
}
.tmq-modal-dialog .tmq-wrap {
  margin: 0;
}
.tmq-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #cfdbe6;
  background: #ffffff;
  color: #243746;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tmq-modal-close:hover {
  background: #f0f4f8;
}

/* ==========================================================================
   /kakoy-matras/ Visual Layer & Spring Encyclopedia
   ========================================================================== */
.tmq-encyc {
  margin: 28px 0 34px;
}
.tmq-encyc__h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #163247;
}
.tmq-encyc__lead {
  font-size: 14.5px;
  color: #546675;
  margin: 0 0 18px;
}
.tmq-encyc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 16px;
}
.tmq-encyc-card {
  background: #ffffff;
  border: 1px solid #dde6ef;
  border-radius: 12px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tmq-encyc-card:hover {
  border-color: #8abbe0;
  box-shadow: 0 6px 18px rgba(18, 50, 74, 0.07);
}
.tmq-encyc-card__head {
  display: flex;
  gap: 12px;
  align-items: center;
}
.tmq-encyc-card__img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e3ebf3;
  flex: 0 0 64px;
}
.tmq-encyc-card__title {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 3px;
  color: #163247;
}
.tmq-encyc-card__tag {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eef5fb;
  color: #195d94;
  font-weight: 600;
}
.tmq-encyc-card__desc {
  font-size: 13px;
  line-height: 1.5;
  color: #374754;
  margin: 0;
}
.tmq-encyc-card__pros {
  margin: 0;
  padding-left: 17px;
  font-size: 12.5px;
  color: #2f4352;
  line-height: 1.45;
}
.tmq-encyc-card__link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #1967a3 !important;
  text-decoration: none !important;
}
.tmq-encyc-card__link:hover {
  text-decoration: underline !important;
}
.tmq-wrap[data-quiz-site="mspb"] ~ .tmq-encyc .tmq-encyc-card {
  border-color: #e3d8c1;
}
.tmq-wrap[data-quiz-site="mspb"] ~ .tmq-encyc .tmq-encyc-card__tag {
  background: #dff4f1;
  color: #0b645c;
}
.tmq-wrap[data-quiz-site="mspb"] ~ .tmq-encyc .tmq-encyc-card__link {
  color: #0d9488 !important;
}

@media (max-width: 640px) {
  .tmq-card {
    padding: 14px 13px;
  }
  .tmq-title {
    font-size: 16.5px !important;
  }
  .tmq-result__top {
    flex-direction: row;
  }
  .tmq-result__img {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }
}
