:root {
  --navy: #16305c;
  --navy-deep: #0b1a38;
  --sky: #a9d3ea;
  --sky-soft: #d4e9f4;
  --surface: #7fb9d9;
  --foam: #f7fbfd;
  --ink: #16305c;
  --muted: #6d83a3;
  --accent: #4f9fcb;
  --accent-ink: #ffffff;
  --head-bg: var(--sky);
  --head-ink: var(--navy);
  --radius: 18px;
  --col: 580px;
}

body[data-list="married"] {
  --accent: #16305c;
  --head-bg: var(--navy);
  --head-ink: #ffffff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  color: var(--ink);
  background: var(--navy-deep);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, input { font: inherit; color: inherit; }

/* ---------- المشهد الحقيقي (ثابت خلف الصفحة) ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0f2d55;
  pointer-events: none;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: opacity, transform;
}

#v-reef { opacity: 0; }
/* حافة سفلية ناعمة: لما يرتفع السطح يبان الماء تحته بدون خط قاطع */
#v-surface {
  height: 114%;
  object-position: 50% 55%;
  transform-origin: 50% 70%;
  -webkit-mask-image: linear-gradient(#000 82%, transparent);
  mask-image: linear-gradient(#000 82%, transparent);
}

/* يغمق الماء مع العمق */
.shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(11, 26, 56, .55), rgba(11, 26, 56, .9));
  opacity: 0;
}

/* ---------- فوق السطح ---------- */

.sky {
  position: relative;
  z-index: 1;
  min-height: 76svh;
  padding: 10svh 20px 22svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  /* غشاوة فاتحة خفيفة فوق السماء عشان الأسماء تنقرأ */
  background: linear-gradient(rgba(247, 251, 253, .62), rgba(247, 251, 253, .28) 45%, rgba(247, 251, 253, 0) 72%);
}

.sky-kicker {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(.8rem, 2.6vw, 1.05rem);
  letter-spacing: .5em;
  margin-inline-end: -.5em;
  color: #2f5f8f;
}

.names {
  margin: .1em 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.5vw, 22px);
  font-family: "Pinyon Script", cursive;
  font-weight: 400;
  font-size: clamp(3.6rem, 17vw, 8rem);
  line-height: 1.15;
  color: var(--navy);
  text-shadow: 0 1px 24px rgba(255, 255, 255, .75);
}

.rings { width: .5em; height: auto; flex: none; margin-top: .12em; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .8)); }
.rings circle { fill: none; stroke-width: 2.6; }
.ring-a { stroke: #4f9fcb; }
.ring-b { stroke: var(--navy); }
.gem { fill: var(--sky-soft); stroke: #4f9fcb; stroke-width: 1.2; }

.sky-tag {
  margin: .2em 0 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(1.05rem, 3.6vw, 1.5rem);
  color: #234a7a;
  text-shadow: 0 1px 14px rgba(255, 255, 255, .8);
}

/* ---------- داخل البحر ---------- */

.sea {
  position: relative;
  z-index: 1;
  min-height: 240vh;
  padding: 8px 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}


/* ---------- التابات ---------- */

.tabs {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: min(100%, var(--col));
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 26px rgba(11, 26, 56, .2);
}

.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--muted);
  text-decoration: none;
  transition: background .25s, color .25s;
}

.tabs a[data-tab="engaged"][aria-selected="true"] { background: var(--sky); color: var(--navy); }
.tabs a[data-tab="married"][aria-selected="true"] { background: var(--navy); color: #fff; }
.tabs a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #f2c879; outline-offset: 2px; }

.count {
  min-width: 2.6em;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  background: rgba(22, 48, 92, .1);
  direction: ltr;
}
.tabs a[data-tab="married"][aria-selected="true"] .count { background: rgba(255, 255, 255, .2); }
.count:empty { display: none; }

/* ---------- القائمة ---------- */

.sheet {
  position: relative;
  z-index: 1;
  width: min(100%, var(--col));
  margin-top: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 18px 50px rgba(11, 26, 56, .28);
  overflow: hidden;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  background: var(--head-bg);
  color: var(--head-ink);
  transition: background .3s, color .3s;
}

.sheet-head h2 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.progress-text { margin: 0; font-size: .9rem; opacity: .85; }

.progress { height: 4px; background: rgba(22, 48, 92, .08); }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .5s ease; }

