/* Components. The signature move of this system is the "solid underside":
   a raised element casts no blur, it sits on a 4px flat edge of its own hue and
   drops onto it when pressed. */

/* ---------- buttons ---------- */
.btn {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--sp-4);
  border: none;
  border-radius: var(--r-btn);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}

.btn-primary {
  background: var(--brown-500);
  color: #fff;
  box-shadow: 0 var(--underside) 0 var(--brown-600);
}
.btn-primary:hover:not(:disabled) { background: var(--brown-400); }
.btn-primary:active:not(:disabled) { transform: translateY(var(--underside)); box-shadow: 0 0 0 var(--brown-600); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink-soft);
  border: 2px solid var(--line);
  box-shadow: 0 var(--underside) 0 var(--line);
}
.btn-ghost:active { transform: translateY(var(--underside)); box-shadow: 0 0 0 var(--line); }

.btn:disabled {
  background: var(--locked);
  color: var(--ink-mute);
  box-shadow: none;
  cursor: default;
}

.action-zone {
  position: sticky;
  bottom: 0;
  padding: var(--sp-3) 0 calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--canvas) 72%, transparent);
}
.action-zone-stack { display: grid; gap: var(--sp-3); }

/* ---------- answer tiles ---------- */
.tile-bank { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }

.tile {
  position: relative;
  min-height: 52px;
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: 0 3px 0 var(--line);
  font-weight: 700;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}
.tile:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.tile.is-picked, .tile.is-active {
  background: var(--brown-100);
  border-color: var(--brown-400);
  box-shadow: 0 3px 0 var(--brown-400);
}
.tile.is-paired { background: var(--brown-100); border-color: var(--brown-200); }
.tile:disabled { cursor: default; opacity: 0.85; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.match-col { display: grid; gap: var(--sp-3); align-content: start; }
.match-badge {
  position: absolute;
  top: -8px; right: -8px;
  min-width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--brown-500);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 800;
}

.numeric-wrap { display: flex; justify-content: center; }
.numeric-input {
  width: 100%;
  max-width: 240px;
  height: 56px;
  padding: 0 var(--sp-4);
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--r-tile);
  box-shadow: 0 3px 0 var(--line);
  font-variant-numeric: tabular-nums;
}
.numeric-input:focus { outline: none; border-color: var(--brown-400); box-shadow: 0 3px 0 var(--brown-400); }

/* ---------- counters ---------- */
.counters { display: flex; gap: var(--sp-4); align-items: center; }
.counter { display: inline-flex; align-items: center; gap: var(--sp-1); }
.counter-icon { width: 24px; height: 24px; object-fit: contain; }
.counter-value { font-weight: 800; font-variant-numeric: tabular-nums; }

.lang-toggle {
  display: inline-flex;
  background: var(--brown-100);
  border-radius: var(--r-pill);
  padding: 3px;
}
.lang-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 12px;
  min-height: 32px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  cursor: pointer;
}
.lang-btn.is-on { background: var(--brown-500); color: #fff; }

/* ---------- health + progress bars ---------- */
.hp-bar {
  height: 12px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.hp-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 300ms ease-in-out;
}
.hp-fill-enemy { background: var(--heart); }
.hp-fill-hero { background: var(--ok); }

.track { flex: 1; height: 12px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.track-fill { display: block; height: 100%; width: 0; background: var(--brown-500); border-radius: var(--r-pill); transition: width 300ms ease-in-out; }

/* ---------- feedback banner ---------- */
.feedback {
  position: relative;
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  padding-right: 92px;
  border-radius: var(--r-card);
  animation: rise 200ms ease-out;
}
.feedback.is-correct { background: var(--ok-100); color: var(--ok-700); }
.feedback.is-wrong { background: var(--bad-100); color: var(--heart); }
.feedback-title { font-size: 18px; font-weight: 800; }
.feedback-tags { margin-top: var(--sp-1); font-size: 13px; font-weight: 700; }
.feedback-answer { margin-top: var(--sp-2); font-size: 20px; font-weight: 800; }
.feedback-exp { margin-top: var(--sp-2); color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.feedback-mascot {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-2);
  width: 76px;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- stars ---------- */
.stars { display: flex; gap: 2px; justify-content: center; }
.star { color: var(--locked); font-size: 14px; }
.star.is-on { color: var(--gold); }
.star-lg { font-size: 28px; }
