/* Megaripple Overdrive – Styles (nur System-Schriften, keine externen Einbindungen) */
:root {
  --bg: #0b0820;
  --bg2: #15103a;
  --panel: rgba(28, 22, 70, .86);
  --line: rgba(255, 255, 255, .12);
  --text: #f4f1ff;
  --muted: #a9a2d6;
  --accent: #35d6ff;
  --accent2: #ff4d6d;
  --gold: #ffd23f;
  --ok: #6dff7a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #05030f; color: var(--text);
  font-family: var(--font); overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app {
  position: relative; height: 100%; height: 100dvh; max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: radial-gradient(120% 80% at 50% 0%, #241a63 0%, var(--bg) 55%, #05030f 100%);
  padding-top: var(--safe-top); padding-bottom: var(--safe-bot);
  overflow: hidden;
}

/* ---------- HUD ---------- */
#hud { padding: 8px 10px 4px; flex: 0 0 auto; }
.hud-row { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); font-size: 15px; font-weight: 700; flex: 0 0 auto;
}
#wavesBox { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#wavePips { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
#wavePips i {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent);
  box-shadow: 0 0 6px rgba(53,214,255,.6); display: block;
}
#wavePips i.used { border-color: rgba(255,255,255,.15); box-shadow: none; }
#wavesNum { font-weight: 800; font-size: 20px; color: var(--accent); min-width: 24px; text-align: right; }
#timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px;
  padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.06); min-width: 52px; text-align: center;
}
#timer.warn { color: var(--accent2); animation: pulse .6s infinite alternate; }

#goalList { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
#goalList li {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
  padding: 5px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
#goalList li .chk {
  width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--muted); flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px; line-height: 1;
}
#goalList li .txt { flex: 1; }
#goalList li .prog { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
#goalList li .crit { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent2); border: 1px solid var(--accent2); border-radius: 6px; padding: 1px 5px; }
#goalList li.done { background: rgba(109,255,122,.12); border-color: rgba(109,255,122,.4); }
#goalList li.done .chk { border-color: var(--ok); background: var(--ok); color: #082; }
#goalList li.failed { background: rgba(255,77,109,.15); border-color: rgba(255,77,109,.5); }
#goalList li.flash { animation: flash .7s; }
#mutList { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#mutList:empty { display: none; }
.mut-chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: rgba(255,210,63,.12); border: 1px solid rgba(255,210,63,.45); color: #ffe7a0; }
.mc-muts { font-size: 15px; letter-spacing: 2px; min-height: 18px; }
#intro .muts { display: block; margin-top: 10px; font-size: 15px; font-weight: 700; color: #ffe7a0; line-height: 1.5; letter-spacing: 0; }
.tier-ico { display: inline-grid; place-items: center; vertical-align: middle; border-radius: 50%; margin-left: 2px;
  background: radial-gradient(circle at 35% 30%, #fff, #b9b2ff 55%, #5b4fc4); box-shadow: inset 0 0 0 2px rgba(255,255,255,.45), 0 0 6px rgba(160,150,255,.6); }
.tier-ico b { font-size: 9px; font-weight: 900; color: #1a1240; font-style: normal; line-height: 1; }
.tier-ico.t1 { width: 12px; height: 12px; } .tier-ico.t2 { width: 15px; height: 15px; }
.tier-ico.t3 { width: 18px; height: 18px; } .tier-ico.t4 { width: 22px; height: 22px; }
.tier-ico.t3 b, .tier-ico.t4 b { font-size: 11px; }
#scrHelp { background: rgba(8, 6, 24, .96); }
.help-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.help-item { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.help-item h3 { margin: 0 0 6px; font-size: 16px; color: var(--accent); }
.help-item p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: #e6e2ff; }
.help-item p b { color: var(--gold); }
.help-vis { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 44px; font-weight: 900; font-size: 18px; }
.help-vis svg { width: 200px; height: 66px; }
.help-vis .grp { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 10px; background: rgba(255,255,255,.05); }
.help-vis .ok { color: var(--ok); } .help-vis .no { color: var(--accent2); }
.hdot { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.6);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 0 8px var(--c); background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.75), var(--c) 55%, rgba(0,0,0,.35) 120%), var(--c); }
.hdot.t1 { width: 16px; height: 16px; } .hdot.t2 { width: 22px; height: 22px; } .hdot.t3 { width: 29px; height: 29px; } .hdot.t4 { width: 37px; height: 37px; font-size: 15px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; box-shadow: 0 0 6px currentColor; }

/* ---------- Stage ---------- */
#stage { position: relative; flex: 1 1 auto; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#tutBox {
  flex: 0 0 auto; margin: 4px 10px 2px; padding: 10px 14px; min-height: 84px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  text-align: center; font-size: 14px; font-weight: 600; line-height: 1.35;
  animation: pop .3s;
}
#tutBox p { margin: 0; }
#tutBox .btn { margin-top: 8px; }
#intro {
  position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-weight: 800; font-size: 20px;
  letter-spacing: .04em; text-shadow: 0 2px 12px rgba(0,0,0,.8); pointer-events: none; animation: introFade 3s forwards; padding: 0 16px;
}