.add { display: flex; gap: 8px; padding: 14px 14px 10px; }

.add input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid #d6e4ee;
  border-radius: 12px;
  background: #fff;
  font-size: 1rem;
}
.add input::placeholder { color: #9fb1c6; }
.add input:focus { border-color: var(--accent); outline: none; }

.add button, .pin button {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
.add button:active, .pin button:active { transform: scale(.96); }

.dates { list-style: none; margin: 0; padding: 0 0 8px; }

.date {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-top: 1px solid #e8f0f6;
}
.date:nth-child(even) { background: #f6fafc; }
.date.is-new { animation: drop-in .35s ease; }

@keyframes drop-in { from { opacity: 0; transform: translateY(-8px); } }

.check {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.check i {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #b9cfdf;
  display: grid;
  place-items: center;
  transition: background .2s, border-color .2s, transform .2s;
}
.check svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.check:hover i { border-color: var(--accent); }
.date.done .check i { background: var(--accent); border-color: var(--accent); }
.date.done .check svg { opacity: 1; transform: none; }

.title {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  font-size: 1.05rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  transition: color .2s;
}
.date.done .title { color: #8fa3ba; text-decoration: line-through; text-decoration-color: rgba(143, 163, 186, .6); }

.title-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  font-size: 1.05rem;
  outline: none;
}

.icon-btn {
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #a3b5c8;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: #eaf2f8; color: var(--navy); }
.icon-btn.confirm { width: auto; padding: 0 12px; background: #fdecec; color: #b3403d; font-size: .88rem; font-weight: 700; }

.empty { margin: 0; padding: 26px 20px 34px; text-align: center; color: var(--muted); }

/* ---------- القاع ---------- */

.seabed-note {
  position: relative;
  z-index: 1;
  margin-top: auto;
  align-self: stretch;
  margin-inline: -16px;
  padding: 60vh 20px 20vh;
  background: linear-gradient(rgba(11, 26, 56, 0) 55%, rgba(11, 26, 56, .72));
  text-align: center;
  color: #d4e9f4;
}
.total { margin: 0; font-size: 1.1rem; text-shadow: 0 1px 12px rgba(11, 26, 56, .8); }
.sign { margin: 6px 0 0; font-family: "Pinyon Script", cursive; font-size: clamp(2.4rem, 9vw, 3.6rem); color: #fff; text-shadow: 0 2px 18px rgba(11, 26, 56, .8); }

/* ---------- عناصر عائمة ---------- */

.depth {
  position: fixed;
  left: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 6;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(11, 26, 56, .55);
  color: #d4e9f4;
  font-size: .82rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.depth.on { opacity: 1; transform: none; }
.depth::before { content: "↓ "; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--navy-deep);
  color: #fff;
  font-size: .95rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.pin {
  width: min(340px, calc(100vw - 32px));
  padding: 26px 22px 22px;
  border: 0;
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(11, 26, 56, .4);
}
.pin::backdrop { background: rgba(11, 26, 56, .6); backdrop-filter: blur(4px); }
.pin h3 { margin: 0 0 4px; font-size: 1.25rem; }
.pin p { margin: 0 0 14px; color: var(--muted); }
.pin input {
  width: 100%;
  height: 50px;
  margin-bottom: 12px;
  border: 1.5px solid #d6e4ee;
  border-radius: 12px;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: .3em;
}
.pin button { width: 100%; }
.pin .pin-error { color: #b3403d; }
.pin-field { position: relative; }
.pin-field input { padding-inline: 48px; }
.pin .pin-eye {
  position: absolute;
  inset-inline-end: 4px;
  top: 4px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  display: grid;
  place-items: center;
}
.pin .pin-eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pin .pin-eye:active { transform: none; }

@media (min-width: 700px) {
  .sky { min-height: 70svh; }
  .sheet { margin-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
