/* =============================================================
   theme-counting.css — Izzy's Counting Quest
   Pink / purple palette, large tap targets, ten-frame dots
   ============================================================= */

/* ── Custom properties ──────────────────────────────────────── */
:root {
  --count-bg:      #fce4ec;
  --count-surface: #f8bbd9;
  --count-primary: #9c27b0;
  --count-accent:  #e91e63;
  --count-text:    #4a148c;
}

/* ── Page chrome ─────────────────────────────────────────────── */
body {
  background: var(--count-bg);
  color:      var(--count-text);
}

/* ── Welcome screen stage buttons ───────────────────────────── */
.btn-stage.s1 {
  background: linear-gradient(135deg, #ec407a, #c2185b);
  box-shadow: 0 4px 0 #880e4f;
}
.btn-stage.s2 {
  background: linear-gradient(135deg, #ab47bc, #7b1fa2);
  box-shadow: 0 4px 0 #4a148c;
}
.btn-stage.s3 {
  background: linear-gradient(135deg, #7e57c2, #512da8);
  box-shadow: 0 4px 0 #311b92;
}

/* "Best: —" label — match each stage's button colour */
.stage-card.s1 .stage-card-best { color: #c2185b; }
.stage-card.s2 .stage-card-best { color: #7b1fa2; }
.stage-card.s3 .stage-card-best { color: #512da8; }

/* ── Answer buttons ──────────────────────────────────────────── */

/* Hide A/B/C/D labels — digit is the answer */
.answer-letter {
  display: none;
}

/* Base layout override — applies to all 4 buttons */
.answer-btn {
  min-height:      96px;
  border-radius:   16px;
  justify-content: center;
}

/* Colour override — must match components.css specificity (.answer-btn[data-idx]) */
.answer-btn[data-idx] {
  background: #fff;
  border:     4px solid var(--count-primary);
  box-shadow: 0 4px 0 rgba(156,39,176,0.45), 0 6px 18px rgba(156,39,176,0.18);
}

.answer-btn[data-idx]:hover:not(:disabled),
.answer-btn[data-idx]:focus-visible:not(:disabled) {
  background:   #fce4ec;
  border-color: var(--count-accent);
  box-shadow:   0 4px 0 rgba(233,30,99,0.45), 0 6px 18px rgba(233,30,99,0.18);
}

/* Subdued appearance while tap-to-count is in progress */
.answer-btn:disabled {
  opacity: 0.45;
  cursor:  default;
}

/* Column layout: digit stacked above dots */
.ans-text {
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            4px;
  width:          100%;
  justify-content: center;
}

.btn-digit {
  font-size:   28px;
  font-weight: 800;
  line-height: 1;
  color:       var(--count-primary);
}

.btn-dots {
  font-size:    11px;
  letter-spacing: 3px;
  line-height:  1.5;
  color:        var(--count-accent);
  text-align:   center;
}

/* ── Question text ───────────────────────────────────────────── */
.q-text {
  font-size:   22px;
  font-weight: 700;
  text-align:  center;
  color:       var(--count-text);
  margin:      0 0 8px;
}

/* ── Stage 3 static item grid (5 per row) ────────────────────── */
.item-grid {
  display:         flex;
  flex-wrap:       wrap;
  gap:             4px;
  justify-content: center;
  max-width:       calc(5 * 42px + 4 * 4px);
  margin:          10px auto 0;
}

.item-static {
  font-size: 30px;
  width:     42px;
  height:    42px;
  display:   flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

/* ── Pre-answer container spacing ───────────────────────────── */
#pre-answer-container {
  padding:    6px 0 2px;
  align-self: stretch;
}

/* ── Tap-to-count item grid ──────────────────────────────────── */
.tap-grid {
  display:         flex;
  flex-wrap:       wrap;
  gap:             8px;
  justify-content: center;
  padding:         8px 4px;
}

.tap-item {
  width:         80px;
  min-height:    88px;
  border-radius: 14px;
  background:    #fff;
  border:        3px solid var(--count-primary);
  display:       flex;
  align-items:   center;
  justify-content: center;
  cursor:        pointer;
  position:      relative;
  transition:    transform 0.1s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action:  manipulation;
}

.tap-item:active {
  transform: scale(0.92);
}

.tap-item.tapped {
  background:   var(--count-surface);
  border-color: var(--count-accent);
}

.tap-item.tapped .tap-emoji {
  opacity: 0.55;
}

.tap-emoji {
  font-size:       36px;
  line-height:     1;
  pointer-events:  none;
  user-select:     none;
}

.tap-badge {
  position:    absolute;
  top:         -10px;
  right:       -10px;
  width:       26px;
  height:      26px;
  border-radius: 50%;
  background:  var(--count-accent);
  color:       #fff;
  font-size:   13px;
  font-weight: 800;
  display:     flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border:      2px solid #fff;
}

/* ── Count readout "3 of 5  ●●●" ────────────────────────────── */
.count-readout {
  display:         flex;
  align-items:     center;
  justify-content: center;
  gap:             10px;
  padding:         6px 0 2px;
  font-size:       17px;
  font-weight:     700;
  color:           var(--count-primary);
}

.readout-dots {
  font-size:      13px;
  letter-spacing: 4px;
  color:          var(--count-accent);
  min-width:      2ch;
}

/* ── Stage 2 helper button ───────────────────────────────────── */
.count-helper-btn {
  display:       block;
  width:         100%;
  max-width:     360px;
  min-height:    64px;
  margin:        4px auto;
  padding:       12px 24px;
  background:    var(--count-primary);
  color:         #fff;
  border:        none;
  border-radius: 16px;
  font-family:   inherit;
  font-size:     20px;
  font-weight:   700;
  cursor:        pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action:  manipulation;
  transition:    opacity 0.15s;
}

.count-helper-btn:active {
  opacity: 0.75;
}
