/* بيننا · Between Us — warm paper & ink */

:root {
  --bg: #faf6ef;
  --bg-2: #f2ebdd;
  --card: #fffdf8;
  --card-2: #fbf5ea;
  --ink: #2b2333;
  --ink-2: #6f6579;
  --ink-3: #a39aa8;
  --accent: #c96f4a;
  --accent-deep: #a8552f;
  --accent-soft: #f3ddd2;
  --rose: #e8b4a0;
  --gold: #c9a227;
  --sage: #8a9b7a;
  --line: #e8dfcd;
  --shadow: 0 2px 12px rgba(80, 60, 40, .07), 0 12px 40px rgba(80, 60, 40, .06);
  --shadow-lift: 0 4px 18px rgba(80, 60, 40, .12), 0 18px 60px rgba(80, 60, 40, .10);
  --radius: 18px;
  --font-display: 'Fraunces', 'Amiri', georgia, serif;
  /* Noto Sans Arabic first: its unicode-range limits it to Arabic glyphs,
     so Latin still falls through to the system font. */
  --font-body: 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.22, .8, .3, 1);
}
[data-theme="dark"] {
  --bg: #211d26;
  --bg-2: #191621;
  --card: #2c2733;
  --card-2: #332d3b;
  --ink: #f0e9e0;
  --ink-2: #b3a8b8;
  --ink-3: #7d7385;
  --accent: #e08a63;
  --accent-deep: #eda27f;
  --accent-soft: #4a3830;
  --rose: #8a5747;
  --gold: #d8b64a;
  --sage: #93a884;
  --line: #3d3745;
  --shadow: 0 2px 12px rgba(0, 0, 0, .25), 0 12px 40px rgba(0, 0, 0, .25);
  --shadow-lift: 0 4px 18px rgba(0, 0, 0, .35), 0 18px 60px rgba(0, 0, 0, .35);
}
[dir="rtl"] {
  --font-display: 'Amiri', 'Fraunces', georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  transition: background .4s, color .4s;
  -webkit-font-smoothing: antialiased;
}
body::before { /* soft paper wash */
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, color-mix(in srgb, var(--rose) 16%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--sage) 12%, transparent), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 20px 18px 110px; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; line-height: 1.25; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] .display { font-weight: 700; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---------- boot ---------- */
.boot-heart { display: grid; place-items: center; min-height: 70dvh; }
.boot-pulse {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .55; }
  50% { transform: scale(1.7); opacity: 1; }
}

/* ---------- shared components ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  animation: rise .5s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.stack > * + * { margin-top: 14px; }
.screen-title { font-size: 1.7rem; margin: 18px 4px 4px; animation: rise .45s var(--ease) both; }
.screen-sub { color: var(--ink-2); margin: 0 4px 18px; animation: rise .5s var(--ease) both; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 1rem;
  box-shadow: 0 3px 14px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .18s var(--ease), box-shadow .18s, background .18s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; border: 1.5px solid var(--accent); }
.btn.subtle { background: var(--card-2); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.btn.big { padding: 15px 30px; font-size: 1.08rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--line);
  font-size: .92rem; transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .88rem; color: var(--ink-2); margin-bottom: 6px; }
.input, textarea.input {
  width: 100%;
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { min-height: 130px; resize: vertical; line-height: 1.7; }

.progress-track { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rose), var(--accent)); transition: width .7s var(--ease); }

/* ---------- nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: center; gap: 2px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 8px max(10px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
}
.nav button {
  flex: 1; max-width: 86px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 12px;
  font-size: .62rem; color: var(--ink-2);
  transition: color .15s, background .15s;
}
.nav button .ico { font-size: 1.25rem; line-height: 1; filter: grayscale(.4) opacity(.75); transition: filter .15s, transform .2s var(--ease); }
.nav button.on { color: var(--accent-deep); }
.nav button.on .ico { filter: none; transform: translateY(-2px); }

/* ---------- gate (setup / claim / login) ---------- */
.gate { min-height: 88dvh; display: flex; flex-direction: column; justify-content: center; }
.gate-logo { text-align: center; margin-bottom: 26px; animation: rise .6s var(--ease) both; }
.gate-logo .mark { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.gate-logo h1 { font-size: 2rem; }
.gate-logo .tag { color: var(--ink-2); margin-top: 6px; font-size: .95rem; }
.person-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.person-pick button {
  padding: 22px 10px; border-radius: var(--radius);
  background: var(--card); border: 1.5px solid var(--line);
  font-family: var(--font-display); font-size: 1.15rem;
  transition: all .18s var(--ease);
}
.person-pick button:hover, .person-pick button.on { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.invite-code-box {
  font-family: var(--font-display); font-size: 2rem; letter-spacing: .18em;
  text-align: center; direction: ltr;
  background: var(--accent-soft); border: 2px dashed var(--accent);
  border-radius: var(--radius); padding: 22px; margin: 14px 0;
  user-select: all;
}
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-pick button {
  padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  font-size: 1rem; transition: all .15s var(--ease);
}
.lang-pick button.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- home ---------- */
.greeting { font-size: 1.8rem; margin: 10px 4px 2px; }
.greeting-sub { color: var(--ink-2); margin: 0 4px 18px; }
.home-cards { display: flex; flex-direction: column; gap: 14px; }
.card .card-kicker {
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-deep); font-weight: 700; margin-bottom: 8px;
}
[dir="rtl"] .card .card-kicker { letter-spacing: 0; }
.mood-row { display: flex; gap: 6px; justify-content: space-between; margin: 10px 0; }
.mood-row button {
  font-size: 1.7rem; padding: 8px; border-radius: 14px; flex: 1;
  filter: grayscale(.8) opacity(.6);
  transition: all .18s var(--ease);
}
.mood-row button.on { filter: none; background: var(--accent-soft); transform: scale(1.12); }
.dots { display: flex; gap: 10px; justify-content: center; margin: 8px 0 4px; }
.dots button {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-2); border: 1.5px solid var(--line);
  transition: all .15s var(--ease);
}
.dots button.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.partner-checkin { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card-2); border-radius: 14px; }
.partner-checkin .emo { font-size: 1.9rem; }
.waiting-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-soft); color: var(--accent-deep);
  border-radius: 999px; padding: 6px 14px; font-size: .85rem; font-weight: 600;
}
.waiting-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }

