/* Phone Call invitation: styles */
:root {
  --em: #0f4d3c;
  --em-d: #072a20;
  --em-l: #1f6b55;
  --gold: #d4af6a;
  --gold-d: #a67c2e;
  --gold-l: #f3e2b3;
  --cream: #f4ecdd;
  --ink: #1d2a25;
  --muted: #6f7d76;
  --out: #d6f0de;
  --red: #e5484d;
  --green: #2fbf71;
  --serif: "Cormorant Garamond", Georgia, serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cg fill='none' stroke='%23b8914a' stroke-opacity='.16' stroke-width='1'%3E%3Cpath d='M28 8l5.5 14.5L48 28l-14.5 5.5L28 48l-5.5-14.5L8 28l14.5-5.5z'/%3E%3Crect x='19' y='19' width='18' height='18' transform='rotate(45 28 28)'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 0%, #1a6650 0%, #0a3328 45%, #04170f 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; }
.phone {
  position: relative;
  width: 400px;
  height: min(860px, calc(100vh - 70px));
  border-radius: 46px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 10px #101413, 0 0 0 11px #3a403e, 0 30px 80px rgba(0, 0, 0, .55);
}
.desk-hint { color: rgba(243, 226, 179, .7); font-size: 13px; letter-spacing: .04em; }

@media (max-width: 520px) {
  body { display: block; }
  .stage { display: block; padding: 0; }
  .phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
  .desk-hint { display: none; }
}

/* ---------- status bar ---------- */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: 44px; padding: 15px 28px 0;
  display: flex; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: #fff;
  pointer-events: none;
}
.sb-icons { display: flex; gap: 6px; align-items: center; }
.sb-icons svg { fill: currentColor; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; transform: scale(1.04);
  transition: opacity .6s ease, transform .6s ease, visibility 0s linear .6s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; transition: opacity .6s ease, transform .6s ease; }

/* =================== CALL SCREEN =================== */
#screen-call {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: clamp(50px, 9vh, 78px) 26px clamp(18px, 5vh, 50px); text-align: center; color: #fff;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  background: radial-gradient(circle at 50% 28%, #1e6d56 0%, #0c3a2e 46%, #041812 100%);
}
#screen-call::-webkit-scrollbar { display: none; }
#screen-call::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--pattern); background-size: 64px; opacity: .55; filter: brightness(1.6);
  pointer-events: none;
}
.bokeh i {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(243, 226, 179, .55), rgba(212, 175, 106, 0) 70%);
  animation: float 9s ease-in-out infinite;
}
.bokeh i:nth-child(1) { width: 120px; height: 120px; left: -30px; top: 12%; }
.bokeh i:nth-child(2) { width: 70px; height: 70px; right: 8%; top: 8%; animation-delay: -2s; }
.bokeh i:nth-child(3) { width: 160px; height: 160px; right: -60px; top: 44%; animation-delay: -4s; opacity: .6; }
.bokeh i:nth-child(4) { width: 50px; height: 50px; left: 18%; top: 58%; animation-delay: -6s; }
.bokeh i:nth-child(5) { width: 90px; height: 90px; left: 40%; bottom: 4%; animation-delay: -1s; opacity: .5; }
.bokeh i:nth-child(6) { width: 34px; height: 34px; right: 26%; top: 30%; animation-delay: -3s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(12px, -22px); } }

.call-top, .call-bottom { position: relative; z-index: 1; }
.call-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-l);
  padding: 6px 14px; border: 1px solid rgba(243, 226, 179, .35); border-radius: 30px;
  background: rgba(0, 0, 0, .15);
}
.avatar-wrap {
  position: relative; width: clamp(96px, 19vh, 156px); height: clamp(96px, 19vh, 156px);
  margin: clamp(14px, 4vh, 34px) auto clamp(12px, 3vh, 24px);
}
.avatar {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #fbf1d6 0%, #ecd39a 55%, #c9a052 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); color: var(--em-d); font-size: 54px; font-weight: 600;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 0 0 7px rgba(212, 175, 106, .35), 0 14px 40px rgba(0, 0, 0, .45);
}
.avatar i { font-style: italic; font-size: .55em; margin: 0 .12em; opacity: .7; }
.avatar img, .avatar svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--gold); opacity: 0;
}
.ringing .ring { animation: ripple 2.4s ease-out infinite; }
.ringing .r2 { animation-delay: .8s; }
.ringing .r3 { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(1); opacity: .75; } 100% { transform: scale(1.95); opacity: 0; } }
.ringing .avatar { animation: buzz 2.4s ease-in-out infinite; }
@keyframes buzz {
  0%, 24%, 100% { transform: rotate(0); }
  4% { transform: rotate(-5deg); } 8% { transform: rotate(5deg); }
  12% { transform: rotate(-4deg); } 16% { transform: rotate(4deg); } 20% { transform: rotate(-2deg); }
}

