.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  background: #1a1a1f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewport-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border-default);
  flex-shrink: 0;
  gap: 8px;
  z-index: 10;
}

.viewport-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.viewport-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.viewport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.viewport-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  border-color: var(--color-border-hover);
}

.viewport-btn.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

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

.viewport-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border-default);
  margin: 0 4px;
}

.viewport-canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  background: #1a1a1f;
  user-select: none;
}

.viewport-canvas:active {
  cursor: grabbing;
}

.viewport-stats {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-family-mono);
  font-size: 11px;
  pointer-events: none;
  z-index: 5;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.viewport-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.viewport-stat-label {
  color: var(--color-text-secondary);
  font-weight: 500;
}

.viewport-stat-value {
  color: var(--color-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.viewport:fullscreen {
  background: #000;
}

.viewport:fullscreen .viewport-canvas {
  background: #000;
}

.viewport-canvas:focus {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .viewport-btn {
    transition: none;
  }
}
