html,
body {
  font-family: "Golos Text", "Outfit", sans-serif;
  margin: 0;
  position: relative;
  z-index: 99;
  scroll-behavior: smooth;
  color: rgb(var(--text-body));
  background: rgb(var(--bg-body));
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
}

footer {
  margin-top: auto !important;
  position: static;
}

.back-to-top {
  transition: all 0.3s ease;
}

.back-to-top.back-to-top-active {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-5px);
}

body::-webkit-scrollbar {
  display: none;
}

#copy-message {
  position: fixed;
  z-index: 999;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: none;
  width: auto;
  min-width: 96px;
  height: auto;
  padding: 9px 18px;
  background: rgb(var(--bg-elevated) / 0.95);
  border: 1px solid rgb(var(--border-strong) / 0.8);
  color: rgb(var(--text-title));
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgb(var(--bg-overlay) / 0.45);
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: copy-toast-in 0.25s ease-out;
}

#copy-message::before {
  content: "✓";
  color: rgb(var(--success));
  font-weight: 700;
  margin-right: 6px;
}

@keyframes copy-toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #copy-message {
    animation: none;
  }
}

::-webkit-scrollbar {
  background: var(--bg-scroll);
  border-radius: 9999px;
  height: 6px;
  width: 6px;
}

::-webkit-scrollbar-thumb {
  background: rgb(var(--theme-primary));
  border-radius: 9999px;
}

.nav-links.nav-active {
  transform: translateX(0);
}


#play-game:not(.is-playing) .play-cover {
  z-index: 10;
}

#play-game:not(.is-playing) #gameIframe {
  z-index: 0;
  visibility: hidden;
  pointer-events: none;
}

#play-game.is-playing .top__shading,
#play-game.is-playing .play-cover {
  display: none;
}

#play-game.is-playing #gameIframe {
  z-index: 1;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  touch-action: manipulation;
}

#play-player:fullscreen,
#play-player:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  background: rgb(var(--bg-body));
}

#play-player:fullscreen #play-game,
#play-player:-webkit-full-screen #play-game {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
}

#play-player:fullscreen .play-bar,
#play-player:-webkit-full-screen .play-bar {
  flex-shrink: 0;
  width: 100%;
}

.pt {
  padding: 1.25rem 1.25rem 1.5rem;
  color: rgb(var(--text-body));
  font-size: 0.9375rem;
  line-height: 1.7;
}

@media (min-width: 640px) {
  .pt {
    padding: 1.75rem 2rem 2rem;
  }
}

.pt>*:first-child {
  margin-top: 0;
}

.pt>*:last-child {
  margin-bottom: 0;
}

.pt h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: 1.5rem !important;
  font-weight: 700;
  line-height: 1.3 !important;
  color: rgb(var(--text-title));
  margin: 0 0 1rem;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid rgb(var(--border-base));
}

.pt h2 {
  position: relative;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  color: rgb(var(--text-title));
  margin: 1.75rem 0 0.85rem;
  padding: 0.15rem 0 0.15rem 1rem;
}

.pt h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2em;
  bottom: 0.2em;
  width: 4px;
  background: rgb(var(--theme-primary));
  border-radius: 9999px;
}

.pt h3,
.pt h4 {
  font-size: 1rem !important;
  font-weight: 650;
  line-height: 1.4 !important;
  color: rgb(var(--text-title));
  margin: 1.35rem 0 0.6rem;
  padding: 0;
}

.pt p {
  margin: 0 0 1rem;
  padding: 0;
  font-size: 0.9375rem !important;
  line-height: 1.75 !important;
  color: rgb(var(--text-body));
}

.pt li {
  margin: 0 0 0.45rem;
  padding: 0;
  font-size: 0.9375rem !important;
  line-height: 1.7 !important;
  color: rgb(var(--text-body));
}

.pt ul,
.pt ol {
  margin: 0 0 1.15rem;
  padding-left: 1.35rem;
}

