* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(10, 13, 20, 0.6);
}
::-webkit-scrollbar-thumb {
  background: #1f293d;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
::-webkit-scrollbar-thumb:hover {
  background: #2b3954;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #1f293d rgba(10, 13, 20, 0.6);
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #090b10;
  color: #e2e8f0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.bg-gradient {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
}

.bg-1 {
  width: 700px;
  height: 700px;
  top: -200px;
  left: -200px;
  background: radial-gradient(circle, #2563eb 0%, transparent 65%);
}

.bg-2 {
  width: 700px;
  height: 700px;
  bottom: -200px;
  right: -200px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 65%);
}

.app-layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes screenFadeIn {
  0% { opacity: 0; transform: scale(0.99) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.glass-panel {
  background: rgba(18, 23, 34, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  height: 100%;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .app-layout {
    height: 94vh;
    max-height: 900px;
  }
  .glass-panel {
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

.panel-header {
  text-align: center;
  margin-bottom: 10px;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.35);
  border-radius: 20px;
  color: #60a5fa;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  font-size: 11px;
  color: #34d399;
  font-weight: 600;
}

.pulse-green {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

h2 {
  font-size: 18px;
  font-weight: 700;
}

.subtitle {
  font-size: 11.5px;
  color: #7b889b;
  margin-top: 2px;
}

.mode-tabs {
  display: inline-flex;
  background: #11151f;
  border: 1px solid #1f2738;
  border-radius: 10px;
  padding: 3px;
  margin-top: 8px;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #8b99ad;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-areas: 
    "mysex   age"
    "wishsex age"
    "geo     age"
    "mindset age"
    "goal    age"
    "checks  age";
  gap: 10px 20px;
  flex: 1;
  overflow-y: auto;
  align-content: start;
  padding: 4px 2px;
}

.area-my-sex   { grid-area: mysex; }
.area-wish-sex { grid-area: wishsex; }
.area-geo      { grid-area: geo; }
.area-mindset  { grid-area: mindset; }
.area-goal     { grid-area: goal; }
.area-checks   { grid-area: checks; }
.area-age      { grid-area: age; }

.setup-grid.mode-quick .detailed-only {
  display: none !important;
}

.setup-grid.mode-quick {
  grid-template-areas:
    "mysex   age"
    "wishsex age";
  align-content: center;
}

.field-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: #8b99ad;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sub-label {
  text-transform: none;
  font-size: 10.5px;
  color: #556275;
}

.btn-row {
  display: flex;
  gap: 6px;
}

.btn-row.four-btns {
  gap: 4px;
}

.geo-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.region-box {
  width: 100%;
}

.glass-select {
  width: 100%;
  background: #141923;
  border: 1px solid #232b3b;
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.glass-select option {
  background: #10141e;
  color: #f1f5f9;
}

.glass-btn {
  background: #141923;
  border: 1px solid #232b3b;
  color: #9cb0c9;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-row .glass-btn {
  flex: 1;
}

.btn-row.four-btns .glass-btn {
  padding: 7px 4px;
  font-size: 11px;
}

.glass-btn.active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}

.glass-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.age-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.age-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.age-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.age-list .age-btn {
  width: 100%;
  padding: 7px 4px;
  font-size: 11.5px;
}

.inset-box {
  background: #10141e;
  border: 1px solid #1c2331;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.children-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #1b212f;
  padding-top: 6px;
}

.custom-cb {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.custom-cb input {
  display: none;
}

.cb-box {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid #2d3748;
  background: #161c28;
  position: relative;
  flex-shrink: 0;
}

.custom-cb input:checked ~ .cb-box {
  background: #2563eb;
  border-color: #3b82f6;
}

.custom-cb input:checked ~ .cb-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 3px;
  height: 6px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cb-text {
  font-size: 12px;
  color: #cbd5e1;
}

.panel-footer {
  margin-top: 10px;
}

.submit-btn {
  width: 100%;
  padding: 11px;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Радар поиска */
#screen-search {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radar-scan-box {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.radar-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.circle-1 {
  width: 70px;
  height: 70px;
  animation: radarWave 2.4s ease-out infinite;
}

.circle-2 {
  width: 120px;
  height: 120px;
  animation: radarWave 2.4s ease-out 1.2s infinite;
}

@keyframes radarWave {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.3); opacity: 0; }
}

.radar-sweep {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(37, 99, 235, 0.45) 0deg, transparent 90deg);
  animation: radarSpin 2s linear infinite;
}

@keyframes radarSpin {
  100% { transform: rotate(360deg); }
}

.radar-center-icon {
  position: relative;
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #161f33;
  border: 1.5px solid #3b82f6;
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cancel-btn {
  margin-top: 18px;
  padding: 8px 18px;
}

/* ========================================================
   ИСПРАВЛЕННАЯ КОМПАКТНАЯ ШАПКА ЧАТА (НЕ ЛОМАЕТСЯ)
   ======================================================== */
.chat-screen {
  padding: 0;
  overflow: hidden;
  position: relative;
  border-radius: 0;
}

.chat-bar {
  padding: 10px 12px;
  background: #11151f;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.glass-btn.sm {
  padding: 6px 9px;
  font-size: 11.5px;
  border-radius: 7px;
}

.glass-btn.icon-only {
  padding: 6px 8px;
}

.contact-btn {
  border-color: #3b82f6;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.12);
}

.contact-btn.shared {
  background: rgba(37, 99, 235, 0.25);
  border-color: #60a5fa;
  color: #bfdbfe;
}

.report-btn {
  color: #94a3b8;
}

.report-btn:hover {
  border-color: #ef4444;
  color: #f87171;
}

.warn-btn:hover:not(:disabled) {
  border-color: #f59e0b;
  color: #fbbf24;
}

.stop-btn:hover {
  border-color: #ef4444;
  color: #f87171;
}

.chat-feed {
  flex: 1;
  padding: 14px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.bubble-row.me {
  align-self: flex-end;
  align-items: flex-end;
}

.bubble-row.me .bubble-text {
  background: #2563eb;
  color: white;
  border-radius: 12px 12px 3px 12px;
}

.bubble-row.partner {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble-row.partner .bubble-text {
  background: #19202e;
  border: 1px solid #252f44;
  color: #e2e8f0;
  border-radius: 12px 12px 12px 3px;
}

.bubble-row.system {
  align-self: center;
  font-size: 11.5px;
  color: #8b99ad;
  text-align: center;
  max-width: 92%;
  line-height: 1.4;
  margin: 4px 0;
}

.bubble-row.system.highlight {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  padding: 8px 14px;
  border-radius: 10px;
  color: #93c5fd;
}

.sys-icon {
  display: inline-flex;
  vertical-align: -2px;
  margin-right: 4px;
}

.revealed-box {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.sys-icon-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
}

.contact-link {
  color: #60a5fa;
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

.bubble-text {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.38;
  word-break: break-word;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0 4px;
}

.time-stamp {
  font-size: 10px;
  color: #556275;
}

.check-status {
  font-size: 11px;
  letter-spacing: -1.5px;
  font-weight: 700;
}

.check-status.status-sent {
  color: #94a3b8;
}

.check-status.status-read {
  color: #10b981;
}

.bubble-row.me.pending {
  opacity: 0.65;
}

.bubble-row.me.failed .bubble-text {
  background: #7f1d1d !important;
  border: 1px solid #ef4444 !important;
  color: #fecaca;
}

.failed-note {
  font-size: 10px;
  color: #f87171;
}

.typing-notice {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  font-size: 11px;
  color: #7b889b;
}

.dots-anim {
  display: flex;
  gap: 3px;
}

.dots-anim span {
  width: 4px;
  height: 4px;
  background: #3b82f6;
  border-radius: 50%;
  opacity: 0.6;
}

.chat-input-bar {
  padding: 10px 12px;
  background: #11151f;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-bar input {
  flex: 1;
  background: #0a0d14;
  border: 1px solid #232b3b;
  border-radius: 8px;
  padding: 9px 12px;
  color: white;
  outline: none;
  font-size: 13px;
}

.chat-input-bar input:focus {
  border-color: #3b82f6;
}

.send-action {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #2563eb;
  border: 1px solid #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Модалки */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 11, 16, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.modal-backdrop.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #131826;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: modalScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScaleUp {
  0% { transform: scale(0.93); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

.modal-icon.warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.modal-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 12px;
  color: #8b99ad;
  line-height: 1.4;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-btn {
  padding: 10px;
  font-size: 13px;
}

.report-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-opt-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  padding: 9px 12px;
  font-size: 12px;
  border-color: #26334a;
}

.report-opt-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #fca5a5;
}

.glass-input {
  width: 100%;
  background: #0a0d14;
  border: 1px solid #232b3b;
  border-radius: 8px;
  padding: 9px 12px;
  color: white;
  outline: none;
  font-size: 13px;
}

.glass-input:focus {
  border-color: #3b82f6;
}

.toast-alert {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(220, 38, 38, 0.95);
  border: 1px solid rgba(254, 202, 202, 0.35);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s;
}

.toast-alert.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================================
   ОПТИМИЗАЦИЯ ДЛЯ УЗКИХ ЭКРАНОВ ТЕЛЕФОНА (<= 480px)
   ======================================================== */
@media (max-width: 480px) {
  .chat-bar {
    padding: 8px 10px;
  }
  
  .btn-text-hide {
    display: none; /* Скрывает надпись «Контакт», оставляя иконку с плюсиком */
  }

  .glass-btn.sm {
    padding: 6px 8px;
  }

  .user-title {
    max-width: 120px;
  }

  .setup-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .btn-row.four-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }
}