/* VAKS Games: a family game shelf at night. Split-flap room numbers, game boxes on a plank, one warm lamp. */
:root {
  --ink: #150e20;
  --night: #1f1430;
  --plum: #2b1c40;
  --plum-2: #3a2756;
  --cream: #f7ecd6;
  --cream-dim: #cbbda4;
  --lamp: #ffb547;
  --tomato: #ff5b3d;
  --mint: #39d3a6;
  --gold: #f3c24f;
  --flap: #1b1822;
  --flap-hi: #2a2633;
  --line: rgba(247, 236, 214, 0.14);
  --shadow: 0 18px 40px rgba(5, 2, 10, 0.55);
  --r: 22px;
  --display: 'Unbounded', 'Fredoka', 'Rubik', sans-serif;
  --body: 'Rubik', sans-serif;
  color-scheme: dark;
}
[dir='rtl'] { --display: 'Fredoka', 'Unbounded', 'Rubik', sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(255, 181, 71, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(57, 211, 166, 0.10), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, var(--night), var(--ink) 70%);
  color: var(--cream);
  font: 400 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.lamp { position: fixed; top: -140px; inset-inline-end: -80px; width: 420px; height: 420px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 196, 102, 0.35), transparent 65%); filter: blur(10px); animation: lamp 7s ease-in-out infinite; }
@keyframes lamp { 50% { opacity: 0.75; transform: scale(1.06); } }

