/* beekgame.com — Beek: Familiar Spirit (Remastered) promo site */

/* Game fonts (from the shipped game): Nunito Sans SemiBold for Latin,
   Noto Sans SC/TC Bold for Chinese (subset to the site's text). */
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/nunito-sans-bold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans SC";
  src: url("../fonts/noto-sans-sc-bold.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans TC";
  src: url("../fonts/noto-sans-tc-bold.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #10161f;
  --ink: #e8ecf2;
  --muted: #93a2b5;
  --faint: #5c6b7e;
  --accent: #5da7ea;
  --slate: #3f4f66;
  --slate-deep: #33415c;
  --bubble-rx: #35353a;
  --bubble-tx: #3d7be0;
  --drawer: #d9dce1;
  --radius: 14px;
}

*, ::before, ::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito Sans", -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
html[lang="zh-Hans"] body {
  font-family: "Nunito Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}
html[lang="zh-Hant"] body {
  font-family: "Nunito Sans", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
body.lock { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

/* ================= INTRO / CHAT ================= */

#intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
}
/* display:grid above outranks the UA [hidden] rule — restore it so repeat
   visitors don't see a flash of the intro before JS removes it. */
#intro[hidden] { display: none; }
#intro.leave {
  opacity: 0;
  transition: opacity .85s ease;
  pointer-events: none;
}
#intro .phone { transition: transform .85s cubic-bezier(.22, 1, .36, 1); }
#intro.leave .phone { transform: scale(.955); }

.intro-backdrop {
  position: absolute;
  inset: 0;
  background: #0a0d13 center / cover no-repeat;
  background-image: url("../img/forest-1280.webp");
  filter: brightness(.6);
}
@media (min-width: 1024px) {
  .intro-backdrop { background-image: url("../img/forest-2560.webp"); }
}
.intro-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(5, 8, 12, .55));
}

.phone {
  position: relative;
  width: min(430px, 100vw);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #2f3a50;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  overflow: hidden;
}
@media (min-width: 600px) and (min-height: 700px) {
  .phone {
    height: min(880px, calc(100dvh - 56px));
    border-radius: 22px;
  }
}

.phone-header {
  position: relative;
  z-index: 3;
  padding: calc(20px + env(safe-area-inset-top)) 22px 12px;
  background: linear-gradient(180deg, #46586f, #3c4c61);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.chat-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .38em;
  color: #fff;
  text-transform: uppercase;
  white-space: nowrap;
}
.chat-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, .55);
  transition: color .4s;
}
.chat-status .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6b7787;
  transition: background .4s, box-shadow .4s;
}
#intro.online .chat-status { color: rgba(255, 255, 255, .85); }
#intro.online .chat-status .dot {
  background: #5b9e63;
}

.hdr-btn {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: rgba(255, 255, 255, .75);
  transition: background .2s, opacity .3s;
}
.hdr-btn:hover { background: rgba(255, 255, 255, .12); }
#mute-btn { right: 16px; }
.mute-toggle .on, .mute-toggle.muted .off { display: block; }
.mute-toggle .off, .mute-toggle.muted .on { display: none; }

#page-mute {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(16, 22, 31, .6);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #cfd8e6;
  transition: background .2s;
}
#page-mute:hover { background: rgba(16, 22, 31, .85); }

#skip-btn {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top));
  right: 60px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, .8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s, background .2s;
}
#skip-btn.show { opacity: 1; pointer-events: auto; }
#skip-btn:hover { background: rgba(255, 255, 255, .12); }

.chat-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: #000;
  background-image:
    linear-gradient(rgba(0, 0, 0, .2), rgba(0, 0, 0, .2)),
    url("../img/chat-pattern.webp");
  background-position: center top;
  background-size: auto, 136px;
  background-repeat: repeat;
}
.chat-glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 150px;
  background: linear-gradient(to top, rgba(255, 255, 255, .4), rgba(255, 255, 255, 0));
  opacity: 0;
  pointer-events: none;
}
.chat-glow.pulse { animation: glow-pulse 1.6s cubic-bezier(.4, 0, .4, 1) both; }
@keyframes glow-pulse {
  0% { opacity: 0; }
  30% { opacity: .85; }
  100% { opacity: 0; }
}
.chat-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.chat-scroll::-webkit-scrollbar { display: none; }

.chat-log {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 100%;
  justify-content: flex-end;
  padding: 24px 14px calc(16px + env(safe-area-inset-bottom));
}

.line { display: flex; }
.line.rx { justify-content: flex-start; }
.line.tx { justify-content: flex-end; }

