/* =====================================================================
   Christmas Magic: shared design system
   Midnight blue + warm gold, berry and pine accents, frosted glass.
   Shrikhand (fun retro display) for big titles, Plus Jakarta Sans for UI.
   ===================================================================== */
:root {
  --ink: #060b1a;
  --night: #0b1430;
  --night-2: #14214a;
  --glass: rgba(255, 255, 255, .07);
  --glass-2: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .14);
  --text: #f4f6ff;
  --muted: #a8b3d6;
  --gold: #ffc95c;
  --gold-2: #ff9d3a;
  --berry: #ff4f6d;
  --pine: #3ddc97;
  --frost: #9fd8ff;
  --radius: 22px;
  --display: 'Shrikhand', 'Plus Jakarta Sans', serif; /* fun retro display font for big titles */
  --ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* kept for older rules */
  --snow: var(--text);
  --navy: var(--night);
  --navy-2: var(--night-2);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--text);
  font-family: var(--ui); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }
.link { color: var(--muted); text-decoration: none; border-bottom: 1px solid rgba(168, 179, 214, .35); }
.link:hover { color: var(--text); }

.screen { position: fixed; inset: 0; }

/* ---------- backdrop for the menu / intro screens ---------- */
#menu, #intro {
  display: grid; place-items: center; padding: max(28px, env(safe-area-inset-top)) 18px 28px; overflow-y: auto;
}
#intro { padding-top: calc(70px + env(safe-area-inset-top));
  background:
    radial-gradient(60% 45% at 12% 0%, rgba(61, 220, 151, .16), transparent 70%),
    radial-gradient(55% 40% at 95% 8%, rgba(159, 216, 255, .12), transparent 70%),
    radial-gradient(70% 50% at 50% 115%, rgba(255, 157, 58, .22), transparent 70%),
    radial-gradient(40% 30% at 85% 85%, rgba(255, 79, 109, .12), transparent 70%),
    linear-gradient(180deg, var(--ink) 0%, var(--night) 55%, var(--night-2) 100%);
}

/* twinkling stars and slowly drifting northern lights */
#menu::before, #intro::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 47% 14%, #fff, transparent), radial-gradient(1px 1px at 66% 6%, #fff, transparent),
    radial-gradient(2px 2px at 84% 20%, #fff, transparent), radial-gradient(1px 1px at 92% 38%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 6% 44%, #fff, transparent), radial-gradient(1px 1px at 38% 30%, #fff, transparent),
    radial-gradient(1px 1px at 74% 34%, #fff, transparent), radial-gradient(1.5px 1.5px at 58% 26%, #fff, transparent);
  animation: twinkle 4s ease-in-out infinite alternate;
}
#menu::after, #intro::after {
  content: ''; position: absolute; left: -20%; right: -20%; top: -10%; height: 55%; pointer-events: none;
  background: radial-gradient(40% 50% at 30% 40%, rgba(61, 220, 151, .22), transparent 70%), radial-gradient(35% 45% at 70% 30%, rgba(159, 120, 255, .16), transparent 70%);
  filter: blur(30px); animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes twinkle { 0% { opacity: .35; } 50% { opacity: .9; } 100% { opacity: .5; } }
@keyframes aurora { 0% { transform: translateX(-6%) skewX(-6deg); opacity: .7; } 100% { transform: translateX(6%) skewX(6deg); opacity: 1; } }

/* soft bokeh snow */
.snowfall { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.flake {
  position: absolute; top: -12px; border-radius: 50%; background: #fff; color: transparent; font-size: 0 !important;
  width: var(--s, 4px); height: var(--s, 4px); opacity: var(--o, .6); filter: blur(var(--b, 0px));
  animation: fall linear infinite;
}
@keyframes fall { to { transform: translate3d(var(--drift, 20px), 110vh, 0); } }

/* ---------- type ---------- */
.kicker {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
}
.kicker::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--berry); box-shadow: 0 0 10px var(--berry); }
h1 {
  font-family: var(--display); font-style: normal; font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(44px, 12.5vw, 72px); line-height: .98; margin: 14px 0 12px;
  background: linear-gradient(180deg, #fff8e6 10%, var(--gold) 60%, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 190, 90, .18);
}
h2 { font-family: var(--display); font-style: normal; font-weight: 700; letter-spacing: -.01em; }
.lede { font-size: 17px; line-height: 1.5; color: #dfe5fb; margin: 0 auto 22px; max-width: 34ch; }
.fine { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 16px 8px 0; }
.error { color: #ffb3c0; font-weight: 700; margin-top: 14px; }
.signoff { font-family: var(--display); font-style: normal; font-weight: 600; color: var(--gold); }

/* ---------- buttons ---------- */
.big-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 17px 30px;
  font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: #2a1200;
  background: linear-gradient(180deg, #ffe39a 0%, var(--gold) 45%, var(--gold-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 10px 30px -8px rgba(255, 157, 58, .65), 0 0 0 1px rgba(255, 220, 150, .35);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s;
}
.big-btn { position: relative; overflow: hidden; isolation: isolate; }
.big-btn::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.65) 50%, transparent 65%);
  transform: translateX(-120%); animation: glint 4.5s ease-in-out infinite;
}
@keyframes glint { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.big-btn:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 14px 36px -8px rgba(255, 157, 58, .8), 0 0 0 1px rgba(255, 220, 150, .5); }
.big-btn:active { transform: scale(.97); }
.big-btn:disabled { filter: saturate(.4) brightness(.85); }
.big-btn.small { font-size: 16px; padding: 13px 22px; }
.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--glass); color: var(--text);
  border-radius: 999px; padding: 12px 20px; font-weight: 700;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .2s, transform .15s;
}
.ghost-btn:hover { background: var(--glass-2); }
.ghost-btn:active { transform: scale(.97); }
.big-btn svg, .ghost-btn svg { width: 20px; height: 20px; flex: none; }

