* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050706; color: #e8efe9; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
[hidden] { display: none !important; }

#loading, #menu, #pause, #death, #help { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; }
#loading { background: radial-gradient(ellipse at center, #17201b 0%, #050706 70%); flex-direction: column; gap: 18px; }
#menu, #pause, #death, #help { background: rgba(4, 6, 5, 0.35); }
.panel { background: rgba(12, 17, 14, 0.86); border: 1px solid rgba(170, 210, 180, 0.18); border-radius: 18px; padding: 28px 30px; max-width: 560px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.6); backdrop-filter: blur(6px); }
.title { font-family: Georgia, "Times New Roman", serif; font-size: 52px; letter-spacing: 0.12em; color: #eef6ee; text-shadow: 0 2px 18px rgba(120, 200, 150, 0.25); }
.title.small { font-size: 30px; margin-bottom: 12px; }
.sub { color: #9fb8a6; margin: 4px 0 22px; letter-spacing: 0.05em; }
#status { color: #9fb8a6; font-size: 15px; min-height: 20px; }
button { font: inherit; color: #eef6ee; background: #24372b; border: 1px solid #3f5e48; border-radius: 10px; padding: 9px 14px; cursor: pointer; }
button:hover { background: #2d4635; }
button.big { display: block; width: 100%; font-size: 20px; padding: 15px; margin: 10px 0; background: #2f6b45; border-color: #4f9a69; font-weight: 600; }
button.big.alt { background: #26392d; border-color: #46634f; }
.note { font-size: 14px; color: #c9b98a; margin: 8px 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0 6px; font-size: 14px; color: #a8c0ae; }
.row label { display: flex; flex-direction: column; gap: 5px; }
select, input { font: inherit; color: #eef6ee; background: #142019; border: 1px solid #3f5e48; border-radius: 8px; padding: 7px 9px; width: 150px; }
details { margin-top: 14px; font-size: 14px; color: #b9cdbf; line-height: 1.45; }
summary { cursor: pointer; color: #dbe9de; font-weight: 600; margin-bottom: 6px; }
#help p { font-size: 15px; color: #cfe0d3; margin: 8px 0; }
#deathCause { font-size: 20px; margin: 12px 0; color: #f2b8b5; }
#death .title { color: #ff8a80; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#bars { position: absolute; left: 16px; bottom: 16px; width: 250px; display: flex; flex-direction: column; gap: 6px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12px; text-shadow: 0 1px 3px #000; }
.bar span { width: 52px; color: #dfe9e1; }
.track { flex: 1; height: 9px; background: rgba(255,255,255,0.13); border-radius: 6px; overflow: hidden; }
.fill { height: 100%; border-radius: 6px; transition: width 0.3s; }
#info { position: absolute; left: 16px; top: 14px; font-size: 13px; line-height: 1.5; color: #e6efe8; text-shadow: 0 1px 4px #000; }
#held { position: absolute; right: 16px; bottom: 44px; font-size: 13px; text-shadow: 0 1px 4px #000; text-align: right; }
#bag { position: absolute; right: 16px; bottom: 18px; font-size: 12px; color: #c9d9cd; text-shadow: 0 1px 4px #000; max-width: 60vw; text-align: right; }
#bag .sel { color: #b9f6ca; font-weight: 700; text-decoration: underline; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,0.75); box-shadow: 0 0 3px #000; }
#hint { position: absolute; left: 50%; top: calc(50% + 18px); transform: translateX(-50%); font-size: 12px; color: rgba(255,255,255,0.75); text-shadow: 0 1px 3px #000; }
#toasts { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.toast { background: rgba(10, 14, 12, 0.72); padding: 7px 14px; border-radius: 10px; font-size: 15px; transition: opacity 0.7s; }
.toast.fade { opacity: 0; }
#fps { position: absolute; right: 12px; top: 10px; font-size: 12px; color: #9fb; }

#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#stick { position: absolute; left: 22px; bottom: 26px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2); pointer-events: auto; }
#knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.3); }
#tbtns { position: absolute; right: 12px; bottom: 18px; display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; pointer-events: auto; }
#tbtns button { height: 50px; font-size: 13px; background: rgba(30,45,36,0.7); }
@media (pointer: coarse) { #bars { bottom: auto; top: 64px; width: 190px; } #crosshair { display: block; } #held { bottom: auto; top: 14px; right: 14px; } #bag { bottom: auto; top: 34px; right: 14px; } #info { font-size: 11px; } }
