/* The play layer: actors, props, bubbles, emotes, traffic, toasts, and the little motions around them. */

/* ------------------------------------------------------------- floor stage */
.parade { pointer-events: none; }
.parade::before { z-index: 0; }
.prop {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  image-rendering: pixelated;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.25));
}
.actor {
  position: absolute;
  left: 0;
  bottom: 18px;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  will-change: transform;
}
.actor .spr { image-rendering: pixelated; background-repeat: no-repeat; position: relative; }
.actor::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 44px;
  height: 10px;
  margin-left: -22px;
  border-radius: 50%;
  background: rgba(20, 10, 30, 0.35);
  z-index: -1;
}
.actor.cat::after { width: 30px; margin-left: -15px; }
.actor.carried { cursor: grabbing; }
.actor.carried::after { opacity: 0.25; transform: scale(0.6); }
.actor .tag {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(21, 18, 28, 0.85);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
  pointer-events: none;
}
.actor .tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.actor:hover .tag { opacity: 1; }

/* Speech bubble: the same card the game draws above heads (src/client/styles.css .bubble). */
.say {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 30px);
  transform: translateX(-50%) scale(0.4);
  transform-origin: 50% 100%;
  width: max-content;
  max-width: 220px;
  padding: 5px 10px 6px;
  background: #fffdf8;
  color: #1d1726;
  border: 2px solid #1d1726;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  box-shadow: 0 3px 0 rgba(29, 23, 38, 0.35);
  opacity: 0;
  transition: opacity 0.14s, transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
  pointer-events: none;
  z-index: 40;
}
.say::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 9px;
  height: 9px;
  background: inherit;
  border-right: 2px solid #1d1726;
  border-bottom: 2px solid #1d1726;
  transform: translateX(-50%) rotate(45deg);
}
.say.show { opacity: 1; transform: translateX(-50%) scale(1); }
.emo {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  width: 30px;
  image-rendering: pixelated;
  pointer-events: none;
  animation: emo 1.7s cubic-bezier(0.3, 1.6, 0.5, 1) forwards;
  z-index: 35;
}
@keyframes emo {
  0% { transform: translate(-50%, 10px) scale(0); opacity: 0; }
  15% { transform: translate(-50%, 0) scale(1.25); opacity: 1; }
  25% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -26px) scale(1); opacity: 0; }
}
.spark, .dust, .trail {
  position: absolute;
  width: 6px;
  height: 6px;
  pointer-events: none;
  z-index: 45;
}
.spark { animation: spark 0.9s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; box-shadow: 0 0 6px currentColor; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(180deg) scale(0.3); opacity: 0; } }
.dust { width: 8px; height: 8px; background: #e9dcc6; animation: dust 0.6s ease-out forwards; }
@keyframes dust { to { transform: translate(var(--dx), -18px) scale(0.2); opacity: 0; } }
.trail { width: 5px; height: 5px; margin: -2px; animation: trail 0.7s ease-in forwards; z-index: 1; }
@keyframes trail { to { transform: translateY(26px) scale(0.3); opacity: 0; } }
.pizza-box {
  position: absolute;
  bottom: 22px;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
  transform: translateX(-50%);
  image-rendering: pixelated;
  z-index: 5;
  animation: drop 0.5s cubic-bezier(0.5, 0, 0.75, 0) both, wobble 0.5s 0.5s ease-out;
}
.pizza-box.gone { transition: opacity 0.4s, transform 0.4s; opacity: 0; transform: translateX(-50%) scale(0.4); }
@keyframes drop { from { transform: translate(-50%, -240px); } }
@keyframes wobble { 30% { transform: translateX(-50%) scale(1.25, 0.8); } 60% { transform: translateX(-50%) scale(0.9, 1.1); } }

/* ------------------------------------------------------------- hero extras */
.hero h1 em {
  background: linear-gradient(100deg, #ffc94a 0%, #ffc94a 40%, #fff3c9 50%, #ffc94a 60%, #ffc94a 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 4.5s linear infinite;
}
@keyframes shine { from { background-position: 125% 0; } to { background-position: -125% 0; } }
.logo-px { animation: logo-in 0.9s steps(6) both; }
@keyframes logo-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }
.hero .chip .dot { animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* The game's command bar, typing its own examples. */
.cmdbar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 0 22px;
  padding: 7px;
  background: rgba(30, 25, 42, 0.95);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}
.cmdbar.sent { box-shadow: 0 0 0 3px rgba(54, 196, 143, 0.5), var(--shadow); transform: translateY(-2px); }
.cmd-who { display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text); }
.cmd-who img { width: 28px; height: 34px; image-rendering: pixelated; object-fit: cover; object-position: top; }
.cmd-who small { color: var(--muted); font-weight: 500; }
.cmd-field {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
}
.cmd-field::after { content: ''; width: 2px; height: 18px; margin-inline-start: 2px; background: var(--yellow); animation: blink 1s steps(2) infinite; }
.cmd-send {
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--good);
  color: #0e2a20;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 3px 0 #23875f;
  transition: transform 0.08s, box-shadow 0.08s;
}
.cmd-send.press { transform: translateY(3px); box-shadow: 0 0 0 #23875f; }

.pizza-btn {
  border: 1px dashed rgba(255, 201, 74, 0.5);
  background: rgba(255, 201, 74, 0.08);
  color: var(--yellow);
  font: 600 13px var(--font);
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s;
}
.pizza-btn:hover { transform: rotate(-3deg) scale(1.06); }
.hero .note .pizza-btn::before, .hero .note .hint::before { content: none; }
.hero .note .hint { color: var(--dim); }

/* Night: stars over the city. */
.stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 1.2s;
  background-image:
    radial-gradient(2px 2px at 12% 18%, #fff, transparent 60%),
    radial-gradient(2px 2px at 28% 8%, #ffe9a8, transparent 60%),
    radial-gradient(2px 2px at 44% 22%, #fff, transparent 60%),
    radial-gradient(2px 2px at 63% 11%, #cfe6ff, transparent 60%),
    radial-gradient(2px 2px at 77% 26%, #fff, transparent 60%),
    radial-gradient(2px 2px at 88% 9%, #ffe9a8, transparent 60%),
    radial-gradient(2px 2px at 6% 40%, #fff, transparent 60%),
    radial-gradient(2px 2px at 95% 38%, #cfe6ff, transparent 60%);
  animation: twinkle 3s steps(3) infinite;
  pointer-events: none;
}
.hero.is-night .stars { opacity: 1; }
.hero.is-night .parade::before { filter: brightness(0.6) saturate(0.8); }
.hero.is-night .prop, .hero.is-night .actor .spr { filter: brightness(0.75); }
@keyframes twinkle { 50% { opacity: 0.55; } }

/* ------------------------------------------------------------- top bar: sound + XP bar */
.sound-btn { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 10px; width: 38px; height: 36px; font-size: 16px; cursor: pointer; flex: none; }
.sound-btn:hover { background: var(--panel-3); }
.xpwrap { position: absolute; inset-inline: 16px; bottom: -1px; height: 3px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.05); }
.xpbar { height: 100%; background: linear-gradient(90deg, var(--blue), var(--violet), var(--pink), var(--yellow)); transform: scaleX(0); transform-origin: right; }
.xplv { font: 600 11px var(--mono); color: var(--yellow); background: rgba(255, 201, 74, 0.1); border: 1px solid rgba(255, 201, 74, 0.3); padding: 2px 7px; border-radius: 6px; flex: none; }

/* ------------------------------------------------------------- reveal: a springy pop, staggered */
.reveal { transform: translateY(26px) scale(0.97); transition: opacity 0.6s, transform 0.7s cubic-bezier(0.3, 1.5, 0.5, 1); transition-delay: var(--d, 0s); }
.reveal.in { transform: none; }
.eyebrow svg { transition: transform 0.4s cubic-bezier(0.3, 1.8, 0.5, 1); }
.sec-head.in .eyebrow svg { animation: hop 0.8s 0.3s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes hop { 40% { transform: translateY(-8px) scale(1.15); } }

/* ------------------------------------------------------------- tilt cards with a light that follows the pointer */
.tilt { transition: transform 0.18s ease-out, box-shadow 0.2s, border-color 0.2s; transform-style: preserve-3d; position: relative; }
.tilt::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.09), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
}
.tilt:hover { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); border-color: var(--line-2); }
.tilt:hover::before { opacity: 1; }
.feature:hover .ico { animation: wiggle 0.5s ease-in-out; }
.feature .ico img { transition: transform 0.25s cubic-bezier(0.3, 1.8, 0.5, 1); }
.feature:hover .ico img { transform: scale(1.3); }
@keyframes wiggle { 25% { transform: rotate(-10deg); } 75% { transform: rotate(10deg); } }

/* Team cards */
.member { cursor: pointer; }
.member .stage .who { width: 80px; height: 96px; image-rendering: pixelated; background-repeat: no-repeat; background-size: 80px 96px; animation: bob 2.4s ease-in-out infinite; }
.member.talking .stage .who { animation: none; }
.member .say { bottom: auto; top: 10px; max-width: 180px; font-size: 12px; }
.member.talking .say { opacity: 1; transform: translateX(-50%) scale(1); }
.member.jump .stage .who { animation: jump 0.7s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes jump { 40% { transform: translateY(-34px); } 70% { transform: translateY(0) scale(1.15, 0.85); } }
.member .stage .bubble { transition: opacity 0.2s; }
.member.talking .stage .bubble { opacity: 0; }
.member .hint { font-size: 11.5px; color: var(--dim); }

/* Stats pop when the count finishes */
.stat b.pop { animation: statpop 0.45s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes statpop { 50% { transform: scale(1.25); color: #fff; } }

/* ------------------------------------------------------------- city strip: rail, sidewalk, road */
.street {
  position: relative;
  margin: 26px 0 20px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  height: 300px;
  background: #5c9f45;
  user-select: none;
}
.street .rail {
  position: absolute;
  inset: 0 0 auto 0;
  height: 96px;
  background:
    repeating-linear-gradient(90deg, #6b4a32 0 6px, transparent 6px 22px) 0 62px / 100% 22px no-repeat,
    linear-gradient(#9aa1ad, #9aa1ad) 0 66px / 100% 3px no-repeat,
    linear-gradient(#9aa1ad, #9aa1ad) 0 78px / 100% 3px no-repeat,
    linear-gradient(180deg, #6fae55 0 52px, #8d8578 52px 96px);
}
.street .train { position: absolute; left: 0; top: 0; display: flex; align-items: flex-end; height: 84px; will-change: transform; }
.street .train img { image-rendering: pixelated; height: auto; display: block; }
.street .walk {
  position: absolute;
  inset: 96px 0 auto 0;
  height: 54px;
  background:
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(0, 0, 0, 0.12) 47px 48px),
    repeating-linear-gradient(180deg, #cfc6b4 0 23px, #bfb5a2 23px 24px);
  border-bottom: 4px solid #8b8478;
}
.street .props { position: absolute; inset: 40px 0 auto 0; height: 110px; pointer-events: none; }
.street .props img { position: absolute; bottom: 0; image-rendering: pixelated; transform: translateX(-50%); }
.street .props img.sway { transform-origin: 50% 100%; animation: sway 3.5s ease-in-out infinite; }
@keyframes sway { 50% { transform: translateX(-50%) rotate(1.6deg); } }
.street .lanes {
  position: absolute;
  inset: 154px 0 34px 0;
  background:
    repeating-linear-gradient(90deg, #ffc94a 0 34px, transparent 34px 68px) 0 50% / 100% 4px no-repeat,
    #3b3a44;
}
.street .lanes::before, .street .lanes::after { content: ''; position: absolute; inset-inline: 0; height: 3px; background: #e9e4dc; opacity: 0.7; }
.street .lanes::before { top: 4px; }
.street .lanes::after { bottom: 4px; }
.street .zebra { position: absolute; top: 0; bottom: 0; right: 22%; width: 64px; background: repeating-linear-gradient(180deg, #f1ecdf 0 9px, transparent 9px 18px); opacity: 0.9; }
.street .curb { position: absolute; inset: auto 0 0 0; height: 34px; background: repeating-linear-gradient(90deg, transparent 0 47px, rgba(0, 0, 0, 0.12) 47px 48px), #cfc6b4; border-top: 4px solid #8b8478; }
.street .car { position: absolute; left: 0; image-rendering: pixelated; background-repeat: no-repeat; cursor: pointer; will-change: transform; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.3)); }
.street .car.honk { animation: honk 0.4s; }
@keyframes honk { 30% { margin-top: -6px; } }
.street .label {
  position: absolute;
  top: 10px;
  inset-inline-start: 14px;
  z-index: 5;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(21, 18, 28, 0.85);
  border: 1px solid var(--line-2);
}
.street .label b { color: var(--yellow); }

/* ------------------------------------------------------------- toasts: the game's office feed */
.toasts { position: fixed; top: 86px; inset-inline-end: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(30, 25, 42, 0.97);
  border: 1px solid var(--line-2);
  border-inline-start: 3px solid var(--yellow);
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: toast-in 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.toast .ti { font-size: 18px; }
.toast .tt { flex: 1; line-height: 1.5; }
.toast small { color: var(--dim); font-size: 11px; }
.toast.out { transition: opacity 0.35s, transform 0.35s; opacity: 0; transform: translateX(-30px); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-40px) scale(0.9); } }

/* Buttons bounce a little */
.btn.primary:hover { animation: nudge 0.5s; }
@keyframes nudge { 30% { transform: translateY(-4px) rotate(-1deg); } 60% { transform: translateY(-1px) rotate(1deg); } }
.filters button { transition: transform 0.15s cubic-bezier(0.3, 1.8, 0.5, 1); }
.filters button:hover { transform: translateY(-2px); }
.filters button:active { transform: scale(0.94); }
.shot { transition: transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.3s; }
.shot:hover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); z-index: 2; }
.shot.hide { display: none; }
.gallery .shot { animation: none; }
.gallery.refilter .shot:not(.hide) { animation: card-in 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes card-in { from { opacity: 0; transform: scale(0.85) translateY(16px); } }
dialog.lightbox[open] { animation: lb-in 0.35s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes lb-in { from { opacity: 0; transform: scale(0.9); } }
.place img, .figure img { transition: transform 0.5s; }
.place:hover img { transform: scale(1.06); }
.place { overflow: hidden; }
.pin:hover { z-index: 5; background: var(--yellow); color: var(--ink); }
.pin:hover i { background: var(--ink); color: var(--yellow); }
.hot:hover { transform: scale(1.2); }
.faq details[open] p { animation: fade-down 0.35s ease-out; }
@keyframes fade-down { from { opacity: 0; transform: translateY(-8px); } }
.toc a { transition: background 0.15s, padding 0.2s; }
.toc a.on { padding-inline-start: 16px; }

@media (max-width: 860px) {
  .street { height: 260px; }
  .street .lanes { inset: 150px 0 30px 0; }
  .cmd-who small { display: none; }
  .xplv { display: none; }
}
@media (max-width: 560px) {
  .cmd-who span { display: none; }
  .hero { padding-bottom: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero h1 em { color: var(--yellow); background: none; -webkit-background-clip: initial; background-clip: initial; }
  .reveal { transform: none; }
}

/* Visitors from other offices: a dashed name tag with the office they came from. */
.actor.visitor .tag { border-style: dashed; border-color: var(--accent); color: #fff; opacity: 1; }
.actor.visitor .spr { animation: arrive 0.6s ease-out; }
@keyframes arrive { from { filter: brightness(2) drop-shadow(0 0 10px #fff); } }

/* The name, big: a pixel logotype in the game's sign colours. */
.logo-wrap { margin: 14px 0 6px; line-height: 0; }
.logo-big { height: clamp(46px, 6vw, 72px); width: auto; display: block; overflow: visible; animation: logo-in 0.9s steps(8) both, logo-float 4s 1s ease-in-out infinite; filter: drop-shadow(0 6px 16px rgba(255, 201, 74, 0.25)); }
.final .logo-big { margin: 0 auto 10px; }
@keyframes logo-float { 50% { transform: translateY(-4px); } }
.lang-btn { flex: none; display: grid; place-items: center; height: 36px; padding: 0 11px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font: 700 13px var(--font); text-decoration: none !important; transition: background 0.15s, transform 0.15s; }
.lang-btn:hover { background: var(--panel-3); transform: translateY(-1px); }

/* ------------------------------------------------------------- English page: left-to-right mirrors */
html[lang='en'] { --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif; }
[dir='ltr'] .hero::after {
  background:
    linear-gradient(to right, rgba(21, 18, 28, 0.94) 0%, rgba(21, 18, 28, 0.8) 40%, rgba(21, 18, 28, 0.45) 75%, rgba(21, 18, 28, 0.6) 100%),
    linear-gradient(180deg, rgba(21, 18, 28, 0.6) 0%, transparent 25%, transparent 70%, var(--bg) 100%);
}
@media (min-width: 861px) {
  [dir='ltr'] .window { transform: perspective(1400px) rotateY(-8deg) rotateX(2deg); }
  [dir='ltr'] .window:hover { transform: perspective(1400px) rotateY(-2deg) rotateX(0deg); }
}
[dir='ltr'] .xpbar, [dir='ltr'] .b-tabs .prog { transform-origin: left; }
[dir='ltr'] .searchbar .q { text-align: left; }
[dir='ltr'] .toast { animation-name: toast-in-ltr; }
[dir='ltr'] .toast.out { transform: translateX(30px); }
@keyframes toast-in-ltr { from { opacity: 0; transform: translateX(40px) scale(0.9); } }
[dir='ltr'] .member q, [dir='ltr'] q { quotes: '“' '”'; }
[dir='ltr'] .hero h1 { letter-spacing: -0.02em; }
[dir='ltr'] .eyebrow { letter-spacing: 0.01em; }
html[lang='en'] .district .land { background-image: url(/shots-en/city-wide.webp); }
html[lang='en'] .district.lot .land { background-image: repeating-linear-gradient(45deg, #6f8f4f 0 10px, #67864a 10px 20px); }
html[lang='en'] .final::before { background-image: url(/shots-en/night.webp); }
