:root {
  --bg: #0b3a22;
  --card: #f4f6f8;
  --milk: #f6f1e4;
  --ink: #161616;
  --muted: #8d867c;
  --line: rgba(28, 24, 16, 0.12);
  --gold: #c4a15a;
  --gold-deep: #8d7040;
  --danger: #8d3d32;
  --shadow: 0 24px 60px rgba(70, 50, 20, 0.12);
  --sans: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --arabic: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --nav: 140px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #f6f1e4; }
body {
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--ink);
  background: #f6f1e4;
  text-rendering: optimizeLegibility;
}
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(196, 161, 90, 0.35); }
[hidden] { display: none !important; }

.stage {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: #f6f1e4;
}

.shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #062818 url("/img/salawat-scene.jpg") center center / cover no-repeat;
}

.install-bar {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  background: #f6f1e4;
  color: #1c1914;
  font-size: 14.5px;
  line-height: 1.35;
  font-weight: 600;
}
.install-bar span { flex: 1 1 auto; min-width: 0; }
.install-bar button {
  flex: 0 0 auto;
  border: 0;
  background: #161616;
  color: #f6f1e4;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.view {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.shell:has(#nav:not([hidden])) .view:not(.view-home) {
  padding-bottom: calc(var(--nav) + 12px);
}
.view-boot {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.boot-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(196, 161, 90, 0.35);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: #8f8880;
  text-indent: 0.42em;
}
.page-title, .reg-wrap h1 {
  margin: 10px 0 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.lede {
  margin: 12px 0 0;
  color: #3c3934;
  font-size: 15.5px;
  line-height: 1.5;
  font-weight: 500;
}
.quiet {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.center { text-align: center; }
.page-pad, .reg-wrap {
  width: min(calc(100% - 20px), 460px);
  margin: 12px auto 16px;
  padding: calc(22px + env(safe-area-inset-top)) 18px 22px;
  background: rgba(246, 241, 228, 0.94);
  border-radius: 26px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

.field { display: block; margin-top: 18px; }
.field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.field input, .field select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  padding: 12px 2px;
  font-size: 16px;
  outline: none;
}
.field input:focus, .field select:focus { border-bottom-color: var(--gold); }
.field input.is-bad, .field select.is-bad { border-bottom-color: var(--danger); }

.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gender button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 12px 10px;
  font-size: 16px;
  font-weight: 600;
}
.gender button[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(196, 161, 90, 0.14);
}

.btn-primary, .btn-ghost {
  display: block;
  width: 100%;
  margin-top: 22px;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 600;
}
.btn-primary { border: 0; background: var(--ink); color: #f6f3ee; }
.btn-primary:disabled { opacity: 0.55; }
.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.text-btn, .admin-link {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 0;
  background: transparent;
  color: var(--gold-deep);
  font-size: 14.5px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

/* Registration must fit a short phone and the desktop phone card without scrolling. */
#view-register {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  overflow: hidden;
  padding: 6px 0;
}
#view-register .reg-wrap {
  width: min(calc(100% - 16px), 420px);
  margin: 0 auto;
  padding: 12px 14px 10px;
  border-radius: 22px;
}
#view-register .eyebrow {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
}
#view-register h1 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.1;
}
#view-register .lede {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.32;
}
#view-register .field { margin-top: 8px; }
#view-register .field > span {
  margin-bottom: 1px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
#view-register .field input,
#view-register .field select {
  padding: 6px 2px 5px;
  font-size: 16px;
  line-height: 1.2;
}
#view-register .gender { gap: 8px; }
#view-register .gender button {
  padding: 7px 10px;
  font-size: 15px;
  line-height: 1.2;
}
#view-register .btn-primary,
#view-register .btn-ghost {
  margin-top: 10px;
  padding: 11px 16px;
  font-size: 16px;
  line-height: 1.2;
}
#view-register .text-btn,
#view-register .admin-link {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.25;
}
#view-register .quiet {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.3;
}
#view-register .form-error {
  margin: 6px 0 0;
  font-size: 13px;
}
.form-error {
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
}
.success {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(196, 161, 90, 0.16);
  color: #3e3424;
  font-weight: 600;
}

