:root {
  --terra: #BD532B;
  --terra-dark: #8F3618;
  --carbon: #141214;
  --carbon2: #1C1917;
  --gold: #EAB308;
  --gold2: #F59E0B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--terra-dark);
  font-family: 'Vazirmatn', sans-serif;
  color: #F5E6D0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#canvas {
  position: fixed;
  inset: 0;
  display: block;
}

/* ---- Top nav ---- */
#topnav {
  position: fixed;
  top: 22px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 22px;
  z-index: 10;
}
#topnav .brand {
  font-family: 'Lalezar', cursive;
  font-size: 26px;
  color: var(--gold);
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.navlinks {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.navlinks button {
  background: rgba(20,18,20,0.55);
  color: var(--gold);
  border: 1px solid rgba(234,179,8,0.3);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Vazirmatn', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
  backdrop-filter: blur(4px);
}
.navlinks button:hover {
  background: var(--gold);
  color: var(--carbon);
}

/* ---- Quote card ---- */
#quoteCard {
  position: fixed;
  top: 90px;
  right: 50%;
  transform: translateX(50%);
  width: min(560px, 86vw);
  text-align: center;
  background: rgba(20,18,20,0.5);
  border: 1px solid rgba(234,179,8,0.35);
  border-radius: 14px;
  padding: 18px 22px;
  z-index: 9;
  backdrop-filter: blur(6px);
  transition: opacity .6s ease, transform .6s ease;
  opacity: 1;
}
#quoteCard.fade { opacity: 0; transform: translateX(50%) translateY(8px); }
#quoteText {
  font-family: 'Lalezar', cursive;
  font-size: clamp(17px, 2.6vw, 24px);
  line-height: 1.7;
  color: #F7E4C2;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
#quoteCat {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--gold2);
  letter-spacing: .5px;
}

/* ---- Bottom bar ---- */
#bottombar {
  position: fixed;
  bottom: 30px;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  z-index: 10;
  flex-wrap: wrap;
}
#elevation {
  font-weight: 700;
  font-size: 15px;
  color: #F5E6D0;
  background: rgba(20,18,20,0.5);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(234,179,8,0.25);
  backdrop-filter: blur(4px);
}
#timerDisplay {
  font-family: 'Lalezar', cursive;
  font-size: clamp(34px, 8vw, 58px);
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  line-height: 1;
}
.btns { display: flex; gap: 10px; }
.btns button {
  font-family: 'Lalezar', cursive;
  font-size: 18px;
  padding: 10px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: .2s;
  border: none;
}
#pauseBtn {
  background: var(--gold);
  color: var(--carbon);
}
#pauseBtn:hover { background: var(--gold2); }
#resetBtn {
  background: rgba(20,18,20,0.6);
  color: #F5E6D0;
  border: 1px solid rgba(234,179,8,0.4);
}
#resetBtn:hover { background: rgba(191,83,43,0.7); }

/* ---- Modal ---- */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(15,10,8,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  animation: fadein .25s ease;
}
#modal.hidden { display: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#modalBox {
  position: relative;
  width: min(480px, 90vw);
  max-height: 82vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #A8461F, #6E2A11);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
#modalClose {
  position: absolute;
  top: 12px; left: 16px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 30px;
  cursor: pointer;
  line-height: 1;
}
#modalContent h2 {
  font-family: 'Lalezar', cursive;
  color: var(--gold);
  font-size: 28px;
  margin-bottom: 14px;
}
#modalContent p { line-height: 2; margin-bottom: 10px; font-size: 15px; }
#modalContent .muted { color: #E8C9A8; font-size: 13px; }
#modalContent .big {
  font-family: 'Lalezar', cursive;
  font-size: 64px;
  color: var(--gold);
  text-align: center;
}
#modalContent label { display: block; margin: 12px 0 8px; font-weight: 700; color: var(--gold2); }
.durrow { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.durbtn {
  font-family: 'Lalezar', cursive;
  background: rgba(20,18,20,0.4);
  color: #F5E6D0;
  border: 1px solid rgba(234,179,8,0.4);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 18px;
  cursor: pointer;
}
.durbtn.active { background: var(--gold); color: var(--carbon); }
#durSlider { width: 100%; margin: 8px 0; accent-color: var(--gold); }

/* ---- Footer ---- */
footer {
  position: fixed;
  bottom: 4px;
  right: 50%;
  transform: translateX(50%);
  z-index: 8;
  font-size: 11px;
}
footer a { color: rgba(245,230,208,0.5); text-decoration: none; }
footer a:hover { color: var(--gold); }

@media (max-width: 560px) {
  #topnav { top: 14px; padding: 4px 12px; }
  #topnav .brand { font-size: 20px; }
  .navlinks button { padding: 5px 9px; font-size: 11px; }
  #quoteCard { top: 74px; padding: 12px 14px; }
  #bottombar { bottom: 40px; padding: 0 14px; justify-content: center; }
  #timerDisplay { order: -1; width: 100%; text-align: center; }
}
</parameter>
</invoke>