:root {
  --ink: #eafcff;
  --cyan: #6ef6ff;
  --night: #010104;
  --panel: #07121d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--night);
  color: var(--ink);
}

body {
  overflow: hidden;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.h5-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 390px) auto;
  align-items: center;
  justify-content: center;
  gap: clamp(54px, 8vw, 132px);
  min-height: 100dvh;
  padding: 4vh 6vw;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 42%, rgba(49, 219, 245, 0.11), transparent 32%),
    radial-gradient(circle at 18% 72%, rgba(72, 98, 255, 0.11), transparent 28%),
    #020408;
}

.h5-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px);
  background-size: 100% 6px;
}

.side-note {
  position: relative;
  z-index: 1;
  align-self: center;
}

.brand-mark,
.eyebrow,
.desktop-footnote {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.16em;
}

.brand-mark {
  display: inline-block;
  padding: 7px 10px;
  color: #001013;
  background: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.eyebrow {
  margin: 34px 0 12px;
  color: var(--cyan);
  font-size: 12px;
}

.side-note h1 {
  margin: 0;
  font-size: clamp(48px, 5.5vw, 82px);
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: -0.075em;
  text-shadow: 0 0 42px rgba(110, 246, 255, 0.24);
}

.lede {
  margin: 28px 0 36px;
  color: rgba(234, 252, 255, 0.68);
  font-size: 15px;
  line-height: 1.9;
}

.play-hint {
  display: flex;
  align-items: center;
  gap: 15px;
  color: rgba(234, 252, 255, 0.48);
  font-size: 12px;
  line-height: 1.7;
}

.play-hint span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(110, 246, 255, 0.32);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 20px;
}

.play-hint p {
  margin: 0;
}

.game-stage {
  position: relative;
  z-index: 2;
  height: min(92dvh, 900px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(153, 245, 255, 0.42);
  border-radius: 28px;
  background: #010104;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.65),
    0 0 60px rgba(77, 222, 255, 0.12),
    inset 0 0 0 6px rgba(255, 255, 255, 0.025);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: pointer;
  user-select: none;
}

.game-loading {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  background: #010104;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.game-loading.is-ready {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.game-loading.is-error {
  color: #ffb1b1;
}

.game-loading p {
  margin: 0;
  color: rgba(234, 252, 255, 0.68);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.loading-cat {
  color: var(--cyan);
  font: 700 26px/1 ui-monospace, monospace;
  animation: breathe 1.2s ease-in-out infinite;
}

.h5-toast {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 9%;
  max-width: 76%;
  padding: 10px 16px;
  border: 1px solid rgba(110, 246, 255, 0.5);
  border-radius: 999px;
  color: #071014;
  background: rgba(225, 252, 255, 0.96);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.42);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.h5-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.desktop-footnote {
  position: absolute;
  right: 24px;
  bottom: 18px;
  margin: 0;
  color: rgba(234, 252, 255, 0.2);
  font-size: 9px;
}

@keyframes breathe {
  0%, 100% { opacity: 0.42; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 760px) {
  .h5-shell {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }

  .side-note,
  .desktop-footnote {
    display: none;
  }

  .game-stage {
    width: 100vw;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-cat { animation: none; }
}
