:root {
  --chance-fg: rgba(255, 255, 255, 0.96);
  --chance-soft: rgba(255, 255, 255, 0.54);
  --chance-rule: rgba(255, 255, 255, 0.16);
  --chance-accent: #c9a87c;
}

:root[data-chance-palette="dark"] {
  --chance-fg: rgba(24, 23, 21, 0.94);
  --chance-soft: rgba(24, 23, 21, 0.52);
  --chance-rule: rgba(24, 23, 21, 0.17);
}

.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;
}

.site-topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 9997;
  min-height: 70px;
  padding: 21px 56px 20px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--chance-fg);
  border-bottom: 1px solid var(--chance-rule);
  opacity: 0;
  pointer-events: none;
  background: transparent;
  transition: color 420ms ease, border-color 420ms ease, background-color 420ms ease, opacity 700ms ease;
}

:root[data-chance-ready="true"] .site-topbar { opacity: 1; }
:root[data-chance-detail-content="true"] .site-topbar { background: #111; }
.site-topbar a,
.site-menu-button { pointer-events: auto; }

.site-brand {
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  color: inherit;
}

.site-brand-cn {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
  letter-spacing: 0.16em;
  transition: letter-spacing 300ms ease;
}

.site-brand-en {
  font-family: "Times New Roman", serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--chance-soft);
}

.site-brand:hover .site-brand-cn { letter-spacing: 0.22em; }

.site-chapters {
  justify-self: center;
  display: flex;
  gap: 36px;
}

.site-chapters a,
.site-contact {
  position: relative;
  color: inherit;
  font-family: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  transition: color 260ms ease, letter-spacing 300ms ease;
}

.site-chapters a:hover,
.site-contact:hover,
.site-chapters .is-active { color: var(--chance-accent); letter-spacing: 0.24em; }

.site-chapters .is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 28px;
  height: 1px;
  background: currentColor;
  transform: translateX(-50%);
}

.site-contact { justify-self: end; }
.site-menu-button,
.site-mobile-menu { display: none; }

.chance-about-overlay {
  position: fixed;
  inset: 70px 0 0;
  z-index: 9994;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 40px 56px;
  background: #111;
  color: rgba(255, 255, 255, .96);
  cursor: pointer;
}

.chance-about-overlay[hidden] { display: none; }

.chance-about-copy {
  width: max-content;
  max-width: 100%;
  margin: 0;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(10px, 1.55vw, 30px);
  line-height: 1.4;
  letter-spacing: 0;
  cursor: default;
}

/* The About route keeps the reference transition hooks but presents only
   Waiting's title and one unbroken line of copy. */
body:has(#a-r) #a-r {
  box-sizing: border-box;
  width: 100% !important;
  min-height: 100vh;
  padding: 0 56px !important;
  display: grid;
  place-items: center;
  text-align: center;
}

body:has(#a-r) #a-r-hero {
  width: 100% !important;
  padding: 0 !important;
}

body:has(#a-r) #a-r-hero p:first-child {
  display: none;
}

body:has(#a-r) #a-r-hero p:last-child {
  width: max-content;
  max-width: 100%;
  margin: 0 auto !important;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(10px, 1.55vw, 30px);
  line-height: 1.4;
  letter-spacing: 0;
}

body:has(#a-r) #a-r > section,
body:has(#a-r) #a-l-w,
body:has(#a-r) #a-lp {
  display: none !important;
}

/* A slash reads as one compact counter instead of three spaced columns. */
#h-pgn-middle,
.w-hero-pgn-middle {
  width: 8px !important;
}

.chance-detail-plus {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  z-index: 2;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chance-fg);
  font-size: 27px;
  font-weight: 300;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, 12px, 0) rotate(0deg);
  transition: opacity 240ms ease, transform 240ms ease, color 420ms ease;
}

#h-title-w li.chance-current .chance-detail-plus {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(-50%, 0, 0) rotate(0deg);
  transition: opacity 700ms ease 360ms, transform 900ms cubic-bezier(.16,1,.3,1) 360ms, color 420ms ease;
}

#h-title-w li.chance-current .chance-detail-plus:hover {
  transform: translate3d(-50%, 0, 0) rotate(90deg) scale(1.12);
}

#h-cross svg { fill: var(--chance-fg) !important; transition: fill 420ms ease; }
#h-title-w,
#h-pgn { color: var(--chance-fg); transition: color 420ms ease; }

@media (max-width: 960px) {
  .site-topbar {
    min-height: 58px;
    padding: 14px 18px;
    grid-template-columns: 1fr auto;
  }
  .site-brand { gap: 8px; }
  .site-brand-cn { font-size: 14px; letter-spacing: 0.1em; }
  .site-brand-en { font-size: 11px; letter-spacing: 0.04em; }
  .site-chapters,
  .site-contact { display: none; }
  .site-menu-button {
    justify-self: end;
    display: grid;
    width: 34px;
    height: 30px;
    padding: 7px 3px;
    gap: 4px;
    color: inherit;
  }
  .site-menu-button span:not(.sr-only) {
    display: block;
    width: 28px;
    height: 1px;
    background: currentColor;
    transition: transform 240ms ease, opacity 240ms ease;
  }
  .site-menu-button[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .site-menu-button[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .site-menu-button[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  .site-mobile-menu:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 9998; }
  .site-mobile-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; background: rgba(20,20,20,.42); }
  .site-mobile-card {
    position: absolute;
    top: 58px;
    right: 0;
    width: min(72vw, 280px);
    padding: 28px 24px;
    display: grid;
    gap: 20px;
    background: #141414;
    color: #fff;
    border-left: 1px solid rgba(255,255,255,.14);
    border-bottom: 1px solid rgba(255,255,255,.14);
  }
  .site-mobile-card a { font: 14px/1.4 "Noto Sans SC", "PingFang SC", sans-serif; letter-spacing: .18em; }
  .site-mobile-card .is-active { color: var(--chance-accent); }

  .chance-about-overlay {
    inset: 58px 0 0;
    padding: 32px 18px;
  }

  .chance-about-copy {
    font-size: clamp(9px, 2.9vw, 13px);
  }

  body:has(#a-r) #a-r {
    padding: 0 18px !important;
  }

  body:has(#a-r) #a-r-hero p:first-child {
    font-size: clamp(42px, 18vw, 76px);
  }

  body:has(#a-r) #a-r-hero p:last-child {
    font-size: clamp(9px, 2.9vw, 13px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-topbar,
  .chance-detail-plus { transition-duration: 1ms !important; transition-delay: 0ms !important; }
}
