/* Monkey Jump – Layout: Spielfeld fest 2:3, zentriert, dekorativer Rand drumherum. */
:root { --green: #2f6b2b; --dark: #17301a; --yellow: #ffd92e; --brown: #7a4f2a; --text: #fff; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--dark); font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); -webkit-text-size-adjust: 100%; }
body {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120, 190, 90, .25), transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 217, 46, .12), transparent 50%),
    repeating-linear-gradient(135deg, #1b3a1e 0 18px, #173219 18px 36px);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#stage { position: relative; box-shadow: 0 0 0 4px rgba(0,0,0,.35), 0 20px 60px rgba(0,0,0,.6); background: #000; }
#game { display: block; touch-action: none; }

.icon-btn {
  position: absolute; top: 2.2%; width: 10%; max-width: 44px; aspect-ratio: 1; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; font-size: clamp(14px, 4.5vmin, 20px); cursor: pointer; z-index: 5; display: grid; place-items: center;
}
#btn-pause { right: 2.5%; top: 11%; }
#btn-mute { right: 14%; top: 11%; }
.icon-btn:active { transform: scale(.92); }

#overlay { position: absolute; inset: 0; z-index: 10; background: rgba(10, 30, 12, .82); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; }
.screen { width: 100%; height: 100%; padding: 6% 7% 9%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .5em; container-type: inline-size; }
.screen.scroll { justify-content: flex-start; overflow-y: auto; }
h1 { font-size: 11cqw; margin: 0 0 .1em; color: var(--yellow); text-shadow: 0 4px 0 rgba(0,0,0,.4); letter-spacing: -.02em; }
h2 { font-size: 9cqw; margin: 0; color: var(--yellow); text-shadow: 0 3px 0 rgba(0,0,0,.4); }
h3 { font-size: 5cqw; margin: .6em 0 .2em; color: #cfe9b8; }
p { margin: .2em 0; font-size: 4.2cqw; line-height: 1.35; }
.small { font-size: 3.4cqw; }
.muted { color: #b9cfae; }
.error { color: #ff9aa2; min-height: 1.2em; }
.new { color: var(--yellow); font-weight: 800; font-size: 5.5cqw; animation: pop .6s ease; }
.score-big { font-size: 16cqw; font-weight: 800; margin: 0; line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,.4); }
.hero { width: 32%; height: auto; margin: 2% 0; animation: bob 1.6s ease-in-out infinite; }
.tag { font-size: 4cqw; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6%); } }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

.btn {
  font: inherit; font-weight: 800; font-size: 4.4cqw; padding: .6em 1.4em; border-radius: 999px; border: 0; cursor: pointer;
  background: #3f8f3a; color: #fff; box-shadow: 0 4px 0 #245a22; margin: .25em;
}
.btn.primary { background: var(--yellow); color: #3b2a05; box-shadow: 0 4px 0 #b89a10; }
.btn.big { font-size: 6cqw; padding: .55em 1.6em; margin-top: .4em; }
.btn:active { transform: translateY(3px); box-shadow: none; }
.link { background: none; border: 0; color: #b9cfae; text-decoration: underline; font: inherit; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; justify-content: center; }

input[type=text] { font: inherit; font-size: 5cqw; padding: .5em .8em; border-radius: 12px; border: 2px solid #6fa35f; width: 80%; text-align: center; background: #fff; color: #222; }
.setting { display: flex; justify-content: space-between; align-items: center; width: 80%; font-size: 4.4cqw; padding: .4em 0; }
.setting input[type=range] { width: 55%; }
.setting input[type=checkbox] { width: 1.6em; height: 1.6em; }

.bar { width: 70%; height: 14px; background: rgba(0,0,0,.4); border-radius: 7px; overflow: hidden; margin: 1em 0 .4em; }
#load-bar { height: 100%; width: 0; background: var(--yellow); transition: width .15s; }

.top { list-style: none; padding: 0; margin: 0 0 .6em; width: 85%; counter-reset: rank; font-size: 3.8cqw; }
.top li { display: flex; justify-content: space-between; padding: .18em .6em; border-radius: 8px; counter-increment: rank; }
.top li::before { content: counter(rank) "."; width: 2em; text-align: left; color: #b9cfae; }
.top li span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top li:nth-child(odd) { background: rgba(255,255,255,.06); }
.top li.empty::before { content: ""; width: 0; }
.top li.me { background: rgba(255, 217, 46, .22); font-weight: 800; }

.howto { width: 100%; text-align: left; font-size: 3.6cqw; }
.howto ul { padding-left: 1.2em; margin: .2em 0; }
.howto ul.icons { list-style: none; padding: 0; }
.howto ul.icons li { display: flex; align-items: center; gap: .6em; padding: .15em 0; }
.howto ul.icons img { width: 12%; max-height: 3em; object-fit: contain; flex: none; }
.howto p { font-size: inherit; }

.footer { position: absolute; left: 0; right: 0; bottom: 2.5%; margin: 0; text-align: center; font-size: 3.2cqw; letter-spacing: .08em; text-transform: uppercase; color: #9fb892; opacity: .85; pointer-events: none; }
#overlay { container-type: inline-size; }

.top li[data-user] { cursor: pointer; }
.top li[data-user]:hover { background: rgba(255,255,255,.14); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2%; width: 100%; margin: .3em 0; }
.stat { background: rgba(255,255,255,.08); border-radius: 10px; padding: .5em .2em; display: flex; flex-direction: column; align-items: center; }
.stat b { font-size: 4.6cqw; color: var(--yellow); line-height: 1.1; white-space: nowrap; }
.stat span { font-size: 2.9cqw; color: #b9cfae; }
.recent { list-style: none; padding: 0; margin: 0 0 .6em; width: 100%; font-size: 3.3cqw; }
.recent li { display: grid; grid-template-columns: auto auto 1fr; gap: .6em; align-items: baseline; padding: .22em .5em; border-radius: 8px; text-align: left; }
.recent li:nth-child(odd) { background: rgba(255,255,255,.06); }
.recent .when { color: #b9cfae; white-space: nowrap; }
.recent b { color: var(--yellow); }
.recent .det { color: #d9e8cf; font-size: 2.9cqw; text-align: right; }

/* Top 3: Gold, Silber, Bronze */
.top li[data-user]:nth-child(-n+3) { font-weight: 800; }
.top li[data-user]:nth-child(-n+3)::before { font-size: 1.15em; width: 1.7em; }
.top li[data-user]:nth-child(1) { background: linear-gradient(90deg, rgba(255,205,60,.38), rgba(255,205,60,.1)); }
.top li[data-user]:nth-child(1)::before { content: "🥇"; }
/* Krone für Platz 1 */
.top li[data-user]:nth-child(1) span::after { content: " 👑"; font-size: 1.05em; }
.top li[data-user]:nth-child(2) { background: linear-gradient(90deg, rgba(220,220,230,.32), rgba(220,220,230,.08)); }
.top li[data-user]:nth-child(2)::before { content: "🥈"; }
.top li[data-user]:nth-child(3) { background: linear-gradient(90deg, rgba(205,127,50,.38), rgba(205,127,50,.1)); }
.top li[data-user]:nth-child(3)::before { content: "🥉"; }
.top li.me:nth-child(-n+3) { outline: 2px solid rgba(255,217,46,.7); }
