/* =================================================================
   تسنيم 🌹 — romantic one-page gift
   Mobile-first. Pink/rose theme. RTL (handled by <html dir="rtl">).
   ================================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --rose-50:  #fff6f9;   /* blush background */
  --rose-100: #ffe9f0;
  --rose-200: #ffd6e3;
  --rose-300: #ffbcd2;
  --pink:     #ff8fb0;
  --rose:     #f4729a;
  --rose-deep:#e25586;   /* accent for buttons/links */
  --heart:    #ff4d6d;   /* hearts red */
  --ink:      #5d3b48;   /* warm rose-brown text */
  --ink-soft: #95707e;   /* muted text */
  --white:    #ffffff;

  --radius:   22px;
  --radius-sm:14px;
  --shadow:   0 12px 34px rgba(226, 85, 134, 0.16);
  --shadow-sm:0 6px 18px rgba(226, 85, 134, 0.14);
  --ring:     0 0 0 4px rgba(244, 114, 154, 0.22);
}

/* ---------- Reset-ish ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, var(--rose-200), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, var(--rose-100), transparent 55%),
    linear-gradient(170deg, var(--rose-50), var(--rose-100) 55%, var(--rose-200));
  background-attachment: fixed;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* lock scroll while the gate is up */
body.locked { overflow: hidden; }

h1, h2 { margin: 0 0 .4em; font-weight: 800; line-height: 1.25; }
p { margin: 0 0 1rem; }

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  min-height: 52px;            /* tap-friendly */
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover  { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn-ghost {
  background: var(--white);
  color: var(--rose-deep);
  box-shadow: inset 0 0 0 2px var(--rose-200), var(--shadow-sm);
}

.big-btn { font-size: 1.2rem; padding: 1rem 2rem; }

/* =================================================================
   0) Password gate
   ================================================================= */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background:
    radial-gradient(800px 500px at 50% -10%, var(--rose-200), transparent 60%),
    linear-gradient(170deg, var(--rose-50), var(--rose-200));
  transition: opacity .6s ease, visibility .6s ease;
}
.gate.hidden { opacity: 0; visibility: hidden; }

.gate-card {
  width: min(420px, 100%);
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem 1.6rem;
  text-align: center;
  animation: pop-in .5s ease both;
}
.gate-q { font-size: 1.6rem; color: var(--rose-deep); }

.gate-form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }
.gate-input {
  font-family: inherit;
  font-size: 1.1rem;
  text-align: center;
  padding: 0.85rem 1rem;
  min-height: 52px;
  border: 2px solid var(--rose-200);
  border-radius: 999px;
  color: var(--ink);
  background: var(--rose-50);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.gate-input::placeholder { color: var(--ink-soft); opacity: .8; }
.gate-input:focus { outline: none; border-color: var(--rose); box-shadow: var(--ring); }

.gate-hint { min-height: 1.4em; margin: .9rem 0 0; color: var(--rose-deep); font-weight: 500; }
.gate-card.shake { animation: shake .4s ease; }

/* =================================================================
   The site
   ================================================================= */
.site { opacity: 0; transition: opacity .8s ease .15s; }
.site.revealed { opacity: 1; }

section, .menu { padding: clamp(2.5rem, 8vw, 5rem) 1.1rem; }

/* ---------- 1) Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-content { position: relative; z-index: 1; max-width: 640px; }

.hero-name {
  font-size: clamp(3.6rem, 18vw, 7rem);
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: .5px;
  margin-bottom: .1em;
  filter: drop-shadow(0 6px 16px rgba(226, 85, 134, 0.18));
}
.hero-greet { font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 700; color: var(--rose-deep); margin-bottom: 1.2rem; }
.hero-sub  { font-size: clamp(1.05rem, 4.4vw, 1.3rem); color: var(--ink); }
.hero-note { font-size: clamp(.95rem, 3.8vw, 1.1rem); color: var(--ink-soft); margin-top: .4rem; }

/* welcome call-to-action (tap to open the dashboard) */
.cta { display: inline-block; margin-top: 2rem; text-decoration: none; font-size: 1.15rem; padding: 1rem 2.4rem; }

/* floating heart glyphs in the hero */
.petal {
  position: absolute;
  bottom: -10%;
  color: var(--heart);
  opacity: .5;
  will-change: transform, opacity;
  animation: float-up linear infinite;
  user-select: none;
}

/* ---------- 2) Menu ---------- */
.menu { text-align: center; }
.menu-title { font-size: 1.7rem; color: var(--rose-deep); margin-bottom: .2rem; }
.menu-hint { color: var(--ink-soft); margin-bottom: 1.3rem; }
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .9rem;
  max-width: 760px;
  margin: 0 auto;
}
.card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 92px;
  padding: 1rem;
  background: var(--white);
  color: var(--rose-deep);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .2s ease;
}
.card::after { /* soft rose accent corner — not an emoji */
  content: "";
  position: absolute;
  inset-block-start: -18px;
  inset-inline-start: -18px;
  width: 46px; height: 46px;
  background: radial-gradient(circle at center, var(--rose-200), transparent 70%);
}
.card:hover  { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:active { transform: translateY(0) scale(.99); }

/* ---------- Rooms (shared) ---------- */
.room { scroll-margin-top: 12px; }
.room-title { text-align: center; font-size: clamp(1.6rem, 6vw, 2.2rem); color: var(--rose-deep); }

.room-body {
  max-width: 620px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.4rem, 5vw, 2.2rem);
}
.room-body.center { text-align: center; }

