:root {
  --bg-start: #08070e;
  --bg-end: #1f1217;
  --surface: #ece8e2;
  --line: #d5ccc3;
  --text: #17120f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans TC", "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background:
    radial-gradient(110% 150% at 84% 0%, rgba(229, 122, 80, 0.2), transparent 42%),
    radial-gradient(90% 120% at 12% 16%, rgba(210, 169, 86, 0.16), transparent 32%),
    linear-gradient(160deg, var(--bg-start) 0%, var(--bg-end) 100%);
  color: var(--text);
  min-height: 100vh;
}

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

.top-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 8, 14, 0.92);
  border-bottom: 1px solid rgba(230, 176, 113, 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;
}

.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(236, 192, 135, 0.24);
  background: rgba(36, 24, 30, 0.72);
  color: #fff1e4;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    box-shadow 0.2s ease;
}

.top-nav-link:hover {
  transform: translateY(-1px);
  background: rgba(73, 44, 38, 0.96);
  border-color: rgba(245, 204, 150, 0.5);
  box-shadow: 0 10px 24px rgba(21, 9, 6, 0.34);
}

.top-nav-link.is-active {
  background: linear-gradient(135deg, rgba(227, 122, 78, 0.96), rgba(177, 73, 50, 0.96));
  border-color: rgba(255, 219, 178, 0.72);
  color: #fffaf3;
  box-shadow: 0 12px 28px rgba(109, 37, 22, 0.3);
}

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

.game-stage,
.game-info {
  grid-column: 1;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 10px 24px rgba(33, 18, 14, 0.12);
}

.game-shell-sanguo .game-shell__toolbar {
  background: rgba(36, 20, 22, 0.94);
}

.game-shell-sanguo {
  grid-template-columns: minmax(0, 1fr);
}

.game-shell-sanguo .game-shell__toolbar,
.game-shell-sanguo .game-shell__play {
  grid-column: 1;
}

.game-shell-sanguo .game-shell__play {
  padding: 10px;
  background: transparent;
  box-shadow: none;
}

.game-shell-stage:fullscreen .game-shell-sanguo {
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  border-radius: 0;
  background: #000;
}

.game-shell-stage:fullscreen .game-shell-sanguo .game-shell__toolbar {
  display: none;
}

.game-shell-stage:fullscreen .game-shell-sanguo .game-shell__play {
  grid-row: 1;
  padding: 0;
  border-radius: 0;
  background: #000;
}

.game-shell-stage:fullscreen .game-shell-sanguo .sanguo-surface {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
  background: #000;
}

.game-shell-stage:fullscreen .game-shell-sanguo #canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain;
}

.sanguo-surface {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  box-shadow: none;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  background: #000000;
  object-fit: contain;
  touch-action: none;
}

.sanguo-noscript {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #ffe6d0;
  font-size: 0.95rem;
}

.sanguo-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  padding: 24px;
  background: rgba(11, 5, 8, 0.56);
  backdrop-filter: blur(4px);
}

.sanguo-status.is-hidden {
  display: none;
}

.sanguo-status__panel {
  width: min(100%, 420px);
  padding: 1.6rem;
  border-radius: 22px;
  border: 1px solid rgba(243, 192, 132, 0.26);
  background:
    linear-gradient(165deg, rgba(37, 19, 21, 0.95), rgba(49, 24, 22, 0.9)),
    radial-gradient(circle at top, rgba(255, 195, 130, 0.14), transparent 44%);
  color: #fff3e6;
  text-align: center;
  box-shadow: 0 26px 58px rgba(0, 0, 0, 0.45);
}

.sanguo-status__title {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
  font-weight: 900;
  line-height: 1.2;
}

.sanguo-status__progress {
  display: block;
  width: 100%;
  height: 16px;
  margin: 1rem 0 0.8rem;
  accent-color: #e58b4f;
}

.sanguo-status__hint {
  margin: 0;
  color: #ffd7b3;
  font-size: 1rem;
}

.sanguo-status__notice {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 178, 148, 0.5);
  background: rgba(93, 31, 26, 0.6);
  color: #ffe8dc;
  font-size: 0.95rem;
  line-height: 1.45;
}

.sanguo-audio-toggle.is-muted {
  opacity: 0.88;
}

.game-info__panel h2 {
  margin: 0 0 0.6rem;
}

.game-info__panel p {
  margin: 0.42rem 0;
  line-height: 1.7;
}

.game-info__panel h3 {
  margin: 1.2rem 0 0.45rem;
}

.site-footer {
  border-top: 1px solid rgba(214, 176, 141, 0.32);
  padding: 1rem 0 1.5rem;
  color: #f1d9c3;
}

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

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

  .top-bar {
    gap: 0.9rem;
  }

  .sanguo-status {
    padding: 14px;
  }

  .sanguo-status__panel {
    padding: 1.2rem;
    border-radius: 16px;
  }
}

.sanguo-load-title {
  margin: 0 0 1.15rem;
  color: #fff3e6;
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
}

.sanguo-start-btn {
  margin: 1.1rem 0 0.85rem;
  min-width: 220px;
  min-height: 60px;
  border: 1px solid rgba(255, 219, 178, 0.75);
  border-radius: 999px;
  background: linear-gradient(135deg, #e58b4f, #b84a31);
  color: #fffaf3;
  padding: 0.9rem 2rem;
  font-size: 1.5rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(87, 28, 17, 0.35);
}

.sanguo-start-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.sanguo-start-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}