/* Reset / base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f4f6f8;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* The drawing surface. Overlaid SVG guide + Canvas ink, same box. */
#stage {
  position: relative;
  width: min(90vw, 90vh);
  height: min(90vw, 90vh);
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Drawing-surface rules: never scroll/zoom/select while tracing. */
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#guide,
#ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* The guide sits underneath; ink is drawn on top. */
#guide {
  z-index: 1;
}

#ink {
  z-index: 2;
}

/* ── HUD (letter label + stroke counter) ───────────────────────────────────── */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 16px 0;
  pointer-events: none;
}

#glyph-label {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}

#stroke-counter {
  font-size: 1rem;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.04em;
}

/* ── Nudge feedback pill ────────────────────────────────────────────────────── */

#feedback {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(30, 30, 46, 0.82);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

/* ── Celebration overlay ─────────────────────────────────────────────────────── */

#celebration[hidden] { display: none; }

#celebration:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#celebration {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.93);
  border-radius: inherit;
  backdrop-filter: blur(2px);
}

.cel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.cel-text {
  font-size: 2.4rem;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}

#next-btn {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 36px;
  border: none;
  border-radius: 999px;
  background: #4a90e2;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(74, 144, 226, 0.4);
}

#next-btn:active {
  background: #357abd;
  box-shadow: none;
}
