/* ──────────────────────────────────────────────
   UPSCALE — Crack It! Game CSS
────────────────────────────────────────────── */

/* ── Home page ── */
.ci-page { max-width: 900px; margin: 0 auto; padding: 32px 16px 60px; }

.ci-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.ci-cat-card {
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  border-radius: var(--radius-lg);
}
.ci-cat-card:hover { transform: translateY(-4px); }

.ci-cat-glow {
  position: absolute; top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%; opacity: 0.12; filter: blur(30px);
  pointer-events: none;
}
.ci-cat-card.indigo .ci-cat-glow { background: var(--indigo); }
.ci-cat-card.gold   .ci-cat-glow { background: var(--gold); }
.ci-cat-card.rose   .ci-cat-glow { background: var(--rose); }
.ci-cat-card.purple .ci-cat-glow { background: var(--purple); }
.ci-cat-card.emerald.ci-cat-glow { background: var(--emerald); }

.ci-cat-top-bar {
  height: 3px; border-radius: 3px 3px 0 0;
  position: absolute; top: 0; left: 0; right: 0;
}
.ci-cat-card.indigo  .ci-cat-top-bar { background: var(--indigo); }
.ci-cat-card.gold    .ci-cat-top-bar { background: var(--gold); }
.ci-cat-card.rose    .ci-cat-top-bar { background: var(--rose); }
.ci-cat-card.purple  .ci-cat-top-bar { background: var(--purple); }
.ci-cat-card.emerald .ci-cat-top-bar { background: var(--emerald); }

.ci-cat-icon { font-size: 40px; margin-bottom: 14px; }
.ci-cat-name { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin-bottom: 6px; color: var(--text-primary); }
.ci-cat-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }

.ci-cat-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.ci-cat-stat {
  font-size: 12px; padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(var(--overlay-rgb), 0.06);
  color: var(--text-muted);
  display: flex; align-items: center; gap: 4px;
}
.ci-in-progress-badge {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(var(--gold-rgb),0.2); color: var(--gold);
  border: 1px solid rgba(var(--gold-rgb),0.3);
  animation: pulseBadge 2s ease-in-out infinite;
}

/* ── Game header ── */
.ci-game-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* The session HUD is one floating bar rather than a hairline strip — the same
   shape the Flashcard Duel session uses, so the two games read as one product. */
.ci-header {
  flex-shrink: 0;
  z-index: 100;
  margin: 14px auto 0;
  width: min(1100px, calc(100% - 28px));
  padding: 12px 18px;
  display: flex; align-items: center; gap: 16px;
  background: #fff;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-card);
}

.ci-header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.ci-logo {
  font-family: var(--font-display);
  font-size: 15.5px; font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.ci-logo .clay { flex: none; }

.ci-category-chip {
  font-family: var(--font-body);
  font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: var(--radius-full);
  background: var(--m-knock-knock-tint); border: 0;
  color: var(--m-knock-knock-text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 40vw;
}

.ci-puzzle-count {
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
}

.ci-header-center { flex: 1; display: flex; justify-content: center; }

.ci-hint-counter {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap;
}
.ci-hint-counter span { color: var(--indigo-light); font-weight: 800; }

.ci-header-right { display: flex; align-items: center; gap: 12px; }

/* Lives — same Fluent UI Flat emoji family as the dashboard's stat cards
   (.emoji-icon-sm / .emoji-icon-lg, static/css/main.css), not SVG icons. */
.ci-lives {
  display: flex; align-items: center; gap: 6px;
}
.ci-heart {
  display: flex; align-items: center;
  transition: all var(--transition-base);
}
/* Two emoji stacked per slot — CSS shows exactly one, based on .lost. */
.ci-heart-lost { display: none; }
.ci-heart.lost .ci-heart-alive { display: none; }
.ci-heart.lost .ci-heart-lost  { display: inline-block; }
.ci-heart.losing { animation: heartLose 0.4s ease forwards; }
@keyframes heartLose {
  0%   { transform: scale(1.2); }
  50%  { transform: scale(0.8); }
  100% { transform: scale(1); }
}

.ci-close {
  width: 34px; height: 34px; flex: none;
  background: var(--bg-soft);
  border: 0;
  border-radius: 50%;
  color: var(--ink-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ci-close:hover { background: var(--m-knock-knock-tint); color: var(--ink); }

/* ── Game body ── */
.ci-body {
  flex: 1; min-height: 0; padding: 28px 0 48px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ci-container { width: 100%; max-width: 680px; padding: 0 20px; }

/* ── Hints area ── */
.ci-hints-wrap { margin-bottom: 24px; }

.ci-hints-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}

/* A revealed clue is a solid card; at 4% overlay it was barely distinguishable
   from the locked slots below it, so the list read as uniformly empty. */
.ci-hint-card {
  padding: 16px 20px;
  border-radius: 20px;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow-card), inset 0 0 0 1.5px rgba(var(--m-knock-knock-rgb), 0.16);
  display: flex; gap: 14px; align-items: flex-start;
  margin-bottom: 10px;
}

.ci-hint-card.ci-hint-enter {
  animation: hintSlideIn 0.4s cubic-bezier(0.22,1,0.36,1);
}
@keyframes hintSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ci-hint-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--m-knock-knock); color: #fff;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

.ci-hint-text {
  font-size: 15.5px; line-height: 1.6; color: var(--ink);
  flex: 1;
}

/* Locked hint slots */
/* Locked slots stay quiet but legible: a dashed outline on the page rather
   than a near-invisible panel at 40% opacity. */
.ci-hint-locked {
  padding: 13px 20px;
  border-radius: 20px;
  border: 1.5px dashed rgba(30, 27, 75, 0.14);
  background: transparent;
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 10px; opacity: 1;
}
.ci-hint-locked-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-soft);
  font-family: var(--font-display);
  font-size: 12px; font-weight: 800; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ci-hint-locked-text { font-size: 13px; color: var(--text-muted); }

/* ── Guess area ── */
.ci-guess-wrap {
  background: #fff;
  border: 0;
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  padding: 22px;
}

.ci-guess-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 12px;
}

