@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap");

:root {
  --app-vh: 1vh;
  --bg: #f3f3f2;
  --panel: #ffffff;
  --ink: #202020;
  --ink-soft: #525252;
  --line: #e8e8e8;
  --btn: #242424;
  --btn-hover: #353535;
  --self: #2a2a2a;
  --other: #f2f2f2;
  --danger: #9a2f2f;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: calc(var(--app-vh) * 100);
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, #ffffff 0%, #f4f4f3 55%, #ebebea 100%);
  overflow: hidden;
  overscroll-behavior: none;
}

.bg-shape {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.55;
}

.shape-a {
  width: 280px;
  height: 280px;
  background: #dfdfdd;
  top: -90px;
  left: -60px;
}

.shape-b {
  width: 320px;
  height: 320px;
  background: #e9e9e7;
  right: -90px;
  bottom: -120px;
}

.chat-app {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 28px));
  height: min(86vh, 820px);
  margin: 7vh auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.09);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  animation: rise 0.55s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-wrap h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 800;
  text-transform: lowercase;
}

.brand-wrap p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#notif-btn {
  min-width: 130px;
}

.message-list {
  padding: 14px 14px 6px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.message {
  max-width: 76%;
  padding: 9px 12px;
  border-radius: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.message .meta {
  font-size: 11px;
  margin-bottom: 3px;
  opacity: 0.68;
  font-weight: 700;
}

.message.self {
  align-self: flex-end;
  background: var(--self);
  color: #f9f9f9;
  border-bottom-right-radius: 6px;
}

.message.other {
  align-self: flex-start;
  background: var(--other);
  color: var(--ink);
  border: 1px solid #e2e2e2;
  border-bottom-left-radius: 6px;
}

.composer {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-top: 1px solid var(--line);
}

input,
button {
  font: inherit;
}

input {
  border: 1px solid #dbdbdb;
  background: #fbfbfb;
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 14px;
}

input:focus {
  outline: 2px solid #bdbdbd;
  outline-offset: 1px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--btn);
  color: #f4f4f4;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--btn-hover);
}

button.ghost {
  background: #eeeeee;
  color: var(--ink);
  border: 1px solid #e0e0e0;
}

button.ghost:hover {
  background: #e5e5e5;
}

.error {
  min-height: 20px;
  color: var(--danger);
  margin: 0;
  padding: 0 16px 12px;
  font-size: 13px;
}

.name-gate {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  background: rgba(242, 242, 241, 0.72);
}

.name-gate.hidden {
  display: none;
}

.hidden {
  display: none;
}

.name-card {
  width: min(440px, calc(100vw - 30px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.11);
  animation: rise 0.4s ease;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-weight: 700;
}

.name-card h2 {
  margin: 8px 0 4px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.caption {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

.name-card input {
  width: 100%;
  margin-bottom: 10px;
}

.name-card button {
  width: 100%;
}

.placeholder {
  margin: 10px auto;
  color: var(--ink-soft);
  font-size: 14px;
}

.logout-modal {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(32, 32, 32, 0.28);
  backdrop-filter: blur(3px);
}

.logout-modal.hidden {
  display: none;
}

.logout-card {
  width: min(420px, calc(100vw - 28px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.16);
}

.logout-card h3 {
  margin: 8px 0 6px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.logout-text {
  margin: 0 0 14px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.logout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

@media (max-width: 700px) {
  body {
    overflow: hidden;
  }

  .chat-app {
    height: calc(var(--app-vh) * 100);
    margin: 0;
    border-radius: 0;
    width: 100vw;
  }

  .composer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .message {
    max-width: 88%;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  #notif-btn {
    min-width: auto;
  }
}
