.grid-math-shell {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Voortgang als piramide (10 blokjes) */
.grid-math-pyramid-mount {
  display: flex;
  justify-content: center;
  padding: 0.15rem 0 0.25rem;
}

.progress-pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.progress-pyramid__row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.progress-pyramid__cell {
  width: 1.45rem;
  height: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 5px;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.progress-pyramid__cell--pending {
  background: var(--cell-pending);
  color: var(--text-muted);
  opacity: 0.85;
}

.progress-pyramid__cell--done {
  background: var(--cell-done);
  color: #1e4a28;
  border-color: rgba(30, 120, 60, 0.2);
}

.progress-pyramid__cell--current {
  background: var(--cell-current);
  color: var(--text);
  border-color: var(--cell-current-ring);
  box-shadow: 0 2px 6px rgba(244, 160, 32, 0.35);
  transform: scale(1.06);
  z-index: 1;
}

.grid-math-shell--hero .progress-pyramid__cell {
  width: 1.2rem;
  height: 1.2rem;
  font-size: 0.52rem;
}

.grid-math-shell--hero .progress-pyramid {
  gap: 3px;
}

.grid-math-shell--hero .progress-pyramid__row {
  gap: 3px;
}

/* Titel + compact rooster (headerregel) */
.grid-math-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.15rem 0 0.35rem;
  overflow: hidden;
}

.grid-math-page-head--embed {
  justify-content: flex-end;
  padding: 0;
}

.grid-math-page-head--no-grid {
  justify-content: flex-start;
}

.grid-math-page-head__text {
  flex: 1 1 12rem;
  min-width: 0;
}

.grid-math-title {
  margin: 0 0 0.25rem;
  font-size: clamp(1.1rem, 2.8vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.grid-math-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 36ch;
}

.grid-math-grid-wrap--header {
  flex: 0 0 auto;
  width: 100%;
  max-width: 12.75rem;
  padding: 0;
  overflow: hidden;
}

.grid-math-page-head--embed .grid-math-grid-wrap--header {
  max-width: 11.25rem;
}

.grid-math-grid--compact {
  gap: 3px;
}

.grid-math-grid--compact .grid-cell {
  font-size: 0.62rem;
  border-radius: 5px;
}

.grid-math-grid--compact .grid-cell--current {
  transform: scale(1.03);
  box-shadow: 0 1px 5px rgba(244, 160, 32, 0.35);
}

.grid-math-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-math-body {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    align-items: start;
  }
}

.grid-math-main {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.grid-math-main--hint-only {
  padding: 0.75rem 1rem;
}

.grid-math-body--hero {
  grid-template-columns: 1fr !important;
  gap: 0.5rem;
}

.grid-math-shell--hero {
  gap: 0.35rem;
  overflow: hidden;
  max-height: 100%;
}

.grid-math-shell--hero .grid-math-header-mount .app-header {
  padding: 0.35rem 0.45rem;
  margin-bottom: 0.15rem;
  gap: 0.4rem;
}

.grid-math-shell--hero .app-header__label {
  font-size: 0.58rem;
}

.grid-math-shell--hero .app-header__value,
.grid-math-shell--hero .app-header__value-text,
.grid-math-shell--hero .timer-display {
  font-size: 0.88rem;
}

.grid-math-shell--hero .grid-math-panel {
  padding: 0.55rem 0.65rem;
  gap: 0.45rem;
}

.grid-math-shell--hero .grid-math-problem {
  font-size: 1.05rem;
  min-height: 1.75rem;
}

.grid-math-shell--hero .grid-math-input {
  padding: 0.45rem 0.55rem;
}

.grid-math-shell--hero .btn {
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

.grid-math-shell--hero .grid-math-grid--compact .grid-cell {
  font-size: 0.56rem;
}

.grid-math-shell--hero .grid-math-grid--compact {
  gap: 2px;
}

.grid-math-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.grid-math-grid-wrap {
  overflow: hidden;
  padding: 0.15rem;
}

.grid-math-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
  width: 100%;
  max-width: 100%;
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(0.7rem, 2.2vw, 0.95rem);
  font-variant-numeric: tabular-nums;
  background: var(--cell-pending);
  color: var(--text);
  border-radius: 8px;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.grid-cell--done {
  background: var(--cell-done);
  color: #1e4a28;
}

.grid-cell--current {
  background: var(--cell-current);
  border-color: var(--cell-current-ring);
  box-shadow: 0 2px 8px rgba(244, 160, 32, 0.35);
  transform: scale(1.04);
  z-index: 1;
}

.grid-math-panel {
  background: var(--surface-muted);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.grid-math-difficulty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.grid-math-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.grid-math-select {
  border: 2px solid var(--accent-soft);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  background: var(--surface);
  color: var(--text);
  min-width: 8rem;
}

.grid-math-problem-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.grid-math-problem {
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  min-height: 2.5rem;
}

.grid-math-input {
  width: 100%;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: var(--surface);
}

.grid-math-input::placeholder {
  color: #9aa8b8;
}

.grid-math-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grid-math-actions .btn--primary:first-of-type {
  flex: 0 0 auto;
}

.grid-math-actions .btn--primary:nth-of-type(2) {
  flex: 1 1 8rem;
}

.grid-math-feedback {
  min-height: 1.5rem;
}

.feedback-message {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.feedback-message[data-kind="ok"] {
  color: var(--ok);
}

.feedback-message[data-kind="warn"] {
  color: var(--warn);
}

.feedback-message[data-kind="info"] {
  color: var(--text-muted);
}
