/* Shaadi Kab? — one theme: a Diwali night. Colours from the mockups. No inline styles anywhere
   (the CSP's style-src is 'self'), so every look lives here. */

@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/baloo-2-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/baloo-2-latin-800-normal.woff2') format('woff2');
}

:root {
  --night: #1d1838;
  --night-deep: #16122c;
  --plum: #4a2a5e;
  --marigold: #f5a623;
  --marigold-dark: #9a5c0c;
  --pink: #d6336c;
  --pink-dark: #8f1a44;
  --cream: #fff4e0;
  --sand: #f6c99c;
  --muted: #e7d6c4;
  --ink: #2b1d14;
  --font: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

/* `hidden` must win over any display rule below (the sheets are flex boxes). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(120% 70% at 50% 100%, var(--plum), var(--night) 70%) fixed;
  background-color: var(--night);
  color: var(--cream);
  font: 600 17px/1.4 var(--font);
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--sand);
}
a:hover {
  color: var(--cream);
}

:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 3px;
}

.screen {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

/* Title */

.title {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100svh;
  overflow: hidden;
}

.fireworks {
  position: absolute;
  inset: 0 0 auto 0;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.fw {
  fill: none;
  stroke-linecap: round;
  stroke-width: 3;
  stroke-dasharray: 1 9;
}
.fw-inner {
  stroke-width: 2.4;
  stroke-dasharray: 1 7;
  opacity: 0.7;
}
.fw-gold {
  stroke: #ffd54f;
}
.fw-pink {
  stroke: #f48fb1;
}
.fw-teal {
  stroke: #80deea;
}
.fw-coral {
  stroke: #ff8a65;
}

.kicker {
  position: relative;
  margin: clamp(8px, 5svh - 12px, 56px) 0 0;
  /* The phone's own Devanagari font (see scripts/build-client-shared.mjs). */
  font-family: 'Noto Sans Devanagari', 'Kohinoor Devanagari', 'Mangal', system-ui, sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sand);
}

.logo {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-weight: 800;
  line-height: 0.95;
}
.logo-1 {
  font-size: clamp(50px, 9svh, 76px);
  color: var(--marigold);
  text-shadow:
    0 2px 0 var(--pink),
    0 4px 0 #c2185b,
    0 6px 0 #9c1046,
    0 8px 0 #7a0c37,
    0 18px 24px rgb(0 0 0 / 45%);
}
.logo-2 {
  font-size: clamp(60px, 11svh, 92px);
  color: var(--cream);
  transform: rotate(-4deg);
  text-shadow:
    0 2px 0 var(--marigold),
    0 4px 0 #e0901a,
    0 6px 0 #c47812,
    0 8px 0 var(--marigold-dark),
    0 18px 24px rgb(0 0 0 / 45%);
}

.lede {
  position: relative;
  margin: 10px 0 0;
  font-size: 19px;
}

/* The preview shrinks first, so the title fits a laptop window or a phone without scrolling. */
.stage-wrap {
  position: relative;
  width: 100%;
  height: clamp(110px, 100svh - 520px, 300px);
  margin: 4px 0;
}
#stage {
  display: block;
  width: 100%;
  height: 100%;
}
.no-webgl .stage-wrap {
  display: none;
}

.avatar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar-label {
  font-size: 15px;
  color: var(--sand);
}

.pill {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 2px solid rgb(255 244 224 / 55%);
  background: transparent;
  color: var(--cream);
  font: 700 17px var(--font);
  cursor: pointer;
}
.pill[aria-pressed='true'] {
  border-color: var(--marigold);
  background: var(--marigold);
  color: var(--ink);
  font-weight: 800;
}

.btn-primary {
  min-width: 250px;
  min-height: 58px;
  margin-top: 16px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--pink);
  color: var(--cream);
  font: 800 22px var(--font);
  box-shadow:
    0 6px 0 var(--pink-dark),
    0 16px 24px rgb(0 0 0 / 35%);
  cursor: pointer;
}
.btn-primary:disabled {
  background: #5a3d6e;
  box-shadow: 0 6px 0 #3a2550;
  color: var(--muted);
  font-size: 19px;
  cursor: default;
}

.note {
  min-height: 1.4em;
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--muted);
}
.no-webgl .note {
  max-width: 34ch;
  color: var(--cream);
}

