:root {
  --bg1: #fff8e1;
  --bg2: #e1f5fe;
  --card: #ffffff;
  --ink: #3e2f5b;
  --muted: #7a6f8f;
  --accent: #7e57c2;
  --ok: #43a047;
  --bad: #ef6c00;
  --line: #e3dcef;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
#app { max-width: 720px; margin: 0 auto; padding: 14px 16px 28px; }
.hidden { display: none !important; }

/* Start */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 14px; }
.top h1 { font-size: 1.7rem; margin: 0; }
.wave { display: inline-block; animation: wave 2s infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } }
.stars { background: #fff3c4; border: 2px solid #f6d365; border-radius: 999px; padding: 8px 16px; font-size: 1.3rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tile {
  background: var(--card); border: 3px solid var(--line); border-radius: 26px; padding: 16px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 5px 0 var(--line); min-height: 150px;
}
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.tile .ico { font-size: 3.6rem; line-height: 1; }
.tile .lbl { font-size: 1rem; font-weight: 700; text-align: center; }
.tile .lvl { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.tile .lvl i { width: 10px; height: 10px; border-radius: 50%; background: #e6e0ef; display: block; }
.tile .lvl i.on { background: #ffb300; }
.ver { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 22px; }
.ver a { color: var(--muted); }

/* Aufgabe */
.taskbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.taskbar h2 { margin: 0; font-size: 1.3rem; }
.round-btn { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--line); background: var(--card); font-size: 1.7rem; box-shadow: 0 4px 0 var(--line); }
.round-btn.say { background: #e3f2fd; border-color: #90caf9; box-shadow: 0 4px 0 #90caf9; }
.round-btn.say.playing { animation: pulse 0.9s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.dots { display: flex; gap: 8px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; background: #e6e0ef; display: block; }
.dots i.now { background: #ffd54f; }
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }

.show { background: var(--card); border-radius: 26px; border: 3px solid var(--line); min-height: 110px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 14px; margin-bottom: 14px; text-align: center; }
.show:empty { display: none; }
.show .emoji { font-size: 3.4rem; line-height: 1.25; white-space: pre-line; word-break: break-all; }
.show .label { color: var(--muted); font-size: 1rem; margin-top: 4px; }
.show .big { font-size: 5rem; font-weight: 800; letter-spacing: 0.08em; line-height: 1; }
.show .seq { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.show .seq span { font-size: 2.6rem; min-width: 56px; height: 64px; border-radius: 14px; background: #f6f2fb; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.show .seq span.q { background: #fff3c4; border: 3px dashed #f6b93b; color: #f39c12; }
.show .calc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 2.6rem; }
.show .calc .op { font-size: 2rem; }
.show .calc .gone { opacity: 0.35; text-decoration: line-through; }

.opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.opts.n3 > :last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 6px); }
.opt {
  background: var(--card); border: 4px solid var(--line); border-radius: 24px; min-height: 120px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 5px 0 var(--line);
}
.opt:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.opt .i { font-size: 3.4rem; line-height: 1.1; }
.opt .i.small { font-size: 2rem; word-break: break-all; }
.opt .t { font-size: 3.4rem; font-weight: 800; line-height: 1; }
.opt .l { font-size: 0.9rem; color: var(--muted); }
.opt .d { display: grid; grid-template-columns: repeat(5, 12px); gap: 4px; margin-top: 4px; }
.opt .d b { width: 12px; height: 12px; border-radius: 50%; background: #7e57c2; display: block; }
.opt .d.only { grid-template-columns: repeat(3, 22px); gap: 8px; }
.opt .d.only b { width: 22px; height: 22px; }
.opt .c { width: 84px; height: 84px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, 0.15); }
.opt svg { width: 90px; height: 90px; }
.opt .scene { display: grid; grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(3, 38px); font-size: 1.9rem; align-items: center; justify-items: center; }
.opt .scene.row { grid-template-rows: 44px; }
.opt.wrong { opacity: 0.35; border-color: #ffcc80; pointer-events: none; }
.opt.right { border-color: var(--ok); background: #e8f5e9; box-shadow: 0 5px 0 #a5d6a7; animation: pop 0.4s; }
@keyframes pop { 50% { transform: scale(1.07); } }
.opts.locked .opt { pointer-events: none; }

.feedback { margin-top: 14px; background: var(--card); border-radius: 22px; border: 3px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.fb-text { flex: 1; font-size: 1.15rem; font-weight: 700; }
.next { width: 76px; height: 76px; border-radius: 50%; border: none; background: var(--ok); font-size: 2.2rem; box-shadow: 0 5px 0 #2e7d32; }
.dunno { display: block; margin: 18px auto 0; background: transparent; border: 2px dashed #cfc4e2; border-radius: 999px; padding: 10px 18px; color: var(--muted); font-size: 1rem; }

/* Fertig */
.done-box { text-align: center; padding-top: 30px; }
.done-big { font-size: 6rem; animation: pop 0.8s infinite; }
.done-box h2 { font-size: 2rem; margin: 10px 0; }
.done-stars { font-size: 2.6rem; margin: 6px 0; }
.sticker-new { font-size: 1.2rem; font-weight: 700; margin: 12px auto; background: #fff3c4; border-radius: 22px; padding: 12px; max-width: 320px; }
.sticker-new b { display: block; font-size: 5rem; }
.done-btns { display: flex; gap: 20px; justify-content: center; margin-top: 18px; }
.big-btn { width: 100px; height: 100px; border-radius: 50%; border: 4px solid var(--line); background: var(--card); font-size: 3rem; box-shadow: 0 5px 0 var(--line); }

/* Album */
.album { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.album span { font-size: 3rem; background: var(--card); border-radius: 18px; border: 3px solid var(--line); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.album span.empty { color: #d6cfe3; font-size: 2rem; }
.album-next { text-align: center; color: var(--muted); font-size: 1.1rem; }

/* Konfetti */
.confetti { position: fixed; top: -40px; font-size: 2rem; pointer-events: none; animation: fall 1.6s ease-in forwards; z-index: 50; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: 0.6; } }

@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .opt { min-height: 150px; }
}

.qtext { text-align: center; color: var(--muted); font-size: 1rem; margin: 0 4px 10px; min-height: 1.4em; }

.install-btn { display: block; width: 100%; margin: 0 0 14px; padding: 14px; border-radius: 18px; border: 3px solid #b39ddb; background: #ede7f6; font-size: 1.1rem; font-weight: 700; box-shadow: 0 4px 0 #b39ddb; }
.install-btn[hidden] { display: none; }
