/* ══════════════════════════════════════════════════════════
   tracing.css — Tracing game styles
   Unified design: lavender background, coral top bar
   ══════════════════════════════════════════════════════════ */

:root {
  --canvas-bg: #FFFEF5;
  --tab-lines:     #4CAF50;
  --tab-numbers:   #FFC107;
  --tab-alphabets: #2196F3;
  --tab-shapes:    #E91E63;
  --radius: 16px;
}

body {
  background: var(--sky-bg);
  color: var(--sky-text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  min-height: 100vh;
}

/* ══ TOP BAR ══ */
#topBar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 48px;
  background: var(--sky-surface);
  border-bottom: 1px solid var(--sky-border);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

#homeBtn {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}
#homeBtn:hover { background: rgba(255,255,255,0.3); }

#tabs {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: flex-start;
  overflow: hidden;
}

.tab-btn {
  border: none;
  border-radius: 20px;
  padding: 7px 12px;
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: white;
  cursor: pointer;
  opacity: 0.75;
  transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.tab-btn.active { opacity: 1; transform: scale(1.06); box-shadow: 0 3px 10px rgba(0,0,0,0.3); }
.tab-btn[data-cat="lines"]     { background: var(--tab-lines); }
.tab-btn[data-cat="numbers"]   { background: var(--tab-numbers); color: #333; }
.tab-btn[data-cat="alphabets"] { background: var(--tab-alphabets); }
.tab-btn[data-cat="shapes"]    { background: var(--tab-shapes); }

#navBtns { display: flex; gap: 4px; }
.nav-btn {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 16px; color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.15s;
}
.nav-btn:active { transform: scale(0.9); }

/* ══ MAIN AREA ══ */
#mainArea {
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 8px 10px;
  overflow: hidden;
  min-height: 0;
}

/* ══ LEFT SIDEBAR ══ */
#leftSidebar {
  background: var(--sky-surface);
  border: 1px solid var(--sky-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 6px;
  align-items: center;
  width: 52px;
  flex-shrink: 0;
}

.tool-btn {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: all 0.15s;
  position: relative;
}
.tool-btn:active { transform: scale(0.9); }
.tool-btn.active { outline: 3px solid var(--sky-trace); background: rgba(253,121,168,0.25); box-shadow: 0 0 10px var(--sky-trace); }

/* ══ CANVAS AREA ══ */
#canvasWrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0; min-height: 0;
  justify-content: flex-start;
}

#canvasContainer {
  flex: 1;
  min-height: 0;
  background: var(--canvas-bg);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(108,92,231,0.12);
  border: 1px solid var(--gs-border);
  position: relative;
  overflow: hidden;
}

#traceCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}
#overlayCanvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

#refChar {
  position: absolute;
  top: 6px; left: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(32px, 10vw, 52px);
  color: rgba(0,0,0,0.18);
  pointer-events: none;
  z-index: 5;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}

#countObjects {
  position: absolute;
  top: 6px; right: 8px;
  font-size: clamp(18px, 5.5vw, 26px);
  max-width: 45%;
  line-height: 1.2;
  text-align: right;
  pointer-events: none;
  z-index: 5;
  display: flex; flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

#phonicsLabel {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg,var(--gs-primary),#764ba2);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: clamp(14px, 4.5vw, 18px);
  font-family: 'Fredoka One', cursive;
  color: #fff;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(108,92,231,0.4);
}

#progressBar {
  height: 10px;
  background: rgba(225,112,85,0.15);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
#progressFill {
  height: 100%;
  background: linear-gradient(90deg,var(--gs-tracing),#fab1a0);
  border-radius: 8px;
  transition: width 0.2s;
  width: 0%;
}

#progressDots {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  max-height: 24px;
  overflow: hidden;
  flex-shrink: 0;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(225,112,85,0.2); transition: background 0.2s; }
.dot.done   { background: var(--gs-tracing); }
.dot.active { background: white; transform: scale(1.3); }

/* ══ RIGHT SIDEBAR ══ */
#rightSidebar {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 6px;
  align-items: center;
  width: 52px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.color-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.35);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.color-btn:active { transform: scale(0.9); }
.color-btn.active {
  border-color: #ffffff;
  border-width: 3px;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4), 0 4px 10px rgba(0,0,0,0.5);
}

/* ══ CELEBRATION ══ */
#celebration {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  align-items: center; justify-content: center;
}
#celebration.show { display: flex; }

#celebMsg {
  background: linear-gradient(135deg, var(--gs-warm), var(--gs-warm-dk));
  border-radius: 24px;
  padding: 24px 40px;
  font-size: 42px;
  font-family: 'Fredoka One', cursive;
  color: white;
  text-shadow: 0 3px 8px rgba(0,0,0,0.3);
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
  text-align: center;
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

#confettiCanvas {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 99;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 480px) {
  .tab-btn { padding: 6px 8px; font-size: 10px; }
  #leftSidebar, #rightSidebar { width: 44px; }
  .tool-btn { width: 34px; height: 34px; font-size: 15px; }
  .color-btn { width: 30px; height: 30px; }
}