.bubble {
  position: relative;
  max-width: 80%;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #fff;
  border-style: solid;
  border-color: transparent;
  border-image-repeat: stretch;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  animation: bubble-in .28s cubic-bezier(.34, 1.3, .64, 1) both;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translate3d(0, 10px, 0) scale(.96); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
/* Original in-game bubble sprites (V2), 9-sliced at 2x. The horizontal
   slice sits below the side arrow (y64 of 96) so the arrow stays in the
   fixed corner region and never stretches with the bubble. */
.line.rx .bubble {
  border-width: 32px 12px 12px 23px;
  border-image: url("../img/bubble-hero.png") 64 24 24 46 fill;
}
.line.tx .bubble {
  border-width: 32px 23px 12px 12px;
  border-image: url("../img/bubble-player.png") 64 46 24 24 fill;
}
/* Text overlaps the deep top border so short bubbles stay compact,
   the way the game lays out its 9-slice panels. */
.bubble p { margin-top: -21px; }
.bubble time {
  display: block;
  text-align: right;
  font-weight: 400;
  font-size: 10.5px;
  color: rgba(255, 255, 255, .45);
  margin-top: 1px;
}
.line.tx .bubble time { color: rgba(255, 255, 255, .6); }

/* Typing indicator: a thin loading bar flush below the phone header,
   like the game's. A white-to-transparent gradient glides back and forth.
   Two mirrored gradient layers cross-fade as the direction flips, so the
   trailing side drags out like a comet tail while the leading side squishes. */
.typing-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 6px;
  overflow: hidden;
  opacity: 0;
  transition: opacity .35s ease;
}
.typing-bar.on { opacity: 1; }
.typing-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  /* The segment's centre travels wall to wall at constant speed (percentages
     are of the segment's own 45% width: centre at left wall = -50%, at right
     wall = (100 - 22.5) / 45). It squashes into each wall over the outer 20%
     of the leg, the far side clipping against the track edge. */
  animation: typing-slide 2.5s linear infinite alternate;
  will-change: transform;
}
.typing-bar span::before,
.typing-bar span::after {
  content: "";
  position: absolute;
  inset: 0;
}
/* Peak sits near the leading edge; long fade trails behind. */
.typing-bar span::before { /* rightward leg */
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85) 72%, transparent);
  animation: typing-tail-right 5s ease-in-out infinite;
}
.typing-bar span::after { /* leftward leg */
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85) 28%, transparent);
  animation: typing-tail-left 5s ease-in-out infinite;
}
@keyframes typing-slide {
  0%   { transform: translate3d(-50%, 0, 0) scaleX(.35); }
  20%  { transform: translate3d(-5.56%, 0, 0) scaleX(1); }
  80%  { transform: translate3d(127.78%, 0, 0) scaleX(1); }
  100% { transform: translate3d(172.22%, 0, 0) scaleX(.35); }
}
/* One full round trip is 5s: rightward 0-50%, leftward 50-100%.
   Eased keyframes at quarter points approximate a sine wave: the tail is
   fully stretched mid-leg and the layers blend evenly at the walls, so the
   flip breathes instead of snapping between plateaus. */
@keyframes typing-tail-right {
  0%, 50%, 100% { opacity: .5; }
  25% { opacity: 1; }
  75% { opacity: 0; }
}
@keyframes typing-tail-left {
  0%, 50%, 100% { opacity: .5; }
  25% { opacity: 0; }
  75% { opacity: 1; }
}


.choice-drawer {
  position: relative;
  z-index: 2;
  background: var(--drawer);
  box-shadow: 0 -8px 20px rgba(10, 16, 26, .35);
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .45s cubic-bezier(.16, 1, .3, 1), padding .45s cubic-bezier(.16, 1, .3, 1);
}
.choice-drawer.open {
  max-height: 360px;
  padding: 16px 16px 0;
}
.choice-btn {
  display: block;
  width: 100%;
  padding: 13px 18px;
  border-radius: 9px;
  background: #fff;
  color: #1d2735;
  font-weight: 600;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(20, 30, 45, .25);
  transition: transform .15s, box-shadow .15s;
}
.choice-btn + .choice-btn { margin-top: 10px; }
.choice-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(20, 30, 45, .3); }
.choice-btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(20, 30, 45, .25); }

.hold-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 56px;
  margin-bottom: -18px;
  padding: 13px 16px 56px;
  border-radius: 9px;
  background: #26262a;
  color: #8b8b92;
  font-size: 15px;
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  position: relative;
  overflow: hidden;
}
.hold-input .fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .09);
  transform: scaleX(0);
  transform-origin: left;
}
.hold-input.holding .fill {
  transform: scaleX(1);
  transition: transform 1.2s linear;
}
.hold-input .ignore-icon {
  flex: none;
  width: 20px;
  height: 20px;
  background: #8b8b92;
  -webkit-mask: url("../img/icon-ignore.png") center / contain no-repeat;
  mask: url("../img/icon-ignore.png") center / contain no-repeat;
}

