:root {
  --bg: #f6f4ef;
  --cream: #faf7f1;
  --ink: #373733;
  --green: #5e6b52;
  --ref: #4f5b44;
  --btn: #131313;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  overscroll-behavior: none;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 34px);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 0;
  border-radius: 32px;
  background: var(--cream);
  overflow: hidden;
  will-change: transform;
  cursor: grab;
}
.card.dragging { cursor: grabbing; transition: none !important; }
.card.animate { transition: transform .32s cubic-bezier(.22, .8, .3, 1), opacity .32s; }

/* Ảnh nhoè tan dần vào nền kem ở phía trên */
.card .photo {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(18px) saturate(.7);
  opacity: 0;
  transition: opacity .9s;
}
.card .photo.loaded { opacity: 1; }
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(var(--cream) 8%, rgba(250, 247, 241, .88) 38%, rgba(250, 247, 241, .35) 68%, rgba(60, 62, 45, .35));
  pointer-events: none;
}
.card > :not(.photo) { position: relative; z-index: 2; }

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 60px;
}

.mark { font-family: "EB Garamond", Georgia, serif; font-size: 52px; line-height: .8; height: 30px; color: var(--green); }

.text {
  margin: 10px 0 0;
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 400;
  line-height: 1.45;
  font-size: 27px;
  text-wrap: balance;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.text.s-xl { font-size: 32px; }
.text.s-l { font-size: 28px; }
.text.s-m { font-size: 24px; }
.text.s-s { font-size: 20px; line-height: 1.5; }

.ref {
  margin-top: 26px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ref);
  text-decoration: none;
}

.like {
  flex: 0 0 auto;
  height: 64px;
  border: 0;
  border-radius: 32px;
  background: var(--btn);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.like img { width: 28px; height: 28px; }
.like:active { filter: brightness(.92); }

.state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  font-size: 14px;
}
.state button { padding: 10px 18px; border-radius: 20px; border: 0; background: var(--green); color: #fff; font-size: 14px; cursor: pointer; }
.spinner { width: 26px; height: 26px; margin: 0 auto; border: 3px solid #e4e2da; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shake { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }
.card.shake { animation: shake .3s; }

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 10;
}
.sheet-panel {
  width: 100%;
  max-width: 430px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 22px 16px 28px;
  background: var(--cream);
  border-radius: 28px 28px 0 0;
}
.sheet-item {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 500 13px Inter, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.sheet-item img { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: #ebe8df; }