/* ---------- Footer ---------- */
#bottomBar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 6px 12px 10px; min-height: 54px; }
.score-wrap { display: flex; flex-direction: column; }
#scoreLive { font-size: 28px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
#scoreLive.bump { animation: bump .25s; }
#chainLive { flex: 1; font-weight: 900; color: var(--gold); font-size: 18px; text-align: center; text-shadow: 0 0 12px rgba(255,210,63,.6); }
#chainLive.show { animation: chainPop .9s forwards; }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0; padding: calc(16px + var(--safe-top)) 18px calc(16px + var(--safe-bot));
  display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 10; overflow-y: auto;
  animation: fadeIn .25s;
}
.screen.dim { background: rgba(5, 3, 15, .72); justify-content: center; backdrop-filter: blur(4px); }
#scrMenu { justify-content: space-between; background: linear-gradient(180deg, rgba(11,8,32,.35), rgba(11,8,32,.15) 40%, rgba(11,8,32,.75)); }
#scrResult, #scrBoard { background: rgba(8, 6, 24, .94); }

.menu-top { width: 100%; display: flex; justify-content: space-between; }
.chip-row { display: flex; gap: 8px; }
.install-txt { text-align: left; line-height: 1.5; color: #e6e2ff; }
.install-chip { background: rgba(53,214,255,.16); border-color: rgba(53,214,255,.5); }
.stage-lbl { font-weight: 900; font-size: 13px; padding: 7px 8px; border-radius: 10px; background: rgba(255,210,63,.14); color: var(--gold); white-space: nowrap; }
.stage-lbl:empty { display: none; }
.stage-card .big-score { font-size: 52px; }
.stg-total { margin: 4px 0 12px; font-weight: 800; color: var(--gold); }
.mc-levels { font-size: 11px; font-weight: 800; color: var(--gold); letter-spacing: .04em; }
.fs-btn { display: grid; place-items: center; padding: 7px 11px; }
.fs-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fs-ico .fs-out { display: none; }
.is-fs .fs-ico .fs-in { display: none; }
.is-fs .fs-ico .fs-out { display: inline; }
#toast {
  position: absolute; left: 50%; bottom: calc(24px + var(--safe-bot)); transform: translateX(-50%); z-index: 50;
  width: min(92%, 380px); padding: 12px 16px; border-radius: 14px; background: rgba(28,22,70,.96); border: 1px solid var(--accent);
  font-size: 14px; font-weight: 600; line-height: 1.4; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: pop .25s;
}
.snd { position: relative; }
.snd.off { opacity: .6; }
.snd-music.off::after {
  content: ''; position: absolute; left: 22%; right: 22%; top: 50%; height: 3px; border-radius: 2px;
  background: #ff4d6d; transform: rotate(-45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.4);
}
@media (max-width: 430px) {
  #wavesBox .lbl { display: none; }
  #wavePips i { width: 9px; height: 9px; }
  .hud-row { gap: 6px; }
}
/* Viele Wellen auf schmalen Handys: nur eine Zeile Kreise, Zahl zeigt den Rest */
@media (max-width: 430px) {
  #wavePips { flex-wrap: nowrap; overflow: hidden; max-height: 12px; }
}
.icon-btn.mini { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; padding: 0; }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,.07); border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.logo { text-align: center; margin-top: 1vh; }
.logo h1 { margin: 0; line-height: 0; font-size: 0; }
.logo h1 img {
  width: min(100%, 420px); height: auto; pointer-events: none;
  filter: drop-shadow(0 0 22px rgba(53,214,255,.25)); animation: logoIn .7s ease-out both;
}
.tagline { color: var(--muted); margin: 10px 0 0; letter-spacing: .2em; text-transform: uppercase; font-size: 12px; font-weight: 700; }

