* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Noto Serif SC", serif;
  color: #21312e;
  background:
    linear-gradient(90deg, rgba(31, 111, 104, .1) 1px, transparent 1px),
    linear-gradient(180deg, rgba(159, 47, 47, .08) 1px, transparent 1px),
    #edf1ee;
  background-size: 42px 42px;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: rise .45s ease both;
}

.ink-hero {
  min-height: calc(100vh - 56px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  align-items: stretch;
  border: 1px solid rgba(33, 49, 46, .22);
  background: rgba(246, 248, 244, .82);
  box-shadow: 0 20px 60px rgba(32, 42, 40, .14);
}

.hero-img {
  width: 100%;
  height: 100%;
  min-height: 620px;
  object-fit: cover;
  filter: grayscale(.25) contrast(.92);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: clamp(28px, 5vw, 64px);
  background:
    linear-gradient(90deg, rgba(237, 241, 238, .92), rgba(237, 241, 238, .78)),
    repeating-linear-gradient(0deg, rgba(33, 49, 46, .06), rgba(33, 49, 46, .06) 1px, transparent 1px, transparent 10px);
}

h1,
h2,
h3,
.seal {
  margin: 0;
}

h1 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", serif;
  font-size: clamp(54px, 9vw, 108px);
  font-weight: 400;
  color: #172421;
  letter-spacing: 0;
}

h2 {
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", serif;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 400;
  color: #172421;
}

h3 {
  font-size: 24px;
  color: #172421;
}

.seal {
  align-self: flex-start;
  padding: 8px 12px;
  color: #f8f4ea;
  background: #9f2f2f;
  border-radius: 4px;
  font-family: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", serif;
  font-size: 28px;
}

.seal.big {
  min-width: 86px;
  min-height: 86px;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.1;
}

.hero-copy p,
.lead,
.panel p,
.wait-box p {
  font-size: 18px;
  line-height: 1.9;
}

.name-label,
.eyebrow {
  color: #1f6f68;
  font-weight: 700;
}

.name-row,
.match-row {
  display: flex;
  gap: 10px;
}

input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: #172421;
  background: rgba(246, 248, 244, .88);
  border: 1px solid rgba(33, 49, 46, .32);
  border-radius: 6px;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary,
#randomName,
.tab {
  min-height: 48px;
  padding: 0 20px;
  color: #f8f4ea;
  background: #21312e;
}

#randomName {
  white-space: nowrap;
  background: #1f6f68;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin: 12px 0 18px;
  color: #1f6f68;
  font-size: 18px;
}

.question-panel,
.panel,
.wait-box,
.result-head {
  background: rgba(246, 248, 244, .84);
  border: 1px solid rgba(33, 49, 46, .2);
  box-shadow: 0 14px 44px rgba(32, 42, 40, .1);
}

.question-panel {
  padding: clamp(22px, 5vw, 54px);
}

.question-text {
  margin: 0 0 28px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.55;
  color: #172421;
}

.options {
  display: grid;
  gap: 14px;
}

.option {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 78px;
  padding: 14px;
  text-align: left;
  color: #21312e;
  background: rgba(246, 248, 244, .94);
  border: 1px solid rgba(33, 49, 46, .18);
  transition: transform .2s ease, border-color .2s ease;
}

.option:hover {
  transform: translateY(-2px);
  border-color: rgba(159, 47, 47, .55);
}

.option span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #f8f4ea;
  background: #9f2f2f;
  border-radius: 4px;
}

.option em {
  font-style: normal;
  font-size: 19px;
  line-height: 1.6;
}

.result-head {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 28px;
  margin-bottom: 18px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.tab {
  background: #52615c;
}

.tab.active {
  background: #9f2f2f;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel,
.wait-box {
  padding: 24px;
}

canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.dim-list {
  display: grid;
  gap: 12px;
}

.dim-row {
  padding: 14px 0;
  border-top: 1px solid rgba(33, 49, 46, .16);
}

.dim-row strong {
  color: #9f2f2f;
}

.dim-row span {
  float: right;
  color: #1f6f68;
  font-weight: 700;
}

.match-score {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: #f8f4ea;
  background: #9f2f2f;
  border-radius: 6px;
}

.match-score span {
  font-size: 34px;
}

.match-score small {
  margin-top: -36px;
}

.wait-box {
  text-align: center;
}

.spinner {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border: 3px solid rgba(31, 111, 104, .18);
  border-top-color: #1f6f68;
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 36, 33, .72);
}

.access-gate[hidden] {
  display: none;
}

.gate-card {
  width: min(520px, 100%);
  padding: 30px;
  text-align: center;
  color: #21312e;
  background: rgba(246, 248, 244, .96);
  border: 1px solid rgba(33, 49, 46, .24);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .24);
}

.gate-card a {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 0 18px;
  color: #f8f4ea;
  text-decoration: none;
  background: #9f2f2f;
  border-radius: 6px;
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .ink-hero,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .hero-img {
    min-height: 38vh;
  }

  .result-head,
  .name-row,
  .match-row {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 58px;
  }
}
