/* Menulis Huruf — game body styles (Sunny & Playful). Chrome lives in css/style.css. */

.trace-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: calc(var(--header-h) + 8px) 12px 14px;
  background:
    radial-gradient(700px 340px at 15% -5%, rgba(127, 208, 255, 0.35), transparent 60%),
    radial-gradient(700px 340px at 90% 0%, rgba(255, 197, 61, 0.30), transparent 55%),
    linear-gradient(180deg, #f2fbff 0%, #fff7e6 100%);
}

.trace-app__title {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  gap: 8px;
}

.btn-mode {
  padding: 8px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-pill);
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-chip);
  color: var(--ink);
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn-mode.active {
  background: var(--sun);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 rgba(46, 42, 69, 0.14);
}

.btn-mode:active { transform: scale(0.95); }

/* Letter picker */
.picker-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: min(92vw, 380px);
}

.nav-arrow {
  width: 42px;
  height: 42px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-chip);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  transition: transform 0.12s ease;
}

.nav-arrow:active { transform: scale(0.9); }

.letters-scroll {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 3px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.letters-scroll::-webkit-scrollbar { display: none; }

.btn-letter {
  width: 42px;
  height: 42px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  background-color: var(--paper);
  color: var(--ink);
  border: 3px solid rgba(46, 42, 69, 0.35);
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 0 rgba(46, 42, 69, 0.08);
  transition: transform 0.1s ease, background 0.1s ease;
}

.btn-letter.active {
  background-color: var(--sun);
  border-color: var(--ink);
  transform: scale(1.1);
}

/* Trace canvas card */
.trace-card {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 0 rgba(46, 42, 69, 0.12);
  padding: 6px;
}

#canvas-container {
  position: relative;
  width: 340px;
  height: 340px;
  max-width: 88vw;
  max-height: 88vw;
  touch-action: none;
  overflow: hidden;
}

@media (max-width: 420px) {
  #canvas-container {
    width: min(340px, 86vw);
    height: min(340px, 86vw);
  }
  #canvas-container canvas {
    width: 100%;
    height: 100%;
  }
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 20px;
}

/* Confetti pieces */
.confetti {
  position: absolute;
  border-radius: 3px;
  z-index: 5;
  pointer-events: none;
  animation: confettiFall 1.2s ease-out forwards;
}

@keyframes confettiFall {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--drift, 40px), 200px) rotate(560deg) scale(0.4); }
}

/* Message / praise */
#message {
  min-height: 34px;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-round);
  color: var(--leaf-deep);
  text-align: center;
  line-height: 1.3;
}

#message.praise {
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  color: var(--ink);
  animation: praisePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes praisePop {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.18); }
  100% { transform: scale(1); opacity: 1; }
}

/* Reset action */
.trace-actions {
  display: flex;
  justify-content: center;
}

.btn-reset {
  width: 64px;
  height: 64px;
  font-size: 1.9rem;
  line-height: 1;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--sun);
  box-shadow: var(--shadow-chip);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease;
}

.btn-reset:active { transform: rotate(-180deg) scale(0.92); }
