:root {
  --ink: #e9e3d3;
  --dim: #9a9585;
  --bg: #0b0f0d;
  --red: #c4564a;
  --blue: #5a7fb8;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
#gl, #hud { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { pointer-events: none; }
#screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  transition: opacity 0.6s;
}
#screen.hidden { opacity: 0; pointer-events: none; }
.title {
  font-size: clamp(44px, 14vw, 88px);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(200, 230, 210, 0.35), 3px 2px 0 rgba(196, 86, 74, 0.5), -3px -1px 0 rgba(90, 127, 184, 0.5);
  animation: wob 3.2s ease-in-out infinite;
}
@keyframes wob {
  0%, 100% { transform: skewX(0deg) scaleY(1); }
  30% { transform: skewX(-6deg) scaleY(1.05); }
  65% { transform: skewX(5deg) scaleY(0.96); }
}
.feet { display: flex; gap: 48px; align-items: flex-end; opacity: 0.85; }
.feet svg { width: 54px; height: 72px; }
.tap {
  font-size: 15px;
  color: var(--dim);
  letter-spacing: 0.2em;
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }
.line { font-size: clamp(20px, 5.6vw, 30px); font-weight: 700; line-height: 1.5; max-width: 22em; text-wrap: balance; }
.who { font-size: 15px; color: var(--dim); }
.who b { display: block; margin-top: 6px; font-size: clamp(22px, 6.4vw, 34px); color: var(--ink); letter-spacing: 0.04em; text-wrap: balance; word-break: auto-phrase; }
.stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 18px;
  font-size: 15px;
  color: var(--dim);
  text-align: left;
}
.stats span:nth-child(even) { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.rule { font-size: 15px; color: var(--dim); }
.rule i { font-style: normal; font-weight: 800; }
.rule .red { color: var(--red); }
.rule .blue { color: var(--blue); }
.buttons { display: flex; gap: 12px; margin-top: 6px; }
.btn {
  appearance: none;
  border: 2px solid rgba(233, 227, 211, 0.5);
  background: rgba(20, 26, 22, 0.6);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 30px 26px 32px 24px;
  cursor: pointer;
}
.btn:active { transform: scale(0.96); }
.btn.share { font-size: 15px; padding: 8px 20px; }
.dark { background: radial-gradient(ellipse at center, rgba(5, 7, 6, 0.55), rgba(5, 7, 6, 0.9)); }
.morning { background: radial-gradient(ellipse at center, rgba(255, 246, 220, 0.25), rgba(30, 28, 22, 0.88)); }
.morning {
  color: #2a2620;
  background: radial-gradient(ellipse at center, rgba(255, 249, 232, 0.94), rgba(226, 212, 178, 0.97));
}
.logo { width: min(92vw, 640px); height: auto; margin: -4% 0 -2%; animation: wob 4.2s ease-in-out infinite; }
.howto {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px 14px;
  align-items: center;
  font-size: 15px;
  color: var(--dim);
  text-align: left;
}
.howto .key { color: var(--ink); font-weight: 700; text-align: right; white-space: nowrap; }
.howto b { color: var(--ink); }
kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 3px 6px;
  margin-left: 4px;
  border: 2px solid rgba(233, 227, 211, 0.6);
  border-bottom-width: 4px;
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
}
.hint { font-size: 14px; color: #c9a37a; }
#screen.wake.dark { justify-content: flex-end; background: linear-gradient(to bottom, rgba(5, 7, 6, 0) 0%, rgba(5, 7, 6, 0) 34%, rgba(5, 7, 6, 0.82) 52%, rgba(5, 7, 6, 0.92) 100%); }
#screen.wake.morning { justify-content: flex-end; background: linear-gradient(to bottom, rgba(255, 249, 232, 0) 0%, rgba(255, 249, 232, 0) 34%, rgba(255, 249, 232, 0.88) 52%, rgba(240, 228, 198, 0.96) 100%); }
@media (orientation: landscape) {
  #screen.wake.dark, #screen.wake.morning { justify-content: center; padding-left: 50vw; padding-right: 3vw; }
  #screen.wake.dark { background: linear-gradient(to right, rgba(5, 7, 6, 0) 0%, rgba(5, 7, 6, 0) 40%, rgba(5, 7, 6, 0.85) 56%, rgba(5, 7, 6, 0.92) 100%); }
  #screen.wake.morning { background: linear-gradient(to right, rgba(255, 249, 232, 0) 0%, rgba(255, 249, 232, 0) 40%, rgba(255, 249, 232, 0.9) 56%, rgba(240, 228, 198, 0.96) 100%); }
}
.morning .line, .morning .who b, .morning .stats span:nth-child(even) { color: #2a2620; }
.morning .who, .morning .stats, .morning .rule { color: #6b6250; }
.morning .title { text-shadow: none; }
.morning .btn { color: #2a2620; background: rgba(255, 255, 255, 0.5); border-color: rgba(42, 38, 32, 0.45); }
@media (max-height: 520px) {
  #screen { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .line { font-size: 19px; }
  .who b { font-size: 21px; margin-top: 2px; }
  .stats { grid-template-columns: auto auto auto auto; gap: 2px 14px; font-size: 13px; }
  .who, .rule { font-size: 13px; }
  .btn { padding: 8px 18px; font-size: 15px; }
  .title { font-size: 56px; }
  .logo { width: min(60vw, 420px); margin: -3% 0 -3%; }
  .howto { gap: 4px 12px; font-size: 13px; }
  kbd { font-size: 13px; padding: 1px 5px; }
  .hint { font-size: 12px; }
  .wake .stats { grid-template-columns: auto auto; }
  .feet svg { width: 40px; height: 54px; }
}
.credits-btn {
  position: absolute; right: calc(12px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
  appearance: none; border: 0; background: none; color: var(--dim); font: inherit; font-size: 12px; padding: 8px; cursor: pointer; opacity: 0.7;
}
.credits { display: grid; gap: 14px; max-width: 26em; text-align: left; font-size: 14px; color: var(--dim); }
.credit { display: grid; gap: 2px; }
.credit b { color: var(--ink); font-size: 15px; }
.credit-note a { color: var(--ink); }
.lang {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 13px; color: var(--ink);
  background: rgba(20, 26, 22, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23e9e3d3'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1.5px solid rgba(233, 227, 211, 0.45); border-radius: 16px; padding: 6px 28px 6px 12px; cursor: pointer;
}
.lang option { color: #111; background: #eee; }
:lang(zh) body, :lang(zh) .btn, :lang(zh) kbd { font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
:lang(ko) body, :lang(ko) .btn, :lang(ko) kbd { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; }
:lang(ko) #screen { word-break: keep-all; }
:lang(en) .title, :lang(en) .line { letter-spacing: 0; }
