:root {
  --ink: #1f1a10;
  --muted: #7b735f;
  --line: #eadfbd;
  --paper: #fffdf8;
  --panel: #ffffff;
  --gold: #d6a832;
  --gold-dark: #8d6418;
  --gold-soft: #fff3c6;
  --danger: #b43e48;
  --success: #2f7c55;
  --shadow: 0 22px 50px rgba(65, 45, 12, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: #f8f4e8;
}

body {
  margin: 0;
  min-height: 100svh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 244, 203, 0.9), transparent 34rem),
    linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

body.locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  width: 100%;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--paper);
  box-shadow: 0 0 80px rgba(49, 39, 16, 0.16);
  overflow: hidden;
}

body.locked .app-shell {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 243, 198, 0.94), transparent 32rem),
    rgba(255, 253, 248, 0.94);
  overflow: auto;
}

body.locked .auth-gate {
  display: grid;
}

.auth-card {
  width: min(100%, 430px);
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.auth-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.api-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffdf8;
}

.api-settings summary {
  color: var(--gold-dark);
  cursor: pointer;
  font-weight: 850;
}

.api-settings input {
  margin-top: 9px;
}

.api-settings button {
  width: 100%;
  margin-top: 9px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(234, 223, 189, 0.72);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.halo-logo {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 8px 14px rgba(141, 100, 24, 0.2));
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 1.28rem;
  letter-spacing: 0;
}

.brand-lockup span,
.eyebrow,
small {
  color: var(--muted);
}

main {
  padding: 14px 16px calc(112px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 14ch;
  font-size: 1.72rem;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  font-size: 1.42rem;
  line-height: 1.1;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-row,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}

.discover-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-user-photo {
  width: 52px;
  height: 52px;
  border: 3px solid var(--gold-soft);
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
}

.swipe-counter {
  min-width: 84px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.swipe-counter span,
.swipe-counter small {
  display: block;
}

.swipe-counter span {
  color: var(--gold-dark);
  font-size: 1.36rem;
  font-weight: 900;
}

.location-strip {
  margin: -4px 0 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--gold-dark);
  background: #fffaf0;
  font-size: 0.86rem;
  font-weight: 800;
}

.profile-card,
.chat-panel,
.info-panel,
.date-planner,
.profile-form,
.settings-list,
.account-panel,
.modal form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-card {
  overflow: hidden;
  touch-action: pan-y;
  transition: transform 180ms ease, opacity 180ms ease;
  user-select: none;
}

.profile-card.dragging {
  transition: none;
}

.profile-card.swipe-like {
  transform: translateX(120%) rotate(13deg);
  opacity: 0;
}

.profile-card.swipe-pass {
  transform: translateX(-120%) rotate(-13deg);
  opacity: 0;
}

.photo-stage {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--gold-soft);
  overflow: hidden;
}

.photo-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 46px;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 26, 16, 0.42);
  backdrop-filter: blur(8px);
}

.photo-nav.prev {
  left: 10px;
}

.photo-nav.next {
  right: 10px;
}

.photo-nav svg {
  width: 22px;
  height: 22px;
}

.photo-stage img {
  height: 100%;
  object-fit: cover;
}

.photo-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(20, 14, 4, 0.68));
  pointer-events: none;
}

.photo-dots {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  display: grid;
  grid-auto-flow: column;
  gap: 5px;
}

.photo-dots span {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
}

.photo-dots .active {
  background: #fff;
}

.safety-chip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(31, 26, 16, 0.62);
  font-size: 0.76rem;
  font-weight: 800;
}

.profile-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.profile-title {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.profile-title p,
.bio {
  color: var(--muted);
}

.verse {
  padding: 12px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff9e7;
  color: #564016;
  font-weight: 700;
}

.church-strip {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
}

.church-strip strong {
  color: var(--ink);
}

.safety-actions,
.account-actions,
.legal-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 18px 0 2px;
}

