:root {
  --wine: #2e0811;
  --kumkum: #a01830;
  --zari: #e3b04b;
  --gulabi: #fff0ea;
  --kora: #fffaf6;
  --ink: #2e0811;
  --ink-soft: #6f4a50;
  --leaf: #25d366;

  --serif: "Tiro Devanagari Hindi", Georgia, serif;
  --sans: "Mukta", system-ui, -apple-system, "Segoe UI", sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --shell: min(100vw, 430px);
  --top: calc(56px + var(--safe-top));
  --hero: max(65vh, 400px);
  --card-h: min(calc((var(--shell) - 40px) * 1.25), calc(var(--hero) - var(--top) - 24px));
  --card-w: calc(var(--card-h) * 0.8);
}

@supports (height: 1svh) {
  :root { --hero: max(65svh, 400px); }
}

*, *::before, *::after { box-sizing: border-box; }

/* Everything still scrolls; the bars just never show. */
* { scrollbar-width: none; }

::-webkit-scrollbar { display: none; }

html {
  background: var(--wine);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.locked { overflow: hidden; }

body {
  margin: 0;
  font: 400 17px/1.5 var(--sans);
  color: var(--ink);
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p, dl, dd { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--zari); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite { position: absolute; }

.ico {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Photo-tinted backdrop: full screen on desktop, behind the hero on phones */
.ambient {
  position: fixed;
  inset: -10%;
  z-index: -1;
  overflow: hidden;
}

.ambient img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(48px) saturate(1.35);
  opacity: 0;
  transition: opacity 0.7s ease;
}

.ambient img.on { opacity: 0.6; }

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(46, 8, 17, 0.25), rgba(46, 8, 17, 0.72));
}

.app {
  position: relative;
  width: var(--shell);
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: clip;
}

.topbar {
  height: var(--top);
  padding: var(--safe-top) 20px 0;
  display: flex;
  align-items: center;
  color: var(--gulabi);
}

.name { font: 400 30px/1 var(--serif); padding-top: 6px; }

/* Deck */
.stage {
  height: calc(var(--hero) - var(--top));
  display: grid;
  place-items: center;
}

.deck {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  border-radius: 24px;
}

.deck:active { cursor: grabbing; }

.card {
  position: absolute;
  inset: 0;
  transform-origin: 50% 80%;
  will-change: transform;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  overflow: hidden;
  background: var(--kumkum);
  box-shadow: 0 16px 32px -12px rgba(20, 2, 6, 0.65);
}

.card-face::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  height: 14%;
  background: linear-gradient(to bottom, rgba(20, 2, 6, 0.42), rgba(20, 2, 6, 0));
  pointer-events: none;
}

.card-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card-shade {
  position: absolute;
  inset: auto 0 0;
  height: 20%;
  background: linear-gradient(to top, rgba(20, 2, 6, 0.62), rgba(20, 2, 6, 0));
}

.card-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 5px 12px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  color: #fff;
  font-size: 15px;
  line-height: 1.3;
}

.card-dim {
  position: absolute;
  inset: 0;
  background: var(--wine);
  opacity: 0;
  pointer-events: none;
}

.bars {
  position: absolute;
  z-index: 20;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  pointer-events: none;
}

.bars i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.38);
  overflow: hidden;
}

.bars i::after {
  content: "";
  display: block;
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}

.bars i.on::after { transform: scaleX(1); }

/* Filter chips */
.chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.chip {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff3ec;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.chip[aria-pressed="true"] {
  background: var(--gulabi);
  border-color: transparent;
  color: var(--wine);
}

/* Biodata sheet */
.sheet {
  position: relative;
  padding: 18px 16px calc(112px + var(--safe-bottom));
  background: var(--gulabi);
  border-radius: 28px 28px 0 0;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  padding: 11px 14px 13px;
  border-radius: 18px;
  background: var(--kora);
}

.stat dt { font-size: 15px; color: var(--ink-soft); }

.stat dd { margin-top: 3px; font: 400 20px/1.25 var(--serif); }

.details { margin-top: 22px; scroll-margin-top: 14px; }

.tabs {
  --tabs: 4;
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tabs), 1fr);
  padding: 4px;
  border-radius: 16px;
  background: rgba(46, 8, 17, 0.07);
}

.tab-ink {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / var(--tabs));
  border-radius: 12px;
  background: var(--kora);
  box-shadow: 0 1px 3px rgba(46, 8, 17, 0.14);
}

.tab {
  position: relative;
  height: 42px;
  border-radius: 12px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: color 0.2s ease;
}

.tab[aria-selected="true"] { color: var(--kumkum); font-weight: 600; }

.panels {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px -16px 0;
  padding: 0 16px;
  overflow: auto hidden;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 16px;
  -webkit-overflow-scrolling: touch;
}

.panel {
  flex: 0 0 calc(100% - 22px);
  padding: 18px 16px;
  border-radius: 22px;
  background: var(--kora);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.note { font: 400 19px/1.55 var(--serif); }

.rows { margin-top: 16px; }

.rows div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid rgba(46, 8, 17, 0.09);
}

.rows dt { color: var(--ink-soft); }

.note[hidden] + .rows { margin-top: 0; }

.note[hidden] + .rows div:first-child { padding-top: 0; border-top: 0; }

.blank { color: var(--ink-soft); font-style: italic; }

.astro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}

.astro dt { font-size: 15px; color: var(--ink-soft); }

.astro dd { font-size: 18px; line-height: 1.3; font-weight: 500; }