.mode-cards { width: 100%; display: flex; gap: 8px; }
.mode-card {
  flex: 1; border: 2px solid var(--line); background: var(--panel); border-radius: 16px; padding: 10px 8px;
  text-align: center; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .15s;
}
.mode-card .mc-name { font-weight: 800; font-size: 14px; }
.mode-card .mc-stars { color: var(--gold); font-size: 12px; letter-spacing: 2px; }
.mode-card .mc-rank { font-size: 20px; font-weight: 900; }
.mode-card .mc-small { font-size: 11px; color: var(--muted); }
.mode-card.sel { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 6px 24px rgba(53,214,255,.25); }

.menu-bottom { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
#streakLine { margin: 0; font-weight: 700; font-size: 14px; }
.menu-links { display: flex; gap: 8px; align-items: center; }
.link { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; padding: 6px; }
.dot-sep { color: var(--muted); }
.noname-hint {
  border: 1px solid rgba(255,210,63,.5); background: rgba(255,210,63,.1); color: #ffe7a0; border-radius: 12px;
  padding: 8px 12px; font-size: 13px; line-height: 1.35; max-width: 360px;
}
.noname-hint b { color: var(--gold); white-space: nowrap; }
.legal { display: flex; gap: 6px; justify-content: center; font-size: 12px; margin-top: 2px; }
.legal a { color: var(--muted); text-decoration: none; padding: 4px 2px; }
.legal span { color: rgba(255,255,255,.25); }
.offline { margin: 0; color: var(--accent2); font-size: 12px; }

.btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.08); border-radius: 14px;
  padding: 12px 18px; font-size: 16px; font-weight: 800; min-height: 48px; text-align: center; text-decoration: none; color: var(--text);
  transition: transform .08s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6c5bff); border: none; color: #fff; box-shadow: 0 6px 24px rgba(53,214,255,.35); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #ff9f1c); color: #2a1600; border: none; box-shadow: 0 6px 20px rgba(255,190,40,.35); }
