:root {
  --joke-bg-top: #05070d;
  --joke-bg-bottom: #0c162c;
  --joke-panel: rgba(8, 14, 24, 0.9);
  --joke-line: rgba(124, 255, 203, 0.16);
  --joke-text: #eef4ff;
  --joke-muted: #aebcda;
  --joke-gold: #ffd460;
  --joke-red: #e33f36;
  --joke-mint: #7cffcb;
  --joke-blue: #76a1ff;
  --joke-danger: #ff6b7a;
  --joke-font:
    "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--joke-text);
  font-family: var(--joke-font);
  background:
    radial-gradient(
      110% 120% at 72% 0%,
      rgba(227, 63, 54, 0.16),
      transparent 38%
    ),
    radial-gradient(
      90% 110% at 12% 18%,
      rgba(124, 255, 203, 0.14),
      transparent 30%
    ),
    linear-gradient(160deg, var(--joke-bg-top), var(--joke-bg-bottom));
}

button {
  font-family: inherit;
}

.page-wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 24px;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(8, 10, 23, 0.92);
  border-bottom: 1px solid rgba(126, 153, 255, 0.24);
  backdrop-filter: blur(8px);
}

.top-strip-inner {
  overflow-x: auto;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 58px;
  width: max-content;
  min-width: 100%;
  padding: 0.5rem 0;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.78rem;
  flex-shrink: 0;
  margin-left: auto;
}

.icon-button {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 0;
  flex-shrink: 0;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
}

.icon-button img {
  width: clamp(168px, 26vw, 280px);
  height: auto;
  display: block;
  pointer-events: none;
}

.icon-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.top-nav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  flex-shrink: 0;
  min-width: max-content;
  white-space: nowrap;
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.02rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.2);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-nav-link:hover {
  transform: translateY(-1px);
  background: rgba(31, 47, 84, 0.96);
  border-color: rgba(141, 176, 255, 0.5);
  box-shadow: 0 10px 24px rgba(5, 10, 24, 0.32);
}

.top-nav-link.is-active {
  background: linear-gradient(
    135deg,
    rgba(74, 117, 255, 0.92),
    rgba(42, 80, 186, 0.92)
  );
  border-color: rgba(198, 217, 255, 0.74);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(43, 77, 179, 0.28);
}

.top-lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.top-lang-switch::after {
  content: "▾";
  position: absolute;
  right: 0.9rem;
  color: #dbeafe;
  font-size: 0.9rem;
  pointer-events: none;
}

.top-lang-switch__select {
  min-height: 48px;
  padding: 0.7rem 2.25rem 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(164, 191, 255, 0.24);
  background: rgba(14, 20, 38, 0.72);
  color: #e6eeff;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  appearance: none;
  cursor: pointer;
}

.top-lang-switch__select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(198, 217, 255, 0.9);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.game-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
}

.game-panel {
  background:
    linear-gradient(90deg, rgba(124, 255, 203, 0.05), transparent 34%),
    var(--joke-panel);
  border: 1px solid var(--joke-line);
  border-radius: 22px;
  color: #dde7f3;
  padding: 1rem 1.05rem;
  box-shadow: 0 18px 38px rgba(4, 10, 24, 0.34);
}

.game-stage {
  --game-frame-width: 1406px;
  --game-frame-height: 894px;
  --game-frame-gap: 14px;
  --game-frame-padding: 20px;
  --game-frame-surface-padding: 0px;
  padding: 8px;
  overflow: hidden;
}

.game-shell-jokingyou {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.game-shell-jokingyou .game-shell__toolbar {
  position: relative;
  z-index: 12;
  grid-column: 1;
  align-items: center;
  min-height: 72px;
  height: 72px;
  padding: 10px 14px;
}

.game-shell-jokingyou .game-shell__toolbar-group {
  gap: 10px;
}

.game-shell-jokingyou .game-shell__button {
  min-height: 46px;
  padding: 0.72rem 1.18rem;
  font-size: 1.25rem;
}

.game-shell-jokingyou .game-shell__play {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 2;
  align-items: stretch;
  justify-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(9, 15, 29, 0.88);
}

.jokingyou-audio-toggle {
  min-width: 74px;
  padding-inline: 0.92rem;
}

.jokingyou-audio-toggle.is-muted {
  background: rgba(21, 32, 58, 0.92);
  border-color: rgba(164, 191, 255, 0.24);
  opacity: 0.88;
}

.jokingyou-viewport {
  position: relative;
  width: 1366px;
  height: 768px;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 212, 96, 0.36);
  background:
    radial-gradient(
      circle at 50% -15%,
      rgba(227, 63, 54, 0.18),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(6, 12, 27, 0.96), rgba(9, 19, 42, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 28px 54px rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(3, 10, 8, 0.28);
  user-select: none;
  touch-action: none;
}

.jokingyou-stage,
.jokingyou-phaser-host {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.jokingyou-phaser-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: #071329;
}

.jokingyou-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  pointer-events: none;
}

.jokingyou-stat {
  min-width: 0;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 212, 96, 0.26);
  background: rgba(7, 12, 26, 0.62);
  color: #eff6ff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 22px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

.jokingyou-stat__label {
  display: block;
  color: #ffdca0;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.1;
}

.jokingyou-stat__value {
  display: block;
  margin-top: 4px;
  color: #ffffff;
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.jokingyou-status {
  position: absolute;
  top: 82px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 48px));
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid rgba(124, 255, 203, 0.24);
  background: rgba(7, 12, 26, 0.6);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.jokingyou-status:empty {
  display: none;
}

.jokingyou-touch-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 7;
  display: none;
  grid-template-columns: repeat(3, 64px);
  gap: 12px;
  transform: translateX(-50%);
}

