:root {
  --primary: #954330;
  --primary-2: #b45b46;
  --secondary: #36656c;
  --tertiary: #52604a;
  --surface: #fcf9f4;
  --surface-low: #f6f3ee;
  --surface-mid: #f0ede8;
  --paper: #ffffff;
  --ink: #1c1c19;
  --muted: #55433e;
  --soft: rgba(28, 28, 25, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--surface); color: var(--ink); }
body { font-family: Manrope, system-ui, sans-serif; overflow: hidden; }
button { font: inherit; }

#app {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 10% 0%, rgba(149, 67, 48, .14), transparent 30%),
    linear-gradient(145deg, #fcf9f4, #f0ede8);
}

.phone {
  position: relative;
  width: min(100vw, 430px);
  height: 100svh;
  max-height: 920px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 32px 80px rgba(28, 28, 25, .16);
}

@media (max-width: 719px) {
  .phone { width: 100vw; max-height: none; box-shadow: none; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
  background: rgba(252, 249, 244, .82);
  backdrop-filter: blur(20px);
}

.brand {
  font-family: "Noto Serif", Georgia, serif;
  font-style: italic;
  font-size: 21px;
  color: var(--primary);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-mid);
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-low);
  color: var(--primary);
  font-weight: 900;
}

.view {
  height: calc(100svh - 66px);
  max-height: 854px;
  overflow-y: auto;
  padding: 18px 20px calc(118px + env(safe-area-inset-bottom));
  scroll-behavior: smooth;
}

.kicker {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--secondary);
}

h1, h2, h3 {
  margin: 0;
  font-family: "Noto Serif", Georgia, serif;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 { font-size: 40px; max-width: 360px; }
h2 { font-size: 25px; color: var(--primary); }
h3 { font-size: 24px; }
p { margin: 0; line-height: 1.52; }

.lead {
  max-width: 340px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
}

.section { display: grid; gap: 16px; margin: 30px 0; }
.row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.row::-webkit-scrollbar { display: none; }

.card {
  border: 0;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 18px 42px var(--soft);
  overflow: hidden;
}

.soft-card {
  border-radius: 12px;
  background: var(--surface-low);
  padding: 18px;
}

.profile-card { min-width: 292px; }
.cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: var(--surface-mid);
}

.event-cover { aspect-ratio: 16 / 10; }
.content { display: grid; gap: 10px; padding: 16px; }
.meta {
  color: var(--secondary);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.muted { color: var(--muted); font-size: 13px; }
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 70px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--surface) 48%, transparent 50%),
    conic-gradient(var(--primary) var(--score), rgba(54,101,108,.18) 0);
  color: var(--primary);
  font-family: "Noto Serif", Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 13px;
  background: var(--surface-mid);
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
.chip.active { background: var(--secondary); color: white; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--surface-mid);
  color: var(--ink);
  font-weight: 900;
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 12px 28px rgba(149, 67, 48, .22);
}
.btn.secondary { background: var(--secondary); color: white; }

.split {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.field-grid { display: grid; gap: 10px; }
.field {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-low);
}
.field span { color: var(--secondary); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.field strong { font-size: 15px; }

.chat {
  display: grid;
  gap: 12px;
}
.bubble {
  max-width: 86%;
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-low);
  font-size: 14px;
}
.bubble.me { justify-self: end; background: var(--primary); color: white; }

.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.source-tile {
  position: relative;
  min-height: 150px;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  color: white;
  text-align: left;
  padding: 12px;
  display: grid;
  align-content: end;
  background: #333;
}
.source-tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.source-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.68));
}
.source-tile span, .source-tile strong { position: relative; z-index: 1; }

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  min-height: calc(88px + env(safe-area-inset-bottom));
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(252,249,244,.94);
  backdrop-filter: blur(20px);
  box-shadow: 0 -14px 34px rgba(28,28,25,.08);
}
.tab {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #83736d;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
}
.tab img {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  object-fit: cover;
  filter: grayscale(.45) saturate(.8);
}
.tab.active { color: var(--primary); transform: translateY(-2px); }
.tab.active img {
  filter: none;
  box-shadow: 0 0 0 2px rgba(149,67,48,.18);
}

.toast {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 40;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(28,28,25,.92);
  color: white;
  font-size: 13px;
  transform: translateY(18px);
  opacity: 0;
  transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