/* ---------- journey ---------- */
.chapter-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-inline-start: 5px solid var(--ch, var(--accent));
  transition: transform .18s var(--ease), box-shadow .18s;
  animation: rise .5s var(--ease) both;
}
.chapter-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.chapter-card .ch-icon { font-size: 1.9rem; }
.chapter-card .ch-body { flex: 1; min-width: 0; }
.chapter-card h3 { font-size: 1.15rem; }
.chapter-card .ch-tag { font-size: .85rem; color: var(--ink-2); margin: 2px 0 8px; }
.meter-card { background: linear-gradient(135deg, var(--card), var(--card-2)); }
.meter-heart { font-size: 2rem; text-align: center; }

.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  transition: transform .15s var(--ease), border-color .15s;
  animation: rise .4s var(--ease) both;
}
.item-row:hover { transform: translateX(3px); border-color: var(--accent); }
[dir="rtl"] .item-row:hover { transform: translateX(-3px); }
.item-row .st { font-size: 1.15rem; width: 26px; text-align: center; flex-shrink: 0; }
.item-row .txt { flex: 1; font-size: .95rem; }
.item-row.done { opacity: .75; }

/* ---------- item screen ---------- */
.q-display {
  font-family: var(--font-display); font-size: 1.45rem; line-height: 1.45;
  margin: 10px 0 6px;
  animation: rise .5s var(--ease) both;
}
.q-other-lang {
  font-size: 1.02rem; color: var(--ink-2); line-height: 1.7; margin-bottom: 8px;
  font-family: var(--font-display);
  animation: rise .6s var(--ease) both;
}
.q-hint { font-size: .88rem; color: var(--ink-2); background: var(--card-2); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.q-hint::before { content: '✧ '; color: var(--gold); }
.scenario-badge {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  color: var(--sage); border: 1px solid var(--sage); border-radius: 999px;
  padding: 3px 12px; margin-bottom: 8px; text-transform: uppercase;
}
[dir="rtl"] .scenario-badge { letter-spacing: 0; }

.sealed-wait { text-align: center; padding: 30px 16px; }
.envelope {
  width: 92px; height: 66px; margin: 0 auto 18px; position: relative;
  background: var(--accent-soft); border: 2px solid var(--accent); border-radius: 8px;
  animation: float 3.4s ease-in-out infinite;
}
.envelope::before {
  content: ''; position: absolute; inset: 0;
  border-bottom: 2px solid var(--accent);
  clip-path: polygon(0 0, 50% 62%, 100% 0);
  background: color-mix(in srgb, var(--accent) 22%, var(--accent-soft));
  border-radius: 6px 6px 0 0;
}
.envelope::after {
  content: '♡'; position: absolute; left: 50%; top: 58%;
  transform: translate(-50%, -50%); color: var(--accent-deep); font-size: 1.05rem;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-7px) rotate(1.5deg); }
}