.ci-answer-input {
  width: 100%;
  padding: 15px 20px;
  background: var(--bg-soft);
  border: 0;
  box-shadow: inset 0 0 0 1.5px rgba(30, 27, 75, 0.1);
  border-radius: var(--radius-full);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  margin-bottom: 14px;
}
.ci-answer-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 15px; }
.ci-answer-input:focus {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--m-knock-knock), 0 0 0 4px rgba(var(--m-knock-knock-rgb), 0.16);
}
.ci-answer-input.ci-shake {
  animation: inputShake 0.5s ease;
}
/* the input lost its border in the Clay pass, so these states have to carry
   their colour on the inset ring rather than border-color */
.ci-answer-input.ci-wrong {
  background: #FFE4EF;
  box-shadow: inset 0 0 0 2px #EC4899, 0 0 0 4px rgba(236, 72, 153, 0.16);
}
.ci-answer-input.ci-correct {
  background: #DDF7F0;
  box-shadow: inset 0 0 0 2px #14B8A6, 0 0 0 4px rgba(20, 184, 166, 0.18);
}
@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.ci-guess-actions {
  display: flex; gap: 10px;
}

.ci-btn-submit {
  flex: 1;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--emerald), #059669);
  border: none; border-radius: var(--radius-md);
  color: white; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all var(--transition-base);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
}
.ci-btn-submit:hover:not(:disabled) {
  filter: brightness(1.15); transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--emerald-rgb),0.35);
}
.ci-btn-submit:disabled {
  opacity: 0.35; cursor: not-allowed; transform: none;
  background: rgba(var(--overlay-rgb), 0.08);
}

.ci-btn-hint {
  padding: 12px 20px;
  background: rgba(var(--accent-rgb),0.12);
  border: 1.5px solid rgba(var(--accent-rgb),0.3);
  border-radius: var(--radius-md);
  color: var(--indigo-light); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-base);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-body); white-space: nowrap;
}
.ci-btn-hint:hover:not(:disabled) {
  background: rgba(var(--accent-rgb),0.2); transform: translateY(-1px);
}
.ci-btn-hint:disabled {
  opacity: 0.3; cursor: not-allowed; transform: none;
}

/* Feedback message */
.ci-feedback {
  margin-top: 12px; min-height: 20px;
  font-size: 13px; font-weight: 500;
  text-align: center; transition: all var(--transition-base);
}
.ci-feedback.wrong   { color: var(--danger); }
.ci-feedback.blocked { color: var(--text-muted); }

/* ── Win overlay ── */
.ci-win-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: var(--scrim-bg); backdrop-filter: blur(12px);
}
.ci-win-overlay.show { display: flex; }

.ci-win-card {
  max-width: 420px; width: 92%;
  padding: 48px 36px; text-align: center;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-float);
  animation: scaleIn 0.4s cubic-bezier(0.22,1,0.36,1);
}

