:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-soft: #f8f8f7;
  --text: #111111;
  --muted: #6a6a68;
  --line: #e3e3df;
  --accent: #2563eb;
  --accent-dark: #1747b8;
  --danger: #d92d20;
  --shadow: 0 24px 80px rgba(17, 17, 17, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(245, 245, 243, 0.9)),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  display: flex;
  flex-direction: column;
  width: min(100%, 64rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1rem;
  gap: 1rem;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.25rem 0;
}

.app-header h1,
.modal-panel h2,
.empty-state h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.chat_box {
  position: relative;
  flex: 1;
  min-height: 24rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.empty-state {
  margin: auto;
  max-width: 24rem;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  color: var(--text);
  font-size: 1.35rem;
}

.empty-state p {
  margin: 0.7rem 0 0;
  line-height: 1.6;
}

.chat_msg {
  display: inline-block;
  width: fit-content;
  max-width: min(78%, 34rem);
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.07);
}

.my_msg {
  align-self: flex-end;
  background: var(--text);
  color: var(--surface);
}

.partner_msg {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.system_msg {
  align-self: center;
  max-width: 90%;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(37, 99, 235, 0.2);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-dark);
  box-shadow: none;
  font-size: 0.85rem;
  text-align: center;
}

.error_msg {
  border-color: rgba(217, 45, 32, 0.28);
  background: rgba(217, 45, 32, 0.08);
  color: var(--danger);
}

.pending_msg {
  opacity: 0.62;
  font-style: italic;
}

.user-input {
  position: sticky;
  bottom: 0;
  padding: 0 0 0.35rem;
}

.chat-form-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 42px rgba(17, 17, 17, 0.08);
}

.input {
  min-height: 3rem;
  max-height: 9rem;
  resize: vertical;
  padding: 0.8rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
}

.input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn,
.sendBtn {
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.btn:hover,
.sendBtn:hover,
.avatar-option:hover {
  transform: translateY(-1px);
}

.btn:disabled,
.sendBtn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.sendBtn,
.primary-btn {
  background: var(--accent);
  color: #ffffff;
}

.sendBtn:hover,
.primary-btn:hover {
  background: var(--accent-dark);
}

.ghost-btn {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.ghost-btn:hover {
  border-color: #c9c9c5;
  background: var(--surface-soft);
}

.user-info,
.partner-info,
.findNewPartnerMask,
.confirm-leave {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(245, 245, 243, 0.82);
  backdrop-filter: blur(18px);
}

.modal-panel {
  width: min(100%, 34rem);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-panel {
  display: grid;
  gap: 1.25rem;
}

.modal-copy h2,
.compact-panel h2 {
  font-size: 1.45rem;
}

.form-error {
  min-height: 1.2rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.sex-wrap {
  display: grid;
  gap: 0.8rem;
}

.sex-wrap label,
.age label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.avatar-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.avatar-option {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  min-width: 0;
  padding: 0.8rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
}

.avatar-option.selected {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.avatar {
  display: block;
  width: min(6.5rem, 22vw);
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #ececea;
  box-shadow: 0 10px 26px rgba(17, 17, 17, 0.12);
}

.avatar img,
#sex-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sex {
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
}

.age form {
  display: grid;
  gap: 0.7rem;
}

select {
  width: 100%;
  min-height: 2.9rem;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
}

.partner-panel {
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

#sex-img {
  width: 8rem;
  height: 8rem;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 16px 48px rgba(17, 17, 17, 0.18);
}

#info-details {
  color: var(--muted);
  font-weight: 800;
}

.btns-containers {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
}

.compact-panel {
  display: grid;
  justify-items: start;
  gap: 1rem;
}

.confirm-leave {
  z-index: 30;
}

.confirm-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

@media screen and (max-width: 42rem) {
  .container {
    padding: 0.75rem;
  }

  .app-header {
    align-items: flex-start;
  }

  .header-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .status-pill {
    min-height: 2rem;
    font-size: 0.78rem;
  }

  .chat_box {
    min-height: 18rem;
    padding: 0.75rem;
  }

  .chat-form-container {
    grid-template-columns: 1fr;
  }

  .sendBtn {
    width: 100%;
  }

  .avatar-list {
    gap: 0.5rem;
  }

  .avatar-option {
    padding: 0.65rem 0.3rem;
  }

  .sex {
    font-size: 0.76rem;
  }

  .btns-containers {
    flex-direction: column;
  }

  .btns-containers .btn {
    width: 100%;
  }
}
