:root {
  color-scheme: light;
  --bg: #f7f4ea;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-alt: #e7efe7;
  --text: #18332d;
  --muted: #5f726d;
  --line: rgba(24, 51, 45, 0.12);
  --brand: #0f766e;
  --brand-deep: #125e59;
  --brand-soft: #d1f2ec;
  --accent: #f59e0b;
  --danger: #b91c1c;
  --shadow: 0 18px 38px rgba(19, 41, 37, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.18), transparent 30%),
    linear-gradient(180deg, #f4f7ec 0%, #edf6ef 48%, #e6f0ea 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
}

textarea {
  resize: none;
  min-height: 52px;
  max-height: 140px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 1rem;
}

.login-screen,
.chat-screen {
  max-width: 720px;
  margin: 0 auto;
}

.login-screen {
  min-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
  position: relative;
}

.login-card {
  width: 100%;
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.compact-login-card {
  max-width: 360px;
  padding: 1.25rem;
}

.welcome-home {
  width: 100%;
  display: grid;
  place-items: center;
}

.welcome-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 36px;
  box-shadow: var(--shadow);
  padding: 1.6rem;
  text-align: center;
}

.welcome-card h1 {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  line-height: 0.98;
}

.welcome-copy {
  margin: 1rem auto 0;
  max-width: 28rem;
  color: var(--muted);
  line-height: 1.7;
}

.prayer-panels {
  margin-top: 1.4rem;
  display: grid;
  gap: 0.85rem;
}

.prayer-panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 51, 45, 0.08);
  border-radius: 24px;
  padding: 1rem 1.05rem;
  text-align: left;
}

.panel-label {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-deep);
  font-weight: 700;
}

.panel-text {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.heart-login-button,
.submit-heart-button {
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.1) 48%),
    linear-gradient(180deg, #ba3f47 0%, #8e1f2f 100%);
  box-shadow:
    0 16px 30px rgba(142, 31, 47, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

.heart-login-button {
  width: 88px;
  height: 88px;
  margin-top: 1.5rem;
}

.submit-heart-button {
  width: 72px;
  height: 72px;
  margin: 0.2rem auto 0;
}

.heart-login-button svg,
.submit-heart-button svg {
  fill: #fff5f1;
  stroke: none;
}

.heart-login-button svg {
  width: 50px;
  height: 50px;
}

.submit-heart-button svg {
  width: 40px;
  height: 40px;
}

.heart-login-button .heart-detail,
.submit-heart-button .heart-detail {
  fill: none;
  stroke: #fff5f1;
  stroke-linecap: round;
  stroke-width: 4.4;
}

.heart-login-button .heart-flame,
.submit-heart-button .heart-flame {
  fill: #ffd9af;
  stroke: none;
}

.heart-login-button {
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.login-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 1rem;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 17, 0.32);
  backdrop-filter: blur(5px);
}

.login-sheet {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 28px;
  box-shadow: 0 24px 50px rgba(19, 41, 37, 0.2);
  padding: 2.8rem 1.1rem 1.1rem;
}

.drawer-close {
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(24, 51, 45, 0.08);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--brand-deep);
  font-weight: 700;
}

.login-card h1,
.chat-header h2,
.call-status-row h3 {
  margin: 0;
  line-height: 1.05;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-copy,
.login-note,
.presence-text,
.message-meta,
.default-users span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 0.9rem;
}

.login-form label,
.message-input {
  display: grid;
  gap: 0.45rem;
}

.default-users {
  margin-top: 1.4rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.default-users div {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 20px;
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.2rem;
}

.primary-button,
.ghost-button,
.danger-button {
  border-radius: 18px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand) 0%, #10998e 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.24);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid rgba(24, 51, 45, 0.08);
}

.danger-button {
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.chat-screen {
  min-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-header,
.composer,
.call-panel,
.message-list {
  background: var(--surface);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}

.chat-header {
  border-radius: 28px;
  padding: 1rem 1rem 0.95rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  position: sticky;
  top: 1rem;
  z-index: 10;
}

.header-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.presence-text:empty {
  display: none;
}

.login-sheet .login-form {
  gap: 0.8rem;
}

.login-sheet .primary-button {
  margin-top: 0.1rem;
}

.chat-main {
  display: grid;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.message-list {
  border-radius: 28px;
  padding: 1rem;
  overflow: auto;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.message {
  display: flex;
  width: 100%;
}

.message.mine {
  justify-content: flex-end;
}

.message-bubble {
  max-width: min(80%, 460px);
  background: var(--surface-strong);
  border-radius: 24px 24px 24px 10px;
  padding: 0.9rem 0.95rem 0.8rem;
  border: 1px solid rgba(24, 51, 45, 0.08);
}

.message.mine .message-bubble {
  background: linear-gradient(135deg, var(--brand-soft) 0%, #ffffff 100%);
  border-radius: 24px 24px 10px 24px;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-image {
  width: 100%;
  max-width: 280px;
  border-radius: 18px;
  display: block;
  object-fit: cover;
  margin-bottom: 0.7rem;
  background: rgba(24, 51, 45, 0.06);
}

.message-meta {
  margin-top: 0.55rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.message-status.delivered,
.message-status.read {
  color: var(--brand-deep);
}

.message-status.read {
  color: var(--accent);
}

.call-panel {
  border-radius: 28px;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.call-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.video-grid video {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #10211e;
  border-radius: 24px;
  object-fit: cover;
}

.composer {
  border-radius: 24px;
  padding: 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  position: sticky;
  bottom: calc(1rem + var(--safe-bottom));
}

.composer-tools {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.tool-button,
.emoji-button {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(24, 51, 45, 0.08);
  color: var(--text);
}

.tool-button {
  width: 42px;
  height: 42px;
  font-size: 1.35rem;
  line-height: 1;
}

.emoji-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.emoji-button {
  min-width: 42px;
  height: 42px;
  padding: 0 0.7rem;
  font-size: 1.1rem;
}

.incoming-call-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.incoming-call-dialog::backdrop {
  background: rgba(7, 19, 17, 0.4);
  backdrop-filter: blur(6px);
}

.dialog-card {
  width: min(92vw, 360px);
  border-radius: 28px;
  padding: 1.25rem;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(24, 51, 45, 0.92);
  color: #ffffff;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  z-index: 40;
  box-shadow: 0 14px 24px rgba(19, 41, 37, 0.24);
}

.error-text {
  margin-top: 0.8rem;
  color: var(--danger);
}

@media (max-width: 720px) {
  .app-shell {
    padding: 0.75rem;
  }

  .chat-header {
    top: 0.75rem;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1;
  }

  .default-users {
    grid-template-columns: 1fr;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .video-grid video {
    aspect-ratio: 4 / 3;
  }
}
