:root {
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --gold: #f3cf86;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: #eee; font-family: var(--serif); }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

.bar { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 5; pointer-events: none; }
#letterbox-top { top: 0; }
#letterbox-bottom { bottom: 0; display: flex; align-items: center; }

#caption {
  position: absolute; left: 6vw; bottom: 50%; transform: translateY(50%);
  opacity: 0; transition: none; white-space: nowrap;
}
.cap-head { display: flex; align-items: baseline; gap: 0.9em; letter-spacing: 0.32em; font-size: clamp(12px, 1.25vw, 20px); color: #e9e2d0; }
.cap-num { color: var(--gold); letter-spacing: 0.1em; }
.cap-title { text-transform: uppercase; }
.cap-kanji { letter-spacing: 0.1em; color: #b9b2a0; }
.cap-line { margin-top: 0.55em; font-style: italic; font-size: clamp(11px, 1.0vw, 16px); color: #9d988c; letter-spacing: 0.05em; }

.card {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; z-index: 6; text-align: center; text-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.card .kanji { font-size: clamp(18px, 2.2vw, 34px); letter-spacing: 0.6em; color: var(--gold); margin-left: 0.6em; }
.card .big { font-size: clamp(40px, 7.5vw, 124px); letter-spacing: 0.42em; margin-left: 0.42em; font-weight: 300; color: #f4efe2; }
.card .small { margin-top: 0.8em; font-style: italic; font-size: clamp(13px, 1.3vw, 20px); letter-spacing: 0.12em; color: #d7cfbd; }
.card .tiny { margin-top: 1.6em; font-size: clamp(11px, 0.95vw, 14px); letter-spacing: 0.2em; color: #a49c8a; text-transform: uppercase; }

#start {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, #151a33 0%, #05060c 70%);
  transition: opacity 1.2s ease;
}
#start.hidden { opacity: 0; pointer-events: none; }
.start-inner { max-width: 640px; padding: 32px; text-align: center; }
.start-inner .kanji { font-size: 26px; letter-spacing: 0.6em; margin-left: 0.6em; color: var(--gold); }
.start-inner h1 { font-weight: 300; font-size: clamp(44px, 8vw, 88px); letter-spacing: 0.4em; margin: 0.1em 0 0.3em 0.4em; color: #f4efe2; }
.start-inner .lede { font-size: 19px; font-style: italic; color: #e3dccb; line-height: 1.5; }
.start-inner .about { font-size: 15px; color: #a9a495; line-height: 1.7; font-family: -apple-system, "Helvetica Neue", sans-serif; }
.start-inner em { color: var(--gold); font-style: normal; }
button {
  font-family: var(--serif); font-size: 16px; letter-spacing: 0.35em; text-transform: uppercase;
  padding: 14px 38px 14px 44px; margin-top: 22px; color: #1a1408; background: var(--gold);
  border: none; border-radius: 2px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 40px rgba(243, 207, 134, 0.35);
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 60px rgba(243, 207, 134, 0.6); }
button:disabled { opacity: 0.5; cursor: wait; }
.keys { margin-top: 26px; font-size: 12px; color: #6f6b62; letter-spacing: 0.12em; font-family: -apple-system, "Helvetica Neue", sans-serif; }

#end-actions { position: fixed; left: 0; right: 0; bottom: 14vh; display: none; justify-content: center; z-index: 21; }
#end-actions.show { display: flex; }

#scrub {
  position: fixed; left: 0; right: 0; bottom: 0; height: 14px; z-index: 10; cursor: pointer;
  opacity: 0; transition: opacity 0.4s;
}
body.ui-active #scrub { opacity: 1; }
body.ui-hidden #scrub, body.ui-hidden #caption, body.ui-hidden #hud { display: none; }
#scrub::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.12); }
#scrub-fill { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--gold); }
#scrub-sections .tick { position: absolute; bottom: 0; width: 1px; height: 9px; background: rgba(255,255,255,0.35); }
#scrub:hover::before, #scrub:hover #scrub-fill { height: 6px; }

#hud {
  position: fixed; top: 8px; left: 8px; z-index: 30; margin: 0; padding: 8px 10px; display: none;
  background: rgba(0,0,0,0.6); color: #9fe; font: 11px/1.45 ui-monospace, Menlo, monospace; pointer-events: none;
}
#hud.show { display: block; }
