/* Quis ut Deus: menus, HUD and touch buttons drawn over the game canvas. */
:root { --gold: #f1c95b; --ink: #f4ecd8; --dim: #b9ad95; --bg: rgba(11, 10, 26, .9); --red: #e0605a; }
html, body { margin: 0; height: 100%; background: #0b0a1a; overflow: hidden; color: var(--ink); font: 16px/1.45 Georgia, 'Times New Roman', serif; }
body { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; }
#game canvas { image-rendering: pixelated; }
button { font: inherit; color: inherit; cursor: pointer; }

/* loading bar */
#loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; letter-spacing: .2em; color: var(--gold); z-index: 30; }
#loading i { display: block; width: 200px; height: 4px; background: #2a2440; border-radius: 2px; position: relative; overflow: hidden; }
#loading i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--gold); transition: width .2s; }

/* screens */
#ui { position: fixed; inset: 0; display: none; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#ui.show { display: flex; align-items: center; justify-content: center; padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); box-sizing: border-box; background: radial-gradient(ellipse at center, rgba(11,10,26,.55), rgba(11,10,26,.85)); }
#ui .box { width: min(640px, 100%); margin: auto; text-align: center; background: var(--bg); border: 1px solid rgba(241,201,91,.35); border-radius: 14px; padding: 18px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.6); box-sizing: border-box; }
#ui.title .box { background: rgba(11,10,26,.72); }
#ui h1 { margin: 0; color: var(--gold); font-size: clamp(28px, 6vw, 46px); letter-spacing: .14em; text-shadow: 0 0 18px rgba(241,201,91,.45); }
#ui h2 { margin: 4px 0 8px; color: var(--gold); font-size: clamp(20px, 4vw, 28px); }
#ui h2.red { color: var(--red); }
#ui .sub { margin: 2px 0 8px; color: var(--dim); font-style: italic; }
#ui .tag, #ui .lore { margin: 8px auto; max-width: 52ch; }
#ui .prayer { margin: 8px auto; max-width: 52ch; font-style: italic; color: var(--dim); font-size: 14px; }
#ui .kicker { margin: 0; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; color: var(--dim); }
#ui .stat { margin: 4px 0; color: var(--dim); }
#ui .best { margin: 8px 0 0; color: var(--gold); }
#ui .hint, #ui .credits, #ui .note { margin: 8px 0 0; font-size: 12px; color: var(--dim); }
#ui .who { align-self: center; color: var(--dim); font-size: 14px; }
.verse { margin: 12px auto; max-width: 54ch; padding: 12px 16px; border-left: 3px solid var(--gold); background: rgba(241,201,91,.07); text-align: left; border-radius: 4px; }
.verse p { margin: 0 0 6px; font-size: clamp(16px, 2.6vw, 19px); }
.verse cite { color: var(--gold); font-style: normal; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px; min-height: 44px; }
.row.small { gap: 8px; min-height: 0; }
.row.col { flex-direction: column; align-items: center; }
.btn { padding: 10px 18px; min-height: 44px; border-radius: 10px; border: 1px solid rgba(241,201,91,.45); background: rgba(241,201,91,.08); }
.btn:hover, .btn:focus-visible { background: rgba(241,201,91,.18); outline: none; }
.btn.primary { background: var(--gold); color: #1a1408; border-color: var(--gold); font-weight: bold; animation: rise .35s ease-out; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: wait; }
.row.small .btn { padding: 6px 12px; min-height: 36px; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* blessings */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 12px; text-align: left; border-radius: 10px; border: 1px solid rgba(241,201,91,.45); background: rgba(241,201,91,.06); }
.card:hover, .card:focus-visible { background: rgba(241,201,91,.16); outline: none; }
.card strong { color: var(--gold); }
.card span { font-size: 14px; }
.card cite { font-size: 12px; color: var(--dim); font-style: normal; }

/* account form and leaderboard */
.acct { display: flex; flex-direction: column; gap: 8px; max-width: 320px; margin: 10px auto 0; }
.acct input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(241,201,91,.4); background: #15122a; color: var(--ink); -webkit-user-select: text; user-select: text; }
.acct .err { min-height: 1.2em; margin: 0; color: var(--red); font-size: 14px; }
.board { margin: 8px auto; border-collapse: collapse; min-width: min(420px, 100%); font-size: 15px; }
.board td { padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; }
.board td:first-child { color: var(--dim); text-align: right; }
.board tr.me td { color: var(--gold); }
.board caption { padding: 10px; color: var(--dim); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; display: none; font-family: system-ui, sans-serif; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
#hud .left { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); }
#hud .hearts { color: #ff5d6e; font-size: 20px; letter-spacing: 1px; }
#hud .holy { width: 120px; height: 7px; margin-top: 4px; background: rgba(0,0,0,.6); border: 1px solid rgba(241,201,91,.6); border-radius: 4px; overflow: hidden; }
#hud .holy i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c99a2e, #fff2c0); transition: width .15s; }
#hud .holy.full { box-shadow: 0 0 10px var(--gold); animation: glow 1s infinite alternate; }
#hud .holylabel { font-size: 12px; color: var(--gold); }
@keyframes glow { to { box-shadow: 0 0 2px var(--gold); } }
#hud .mid { position: absolute; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); text-align: center; font-size: 13px; }
#hud .lvl { color: var(--gold); }
#hud .score { font-size: 18px; font-weight: bold; }
#hud .folk { color: var(--dim); font-size: 12px; }
#hud .pause { pointer-events: auto; position: absolute; top: max(6px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.4); font-size: 14px; }
#hud .boss { display: none; position: absolute; bottom: max(12px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(420px, 60vw); text-align: center; font-size: 13px; color: #ffb3a8; }
#hud .boss .bar { height: 8px; margin-top: 3px; background: rgba(0,0,0,.6); border: 1px solid #a33; border-radius: 4px; overflow: hidden; }
#hud .boss .bar i { display: block; height: 100%; background: linear-gradient(90deg, #8a1010, #e0605a); transition: width .2s; }
#hud .toast { position: absolute; top: 22%; left: 50%; transform: translate(-50%, -6px); opacity: 0; transition: opacity .25s, transform .25s; color: var(--gold); font: italic 18px Georgia, serif; white-space: nowrap; }
#hud .toast.on { opacity: 1; transform: translate(-50%, 0); }

/* touch buttons */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 11; display: none; }
.tb { pointer-events: auto; position: absolute; width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: rgba(20,16,40,.38); font: bold 13px system-ui, sans-serif; touch-action: none; }
.tb.on { background: rgba(241,201,91,.45); border-color: var(--gold); }
.tb.left { left: max(14px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); }
.tb.right { left: calc(max(14px, env(safe-area-inset-left)) + 76px); bottom: max(18px, env(safe-area-inset-bottom)); }
.tb.strike { right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 72px; height: 72px; }
.tb.jump { right: calc(max(14px, env(safe-area-inset-right)) + 84px); bottom: max(14px, env(safe-area-inset-bottom)); }
.tb.dash { right: calc(max(14px, env(safe-area-inset-right)) + 40px); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 82px); width: 54px; height: 54px; }
.tb.pray { right: calc(max(14px, env(safe-area-inset-right)) + 112px); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 76px); width: 54px; height: 54px; color: var(--gold); }
@media (max-height: 460px) { #ui.show { align-items: flex-start; } #ui .box { padding: 10px 16px; } #ui .prayer, #ui .tag { display: none; } #ui h2 { margin: 0 0 4px; font-size: 20px; } .verse { margin: 6px auto; padding: 8px 12px; } .verse p { font-size: 15px; } #ui .lore { font-size: 14px; margin: 4px auto; } .row { margin-top: 8px; } }