.btn.big { width: 100%; font-size: 22px; padding: 16px; letter-spacing: .04em; }
.btn.small { padding: 8px 14px; min-height: 40px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; }
.play-col { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.endless-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 8px 14px; font-size: 15px;
  background: rgba(255,210,63,.1); border-color: rgba(255,210,63,.45); color: #ffe7a0; }
.endless-btn small { font-size: 12px; font-weight: 700; color: var(--muted); }
#btnPlay { max-width: 360px; animation: breathe 2.2s ease-in-out infinite; }

.card { width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 18px; text-align: center; }
.card h2 { margin: 0 0 4px; font-size: 22px; }
.small-card { max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.sub { color: var(--muted); margin: 0; font-size: 14px; }
.big-score { font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 6px 0; background: linear-gradient(180deg, #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.share-btn { margin: 2px auto 8px; display: inline-flex; gap: 6px; align-items: center; }
.pb { color: var(--gold); font-weight: 800; margin: 0 0 8px; animation: pulse .7s infinite alternate; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0; }
.breakdown td { padding: 4px 2px; border-bottom: 1px solid var(--line); }
.breakdown td:last-child { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.breakdown tr.zero td { color: var(--muted); }
.res-goals { list-style: none; padding: 0; margin: 10px 0; text-align: left; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.res-goals li.ok::before { content: "✓ "; color: var(--ok); font-weight: 900; }
.res-goals li.no::before { content: "✗ "; color: var(--accent2); font-weight: 900; }
.res-rank { font-weight: 700; font-size: 15px; line-height: 1.5; }
.res-rank .gap { color: var(--gold); }
.btn-col { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
#inpName {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35);
  color: var(--text); font-size: 18px; font-family: inherit; text-align: center; outline: none; -webkit-user-select: text; user-select: text;
}
#inpName:focus { border-color: var(--accent); }

/* ---------- Rangliste ---------- */
.board-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.board-head h2 { margin: 0; }
.board-head .icon-btn { font-size: 26px; line-height: 1; }
.board-head span { width: 40px; }
.tabs { width: 100%; display: flex; background: rgba(255,255,255,.06); border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; border: none; background: none; padding: 9px; border-radius: 9px; font-weight: 800; color: var(--muted); }
.tabs button.on { background: var(--accent); color: #04122a; }
.board-me { width: 100%; text-align: center; font-weight: 700; }
.board-me .gap { color: var(--gold); display: block; font-size: 14px; }
.board-list { list-style: none; padding: 0; margin: 0; width: 100%; display: flex; flex-direction: column; gap: 4px; }
.board-list li { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-weight: 600; }
.board-list li .r { width: 32px; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-list li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li .s { font-weight: 900; font-variant-numeric: tabular-nums; }
.board-list li.top1 .r { color: var(--gold); }
.board-list li.top2 .r { color: #d7e2ff; }
.board-list li.top3 .r { color: #ff9f6b; }
.board-list li.me { background: rgba(53,214,255,.18); border: 1px solid var(--accent); }
.board-list .empty { justify-content: center; color: var(--muted); }

/* ---------- Promo ---------- */
.promo { background: rgba(5, 3, 15, .96); justify-content: center; z-index: 20; }
.promo-label { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .2em; font-size: 12px; font-weight: 700; }
.promo-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); text-align: center; animation: pop .35s;
}
.promo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; background: #1b1446; }
.promo-card h3 { margin: 4px 0 0; font-size: 24px; }
.promo-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
#btnPromoSkip { min-width: 160px; }

/* ---------- Hochformat-Hinweis ---------- */
#rotate { display: none; position: fixed; inset: 0; z-index: 100; background: #05030f; place-items: center; text-align: center; font-size: 42px; }
#rotate p { font-size: 17px; font-weight: 700; padding: 0 30px; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  #rotate { display: grid; }
}

/* ---------- Animationen ---------- */
@keyframes logoIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { from { opacity: 1; } to { opacity: .55; } }
@keyframes flash { 0% { background: rgba(109,255,122,.6); transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes bump { 50% { transform: scale(1.18); color: var(--gold); } }
@keyframes chainPop { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1.25); opacity: 1; } 70% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.035); } }
@keyframes introFade { 0% { opacity: 0; transform: scale(.9); } 15% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

@media (max-height: 640px) {
  #goalList li { padding: 3px 8px; font-size: 13px; }
  .big-score { font-size: 48px; }
  .logo h1 img { width: min(100%, 320px); }
}

/* Wellen-Anzeige blinkt, wenn ein Kristall eine Welle schenkt */
#wavesBox.flash-waves { animation: wavesFlash 1.4s ease-out; border-radius: 10px; }
@keyframes wavesFlash { 0%, 40% { background: rgba(127,233,255,.35); box-shadow: 0 0 0 3px rgba(127,233,255,.6); } 100% { background: transparent; box-shadow: none; } }

/* Kompakt für kleine Handys (wenig Höhe): mehr Platz fürs Spielfeld, Menü passt auf einen Bildschirm */
@media (max-height: 720px) {
  #hud { padding: 4px 8px 2px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn.mini { width: 30px; height: 30px; font-size: 13px; }
  #timer { font-size: 15px; padding: 5px 7px; min-width: 42px; }
  .stage-lbl { font-size: 11px; padding: 5px 6px; }
  #goalList { margin-top: 4px; gap: 2px; }
  #goalList li { padding: 2px 8px; font-size: 12px; border-radius: 8px; }
  #goalList li .chk { width: 14px; height: 14px; font-size: 10px; border-radius: 4px; }
  #goalList li .prog { font-size: 11px; }
  #mutList { margin-top: 3px; gap: 4px; }
  .mut-chip { font-size: 10px; padding: 2px 7px; }
  #bottomBar { min-height: 38px; padding: 2px 10px 6px; }
  #scoreLive { font-size: 21px; }
  #tutBox { min-height: 64px; padding: 6px 10px; font-size: 13px; }
  #scrMenu { gap: 8px; padding-top: calc(10px + var(--safe-top)); padding-bottom: calc(10px + var(--safe-bot)); }
  .logo h1 img { width: min(100%, 250px); }
  .tagline { margin-top: 4px; font-size: 11px; }
  .mode-card { padding: 6px 4px; gap: 2px; }
  .mode-card .mc-rank { font-size: 16px; }
  .btn.big { font-size: 19px; padding: 12px; }
  .endless-btn { min-height: 38px; padding: 6px 12px; }
  .menu-bottom { gap: 3px; }
  #streakLine { font-size: 13px; }
  .link { padding: 3px; font-size: 13px; }
}
