:root {
  --hrpc-blue: #001f3f;
  --hrpc-blue-soft: #103662;
  --hrpc-gold: #d4af37;
  --paper: #f7f6f1;
  --ink: #0f2d4d;
  --shadow: 0 16px 38px rgba(0, 20, 43, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans", "Nunito Sans", "Cinzel", sans-serif;
  color: var(--paper);
  background:
    radial-gradient(circle at 10% 18%, rgba(252, 228, 146, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 24% 12%, rgba(252, 228, 146, 0.14) 0 2px, transparent 3px),
    radial-gradient(circle at 74% 18%, rgba(252, 228, 146, 0.2) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 10%, rgba(252, 228, 146, 0.16) 0 1.5px, transparent 3px),
    linear-gradient(180deg, #021327 0%, #07284a 54%, #0d355c 100%);
}

.app {
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 1.4rem 0 3rem;
  position: relative;
}

.bg-glow {
  position: fixed;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(2px);
}

.bg-glow-left {
  top: 15%;
  left: -110px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.28) 0%, rgba(212, 175, 55, 0) 72%);
}

.bg-glow-right {
  bottom: 18%;
  right: -110px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.24) 0%, rgba(212, 175, 55, 0) 72%);
}

.hero {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 22px;
  padding: 1.4rem 1.2rem 1.5rem;
  background: linear-gradient(160deg, rgba(4, 28, 55, 0.9), rgba(10, 52, 95, 0.9));
  box-shadow: var(--shadow);
}

.logo {
  width: min(560px, 100%);
  display: block;
  margin: 0 auto 0.5rem;
  border-radius: 14px;
}

.kicker {
  color: var(--hrpc-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  font-size: 0.82rem;
  margin: 0.4rem 0;
}

h1,
h2,
h3 {
  font-family: "Marcellus", serif;
  margin: 0;
}

h1 {
  font-family: "Cinzel", serif;
  font-weight: 700;
  text-align: center;
  font-size: clamp(1.8rem, 4.8vw, 3rem);
  color: #fff9dd;
}

.intro {
  max-width: 760px;
  margin: 0.75rem auto 0;
  text-align: center;
  color: #f2efdf;
  line-height: 1.45;
}

.progress-wrap {
  margin: 1.15rem auto 0;
  max-width: 640px;
}

#progress-text {
  margin: 0;
  text-align: center;
  font-weight: 700;
}

.progress-track {
  margin-top: 0.5rem;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(4, 17, 30, 0.5);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e7ca6a 0%, #d4af37 60%, #efdc9b 100%);
  transition: width 220ms ease;
}

.section-title {
  margin-top: 1.6rem;
  color: #fff2ca;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.section-subtitle {
  text-align: center;
  margin: 0.35rem auto 1rem;
  max-width: 660px;
  color: #dae8ff;
}

.calendar-grid {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  margin: 8rem auto 0;
}

.mosque-layout {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 130px;
  gap: 0.85rem;
  align-items: end;
}

.minaret {
  position: relative;
  display: grid;
  gap: 0.7rem;
  padding: 3.9rem 0.5rem 0.7rem;
  border: 2px solid rgba(212, 175, 55, 0.55);
  border-radius: 70px 70px 16px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(4, 18, 34, 0.5)),
    linear-gradient(180deg, #184774 0%, #10365c 100%);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.minaret::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -44px;
  transform: translateX(-50%);
  width: 92px;
  height: 62px;
  border: 2px solid rgba(212, 175, 55, 0.65);
  border-bottom: none;
  border-radius: 100px 100px 0 0;
  background: linear-gradient(180deg, #1b4d7c, #123e67);
}

.minaret::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -68px;
  transform: translateX(-50%);
  width: 10px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, #f1dea1, #c8a53a);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.mosque-body {
  position: relative;
  padding: 5.2rem 1rem 1rem;
  border: 2px solid rgba(212, 175, 55, 0.55);
  border-radius: 28px 28px 16px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(4, 18, 34, 0.45)),
    linear-gradient(180deg, #0f355c 0%, #0b2a4a 52%, #082038 100%);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.mosque-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -76px;
  transform: translateX(-50%);
  width: 190px;
  height: 116px;
  border: 2px solid rgba(212, 175, 55, 0.65);
  border-bottom: none;
  border-radius: 110px 110px 0 0;
  background: linear-gradient(180deg, #1a4a78, #11395f);
}

.mosque-body::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -112px;
  transform: translateX(-50%);
  width: 18px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f1dea1, #c8a53a);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
}

