/* ══════════════════════════════════════════════════════════
   word-guess.css — Word Guess game styles
   Replaces wg-style.css. Unified design: lavender bg, blue navbar.
   ══════════════════════════════════════════════════════════ */

:root {
  --wg-primary:  #0984E3;
  --wg-purple:   var(--gs-primary);
  --wg-navy:     #1A237E;
  --wg-green:    #43A047;
  --wg-red:      #E53935;
  --wg-grid:     rgba(9,132,227,0.07);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--sky-bg);
  display: flex;
  flex-direction: column;
  color: var(--sky-text);
  user-select: none;
}

/* ── Game wrapper ── */
#app {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: transparent;
  overflow: hidden;
  padding-top: 56px;
}

/* ── Back button — hidden since header provides home nav ── */
.back-to-hub { display: none; }

.wg-quit-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.wg-quit-btn:hover { background: rgba(255,80,80,0.35); }
.wg-quit-btn.hidden { display: none; }

/* ── Top bar — hidden, gs-game-header used instead ── */
.top-bar { display: none !important; }

/* ── Old top bar (kept for reference) ── */
.top-bar-legacy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 14px;
  background: rgba(10,10,26,0.95);
  border-bottom: 1px solid var(--sky-border);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ── Coin pill ── */
.coin-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--gs-warm);
  border-radius: 50px;
  padding: 4px 12px 4px 8px;
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 6px rgba(253,203,110,0.5);
}
.coin-icon  { font-size: 16px; line-height: 1; }
.coin-count { font-family: 'Fredoka One', cursive; font-size: 16px; }

/* ── Category & round ── */
.category-name {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: var(--sky-text);
  text-align: center;
  flex: 1;
  padding: 0 8px;
}
.round-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 4px 12px;
  font-family: 'Fredoka One', cursive;
  font-size: 13px;
  font-weight: 900;
  color: var(--sky-word, #74b9ff);
  white-space: nowrap;
}

