:root {
  color-scheme: dark;
  --night: #081217;
  --panel: #0d2028;
  --panel-2: #122c35;
  --ink: #ebe9df;
  --muted: #9aabb0;
  --amber: #ffb454;
  --green: #b7d88d;
  --line: #35505a;
  --page-width: 1120px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--night); }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(rgb(53 80 90 / 11%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(53 80 90 / 11%) 1px, transparent 1px),
    var(--night);
  background-size: 44px 44px;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.site-header { border-bottom-color: var(--line); }
.site-header .brand-mark { color: var(--night); background: var(--ink); }
.site-header .brand-name small { color: var(--muted); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--amber); }

main, footer {
  width: min(var(--page-width), calc(100% - 40px));
  margin-inline: auto;
}

.night-hero { padding: clamp(42px, 7vw, 82px) 0 clamp(34px, 5vw, 58px); }
.shift-stamp {
  display: flex;
  min-height: 44px;
  margin-bottom: 18px;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}
.shift-stamp span {
  width: 8px;
  aspect-ratio: 1;
  background: currentColor;
  animation: status-pulse 1.8s steps(2, end) infinite;
}
.shift-stamp time { margin-left: 3px; color: var(--muted); }
.night-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, .55fr);
  gap: clamp(28px, 7vw, 92px);
  align-items: end;
}
.night-hero h1 {
  margin: 0;
  font-size: clamp(4.4rem, 10vw, 8.2rem);
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: .78;
}
.night-hero h1 span { color: var(--amber); }
.night-hero-copy {
  padding: 18px 0 4px 18px;
  border-left: 1px solid var(--line);
}
.night-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.75;
}
.night-hero-copy button, .change-button {
  min-height: 44px;
  margin-top: 13px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--ink);
  background: transparent;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}
.night-hero-copy button:hover, .change-button:hover { color: var(--amber); }

.control-room {
  position: relative;
  padding: clamp(18px, 3.8vw, 42px);
  border: 1px solid var(--line);
  background: rgb(8 18 23 / 94%);
  box-shadow: 10px 10px 0 #142832;
}
.control-room::before {
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(154 171 176 / 10%);
  content: "";
  pointer-events: none;
}
.console-bar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  gap: clamp(18px, 4vw, 52px);
  align-items: center;
  margin-bottom: clamp(28px, 5vw, 48px);
}
.round-block { display: grid; gap: 4px; }
.round-block span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .62rem;
  letter-spacing: .13em;
}
.round-block strong { color: var(--amber); font-size: .92rem; letter-spacing: .08em; }
progress {
  width: 100%;
  height: 4px;
  border: 0;
  color: var(--amber);
  background: var(--panel-2);
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--panel-2); }
progress::-webkit-progress-value { background: var(--amber); transition: width 220ms ease-out; }
progress::-moz-progress-bar { background: var(--amber); }
.change-button { margin: 0; color: var(--muted); }

.night-match { position: relative; z-index: 1; }
.night-match[hidden], .night-result[hidden] { display: none; }
.night-choice {
  display: grid;
  width: 100%;
  min-height: 150px;
  padding: clamp(20px, 3.5vw, 38px);
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(18px, 4vw, 52px);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 120ms ease-out, background 120ms ease-out;
}
.night-choice:hover { border-color: var(--amber); background: var(--panel-2); }
.night-choice:active { background: #183641; }
.night-choice:disabled { cursor: default; }
.choice-code {
  display: grid;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--amber);
  color: var(--amber);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  font-weight: 800;
}
.choice-copy { display: grid; min-width: 0; gap: 8px; }
.choice-copy small {
  color: var(--muted);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
}
.choice-copy strong {
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  font-weight: 850;
  letter-spacing: -.065em;
  line-height: .9;
  overflow-wrap: anywhere;
}
.choice-action {
  padding-bottom: 5px;
  border-bottom: 1px solid currentColor;
  color: var(--amber);
  font-size: .74rem;
  font-weight: 800;
}
.or-line {
  display: grid;
  min-height: 42px;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .62rem;
}
.or-line::before, .or-line::after { height: 1px; background: var(--line); content: ""; }
.night-choice.is-entering { animation: supply-in 360ms cubic-bezier(.16, 1, .3, 1) both; }