.body-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
}

.tile {
  position: relative;
  min-height: 136px;
  border: 1px solid rgba(212, 175, 55, 0.6);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(2, 19, 39, 0.5)),
    linear-gradient(160deg, #1d4670, #133355);
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 20%;
  background: linear-gradient(to top, rgba(2, 19, 39, 0.65), rgba(2, 19, 39, 0));
}

.window-frame {
  position: absolute;
  inset: 6% 12% 7%;
  border: 2px solid rgba(238, 226, 182, 0.6);
  border-radius: 38px 38px 12px 12px;
}

.door-button {
  position: absolute;
  inset: 9% 16% 10%;
  border: none;
  cursor: pointer;
  color: #ffecc1;
  font-weight: 800;
  font-family: inherit;
  font-size: 1.2rem;
  border-radius: 32px 32px 10px 10px;
  background:
    linear-gradient(175deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(120deg, #d7b347, #9e7b20);
  transform-origin: left center;
  transition: transform 460ms cubic-bezier(0.2, 0.9, 0.2, 1), filter 180ms ease;
  box-shadow: inset -10px 0 18px rgba(0, 0, 0, 0.24);
}

.door-button:hover {
  filter: brightness(1.06);
}

.door-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.25) brightness(0.82);
}

.door-button:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.door-button::before {
  content: "";
  position: absolute;
  right: 12%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #f7ebc2;
  box-shadow: 0 0 8px rgba(247, 235, 194, 0.4);
}

.tile.is-open .door-button {
  transform: perspective(600px) rotateY(-106deg);
}

.tile.click-burst {
  animation: tilePulse 420ms ease;
}

.tile.main-door .window-frame {
  inset: 6% 12% 7%;
  border-radius: 38px 38px 12px 12px;
}