/* ============ LANDING: full-bleed art, 3-column band at the bottom ============ */

.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.landing-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.landing-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 37%;
}

.landing-band {
  position: relative;
  z-index: 1;
  padding: 140px 20px 24px;
  background: linear-gradient(to top,
    rgba(16, 22, 31, .97) 0,
    rgba(16, 22, 31, .9) 50%,
    rgba(16, 22, 31, .55) 78%,
    rgba(16, 22, 31, 0) 100%);
}
.landing-grid {
  display: grid;
  gap: 18px;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
}
.landing-grid > picture { display: block; font-size: 0; margin-inline: auto; }

.landing-logo {
  width: min(220px, 55vw);
  height: auto;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .6));
}
.desc p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #d7dfe9;
  max-width: 52em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.desc p + p { margin-top: .6em; }

.badges {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  align-items: center;
  justify-items: center;
  gap: 18px 26px;
}
.badges a {
  display: flex;
  align-items: center;
  height: 40px;
  transition: transform .18s, filter .18s;
}
.badges a:hover { transform: translateY(-2px); filter: brightness(1.12); }
.badges img { height: 40px; width: auto; }

/* Desktop: logo | text | platforms across the bottom */
@media (min-width: 960px) {
  .landing-band { padding: 160px 52px 34px; }
  .landing-grid {
    grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) auto;
    align-items: center;
    gap: 48px;
  }
  .landing-art img { object-position: 50% 37%; }
  .landing-grid > picture { align-self: center; }
  .landing-logo {
    width: auto;
    max-width: 100%;
    max-height: min(220px, 24vh);
  }
  .desc p { font-size: 14px; }
  .badges {
    justify-content: start;
    justify-items: start;
    gap: 20px 30px;
  }
}

/* Mobile store section (badges live here below the fold; empty on desktop) */
.store {
  background: var(--bg);
  padding: 30px 20px 36px;
}
.store:empty { display: none; }

/* Footer - style pulled from klondike.studio */
.site-foot {
  background: #161617;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.foot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 2.4rem 20px 1.9rem;
}
.foot-brand { display: inline-flex; transition: opacity .2s; }
.foot-brand:hover { opacity: .8; }
.foot-brand img { height: 44px; width: auto; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 18px;
  font-size: .92rem;
  color: #a1a1aa;
}
.foot-links a, .foot-links button {
  color: #a1a1aa;
  font-size: .92rem;
  padding: 2px 0;
}
.foot-links a:hover, .foot-links button:hover { color: #e72528; }
.foot-links .current { color: #ededee; }
.foot-legal {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 1.1rem 20px calc(1.2rem + env(safe-area-inset-bottom));
  text-align: center;
  color: #a1a1aa;
}
.foot-legal p {
  max-width: 880px;
  margin: 0 auto;
  font-size: .74rem;
  line-height: 1.65;
}
.foot-legal p + p {
  margin-top: .6em;
  font-size: .65rem;
  color: #71717a;
}

/* trailer */
.trailer-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  background: rgba(16, 22, 31, .45);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  transition: background .2s, border-color .2s, color .2s;
}
/* Highlighted: straight colour inversion — light fill, dark text. */
.trailer-btn:hover,
.trailer-btn:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: #10161f;
}
.trailer-btn svg { flex: none; }

.trailer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: max(4vmin, 20px);
  background: rgba(5, 8, 12, .88);
  animation: trailer-in .25s ease both;
}
@keyframes trailer-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.trailer-box {
  position: relative;
  width: min(1100px, 100%);
}
.trailer-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
}
.trailer-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.trailer-close {
  position: absolute;
  top: -42px;
  right: 0;
  padding: 6px 12px;
  font-size: 19px;
  color: #cfd8e6;
}
.trailer-close:hover { color: #fff; }

/* locale suggestion toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 480px);
  padding: 14px 18px;
  border-radius: 12px;
  background: #1d2735;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  font-size: 14px;
  animation: toast-in .5s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast button {
  flex: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13.5px;
}
.toast .switch { background: var(--accent); color: #0d1520; font-weight: 700; }
.toast .dismiss { color: var(--muted); }
.toast .dismiss:hover { color: var(--ink); }
/* Keep the toast clear of the fixed #page-mute button (42px at bottom/right 18px)
   on viewports too narrow for them to sit side by side. */
@media (max-width: 560px) {
  .toast { bottom: 74px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bubble { animation: none; }
  #intro.leave, #intro .phone { transition-duration: .2s; }
}
