* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, sans-serif;
  background: #1a1a2e;
  color: #eee;
}

/* Screens */
.screen {
  display: none;
  height: 100%;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

/* ---- Menu ---- */
#screen-menu {
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 24px;
  padding-top: min(40vw, 30vh);
  background: url('bg.webp') center top / 100% auto no-repeat #051131;
  position: relative;
}
#screen-menu::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 46vw, #051131 54vw);
  pointer-events: none;
}

#screen-menu > * {
  position: relative;
  z-index: 1;
}

.app-title {
  font-size: 48px;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  background: linear-gradient(135deg, #E58268, #7544E4, #8FF8FA, #49A3ED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
}

.category-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 300px;
}

.category-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: none;
  border-radius: 16px;
  background: rgba(22, 33, 62, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #eee;
  font-size: 20px;
  cursor: pointer;
  -webkit-appearance: none;
}
.category-btn:active {
  transform: scale(0.96);
}
.category-icon {
  font-size: 28px;
  font-weight: 700;
  width: 60px;
  text-align: center;
}
.category-label {
  font-weight: 600;
}

/* ---- Practice ---- */
#screen-practice {
  padding: env(safe-area-inset-top, 8px) 0 env(safe-area-inset-bottom, 8px);
}

.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  flex-shrink: 0;
}

.nav-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 12px;
  background: #16213e;
  color: #eee;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-appearance: none;
}
.nav-btn:active {
  transform: scale(0.9);
}
.nav-arrows {
  display: flex;
  gap: 8px;
}

.char-label {
  font-size: 24px;
  font-weight: 700;
}

.practice-area {
  flex: 1;
  position: relative;
  margin: 8px;
  border-radius: 20px;
  background: #0f3460;
  overflow: hidden;
}

#stroke-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stroke-counter {
  text-align: center;
  padding: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #aaa;
  flex-shrink: 0;
}

/* ---- Celebration ---- */
.celebration {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.92);
  z-index: 100;
  gap: 16px;
}
.celebration.hidden {
  display: none;
}
.celebration-emoji {
  font-size: 80px;
  animation: pop 0.4s ease-out;
}
.celebration-text {
  font-size: 32px;
  font-weight: 800;
}

@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
