:root {
  --fg: #f1ebdc;
  --dim: rgba(241, 235, 220, 0.62);
  --faint: rgba(241, 235, 220, 0.22);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #0d1117;
  color: var(--fg);
  font-family: ui-serif, Georgia, "Songti SC", "Noto Serif CJK SC", "Hiragino Mincho ProN", serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#veil {
  position: fixed; inset: 0; background: #000; opacity: 1; pointer-events: none;
  transition: opacity 2.6s ease; z-index: 5;
}
#veil.clear { opacity: 0; }
#veil.dark { opacity: 1; transition-duration: 1.2s; }

.layer {
  position: fixed; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px 16px 90px;
  opacity: 0; pointer-events: none; transition: opacity 1.4s ease;
}
.layer.on { opacity: 1; pointer-events: auto; }

.question { font-weight: 400; font-size: clamp(26px, 4.4vw, 40px); letter-spacing: 0.04em; margin: 0 0 6px; }
.words { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; max-width: 640px; }

button {
  font: inherit; color: var(--fg); background: transparent; border: none; cursor: pointer;
  padding: 8px 6px; transition: opacity .5s, color .5s;
}
.word {
  font-size: clamp(20px, 3vw, 26px); opacity: 0.62;
  animation: float 7s ease-in-out infinite;
}
.word:nth-child(2) { animation-delay: -1.7s; }
.word:nth-child(3) { animation-delay: -3.4s; }
.word:nth-child(4) { animation-delay: -5.1s; }
.word:hover, .word:focus-visible { opacity: 1; }
.word + .word::before { content: "·"; margin-right: 26px; opacity: 0.4; display: inline-block; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

#say input {
  font: inherit; font-size: 16px; color: var(--fg); background: transparent;
  border: none; border-bottom: 1px solid var(--faint); padding: 8px 4px;
  width: min(320px, 82vw); text-align: center; outline: none;
}
#say input:focus { border-color: var(--dim); }
::placeholder { color: var(--dim); opacity: 0.8; }

.durations { display: flex; gap: 14px; }
.dur { font-size: 14px; opacity: 0.45; }
.dur.selected { opacity: 0.95; border-bottom: 1px solid var(--dim); }
.hint { margin: 0; color: var(--dim); font-size: 12px; }

#hud { justify-content: flex-end; padding-bottom: 70px; gap: 10px; }
.time { font-size: 30px; font-weight: 300; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; opacity: 0.85; }
.controls { display: flex; gap: 22px; font-size: 14px; }
.controls button { opacity: 0.7; }
.controls button:hover { opacity: 1; }
.done { font-size: 22px; margin: 0; }
#done { justify-content: flex-end; padding-bottom: 90px; }

.chrome { transition: opacity 1.2s ease; }
body.sitting .chrome { opacity: 0; pointer-events: none; }
body.sitting.stir .chrome { opacity: 1; pointer-events: auto; }
body.sitting { cursor: none; }
body.sitting.stir { cursor: auto; }

footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; justify-content: center; align-items: center; gap: 14px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  font-size: 12px; color: var(--dim);
}
footer select { font: inherit; color: var(--dim); background: transparent; border: none; cursor: pointer; }
footer select option { color: #000; }

.fb-open { position: fixed; right: 14px; bottom: 10px; z-index: 4; padding: 4px 12px; font-size: 16px; color: var(--dim); }
.fb {
  position: fixed; right: 14px; bottom: 52px; z-index: 6;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  background: rgba(10, 12, 16, 0.9); border: 1px solid var(--faint); border-radius: 14px;
  padding: 14px; width: min(320px, calc(100vw - 28px));
}
.fb[hidden] { display: none; }
.fb label { align-self: flex-start; font-size: 13px; color: var(--dim); }
.fb textarea {
  font: inherit; color: var(--fg); background: transparent; border: none; border-bottom: 1px solid var(--faint);
  width: 100%; resize: none; outline: none; padding: 6px 2px;
}
.fb button { border: 1px solid var(--faint); border-radius: 999px; padding: 6px 16px; }

@media (orientation: portrait) {
  #ask { justify-content: flex-start; padding-top: 7vh; gap: 14px; }
  .words { gap: 6px 18px; }
}