/* ---------------------------------------------------------------- header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px; max-width: 1240px; margin: 0 auto; }
.mark { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--cream); }
.die { width: 44px; height: 44px; border-radius: 12px; background: var(--cream); position: relative; transform: rotate(-9deg);
  box-shadow: 0 6px 0 #c9b48f, 0 12px 22px rgba(0, 0, 0, 0.5); }
.die i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--tomato); }
.die i:nth-child(1) { top: 8px; left: 8px; } .die i:nth-child(2) { top: 8px; right: 8px; }
.die i:nth-child(3) { top: 18px; left: 18px; background: var(--ink); }
.die i:nth-child(4) { bottom: 8px; left: 8px; } .die i:nth-child(5) { bottom: 8px; right: 8px; }
.word { display: flex; flex-direction: column; line-height: 0.9; direction: ltr; }
.word b { font: 900 24px/0.9 'Unbounded', sans-serif; letter-spacing: 0.02em; }
.word small { font: 600 11px/1 'Unbounded', sans-serif; letter-spacing: 0.42em; color: var(--lamp); margin-top: 4px; }
.langs { display: flex; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.langs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font: 700 14px/1 var(--body); color: var(--cream-dim); }
.langs button.on { background: var(--cream); color: var(--ink); }

/* ---------------------------------------------------------------- layout */
.layout { max-width: 1240px; margin: 0 auto; padding: 8px 16px 40px; display: grid; gap: 40px; }
@media (min-width: 980px) {
  .layout { grid-template-columns: minmax(380px, 460px) 1fr; gap: 56px; align-items: start; padding-top: 28px; }
  .join { position: sticky; top: 24px; }
}
.h { font: 800 clamp(26px, 6.6vw, 40px)/1.05 var(--display); margin: 18px 0 8px; letter-spacing: -0.01em; }
[dir='rtl'] .h { font-weight: 700; letter-spacing: 0; }
.lead { margin: 0 0 18px; color: var(--cream-dim); max-width: 34em; }
.reveal { animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--d, 0) * 110ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* how it works: three short steps */
.steps { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; }
.steps span { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font: 800 14px/1 'Unbounded', sans-serif;
  background: var(--cream); color: var(--ink); box-shadow: 0 3px 0 #bfa983; transform: rotate(-6deg); }
.steps li:nth-child(2) span { transform: rotate(5deg); background: var(--lamp); }
.steps li:nth-child(3) span { transform: rotate(-3deg); background: var(--mint); }
.steps p { margin: 3px 0 0; font-size: 15px; line-height: 1.35; }
.who { margin: 2px 0 -2px; font: 700 15px/1.2 var(--display); color: var(--lamp); }

/* ---------------------------------------------------------------- join modes */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode { position: relative; text-align: start; border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px 14px 14px;
  background: linear-gradient(160deg, var(--plum-2), var(--plum)); box-shadow: var(--shadow); display: grid; gap: 4px;
  transition: transform 0.18s, border-color 0.18s, background 0.18s; }
.mode:hover { transform: translateY(-2px); border-color: rgba(255, 181, 71, 0.5); }
.mode[aria-selected='true'] { border-color: var(--lamp); background: linear-gradient(160deg, #4a3168, var(--plum-2)); }
.mode .ico svg { width: 38px; height: 38px; fill: none; stroke: var(--lamp); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mode .mt { font: 700 17px/1.15 var(--display); }
[dir='ltr'] .mode .mt { font-size: 15px; }
.mode .ms { font-size: 13px; color: var(--cream-dim); min-height: 18px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; }
.live-dot.on::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(57, 211, 166, 0.6); animation: ping 1.8s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(57, 211, 166, 0); } 100% { box-shadow: 0 0 0 0 rgba(57, 211, 166, 0); } }

.panel { margin-top: 14px; border-radius: var(--r); padding: 18px 16px; background: rgba(10, 6, 16, 0.55); border: 1px solid var(--line); animation: rise 0.35s both; }

/* split-flap board */
.board { display: flex; justify-content: center; position: relative; cursor: text; padding: 6px 0 4px; }
.board input { position: absolute; inset: 0; opacity: 0; font-size: 16px; width: 100%; border: 0; caret-color: transparent; }
.flaps { display: flex; gap: 10px; direction: ltr; }
.flap { width: 92px; height: 124px; border-radius: 14px; position: relative; perspective: 400px;
  background: linear-gradient(180deg, var(--flap-hi) 0 50%, var(--flap) 50% 100%);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.45), 0 10px 0 #0c0a10, 0 18px 30px rgba(0, 0, 0, 0.6);
  display: grid; place-items: center; font: 900 84px/1 'Unbounded', sans-serif; color: var(--cream); }
.flap::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #07060a; }
.flap::before { content: ''; position: absolute; top: 50%; width: 8px; height: 14px; margin-top: -7px; left: -3px; border-radius: 3px; background: #4b4556; box-shadow: 92px 0 0 #4b4556; }
.flap.empty { color: transparent; }
.flap.empty span { width: 30px; height: 6px; border-radius: 3px; background: rgba(247, 236, 214, 0.18); }
.flap.cur { outline: 3px solid var(--lamp); outline-offset: 4px; }
.flap.cur.empty span { animation: blink 1s steps(1) infinite; background: var(--lamp); }
@keyframes blink { 50% { opacity: 0; } }
.flap.flip span { animation: flip 0.32s cubic-bezier(0.3, 1.4, 0.5, 1); display: inline-block; }
@keyframes flip { from { transform: rotateX(-90deg); opacity: 0.2; } }
@media (max-width: 380px) { .flap { width: 76px; height: 104px; font-size: 68px; } .flap::before { box-shadow: 76px 0 0 #4b4556; } }
.hint { text-align: center; color: var(--cream-dim); font-size: 14px; margin: 14px 0 0; }

/* where a number leads + the two ways in */
.result:empty { display: none; }
.result { margin-top: 16px; }
.found { display: grid; gap: 12px; animation: rise 0.3s both; }
.found-head { display: flex; align-items: center; gap: 12px; }
.found-head .mini { flex: none; }
.found-head b { display: block; font: 700 18px/1.15 var(--display); }
.found-head small { color: var(--cream-dim); }
.ways { display: grid; gap: 10px; }
.way { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 16px; padding: 14px 16px; text-align: start; text-decoration: none; color: var(--ink);
  background: var(--cream); box-shadow: 0 5px 0 #bfa983, 0 10px 20px rgba(0, 0, 0, 0.4); transition: transform 0.12s, box-shadow 0.12s; }
.way:active { transform: translateY(4px); box-shadow: 0 1px 0 #bfa983; }
.way.alt { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 1.5px var(--line); }
.way.alt:active { box-shadow: inset 0 0 0 1.5px var(--lamp); }
.way .em { font-size: 26px; flex: none; }
.way b { display: block; font: 700 16px/1.2 var(--display); }
.way small { display: block; font-size: 13px; opacity: 0.75; }
.miss { text-align: center; color: #ffb3a5; font-weight: 500; animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* open rooms */
.open-list { display: grid; gap: 10px; }
.room { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; padding: 12px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(58, 39, 86, 0.9), rgba(43, 28, 64, 0.9)); border: 1px solid var(--line); animation: rise 0.3s both; }
.room .no { width: 60px; height: 74px; border-radius: 10px; display: grid; place-items: center; font: 900 32px/1 'Unbounded', sans-serif; direction: ltr;
  background: linear-gradient(180deg, var(--flap-hi) 0 50%, var(--flap) 50%); box-shadow: 0 5px 0 #0c0a10; position: relative; }
.room .no::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #07060a; }
.room .info b { font: 700 16px/1.2 var(--display); display: block; }
.room .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(247, 236, 214, 0.1); color: var(--cream); }
.chip.lobby { background: rgba(57, 211, 166, 0.18); color: #8ff0cf; }
.chip.playing { background: rgba(255, 181, 71, 0.18); color: #ffd28c; }
.chip.tutorial { background: rgba(147, 121, 255, 0.2); color: #cbbcff; }
.room .ways { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
.room .way { padding: 10px 12px; }
.room .way small { display: none; } /* two short buttons side by side: the long hints are on the number screen */
.room .way b { font-size: 14px; }
.room .way .em { font-size: 20px; }
.empty-state { text-align: center; color: var(--cream-dim); padding: 18px 8px; }
.empty-state .zz { font-size: 34px; display: block; margin-bottom: 6px; }

/* ---------------------------------------------------------------- shelf of game boxes */
.shelf { display: grid; grid-template-columns: 1fr; gap: 22px; perspective: 1400px; }
@media (min-width: 640px) { .shelf { grid-template-columns: 1fr 1fr; } }
.box { position: relative; border: 0; padding: 0; text-align: start; border-radius: 18px; background: none; transform-style: preserve-3d;
  transform: rotateY(-7deg) rotateX(3deg); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); animation: rise 0.6s both; animation-delay: calc(200ms + var(--i, 0) * 120ms); }
[dir='rtl'] .box { transform: rotateY(7deg) rotateX(3deg); }
.box:hover, .box:focus-visible { transform: rotateY(0) rotateX(0) translateY(-6px); }
.box:focus-visible { outline: 3px solid var(--lamp); outline-offset: 6px; }
.box .lid { position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden; box-shadow: 14px 22px 34px rgba(0, 0, 0, 0.6); }
.box .edge { position: absolute; top: 10px; bottom: -10px; width: 18px; inset-inline-end: -14px; border-radius: 0 10px 10px 0; transform: skewY(-28deg); transform-origin: left; filter: brightness(0.55); }
[dir='rtl'] .box .edge { border-radius: 10px 0 0 10px; transform: skewY(28deg); transform-origin: right; }
.box .meta { padding: 14px 4px 0; }
.box .meta b { font: 800 20px/1.1 var(--display); display: block; }
[dir='rtl'] .box .meta b { font-weight: 700; font-size: 22px; }
.box .meta .paren { color: var(--lamp); font-weight: 600; white-space: nowrap; }
.box .meta p { margin: 6px 0 0; color: var(--cream-dim); font-size: 14px; }
.box .facts { display: flex; gap: 8px; margin-top: 10px; }
.plank { height: 18px; margin-top: 26px; border-radius: 6px; background: linear-gradient(180deg, #6b4526, #3d2614); box-shadow: 0 14px 24px rgba(0, 0, 0, 0.55), inset 0 2px 0 rgba(255, 210, 160, 0.25); }

/* box art: the dungeon (Kick the Door) */
.art-dungeon { position: absolute; inset: 0; background: #1a0f08 url('/img/ktd_bg.webp') center / cover; }
.art-dungeon::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 8, 2, 0.15), rgba(20, 8, 2, 0.75)); }
.art-dungeon .wiz { position: absolute; bottom: -4%; inset-inline-end: -2%; width: 50%; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.7)); }
.art-dungeon .chest { position: absolute; bottom: 6%; inset-inline-start: 6%; width: 28%; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.7)); }
.art-dungeon .title { position: absolute; top: 9%; inset-inline-start: 7%; font: 900 clamp(22px, 5vw, 34px)/0.95 var(--display); color: #ffe7b0;
  text-shadow: 0 3px 0 #7a3c0d, 0 8px 18px rgba(0, 0, 0, 0.8); max-width: 60%; }
[dir='rtl'] .art-dungeon .title { font-weight: 700; }
.edge-dungeon { background: #7a4a1c; }

/* box art: the party show (quiz) */
.art-party { position: absolute; inset: 0; overflow: hidden;
  background: radial-gradient(circle at 30% 30%, #ff4fa3, #7b2ff7 55%, #2a0b63); }
.art-party::before { content: ''; position: absolute; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.10) 0 10deg, transparent 10deg 20deg); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.art-party .q { position: absolute; font: 900 1em/1 'Unbounded', sans-serif; color: var(--gold); text-shadow: 0 6px 0 #b0187a, 0 14px 22px rgba(0, 0, 0, 0.5); }
.art-party .q1 { font-size: clamp(90px, 22vw, 150px); right: 10%; top: 4%; transform: rotate(12deg); }
.art-party .q2 { font-size: clamp(50px, 12vw, 80px); left: 12%; bottom: 10%; color: var(--mint); text-shadow: 0 5px 0 #0d6e57; transform: rotate(-14deg); }
.art-party .tiles { position: absolute; left: 7%; top: 12%; display: grid; grid-template-columns: repeat(2, 30px); gap: 6px; transform: rotate(-8deg); }
.art-party .tiles i { width: 30px; height: 30px; border-radius: 8px; }
.art-party .tiles i:nth-child(1) { background: #ff5b3d; } .art-party .tiles i:nth-child(2) { background: #2f80ff; }
.art-party .tiles i:nth-child(3) { background: #f3c24f; } .art-party .tiles i:nth-child(4) { background: #39d3a6; }
.art-party .dots i { position: absolute; width: 10px; height: 10px; border-radius: 2px; animation: drift 6s ease-in-out infinite; }
@keyframes drift { 50% { transform: translateY(-10px) rotate(40deg); } }
.art-party .title { position: absolute; bottom: 9%; inset-inline-end: 7%; font: 900 clamp(20px, 4.6vw, 30px)/0.95 var(--display); color: #fff; text-align: end;
  text-shadow: 0 3px 0 #5b148f, 0 8px 18px rgba(0, 0, 0, 0.6); max-width: 70%; }
[dir='rtl'] .art-party .title { font-weight: 700; }
.edge-party { background: #5b1fb5; }
.mini { width: 56px; height: 42px; border-radius: 9px; overflow: hidden; position: relative; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); }
.mini .title, .mini .q2, .mini .tiles, .mini .dots, .mini .chest { display: none; }
.mini .q1 { font-size: 34px; right: 8%; top: 0; }
.mini .wiz { width: 70%; }

/* ---------------------------------------------------------------- sheet */
.sheet { border: 0; padding: 0; background: transparent; color: var(--cream); width: min(560px, 100vw); max-width: 100vw; margin: auto auto 0; max-height: 92dvh; }
@media (min-width: 700px) { .sheet { margin: auto; } }
.sheet::backdrop { background: rgba(8, 4, 14, 0.66); backdrop-filter: blur(4px); }
.sheet[open] .sheet-in { animation: up 0.32s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-in { background: linear-gradient(170deg, var(--plum-2), var(--night)); border: 1px solid var(--line); border-radius: 26px 26px 0 0; padding: 0 0 calc(18px + env(safe-area-inset-bottom)); overflow: hidden; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6); }
@media (min-width: 700px) { .sheet-in { border-radius: 26px; } }
.sheet .lid { position: relative; aspect-ratio: 16 / 7; }
.sheet .x { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 20px; }
.sheet .body { padding: 18px 18px 4px; display: grid; gap: 14px; }
.sheet .body .tag { margin: 0; color: var(--cream-dim); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 5px; }
.seg button { border: 0; border-radius: 10px; padding: 10px 6px; background: transparent; color: var(--cream-dim); font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--cream); color: var(--ink); }
.seg-l { font-size: 13px; color: var(--cream-dim); margin-bottom: -6px; }
.note { font-size: 13px; color: var(--cream-dim); text-align: center; margin: 0; }
.busy { border-radius: 16px; padding: 12px 14px; background: rgba(255, 181, 71, 0.12); border: 1px solid rgba(255, 181, 71, 0.4); }
.busy b { color: var(--lamp); }

.foot { text-align: center; color: rgba(247, 236, 214, 0.4); font-size: 13px; padding: 0 16px 28px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .box, [dir='rtl'] .box { transform: none; }
}
/* the sheet's banner is wide and short: a smaller wizard and chest so the title stays clear */
.sheet .art-dungeon .wiz { width: 30%; }
.sheet .art-dungeon .chest { width: 17%; bottom: 8%; }
.sheet .art-dungeon .title { max-width: 62%; top: 14%; }
