:root {
  --green: #01411C;
  --white: #FFFFFF;
  --gold: #E6B325;
  --ink: #0E1A12;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--white);
  font-family: "Noto Nastaliq Urdu", serif;
  font-weight: 400;
  line-height: 2;
}

button, input, select { font-family: inherit; }

button { cursor: pointer; }

button:disabled { opacity: 0.45; cursor: default; }

img { max-width: 100%; display: block; }

#splash {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  background:
    linear-gradient(180deg, rgba(1, 65, 28, 0.25), rgba(14, 26, 18, 0.78)),
    url("bg-night.jpg") center / cover no-repeat;
  text-align: center;
  padding: 24px;
}

#splash img { width: 168px; height: 220px; object-fit: contain; }

#splash h1 {
  margin: 0;
  color: var(--gold);
  font-size: 48px;
  font-weight: 700;
  line-height: 1.8;
}

.rule {
  width: 128px;
  height: 3px;
  margin: 0;
  border: 0;
  background: var(--gold);
}

#onboard {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 28px 16px 36px;
  background:
    linear-gradient(180deg, rgba(14, 26, 18, 0.28), rgba(1, 65, 28, 0.92)),
    url("bg-night.jpg") center / cover no-repeat;
  text-align: center;
}

#onboard.wash {
  background:
    linear-gradient(180deg, rgba(14, 26, 18, 0.2), rgba(1, 65, 28, 0.9)),
    url("bg-crescent.jpg") center / cover no-repeat;
}

#onboard .box { width: min(440px, 100%); }

#onboard h1 {
  margin: 0;
  color: var(--gold);
  font-size: 34px;
  line-height: 1.8;
}

#onboard p { margin: 0.2em 0 0.7em; }

#shell {
  width: min(480px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  background: linear-gradient(180deg, rgba(1, 65, 28, 0.55), var(--ink) 240px);
}

.hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 12px;
  background:
    linear-gradient(180deg, rgba(14, 26, 18, 0.05), rgba(1, 65, 28, 0.9)),
    url("bg-night.jpg") center 22% / cover no-repeat;
}

.logo { width: 62px; height: 82px; object-fit: contain; }

.brand { display: flex; flex-direction: column; }

.brand strong {
  color: var(--gold);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.5;
}

.brand small { color: var(--white); font-size: 14px; line-height: 1.5; }

.chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-inline-start: auto;
  border: 2px solid var(--gold);
  flex: 0 0 auto;
}

.chip.green {
  background: radial-gradient(circle, var(--gold) 0 5px, var(--green) 6px);
  box-shadow: 0 0 0 2px var(--white);
}

.chip.white {
  background: radial-gradient(circle, var(--green) 0 5px, var(--white) 6px);
}

.ticker {
  position: relative;
  background: var(--gold);
  color: var(--ink);
  overflow: hidden;
  height: 86px;
  cursor: pointer;
  user-select: none;
}

.ticker .track {
  display: flex;
  align-items: center;
  width: max-content;
  height: 86px;
  animation: run 18s linear infinite;
}

.ticker .track span {
  display: flex;
  align-items: center;
  height: 86px;
  font-weight: 700;
  font-size: 18px;
  line-height: 2.4;
  white-space: nowrap;
  padding: 16px 8px 8px;
}

.ticker.paused .track { animation-play-state: paused; }

.ticker .mark {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--green);
  color: var(--gold);
  border-radius: 999px;
  padding: 0 10px 3px;
  font-size: 14px;
  line-height: 1.7;
  font-style: normal;
}

.ticker.paused .mark { display: block; }

