:root {

  --ground: #120f16;
  --card:   #1c1822;
  --hi:     #221d2b;
  --cream:  #F6EEF2;
  --muted:  #9C8FA3;
  --dim:    #6E6274;
  --rose:   #FF2E7E;
  --soft:   #FF7FA8;
  --deep:   #B21F57;
  --online: #4CE08A;
  --busy:   #FFC24C;
  --line:   rgba(246,238,242,0.08);
  --hot:    linear-gradient(135deg, #FF2E7E, #B21F57);

}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {

  margin: 0;
  background: #000;
  color: var(--cream);
  font: 400 15px/1.4 "Manrope", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  display: flex;
  align-items: center;
  justify-content: center;

}

.app {

  width: 100%;
  max-width: 430px;
  height: min( 100dvh, 880px );
  background: radial-gradient( 120% 60% at 50% -10%, rgba(255,46,126,0.10), transparent 55% ), var(--ground);
  display: flex;
  flex-direction: column;

}

.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.active { display: flex; }

.gradient {

  font-weight: 800;
  background: var(--hot);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

}

/* ---------- обрыв связи ---------- */

.offline {

  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 40px 34px;
  text-align: center;
  background: radial-gradient( 90% 50% at 50% 40%, rgba(255,46,126,0.07), transparent 60% ), #0b090e;

}

.offline.show { display: flex; }

.offline img { width: 168px; height: 168px; animation: rex 2.4s ease-in-out infinite; }

.offline h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

.offline p { font-size: 14.5px; line-height: 1.7; color: var(--muted); max-width: 320px; margin: 12px auto 0; }
.offline p b { color: var(--cream); }
.offline p i { color: var(--soft); font-style: normal; }

.dots { display: flex; gap: 7px; }

.dots i {

  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--deep);
  animation: pulse 1.3s infinite ease-in-out;

}

.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }

@keyframes rex   { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(-2deg); } }
@keyframes pulse { 0%, 70%, 100% { opacity: .25; transform: scale(.85); } 35% { opacity: 1; transform: scale(1); } }

/* ---------- авторизация ---------- */

.auth {

  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 30px 26px calc( 30px + env( safe-area-inset-bottom ) );

}

.auth .logo { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; text-align: center; }

.auth .sub { text-align: center; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }

.note { text-align: center; font-size: 12.5px; color: var(--busy); min-height: 17px; }

.field {

  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 15px;

}

.field.err { border-color: var(--deep); }

.field input, .field textarea {

  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--cream);
  font: inherit;

}

.field ::placeholder { color: var(--dim); }

.btn {

  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  background: var(--hot);
  color: #fff;
  cursor: pointer;

}

.btn:disabled { opacity: 0.45; cursor: default; }

.soc {

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 14px;
  padding: 13px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;

}

.soc.tg     { background: #26A5E4; color: #fff; }
.soc.google { background: #fff;    color: #1f1f1f; }
.soc.mail   { background: var(--card); color: var(--muted); border: 1px solid var(--line); font-weight: 600; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.link { text-align: center; font-size: 13px; color: var(--dim); padding: 4px; cursor: pointer; }

.resend { text-align: center; font-size: 12.5px; color: var(--dim); }
.resend.ready { color: var(--soft); font-weight: 600; cursor: pointer; }

/* ---------- шапки и списки ---------- */

.topbar {

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  padding: 12px 16px;
  background: var(--ground);
  flex: none;

}

.topbar h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }

.back {

  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;

}

.back svg { width: 18px; height: 18px; }

.scroll { flex: 1; min-height: 0; padding: 6px 8px 20px; overflow-y: auto; }
.scroll::-webkit-scrollbar { width: 0; }

.chat { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; cursor: pointer; }
.chat:active { background: var(--hi); }

.avatar {

  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--card) center/cover no-repeat;
  border: 1px solid var(--line);
  flex: none;

}

.chat .body {

  flex: 1;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;

}

.chat .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.chat .name { font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat .time { font-size: 12px; color: var(--dim); flex: none; }
.chat .last { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {

  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--rose);
  color: #1a0410;
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;

}

.hollow { padding: 60px 36px; text-align: center; }
.hollow b { font-size: 17px; font-weight: 800; }
.hollow p { font-size: 13.5px; color: var(--muted); line-height: 1.6; }

/* ---------- навигация ---------- */

.navbar {

  flex: none;
  display: none;
  background: #000;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 10px 10px calc( 12px + env( safe-area-inset-bottom ) );

}

.navbtn {

  flex: 1;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--dim);
  padding: 14px 4px;
  cursor: pointer;

}

.navbar.show { display: flex; }

.navbtn.active { color: var(--rose); font-weight: 700; }

/* ---------- каталог ---------- */

.grid { display: grid; grid-template-columns: repeat( 2, minmax( 0, 1fr ) ); gap: 14px; padding: 10px; }

.card {

  position: relative;
  height: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card) center/cover no-repeat;
  cursor: pointer;

}

