:root {
  --paper: #ebe4d8;
  --paper-deep: #ddd3c4;
  --ink: #1c1814;
  --ink-soft: #4a433a;
  --gold: #9a7b4f;
  --gold-dim: rgba(154, 123, 79, 0.35);
  --shadow: rgba(28, 24, 20, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body.gate-body {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
  -webkit-font-smoothing: antialiased;
  background: var(--ink);
  color: var(--ink-soft);
  line-height: 1.65;
}

#stage-gate {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse 120% 80% at 50% 40%, #2a2520 0%, var(--ink) 65%);
}

.gate-scroll {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gate-section {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(3.5rem, clamp(1rem, 4vw, 3rem)) clamp(1rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem);
  background: linear-gradient(165deg, var(--paper) 0%, var(--paper-deep) 100%);
  box-shadow: inset 0 0 120px var(--shadow);
}

.cover-inner {
  text-align: center;
  max-width: 36rem;
  border-top: 1px solid var(--gold-dim);
  border-bottom: 1px solid var(--gold-dim);
  padding: clamp(2rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
}

.cover-seal {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1.75rem;
  border: 2px solid var(--gold);
  color: var(--gold);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  line-height: 1.6;
}

.cover h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.35em;
  margin-bottom: 0.75rem;
}

.cover .sub {
  font-size: clamp(0.95rem, 2.2vw, 1.15rem);
  color: var(--ink-soft);
  letter-spacing: 0.28em;
  font-weight: 400;
}

.cover .hint {
  margin-top: 2.5rem;
  font-size: clamp(0.68rem, 2.6vw, 0.8rem);
  line-height: 1.85;
  color: var(--gold);
  letter-spacing: 0.12em;
  opacity: 0.85;
  margin-left: auto;
  margin-right: auto;
  padding: 0 clamp(0.5rem, 2vw, 1rem);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  text-align: center;
}

.cover .hint .hint-block {
  display: inline-block;
  white-space: nowrap;
}

.intro-card {
  max-width: 32rem;
  padding: clamp(2rem, 5vw, 3rem);
  border-left: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 24px 48px var(--shadow);
}

.intro-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.35em;
  margin-bottom: 1.25rem;
}

.intro-card p {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 2;
  color: var(--ink-soft);
  text-align: justify;
  text-indent: 2em;
}

.gate-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.gate-actions a {
  font-size: 0.88rem;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border: 1px solid var(--gold-dim);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.gate-actions a:hover,
.gate-actions a:focus-visible {
  color: var(--ink);
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.4);
}

.gate-actions a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.gate-actions .primary {
  font-weight: 600;
}

#chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  background: transparent;
  pointer-events: none;
}

#chrome .back-link {
  justify-self: start;
  pointer-events: auto;
  font-size: clamp(0.76rem, 2.2vw, 0.88rem);
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

#chrome .back-link:hover {
  color: #c4a574;
}

#chrome .title {
  justify-self: center;
  text-align: center;
  font-size: clamp(0.84rem, 2.6vw, 1.02rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
}

#chrome .counter {
  justify-self: end;
  font-size: clamp(0.76rem, 2.2vw, 0.88rem);
  font-weight: 600;
  letter-spacing: 0.15em;
  color: rgba(196, 165, 116, 0.92);
  font-variant-numeric: tabular-nums;
}
