:root {
  color-scheme: light dark;
  --canvas: #f2f3ef;
  --surface: #e6e9e2;
  --surface-strong: #dce1d8;
  --ink: #202622;
  --muted: #5f6962;
  --line: #c8cec6;
  --accent: #a34329;
  --accent-strong: #7f2f1c;
  --focus: #8d351f;
  --radius: 14px;
  font-family: "Avenir Next", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  background: var(--canvas);
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #171b19;
    --surface: #202622;
    --surface-strong: #2a312c;
    --ink: #e8ece7;
    --muted: #abb4ad;
    --line: #39423c;
    --accent: #dd795a;
    --accent-strong: #f09576;
    --focus: #f09576;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    linear-gradient(135deg, transparent 0 74%, color-mix(in srgb, var(--accent) 5%, transparent) 74% 100%),
    var(--canvas);
}

button,
input,
a {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--canvas);
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.site-header,
.page-shell,
.site-footer {
  width: min(1040px, calc(100% - clamp(32px, 7vw, 104px)));
  margin-inline: auto;
}

.site-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.site-name {
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 700 13px/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: -0.025em;
  cursor: pointer;
  transition: color 140ms ease, transform 140ms ease;
}

.site-name:hover {
  color: var(--accent);
}

.site-name:active {
  transform: translateY(1px) scale(0.99);
}

.site-name[data-nudge="left"] {
  transform: translateX(-1px);
}

.site-name[data-nudge="right"] {
  transform: translateX(1px);
}

.page-shell {
  align-self: center;
  display: grid;
  grid-template-columns: minmax(0, 660px);
  align-items: center;
  gap: clamp(42px, 6vw, 76px);
  padding-block: clamp(56px, 10vh, 108px);
}

.game-is-open .page-shell {
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
}

.introduction {
  max-width: 660px;
}

.introduction::before {
  content: "";
  display: block;
  width: 44px;
  height: 5px;
  margin-bottom: 28px;
  border-radius: var(--radius);
  background: var(--accent);
}

.introduction h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(46px, 6.3vw, 76px);
  font-weight: 720;
  line-height: 1.08;
  letter-spacing: -0.06em;
  text-wrap: balance;
}

.lead {
  max-width: 35em;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.8;
  text-wrap: pretty;
}

.secret-game {
  min-width: 0;
  padding: clamp(24px, 3.4vw, 38px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--accent) 9%, transparent);
}

.secret-game:focus {
  outline: none;
}

.game-heading h2,
.reward h3 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.game-heading p,
.reward p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.game-controls {
  margin-top: 34px;
}

.value-row,
.range-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.value-row {
  color: var(--muted);
  font-size: 12px;
}

.value-row output {
  color: var(--ink);
  font: 720 clamp(22px, 3vw, 34px)/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: -0.055em;
}

.number-slider {
  width: 100%;
  height: 32px;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  accent-color: var(--accent);
}

.number-slider:active {
  cursor: grabbing;
}

.number-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.number-slider::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -10.5px;
  border: 3px solid var(--canvas);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.number-slider::-moz-range-track {
  height: 5px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.number-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid var(--canvas);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.number-slider:disabled {
  cursor: default;
  opacity: 0.5;
}

.range-row {
  margin-top: 2px;
  color: var(--muted);
  font: 500 10px/1.4 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.range-caption,
.slider-feedback {
  margin: 15px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

.range-caption {
  color: var(--muted);
}

.slider-feedback {
  min-height: 1.6em;
  color: var(--accent-strong);
  font-weight: 650;
}

.reward {
  margin-top: 6px;
}

.reward a {
  display: inline-block;
  max-width: 100%;
  margin-top: 24px;
  padding: 13px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--canvas);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
}

.reward a:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.reward a:active {
  transform: translateY(1px);
}

.noscript-note {
  max-width: 36em;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.site-footer {
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--accent-strong);
}

@media (max-width: 800px) {
  .site-header,
  .page-shell,
  .site-footer {
    width: min(100% - 32px, 620px);
  }

  .site-header {
    min-height: 64px;
  }

  .page-shell,
  .game-is-open .page-shell {
    align-self: start;
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
    padding-block: 52px 64px;
  }

  .introduction h1 {
    font-size: clamp(42px, 12vw, 60px);
  }

  .secret-game {
    padding: 24px;
  }
}

@media (max-width: 390px) {
  .page-shell {
    padding-top: 42px;
  }

  .introduction h1 {
    font-size: 42px;
  }

  .value-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .value-row output {
    font-size: 28px;
  }

  .reward a {
    width: 100%;
  }
}

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