.back {
  display: inline-block;
  margin: 0 auto 1rem;
  color: var(--rose-deep);
  text-decoration: none;
  font-weight: 700;
  font-size: .98rem;
  opacity: .85;
}
.room { text-align: center; }
.back:hover { opacity: 1; }

.msg { min-height: 1.6em; margin: 1.2rem 0 0; font-size: 1.15rem; font-weight: 500; color: var(--ink); }
.msg.quote { font-size: 1.2rem; line-height: 1.9; }

/* ---------- 5) Game ---------- */
.game-hint { color: var(--ink-soft); margin-bottom: .6rem; }
.game-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 420px;
  margin: 0 auto .8rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rose-deep);
}
.game-area {
  position: relative;
  height: clamp(340px, 56vh, 460px);
  margin: 0 auto 1rem;
  max-width: 460px;
  background: linear-gradient(180deg, var(--rose-50), var(--rose-100));
  border: 2px dashed var(--rose-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  touch-action: manipulation;
}
.game-area.shake { animation: shake .3s ease; }

.drop {
  position: absolute;
  top: -14%;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  will-change: top, transform;
  touch-action: manipulation;
}
.drop.popped { animation: pop-away .25s ease forwards; pointer-events: none; }

.float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 700;
  color: var(--rose-deep);
  pointer-events: none;
  white-space: nowrap;
  animation: rise-fade .8s ease forwards;
}

/* ---------- 6) Love meter ---------- */
.meter {
  height: 26px;
  max-width: 460px;
  margin: 1.5rem auto .6rem;
  background: var(--rose-100);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(226,85,134,.14);
}
.meter-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--heart));
}
.meter-fill.broken { animation: jitter .25s linear infinite; }
.meter-num { font-size: 1.5rem; font-weight: 800; color: var(--rose-deep); min-height: 1.4em; }

/* ---------- 7) Love (yes / runaway no) ---------- */
.love-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
#no-btn { transition: none; }   /* it teleports; no slide */
#no-btn.fixed { position: fixed; z-index: 60; margin: 0; }

/* ---------- 8) Letter ---------- */
.letter {
  font-family: "Amiri", "Tajawal", serif;
  text-align: center;
  font-size: clamp(1.15rem, 4.6vw, 1.5rem);
  line-height: 2.4;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fffafc, var(--white));
  border: 1px solid var(--rose-200);
  border-radius: var(--radius-sm);
  padding: clamp(1.4rem, 6vw, 2.4rem);
}
.letter .stanza + .stanza { margin-top: 1.6rem; }
.letter p { margin: 0; }

/* heart-burst particles (love confirmation + game end) */
.burst-heart {
  position: fixed;
  z-index: 80;
  font-size: 24px;
  pointer-events: none;
  will-change: transform, opacity;
  animation: burst .9s ease-out forwards;
}

/* =================================================================
   Views — one screen at a time (welcome → dashboard → room).
   The active view keeps its own display (hero=grid, others=block);
   inactive views are removed from the flow entirely.
   ================================================================= */
.view:not(.active) { display: none; }
.view.active { animation: viewIn .45s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* =================================================================
   Keyframes
   ================================================================= */
@keyframes pop-in   { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes shake    { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
@keyframes jitter   { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-2px)} 75%{transform:translateX(2px)} }
@keyframes pop-away { to { transform: scale(1.6); opacity: 0; } }
@keyframes rise-fade{ from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -120%); } }

@keyframes float-up {
  0%   { transform: translateY(0) rotate(0deg) scale(1); opacity: 0; }
  10%  { opacity: .6; }
  90%  { opacity: .5; }
  100% { transform: translateY(-112svh) rotate(220deg) scale(1.1); opacity: 0; }
}
@keyframes burst {
  0%   { transform: translate(0,0) scale(.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 0; }
}

/* =================================================================
   Larger screens
   ================================================================= */
@media (min-width: 720px) {
  .menu-grid { grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
  .card { min-height: 110px; font-size: 1.2rem; }
}

/* Respect reduced-motion: keep it calm */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .petal, .meter-fill.broken, .view.active { animation: none; }
}
