* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e8c88a; font-family: system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 16px; color: #3b2410; font-weight: 800; font-size: 28px; text-shadow: 0 2px 0 rgba(255,255,255,.5); pointer-events: none; }
#hud .small { font-size: 14px; font-weight: 600; opacity: .8; }

#toast { position: fixed; top: 28%; left: 0; right: 0; text-align: center; font-size: clamp(32px, 8vw, 64px); font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.45); pointer-events: none; opacity: 0; transform: scale(.8); transition: opacity .4s, transform .4s; }
#toast.show { opacity: 1; transform: scale(1); }

.overlay { overflow-y: auto; position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: #3b2410; background: rgba(255, 238, 200, .78); backdrop-filter: blur(3px); }
.overlay[hidden], #hud[hidden], [hidden] { display: none !important; }
h1 { font-size: clamp(40px, 9vw, 72px); margin: 0; }
h2 { font-size: clamp(28px, 6vw, 48px); margin: 0; }
p { margin: 4px 0; font-size: 18px; line-height: 1.4; }
.big { font-size: 56px; font-weight: 800; }
.hint { font-size: 15px; opacity: .75; }
button { margin-top: 16px; padding: 14px 40px; font-size: 22px; font-weight: 800; color: #fff; background: #5a3517; border: 0; border-radius: 14px; box-shadow: 0 5px 0 #2e1a0a; cursor: pointer; }
button:active { transform: translateY(3px); box-shadow: 0 2px 0 #2e1a0a; }

@media (pointer: coarse) { .desktop { display: none; } }
@media (pointer: fine) { .touch { display: none; } }

#quote { max-width: 560px; margin: 14px 0 0; padding: 0 8px; }
#quote p { font-size: 20px; font-style: italic; margin: 0; }
#quote footer { margin-top: 6px; font-weight: 700; font-size: 16px; opacity: .85; }
.fine { font-size: 12px; opacity: .55; margin-top: 4px; }

button.ghost { background: transparent; color: #5a3517; border: 3px solid #5a3517; box-shadow: none; padding: 11px 26px; font-size: 18px; }
button.small { margin-top: 0; padding: 10px 18px; font-size: 15px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
#submitRow { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
#nameInput { font: inherit; font-size: 18px; padding: 10px 14px; width: 180px; border-radius: 12px; border: 3px solid #5a3517; background: #fff8e8; color: #3b2410; text-align: center; user-select: text; -webkit-user-select: text; }
#rankMsg { font-weight: 800; font-size: 20px; margin-top: 10px; }
#rankList { list-style: none; margin: 8px 0 0; padding: 0; width: min(420px, 92vw); text-align: left; counter-reset: pos; }
#rankList li { display: flex; gap: 10px; padding: 7px 12px; border-radius: 10px; font-size: 18px; counter-increment: pos; }
#rankList li::before { content: counter(pos) "º"; width: 2.2em; font-weight: 800; opacity: .6; }
#rankList li:nth-child(odd) { background: rgba(90, 53, 23, .08); }
#rankList li.me { background: #5a3517; color: #fff; }
#rankList .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rankList .s { font-weight: 800; }
