/* ── Сброс и базовые стили ─────────────────────────────────── */

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

:root {
  --accent: #00AEEF;
  --secondary: #3D1F6E;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #5a5a7a;
  --border: #dde1ea;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --header-h: 64px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
}

/* ── Шапка ─────────────────────────────────────────────────── */

.site-header {
  background: #000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

/* ── Контейнер ─────────────────────────────────────────────── */

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Экраны ────────────────────────────────────────────────── */

.screen {
  display: none;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 1.5rem;
  color: var(--secondary);
  margin-bottom: 20px;
  line-height: 1.3;
}

h2 {
  font-size: 1.25rem;
  color: var(--secondary);
  margin-bottom: 20px;
}

/* ── Приветствие ───────────────────────────────────────────── */

.welcome-text p {
  margin-bottom: 14px;
  color: var(--text);
}

.privacy-note {
  background: #eef7fc;
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Кнопки ────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  min-height: 48px;
  width: 100%;
  margin-top: 20px;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #0099d4;
}

.btn-secondary {
  background: var(--surface);
  color: var(--secondary);
  border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--secondary);
}

.nav-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.nav-buttons .btn {
  flex: 1;
  margin-top: 0;
}

/* ── Выбор дома ────────────────────────────────────────────── */

.label-text {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.building-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.building-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}

.building-btn:hover {
  border-color: var(--accent);
}

.building-btn.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.2);
}

.building-btn .bld-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  display: block;
}

.building-btn .bld-address {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* ── Выпадающий список ─────────────────────────────────────── */

.select-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a5a7a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  margin-bottom: 8px;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.2);
}

/* ── Поле мнения ───────────────────────────────────────────── */

.opinion-prompt {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  border: 1px solid var(--border);
  color: var(--text);
}

.textarea-wrap {
  position: relative;
}

.opinion-textarea {
  width: 100%;
  min-height: 200px;
  max-height: 480px;
  padding: 16px;
  font-size: 1rem;
  line-height: 1.55;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  resize: none;
  overflow-y: auto;
  word-wrap: break-word;
  overflow-wrap: break-word;
  transition: border-color 0.15s;
}

.opinion-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.2);
}

.char-counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.error-text {
  color: #d32f2f;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* ── Экран «Спасибо» ───────────────────────────────────────── */

.thanks-block {
  text-align: center;
  padding: 40px 16px;
}

.check-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.thanks-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 12px;
}

.thanks-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* ── Утилиты ───────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Адаптив ───────────────────────────────────────────────── */

@media (min-width: 480px) {
  h1 { font-size: 1.75rem; }

  .building-buttons {
    flex-direction: row;
  }

  .building-btn {
    flex: 1;
  }

  .btn {
    width: auto;
    min-width: 200px;
  }

  #screen-welcome .btn-primary {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .container {
    padding: 32px 24px 64px;
  }
}
