:root {
  --primary: #6750A4;
  --primary-dark: #4F378B;
  --secondary: #625B71;
  --surface: #FFFBFE;
  --surface-variant: #E7E0EC;
  --on-surface: #1C1B1F;
  --error: #B3261E;
  --success: #2E7D32;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Roboto', sans-serif;
  background: #F5F0FA;
  color: var(--on-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.page-content {
  flex: 1 0 auto;
  padding-bottom: 40px;
}

.app-nav {
  background: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.app-nav .brand-logo { display:flex; align-items:center; gap:8px; font-weight:500; }
.app-nav ul a { color: #fff !important; }

.flash-box { margin-top: 20px; }

.material-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  padding: 28px;
  margin-bottom: 24px;
  transition: box-shadow .2s ease;
}
.material-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.btn, .btn-large, .btn-small {
  background-color: var(--primary) !important;
  border-radius: 24px !important;
  text-transform: none;
  font-weight: 500;
  box-shadow: none;
}
.btn:hover, .btn-large:hover { background-color: var(--primary-dark) !important; }

.btn-flat { border-radius: 24px !important; text-transform: none; }

.btn-outlined {
  background: transparent !important;
  border: 1.5px solid var(--primary);
  color: var(--primary) !important;
  border-radius: 24px !important;
  box-shadow: none;
  text-transform: none;
}

input[type=text], input[type=password], input[type=email], textarea.materialize-textarea {
  border-bottom: 1px solid var(--secondary) !important;
}
input[type=text]:focus:not([readonly]), input[type=password]:focus:not([readonly]) {
  border-bottom: 2px solid var(--primary) !important;
  box-shadow: 0 1px 0 0 var(--primary) !important;
}
label.active { color: var(--primary) !important; }

.hero {
  background: linear-gradient(135deg, var(--primary), #9A82DB);
  color: #fff;
  padding: 80px 0 60px;
  border-radius: 0 0 32px 32px;
  text-align: center;
  margin-bottom: 40px;
}
.hero h1 { font-weight: 700; }
.hero p { font-size: 1.1rem; opacity: .95; }

.center-form {
  max-width: 460px;
  margin: 40px auto;
}

.question-block {
  border: 1px solid var(--surface-variant);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  background: #FBF8FD;
  position: relative;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.option-row input[type=text] { flex: 1; }

.correct-toggle-row { margin: 10px 0; }

.correct-radio { display: flex; align-items: center; margin: 0; }
.correct-radio [type="radio"]:not(:checked) + span:not(.lever):before,
.correct-radio [type="radio"]:not(:checked) + span:not(.lever):after {
  border: 2px solid #9E9E9E;
}
.optionsWrap:not(.correct-mode-on) .correct-radio { opacity: .35; }
.correct-radio [type="radio"]:checked + span:not(.lever):after {
  border: 2px solid var(--success);
  background-color: var(--success);
}

.correct-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-weight: 500;
  font-size: .85rem;
  margin-left: 8px;
}
.option-correct-highlight {
  border-color: var(--success) !important;
  background: #EAF6EA;
}
.your-answer-wrong {
  border-color: var(--error) !important;
  background: #FBEAEA;
}

.thumb-preview {
  max-width: 160px;
  max-height: 160px;
  border-radius: 12px;
  margin-top: 8px;
  object-fit: cover;
}

.q-image-preview, .opt-image-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
  margin: 10px 0;
  display: block;
}

.progress-bar-wrap {
  background: var(--surface-variant);
  border-radius: 8px;
  height: 22px;
  overflow: hidden;
  margin: 6px 0;
  position: relative;
}
.progress-bar-fill {
  background: var(--primary);
  height: 100%;
  color: #fff;
  font-size: .8rem;
  display: flex;
  align-items: center;
  padding-left: 8px;
  white-space: nowrap;
  transition: width .4s ease;
}

.remove-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  color: var(--error);
}

footer.page-footer {
  background: var(--primary-dark) !important;
  padding-top: 20px;
}

.chip-code {
  background: var(--surface-variant);
  padding: 4px 12px;
  border-radius: 16px;
  font-family: monospace;
  word-break: break-all;
}

.radio-option {
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.radio-option:hover { background: #F5F0FA; }

.info-list.collection {
  border: none;
  margin-bottom: 20px;
}
.info-list .collection-item {
  border-bottom: 1px solid var(--surface-variant);
  border-left: none; border-right: none; border-top: none;
  padding: 14px 16px;
}
.info-list .collection-item:first-child { border-radius: 8px 8px 0 0; }
.info-list .collection-item:last-child { border-bottom: none; border-radius: 0 0 8px 8px; }

/* Пошаговый опрос */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0;
  gap: 12px;
}
.step-nav #stepProgress {
  font-weight: 500;
  order: -1;
  flex: 1;
  text-align: center;
}
@media (max-width: 600px) {
  .step-nav { flex-wrap: wrap; }
  .step-nav #stepProgress { order: 0; width: 100%; }
}

/* Идентичность гостя (аккаунт 0 уровня) */
.guest-identity-box {
  background: var(--surface-variant);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.guest-identity-box .change-name-link {
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
  font-size: .9rem;
}

/* Статус срока жизни опроса */
.lifespan-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: .82rem;
  font-weight: 500;
}
.lifespan-badge.ok { background: #E3F2E3; color: var(--success); }
.lifespan-badge.warn { background: #FFF3CD; color: #8A6D1F; }
.lifespan-badge.critical { background: #FBEAEA; color: var(--error); }
.lifespan-badge.protected { background: var(--surface-variant); color: var(--secondary); }

/* Рекламные слоты — пустая папка = блока просто нет на странице (никаких заглушек/рамок) */
.ad-slot {
  margin: 24px auto;
  text-align: center;
  max-width: 728px;
}
.ad-slot img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: inline-block;
}
