:root {
  --bg: #05040a;
  --amber: #ffb347;
  --marigold: #ff9f1c;
  --cream: #fff1d6;
  --muted: rgba(255, 236, 205, 0.55);
  --line: rgba(255, 200, 140, 0.18);
  --serif: "Cormorant Garamond", "Noto Serif Devanagari", "Noto Serif Tamil", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.ui { position: fixed; inset: 0; pointer-events: none; }

.top {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 0; right: 0;
  display: flex; justify-content: center; gap: 10px;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted);
  transition: opacity 2s ease;
}
.top .deva, .top .tamil { letter-spacing: 0.05em; text-transform: none; font-size: 14px; }
.top .deva { font-family: "Noto Serif Devanagari", serif; }
.top .tamil { font-family: "Noto Serif Tamil", serif; }
.dot { opacity: 0.5; }

.intro {
  position: absolute; left: 16px; right: 16px; top: 18vh;
  text-align: center;
  transition: opacity 1.4s ease, transform 1.8s ease, filter 1.4s ease;
}
.intro .for {
  font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--muted);
}
.intro h1 {
  font-family: var(--serif); font-weight: 500; font-style: italic;
  font-size: clamp(44px, 11vw, 88px); line-height: 1.05; margin-top: 4px;
  color: var(--cream);
  text-shadow: 0 0 40px rgba(255, 170, 80, 0.25);
}
.intro.gone { opacity: 0; transform: translateY(-20px); filter: blur(6px); }

.hold-wrap {
  position: absolute; left: 0; right: 0; bottom: max(64px, calc(env(safe-area-inset-bottom) + 52px));
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  transition: opacity 1s ease;
}
.hold-wrap.gone { opacity: 0; }
.hold { position: relative; width: 64px; height: 64px; }
.hold svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hold circle { fill: none; stroke-width: 2; }
.hold .track { stroke: var(--line); }
.hold .ring {
  stroke: var(--amber);
  stroke-linecap: round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
  filter: drop-shadow(0 0 6px rgba(255, 170, 70, 0.8));
}
.hold .ember {
  position: absolute; inset: 0; margin: auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 14px 4px rgba(255, 160, 60, 0.6);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.6); opacity: 0.6; } }
.hint { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }

.wish {
  position: absolute; inset: 0;
  --wish-top: 48vh;
  opacity: 0;
  transition: opacity 2.2s ease;
}
.wish.show { opacity: 1; }
.wish.show .actions { pointer-events: auto; }
.scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 22% at 50% calc(var(--wish-top) + 70px), rgba(5, 4, 10, 0.78), rgba(5, 4, 10, 0) 70%),
    linear-gradient(to bottom, rgba(5, 4, 10, 0) 55%, rgba(5, 4, 10, 0.55) 78%, rgba(5, 4, 10, 0.92) 100%);
}
.wish-text {
  position: absolute; left: 16px; right: 16px; top: var(--wish-top);
  text-align: center;
  transform: translateY(14px);
  transition: transform 2.4s cubic-bezier(.2,.7,.2,1);
}
.wish.show .wish-text { transform: none; }
.happy {
  font-size: 12px; font-weight: 600; letter-spacing: 0.42em; text-transform: uppercase;
  color: #ffcf86; text-shadow: 0 0 18px rgba(255, 160, 60, 0.55);
}
.wish-line {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: clamp(22px, 4.6vw, 32px); line-height: 1.3;
  max-width: 520px; margin: 12px auto 0; text-wrap: balance;
  color: #fff6e6;
  text-shadow: 0 2px 18px rgba(5, 4, 10, 0.95), 0 0 2px rgba(5, 4, 10, 0.9);
}
.from {
  font-family: var(--serif); font-style: italic; font-size: 19px; margin-top: 10px; min-height: 1em;
  color: #f3c98e; text-shadow: 0 2px 14px rgba(5, 4, 10, 0.95);
}
.actions {
  position: absolute; left: 16px; right: 16px;
  bottom: max(56px, calc(env(safe-area-inset-bottom) + 44px));
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.btn.ghost { background: rgba(10, 7, 14, 0.55); }

.btn {
  font: 500 14px var(--sans); letter-spacing: 0.02em;
  padding: 12px 20px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255, 200, 140, 0.06); color: var(--cream);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn:hover { background: rgba(255, 200, 140, 0.12); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(180deg, #ffc46b, #ff9a2e); color: #2a1300; border-color: transparent;
  box-shadow: 0 6px 30px rgba(255, 150, 50, 0.35);
}

.maker {
  border: 1px solid var(--line); border-radius: 22px; padding: 28px 22px 22px;
  width: min(420px, calc(100% - 32px));
  background: rgba(18, 12, 20, 0.92); color: var(--cream);
  user-select: text; -webkit-user-select: text;
}
.maker::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); }
.maker form { display: flex; flex-direction: column; gap: 16px; position: relative; }
.maker h2 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 28px; }
.maker label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.maker .opt { opacity: 0.7; }
.maker input {
  font: 500 17px var(--sans); color: var(--cream);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none;
}
.maker input:focus { border-color: var(--amber); }
.link-box { display: flex; flex-direction: column; gap: 10px; }
.link-box code {
  font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 179, 71, 0.08);
  color: var(--amber); word-break: break-all;
}
.link-box .row { display: flex; gap: 8px; flex-wrap: wrap; }
.link-box .row .btn { flex: 1; }
.close {
  position: absolute; top: -18px; right: -8px; background: none; border: 0;
  color: var(--muted); font-size: 28px; cursor: pointer;
}

body { cursor: grab; }
body.grabbing { cursor: grabbing; }
.hint {
  padding: 10px 18px; border-radius: 999px;
  background: rgba(10, 7, 14, 0.55); border: 1px solid var(--line);
  color: #f6dcb4; font-weight: 500;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.hint.swap { opacity: 0; transform: translateY(4px); }

.brand {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
  pointer-events: auto;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255, 236, 205, 0.4); text-decoration: none;
  transition: color 0.3s ease;
}
.brand span { color: rgba(255, 207, 134, 0.75); font-weight: 600; }
.brand:hover, .brand:hover span { color: #ffcf86; }