/* ---------- intro card (street + game) ---------- */
.intro-card, .menu-card { position: relative; z-index: 1; width: 100%; text-align: center; }
.intro-card { max-width: 440px; }
figure { margin: 0 auto 24px; }
#house-img {
  width: 100%; max-height: 36vh; object-fit: cover; border-radius: var(--radius); display: block;
  border: 1px solid var(--line); box-shadow: 0 24px 60px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255, 201, 92, .25);
}
figcaption { margin-top: 12px; color: #dfe5fb; font-weight: 600; font-size: 15px; line-height: 1.45; }

/* ---------- menu ---------- */
.menu-card { max-width: 760px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 6px 0 6px; }
.choice {
  position: relative; display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left;
  text-decoration: none; color: inherit; font: inherit; cursor: pointer;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 24px 50px -24px rgba(0,0,0,.8);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: transform .2s ease, border-color .2s, box-shadow .2s;
}
.choice:hover { transform: translateY(-3px); border-color: rgba(255, 201, 92, .55); box-shadow: 0 28px 60px -24px rgba(255, 157, 58, .45); }
.choice:active { transform: scale(.98); }
.choice .pic { position: relative; }
.choice img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.choice .pic::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(6, 11, 26, .55)); }
.choice .tag {
  position: absolute; left: 12px; top: 12px; z-index: 1; padding: 6px 11px; border-radius: 999px;
  background: rgba(6, 11, 26, .62); border: 1px solid var(--line); font-size: 12px; font-weight: 800; letter-spacing: .02em;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.choice-text { display: grid; gap: 6px; padding: 16px 18px 18px; }
.choice-text b { font-family: var(--display); font-style: normal; font-weight: 700; font-size: 24px; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.choice-text span { font-size: 14px; color: #cfd7f3; line-height: 1.45; }
.choice-text em {
  font-style: normal; font-weight: 800; color: var(--gold); font-size: 14px; margin-top: 4px;
  display: inline-flex; align-items: center; gap: 6px;
}
.choice-text em::after { content: '→'; transition: transform .2s; }
.choice:hover .choice-text em::after { transform: translateX(4px); }
.menu-card .signoff { font-size: 22px; margin-top: 18px; }
@media (max-width: 560px) {
  .choices { grid-template-columns: 1fr; gap: 12px; }
  .choice { flex-direction: row; align-items: stretch; }
  .choice .pic { width: 40%; flex: none; }
  .choice img { height: 100%; aspect-ratio: auto; min-height: 150px; }
  .choice .pic::after { background: linear-gradient(90deg, transparent 60%, rgba(6, 11, 26, .4)); }
  .choice .tag { left: 8px; top: 8px; font-size: 11px; padding: 5px 9px; }
  .choice-text { align-content: center; padding: 14px 16px; }
  .choice-text b { font-size: 20px; }
}

/* ---------- AR view ---------- */
#ar { background: #000; touch-action: none; }
#cam, #gl, #night-sky, #cam-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
#cam { object-fit: cover; }
/* soft blurred copy of the camera behind the picture, filling the bands in "Wide" view */
#cam-bg { object-fit: cover; filter: blur(24px) brightness(.45) saturate(1.2); transform: scale(1.15); }
#night-sky { background: radial-gradient(80% 50% at 50% 0%, #16224a, transparent), linear-gradient(180deg, #030716, #0b1838 60%, #1a2550); }
#gl { display: block; }

.overlay { position: absolute; inset: 0; z-index: 4; pointer-events: none; display: grid; place-items: center; }
/* while lining up, the instructions sheet replaces the shutter */
#ar.aiming .hud.bottom, #ar:has(#calibrate:not([hidden])) .hud.bottom { display: none; }
.frame { position: relative; width: 72vw; max-width: 380px; aspect-ratio: 1160 / 910; margin-bottom: 26vh; }
#ghost {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  border-radius: 16px; opacity: .28; mix-blend-mode: screen;
}
.frame span {
  position: absolute; width: 34px; height: 34px; border: 3px solid var(--gold);
  filter: drop-shadow(0 0 8px rgba(255, 201, 92, .8));
  animation: breathe 1.8s ease-in-out infinite;
}
.frame span:nth-child(2) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.frame span:nth-child(3) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.frame span:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.frame span:nth-child(5) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }
@keyframes breathe { 50% { opacity: .5; } }

/* bottom sheet with the instructions + main button */
.calibrate-msg {
  position: absolute; left: 14px; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 440px; pointer-events: auto;
  display: grid; gap: 4px; text-align: center; padding: 20px 18px 18px;
  background: rgba(8, 14, 34, .72); border: 1px solid var(--line); border-radius: 26px;
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.8);
}
.calibrate-msg strong { font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.calibrate-msg span { font-size: 14px; color: var(--muted); font-weight: 600; }
.calibrate-msg .big-btn { justify-self: stretch; margin-top: 12px; }
#place-btn { pointer-events: auto; }

.err {
  position: absolute; left: 12px; right: 12px; top: calc(80px + env(safe-area-inset-top)); padding: 12px 14px; border-radius: 14px;
  background: rgba(120, 0, 30, .88); font: 700 13px/1.4 var(--ui); white-space: pre-wrap; z-index: 5;
}

.hint {
  position: absolute; left: 50%; bottom: calc(126px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 999px;
  background: rgba(8, 14, 34, .7); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  animation: hintIn .45s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }

.hud { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 14px 16px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud.top { top: env(safe-area-inset-top); justify-content: space-between; }
.hud.bottom { bottom: env(safe-area-inset-bottom); justify-content: center; padding-bottom: 26px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(8, 14, 34, .5); color: #fff; display: grid; place-items: center; padding: 0;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .i-off { display: none; }
.icon-btn.off .i-on { display: none; }
.icon-btn.off .i-off { display: block; }
.icon-btn.off { color: var(--muted); }
.view-btn { width: auto; min-width: 46px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 800; letter-spacing: .02em; }
.shutter {
  width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; padding: 0;
  background: transparent; display: grid; place-items: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.shutter::after { content: ''; width: 56px; height: 56px; border-radius: 50%; background: #fff; transition: transform .15s, background .2s; }
.shutter:active::after { transform: scale(.86); background: var(--gold); }
.flash { position: absolute; inset: 0; background: #fff; animation: flash .45s ease-out forwards; pointer-events: none; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; overflow-y: auto;
  background: rgba(4, 8, 20, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
  width: 100%; min-width: 0; max-width: 440px; text-align: center; padding: 22px 18px 20px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(22, 34, 74, .92), rgba(11, 20, 48, .94));
  border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0,0,0,.8);
  animation: rise .35s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
#photo-img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 18px; display: block; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .flake, .frame span, .hint, .modal, .modal-card, h1, .big-btn::after, #menu::before, #intro::before, #menu::after, #intro::after { animation: none; }
  .big-btn, .choice { transition: none; }
}

/* ---------- navigation: the same Home control everywhere ---------- */
.nav-home {
  position: absolute; z-index: 5; top: calc(14px + env(safe-area-inset-top)); left: 14px;
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px 0 11px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); color: var(--text); text-decoration: none;
  font-size: 14px; font-weight: 700; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background .2s, transform .15s;
}
.nav-home:hover { background: var(--glass-2); }
.nav-home:active { transform: scale(.96); }
.nav-home svg { width: 18px; height: 18px; }
.hud-group { display: flex; gap: 10px; }
a.icon-btn { text-decoration: none; }
.text-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 8px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 700; transition: color .2s, background .2s;
}
.text-btn:hover { color: var(--text); background: var(--glass); }
.text-btn svg { width: 16px; height: 16px; }
.menu-card .signoff { line-height: 1.15; }
.signoff-sub {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px;
  font-family: var(--ui); font-size: 12px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); opacity: .85;
}
.signoff-sub::before, .signoff-sub::after { content: '✦'; font-size: 10px; letter-spacing: 0; color: var(--gold); opacity: .8; }
.nowrap { white-space: nowrap; }