.night-result {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 362px;
  padding: 28px;
  place-content: center;
  border: 1px solid var(--amber);
  background:
    linear-gradient(90deg, transparent 49.8%, rgb(255 180 84 / 8%) 50%, transparent 50.2%),
    var(--panel);
  text-align: center;
}
.night-result p {
  margin: 0 0 16px;
  color: var(--green);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .18em;
}
.result-name {
  color: var(--amber);
  font-size: clamp(3.4rem, 10vw, 8rem);
  font-weight: 900;
  letter-spacing: -.075em;
  line-height: .9;
  overflow-wrap: anywhere;
}
.result-actions { display: flex; margin-top: 30px; justify-content: center; gap: 10px; flex-wrap: wrap; }
.result-actions a, .result-actions button {
  display: inline-flex;
  min-height: 48px;
  padding: 12px 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-size: .78rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.result-actions a { border-color: var(--amber); color: var(--night); background: var(--amber); }
.result-actions a:hover { background: #ffc77e; }
.result-actions button:hover { border-color: var(--ink); }
.night-result.is-revealing { animation: result-in 460ms cubic-bezier(.16, 1, .3, 1) both; }
.status { margin: 18px 0 0; color: var(--muted); font-size: .76rem; text-align: center; }

.night-content, .night-faq {
  display: grid;
  padding: clamp(72px, 10vw, 118px) 0;
  grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr);
  gap: clamp(30px, 7vw, 92px);
  border-bottom: 1px solid var(--line);
}
.section-code {
  margin: 7px 0 0;
  color: var(--amber);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .64rem;
  letter-spacing: .1em;
}
.night-content h2, .night-faq h2 {
  margin: 0 0 26px;
  font-size: clamp(2rem, 5vw, 4.3rem);
  letter-spacing: -.055em;
  line-height: 1.05;
}
.night-content > div > p { margin: 0; color: var(--muted); line-height: 1.9; }
.night-facts {
  display: grid;
  margin: 38px 0 0;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.night-facts div { padding: 18px; border-right: 1px solid var(--line); }
.night-facts div:last-child { border-right: 0; }
.night-facts dt { color: var(--muted); font-size: .68rem; }
.night-facts dd { margin: 8px 0 0; font-weight: 750; }
.night-faq details { border-top: 1px solid var(--line); }
.night-faq details:last-child { border-bottom: 1px solid var(--line); }
.night-faq summary { min-height: 52px; padding: 16px 0; font-weight: 750; cursor: pointer; }
.night-faq details p { margin: 0; padding: 0 0 20px; color: var(--muted); line-height: 1.8; }

footer {
  display: flex;
  padding: 34px 0 48px;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: .72rem;
}
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }
footer a { min-height: 44px; color: inherit; text-underline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes status-pulse { 50% { opacity: .35; } }
@keyframes supply-in { from { opacity: 0; transform: translateX(28px); } }
@keyframes result-in { from { opacity: 0; transform: scale(.975); } }

@media (max-width: 720px) {
  main, footer { width: min(var(--page-width), calc(100% - 24px)); }
  .night-hero { padding-top: 28px; }
  .night-hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .night-hero h1 { font-size: min(calc(15vw + .5rem), 5.2rem); line-height: .83; }
  .night-hero-copy { padding: 14px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .control-room { padding: 16px; box-shadow: 5px 5px 0 #142832; }
  .console-bar { grid-template-columns: auto 1fr; gap: 12px 18px; }
  .console-bar progress { grid-column: 1 / -1; grid-row: 2; }
  .change-button { justify-self: end; }
  .night-choice { min-height: 126px; padding: 18px 14px; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; }
  .choice-code { width: 38px; }
  .choice-copy strong { font-size: min(calc(10vw + .5rem), 3.6rem); }
  .choice-action { display: none; }
  .night-result { min-height: 380px; padding: 20px 12px; }
  .result-name { font-size: min(calc(15vw + .5rem), 5.6rem); }
  .result-actions { display: grid; }
  .result-actions a, .result-actions button { justify-content: center; }
  .night-content, .night-faq { grid-template-columns: 1fr; gap: 20px; }
  .night-content h2, .night-faq h2 { font-size: min(calc(6vw + .75rem), 3rem); }
  .night-facts { grid-template-columns: 1fr; }
  .night-facts div { border-right: 0; border-bottom: 1px solid var(--line); }
  .night-facts div:last-child { border-bottom: 0; }
  footer { display: grid; }
}

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