@font-face {
  font-family: 'Fandom';
  src: url('/assets/fonts/FandomFamily-Regular.otf') format('opentype');
  font-display: block;
}

:root {
  --teal: #10e8d5;
  --teal-2: #0bc4b4;
  --teal-glow: rgba(16, 232, 213, .45);
  --ink: #0b0b0b;
  --gray: #4c4c4c;
  --line: #3a3a3a;
  --white: #f4f7f7;
  --red: #ff5a6e;
  --ui: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #000;
  color: var(--white);
  font-family: var(--ui);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }

/* ───────── backdrop ───────── */
.bg {
  position: fixed; inset: 0;
  background: #000 center bottom / cover no-repeat;
  opacity: 0;
  transition: opacity .8s ease;
}
.bg.on { opacity: 1; }
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 3; }

/* ───────── stage (design units, scaled by JS) ───────── */
#stage {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  z-index: 2;
}
.abs { position: absolute; }
.ff { font-family: 'Fandom', var(--ui); text-transform: uppercase; line-height: 1; letter-spacing: .01em; }
.page { position: absolute; inset: 0; }
.page.enter { animation: pageIn .55s cubic-bezier(.2, .8, .2, 1) both; }
.page.leave { animation: pageOut .3s ease both; pointer-events: none; }
@keyframes pageIn { from { opacity: 0; transform: scale(1.025); } to { opacity: 1; transform: none; } }
@keyframes pageOut { to { opacity: 0; transform: scale(.985); } }

.title {
  color: var(--teal);
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 0 28px #000, 0 0 60px #000, 0 0 90px rgba(0, 0, 0, .9);
}
.title.wrap { white-space: normal; line-height: 1.05; }
.sub {
  color: #fff;
  text-align: center;
  text-shadow: 0 0 18px #000, 0 0 40px #000;
}
.greet {
  color: #fff;
  text-align: center;
  opacity: .92;
  text-shadow: 0 0 18px #000;
}
.greet b { color: var(--teal); font-weight: normal; }

/* ornaments swing from their string */
.orn { transform-origin: 50% 0; animation: swing var(--d, 6s) ease-in-out var(--delay, 0s) infinite alternate; pointer-events: none; }
.orn img { width: 100%; height: 100%; display: block; }
@keyframes swing { from { transform: rotate(calc(var(--a, 2deg) * -1)); } to { transform: rotate(var(--a, 2deg)); } }

.lista img { width: 100%; height: 100%; display: block; }

