:root {
  --void: #0a090b;
  --ink: #140f12;
  --panel: #1a1418;
  --line: rgba(255,255,255,.1);
  --snow: #f6efe9;
  --mist: #c8b8b0;
  --ember: #ff3b5c;
  --ember-2: #ff6b8a;
  --green: #3dd68c;
  --warn: #f0b429;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-ui: "Outfit", "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--void);
  color: var(--snow);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.app {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-top)) 12px calc(12px + var(--safe-bottom));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 20;
}
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .02em;
  font-size: 1.05rem;
}
.brand span { color: #ff6b8a; }
.brand.room span { color: #8ec3ff; }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: var(--snow);
  display: grid;
  place-items: center;
  position: relative;
}
.icon-btn:active { transform: scale(.96); }
.token-chip {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: .88rem;
  color: var(--mist);
}
.token-chip strong { color: #fff; }
.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ember);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
}
.badge.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }

.stage { flex: 1; position: relative; min-height: 0; margin-top: 10px; }

.card-stack, .card {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  overflow: hidden;
}
.card {
  background: #1c1216;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  touch-action: none;
}
.card img, .card .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card .ph {
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%),
    #24181c;
}
.card-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 72px 22px 22px;
  background: linear-gradient(180deg, transparent, rgba(8,4,6,.88) 70%);
}
.card-meta h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 560;
  font-size: clamp(2rem, 8vw, 3.2rem);
  line-height: .95;
}
.card-meta p { margin: 8px 0 0; color: var(--mist); letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }

.stamp {
  position: absolute;
  top: 18%;
  font-size: 4rem;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.4));
}
.stamp.like { right: 18px; color: var(--ember); }
.stamp.pass { left: 18px; color: #d7d2cc; }

.actions {
  position: relative;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 16px 0 4px;
}
.fab {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform .14s ease, filter .14s ease;
}
.fab:active { transform: scale(.92); }
.fab.pass { background: #2a2427; }
.fab.like {
  background: radial-gradient(circle at 30% 20%, #ff7a96, var(--ember));
  box-shadow: 0 10px 30px rgba(255,59,92,.35);
}
.fab:disabled { opacity: .4; }

.empty-state, .auth-copy {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--mist);
}
.empty-state h2, .sheet h2 {
  font-family: var(--font-display);
  color: var(--snow);
  font-weight: 520;
  margin: 0 0 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(20,14,16,.92);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--snow);
  padding: 12px 16px;
  border-radius: 16px;
  max-width: min(92vw, 360px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  backdrop-filter: blur(16px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); transition: .25s ease; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6,4,6,.62);
  backdrop-filter: blur(10px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: min(92dvh, 820px);
  background: #161114;
  border-top: 1px solid var(--line);
  border-radius: 28px 28px 0 0;
  z-index: 50;
  transform: translateY(110%);
  padding: 10px 16px calc(18px + var(--safe-bottom));
  overflow: auto;
}
.sheet.open { transform: translateY(0); transition: transform .38s cubic-bezier(.22,1,.36,1); }
.grab {
  width: 42px; height: 4px; border-radius: 99px;
  background: rgba(255,255,255,.18);
  margin: 6px auto 12px;
}
@media (min-width: 860px) {
  .sheet {
    left: 50%; right: auto;
    top: 50%; bottom: auto;
    width: min(460px, 92vw);
    transform: translate(-50%, -46%) scale(.96);
    border-radius: 24px;
    opacity: 0;
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.list { display: flex; flex-direction: column; gap: 10px; }
.person, .room-card, .note {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
}
.person img, .room-card img, .avatar {
  width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: #2a2226;
}
.mini-actions { display: flex; gap: 8px; }
.tiny {
  width: 42px; height: 42px; border: 0; border-radius: 14px; color: #fff;
}
.tiny.pass { background: #2c272a; }
.tiny.like { background: var(--ember); }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field span { color: var(--mist); font-size: .82rem; }
.field input, .field select, .field textarea {
  background: #221b1f;
  border: 1px solid var(--line);
  color: var(--snow);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
}
.btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 700;
  color: #fff;
  width: 100%;
}
.btn-ember { background: linear-gradient(180deg, var(--ember-2), var(--ember)); }
.btn-ghost { background: rgba(255,255,255,.08); }
.btn-green { background: #17a35a; }
.btn-gray { background: #3a3438; color: #bbb; }
.btn:disabled { opacity: .45; }

.photo-pick {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: 22px;
  overflow: hidden;
  background: #22181c;
  display: grid;
  place-items: center;
  color: var(--mist);
  border: 1px dashed rgba(255,255,255,.18);
  position: relative;
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

.tabs { display: flex; gap: 6px; overflow: auto; padding-bottom: 8px; }
.tab {
  border: 0; background: rgba(255,255,255,.06); color: var(--mist);
  border-radius: 999px; padding: 8px 12px; white-space: nowrap;
}
.tab.on { background: #fff; color: #111; }

.search {
  width: 100%;
  background: #221b1f;
  border: 1px solid var(--line);
  color: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  margin: 8px 0 12px;
  font-size: 1rem;
}

.catalog {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) { .catalog { grid-template-columns: 1fr 1fr; } }
.cover-card {
  border-radius: 22px;
  overflow: hidden;
  min-height: 180px;
  background: #1b1518;
  border: 1px solid var(--line);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.cover-card.has-cover { min-height: 240px; }
.cover-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-card .info {
  position: relative;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(8,6,8,.9));
}
.cover-card h3 { margin: 0 0 4px; font-size: 1.2rem; }
.meta { color: var(--mist); font-size: .82rem; display: flex; gap: 10px; flex-wrap: wrap; }
.dot-on { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }

.room-view { display: flex; flex-direction: column; height: min(82dvh, 740px); }
.room-head { display: flex; gap: 12px; align-items: center; }
.room-head img { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; }
.chat {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}
.bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 16px;
  background: #2a2226;
}
.bubble.mine { margin-left: auto; background: #3a1d27; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; }

.heart-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 6;
}
.heart-burst span {
  font-size: 84px;
  filter: drop-shadow(0 0 24px rgba(255,59,92,.8));
}

.video-layer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 70;
  display: none;
}
.video-layer.on { display: block; }
.video-layer video { width: 100%; height: 100%; object-fit: cover; }
.video-close {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 12px;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
