/* Khatm al-Qur'an — palette and type lifted from Naqshbandi Companion. */
:root {
  --bg: #eef1ef;
  --surface: #ffffff;
  --ink: #142225;
  --muted: #4c5c5e;
  --line: #cdd7d5;
  --accent: #1f6f68;
  --accent-soft: #dcebe8;
  --brass: #8a5f17;
  --done: #2a7347;
  --rose-deep: #7f2236;
  --f-body: "Literata", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px 16px 64px;
}

/* ---------------------------------------------------------------- header */
.top {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  font-size: 12.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 8px;
}

h1 {
  font-size: 27px;
  line-height: 1.15;
  margin: 0 0 6px;
  font-weight: 700;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

/* -------------------------------------------------------------- progress */
.count {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 20px 0 7px;
  font-size: 15px;
  color: var(--muted);
}

.count strong { color: var(--ink); font-size: 17px; }

.bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .35s ease;
}

/* ------------------------------------------------------------------ grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(84px, 100%), 1fr));
  gap: 10px;
  margin: 22px 0 8px;
}

.juz {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  min-height: 76px;
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--f-body);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}

.juz .n {
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.juz .s {
  font-size: 11.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.juz:hover:not(:disabled) { border-color: var(--accent); }
.juz:active:not(:disabled) { transform: scale(.98); }
.juz:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.juz.taken {
  background: transparent;
  border-style: dashed;
  cursor: default;
  color: var(--muted);
}
.juz.taken .n { color: var(--muted); font-weight: 400; }

.juz.mine {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-style: solid;
}
.juz.mine .s { color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------- notices */
.note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.5;
}

.note.err { border-color: var(--rose-deep); color: var(--rose-deep); }
.note.done { border-color: var(--done); color: var(--done); }

/* ----------------------------------------------------------------- modal */
dialog {
  border: none;
  padding: 0;
  border-radius: 8px;
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--f-body);
  box-shadow: 0 18px 50px rgba(20, 34, 37, .22);
}

dialog::backdrop { background: rgba(20, 34, 37, .45); }

.mhead {
  padding: 18px 20px 0;
}
.mhead h2 { margin: 0; font-size: 21px; }
.mhead p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.mbody { padding: 16px 20px 4px; }

label { display: block; font-size: 14px; margin: 0 0 5px; color: var(--muted); }

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--f-body);
  font-size: 17px;
  color: var(--ink);
  background: var(--bg);
}
input[type="text"]:focus,
input[type="password"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: var(--surface);
}

.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 14px; }

.mfoot {
  display: flex;
  gap: 10px;
  padding: 8px 20px 20px;
}

button.btn {
  appearance: none;
  font-family: var(--f-body);
  font-size: 16px;
  border-radius: 6px;
  padding: 13px 16px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  flex: 1;
}

button.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  flex: 2;
  font-weight: 600;
}

button.btn:disabled { opacity: .55; cursor: default; }
button.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- footer */
.foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.foot a { color: var(--accent); }

/* ----------------------------------------------------------------- admin */
.admin table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin-top: 16px;
}
.admin th, .admin td {
  text-align: left;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin th {
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.admin td.j { font-weight: 700; color: var(--brass); width: 52px; }
.admin .del {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--rose-deep);
  border-radius: 5px;
  padding: 5px 10px;
  font-family: var(--f-body);
  font-size: 13px;
  cursor: pointer;
}
.admin .danger {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.admin .danger h2 { font-size: 16px; margin: 0 0 6px; color: var(--rose-deep); }
.admin .danger p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- holding page ---------- */
.hold { margin-top: 18px; display: grid; gap: 10px; justify-items: start; }
.hold a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); padding-bottom: 1px; }
.hold a:hover { border-bottom-color: var(--accent); }