/* ───────── chrome: language + navigation ───────── */
.lang { display: flex; gap: 14px; align-items: center; justify-content: flex-end; font-size: 40px; z-index: 20; }
.lang button { background: none; border: 0; padding: 0 2px 4px; cursor: pointer; color: #fff; font: inherit; border-bottom: 4px solid transparent; }
.lang button.on { color: var(--teal); border-bottom-color: var(--teal); }
.lang span { color: #fff; font-size: 36px; }

.navbtn {
  background: none; border: 0; cursor: pointer; color: #fff; font-size: 40px;
  display: flex; align-items: center; gap: 12px; padding: 0; z-index: 20;
}
.navbtn:hover { color: var(--teal); }
.navbtn svg { width: 1em; height: 1em; }
.arrow {
  background: rgba(0, 0, 0, .35); border: 4px solid var(--teal); border-radius: 50%;
  color: var(--teal); cursor: pointer; display: grid; place-items: center; z-index: 20;
  transition: transform .2s, background .2s;
}
.arrow:hover { transform: scale(1.08); background: var(--teal); color: #000; }
.arrow svg { width: 46%; height: 46%; }
.arrow .num { position: absolute; bottom: -46px; font-size: 30px; color: #fff; }

/* ───────── welcome: gift ───────── */
.gift-lid, .gift-box {
  background: var(--teal);
  border: 5px solid var(--line);
}
.gift-lid { z-index: 3; border-radius: 4px; }
.gift-box { z-index: 1; border-top: 0; }
.tile {
  background: var(--teal);
  border: 4px solid var(--gray);
  border-radius: 20px;
  display: grid; place-items: center;
  color: var(--gray);
  font-size: 54px;
  cursor: pointer;
  z-index: 2;
  transition: transform .22s cubic-bezier(.3, 1.6, .5, 1), background .3s, color .3s, box-shadow .3s;
  padding-top: 6px;
}
.tile:hover, .tile:focus-visible { transform: scale(1.1); box-shadow: 0 0 0 4px rgba(255, 255, 255, .25), 0 10px 30px rgba(0, 0, 0, .45); outline: none; }
.tile.seen { background: var(--gray); color: #000; border-color: #2e2e2e; }
.wrapped .tile { opacity: 0; transform: scale(.4); pointer-events: none; }

.strap { z-index: 4; background: linear-gradient(90deg, #0fd6c4, #3ff5e6 50%, #0fd6c4); border: 4px solid var(--line); }
.strap.h { background: linear-gradient(180deg, #0fd6c4, #3ff5e6 50%, #0fd6c4); }
.bow { z-index: 6; cursor: pointer; }
.bow .half { position: absolute; inset: 0; background-size: 100% 100%; }
.bow .half.l { clip-path: inset(0 50% 0 0); }
.bow .half.r { clip-path: inset(0 0 0 50%); }
.wrapped .bow { animation: bob 2.4s ease-in-out infinite; }
.wrapped .gift-box, .wrapped .gift-lid, .wrapped .strap { cursor: pointer; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(-1.5deg); } }
.hint { color: #fff; text-align: center; font-size: 34px; animation: pulse 1.6s ease-in-out infinite; z-index: 7; pointer-events: none; }
@keyframes pulse { 50% { opacity: .35; } }
.rewrap { background: none; border: 0; color: rgba(255, 255, 255, .55); cursor: pointer; font-size: 26px; z-index: 7; text-align: center; }
.rewrap:hover { color: var(--teal); }

/* ───────── video frames + ribbon ───────── */
.vframe { border: 5px solid var(--gray); background: #000; overflow: hidden; cursor: pointer; z-index: 5; }
.vframe.teal { border-color: var(--teal); }
.vframe > .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .6s; }
.vframe .ribbon { position: absolute; transform-origin: var(--kx) var(--ky); pointer-events: none; }
.vframe .arm { position: absolute; inset: 0; background-size: 100% 100%; will-change: transform; }
.vframe .playbtn { position: absolute; transition: transform .25s, opacity .3s; filter: drop-shadow(0 0 18px rgba(0, 0, 0, .8)); }
.vframe:hover .playbtn { transform: scale(1.15); }
.vframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .6s .2s; }
.vframe.playing { cursor: default; }
.vframe.playing iframe { opacity: 1; }
.vframe.playing > .poster { opacity: 0 !important; }

/* ───────── social wall ───────── */
.wallcell {
  border: 4px solid var(--gray); border-radius: 18px; overflow: hidden; background: #050505;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .55);
}
.wallcell .ph { position: absolute; inset: 0; transition: opacity 1s ease, transform 6s ease; }
.wallcell .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wallcell .ph.out { opacity: 0; }
.wallcell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  font-size: 22px; line-height: 1.2;
}
.wallcell .cap b { display: block; color: var(--teal); font-family: 'Fandom', var(--ui); text-transform: uppercase; font-size: 28px; font-weight: normal; }
.wallcell.empty { display: grid; place-items: center; background: rgba(16, 232, 213, .06); border-style: dashed; }
.wallcell.empty img { width: 45%; opacity: .5; }
.wallpanel {
  background: rgba(0, 0, 0, .82); border: 5px solid var(--teal); border-radius: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; text-align: center; padding: 30px;
  box-shadow: 0 0 60px rgba(16, 232, 213, .25);
}
.wallpanel .qr { background: #fff; padding: 14px; border-radius: 18px; }
.wallpanel .qr svg { display: block; }
.wallpanel p { margin: 0; color: #fff; font-size: 38px; line-height: 1.1; }
.wallpanel .big { color: var(--teal); font-size: 52px; }
.wallpanel .txt { font-family: var(--ui); text-transform: none; font-size: 28px; line-height: 1.35; color: #e9eeee; }

/* ───────── buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--teal); color: #000; border: 4px solid var(--gray); border-radius: 18px;
  font-family: 'Fandom', var(--ui); text-transform: uppercase; font-size: 40px; line-height: 1;
  padding: 20px 38px 16px; cursor: pointer; text-decoration: none;
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s;
}
.btn:hover { transform: scale(1.05); box-shadow: 0 0 30px var(--teal-glow); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--teal); border-color: var(--teal); }

/* ───────── panels used by the games ───────── */
.panel {
  background: rgba(0, 0, 0, .78); border: 4px solid var(--gray); border-radius: 24px; padding: 34px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.panel h3 { margin: 0 0 18px; color: var(--teal); font-family: 'Fandom', var(--ui); font-weight: normal; text-transform: uppercase; font-size: 40px; }
.panel p { margin: 0 0 16px; font-size: 24px; line-height: 1.4; color: #e8eeee; }
.panel .small { font-size: 20px; color: #9fb3b1; }
.stat { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 2px solid #222; }
.stat span { font-size: 22px; color: #9fb3b1; text-transform: uppercase; letter-spacing: .08em; }
.stat b { font-family: 'Fandom', var(--ui); font-weight: normal; font-size: 46px; color: #fff; }
.board { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.board li { display: flex; gap: 14px; align-items: center; padding: 9px 0; font-size: 23px; border-bottom: 1px solid #1f1f1f; }
.board li .r { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #1a1a1a; color: #fff; font-family: 'Fandom', var(--ui); font-size: 26px; flex: none; padding-top: 3px; }
.board li:nth-child(-n+3) .r { background: var(--teal); color: #000; }
.board li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li .n small { color: #7f9290; margin-left: 8px; font-size: 18px; }
.board li .tm { font-family: 'Fandom', var(--ui); font-size: 28px; color: var(--teal); }
.board li.me { background: rgba(16, 232, 213, .12); border-radius: 10px; }

/* pexeso */
.pxgrid { display: grid; gap: var(--gap); }
.pxcard { perspective: 900px; cursor: pointer; }
.pxcard .in { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.3, .9, .3, 1); transform-style: preserve-3d; }
.pxcard.open .in, .pxcard.done .in { transform: rotateY(180deg); }
.pxcard .f, .pxcard .b { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; overflow: hidden; border: 4px solid var(--gray); }
.pxcard .b { background: var(--teal) url('/assets/bow_d.png') center 42% / 62% no-repeat; }
.pxcard .b::after { content: ''; position: absolute; inset: 8px; border: 2px dashed rgba(0, 0, 0, .25); border-radius: 8px; }
.pxcard .f { transform: rotateY(180deg); background: #000 center / cover no-repeat; }
.pxcard.done .f { border-color: var(--teal); box-shadow: 0 0 22px var(--teal-glow); }
.pxcard.done { animation: pop .4s ease; cursor: default; }
.pxcard.wrong .in { animation: shake .35s ease; }
.pxlocked .pxcard { cursor: default; }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 25% { transform: rotateY(180deg) translateX(-6px); } 75% { transform: rotateY(180deg) translateX(6px); } }
.pxveil { display: grid; place-items: center; z-index: 10; background: rgba(0, 0, 0, .55); border-radius: 24px; backdrop-filter: blur(3px); }

/* wheel */
.wheel-wrap { z-index: 5; }
.wheel-wrap svg { width: 100%; height: 100%; overflow: visible; }
.wheel-rot { transform-origin: 50% 50%; transform-box: fill-box; }
.wheel-pointer { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); }
.wheel-hub { cursor: pointer; }
.wheel-hub:hover circle.hubc { fill: #fff; }
.wheel-lights circle { animation: blink 1.2s steps(2, jump-none) infinite; }
.wheel-lights circle:nth-child(2n) { animation-delay: .6s; }
@keyframes blink { 50% { opacity: .25; } }

/* matching */
.monitor { z-index: 4; }
.monitor .scr { position: absolute; inset: 0; border: 10px solid #1d1d1d; border-radius: 12px; overflow: hidden; background: #000; box-shadow: 0 0 0 3px var(--gray), 0 10px 30px rgba(0, 0, 0, .6); }
.monitor video, .monitor img { width: 100%; height: 100%; object-fit: cover; display: block; }
.monitor .neck { position: absolute; left: 50%; width: 40px; height: 26px; margin-left: -20px; background: linear-gradient(#2a2a2a, #111); }
.monitor .foot { position: absolute; left: 50%; width: 120px; height: 12px; margin-left: -60px; background: #2a2a2a; border-radius: 8px 8px 3px 3px; }
.plabel {
  z-index: 4; background: rgba(0, 0, 0, .8); border: 4px solid var(--gray); border-radius: 18px;
  display: grid; place-items: center; text-align: center; padding: 10px 16px; font-size: 26px; line-height: 1.15; color: #fff;
}
.plabel.ok { border-color: var(--teal); box-shadow: 0 0 24px var(--teal-glow); }
.plabel.bad { border-color: var(--red); }
.socket {
  z-index: 6; border-radius: 50%; background: #111; border: 5px solid var(--teal); cursor: grab;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .6); touch-action: none;
}
.socket::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #333; }
.socket.used::after { background: var(--c, var(--teal)); }
.socket:hover { transform: scale(1.15); }
.cables { z-index: 3; pointer-events: none; overflow: visible; }
.cables path { fill: none; stroke-linecap: round; }
.cables .shadow { stroke: rgba(0, 0, 0, .55); }
.cables .bad { stroke-dasharray: 18 14; }

/* ───────── modal ───────── */
.modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; overflow: auto;
}
.modal.in { opacity: 1; }
.modal.out { opacity: 0; }
.modal-card {
  position: relative; width: min(520px, 100%); background: #070707; border: 3px solid var(--teal); border-radius: 22px;
  padding: 34px 28px 28px; box-shadow: 0 0 60px rgba(16, 232, 213, .25); transform: translateY(14px) scale(.97); transition: transform .3s cubic-bezier(.2, 1.4, .4, 1);
}
.modal.in .modal-card { transform: none; }
.modal-x { position: absolute; right: 10px; top: 6px; background: none; border: 0; color: #9fb3b1; font-size: 34px; cursor: pointer; line-height: 1; }
.modal h2 { margin: 0 0 10px; font-family: 'Fandom', var(--ui); font-weight: normal; text-transform: uppercase; color: var(--teal); font-size: 34px; line-height: 1.05; }
.modal p { margin: 0 0 16px; line-height: 1.5; color: #e3eaea; font-size: 16px; }
.modal .btn { font-size: 24px; padding: 14px 26px 11px; border-radius: 14px; border-width: 3px; }
.gate input {
  width: 100%; margin: 0 0 12px; padding: 14px 16px; border-radius: 12px; border: 2px solid #333; background: #111; color: #fff; font-size: 16px; font-family: var(--ui);
}
.gate input:focus { border-color: var(--teal); outline: none; }
.gate-err { color: var(--red) !important; min-height: 1em; font-size: 14px !important; }
.result { text-align: center; }
.result .emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }

@media (prefers-reduced-motion: reduce) {
  .orn, .wrapped .bow, .hint, .wheel-lights circle { animation: none !important; }
  .page.enter { animation-duration: .01s; }
}
