/* Singapore Math CPA Interactive Blocks (Ten-Frame, Number Bond, Make-10, Base-10 Rods) & Tutorial Classroom */

.cpa-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  inline-size: 100%;
  max-inline-size: 620px;
}

.cpa-panel[hidden] {
  display: none;
}

.cpa-visual-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

/* Ten-Frame Grid (2x5 or 1x5) */
.ten-frame {
  display: grid;
  grid-template-columns: repeat(5, 32px);
  gap: 5px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(15, 29, 46, 0.85);
  border: 2px solid rgba(255, 245, 224, 0.28);
  transition: border-color 220ms ease-out, box-shadow 220ms ease-out;
}

.ten-frame.is-full-ten {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.45);
}

.tf-cell {
  inline-size: 32px;
  block-size: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
}

.tf-cell.is-target-slot {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.16);
}

.cpa-cube {
  inline-size: 24px;
  block-size: 24px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease-out;
}

.cpa-cube--a {
  background: linear-gradient(145deg, #38bdf8, #0284c7);
}

.cpa-cube--b {
  background: linear-gradient(145deg, #fde047, #f59e0b);
}

.cpa-cube--crossed {
  background: rgba(248, 113, 113, 0.25);
  border-style: dashed;
  border-color: #fca5a5;
  position: relative;
}

.cpa-cube--crossed::after {
  content: "";
  position: absolute;
  inset: 50% -2px auto -2px;
  block-size: 3px;
  background: #fca5a5;
  transform: rotate(-35deg);
}

.cpa-cube--popped {
  opacity: 0.22;
  transform: scale(0.65);
}

.cpa-cube--draggable {
  cursor: grab;
  touch-action: none;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.55), inset -3px -3px 0 rgba(0, 0, 0, 0.2);
}

.cpa-cube--draggable:hover {
  transform: scale(1.16);
}

.cpa-cube--draggable:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.cpa-cube--removable {
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.85), inset -3px -3px 0 rgba(0, 0, 0, 0.2);
}

.cpa-cube--removable:hover {
  transform: scale(1.14);
}

.tf-cell.is-target-slot {
  cursor: pointer;
}

.ten-rod--interactive {
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.78);
  transition: transform 150ms ease-out;
}

.ten-rod--interactive:hover {
  transform: scale(1.12);
}

.ten-frame.is-drop-hover {
  border-color: #34d399;
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.65);
}

.cpa-drag-ghost {
  position: fixed;
  z-index: 9999;
  inline-size: 36px;
  block-size: 36px;
  border-radius: 9px;
  border: 3px solid #fff;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

/* Number Bond (Singapore Math Part-Part-Whole diagram) */
.number-bond {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(15, 29, 46, 0.78);
  border: 1.5px solid rgba(255, 245, 224, 0.22);
  font-family: var(--font-display);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.bond-node {
  min-inline-size: 36px;
  block-size: 36px;
  padding-inline: 6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.75);
}

.bond-node--whole {
  background: rgba(52, 211, 153, 0.28);
  border-color: #34d399;
}

.bond-node--part-a {
  background: rgba(56, 189, 248, 0.28);
  border-color: #38bdf8;
}

.bond-node--part-b {
  background: rgba(251, 191, 36, 0.28);
  border-color: #fbbf24;
}

.bond-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Base-10 Place Value Mat (Golden Ten-Rods + Blue Unit Cubes) */
.pv-mat {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  inline-size: 100%;
  max-inline-size: 520px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(15, 29, 46, 0.86);
  border: 2px solid rgba(255, 245, 224, 0.26);
}

.pv-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.pv-col-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
}

.pv-rods-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  min-block-size: 62px;
}

.ten-rod {
  inline-size: 16px;
  block-size: 62px;
  border-radius: 5px;
  background: repeating-linear-gradient(
    to bottom,
    #facc15 0px,
    #facc15 5px,
    #b45309 5px,
    #b45309 6.2px
  );
  border: 1.5px solid #fef08a;
  box-shadow: 0 3px 8px rgba(250, 204, 21, 0.32);
}