.card div {

  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  background: linear-gradient( transparent, rgba(0,0,0,0.75) );

}

.card b { font-size: 15.5px; font-weight: 700; }
.card i { display: block; font-size: 11.5px; font-style: normal; color: rgba(246,238,242,0.72); margin-top: 2px; }

/* ---------- комната ---------- */

.roomtop { border-bottom: 1px solid var(--line); }
.roomtop .avatar { width: 40px; height: 40px; }
.roomtop .who { flex: 1; min-width: 0; cursor: pointer; }
.roomtop .name { font-size: 15.5px; font-weight: 700; }

.status { font-size: 12px; color: var(--dim); }
.status.online { color: var(--online); }
.status.typing { color: var(--soft); }

.messages {

  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;

}

.messages::-webkit-scrollbar { width: 0; }

.msg {

  max-width: 78%;
  margin: 3px 0;
  padding: 9px 13px 8px;
  border-radius: 17px;
  font-size: 14.5px;
  word-wrap: break-word;
  white-space: pre-wrap;

}

.msg.in  { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--hot); color: #fff; border-bottom-right-radius: 5px; }

.msg span { display: block; text-align: right; font-size: 10px; margin-top: 2px; color: rgba(255,255,255,0.5); }
.msg span.read { color: #fff; }

.tag {

  align-self: center;
  max-width: 92%;
  margin: 6px 0;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11.5px;
  text-align: center;

}

.tag.emotion { color: var(--soft); background: rgba(255,46,126,0.09); border: 1px solid rgba(255,46,126,0.22); }
.tag.stats   { color: var(--busy); background: rgba(255,194,76,0.08); border: 1px solid rgba(255,194,76,0.22); }

.typing {

  align-self: flex-start;
  display: none;
  align-items: center;
  gap: 4px;
  margin: 3px 0;
  padding: 11px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 17px;
  border-bottom-left-radius: 5px;

}

.typing.show { display: flex; }

.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bounce 1.1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.limitline { flex: none; display: none; padding: 0 14px 8px; font-size: 11.5px; color: var(--busy); }
.limitline.show { display: block; }

.limitblock {

  flex: none;
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px calc( 16px + env( safe-area-inset-bottom ) );
  background: #000;
  border-top: 1px solid rgba(255,255,255,0.06);

}

.limitblock.show { display: flex; }

.limitblock b { font-size: 14.5px; font-weight: 700; }
.limitblock i { display: block; font-size: 12.5px; font-style: normal; color: var(--muted); margin-top: 2px; }

.inputbar {

  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px calc( 10px + env( safe-area-inset-bottom ) );
  background: #000;
  border-top: 1px solid rgba(255,255,255,0.06);

}

.inputbar .field { flex: 1; min-width: 0; border-radius: 20px; padding: 9px 14px; }
.inputbar textarea { max-height: 96px; }

.sendbtn {

  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--hot);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;

}

.sendbtn svg { width: 17px; height: 17px; }

/* ---------- я и тарифы ---------- */

.page { padding: 10px 18px 30px; }

.me { display: flex; align-items: center; gap: 14px; }

.me .letter {

  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--soft);
  flex: none;

}

.me .email { font-size: 16px; font-weight: 700; min-width: 0; word-break: break-all; }

.plan {

  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  margin-top: 14px;

}

.plan.hot { background: linear-gradient( 160deg, rgba(255,46,126,0.10), var(--card) 60% ); border-color: rgba(255,46,126,0.35); }

.plan .row { display: flex; align-items: baseline; justify-content: space-between; }
.plan .name { font-size: 17px; font-weight: 700; }
.plan .price { font-size: 15px; font-weight: 800; }
.plan .price.muted { color: var(--muted); font-weight: 700; }
.plan p { font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.plan .btn { width: 100%; margin-top: 14px; padding: 13px; }

.label { margin-top: 24px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; color: var(--dim); }

.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--hot); }

.quota { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.row-link { margin-top: 4px; padding: 15px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row-link.danger { color: var(--deep); border-bottom: none; }

/* ---------- профиль ---------- */

.slider {

  position: relative;
  flex: none;
  aspect-ratio: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;

}

.slider::-webkit-scrollbar { display: none; }

.slider .shot { flex: 0 0 100%; scroll-snap-align: center; background: var(--card) center/cover no-repeat; }

.slider .dots { position: absolute; left: 0; right: 0; bottom: 12px; justify-content: center; }
.slider .dots i { background: rgba(255,255,255,0.35); animation: none; }
.slider .dots i.on { background: var(--rose); }

.profile h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.profile .age { font-size: 13.5px; color: var(--dim); margin-top: 2px; }

.profile .status {

  margin-top: 14px;
  display: inline-block;
  font-size: 13px;
  color: var(--soft);
  background: rgba(255,46,126,0.10);
  border: 1px solid rgba(255,46,126,0.25);
  padding: 6px 13px;
  border-radius: 20px;

}

.profile .about { margin-top: 8px; font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }
.profile .btn { margin-top: 26px; width: 100%; }