.tile.main-door .door-button {
  inset: 9% 16% 10%;
  border-radius: 32px 32px 10px 10px;
  font-size: 1.2rem;
  background:
    linear-gradient(175deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(120deg, #d7b347, #9e7b20);
}

.tile.minaret-window {
  min-height: 118px;
}

.tile.minaret-window .window-frame {
  inset: 6% 12% 7%;
}

.tile.minaret-window .door-button {
  inset: 9% 16% 10%;
  font-size: 1.2rem;
}

.tile.minaret-window .inside-message {
  inset: 9% 16% 10%;
}

.inside-message {
  position: absolute;
  inset: 9% 16% 10%;
  border-radius: 28px 28px 10px 10px;
  color: var(--ink);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
  padding: 0.6rem;
  background: linear-gradient(180deg, #fffef8, #f4ebc9);
  border: 1px solid #d5bd6f;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 260ms ease, transform 260ms ease;
  pointer-events: none;
}

.tile.is-open .inside-message {
  opacity: 1;
  transform: scale(1);
}

.inside-message strong {
  display: block;
  font-size: 1.1rem;
}

.inside-message span {
  font-size: 0.72rem;
  color: #3e4f64;
}

.tile.done .inside-message {
  border-color: #8bbf7a;
  background: linear-gradient(180deg, #f6fff0, #e4f8d6);
}

.tile.main-door .inside-message {
  inset: 9% 16% 10%;
  border-radius: 28px 28px 10px 10px;
}

.tile.locked {
  border-color: rgba(212, 175, 55, 0.28);
}

.tile.locked .inside-message {
  opacity: 1;
  transform: scale(1);
  background: linear-gradient(180deg, #f2f0e8, #e9e3d0);
  border-color: #c8baa0;
}

.tile.locked .inside-message::before {
  content: "🔒";
  display: block;
  margin-bottom: 0.2rem;
}

.message-dialog {
  border: none;
  padding: 0;
  border-radius: 18px;
  width: min(560px, 90vw);
  background: transparent;
}

.message-dialog::backdrop {
  background: rgba(1, 14, 30, 0.72);
  backdrop-filter: blur(2px);
}

.dialog-card {
  background: linear-gradient(180deg, #fdfbf2, #f6f1df);
  color: var(--ink);
  border: 2px solid #dbc374;
  border-radius: 18px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.message-dialog[open] .dialog-card {
  animation: dialogPop 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dialog-card::before {
  content: "";
  position: absolute;
  left: -18%;
  top: -20%;
  width: 45%;
  height: 170%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
  transform: rotate(12deg);
  pointer-events: none;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  background: #16385f;
  color: #fff;
}

.dialog-day {
  margin: 0;
  color: #87691f;
  font-weight: 700;
}

#dialog-title {
  margin-top: 0.25rem;
  font-size: clamp(1.15rem, 3.2vw, 1.5rem);
  font-weight: 900;
  line-height: 1.25;
  font-family: "Noto Sans", "Nunito Sans", sans-serif;
}

.dialog-message {
  margin-top: 0.75rem;
  line-height: 1.5;
  color: #334d6a;
  background: rgba(255, 255, 255, 0.6);
  border-left: 4px solid #d4af37;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  font-family: "Noto Sans", "Nunito Sans", sans-serif;
}

.cta-btn {
  margin-top: 0.65rem;
  width: 100%;
  border: none;
  border-radius: 11px;
  padding: 0.82rem;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(120deg, #0f335b, #1f4e7f);
}

.cta-btn:hover {
  filter: brightness(1.07);
}

.cta-btn-undo {
  margin-top: 0.5rem;
  background: linear-gradient(120deg, #7e8794, #646d7a);
}

@keyframes tilePulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 9px 20px rgba(0, 0, 0, 0.2);
  }
  55% {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 14px 26px rgba(212, 175, 55, 0.32);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 9px 20px rgba(0, 0, 0, 0.2);
  }
}

@keyframes dialogPop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .calendar-grid {
    margin-top: 7.2rem;
  }

  .mosque-layout {
    grid-template-columns: 112px minmax(0, 1fr) 112px;
  }

  .body-grid {
    grid-template-columns: repeat(4, minmax(96px, 1fr));
  }
}

@media (max-width: 760px) {
  .calendar-grid {
    margin-top: 6.8rem;
  }

  .mosque-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .minaret-left {
    order: 1;
  }

  .minaret-right {
    order: 2;
  }

  .mosque-body {
    order: 3;
  }

  .minaret {
    position: relative;
    z-index: 1;
    padding-top: 2.8rem;
    grid-template-columns: repeat(5, minmax(72px, 1fr));
    border-radius: 18px;
  }

  .minaret::before,
  .minaret::after {
    display: none;
  }

  .mosque-body {
    position: relative;
    z-index: 2;
    margin-top: 5.6rem;
    padding-top: 4rem;
  }

  .mosque-body::before {
    top: -58px;
    width: 140px;
    height: 84px;
  }

  .mosque-body::after {
    top: -82px;
    height: 28px;
  }

  .body-grid {
    grid-template-columns: repeat(3, minmax(90px, 1fr));
  }

  .tile {
    min-height: 132px;
  }
}

@media (max-width: 460px) {
  .minaret {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .body-grid {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

.portal-home-wrap {
  text-align: center;
  margin: 28px auto 36px;
  padding: 0 20px;
}

.portal-home-btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.10);
    border: 1px solid rgba(212, 175, 55, 0.22);
    font-weight: 600;
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.portal-home-btn:hover {
    color: #e8c84a;
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(212, 175, 55, 0.45);
    transform: translateY(-1px);
}
