*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #070b1c;
  --cream: #fdf6ec;
  --amber: #ffb45e;
  --amber-deep: #e07a2e;
  --ink-dim: rgba(253, 246, 236, 0.55);
}

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg);
  color: var(--cream);
  font-family: 'Poppins', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#stage { position: fixed; inset: 0; z-index: 1; display: block; touch-action: manipulation; }

/* ---------------- overlay text ---------------- */
.overlay-ui { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.hello {
  position: absolute; top: clamp(1.4rem, 6vh, 3.4rem); left: 0; right: 0;
  text-align: center;
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: clamp(1.15rem, 4.2vw, 1.8rem);
  color: rgba(253, 246, 236, 0.92);
  text-shadow: 0 0 30px rgba(255, 180, 94, 0.35);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
.hello.show { opacity: 1; transform: none; }
.overlay-bottom {
  position: absolute; left: 0; right: 0;
  bottom: clamp(1.6rem, 7vh, 4rem);
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  text-align: center; padding: 0 1rem;
}
.tagline {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: clamp(1.05rem, 3.4vw, 1.55rem);
  color: rgba(253, 246, 236, 0.92);
  text-shadow: 0 0 26px rgba(255, 180, 94, 0.45);
  opacity: 0; transform: translateY(10px);
  transition: opacity 1.2s ease, transform 1.2s ease;
  max-width: 90vw;
}
.tagline.show { opacity: 1; transform: none; }
.hint {
  font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(253, 246, 236, 0.32);
  opacity: 0; transition: opacity 1.2s ease;
}
.hint.show { opacity: 1; }

/* ---------------- opened lantern card ---------------- */
.note { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1.4rem; }
.note[hidden] { display: none; }
.note__backdrop { position: absolute; inset: 0; background: rgba(4, 6, 16, 0.68); backdrop-filter: blur(5px); animation: fadeIn 0.4s ease; }
.note__card {
  position: relative; z-index: 1; width: 100%; max-width: 28rem;
  background: linear-gradient(180deg, #fff9ee 0%, #ffedd4 100%);
  color: #4a2f18;
  border-radius: 18px; padding: 2.3rem 1.9rem 1.8rem; text-align: center;
  box-shadow: 0 0 60px rgba(255, 180, 94, 0.25), 0 30px 70px rgba(0, 0, 0, 0.5);
  animation: cardIn 0.55s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
.note__card::before {
  content: "🏮"; position: absolute; top: -1.15rem; left: 50%; transform: translateX(-50%);
  font-size: 1.6rem; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
}
.note__eyebrow { font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: #c96f24; margin-bottom: 1rem; }
.note__text { font-family: 'Playfair Display', serif; font-style: italic; font-size: clamp(1.2rem, 4.6vw, 1.55rem); line-height: 1.55; }
.note__keep {
  margin-top: 1.7rem; border: none; border-radius: 50px; cursor: pointer;
  padding: 0.68rem 1.6rem; font-family: 'Poppins', sans-serif; font-size: 0.85rem; font-weight: 500;
  color: #3a2408; background: linear-gradient(135deg, #ffd9a0, #ff9d3f);
  box-shadow: 0 8px 22px rgba(255, 157, 63, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.note__keep:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(255, 157, 63, 0.5); }
@keyframes cardIn { from { opacity: 0; transform: translateY(22px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- customise button ---------------- */
.edit-fab {
  position: fixed; top: 1rem; right: 1rem; z-index: 60;
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: rgba(10, 14, 32, 0.6); backdrop-filter: blur(10px);
  border: 1px solid rgba(253, 246, 236, 0.16); border-radius: 50px;
  color: var(--cream); font-family: 'Poppins', sans-serif; font-size: 0.82rem;
  padding: 0.55rem 1.1rem; cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  animation: editPulse 2.8s ease-in-out infinite;
}
.edit-fab[hidden] { display: none; }
.edit-fab:hover { background: rgba(255, 180, 94, 0.3); transform: translateY(-1px); }
.edit-fab__ico { color: var(--amber); }
@keyframes editPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 180, 94, 0); }
  50%      { box-shadow: 0 0 0 8px rgba(255, 180, 94, 0.10); }
}

/* ---------------- editor ---------------- */
.ed-screen {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% -10%, #1a2142 0%, #0e1226 60%, #080b18 100%);
}
.ed-screen[hidden] { display: none; }
.ed-wrap { max-width: 640px; margin: 0 auto; padding: clamp(2rem, 6vw, 4rem) clamp(1.1rem, 5vw, 2rem) 5rem; }
.ed-head { text-align: center; margin-bottom: 2.2rem; }
.ed-kicker { font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--amber); margin-bottom: 0.9rem; }
.ed-title { font-family: 'Playfair Display', serif; font-weight: 600; font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.06; color: var(--cream); }
.ed-sub { margin: 1rem auto 0; max-width: 32rem; font-size: 0.95rem; line-height: 1.7; font-weight: 300; color: rgba(253, 246, 236, 0.6); }

.ed-card {
  background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(253, 246, 236, 0.08);
  border-radius: 18px; padding: clamp(1.2rem, 4vw, 1.8rem); margin-bottom: 1.4rem;
}
.ed-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; }
.ed-field:last-child { margin-bottom: 0; }
.ed-field > span { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(253, 246, 236, 0.5); }
.ed-field input {
  width: 100%; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(253, 246, 236, 0.12);
  border-radius: 10px; color: var(--cream); font-family: 'Poppins', sans-serif; font-size: 0.95rem;
  padding: 0.7rem 0.85rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.ed-field input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 180, 94, 0.18); }
.ed-field input::placeholder { color: rgba(253, 246, 236, 0.3); }

.ed-msg-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.9rem; }
.ed-flabel { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(253, 246, 236, 0.5); }
.ed-msg-count { font-size: 0.72rem; color: rgba(253, 246, 236, 0.4); }
.ed-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.ed-row { display: flex; align-items: center; gap: 0.55rem; }
.ed-dot { flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd9a0, #e07a2e);
  box-shadow: 0 0 8px rgba(255, 180, 94, 0.5); }
.ed-row input {
  flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(253, 246, 236, 0.12);
  border-radius: 10px; color: var(--cream); font-family: 'Poppins', sans-serif; font-size: 0.92rem;
  padding: 0.65rem 0.8rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.ed-row input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255, 180, 94, 0.18); }
.ed-del {
  flex: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(253, 246, 236, 0.12);
  color: rgba(253, 246, 236, 0.55); font-size: 0.95rem; line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.ed-del:hover { background: rgba(255, 120, 90, 0.25); color: #fff; }

.ed-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1.6rem; }
.ed-btn { font-family: 'Poppins', sans-serif; font-size: 0.95rem; font-weight: 500; border-radius: 50px; padding: 0.85rem 1.8rem; cursor: pointer; border: none; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s; }
.ed-btn--sm { padding: 0.6rem 1.2rem; font-size: 0.86rem; }
.ed-btn--solid { background: linear-gradient(135deg, #ffd9a0 0%, #ff9d3f 100%); color: #3a2408; box-shadow: 0 8px 26px rgba(255, 157, 63, 0.32); }
.ed-btn--solid:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(255, 157, 63, 0.42); }
.ed-btn--ghost { background: transparent; color: var(--cream); border: 1px solid rgba(253, 246, 236, 0.2); }
.ed-btn--ghost:hover { background: rgba(255, 255, 255, 0.06); }
.ed-foot { margin-top: 2rem; text-align: center; font-size: 0.8rem; color: rgba(253, 246, 236, 0.35); }
.ed-foot a { color: var(--amber); text-decoration: none; }
.ed-foot a:hover { text-decoration: underline; }

/* ---------------- share modal ---------------- */
.ed-share { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.ed-share[hidden] { display: none; }
.ed-share-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 14, 0.74); backdrop-filter: blur(4px); }
.ed-share-box { position: relative; z-index: 1; width: 100%; max-width: 30rem; background: linear-gradient(180deg, #1a2142 0%, #101430 100%); border: 1px solid rgba(253, 246, 236, 0.1); border-radius: 20px; padding: 2rem 1.6rem 1.8rem; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.ed-share-x { position: absolute; top: 0.8rem; right: 0.9rem; background: none; border: none; color: rgba(253, 246, 236, 0.5); font-size: 1rem; cursor: pointer; }
.ed-share-box h3 { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--cream); margin-bottom: 0.5rem; }
.ed-share-box > p { font-size: 0.88rem; color: rgba(253, 246, 236, 0.6); line-height: 1.6; margin-bottom: 1.2rem; }
.ed-share-row { display: flex; gap: 0.5rem; }
.ed-share-link { flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(253, 246, 236, 0.12); border-radius: 10px; color: var(--amber); font-family: ui-monospace, monospace; font-size: 0.8rem; padding: 0.7rem 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-share-open { display: inline-block; margin-top: 1rem; color: var(--amber); font-size: 0.85rem; text-decoration: none; }
.ed-share-open:hover { text-decoration: underline; }
.ed-share-note { margin: 0.9rem 0 0; font-size: 0.75rem; color: rgba(253, 246, 236, 0.4); }

@media (prefers-reduced-motion: reduce) {
  .edit-fab, .note__card, .note__backdrop { animation: none !important; }
}
