:root {
  --bg: #0a0617;
  --bg2: #1d0d33;
  --ink: #fff4e0;
  --muted: #c9b8dd;
  --gold: #ffc86b;
  --saffron: #ff8a2a;
  --card: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 214, 140, 0.25);
  --wa: #25d366;
}

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

html, body { margin: 0; min-height: 100%; }

body {
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", "Noto Sans", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.stage {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
}

canvas.diya {
  display: block;
  width: calc(100% + 32px);
  margin: 0 -16px;
  height: 36vh; /* short enough that the form / wish text stays near the top on phones */
  min-height: 220px;
  max-height: 340px;
}

h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.25;
  margin: 8px 0 8px;
  text-align: center;
  font-weight: 700;
}

.sub, .hint, .from, .chain, .note {
  text-align: center;
  color: var(--muted);
  margin: 4px 0 12px;
}

.hint { font-size: 0.95rem; animation: pulse 2.2s ease-in-out infinite; min-height: 1.5em; }
@keyframes pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

.from { color: var(--gold); font-weight: 600; }
.chain { color: var(--ink); font-weight: 600; }

.hidden { display: none !important; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-top: 16px;
  backdrop-filter: blur(6px);
}

.card h2 { font-size: 1.1rem; margin: 0 0 4px; text-align: center; }
.card .note { margin-bottom: 12px; font-size: 0.9rem; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 4px; }

input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
}
input[type="text"]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: #2b1100;
  background: linear-gradient(180deg, #ffd27a, var(--saffron));
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:active, .btn:active { transform: scale(0.98); }
button:disabled { filter: grayscale(0.6) brightness(0.8); cursor: default; }

.btn.wa { background: var(--wa); color: #04210f; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.langs {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 0 0;
}
.langs button {
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.langs button[aria-pressed="true"] { background: var(--gold); color: #2b1100; border-color: var(--gold); }

.counter { text-align: center; color: var(--gold); font-weight: 600; margin: 18px 0 0; min-height: 1.5em; }

.notice { color: var(--gold); text-align: center; margin: 12px 0 0; font-weight: 600; }

.error { color: #ff9a9a; text-align: center; min-height: 1.4em; margin: 10px 0 0; font-size: 0.9rem; }

.wish { animation: rise 0.7s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.linkbox {
  word-break: break-all;
  font-size: 0.85rem;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0 0;
  text-align: center;
}

footer { text-align: center; color: var(--muted); font-size: 0.75rem; margin-top: 28px; opacity: 0.8; }

@media (prefers-reduced-motion: reduce) {
  .hint, .wish { animation: none; }
}