/* ── Wrong dot tracker ── */
.wrong-tracker {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px 4px;
  flex-shrink: 0;
}
.wrong-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.15);
  transition: background 0.3s, border-color 0.3s;
}
.wrong-dot.used { background: #e17055; border-color: #e17055; box-shadow: 0 0 8px #e17055; }

/* ── Drawing area ── */
.drawing-area {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  height: 200px;
  position: relative;
  background: rgba(5, 5, 20, 0.75);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  margin: 0;
}
#gameCanvas { width: 100%; height: 100%; object-fit: contain; display: block; background: transparent; border-radius: 12px; }
.drawing-emoji {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  opacity: 0.25;
  pointer-events: none;
}

/* ── Word display ── */
.word-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 16px 12px;
  min-height: 64px;
  flex-shrink: 0;
}
.word-group  { display: flex; gap: 4px; align-items: flex-end; }
.letter-box  { display: flex; flex-direction: column; align-items: center; width: 28px; }
.letter-char { font-family: 'Fredoka One', cursive; font-size: 24px; color: #ffffff; line-height: 1.1; min-height: 30px; display: flex; align-items: center; justify-content: center; transition: transform 0.2s, color 0.2s; text-shadow: 0 0 8px rgba(116,185,255,0.6); }
.letter-char.revealed { animation: wg-pop-in 0.3s ease; color: #74b9ff; }
@keyframes wg-pop-in { 0%{transform:scale(0.5);opacity:0} 70%{transform:scale(1.15)} 100%{transform:scale(1);opacity:1} }
.letter-underline { width: 100%; height: 3px; background: rgba(255,255,255,0.8); border-radius: 2px; margin-top: 3px; box-shadow: 0 0 6px rgba(116,185,255,0.4); }
.word-space { width: 14px; }

/* ── Hint button ── */
.hint-row {
  display: flex;
  justify-content: center;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}
.hint-btn {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg,#E8F5E9,#C8E6C9);
  border: 1.5px solid var(--wg-green);
  border-radius: 20px;
  padding: 6px 16px;
  color: #2E7D32;
  font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  box-shadow: 0 2px 6px rgba(67,160,71,0.2);
}
.hint-btn:active  { transform: scale(0.95); }
.hint-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hint-icon { font-size: 18px; }

/* ── Keyboard ── */
.keyboard-area {
  flex: 1;
  padding: 6px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.keyboard-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
}
.key-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.12);
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: transform 0.1s, background 0.15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  min-width: 0; padding: 0;
  user-select: none;
}
.key-btn:active:not(:disabled) { transform: scale(0.88); }
.key-btn.correct { background: rgba(0,200,100,0.25); border-color: #00b894; color: #6bcb77; box-shadow: 0 0 8px rgba(0,200,100,0.4); }
.key-btn.wrong   { background: rgba(255,50,50,0.15); border-color: rgba(255,70,70,0.5); color: rgba(255,255,255,0.3); box-shadow: 0 0 8px rgba(255,50,50,0.3); }
.key-btn.wrong::after { content: '✕'; position: absolute; font-size: 16px; color: #ff6b6b; font-weight: bold; line-height: 1; }
.key-btn.wrong .key-letter { opacity: 0.2; }
.key-btn:disabled { cursor: not-allowed; }

/* ── Success screen ── */
#successScreen {
  position: absolute; inset: 0;
  background: rgba(5,3,20,0.6);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center;
  z-index: 100; overflow-y: auto; padding: 16px;
}
#successScreen.hidden { display: none; }

.success-title { font-family: 'Fredoka One', cursive; font-size: 30px; color: #a29bfe; text-align: center; margin-top: 8px; letter-spacing: 1px; }
.success-word  { font-family: 'Fredoka One', cursive; font-size: 36px; color: white; letter-spacing: 3px; text-align: center; margin: 6px 0; }
.stars-row { display: flex; gap: 6px; justify-content: center; font-size: 28px; margin: 4px 0; }
.success-canvas-wrap { width: 100%; max-width: 300px; height: 180px; position: relative; }
#successCanvas { width: 100%; height: 100%; }

#confettiCanvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 200; }

.fun-fact-box {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 12px 16px;
  margin: 8px 0;
  max-width: 380px; width: 100%;
}
.fun-fact-label { font-family: 'Fredoka One', cursive; font-size: 13px; color: white; margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.fun-fact-text  { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.5; }

.coins-earned {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Fredoka One', cursive;
  font-size: 18px; color: #fff;
  background: var(--gs-warm);
  border-radius: 50px;
  padding: 8px 20px; margin: 6px 0;
  box-shadow: 0 2px 8px rgba(253,203,110,0.4);
}

.success-nav {
  display: flex; gap: 12px; margin-top: 10px;
  width: 100%; max-width: 360px; justify-content: center;
}

.nav-btn {
  flex: 1; padding: 12px 8px; border-radius: 50px; border: none;
  font-family: 'Fredoka One', cursive; font-size: 16px;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}
.nav-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
.nav-btn.primary   { background: linear-gradient(135deg,var(--gs-primary),#a29bfe); color: #fff; box-shadow: 0 4px 0 var(--gs-primary-dk); }
.nav-btn.secondary { background: #e8e4fa; color: var(--gs-primary); box-shadow: 0 4px 0 rgba(108,92,231,0.2); }

/* ── Fail screen ── */
#failScreen {
  position: absolute; inset: 0;
  background: rgba(10,10,26,0.7);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
#failScreen.hidden { display: none; }

.fail-title   { font-family: 'Fredoka One', cursive; font-size: 28px; color: #e17055; text-align: center; margin-bottom: 12px; }
.fail-reveal  { font-family: 'Fredoka One', cursive; font-size: 15px; color: rgba(255,255,255,0.65); margin-bottom: 6px; text-align: center; }
.fail-word    { font-family: 'Fredoka One', cursive; font-size: 34px; color: white; letter-spacing: 3px; text-align: center; margin-bottom: 18px; }
.fail-canvas-wrap { width: 100%; max-width: 280px; height: 160px; margin-bottom: 18px; }
#failCanvas   { width: 100%; height: 100%; }
.fail-nav { display: flex; gap: 12px; width: 100%; max-width: 340px; justify-content: center; }

/* ── Level toast ── */
#levelToast {
  position: fixed; top: 70px; left: 50%;
  transform: translateX(-50%);
  opacity: 0; visibility: hidden;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  color: white; font-family: 'Fredoka One', cursive;
  font-size: 18px; padding: 12px 24px; border-radius: 24px;
  box-shadow: 0 4px 20px rgba(108,92,231,0.5);
  z-index: 9999; transition: opacity 0.3s ease, visibility 0.3s ease;
  white-space: nowrap; pointer-events: none;
}
#levelToast.show { opacity: 1; visibility: visible; }

/* ── Category screen ── */
#categoryScreen {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 16px; overflow-y: auto;
}
#categoryScreen.hidden { display: none; }

.cat-screen-title { font-family: 'Fredoka One', cursive; font-size: 26px; color: #74b9ff; margin-bottom: 6px; }
.cat-screen-sub   { font-size: 14px; color: var(--sky-text-soft); margin-bottom: 16px; text-align: center; }

/* ── Level selector ── */
.level-selector { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; width: 100%; max-width: 380px; }
.level-track {
  display: flex;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
}
.level-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--sky-text-soft);
  font-family: 'Nunito', sans-serif;
  transition: all 0.15s;
  border-right: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.level-pill:last-child { border-right: none; }
.level-pill:hover { background: rgba(255,255,255,0.07); color: white; }
.level-pill.active {
  background: linear-gradient(160deg, #0984E3, #0066bb);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}
.level-pill-num { font-size: 15px; font-weight: 900; line-height: 1; }
.level-pill-len { font-size: 9px; font-weight: 700; opacity: 0.75; letter-spacing: 0.3px; }
.level-hint { font-size: 12px; color: var(--sky-text-soft); min-height: 16px; }

.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; max-width: 380px; }

.cat-card {
  border: 2px solid rgba(255,255,255,0.28);
  border-radius: 22px;
  padding: 22px 10px 18px;
  text-align: center;
  cursor: pointer;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 45%),
    var(--cat-color, #6c5ce7);
  transition: transform 0.12s cubic-bezier(0.175,0.885,0.32,1.275), box-shadow 0.12s;
  box-shadow:
    0 6px 0 rgba(0,0,0,0.22),
    0 10px 22px rgba(0,0,0,0.32),
    inset 0 1px 0 rgba(255,255,255,0.3);
  position: relative; overflow: hidden;
  animation: catCardPop 0.4s cubic-bezier(0.175,0.885,0.32,1.275) both;
}
/* Gloss sheen */
.cat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 46%;
  background: linear-gradient(180deg, rgba(255,255,255,0.28) 0%, transparent 100%);
  border-radius: 22px 22px 60% 60%;
  pointer-events: none;
}
.cat-card::after { display: none; }

.cat-card:hover  { transform: translateY(-4px) scale(1.04); box-shadow: 0 10px 0 rgba(0,0,0,0.22), 0 16px 30px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255,255,255,0.35); }
.cat-card:active { transform: translateY(5px) scale(0.96); box-shadow: 0 1px 0 rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.25); }
.cat-card.selected { outline: 3px solid white; outline-offset: 2px; }

/* Per-category colors */
.cat-card[data-cat="All"]       { --cat-color: #6c5ce7; }
.cat-card[data-cat="Animals"]   { --cat-color: #00b894; }
.cat-card[data-cat="Flowers"]   { --cat-color: #e84393; }
.cat-card[data-cat="Classroom"] { --cat-color: #f9a825; }
.cat-card[data-cat="Vehicles"]  { --cat-color: #0984e3; }
.cat-card[data-cat="Food"]      { --cat-color: #e17055; }

@keyframes catCardPop {
  from { transform: scale(0.65); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.cat-emoji { font-size: 44px; margin-bottom: 10px; filter: drop-shadow(0 3px 8px rgba(0,0,0,0.35)); display: block; position: relative; z-index: 1; }
.cat-label { font-family: 'Fredoka One', cursive; font-size: 18px; color: #fff; position: relative; z-index: 1; text-shadow: 0 1px 4px rgba(0,0,0,0.35); }
.cat-count { font-size: 11px; color: rgba(255,255,255,0.8); margin-top: 4px; font-weight: 700; position: relative; z-index: 1; }
.cat-play-btn {
  margin-top: 20px; padding: 14px 48px;
  background: linear-gradient(135deg,var(--gs-primary),#a29bfe);
  color: white; border: none; border-radius: 50px;
  font-family: 'Fredoka One', cursive; font-size: 20px;
  cursor: pointer; box-shadow: 0 4px 0 var(--gs-primary-dk);
  transition: transform 0.15s;
}
.cat-play-btn:active { transform: translateY(3px); }

/* ── Responsive ── */
@media (max-width: 380px) {
  .keyboard-grid { gap: 4px; }
  .key-btn { font-size: 12px; }
  .letter-char { font-size: 19px; }
}

/* ── Hide game elements when category screen is active ── */
#app.showing-category .wrong-tracker,
#app.showing-category .drawing-area,
#app.showing-category .word-display,
#app.showing-category .hint-row,
#app.showing-category .keyboard-area {
  visibility: hidden;
}
