:root {
  --green-dark: #063f32;
  --green: #0d5c46;
  --green-light: #16765b;
  --gold: #d4a13a;
  --gold-light: #f0ca72;
  --cream: #f7f4eb;
  --white: #ffffff;
  --text: #10231d;
  --muted: #65736e;
  --border: rgba(13, 92, 70, 0.15);
  --shadow: 0 24px 70px rgba(4, 49, 38, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(212, 161, 58, 0.15),
      transparent 34%
    ),
    linear-gradient(145deg, #f8f7f1, #edf5f1);
}

button,
a {
  font: inherit;
}

.qibla-page {
  min-height: 100vh;
}

.qibla-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 12px 28px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(13, 92, 70, 0.12);
  background: rgba(248, 247, 241, 0.88);
  backdrop-filter: blur(18px);
}

.qibla-back-button,
.qibla-close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 5px 15px rgba(4, 49, 38, 0.06);
}

.qibla-back-button {
  justify-self: start;
  gap: 6px;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 12px;
}

.qibla-back-button svg,
.qibla-close-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qibla-close-button {
  justify-self: end;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.qibla-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
}

.qibla-brand-icon {
  font-size: 1.4rem;
}

.qibla-content {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 70px;
}

.qibla-heading {
  max-width: 720px;
  margin: 0 auto 30px;
  text-align: center;
}

.qibla-eyebrow {
  color: var(--green);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.qibla-heading h1 {
  margin: 12px 0;
  color: var(--green-dark);
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
}

.qibla-heading p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.7;
}

.qibla-tool-card {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: 26px;
  border: 1px solid rgba(212, 161, 58, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.98),
      rgba(247, 250, 248, 0.94)
    );
  box-shadow: var(--shadow);
}

.qibla-location {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.qibla-location svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qibla-location div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qibla-location span {
  color: var(--muted);
  font-size: 0.75rem;
}

.qibla-location strong {
  overflow: hidden;
  color: var(--green-dark);
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qibla-compass-wrapper {
  padding: 28px 0 20px;
  display: flex;
  justify-content: center;
}

.qibla-compass {
  position: relative;
  width: min(330px, 78vw);
  aspect-ratio: 1;
  border: 3px solid rgba(212, 161, 58, 0.65);
  border-radius: 50%;
  background:
    repeating-conic-gradient(
      from 0deg,
      rgba(13, 92, 70, 0.13) 0deg 1deg,
      transparent 1deg 15deg
    ),
    radial-gradient(
      circle,
      #ffffff 0%,
      #f6faf8 58%,
      #e7f1ed 100%
    );
  box-shadow:
    inset 0 0 0 12px rgba(255, 255, 255, 0.75),
    0 20px 45px rgba(4, 49, 38, 0.15);
}

.direction {
  position: absolute;
  z-index: 3;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.direction.north {
  top: 16px;
  left: 50%;
  color: var(--gold);
  transform: translateX(-50%);
}

.direction.east {
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
}

.direction.south {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
}

.direction.west {
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
}

.compass-line {
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(13, 92, 70, 0.1);
  transform: translate(-50%, -50%);
}

.compass-line.vertical {
  width: 1px;
  height: 75%;
}

.compass-line.horizontal {
  width: 75%;
  height: 1px;
}

.qibla-needle {
  position: absolute;
  inset: 46px;
  z-index: 4;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 180ms linear;
}

.qibla-kaaba {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--green-dark);
  transform: translateX(-50%);
  box-shadow: 0 8px 18px rgba(4, 49, 38, 0.25);
}

.qibla-kaaba span {
  font-size: 1.45rem;
}

.qibla-arrow {
  position: absolute;
  top: 27px;
  bottom: 50%;
  left: 50%;
  width: 8px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(var(--gold-light), var(--gold));
  transform: translateX(-50%);
}

.qibla-arrow::after {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 11px solid transparent;
  border-bottom: 18px solid var(--gold);
  border-left: 11px solid transparent;
  transform: translate(-50%, -55%);
}

.qibla-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 22px;
  height: 22px;
  border: 5px solid var(--white);
  border-radius: 50%;
  background: var(--green);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(13, 92, 70, 0.18);
}

.qibla-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qibla-result-label {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#qiblaBearing {
  margin: 2px 0;
  color: var(--green-dark);
  font-size: 2.3rem;
}

#qiblaDirectionText {
  color: var(--muted);
  font-size: 0.88rem;
}

.qibla-facing-status {
  width: fit-content;
  margin: 16px auto 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(13, 92, 70, 0.08);
  font-size: 0.8rem;
  font-weight: 700;
}

.qibla-facing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.qibla-facing-status.aligned {
  color: #07583f;
  background: rgba(15, 143, 95, 0.13);
}

.qibla-facing-status.aligned .qibla-facing-dot {
  background: #0f8f5f;
}

.qibla-start-button {
  width: 100%;
  min-height: 52px;
  margin-top: 20px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 15px;
  color: var(--white);
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 12px 26px rgba(13, 92, 70, 0.24);
}

.qibla-start-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.qibla-start-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.qibla-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.qibla-details {
  margin-top: 18px;
  padding-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.qibla-details div {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-radius: 13px;
  background: rgba(13, 92, 70, 0.05);
}

.qibla-details span {
  color: var(--muted);
  font-size: 0.69rem;
}

.qibla-details strong {
  color: var(--green-dark);
  font-size: 0.85rem;
}

.qibla-instructions {
  margin-top: 58px;
}

.qibla-instructions h2 {
  margin-bottom: 22px;
  color: var(--green-dark);
  text-align: center;
}

.qibla-instruction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.qibla-instruction-grid article {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.qibla-instruction-grid article > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--white);
  background: var(--green);
  font-weight: 800;
}

.qibla-instruction-grid h3 {
  margin: 14px 0 8px;
  color: var(--green-dark);
  font-size: 1rem;
}

.qibla-instruction-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .qibla-topbar {
    min-height: 62px;
    padding: 9px 14px;
  }

  .qibla-back-button {
    width: 42px;
    padding: 0;
  }

  .qibla-back-button span {
    display: none;
  }

  .qibla-brand {
    font-size: 0.92rem;
  }

  .qibla-content {
    width: min(100% - 22px, 1100px);
    padding: 34px 0 52px;
  }

  .qibla-heading {
    margin-bottom: 22px;
  }

  .qibla-heading p {
    font-size: 0.9rem;
  }

  .qibla-tool-card {
    padding: 18px;
    border-radius: 22px;
  }

  .qibla-compass-wrapper {
    padding-top: 22px;
  }

  .qibla-instruction-grid {
    grid-template-columns: 1fr;
  }
}