.view-home {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: transparent;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.medallion {
  position: absolute;
  left: 50%;
  top: 66.9%;
  width: min(64%, 270px);
  aspect-ratio: 1.62 / 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 46%;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 90ms ease;
}
.medallion.is-down { transform: translate(-50%, -50%) scale(0.975); }
.medallion.is-inactive::before {
  content: "";
  position: absolute;
  inset: 6% 4%;
  border-radius: 46%;
  background: rgba(6, 18, 12, 0.45);
  pointer-events: none;
}
.medallion.is-inactive #countNum {
  position: relative;
  z-index: 1;
  opacity: 0.42;
}
.medallion.is-mark #countNum { text-shadow: 0 0 16px rgba(246, 241, 228, 0.9); }
.medallion:focus-visible { outline: 2px solid var(--milk); outline-offset: 4px; }
#countNum {
  font-weight: 600;
  font-size: clamp(52px, 15vw, 78px);
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #f6f1e4;
  text-shadow: 0 2px 10px rgba(0, 20, 10, 0.28);
}
#countNum[data-len="4"] { font-size: clamp(42px, 12vw, 62px); }
#countNum[data-len="5"] { font-size: clamp(34px, 10vw, 50px); }
#countNum[data-len="6"], #countNum[data-len="7"] { font-size: clamp(28px, 8vw, 40px); }
#countNum.pop { animation: pop 160ms ease; }
@keyframes pop {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.045); }
  100% { transform: scale(1); }
}
.home-tools {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(17% + 6px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.home-tools .undo,
.home-tools .mod-link { pointer-events: auto; }
.split, .sync {
  margin: 0;
  text-align: center;
  color: var(--milk);
  font-size: 13.5px;
  text-shadow: 0 1px 6px rgba(0, 20, 10, 0.45);
}
.split { font-weight: 600; }
.sync { min-height: 1.2em; max-width: 280px; }
.mod-link {
  margin-top: 2px;
  color: #f3e2b0;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.undo {
  margin-top: 2px;
  border: 0;
  background: transparent;
  color: var(--milk);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 12px;
  text-shadow: 0 1px 6px rgba(0, 20, 10, 0.45);
}
.undo:disabled { opacity: 0.4; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.tiles article {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 10px 14px;
  text-align: center;
}
.tiles span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.tiles strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.empty {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
}
.day-list { list-style: none; margin: 18px 0 0; padding: 0; }
.day-list li { padding: 12px 0; border-top: 1px solid rgba(28, 24, 16, 0.08); }
.day-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.day-top small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.day-top strong { font-variant-numeric: tabular-nums; font-size: 18px; }
.track {
  margin-top: 8px;
  height: 7px;
  border-radius: 99px;
  background: rgba(28, 24, 16, 0.06);
  overflow: hidden;
}
.stack { display: flex; height: 100%; border-radius: inherit; overflow: hidden; }
.bar-site { background: #1c1c1c; height: 100%; }
.bar-photo { background: var(--gold); height: 100%; }
.section-title {
  margin: 26px 0 0;
  font-size: 16px;
  font-weight: 700;
}
.photo-records { list-style: none; margin: 8px 0 0; padding: 0; }
.photo-records li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid rgba(28, 24, 16, 0.08);
}
#view-photo .page-pad {
  margin-top: 8px;
  margin-bottom: calc(max(136px, 19%) + 18px);
  padding-top: 14px;
  padding-bottom: 14px;
}
#view-photo .page-title { margin-top: 4px; font-size: 26px; }
#view-photo .lede { margin-top: 6px; font-size: 14.5px; line-height: 1.35; }
#photoPreview {
  display: block;
  width: 100%;
  margin-top: 10px;
  height: min(42dvh, 320px);
  object-fit: contain;
  border-radius: 18px;
  background: #0c2418;
}
#view-photo .btn-primary,
#view-photo .btn-ghost { margin-top: 10px; padding: 12px 16px; }

.nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 17%;
  min-height: 118px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: transparent;
  padding: 0;
  z-index: 5;
}
.nav button {
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
  line-height: 0;
  padding: 0;
}
.nav button svg { display: none; }
.nav button.is-on { color: transparent; }
.nav button[data-go="photo"].is-inactive {
  background: rgba(2, 16, 10, 0.62);
  box-shadow: inset 0 0 0 1px rgba(246, 241, 228, 0.12);
}