.jokingyou-touch-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  background: rgba(8, 15, 32, 0.68);
  color: #ffffff;
  font-size: 2rem;
  font-weight: 950;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.jokingyou-touch-button.is-pressed {
  border-color: rgba(124, 255, 203, 0.72);
  background: rgba(28, 73, 86, 0.82);
}

.jokingyou-rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 18;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(4, 9, 21, 0.78);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 900;
  text-align: center;
  backdrop-filter: blur(6px);
}

.jokingyou-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 9, 21, 0.52);
  backdrop-filter: blur(4px);
}

.jokingyou-overlay.is-hidden {
  display: none;
}

.jokingyou-overlay__panel {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(470px, 100%);
  padding: 1.7rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 212, 96, 0.36);
  background:
    radial-gradient(circle at top, rgba(227, 63, 54, 0.18), transparent 44%),
    linear-gradient(160deg, rgba(13, 24, 47, 0.98), rgba(7, 12, 26, 0.96));
  text-align: center;
  box-shadow: 0 28px 60px rgba(0, 5, 16, 0.42);
}

.jokingyou-overlay__kicker {
  margin: 0;
  color: var(--joke-mint);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.jokingyou-overlay__panel h1 {
  margin: 0;
  color: #ffffff;
  font-size: 2.35rem;
  line-height: 1.08;
}

.jokingyou-overlay__panel p {
  margin: 0;
  color: #dce9fb;
  font-weight: 800;
  line-height: 1.55;
}

.jokingyou-overlay__panel button {
  min-height: 46px;
  min-width: 170px;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.25rem;
  background: linear-gradient(135deg, var(--joke-gold), #df7b21);
  color: #241707;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.game-info__panel {
  display: grid;
  gap: 0.12rem;
}

.game-kicker {
  margin: 0 0 0.35rem;
  color: var(--joke-mint);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-info__lead {
  color: #c8d6e7;
  font-size: 1.05rem;
  font-weight: 700;
}

.game-info h2 {
  margin: 0 0 0.5rem;
  color: #ffffff;
}

.game-info p {
  margin: 0.35rem 0;
  line-height: 1.7;
}

.game-info h3 {
  margin: 1.2rem 0 0.5rem;
  color: #c4d0e8;
}

.site-footer {
  border-top: 1px solid rgba(177, 198, 233, 0.28);
  padding: 1rem 0 1.5rem;
  color: #d5e2ff;
}

.site-footer a {
  color: #eaf2ff;
}

@media (pointer: coarse), (max-width: 900px) {
  .jokingyou-touch-controls {
    display: grid;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .jokingyou-rotate-hint {
    display: grid;
  }
}

@media (max-width: 768px) {
  .page-wrap {
    padding-inline: 16px;
  }

  .top-bar {
    gap: 0.9rem;
    padding: 0.45rem 0;
  }

  .top-bar-actions,
  .top-nav-links {
    gap: 0.5rem;
  }

  .top-nav-link,
  .top-lang-switch__select {
    min-height: 40px;
    font-size: 0.95rem;
  }

  .top-nav-link {
    padding: 0.52rem 0.82rem;
  }

  .top-lang-switch__select {
    padding-inline: 0.9rem 2rem;
  }

  .game-shell-jokingyou .game-shell__toolbar-group {
    flex-wrap: wrap;
  }

  .game-shell-jokingyou .game-shell__button {
    min-height: 40px;
    padding: 0.56rem 0.82rem;
    font-size: 1rem;
  }
}

@media (max-width: 560px) {
  .icon-button img {
    width: 128px;
  }

  .game-shell-jokingyou .game-shell__toolbar-group {
    gap: 8px;
  }

  .game-shell-jokingyou .game-shell__button {
    min-height: 38px;
    padding: 0.48rem 0.7rem;
    font-size: 0.92rem;
  }

  .jokingyou-hud {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 6px;
  }

  .jokingyou-stat {
    padding: 7px 8px;
  }

  .jokingyou-stat__value {
    font-size: 1.05rem;
  }

  .jokingyou-status {
    top: 74px;
    width: min(620px, calc(100% - 24px));
    min-height: 36px;
    padding: 7px 12px;
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
