.counter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  max-width: 100%;
  overflow: hidden;
}

#counter-hint {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.counter-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: linear-gradient(140deg, #ffffff 0%, #f8fbff 100%);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.counter-card.is-active {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.12);
}

.counter-card.dragging {
  opacity: 0.55;
}

.counter-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.counter-drag {
  border: 0;
  background: transparent;
  color: #6c757d;
  cursor: grab;
  padding: 0.2rem;
}

.counter-name {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 1px solid #dee2e6;
  border-radius: 0.45rem;
  padding: 0.35rem 0.55rem;
  font-weight: 600;
}

.counter-name:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.counter-delete {
  border: 0;
  background: transparent;
  color: #dc3545;
  padding: 0.2rem;
}

.counter-value {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  line-height: 1;
  text-align: center;
  margin: 0.6rem 0 0.8rem;
  font-variant-numeric: tabular-nums;
}

.counter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.counter-btn {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  background: #fff;
  padding: 0.55rem 0.65rem;
  font-weight: 700;
}

.counter-btn.counter-plus {
  color: #0d6efd;
}

.counter-btn.counter-minus {
  color: #dc3545;
}

[data-bs-theme="dark"] .counter-card {
  border-color: #334155;
  background: linear-gradient(140deg, #0f172a 0%, #111827 100%);
}

[data-bs-theme="dark"] .counter-name {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

[data-bs-theme="dark"] .counter-btn {
  background: #0f172a;
  border-color: #334155;
}

@media (max-width: 575.98px) {
  .counter-list {
    grid-template-columns: 1fr;
  }
}