.motive {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 8% 7% 14%;
  background: rgba(4, 20, 12, 0.38);
}
.motive-card {
  width: min(100%, 336px);
  max-height: 100%;
  overflow: auto;
  border-radius: 28px;
  padding: 22px 18px 14px;
  text-align: center;
  color: #f6f1e4;
  background:
    radial-gradient(circle at 50% 0%, rgba(236, 204, 122, 0.34), transparent 46%),
    linear-gradient(180deg, #187243 0%, #0c4e2b 72%);
  box-shadow: 0 0 28px rgba(212, 175, 90, 0.38), 0 18px 40px rgba(0, 0, 0, 0.28);
  animation: motive-in 0.42s ease, motive-glow 2.8s ease-in-out infinite;
}
.motive-badge {
  width: 74px;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18));
}
.motive-kicker {
  margin: 0;
  color: #e7c56a;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.motive-card h2 {
  margin: 8px 0 0;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.motive-body {
  margin: 8px 0 0;
  color: rgba(246, 241, 228, 0.92);
  font-size: 14.5px;
  line-height: 1.45;
}
.motive-count {
  margin-top: 14px;
  border-radius: 16px;
  padding: 12px 12px 10px;
  background: #f3ead4;
  color: #0e4a28;
}
.motive-count strong {
  display: block;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.motive-count span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
}
.motive-go {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  background: linear-gradient(180deg, #e2c36a, #c4a15a);
  color: #1d160c;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(90, 60, 10, 0.22);
}
.motive-amen {
  margin: 8px 0 0;
  color: rgba(246, 241, 228, 0.78);
  font-size: 13px;
}
.hours-warn {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 6% 6% 12%;
  background: rgba(4, 24, 14, 0.55);
}
.hours-card {
  width: min(100%, 336px);
  max-height: 100%;
  overflow: auto;
  border-radius: 26px;
  padding: 18px 16px 14px;
  text-align: center;
  color: #14301c;
  background:
    radial-gradient(circle at 50% 0%, rgba(226, 195, 106, 0.45), transparent 42%),
    linear-gradient(180deg, #fffaf0, #f4ecd8);
  border: 3px solid #d4b56a;
  box-shadow: 0 0 0 7px #0e4a28, 0 18px 40px rgba(0, 0, 0, 0.28);
}
.hours-mark {
  margin: 0;
  color: #c4a15a;
  font-size: 28px;
  line-height: 1;
}
.hours-card h2 {
  margin: 4px 0 0;
  color: #0e4a28;
  font-size: 26px;
  letter-spacing: -0.03em;
}
.hours-lead {
  margin: 12px 0 0;
  font-weight: 750;
  font-size: 17px;
  line-height: 1.35;
}
.hours-body {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.45;
}
.hours-note {
  margin-top: 12px;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: #e5f0dc;
  color: #0e4a28;
}
.hours-note p {
  margin: 0;
  font-weight: 750;
  font-size: 15px;
  line-height: 1.35;
}
.hours-note p + p {
  margin-top: 6px;
  font-weight: 650;
  font-size: 13.5px;
}
.hours-when {
  margin: 10px 0 0;
  color: #6d6458;
  font-size: 12.5px;
}
.hours-card button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #1a7a45, #0c4e2b);
  color: #f6f1e4;
  font-size: 18px;
  font-weight: 800;
}
.count-dialog {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: end center;
  padding: 4% 4% 16%;
  background: rgba(4, 24, 14, 0.5);
}
.count-card {
  width: min(100%, 380px);
  max-height: 100%;
  overflow: auto;
  border-radius: 26px;
  padding: 12px 14px 14px;
  text-align: center;
  color: #14301c;
  background:
    radial-gradient(circle at 50% 0%, rgba(226, 195, 106, 0.4), transparent 42%),
    linear-gradient(180deg, #fffaf0, #f4ecd8);
  border: 3px solid #d4b56a;
  box-shadow: 0 0 0 6px #0e4a28, 0 18px 40px rgba(0, 0, 0, 0.28);
}
#countDialogPreview {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: contain;
  border-radius: 16px;
  background: #0c2418;
}
.count-lead {
  margin: 10px 0 0;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
}
.count-zero {
  margin: 4px 0 0;
  font-size: 72px;
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #0e4a28;
}
.count-field { display: block; margin-top: 6px; }
.count-field span {
  display: block;
  color: #6d6458;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.count-field input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid rgba(14, 74, 40, 0.28);
  background: transparent;
  text-align: center;
  font-size: 56px;
  font-weight: 750;
  line-height: 1.1;
  padding: 4px 0 6px;
  color: #0e4a28;
  font-variant-numeric: tabular-nums;
}
.count-field input:focus { outline: none; border-bottom-color: #c4a15a; }
.count-card .btn-primary:disabled {
  opacity: 0.4;
  background: #8d867c;
}
.count-card .form-error { margin-top: 8px; }
@keyframes motive-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes motive-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(212, 175, 90, 0.22), 0 18px 40px rgba(0, 0, 0, 0.28); }
  50% { box-shadow: 0 0 32px rgba(236, 204, 122, 0.55), 0 18px 40px rgba(0, 0, 0, 0.28); }
}

@media (min-width: 560px) {
  .stage {
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: auto;
    min-height: 100dvh;
    padding: 24px 16px;
  }
  .stage:has(.install-bar:not([hidden])) {
    justify-content: flex-start;
  }
  .install-bar {
    width: min(440px, calc(100vw - 48px));
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 10px 28px rgba(50, 36, 12, 0.08);
  }
  .shell {
    flex: 0 0 auto;
    width: min(440px, calc(100vw - 48px), calc((100dvh - 48px) / 1.9542));
    aspect-ratio: 524 / 1024;
    height: auto;
    max-height: calc(100dvh - 48px);
    margin: 0;
    border-radius: 24px;
    box-shadow: var(--shadow);
    z-index: 1;
  }
  .stage:has(.install-bar:not([hidden])) .shell {
    width: min(440px, calc(100vw - 48px), calc((100dvh - 150px) / 1.9542));
    max-height: calc(100dvh - 150px);
  }
  .view-boot { min-height: 100%; }
}

@media (max-height: 740px) {
  .medallion { width: min(58%, 230px); top: 67.4%; }
  .home-tools { bottom: calc(17% + 2px); }
}

@media (max-height: 700px) {
  #view-register { padding: 4px 0; }
  #view-register .reg-wrap { padding: 8px 12px 6px; }
  #view-register h1 { font-size: 20px; margin-top: 2px; }
  #view-register .lede { margin-top: 3px; font-size: 12.5px; }
  #view-register .field { margin-top: 5px; }
  #view-register .field input,
  #view-register .field select { padding: 4px 2px 3px; }
  #view-register .gender button { padding: 6px 8px; }
  #view-register .btn-primary,
  #view-register .btn-ghost { margin-top: 7px; padding: 9px 14px; }
  #view-register .text-btn,
  #view-register .admin-link { margin-top: 4px; }
  #view-register .quiet { margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-ring, #countNum.pop, .motive-card { animation: none; }
  .medallion { transition: none; }
}