.ci-lose-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: var(--scrim-bg); backdrop-filter: blur(12px);
}
.ci-lose-overlay.show { display: flex; }

.ci-lose-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-float);
  max-width: 420px; width: 92%;
  padding: 48px 36px; text-align: center;
  animation: scaleIn 0.4s cubic-bezier(0.22,1,0.36,1);
}

@keyframes scaleIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.ci-result-emoji { margin-bottom: 16px; display: flex; justify-content: center; }
.ci-result-emoji svg { width: 48px; height: 48px; }
.ci-result-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.ci-result-answer {
  font-size: 22px; font-weight: 700; color: var(--gold);
  margin: 12px 0; padding: 10px 20px;
  background: rgba(var(--gold-rgb),0.1); border: 1px solid rgba(var(--gold-rgb),0.25);
  border-radius: var(--radius-md);
}
.ci-result-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }
.ci-xp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: var(--radius-full);
  background: #FFF6D6; border: 0;
  font-size: 22px; font-weight: 800; color: #B45309;
  margin-bottom: 24px;
  animation: xpPop 0.55s cubic-bezier(0.22,1,0.36,1) 0.3s both;
}
@keyframes xpPop {
  from { transform: scale(0.5) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0);      opacity: 1; }
}

.ci-result-actions { display: flex; gap: 10px; flex-direction: column; }

/* Hint progress bar in header */
.ci-hint-progress {
  display: flex; gap: 4px; align-items: center;
}
.ci-hint-pip {
  width: 20px; height: 4px; border-radius: 2px;
  background: rgba(var(--overlay-rgb), 0.1);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.ci-hint-pip.filled  { background: var(--accent); }
.ci-hint-pip.current { background: var(--color-bolt); box-shadow: 0 0 6px rgba(212,154,96,0.5); }

/* Difficulty badge */
.ci-difficulty {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: var(--radius-full); text-transform: uppercase;
}
.ci-difficulty.easy   { background: rgba(var(--emerald-rgb),0.15); color: var(--emerald); border: 1px solid rgba(var(--emerald-rgb),0.3); }
.ci-difficulty.medium { background: rgba(var(--gold-rgb),0.15); color: var(--gold);    border: 1px solid rgba(var(--gold-rgb),0.3); }
.ci-difficulty.hard   { background: rgba(var(--danger-rgb),0.15);  color: var(--danger);  border: 1px solid rgba(var(--danger-rgb),0.3); }

/* ── Results page ── */
.ci-results-page { padding: 40px 0 60px; }
.ci-results-card { max-width: 600px; margin: 0 auto; }

.ci-attempt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.ci-attempt-row:last-child { border-bottom: none; }
.ci-attempt-guess { flex: 1; color: var(--text-secondary); }
.ci-attempt-result { font-size: 16px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .ci-category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .ci-category-grid { grid-template-columns: 1fr; gap: 12px; }
  .ci-header { padding: 10px 12px; gap: 8px; width: calc(100% - 20px); margin-top: 10px; }
  .ci-logo { font-size: 14px; }
  /* five elements cannot share a 390px pill — these overlapped the hint
     counter. The category and difficulty are on the hub, and the clue list
     shows progress, so the bar keeps identity, hints left and lives. */
  .ci-category-chip,
  .ci-difficulty,
  .ci-puzzle-count { display: none; }
  .ci-header-left { gap: 8px; min-width: 0; flex: 0 1 auto; }
  .ci-hint-text { font-size: 14px; }
  .ci-answer-input { font-size: 16px; padding: 12px 14px; }
  .ci-guess-actions { flex-direction: column; }
  .ci-btn-submit, .ci-btn-hint { width: 100%; }
  .ci-win-card, .ci-lose-card { padding: 36px 24px; }
  .ci-result-title { font-size: 22px; }
  .ci-result-actions { gap: 8px; }
  .ci-hint-progress { display: none; }

  /* Full-screen, non-scrolling play layout: header and the guess/answer
     controls stay pinned in place; only the clue list scrolls internally
     if it grows too tall to fit (up to 5 revealed clues on a small phone). */
  .ci-body {
    overflow: hidden;
    padding: 16px 0 12px;
  }
  .ci-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
  }
  .ci-hints-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
  }
  #ci-hints-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .ci-guess-wrap { flex-shrink: 0; padding: 14px; }
}

@media (max-width: 400px) {
  .ci-hint-num, .ci-hint-locked-num { width: 20px; height: 20px; font-size: 10px; }
}
