/* The Case Room · Diwali greeting. */
:root {
  --bg: #080604; --wall: #0e0b07; --fg: #f0e6d0; --fg-mid: #a8987a;
  --gold: #c8a45a; --gold-dim: #6a5228; --paper: #f3e9d4; --ink: #2b241c;
  --ink-mid: #6b5a40; --terra: #b4462f; --red: #e06a5b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 17px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 16px 32px; }
.eyebrow { margin: 0 0 12px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
h1, h2 { overflow-wrap: anywhere; }
h1, h2, .display { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 400; }
h1 { margin: 0; font-size: clamp(28px, 7.6vw, 40px); line-height: 1.18; color: var(--fg); }
.lead { margin: 10px 0 0; font-size: 17px; }
.lead strong { color: var(--gold); font-weight: 400; }

/* Scene */
.scene { cursor: pointer; position: relative; margin: 18px -8px 0; border: 1px solid var(--gold-dim); border-radius: 4px; overflow: hidden; background: var(--wall); }
.scene svg { display: block; width: 100%; height: auto; }
.scene.found { border-color: var(--gold); }
.spot {
  position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: inherit; z-index: 1;
  -webkit-tap-highlight-color: transparent;
}
.spot.is-him { z-index: 2; }
.spot:focus { outline: none; }
.spot:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--gold); }
.scene.done .spot { pointer-events: none; }
.scene.done { cursor: default; }
.opt strong { color: var(--gold); font-weight: 700; }
.stamp {
  position: absolute; left: 6%; top: 46%; transform: rotate(-8deg); z-index: 3;
  border: 2px solid var(--red); border-radius: 3px; padding: 3px 10px;
  color: var(--red); font-weight: 700; font-size: 18px; letter-spacing: .18em;
}
.stamp[hidden] { display: none; }

/* Scene animation states (SVG elements) */
#door-l, #door-r { transition: transform 1.1s cubic-bezier(.3,.7,.2,1) .5s; transform-box: fill-box; }
#door-l { transform-origin: left center; }
#door-r { transform-origin: right center; }
.found #door-l, .found #door-r { transform: scaleX(.18); }
#inner-light, #spill { opacity: 0; transition: opacity 1s ease .7s; }
.found #inner-light { opacity: 1; }
.found #spill { opacity: .22; }
#carry { transform: translate(348px, 182px); transition: transform 1s cubic-bezier(.4,0,.2,1), opacity .3s ease; }
.found #carry { transform: translate(303px, 412px); }
.found #carry.landed { opacity: 0; }
#gap-diya { opacity: 0; transition: opacity .35s ease; }
#gap-diya.lit { opacity: 1; }
#gap-mark { transition: opacity .3s ease; }
.found #gap-mark { opacity: 0; }
#ring { opacity: 0; transition: opacity .3s ease; }
.found #ring { opacity: 1; }
.glow { opacity: .7; transition: opacity 1s ease; }
.found .glow { opacity: 1; }

/* Status, hints, buttons */
.status { min-height: 1.45em; margin: 14px 0 0; font-size: 16px; }
.status strong { color: var(--gold); font-weight: 700; }
.status.miss { color: var(--fg); }
.hint { margin: 8px 0 0; font-size: 16px; color: var(--gold); }
.help { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.help[hidden] { display: none; }
.link { min-height: 44px; padding: 0 2px; border: 0; background: transparent; color: var(--gold); font: 16px 'Courier Prime', 'Courier New', monospace; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link[hidden] { display: none; }
.link:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.hint[hidden] { display: none; }
.row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  flex: 1 1 140px; min-height: 48px; padding: 10px 14px; border-radius: 4px;
  font: 16px/1.2 'Courier Prime', 'Courier New', monospace; cursor: pointer;
  border: 1px solid var(--gold); background: transparent; color: var(--gold);
  text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.btn.primary { background: var(--gold); color: var(--bg); font-weight: 700; font-size: 17px; min-height: 52px; }
.btn:hover { border-color: var(--fg); }
.btn.primary:hover { background: #d6b46c; }
.btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.btn[hidden], .row[hidden] { display: none; }

/* Greeting card */
.greeting { margin-top: 28px; }
.greeting[hidden], .make[hidden] { display: none; }
.card {
  position: relative; margin: 14px 6px 0; padding: 30px 24px 26px; transform: rotate(-1deg);
  background: var(--paper); color: var(--ink); border-radius: 2px;
  box-shadow: 0 12px 28px rgba(0,0,0,.55);
}
.card::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 96px; height: 22px; margin-left: -48px;
  background: rgba(240,230,208,.72); transform: rotate(2deg);
}
.card .ref { font-size: 12px; letter-spacing: .14em; color: var(--ink-mid); }
.card h2 { margin: 0; font-size: clamp(30px, 8.4vw, 40px); line-height: 1.12; color: var(--ink); outline: none; }
.card .msg { margin: 14px 0 0; font-size: 17px; line-height: 1.5; }
.card .sign { margin: 18px 0 0; font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 21px; }
.card .sign[hidden] { display: none; }
.card .small { margin: 20px 0 0; padding-top: 10px; border-top: 1px dashed var(--ink-mid); font-size: 13px; color: var(--ink-mid); }

/* Make one */
.make { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--gold-dim); }
.make h2 { margin: 0 0 6px; font-size: 30px; line-height: 1.2; color: var(--fg); }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field label, fieldset legend { font-size: 14px; color: var(--gold); }
.field input {
  height: 48px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--gold-dim);
  background: #14100b; color: var(--fg); font: 17px 'Courier Prime', 'Courier New', monospace;
}
.field input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.field .err { font-size: 14px; color: var(--red); min-height: 0; }
.field .err:empty { display: none; }
fieldset { margin: 18px 0 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 8px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin-top: 8px;
  border: 1px solid var(--gold-dim); border-radius: 4px; font-size: 15px; line-height: 1.35; cursor: pointer;
}
.opt:has(input:checked) { border-color: var(--gold); background: #1a140c; }
.opt input { margin: 2px 0 0; width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--gold); }
.note { margin: 14px 0 0; font-size: 14px; color: var(--fg-mid); }
.copied { font-size: 14px; color: var(--gold); min-height: 1.4em; margin: 8px 0 0; }

/* Saved image dialog */
dialog {
  width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 16px;
  border: 1px solid var(--gold-dim); border-radius: 6px; background: #120e09; color: var(--fg);
}
dialog::backdrop { background: rgba(0,0,0,.75); }
dialog img { display: block; width: 100%; height: auto; border-radius: 2px; }
dialog p { margin: 12px 0 0; font-size: 15px; }

.more { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--gold-dim); text-align: center; }
.more-link { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 24px; color: var(--gold); text-decoration: underline; text-underline-offset: 5px; display: inline-block; min-height: 44px; line-height: 44px; }
.more-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.more-line { margin: 4px 0 0; font-size: 15px; color: var(--fg-mid); }
.wrap::after { content: ''; display: block; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (min-width: 700px) {
  .wrap { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
#warmth { opacity: 0; transition: opacity 1s ease .6s; }
.found #warmth { opacity: .07; }