@keyframes run {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

.ribbon {
  display: flex;
  gap: 8px;
  margin: 12px 12px 4px;
  padding: 0 4px 8px;
  align-items: flex-start;
}

.rib {
  flex: 1;
  position: relative;
  border: 0;
  color: var(--white);
  background: linear-gradient(180deg, #1c7d40 0%, var(--green) 46%, #012614 100%);
  clip-path: polygon(7% 0, 93% 0, 100% 12%, 100% 78%, 50% 100%, 0 78%, 0 12%);
  padding: 12px 2px 28px;
  min-height: 92px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  transform: rotate(var(--tilt));
  filter: drop-shadow(0 6px 0 rgba(14, 26, 18, 0.9));
}

.rib:nth-child(1) { --tilt: -2.2deg; }
.rib:nth-child(2) { --tilt: 1.6deg; }
.rib:nth-child(3) { --tilt: -1.2deg; }
.rib:nth-child(4) { --tilt: 2deg; }

.rib.active {
  --tilt: 0deg;
  background:
    linear-gradient(var(--gold), var(--gold)) top / 100% 4px no-repeat,
    linear-gradient(180deg, #1f8a45, var(--green) 58%, #012814);
}

.tick {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: 0;
  transform: translateX(-50%);
  color: transparent;
}

.rib.active .tick { color: var(--gold); filter: drop-shadow(0 0 2px #0E1A12); }

.badge {
  position: absolute;
  top: 16px;
  left: 14px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--gold);
  color: var(--ink);
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
}

main { padding: 8px 12px 40px; }

h1 {
  margin: 0;
  color: var(--gold);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.8;
}

h2 {
  margin: 0 0 0.15em;
  color: var(--gold);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.8;
}

p { margin: 0.15em 0 0.55em; }

.lead {
  display: flex;
  gap: 12px;
  align-items: center;
  background-color: var(--green);
  background-image: repeating-linear-gradient(-45deg, rgba(230, 179, 37, 0.1) 0 2px, transparent 2px 12px);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 12px;
}

.lead.cres {
  background:
    linear-gradient(180deg, rgba(14, 26, 18, 0.15), rgba(1, 65, 28, 0.88)),
    url("bg-crescent.jpg") center / cover no-repeat;
}

.lead img { width: 84px; height: 112px; object-fit: contain; flex: 0 0 auto; }

.lead .wide { width: 120px; height: 132px; }

.panel {
  background-color: var(--green);
  background-image: repeating-linear-gradient(-45deg, rgba(230, 179, 37, 0.1) 0 2px, transparent 2px 12px);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 12px 14px 16px;
  margin-bottom: 12px;
}

.center { text-align: center; }

.goldbtn, .qnav button, .backbar button, .tape button {
  background: var(--gold);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 0.35em 1em 0.65em;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.6;
}

.backbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.backbar h1 { font-size: 28px; }

.pcard {
  background-color: var(--green);
  background-image: repeating-linear-gradient(-45deg, rgba(230, 179, 37, 0.08) 0 2px, transparent 2px 11px);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 10px 12px 12px;
  margin-bottom: 10px;
}

.prow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tag {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  border-radius: 999px;
  padding: 0 12px 3px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.8;
}

.prow button {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.1em 0.8em 0.4em;
  font-weight: 700;
}

.lines {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--white);
  text-align: right;
  padding: 4px 0 0;
  font-size: 16px;
}

.lines span {
  display: block;
  border-top: 1px solid rgba(230, 179, 37, 0.35);
  padding: 0.25em 0 0.45em;
  line-height: 1.95;
}

.tape {
  display: grid;
  grid-template-columns: 22px 1fr auto 22px;
  gap: 8px;
  align-items: center;
  background: var(--green);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 8px;
  margin-bottom: 8px;
}

.tape p { margin: 0; line-height: 1.9; }

.tape.kept { background: var(--ink); }

.reel {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 5px var(--green), inset 0 0 0 7px var(--gold);
}

.keptline {
  border-bottom: 1px solid rgba(230, 179, 37, 0.35);
  padding-bottom: 0.3em;
}

.qnav { display: flex; gap: 8px; margin: 8px 0 12px; }

.qnav button { flex: 1; }

.quizbtn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  text-align: right;
  background: var(--green);
  color: var(--white);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 0.45em 0.8em 0.7em;
  margin: 0 0 8px;
  line-height: 1.9;
  font-size: 16px;
}

.quizbtn b { color: var(--gold); font-weight: 700; white-space: nowrap; }

.quizbtn.ok { background: var(--gold); color: var(--ink); }

.quizbtn.ok b { color: var(--ink); }

.quizbtn.bad { background: var(--ink); opacity: 0.72; }

.banner {
  background: var(--gold);
  color: var(--ink);
  text-align: center;
  border-radius: 14px;
  font-weight: 700;
  padding: 0.25em 0.6em 0.5em;
}

.stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.stats p {
  margin: 0;
  background: var(--green);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.1em 0.75em 0.35em;
  line-height: 1.7;
  font-size: 14px;
}

.stats b { color: var(--gold); font-weight: 700; }

.gwin {
  background: linear-gradient(180deg, #f6dc86, var(--gold) 46%, #b88912);
  color: var(--ink);
  border: 2px solid var(--white);
  border-radius: 18px;
  text-align: center;
  padding: 4px 10px 8px;
  margin-bottom: 12px;
}

.gwin small, .gwin span { display: block; line-height: 1.5; font-weight: 700; }

.gwin b { display: block; font-size: 36px; line-height: 1.45; }

.gwin.shut b { opacity: 0.4; }

.pad {
  direction: ltr;
  display: grid;
  grid-template-columns: 1fr 128px 1fr;
  grid-template-areas:
    ". up ."
    "left card right"
    ". down .";
  gap: 8px;
  align-items: center;
}

.side.up { grid-area: up; }
.side.down { grid-area: down; }
.side.left { grid-area: left; }
.side.right { grid-area: right; }

.side {
  background: var(--green);
  color: var(--white);
  border: 2px solid var(--gold);
  border-radius: 16px;
  min-height: 68px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.flip { grid-area: card; }

.flip {
  width: 120px;
  height: 168px;
  margin: 0 auto;
  perspective: 900px;
  background: transparent;
  border: 0;
  padding: 0;
  display: block;
}

.flip.big { width: 150px; height: 210px; }

.flip-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.flip.show .flip-inner { transform: rotateY(180deg); }

.flip .back, .flip .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--gold);
  background: var(--green);
}

.flip .face { transform: rotateY(180deg); }

.flip img { width: 100%; height: 100%; object-fit: cover; }

.week {
  display: flex;
  gap: 4px;
  margin: 4px 0 12px;
}

.sday {
  flex: 1;
  text-align: center;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: var(--ink);
  color: var(--white);
  padding: 2px 0 8px;
  line-height: 1.35;
}

.sday.on { background: var(--gold); color: var(--ink); }

.sday b, .sday small { display: block; }

.sday b { font-size: 16px; }

.sday small { font-size: 12px; }

.streaknum {
  margin: 0;
  color: var(--gold);
  font-size: 56px;
  font-weight: 700;
  line-height: 1.15;
}

.utils {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.utils button {
  background: var(--green);
  color: var(--white);
  border: 2px solid var(--gold);
  border-radius: 16px;
  min-height: 88px;
  padding: 8px 8px 12px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.7;
}

.strip {
  display: flex;
  height: 48px;
  border: 2px solid var(--gold);
  border-radius: 12px;
  overflow: hidden;
}

.strip span { flex: 1; }

.striplabels {
  display: flex;
  margin: 2px 0 12px;
}

.striplabels small {
  flex: 1;
  text-align: center;
  color: var(--gold);
  font-size: 12px;
  line-height: 1.6;
}

.hrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.hrow em {
  flex: 0 0 58px;
  font-style: normal;
  color: var(--gold);
  line-height: 1.6;
}

.hcells { flex: 1; display: flex; gap: 4px; }

.hcells i {
  flex: 1;
  height: 28px;
  border-radius: 6px;
  display: block;
  border: 1px solid rgba(230, 179, 37, 0.45);
}

.tablewrap { overflow-x: hidden; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }

th, td {
  text-align: center;
  padding: 0.2em 0.05em 0.45em;
  border-bottom: 1px solid rgba(230, 179, 37, 0.4);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

th { color: var(--gold); font-weight: 700; }

label {
  display: block;
  margin: 8px 0;
  color: var(--gold);
  line-height: 1.7;
}

input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  background: var(--ink);
  color: var(--white);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 0.45em 0.7em 0.65em;
  font-size: 16px;
}

.chipline { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 8px 0 14px; }

.pickchip {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 4px solid var(--gold);
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding-bottom: 6px;
}

.pickchip.green { background: var(--green); color: var(--white); }

.pickchip.white { background: var(--white); color: var(--ink); }

.pickchip.on { outline: 4px solid var(--white); outline-offset: 4px; }

.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }

.dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--gold);
  display: block;
}

.dots i.on { background: var(--gold); }

.drill {
  width: min(220px, 100%);
  margin: 8px auto 14px;
  display: grid;
  justify-items: center;
  gap: 4px;
  background: var(--green);
  color: var(--white);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 12px 12px 14px;
  font-size: 18px;
  font-weight: 700;
}

.drill img { width: 120px; height: 160px; object-fit: cover; border-radius: 10px; }

.sheetacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.sheetacts .plain {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--white);
  border-radius: 999px;
  padding: 0.3em 1em 0.55em;
  font-weight: 700;
}

#veil {
  position: fixed;
  inset: 0;
  background: rgba(14, 26, 18, 0.72);
  z-index: 30;
}

#sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  z-index: 31;
  background: var(--green);
  color: var(--white);
  border-top: 3px solid var(--gold);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px 28px;
  max-height: 82dvh;
  overflow: auto;
}

#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--gold);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.3em 1em 0.55em;
  font-weight: 700;
  max-width: 92%;
  text-align: center;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}