.links {
  margin: 8px 0 0;
  font-size: 15px;
}

/* Plain pages (about, 404) */

.page {
  max-width: 640px;
  padding-top: max(40px, env(safe-area-inset-top));
}
.page-title {
  margin: 0 0 12px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--marigold);
}
.page h2 {
  margin: 28px 0 6px;
  font-size: 21px;
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* Buttons that look like links */

.link-btn {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--sand);
  font: 600 15px var(--font);
  text-decoration: underline;
  cursor: pointer;
}

/* Room select */

.rooms {
  text-align: center;
}
.screen-title {
  margin: 8px 0 16px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--marigold);
  outline: none;
}
.room-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.room-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  grid-template-rows: auto auto 1fr auto;
  column-gap: 14px;
  width: 100%;
  min-height: 132px;
  padding: 10px;
  border: 2px solid rgb(255 244 224 / 18%);
  border-radius: 20px;
  background: rgb(255 244 224 / 7%);
  color: var(--cream);
  font: 600 15px/1.3 var(--font);
  text-align: left;
  cursor: pointer;
}
.room-card:hover {
  border-color: var(--marigold);
}
.room-card img {
  grid-row: 1 / 5;
  width: 112px;
  height: 112px;
  border-radius: 14px;
  object-fit: cover;
  object-position: 50% 48%;
  background: var(--night-deep);
}
.room-name {
  font-size: 21px;
  font-weight: 800;
}
.room-level {
  justify-self: start;
  margin: 2px 0 4px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}
.level-easy {
  background: #8fd694;
}
.level-medium {
  background: var(--marigold);
}
.level-hard {
  background: #ff8a9b;
}
.room-twist {
  color: var(--muted);
}
.room-best {
  color: var(--sand);
  font-size: 14px;
}

/* Play */

body.playing {
  overflow: hidden;
  overscroll-behavior: none;
}
/* Swipes and taps must never select the HUD's text or open the iOS callout. */
body.playing,
.play,
.play * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.play {
  position: fixed;
  inset: 0;
  background: radial-gradient(90% 60% at 50% 55%, #3a2552, var(--night-deep) 75%);
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hud {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 22px;
  /* A dusk band behind the HUD: the walls are bright and close in first person. */
  background: linear-gradient(rgb(22 18 44 / 72%), rgb(22 18 44 / 0%));
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}
.hud-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hud-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--sand);
}
.pips {
  display: flex;
  gap: 6px;
}
.pips i {
  width: 26px;
  height: 12px;
  border-radius: 6px;
  border: 2px solid #ef5b6c;
}
.pips i.on {
  background: #ef5b6c;
}
.timer {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.combo {
  min-width: 44px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--marigold);
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}
.combo:empty {
  visibility: hidden;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: rgb(255 244 224 / 14%);
  cursor: pointer;
}
.icon-btn path {
  stroke: var(--cream);
  stroke-width: 2.6;
  stroke-linecap: round;
}
.clap {
  --fill: 1;
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  overflow: hidden;
  padding: 4px 16px 2px;
  border-radius: 999px;
  background: rgb(29 24 56 / 85%);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  pointer-events: none;
}
.clap::before {
  content: '';
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(var(--fill));
  background: rgb(245 166 35 / 35%);
}
.clap.ready {
  background: var(--marigold);
  color: var(--ink);
}
.clap.ready::before {
  display: none;
}
.clap span {
  position: relative;
}
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 34px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 4px 14px 2px;
  border-radius: 18px;
  background: rgb(29 24 56 / 82%);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}