.ten-rod--b {
  background: repeating-linear-gradient(
    to bottom,
    #fb923c 0px,
    #fb923c 5px,
    #9a3412 5px,
    #9a3412 6.2px
  );
  border-color: #fed7aa;
}

.ten-rod--new {
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.9);
  transform: scale(1.08);
}

.ten-rod--crossed {
  opacity: 0.28;
  filter: grayscale(0.7);
}

.pv-ones-wrap {
  display: grid;
  grid-template-columns: repeat(5, 22px);
  gap: 4px;
  justify-content: center;
  align-content: center;
  min-block-size: 62px;
}

.pv-ones-wrap .cpa-cube {
  inline-size: 20px;
  block-size: 20px;
  border-radius: 5px;
}

/* Interactive CPA Action Button & Formula Ribbon */
.cpa-action-btn {
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #102030;
  font-size: var(--text-body);
  font-weight: 900;
  border: 2px solid #fff7d6;
  box-shadow: 0 6px 18px rgba(250, 204, 21, 0.35);
  transition: transform 140ms ease-out;
}

.cpa-action-btn:active {
  transform: scale(0.95);
}

.cpa-ribbon {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(52, 211, 153, 0.2);
  border: 1.5px solid #34d399;
  color: #d1fae5;
  font-size: var(--text-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cpa-abstract-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--accent-warning);
  font-weight: 800;
}

/* === CPA Blocks Focused Battle Mode Styling === */
.ar-stage.is-blocks-mode .reticle {
  opacity: 0.16;
}

.ar-stage.is-blocks-mode .creature-sprite-wrap {
  inline-size: clamp(120px, 16vw, 175px);
  block-size: clamp(120px, 16vw, 175px);
}

/* === Level & Scaffold HUD Tag === */
.adaptive-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 800;
}

/* === Full-Stage CPA Tutorial & Certification Classroom === */
.tutorial-screen {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: radial-gradient(circle at 50% 25%, rgba(22, 54, 78, 0.96), rgba(9, 17, 30, 0.99));
  overflow-y: auto;
}

.tutorial-screen[hidden] {
  display: none;
}

.tut-top-bar {
  inline-size: 100%;
  max-inline-size: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tut-progress-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tut-dot {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.tut-dot.is-current {
  border-color: #facc15;
  background: rgba(250, 204, 21, 0.35);
  transform: scale(1.15);
}

.tut-dot.is-pass {
  background: #34d399;
  border-color: #d1fae5;
}

.tut-dot.is-miss {
  background: #f87171;
  border-color: #fee2e2;
}

.tut-teacher-box {
  display: flex;
  align-items: center;
  gap: 12px;
  inline-size: 100%;
  max-inline-size: 720px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1.5px solid var(--border-hud);
}

.tut-teacher-avatar {
  inline-size: 64px;
  block-size: 64px;
  object-fit: contain;
  flex-shrink: 0;
}

.tut-speech {
  flex: 1;
  font-size: var(--text-body);
  line-height: 1.45;
  color: var(--text-primary);
}

.tut-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  inline-size: 100%;
  max-inline-size: 720px;
}

.tut-cert-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 2px solid var(--accent-warning);
  text-align: center;
  max-inline-size: 520px;
}

.start-mode-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.mode-pill {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--surface-card-soft);
  border: 2px solid var(--border-hud);
  font-size: var(--text-body);
  font-weight: 800;
  color: var(--text-muted);
}

.mode-pill.is-active {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #fff;
}

.gate-banner {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(251, 191, 36, 0.18);
  border: 1.5px solid #fbbf24;
  color: #fde68a;
  font-size: var(--text-sm);
  font-weight: 800;
}

.gate-banner.is-unlocked {
  background: rgba(52, 211, 153, 0.18);
  border-color: #34d399;
  color: #a7f3d0;
}