.call-name { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 4.4vh, 35px); line-height: 1.08; letter-spacing: .01em; }
.call-name span { display: block; }
.call-name .amp { font-style: italic; font-size: .75em; color: var(--gold); margin: 2px 0; }
.call-status { margin-top: clamp(6px, 1.5vh, 12px); font-size: 16px; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; }
.ringing .call-status::after { content: ""; display: inline-block; width: 0; }

.wave { display: flex; gap: 4px; justify-content: center; align-items: center; height: 0; opacity: 0; overflow: hidden; transition: opacity .4s, height .4s; }
.wave i { width: 4px; height: 30%; border-radius: 3px; background: var(--gold); animation: wave 1s ease-in-out infinite; }
.wave i:nth-child(2n) { animation-delay: -.3s; } .wave i:nth-child(3n) { animation-delay: -.6s; } .wave i:nth-child(5n) { animation-delay: -.15s; }
@keyframes wave { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.caption {
  min-height: 0; margin: 0 auto; max-width: 300px;
  font-size: 18px; line-height: 1.45; color: #fff;
  opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s;
}
.caption.show { opacity: 1; transform: none; }
.connected .wave { opacity: 1; height: clamp(26px, 5vh, 40px); margin-top: clamp(10px, 2.6vh, 22px); }
.connected .caption { min-height: 52px; margin-top: clamp(8px, 2vh, 16px); }
.ended .wave { opacity: 0; }
.ended .call-status { color: #ff8a8d; }

.mini { display: flex; justify-content: space-around; margin-bottom: clamp(14px, 4vh, 34px); }
.mini button { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 13px; color: rgba(255, 255, 255, .86); }
.ico {
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.answer { display: flex; justify-content: space-around; }
.answer button { display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 14px; }
.big { width: clamp(62px, 9.5vh, 76px); height: clamp(62px, 9.5vh, 76px); border-radius: 50%; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
.decline .big { background: var(--red); }
.accept .big { background: var(--green); animation: pulse 1.5s infinite; }
.accept .big svg { animation: wiggle 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, .65); } 70% { box-shadow: 0 0 0 24px rgba(47, 191, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0); } }
@keyframes wiggle { 0%, 50%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(14deg); } }

.incall { display: none; justify-content: space-around; align-items: center; }
.incall .ico { width: 58px; height: 58px; }
.incall .ico.on { background: rgba(243, 226, 179, .9); color: var(--em-d); }
.incall .end { width: 72px; height: 72px; border-radius: 50%; background: var(--red); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .3); }
.connected .incoming { display: none; }
.connected .incall { display: flex; }

/* very short screens: drop the small Remind/Message row so Accept/Decline always fit */
@media (max-height: 620px) {
  .mini { display: none; }
  .call-label { font-size: 10.5px; padding: 5px 12px; }
}

