:root { color-scheme: dark; --ink: #f1ecd9; --dim: #c9c2a8; --leaf: #8fc46a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0e130c; overflow: hidden; }
body { font: 16px/1.5 Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; color: var(--ink); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }

#title {
  position: fixed; inset: auto auto 7vh 6vw; max-width: 34rem; padding: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55); transition: opacity 0.6s;
}
#title.gone { opacity: 0; pointer-events: none; }
#title h1 { font-weight: normal; font-size: clamp(2.6rem, 6vw, 4.6rem); letter-spacing: 0.01em; margin: 0 0 0.4rem; }
#title .lede { font-size: 1.1rem; margin: 0 0 1.3rem; color: var(--ink); }
.chapter { margin: 0 0 0.9rem; font-style: italic; color: var(--leaf); letter-spacing: 0.02em; }
.start { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.start span { color: var(--dim); font-style: italic; }
button {
  font: inherit; color: #10180c; background: var(--ink); border: 0; border-radius: 999px; padding: 0.55rem 1.6rem;
  cursor: pointer; font-size: 1.05rem;
}
button:hover { background: #fff; }
button:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.2rem 1.6rem; margin: 0; font-size: 0.92rem; }
.keys div { display: flex; gap: 0.6rem; }
.keys dt { color: var(--ink); }
.keys dd { margin: 0; color: var(--dim); font-style: italic; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hint {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%); font-style: italic; color: var(--ink);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7); opacity: 0; transition: opacity 0.8s;
}
#hint.on { opacity: 1; }

/* The morning's readouts: quiet lines in the corners, fading in when they matter. */
#play { opacity: 0; transition: opacity 0.8s; }
#play.on { opacity: 1; }
#goal { position: absolute; left: 22px; top: 16px; margin: 0; font-style: italic; color: var(--dim); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7); }
#meters { position: absolute; left: 22px; bottom: 20px; display: grid; gap: 6px; font-size: 0.85rem; font-style: italic; }
.row { display: flex; align-items: center; gap: 10px; transition: opacity 0.6s; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.row span { width: 3.6rem; color: var(--dim); }
.row i, #watch i { display: block; width: 150px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.row b, #watch b { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.15s linear, background 0.4s; }
#r-energy b { background: #d6c36a; }
#r-energy.low b { background: #e0805a; }
#r-grip, #r-meal { opacity: 0; }
#r-grip.on, #r-meal.on { opacity: 1; }
#r-grip b { background: #b9d7a0; }
#r-grip.low b { background: #e0805a; }
#r-meal b { background: #eaa0bd; }
#prompt {
  position: absolute; left: 50%; bottom: 13vh; transform: translateX(-50%); padding: 0.25rem 0.9rem; border-radius: 999px;
  background: rgba(14, 19, 12, 0.45); font-size: 0.95rem; opacity: 0; transition: opacity 0.3s;
}
#prompt.on { opacity: 1; }
#watch {
  position: absolute; left: 50%; top: 9vh; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px;
  font-size: 1.15rem; font-style: italic; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9); opacity: 0; transition: opacity 0.5s;
}
#watch.on { opacity: 1; }
#watch i { width: 220px; }
#watch b { background: #e0805a; }

#end {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: start; padding: 0 8vw;
  background: radial-gradient(ellipse at 30% 60%, rgba(14, 19, 12, 0.35), rgba(14, 19, 12, 0.82)); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}
#end[hidden] { display: none; }
#end h2 { font-weight: normal; font-size: clamp(2rem, 4.5vw, 3.4rem); margin: 0 0 0.6rem; }
#end p { max-width: 34rem; margin: 0 0 1rem; }
#end dl { display: grid; grid-template-columns: auto auto; gap: 0.15rem 1.4rem; margin: 0 0 1.6rem; font-size: 0.95rem; }
#end dt { color: var(--dim); font-style: italic; }
#end dd { margin: 0; }
#stats { position: absolute; right: 10px; top: 8px; font: 12px/1.3 ui-monospace, Menlo, monospace; color: #dfe; white-space: pre; text-shadow: 0 1px 2px #000; }

#err { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; padding: 2rem; background: #0e130c; }
#err[hidden] { display: none; }