.pt ul {
  list-style: disc;
}

.pt ol {
  list-style: decimal;
}

.pt ul ul,
.pt ol ol,
.pt ul ol,
.pt ol ul {
  margin: 0.4rem 0 0.6rem;
}

.pt blockquote {
  margin: 0 0 1.15rem;
  padding: 0.85rem 1rem;
  border-left: 4px solid rgb(var(--theme-primary));
  border-radius: 0 0.75rem 0.75rem 0;
  background: rgb(var(--theme-primary) / 0.08);
  color: rgb(var(--text-body));
}

.pt hr {
  margin: 1.5rem 0;
  border: 0;
  border-top: 1px solid rgb(var(--border-base));
}

.pt img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0.75rem 0 1.15rem;
  border-radius: 0.75rem;
}

.pt a {
  color: rgb(var(--theme-primary));
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
}

.pt a:hover {
  color: rgb(var(--theme-primary-hover));
}

.pt strong,
.pt b {
  color: rgb(var(--text-title));
  font-weight: 650;
}

.pt table {

  display: block;
  width: 100% !important;
  height: auto !important;
  max-width: 100%;
  margin: 0 0 1.15rem;
  border-collapse: collapse;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
  border: 1px solid rgb(var(--border-base));
}

.pt th,
.pt td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border: 1px solid rgb(var(--border-base));
  font-size: 0.875rem;
  line-height: 1.5;
}

.pt th {
  background: rgb(var(--theme-primary) / 0.08);
  color: rgb(var(--text-title));
  font-weight: 650;
}

.pt tr:nth-child(even) td {
  background: rgb(var(--bg-elevated) / 0.55);
}

table {
  margin-bottom: 10px;
}

table,
th,
td {
  border: 1px solid;
  border-collapse: collapse;
}

th,
td {
  padding: 8px;
  text-align: center;
}

/* ===== Mobile menu (drawer) ===== */
.burger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  border: 1px solid rgb(var(--border-base));
  background: rgb(var(--bg-card));
  color: rgb(var(--text-title));
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.burger:hover {
  background: rgb(var(--bg-elevated));
  border-color: rgb(var(--border-strong));
}

.burger-line {
  display: block;
  width: 1.125rem;
  height: 2px;
  border-radius: 9999px;
  background: currentColor;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.burger.burger-active .burger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.burger.burger-active .burger-line:nth-child(2) {
  opacity: 0;
}

.burger.burger-active .burger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-links {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  background: rgb(var(--bg-overlay) / 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.nav-links.nav-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

/* Explicit backdrop token for light theme overlays */
.theme-light .mobile-menu-backdrop {
  background: transparent;
}

.mobile-menu-panel {
  position: relative;
  width: min(20rem, 82vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: rgb(var(--bg-card));
  border-left: 1px solid rgb(var(--border-base));
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.nav-links.nav-active .mobile-menu-panel {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgb(var(--border-base));
}

.mobile-menu-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--text-muted));
}

.mobile-menu-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 0.5rem;
  border: 1px solid rgb(var(--border-base));
  background: rgb(var(--bg-card));
  color: rgb(var(--text-body-soft));
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-close:hover {
  background: rgb(var(--bg-elevated));
  color: rgb(var(--text-title));
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
}

.mobile-menu-link {
  display: block;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  color: rgb(var(--text-body-soft));
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-menu-link:hover {
  background: rgb(var(--theme-primary-shade));
  color: rgb(var(--theme-primary));
}

.mobile-menu-link.is-active {
  background: rgb(var(--theme-primary-shade));
  color: rgb(var(--theme-primary));
}

@media (min-width: 1024px) {
  .burger {
    display: none;
  }

  .nav-links {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {

  .nav-links,
  .mobile-menu-panel,
  .burger-line {
    transition: none !important;
  }
}

/* 移动端菜单打开时锁定页面滚动 */
body:has(.nav-links.nav-active) {
  overflow: hidden;
}