* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body { height:100%; overflow:hidden; }
body {
  font-family: -apple-system, "Comic Sans MS", "Chalkboard SE", sans-serif;
  background: linear-gradient(160deg,#4FC3F7 0%,#7E57C2 60%,#AB47BC 100%);
  color:#fff; user-select:none; -webkit-user-select:none;
  touch-action: manipulation;
}
#app { height:100%; display:flex; flex-direction:column; padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }

.screen { display:none; flex:1; flex-direction:column; overflow-y:auto; padding:20px; }
.screen.active { display:flex; }

h1 { font-size:2.2rem; text-align:center; margin:10px 0 4px; text-shadow:0 3px 0 rgba(0,0,0,.2); }
h2 { font-size:1.5rem; text-align:center; margin:6px 0 16px; text-shadow:0 2px 0 rgba(0,0,0,.2); }
.subtitle { text-align:center; font-size:1.05rem; opacity:.9; margin-bottom:18px; }

.card {
  background:rgba(255,255,255,.15); border-radius:24px; padding:18px;
  backdrop-filter: blur(6px); margin:0 auto 16px; max-width:560px; width:100%;
}

.btn {
  display:block; width:100%; border:none; border-radius:20px; padding:18px;
  font-size:1.3rem; font-weight:bold; color:#fff; margin:10px 0; cursor:pointer;
  box-shadow:0 5px 0 rgba(0,0,0,.25); transition:transform .08s, box-shadow .08s;
  font-family:inherit;
}
.btn:active { transform:translateY(4px); box-shadow:0 1px 0 rgba(0,0,0,.25); }
.btn.small { padding:12px; font-size:1.05rem; border-radius:16px; }
.btn.pink { background:#EC407A; } .btn.green { background:#66BB6A; }
.btn.blue { background:#42A5F5; } .btn.orange { background:#FFA726; }
.btn.purple { background:#AB47BC; } .btn.teal { background:#26A69A; }
.btn.gray { background:#78909C; }

.grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; max-width:560px; margin:0 auto; width:100%; }
.grid .btn { margin:0; }

.avatar-row { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin:12px 0; }
.avatar {
  width:64px; height:64px; border-radius:50%; font-size:2rem; display:flex;
  align-items:center; justify-content:center; background:rgba(255,255,255,.25);
  border:3px solid transparent; cursor:pointer;
}
.avatar.selected { border-color:#FFEB3B; background:rgba(255,255,255,.45); }

input.name-input {
  width:100%; padding:16px; border-radius:16px; border:none; font-size:1.2rem;
  text-align:center; font-family:inherit; margin:8px 0;
}

/* Quiz */
.question-card {
  background:#fff; color:#333; border-radius:24px; padding:24px; text-align:center;
  margin:0 auto 16px; max-width:560px; width:100%; box-shadow:0 8px 20px rgba(0,0,0,.25);
}
.question-text { font-size:2.4rem; font-weight:bold; margin-bottom:8px; word-break:break-word; }
.question-sub { font-size:1.1rem; color:#666; margin-bottom:12px; }
.choices { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:14px; }
.choice {
  padding:20px 10px; border-radius:18px; border:none; font-size:1.6rem; font-weight:bold;
  background:#E1F5FE; color:#0277BD; cursor:pointer; font-family:inherit;
  box-shadow:0 4px 0 #B3E5FC; transition:transform .08s;
}
.choice:active { transform:translateY(3px); box-shadow:0 1px 0 #B3E5FC; }
.choice.correct { background:#C8E6C9; color:#2E7D32; box-shadow:0 4px 0 #A5D6A7; }
.choice.wrong { background:#FFCDD2; color:#C62828; box-shadow:0 4px 0 #EF9A9A; }

.progress-bar { background:rgba(255,255,255,.3); border-radius:12px; height:20px; overflow:hidden; margin:0 auto 14px; max-width:560px; }
.progress-fill { height:100%; background:#FFEB3B; border-radius:12px; transition:width .3s; display:flex; align-items:center; justify-content:center; font-size:.8rem; color:#795548; font-weight:bold; min-width:34px; }

.feedback { text-align:center; font-size:1.6rem; min-height:44px; margin:6px 0; font-weight:bold; }

/* Typing */
.typing-target {
  background:#fff; color:#333; border-radius:18px; padding:18px; font-size:1.5rem;
  text-align:center; font-family:Menlo,monospace; margin-bottom:12px; letter-spacing:1px;
}
.typing-target .done { color:#2E7D32; }
.typing-target .cursor { border-bottom:3px solid #EC407A; }
.typing-input {
  width:100%; padding:16px; border-radius:16px; border:none; font-size:1.4rem;
  text-align:center; font-family:Menlo,monospace;
}
.kb { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; max-width:240px; margin:6px auto; }
.key {
  aspect-ratio:1/1; padding:0; border-radius:12px; background:rgba(255,255,255,.9); color:#333;
  font-size:1.3rem; font-weight:bold; border:none; font-family:Menlo,monospace; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.key.wide { grid-column:span 2; aspect-ratio:auto; padding:10px 0; font-size:1.2rem; }
.key:nth-child(n+11) { font-size:.95rem; }

/* Stars / rewards */
.stars { text-align:center; font-size:1.4rem; margin:8px 0; }
.big-star { font-size:5rem; text-align:center; margin:20px 0; animation:pop .5s; }
@keyframes pop { 0%{transform:scale(0)} 70%{transform:scale(1.3)} 100%{transform:scale(1)} }

.top-bar { display:flex; justify-content:space-between; align-items:center; max-width:560px; margin:0 auto 10px; width:100%; }
.top-bar .btn { width:auto; margin:0; padding:10px 18px; font-size:1rem; }
.score-pill { background:rgba(255,255,255,.25); border-radius:20px; padding:10px 18px; font-weight:bold; font-size:1.1rem; }

.profile-chip { display:flex; align-items:center; gap:10px; background:rgba(255,255,255,.2); border-radius:20px; padding:8px 16px; margin:0 auto 12px; width:fit-content; font-size:1.1rem; font-weight:bold; }