/* Your comeback after a clap back, at the foot of the screen. */
.said {
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 84px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 6px 16px 4px;
  border-radius: 18px;
  border: 2.5px solid #3949ab;
  background: var(--cream);
  color: #1a237e;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.said.show {
  animation: toast 2.2s ease forwards;
}
.popups {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pop {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 40%);
  transform: translate(-50%, -50%);
  font-weight: 800;
  white-space: nowrap;
  animation: rise 0.9s ease-out forwards;
}
.pop-small {
  font-size: 18px;
  color: var(--marigold);
  text-shadow: 0 2px 0 var(--ink);
}
.pop-big {
  font-size: 52px;
  color: var(--cream);
  text-shadow:
    0 3px 0 var(--pink),
    0 6px 0 #9c1046,
    0 14px 20px rgb(0 0 0 / 40%);
  animation: punch 1.1s ease-out forwards;
}
@keyframes rise {
  from {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -150%);
  }
}
@keyframes punch {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6) rotate(-5deg);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1) rotate(-5deg);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-5deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(1) rotate(-5deg);
  }
}
.toast {
  position: absolute;
  left: 50%;
  top: calc(max(14px, env(safe-area-inset-top)) + 56px);
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 14px 2px;
  border-radius: 999px;
  background: rgb(255 244 224 / 92%);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.toast.show {
  animation: toast 2.4s ease forwards;
}
@keyframes toast {
  0%,
  100% {
    opacity: 0;
  }
  10%,
  80% {
    opacity: 1;
  }
}
/* The hit: a red edge that fades. Never a full-screen flash (photosensitivity). */
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 90px 30px rgb(229 57 53 / 75%);
}
.vignette.show {
  animation: vignette 0.45s ease-out;
}
@keyframes vignette {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
.boss {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  pointer-events: none;
}
.dhan {
  font-weight: 800;
  line-height: 1;
  color: var(--marigold);
  text-shadow:
    0 4px 0 var(--marigold-dark),
    0 12px 18px rgb(0 0 0 / 50%);
  opacity: 0;
}
.dhan.on {
  opacity: 1;
}
.d1 {
  font-size: 34px;
}
.d2 {
  font-size: 50px;
}
.d3 {
  font-size: 80px;
}
.boss-caption {
  margin: 18px 16px 0;
  padding: 6px 16px 4px;
  border-radius: 14px;
  background: #fff7e6;
  color: #9c1046;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}
.boss.still .dhan {
  display: none;
}

/* Sheets: how to play, pause */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgb(10 8 24 / 70%);
}
.sheet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(100%, 400px);
  padding: 24px 20px;
  border-radius: 24px;
  background: var(--night);
  border: 2px solid rgb(255 244 224 / 15%);
  text-align: center;
}
.sheet-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--marigold);
}
.steps {
  margin: 0;
  padding-left: 1.4em;
  text-align: left;
  line-height: 1.35;
}
.steps li + li {
  margin-top: 8px;
}
.keys {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.sheet-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* Game over */

.over {
  text-align: center;
}
.over .screen-title {
  margin: 0 0 10px;
  font-size: 30px;
}
/* The card takes the height that's left, so the buttons stay on screen. */
.card {
  display: block;
  height: clamp(240px, 100svh - 360px, 540px);
  width: auto;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--night-deep);
  box-shadow: 0 16px 32px rgb(0 0 0 / 45%);
}
.over-stats {
  margin: 10px 0 0;
}
.over-best {
  margin: 4px 0 0;
  color: var(--marigold);
  font-weight: 800;
}
.btn-share {
  /* Dark enough for 4.5:1 with the cream text. */
  background: #1b7a43;
  box-shadow:
    0 6px 0 #0f4d29,
    0 16px 24px rgb(0 0 0 / 35%);
}
.over .btn-share {
  margin-top: 10px;
}
.over .sheet-row {
  margin-top: 12px;
}
.over .note:empty {
  display: none;
}
.tip {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

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

/* A laptop window: the card on the left, everything else beside it. */
@media (min-width: 760px) and (min-aspect-ratio: 1/1) {
  .over {
    display: grid;
    grid-template-columns: auto minmax(0, 360px);
    grid-template-rows: 1fr auto auto auto auto auto auto auto 1fr;
    column-gap: 40px;
    justify-content: center;
    max-width: 900px;
    min-height: 100svh;
    text-align: left;
  }
  .over > * {
    grid-column: 2;
  }
  .over .screen-title {
    grid-row: 2;
  }
  .over-stats {
    grid-row: 3;
  }
  .over-best {
    grid-row: 4;
  }
  .over .btn-share {
    grid-row: 5;
    justify-self: start;
  }
  .over .sheet-row {
    grid-row: 6;
  }
  .over .note {
    grid-row: 7;
  }
  .over .tip {
    grid-row: 8;
  }
  .over .card {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: center;
    height: clamp(300px, 100svh - 64px, 640px);
  }
  .over .sheet-row {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pop,
  .pop-big,
  .toast.show,
  .vignette.show {
    animation-duration: 0.01s;
  }
  .toast.show,
  .said.show {
    animation: none;
    opacity: 1;
  }
}
