/* DP table page — extends maxflow.css base */

.dp-stage {
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Items / coins editor */
.items-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.items-row .item-pill {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  font-family: 'system-ui', monospace;
  font-size: 11.5px;
  min-width: 76px;
  position: relative;
}
.items-row .item-pill .name {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.items-row .item-pill .row {
  display: flex; gap: 6px; align-items: center;
}
.items-row .item-pill input {
  width: 44px;
  padding: 2px 4px;
  text-align: right;
  font-size: 12px;
}
.items-row .item-pill .del {
  position: absolute; top: 2px; right: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0;
}
.items-row .item-pill .del:hover { color: oklch(0.55 0.18 30); }

/* The 2D table itself (knapsack) */
.dp-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  position: relative;
}
.dp-table {
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'system-ui', monospace;
  font-size: 12px;
}
.dp-table th, .dp-table td {
  width: 44px; height: 36px;
  text-align: center; vertical-align: middle;
  border: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.dp-table th {
  font-family: 'system-ui', sans-serif;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dp-table th.corner { background: var(--bg); border: none; }
.dp-table td.empty { color: oklch(0.78 0.012 80); background: oklch(0.97 0.005 80); }
.dp-table td.row0 { background: var(--surface-2); color: var(--muted); }

.dp-table td.filled-this-step {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
  color: var(--accent-deep);
  transform: scale(1.04);
  box-shadow: 0 4px 12px -4px oklch(0.4 0.1 50 / 0.4);
}
.dp-table td.dep-skip {
  background: var(--cool-soft);
  border-color: var(--cool);
}
.dp-table td.dep-take {
  background: var(--good-soft);
  border-color: var(--good);
}
.dp-table td.dep-skip::after,
.dp-table td.dep-take::after {
  content: attr(data-dep-label);
  position: absolute;
  top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 9px;
  font-family: 'system-ui', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--surface);
  border-radius: 3px;
  padding: 0 4px;
  white-space: nowrap;
}
.dp-table td.in-path {
  background: oklch(0.92 0.06 50 / 0.5);
  font-weight: 600;
}

/* 1D table (exact change) */
.dp-row-table {
  display: flex; gap: 4px; flex-wrap: wrap;
  font-family: 'system-ui', monospace;
}
.dp-row-cell {
  width: 56px;
  display: flex; flex-direction: column;
  align-items: center;
}
.dp-row-cell .idx {
  font-size: 10px; color: var(--muted);
  margin-bottom: 2px;
}
.dp-row-cell .box {
  width: 100%; height: 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--ink);
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.dp-row-cell .box .inf { color: var(--muted); font-size: 14px; font-weight: 400; }
.dp-row-cell .coin {
  font-size: 9.5px; color: var(--good);
  margin-top: 2px; height: 12px;
}
.dp-row-cell.filled-this-step .box {
  background: var(--accent-soft); border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--accent-deep);
  box-shadow: 0 6px 14px -6px oklch(0.4 0.1 50 / 0.4);
}
.dp-row-cell.dep .box {
  background: var(--cool-soft); border-color: var(--cool);
}
.dp-row-cell.dep .box.best { background: var(--good-soft); border-color: var(--good); }
.dp-row-cell.in-path .box {
  background: oklch(0.92 0.06 50 / 0.5);
}

/* Problem chooser */
.problem-chooser {
  display: flex; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 99px; padding: 2px;
}
.problem-chooser button {
  font-family: 'system-ui', sans-serif;
  font-size: 12px;
  background: transparent; border: none;
  padding: 5px 14px; border-radius: 99px;
  cursor: pointer; color: var(--ink-soft);
}
.problem-chooser button.active { background: var(--ink); color: var(--bg); }

/* Call stack display (recursive mode) */
.call-stack {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 6px;
  font-family: 'system-ui', monospace; font-size: 12px;
}
.call-stack-chip {
  background: var(--cool-soft); border: 1px solid var(--cool);
  color: oklch(0.32 0.1 245);
  border-radius: 5px; padding: 2px 8px;
}
.call-stack-chip.top { background: var(--cool); color: white; }