.reveal-grid { display: grid; gap: 12px; margin: 14px 0; }
@media (min-width: 560px) { .reveal-grid { grid-template-columns: 1fr 1fr; } }
.answer-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  animation: unfold .7s var(--ease) both;
  transform-origin: top center;
}
.answer-card:nth-child(2) { animation-delay: .35s; }
@keyframes unfold {
  from { opacity: 0; transform: perspective(700px) rotateX(-24deg) translateY(12px); }
  to { opacity: 1; transform: none; }
}
.answer-card .who {
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-deep); margin-bottom: 8px;
}
[dir="rtl"] .answer-card .who { letter-spacing: 0; }
.answer-card .body { white-space: pre-wrap; line-height: 1.7; }
.guess-box {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: var(--card-2); border: 1px dashed var(--line);
  font-size: .92rem;
}
.guess-box .who { font-size: .74rem; color: var(--ink-2); font-weight: 700; margin-bottom: 4px; }
.followups { margin: 16px 0; }
.followups li {
  list-style: none; padding: 12px 16px; margin-bottom: 8px;
  background: var(--card-2); border-radius: 12px; font-size: .95rem;
  border-inline-start: 3px solid var(--gold);
  animation: rise .4s var(--ease) both;
}
.followups li:nth-child(2) { animation-delay: .08s; }
.followups li:nth-child(3) { animation-delay: .16s; }
.followups li:nth-child(4) { animation-delay: .24s; }
.followups li .fu-other { display: block; font-size: .82rem; color: var(--ink-2); margin-top: 3px; }

.reveal-cta { text-align: center; padding: 24px 10px; }
.match-meter { text-align: center; margin: 12px 0; }

/* ---------- date night ---------- */
.dn-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.dn-pick button {
  padding: 24px 8px; border-radius: var(--radius);
  background: var(--card); border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  transition: all .18s var(--ease);
}
.dn-pick button:hover { border-color: var(--accent); transform: translateY(-3px); }
.dn-pick .n { display: block; font-family: var(--font-display); font-size: 1.9rem; color: var(--accent-deep); }
.dn-step-card { min-height: 260px; display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 30px 22px; }
.dn-step-card .pool-badge {
  align-self: center; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sage); margin-bottom: 14px;
}
[dir="rtl"] .dn-step-card .pool-badge { letter-spacing: 0; }
.dn-step-card .txt { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.5; }
.dn-step-card .other { color: var(--ink-2); font-size: .98rem; margin-top: 10px; font-family: var(--font-display); }
.dn-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }

/* ---------- journal ---------- */
.journal-entry { animation: rise .45s var(--ease) both; }
.journal-entry .meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--ink-2); margin-bottom: 8px; }
.journal-entry .prompt-label { font-size: .82rem; color: var(--accent-deep); font-weight: 600; margin-bottom: 4px; }
.journal-entry .body { white-space: pre-wrap; }

/* ---------- letters ---------- */
.letter-card { position: relative; overflow: hidden; }
.letter-card.sealed { background: linear-gradient(135deg, var(--card), var(--accent-soft)); }
.letter-card .seal {
  position: absolute; top: 14px; inset-inline-end: 14px;
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent), var(--accent-deep));
  display: grid; place-items: center; color: #fff; font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.letter-card h3 { padding-inline-end: 54px; }
.countdown { font-family: var(--font-display); font-size: 1.05rem; color: var(--accent-deep); }
.letter-open-anim { animation: unfold .8s var(--ease) both; }
.letter-body { white-space: pre-wrap; line-height: 1.8; font-size: 1.02rem; }

/* ---------- constitution ---------- */
.const-section { margin-bottom: 14px; }
.const-section .sec-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.const-section .sec-head h3 { font-size: 1.1rem; }
.const-section .arrow { transition: transform .25s var(--ease); color: var(--ink-3); }
.const-section.open .arrow { transform: rotate(180deg); }
.const-body { display: none; margin-top: 12px; }
.const-section.open .const-body { display: block; }
.sig-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.sig {
  flex: 1; min-width: 130px; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px;
  font-size: .85rem; color: var(--ink-2);
}
.sig.signed { border-style: solid; border-color: var(--gold); color: var(--ink); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.sig .sig-name { font-family: var(--font-display); font-size: 1.15rem; display: block; }

/* ---------- story / timeline ---------- */
.timeline { position: relative; padding-inline-start: 26px; }
.timeline::before {
  content: ''; position: absolute; top: 8px; bottom: 8px; inset-inline-start: 7px;
  width: 2px; background: linear-gradient(var(--rose), var(--accent), var(--gold));
  border-radius: 2px;
}
.tl-item { position: relative; margin-bottom: 18px; animation: rise .5s var(--ease) both; }
.tl-item::before {
  content: ''; position: absolute; inset-inline-start: -26px; top: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--accent);
}
.tl-item .tl-date { font-size: .78rem; color: var(--ink-2); letter-spacing: .06em; }
[dir="rtl"] .tl-item .tl-date { letter-spacing: 0; }
.tl-item img { width: 100%; border-radius: 12px; margin-top: 10px; max-height: 320px; object-fit: cover; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { text-align: center; padding: 16px 10px; }
.stat .n { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent-deep); display: block; }
.stat .lbl { font-size: .78rem; color: var(--ink-2); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 11px 22px; border-radius: 999px; font-size: .9rem;
  opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .25s, transform .25s var(--ease);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- settings ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: .85rem; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* back link */
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: .9rem; padding: 6px 2px; margin-bottom: 4px; }
.backlink:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