.shake { animation: shake .5s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

/* =================== CHAT SCREEN =================== */
#screen-chat { display: flex; flex-direction: column; background: var(--cream); }
.chat-head {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 46px 8px 10px; color: #fff;
  background: linear-gradient(180deg, #0c4234, var(--em));
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.head-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.head-btn:hover { background: rgba(255, 255, 255, .1); }
.avatar.sm { position: relative; width: 42px; height: 42px; flex: none; font-size: 16px; box-shadow: 0 0 0 2px rgba(212, 175, 106, .6); }
.who { flex: 1; min-width: 0; padding-left: 4px; }
.who b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 12px; color: var(--gold-l); }

.chat-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 12px 10px;
  background-color: var(--cream); background-image: var(--pattern); background-size: 56px;
}
.day-chip {
  width: max-content; margin: 4px auto 12px;
  font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, .75); padding: 5px 12px; border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.secure-chip {
  max-width: 290px; margin: 0 auto 14px; text-align: center;
  font-size: 11.5px; line-height: 1.4; color: #7a6a3e;
  background: #fbf1d3; padding: 7px 12px; border-radius: 8px;
}
.row { display: flex; margin: 4px 0; opacity: 0; transform: translateY(10px) scale(.97); transform-origin: left bottom; transition: opacity .35s ease, transform .35s ease; }
.row.in { opacity: 1; transform: none; }
.row.out { justify-content: flex-end; transform-origin: right bottom; }
.bubble {
  position: relative; max-width: 82%;
  background: #fff; border-radius: 4px 16px 16px 16px;
  padding: 7px 10px 5px; font-size: 15px; line-height: 1.4;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, .13);
}
.out .bubble { background: var(--out); border-radius: 16px 4px 16px 16px; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.media { padding: 4px; max-width: 88%; width: 300px; }
.meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; margin-top: 1px; font-size: 11px; color: var(--muted); }
.media .meta { padding: 0 6px 2px; }
.ticks { display: inline-flex; color: #9aa7a1; transition: color .3s; }
.ticks.read { color: #2f9be0; }

.typing .bubble { padding: 12px 14px; }
.dots span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: #9aa7a1; animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* invitation card */
.invite-card { border-radius: 12px; padding: 7px; background: linear-gradient(160deg, #fffdf6, #f5ead2); color: var(--em-d); text-align: center; }
.ic-inner {
  position: relative; border: 1.5px solid var(--gold); border-radius: 9px; padding: 18px 14px 16px;
  outline: 1px solid rgba(212, 175, 106, .55); outline-offset: -6px;
}
.ic-inner::before, .ic-inner::after {
  content: "✦"; position: absolute; left: 50%; transform: translateX(-50%);
  color: var(--gold); font-size: 12px; background: #fcf6e8; padding: 0 6px; line-height: 1;
}
.ic-inner::before { top: -7px; }
.ic-inner::after { bottom: -7px; }
.ic-bism { font-family: Amiri, "Times New Roman", serif; font-size: 23px; line-height: 1.7; color: var(--gold-d); }
.ic-small { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #7c6a45; margin-top: 4px; }
.ic-occ { font-family: var(--serif); font-size: 28px; font-weight: 700; letter-spacing: .05em; color: var(--em); margin: 2px 0 6px; }
.ic-couple { width: 92px; height: 92px; margin: 2px auto 8px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px rgba(212, 175, 106, .25); background: radial-gradient(circle at 50% 35%, #fbf1d6, #e8cd92 60%, #c9a052); }
.ic-couple svg, .ic-couple img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar img, .ic-couple img { transform: scale(1.18); transform-origin: 50% 8%; }
.ic-name { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.05; }
.ic-amp { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--gold-d); line-height: 1.2; }
.ic-div { width: 62%; height: 1px; margin: 12px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.ic-day { font-size: 11.5px; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--gold-d); }
.ic-date { font-family: var(--serif); font-size: 23px; font-weight: 700; line-height: 1.15; }
.ic-time { font-size: 14px; font-weight: 600; margin-top: 2px; }
.ic-venue { font-size: 15px; font-weight: 700; margin-top: 10px; letter-spacing: .02em; }
.ic-town { font-size: 12.5px; color: var(--muted); }
.bubble-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 4px; padding: 11px 8px;
  border-top: 1px solid rgba(0, 0, 0, .07);
  color: #0b7a5a; font-weight: 600; font-size: 14px; text-decoration: none; text-align: center;
}
.bubble-btn:hover { background: rgba(15, 77, 60, .05); }

/* map */
.map-pic { display: block; border-radius: 11px; overflow: hidden; }
.map-pic svg { display: block; width: 100%; height: auto; }
.route { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 2s .3s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pin { transform-box: fill-box; transform-origin: 50% 100%; animation: drop .7s 2s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes drop { 0% { transform: translateY(-40px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.map-info { padding: 9px 8px 2px; }
.map-info b { display: block; font-size: 15px; }
.map-info small { font-size: 12.5px; color: var(--muted); }

/* countdown */
.cd-card { padding: 10px 8px 4px; text-align: center; }
.cd-title { font-size: 13px; font-weight: 600; color: var(--em); margin-bottom: 8px; }
.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cd div { background: linear-gradient(160deg, var(--em), var(--em-d)); color: var(--gold-l); border-radius: 10px; padding: 8px 2px 6px; }
.cd b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cd span { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.cd-done { grid-column: 1 / -1; font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--em); padding: 6px; }

/* quick replies + composer */
.quick {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  max-height: 0; overflow: hidden; padding: 0 12px;
  background: var(--cream); transition: max-height .35s ease, padding .35s ease;
}
.quick.show { max-height: 160px; padding: 8px 12px 4px; }
.quick button {
  padding: 10px 18px; border-radius: 24px; font-size: 14.5px; font-weight: 600;
  background: #fff; color: var(--em); border: 1.5px solid var(--em);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
  animation: pop .35s ease both;
}
.quick button.primary { background: linear-gradient(160deg, #e7c886, var(--gold)); border-color: var(--gold); color: var(--em-d); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.composer { display: flex; gap: 8px; padding: 8px 10px calc(12px + env(safe-area-inset-bottom)); background: var(--cream); }
.composer input {
  flex: 1; min-width: 0; padding: 12px 16px; border: 0; border-radius: 24px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink); outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1); transition: box-shadow .3s;
}
.composer input:disabled { background: rgba(255, 255, 255, .6); }
.composer.ready input { box-shadow: 0 0 0 2px var(--gold), 0 1px 2px rgba(0, 0, 0, .1); }
.composer button { width: 46px; height: 46px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--em); color: #fff; transition: opacity .3s; }
.composer button:disabled { opacity: .45; cursor: default; }

/* overlays */
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }
.toast {
  position: absolute; left: 50%; bottom: 190px; z-index: 30;
  max-width: 85%; width: max-content; padding: 10px 16px; border-radius: 20px;
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 14px; text-align: center;
  opacity: 0; transform: translate(-50%, 16px); transition: opacity .3s, transform .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .route { stroke-dashoffset: 0; }
}