.astro dd.blank { font-weight: 400; font-size: 16px; }

.btn {
  width: 100%;
  height: 50px;
  margin-top: 18px;
  border-radius: 16px;
  background: var(--kumkum);
  color: #fff6f0;
  font-weight: 600;
}

.btn:active { transform: scale(0.98); }

.btn.wa { background: var(--leaf); color: #06331c; }

.reach { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(46, 8, 17, 0.09); }

.reach-title { font: 400 19px/1.3 var(--serif); }

.reach-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.reach .btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 0; }

.parents { display: grid; gap: 14px; }

.parents dt { font-size: 15px; color: var(--ink-soft); }

.parents dd { font: 400 24px/1.25 var(--serif); }

.parents dd.blank { font: italic 400 17px/1.5 var(--sans); }

.values { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(46, 8, 17, 0.09); }

.thanks { margin-top: 20px; text-align: center; font-size: 15px; color: var(--ink-soft); }

/* Dock */
.dock {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(12px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 24px), 406px);
  height: 66px;
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.3fr;
  gap: 2px;
  border-radius: 33px;
  background: rgba(46, 8, 17, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
  box-shadow: 0 12px 28px -8px rgba(20, 2, 6, 0.55);
}

.dock button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 27px;
  color: rgba(255, 243, 236, 0.8);
  font-size: 13px;
  line-height: 1.15;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dock .ico { width: 22px; height: 22px; }

.dock button.active { background: rgba(255, 255, 255, 0.14); color: #fff; }

.dock .connect { background: var(--leaf); color: #06331c; font-weight: 600; }

.dock .connect:active { transform: scale(0.97); }

/* Bottom sheets */
.scrim {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgba(20, 2, 6, 0.55);
  opacity: 0;
  visibility: hidden;
  touch-action: none;
}

.scrim.open { visibility: visible; }

.bsheet {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 0;
  width: var(--shell);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  border-radius: 28px 28px 0 0;
  background: var(--gulabi);
  transform: translateX(-50%) translateY(100%);
  visibility: hidden;
  outline: none;
  will-change: transform;
}

.bsheet.open { visibility: visible; }

.bsheet-head {
  flex: none;
  padding: 10px 20px 8px;
  touch-action: none;
  cursor: grab;
}

.grip {
  display: block;
  width: 40px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: rgba(46, 8, 17, 0.22);
}

.bsheet h2 { font: 400 26px/1.2 var(--serif); }

.bsheet-body {
  padding: 8px 16px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.action {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--kora);
  color: var(--ink);
}

.action + .action { margin-top: 10px; }

.action:active { transform: scale(0.985); }

.action b { display: block; font-size: 18px; font-weight: 600; line-height: 1.25; }

.action small { display: block; margin-top: 2px; font-size: 15px; line-height: 1.3; color: var(--ink-soft); }

.action-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(46, 8, 17, 0.08);
}

.action.wa .action-ico { background: var(--leaf); color: #06331c; }

.action.is-off { opacity: 0.7; }

.chart svg { display: block; width: 100%; max-width: 340px; margin: 0 auto; }

.chart img { display: block; width: 100%; border-radius: 16px; }

.chart-note { margin-top: 12px; text-align: center; color: var(--ink-soft); }

/* Lightbox */
.lightbox {
  position: fixed;
  z-index: 70;
  inset: 0;
  visibility: hidden;
}

.lightbox.open { visibility: visible; }

.lb-bg {
  position: absolute;
  inset: 0;
  background: #120307;
  opacity: 0;
}

.lb-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.lb-img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.lb-close {
  position: absolute;
  top: calc(10px + var(--safe-top));
  right: 12px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
}

.lb-foot {
  position: absolute;
  inset: auto 0 calc(16px + var(--safe-bottom));
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  text-align: center;
}

.lb-caption {
  padding: 5px 12px 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 16px;
  line-height: 1.3;
}

.lb-foot small { font-size: 14px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }

/* PIN gate */
.gate {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: #8e1428 url("assets/gharchola.svg") center top / 196px;
  transition: opacity 0.8s ease;
}

.gate.leaving { opacity: 0; pointer-events: none; }

.gate-panel {
  width: var(--shell);
  margin: 0 auto;
  padding: 22px 28px calc(22px + var(--safe-bottom));
  border-radius: 32px 32px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(46, 8, 17, 0.56);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  color: var(--gulabi);
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.8s cubic-bezier(0.3, 0, 0.2, 1);
}

.gate.ready .gate-panel { opacity: 1; }

.gate.leaving .gate-panel { transform: translateY(40px) scale(1.02); }

.gate-hello { font: 400 44px/1.15 var(--serif); }

.gate-msg { margin-top: 2px; min-height: 52px; font-size: 17px; line-height: 1.4; }

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 14px 0 16px;
}

.pin-dots.shake { animation: shake 0.42s ease; }

.pin-dots i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 240, 234, 0.75);
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.pin-dots i.on { background: var(--zari); border-color: var(--zari); transform: scale(1.1); }

@keyframes shake {
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(6px, 1.2vh, 12px);
  max-width: 300px;
  margin: 0 auto;
}

.keypad button {
  height: clamp(54px, 9vh, 70px);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  transition: transform 0.1s ease, background-color 0.1s ease;
}

.keypad button:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.28); }

.keypad .erase { background: none; border-color: transparent; display: grid; place-items: center; }

@media (min-width: 431px) {
  .app { box-shadow: 0 0 60px rgba(20, 2, 6, 0.5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
