:root {
  --cream: #F8F2E4; --paper: #FFFBF3; --blush: #F6D3D6; --pink: #E7A0AC; --rose: #C9687A;
  --citron: #B7B04A; --olive: #8E8A36; --ink: #5C5A26; --dark: #2B2A12;
  --nav-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--cream); }
body {
  font-family: Jost, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink); background: var(--cream); min-height: 100dvh; max-width: 560px; margin: 0 auto;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
body.noscroll { overflow: hidden; }
img { display: block; }
button, a { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-decoration: none; }
button:disabled { opacity: .6; }
input {
  font: inherit; font-size: 16px; width: 100%; background: #fff; border: 1.5px solid var(--pink);
  border-radius: 24px; padding: 12px 16px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none;
}
input:focus { border-color: var(--rose); }
input::placeholder { color: #bfa7a9; }
.script { font-family: "Pinyon Script", cursive; color: var(--rose); font-weight: 400; line-height: 1.15; }
h1, h2, .serif { font-family: "Cormorant Garamond", "Songti SC", serif; font-weight: 600; }
.btn {
  display: block; width: 100%; text-align: center; background: var(--citron); color: #fff; border-radius: 30px;
  padding: 13px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; margin-top: 14px; min-height: 48px;
}
.btn.pink { background: var(--rose); }
.link { text-decoration: underline; font-size: 14px; margin-top: 12px; padding: 10px; }
.error { color: var(--rose); font-size: 14px; margin-top: 10px; }
.loading { text-align: center; padding: 32px; opacity: .6; }
#app { padding-top: var(--safe-t); padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); min-height: 100dvh; }
#app.full { padding: 0; }

/* language toggle */
.lang { display: inline-flex; border: 1.5px solid var(--rose); border-radius: 16px; overflow: hidden; font-size: 12px; flex: none; }
.lang button { padding: 5px 10px; color: var(--rose); min-height: 30px; }
.lang button.on { background: var(--rose); color: #fff; }
.lang.light { border-color: #fff; }
.lang.light button { color: #fff; }
.lang.light button.on { background: #fff; color: var(--olive); }
.corner { position: absolute; top: calc(var(--safe-t) + 14px); right: 14px; z-index: 2; }

/* scalloped paper card */
.scallop {
  --r: 10px; background: var(--paper);
  --m: radial-gradient(var(--r), #000 98%, #0000) 0 0 / calc(2 * var(--r)) calc(2 * var(--r)) round,
       linear-gradient(#000 0 0) var(--r) var(--r) / calc(100% - 2 * var(--r)) calc(100% - 2 * var(--r)) no-repeat;
  -webkit-mask: var(--m); mask: var(--m); padding: 34px 24px;
}

/* welcome */
.welcome {
  min-height: 100dvh; background: var(--citron); display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: calc(var(--safe-t) + 60px) 20px calc(var(--safe-b) + 56px); position: relative; text-align: center;
}
.welcome .card { width: 100%; max-width: 360px; }
.welcome-art { width: min(72vw, 290px); height: auto; margin-top: 14px; pointer-events: none; user-select: none; }
@media (max-height: 700px) { .welcome { padding-top: calc(var(--safe-t) + 52px); } .welcome .card { padding: 26px 22px; } .names { font-size: 46px; } .welcome-art { width: min(52vw, 200px); margin-top: 8px; } }
.eyebrow { font-family: "Cormorant Garamond", "Songti SC", serif; letter-spacing: .25em; text-transform: uppercase; font-size: 12px; }
.names { font-size: 54px; margin: 12px 0 6px; }
.amp { color: var(--olive); }
.zh-names { font-family: "Cormorant Garamond", "Songti SC", serif; color: var(--rose); letter-spacing: .15em; font-size: 19px; margin-bottom: 2px; }
.date { font-family: "Cormorant Garamond", "Songti SC", serif; font-size: 15px; letter-spacing: .1em; margin-bottom: 12px; }
.vibe { position: absolute; bottom: calc(var(--safe-b) + 16px); left: 0; right: 0; text-align: center; font-size: 12px; color: #fff; opacity: .9; }
.vibe .script { color: inherit; font-size: 21px; }

/* arched card screens (name, profile) */
.arch-wrap { padding: calc(var(--safe-t) + 64px) 18px 24px; position: relative; text-align: center; }
.arch { background: var(--blush); border-radius: 200px 200px 18px 18px; padding: 56px 22px 26px; max-width: 380px; margin: 0 auto; }
.arch h2.script { font-size: 44px; }
.arch p { font-size: 15px; }
.avatar-pick {
  display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; border-radius: 50%;
  margin: 18px auto 6px; background: var(--paper); border: 2px dashed var(--rose); color: var(--rose); font-size: 13px;
  cursor: pointer; overflow: hidden; line-height: 1.3;
}
.avatar-pick img, .avatar-pick .av { width: 100%; height: 100%; }
.name-form { margin-top: 10px; }
.av {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex;
  align-items: center; justify-content: center; background: var(--pink); color: #fff; font-size: 14px;
}
.av.sm { width: 26px; height: 26px; font-size: 12px; }
.av.big { font-size: 38px; }

/* top bar */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 10px;
  position: sticky; top: 0; background: var(--cream); z-index: 5;
}
.top h1 { font-family: "Pinyon Script", cursive; font-weight: 400; color: var(--rose); font-size: 36px; line-height: 1.2; }
.top-right { display: flex; gap: 8px; align-items: center; }
.pill { background: var(--blush); color: var(--rose); border-radius: 20px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.pill:empty { display: none; }

/* photo grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 0 3px; }
.tile {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; display: block; width: 100%;
  background: linear-gradient(135deg, var(--blush), var(--pink)); cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile img.noimg { visibility: hidden; }
.tile .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 22px; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); pointer-events: none;
}
.tile .del {
  position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 251, 243, .94); color: var(--rose); font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.empty { text-align: center; padding: 40px 30px; opacity: .75; line-height: 1.5; }
.sentinel { height: 1px; }

/* bottom navigation */
#nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--paper);
  border-top: 1.5px solid var(--blush); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; z-index: 20;
}
#nav[hidden] { display: none; }
#nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; opacity: .6; padding: 8px 0; }
#nav a.on { opacity: 1; color: var(--rose); font-weight: 500; }
#nav .cam {
  justify-self: center; width: 64px; height: 64px; border-radius: 50%; background: var(--rose); color: #fff;
  display: flex; align-items: center; justify-content: center; margin-top: -30px; border: 5px solid var(--cream);
  box-shadow: 0 4px 14px rgba(201, 104, 122, .35);
}
#nav .cam svg { width: 28px; height: 28px; }

/* ranking */
.rank-head { text-align: center; padding: 54px 16px 4px; position: relative; }
.rank-head h1 { font-family: "Pinyon Script", cursive; font-weight: 400; color: var(--rose); font-size: 44px; line-height: 1.2; }
.sub { font-family: "Cormorant Garamond", "Songti SC", serif; font-size: 15px; }
.podium { display: flex; gap: 8px; padding: 24px 14px 0; }
.chip { flex: 1; min-width: 0; position: relative; background: var(--blush); border-radius: 16px; padding: 22px 6px 10px; text-align: center; font-size: 13px; }
.chip.first { background: var(--citron); color: #fff; }
.chip .num {
  position: absolute; top: -15px; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%;
  background: var(--citron); color: #fff; border: 3px solid var(--cream); font-family: "Cormorant Garamond", serif;
  font-weight: 600; font-size: 18px; line-height: 24px;
}
.chip.first .num { background: var(--rose); }
.chip .av { width: 40px; height: 40px; margin: 0 auto; }
.chip .nm { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip b { font-size: 15px; }
.chip.empty-chip { opacity: .45; }
.me-line { text-align: center; font-size: 13px; margin-top: 12px; opacity: .8; }
.award { margin: 18px 14px 0; text-align: center; padding: 22px 16px; }
.award .label { font-family: "Cormorant Garamond", "Songti SC", serif; letter-spacing: .22em; font-size: 12px; text-transform: uppercase; }
.award .who { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; text-align: left; font-size: 14px; }
.award .av { width: 42px; height: 42px; }
.section-label { font-family: "Cormorant Garamond", "Songti SC", serif; letter-spacing: .18em; font-size: 12px; text-transform: uppercase; padding: 22px 16px 8px; }
.moments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px; }
.moment { text-align: center; font-size: 12px; line-height: 1.4; }
.moment .tile { margin-bottom: 4px; }

/* my photos */
.progress { margin: 0 14px 10px; background: var(--paper); border-radius: 14px; padding: 10px 12px; font-size: 14px; cursor: pointer; }
.progress[hidden] { display: none; }
.bar { height: 6px; background: var(--blush); border-radius: 6px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--citron); border-radius: 6px; transition: width .3s; }
.mine-add { margin: 0 14px 12px; width: calc(100% - 28px); }

/* profile */
.profile .avatar-pick { width: 112px; height: 112px; border: 4px solid var(--paper); }
.profile .hint-sm { font-size: 12px; color: var(--rose); text-decoration: underline; }
.profile h2.script { font-size: 38px; margin-top: 4px; overflow-wrap: anywhere; }
.profile .stats { font-family: "Cormorant Garamond", "Songti SC", serif; font-size: 17px; margin-top: 16px; }
.profile .vibe { position: static; color: var(--olive); margin-top: 26px; }

/* recovery PIN */
.pin-form { margin-top: 18px; text-align: left; }
.pin-label { font-weight: 500; font-size: 14px; }
.pin-hint { font-size: 12px; opacity: .75; margin: 2px 0 8px; line-height: 1.4; }
.pin-row { display: flex; gap: 8px; align-items: center; }
.pin-row input { flex: 1; letter-spacing: .4em; text-align: center; }
.pin-row .btn { width: auto; margin-top: 0; padding: 12px 18px; font-size: 13px; }
.recover-form { margin-top: 8px; }
.recover-title { font-size: 30px; margin-bottom: 6px; }

.profile .logout { display: block; margin: 18px auto 0; color: var(--rose); }

/* full-screen viewer */
.viewer { position: fixed; inset: 0; background: var(--dark); z-index: 50; display: flex; flex-direction: column; color: #fff; }
.viewer header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--safe-t) + 8px) 8px 8px; font-size: 14px; }
.viewer header button, .viewer header a { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.viewer .vbtns { display: flex; flex: none; }
.viewer .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.viewer .who span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.reacts { display: flex; justify-content: center; gap: 10px; padding: 12px; }
.reacts button { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 9px 16px; font-size: 16px; min-height: 44px; }
.reacts button.on { background: var(--rose); color: #fff; }
.viewer .hint { text-align: center; font-size: 12px; opacity: .55; padding-bottom: calc(var(--safe-b) + 12px); min-height: 18px; }

/* in-app confirmation card */
.ask { position: fixed; inset: 0; background: rgba(43, 42, 18, .45); z-index: 80; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(var(--safe-b) + 16px); }
.ask-card { background: var(--paper); border-radius: 22px; padding: 20px 18px 16px; width: 100%; max-width: 420px; text-align: center; color: var(--ink); font-size: 15px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.ask-btns { display: flex; gap: 10px; margin-top: 16px; }
.ask-btns button { flex: 1; min-height: 48px; border-radius: 26px; font-size: 15px; background: var(--blush); color: var(--ink); }
.ask-btns .ask-yes { background: var(--citron); color: #fff; }
.ask-btns .ask-yes.danger { background: var(--rose); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* couple page */
.admin-login { margin: 60px 16px; text-align: center; }
.admin-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; padding: 0 10px 40px; }
.admin-tile { font-size: 11px; }
.admin-tile img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 6px; background: var(--blush); }
.admin-tile.is-hidden img { opacity: .3; }
.admin-tile button { font-size: 12px; padding: 6px 9px; background: var(--blush); border-radius: 12px; margin: 4px 4px 0 0; }