.round-action,
.icon-button,
.nav-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.round-action {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.round-action svg {
  width: 34px;
  height: 34px;
}

.round-action.like {
  color: var(--success);
  border-color: rgba(47, 124, 85, 0.28);
}

.round-action.dislike {
  color: var(--danger);
  border-color: rgba(180, 62, 72, 0.28);
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.icon-button.small {
  width: 36px;
  height: 36px;
}

.icon-button.send {
  flex: 0 0 46px;
  height: 46px;
  color: #fff;
  border-color: var(--gold);
  background: var(--gold);
}

.icon-button svg,
.nav-button svg {
  width: 22px;
  height: 22px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(calc(100% - 28px), 430px);
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(234, 223, 189, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 42px rgba(65, 45, 12, 0.16);
  backdrop-filter: blur(18px);
}

.nav-button {
  min-height: 48px;
  border-radius: 8px;
}

.nav-button.active {
  color: #fff;
  border-color: var(--gold);
  background: linear-gradient(180deg, #e2b941, #a97a1f);
}

.text-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 850;
}

.text-button {
  border: 1px solid var(--line);
  color: var(--gold-dark);
  background: #fff;
}

.primary-button,
.secondary-button {
  border: 1px solid transparent;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #dcb242, #9b711e);
}

.secondary-button {
  color: var(--gold-dark);
  border-color: var(--line);
  background: #fff;
}

.danger-text {
  color: var(--danger);
}

.match-list,
.date-list,
.settings-grid {
  display: grid;
  gap: 12px;
}

.match-item,
.date-item,
.plan-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.match-item {
  grid-template-columns: 58px 1fr auto;
  align-items: center;
}

.match-actions {
  display: flex;
  gap: 8px;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold-soft);
}

.match-item p,
.date-item p,
.plan-card p,
.info-panel p,
.chat-panel span,
.guard-note {
  color: var(--muted);
}

.chat-panel {
  position: fixed;
  left: 50%;
  bottom: 80px;
  z-index: 10;
  width: min(calc(100% - 28px), 430px);
  max-height: min(72vh, 620px);
  transform: translateX(-50%);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}

.chat-panel[hidden] {
  display: none;
}

.chat-panel header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.chat-panel strong,
.chat-panel span {
  display: block;
}

.messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 180px;
  overflow: auto;
  padding: 14px;
  background: #fffaf0;
}

.bubble {
  width: fit-content;
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.bubble.me {
  justify-self: end;
  color: #fff;
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}

.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.guard-note {
  min-height: 30px;
  padding: 0 14px 12px;
  font-size: 0.86rem;
}

label {
  display: grid;
  gap: 6px;
  color: #5f563f;
  font-size: 0.9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.date-planner,
.profile-form,
.account-panel,
.church-finder,
.settings-list {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.info-panel {
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 14px;
}

.church-finder {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.church-results {
  display: grid;
  gap: 8px;
}

.church-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.church-result strong,
.church-result span {
  display: block;
}

.church-result.affiliated {
  border-color: var(--gold);
  background: #fff7df;
}

.affiliate-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: var(--gold-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.church-result span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.full {
  grid-column: 1 / -1;
}

.range-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkbox-row,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input,
.toggle-row input {
  width: auto;
  accent-color: var(--gold);
}

.photo-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-slot {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  overflow: hidden;
  color: var(--muted);
  background: #fffaf0;
  font-size: 0.8rem;
  text-align: center;
}

.photo-slot img {
  height: 100%;
  object-fit: cover;
}

.plan-card.featured {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fffdf8, #fff3c6);
}

.plan-card span {
  color: var(--gold-dark);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.plan-card strong {
  font-size: 1.55rem;
}

.settings-list {
  margin-top: 12px;
}

.account-panel {
  margin-top: 12px;
}

.auth-form {
  display: grid;
  gap: 9px;
}

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

.toggle-row {
  justify-content: space-between;
  padding: 4px 0;
  color: var(--ink);
}

.legal-links {
  margin-top: 12px;
}

.legal-links a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--gold-dark);
  background: #fff;
  font-weight: 850;
  text-decoration: none;
}

.legal-page {
  width: min(900px, calc(100% - 28px));
  margin: 24px auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.legal-page h1 {
  max-width: none;
}

.legal-page h2 {
  margin-top: 22px;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.55;
}

.modal {
  width: min(calc(100% - 28px), 420px);
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(31, 26, 16, 0.42);
}

.modal form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 30;
  width: min(calc(100% - 40px), 400px);
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(31, 26, 16, 0.92);
  text-align: center;
  box-shadow: var(--shadow);
}

@media (min-width: 760px) {
  .app-shell {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100vh - 48px);
    border: 1px solid var(--line);
    border-radius: 24px;
  }
}

@media (max-width: 759px) {
  body {
    background: var(--paper);
  }

  .app-shell {
    box-shadow: none;
  }
}

@media (max-height: 780px) and (max-width: 520px) {
  .app-header {
    padding: 10px 14px 8px;
  }

  .halo-logo {
    width: 42px;
    height: 42px;
  }

  main {
    padding-top: 10px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .status-row,
  .section-head {
    margin-bottom: 10px;
  }

  h1 {
    font-size: 1.48rem;
  }

  .location-strip {
    margin-bottom: 9px;
    padding: 8px 10px;
  }

  .photo-stage {
    aspect-ratio: 1 / 1;
  }

  .profile-body {
    gap: 8px;
    padding: 12px;
  }

  .action-row {
    margin-top: 12px;
  }

  .round-action {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 360px) {
  main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .profile-form,
  .auth-actions,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.48rem;
  }
}
