:root {
  color-scheme: dark;
  --night: #120911;
  --paper: #fff3ec;
  --muted: #c7aaaf;
  --rose-line: #a9688180;
  --chinese: 'Songti SC', 'Noto Serif CJK SC', 'Noto Serif SC', SimSun, serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
}

body {
  overflow: hidden;
  color: var(--paper);
  font-family: var(--chinese);
}

.stage {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 34% 6% at 50% 82.4%, #9a3e51 0%, #5120327a 42%, transparent 100%),
    radial-gradient(ellipse 31% 63% at 51% 56%, #502133 0%, #2c1320 53%, transparent 100%),
    radial-gradient(ellipse 86% 20% at 50% 91%, #240f1a 0%, transparent 85%),
    var(--night);
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#scene:focus-visible {
  outline: 2px solid #ffd3df;
  outline-offset: -4px;
}

.title {
  position: absolute;
  top: max(5.85%, calc(env(safe-area-inset-top, 0px) + 14px));
  left: max(5.4%, calc(env(safe-area-inset-left, 0px) + 16px));
  pointer-events: none;
  text-shadow: 0 2px 24px #0e070e8c;
}

.title h1 {
  margin: 0;
  font: 400 clamp(2.65rem, 5.35vw, 5.5rem) / 1.19 var(--chinese);
  letter-spacing: .09em;
}

.title h1 span {
  display: block;
}

.controls {
  position: absolute;
  right: max(14px, env(safe-area-inset-right, 0px));
  bottom: max(2.6%, calc(env(safe-area-inset-bottom, 0px) + 8px));
  left: max(14px, env(safe-area-inset-left, 0px));
  text-align: center;
  pointer-events: none;
}

.controls__buttons {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 2.4vw, 38px);
}

.controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .85em;
  width: min(100%, clamp(135px, 17.9vw, 300px));
  min-height: clamp(44px, 4.15vw, 68px);
  padding: .3em .55em;
  border: clamp(1px, .14vw, 2px) solid var(--rose-line);
  border-radius: 999px;
  background: #1508118c;
  color: var(--paper);
  font: 400 clamp(.91rem, 1.93vw, 2.05rem) / 1.2 var(--chinese);
  letter-spacing: .07em;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.controls button svg {
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

.controls button:active,
.controls button[aria-pressed='true'] {
  border-color: #c37d96;
  background: #642842bd;
}

.controls button:focus-visible {
  outline: 2px solid #ffd3df;
  outline-offset: 4px;
}

@media (hover: hover) {
  .controls button:hover {
    border-color: #d695ad;
    background: #542039cc;
  }
}

#controls-hint {
  margin: .85em 0 0;
  color: var(--muted);
  font-size: clamp(.75rem, 1.57vw, 1.7rem);
  letter-spacing: .18em;
}

@media (orientation: portrait) {
  .title {
    top: max(5%, calc(env(safe-area-inset-top, 0px) + 12px));
  }

  .title h1 {
    font-size: clamp(2.45rem, 7.45vw, 4.7rem);
  }

  .controls button {
    width: min(45%, clamp(135px, 23.8vw, 220px));
  }
}

@media (max-height: 550px) and (orientation: landscape) {
  .title {
    top: max(4.5%, calc(env(safe-area-inset-top, 0px) + 8px));
  }

  .title h1 {
    font-size: clamp(2.1rem, 5.4vw, 3.25rem);
  }

  .controls button {
    font-size: 1rem;
  }

  #controls-hint {
    margin-top: .48em;
    font-size: .73rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .controls button {
    transition: none;
  }
}
