:root {
  --bg: #05080c;
  --ink: #ece7dc;
  --muted: #98a3ad;
  --muted-2: rgba(236, 231, 220, 0.46);
  --brass: #b8945f;
  --brass-soft: rgba(184, 148, 95, 0.28);
  --line: rgba(236, 231, 220, 0.14);
  --panel: rgba(8, 13, 18, 0.88);
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overscroll-behavior: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#canvas-wrap {
  position: absolute;
  inset: 0;
  cursor: grab;
}

#canvas-wrap:active {
  cursor: grabbing;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 30%, rgba(0, 0, 0, 0.18) 58%, rgba(0, 0, 0, 0.66) 100%);
  z-index: 2;
}

.bottom-fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 180px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 8, 12, 0) 0%, rgba(5, 8, 12, 0.55) 100%);
  z-index: 3;
}

.site-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 34px 42px;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  pointer-events: none;
}

.brand-mark {
  display: block;
  width: 2px;
  height: 46px;
  margin-top: 4px;
  background: linear-gradient(180deg, rgba(184, 148, 95, 0), var(--brass) 30%, var(--brass) 70%, rgba(184, 148, 95, 0));
}

.brand-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 2.6vw, 44px);
  letter-spacing: 0.14em;
  line-height: 1.1;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

.brand-copy p {
  margin: 10px 0 0;
  font-size: 10px;
  letter-spacing: 0.38em;
  color: var(--muted);
  text-transform: uppercase;
}

.head-actions {
  position: relative;
  pointer-events: auto;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.22);
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--brass);
  border-color: var(--brass-soft);
  background: rgba(184, 148, 95, 0.07);
  outline: none;
}

.icon-btn:active {
  transform: scale(0.95);
}

.menu {
  position: absolute;
  top: 56px;
  right: 0;
  width: 236px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(7, 11, 16, 0.92);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.menu[hidden] {
  display: none;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.055);
  color: var(--brass);
  outline: none;
}

.menu-link {
  color: var(--brass);
}

.menu-sep {
  height: 1px;
  margin: 8px 10px;
  background: var(--line);
}

.menu-label {
  margin: 6px 12px 8px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--muted-2);
  text-transform: uppercase;
}

.quality-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 2px 2px;
}

.quality-row button {
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quality-row button:hover {
  color: var(--ink);
  border-color: rgba(236, 231, 220, 0.3);
}

.quality-row button.active {
  color: var(--brass);
  border-color: var(--brass-soft);
  background: rgba(184, 148, 95, 0.08);
}

.loading {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: radial-gradient(ellipse at 50% 45%, #0b1219 0%, #05080c 62%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

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

.loading-ring {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(184, 148, 95, 0.16);
  border-top-color: var(--brass);
  border-radius: 50%;
  animation: spin 1.15s linear infinite;
}

.loading p {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.34em;
  color: rgba(236, 231, 220, 0.78);
}

.loading small {
  margin-top: -6px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.intro-hint {
  position: absolute;
  left: 50%;
  bottom: 38px;
  z-index: 24;
  transform: translateX(-50%);
}

.intro-hint[hidden] {
  display: none;
}

.intro-hint button,
.text-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.22em;
  padding: 9px 18px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.25s ease;
}

.intro-hint button:hover,
.text-btn:hover {
  color: var(--brass);
  border-color: var(--brass-soft);
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 38px;
  z-index: 10;
  transform: translateX(-50%);
  margin: 0;
  padding: 0 20px;
  font-size: 10px;
  letter-spacing: 0.26em;
  color: rgba(236, 231, 220, 0.38);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  white-space: nowrap;
}

.hint.is-visible {
  opacity: 1;
}

.detail {
  position: absolute;
  top: 50%;
  right: 38px;
  z-index: 30;
  width: min(370px, calc(100vw - 48px));
  max-height: 74vh;
  overflow: auto;
  padding: 30px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(165deg, rgba(13, 19, 25, 0.94), rgba(7, 11, 16, 0.9));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-46%) translateX(18px);
  transition: opacity 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 148, 95, 0.3) transparent;
}

.detail::before {
  content: "";
  position: absolute;
  top: 0;
  left: 30px;
  width: 42px;
  height: 2px;
  background: var(--brass);
  opacity: 0.8;
}

.detail.is-open {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

.detail[hidden] {
  display: none;
}

.detail-close {
  position: absolute;
  top: 13px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.detail-close:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.detail-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--brass);
}

.detail h2 {
  margin: 14px 0 10px;
  font-family: var(--serif);
  font-size: clamp(30px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.detail-meta span + span::before {
  content: "·";
  margin-right: 14px;
  color: var(--brass);
  opacity: 0.55;
}

.detail-summary {
  margin: 20px 0 0;
  font-size: 17px;
  line-height: 1.85;
  color: rgba(236, 231, 220, 0.88);
}

.detail-rule {
  width: 36px;
  height: 1px;
  margin: 20px 0;
  background: var(--brass);
  opacity: 0.6;
}

.detail-description {
  margin: 0;
  font-size: 15px;
  line-height: 1.95;
  color: rgba(236, 231, 220, 0.68);
  white-space: pre-line;
}

.detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted-2);
}

.detail-foot .text-btn {
  padding: 8px 14px;
  font-size: 10px;
}

.tooltip {
  position: fixed;
  z-index: 40;
  max-width: 230px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 11, 16, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  line-height: 1.55;
}

.tooltip[hidden] {
  display: none;
}

.tooltip strong {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.tooltip span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.tooltip em {
  display: block;
  margin-top: 7px;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--brass);
}

.error {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 30px;
  background: radial-gradient(ellipse at 50% 45%, #0b1219 0%, #05080c 62%);
  text-align: center;
}

.error[hidden] {
  display: none;
}

.error p {
  max-width: 480px;
  margin: 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--muted);
}

noscript {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 760px) {
  .site-head {
    padding: 20px 20px;
  }

  .brand {
    gap: 12px;
  }

  .brand-mark {
    height: 34px;
    margin-top: 2px;
  }

  .brand-copy h1 {
    font-size: 27px;
    letter-spacing: 0.12em;
  }

  .brand-copy p {
    margin-top: 7px;
    font-size: 8px;
    letter-spacing: 0.3em;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .menu {
    width: 220px;
    top: 50px;
  }

  .detail {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 60vh;
    padding: 26px 22px 22px;
    border-right: 0;
    border-bottom: 0;
    border-radius: 19px 19px 0 0;
    transform: translateY(26px);
  }

  .detail::before {
    left: 22px;
  }

  .detail.is-open {
    transform: translateY(0);
  }

  .detail h2 {
    font-size: 30px;
  }

  .hint,
  .intro-hint {
    bottom: 20px;
    width: calc(100% - 40px);
    white-space: normal;
  }

  .hint {
    font-size: 9px;
    letter-spacing: 0.18em;
    line-height: 1.8;
  }

  .bottom-fade {
    height: 130px;
  }
}

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