* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  overflow: hidden;
}

.container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  width: 320px;
  background: rgba(26, 26, 26, 0.8);
  backdrop-filter: blur(5px);
  border-right: 1px solid #333;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition:
    transform 0.3s ease,
    margin-left 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
  margin-left: -320px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.sidebar h1 {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.sidebar h2 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.sidebar h3 {
  font-size: 14px;
  font-weight: 600;
  color: #999;
  margin-bottom: 8px;
}

/* Upload Section */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.upload-area {
  border: 2px dashed #444;
  border-radius: 8px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #0f0f0f;
}

.upload-area:hover {
  border-color: #666;
  background: #151515;
}

.upload-area.dragging {
  border-color: #4a9eff;
  background: #1a2a3a;
}

.upload-area svg {
  margin: 0 auto 12px;
  color: #666;
}

.upload-area p {
  font-size: 14px;
  color: #999;
  margin: 4px 0;
}

.upload-hint {
  font-size: 12px;
  color: #666;
}

/* Buttons */
.btn-primary,
.btn-import,
.btn-zoom,
.btn-close,
.btn-collapse,
.btn-expand {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #4a9eff;
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: #3a8eef;
}

.btn-import {
  background: #2a2a2a;
  color: #e0e0e0;
  width: 100%;
}

.btn-import:hover {
  background: #333;
}

.btn-zoom {
  background: #2a2a2a;
  color: #e0e0e0;
  flex: 1;
  padding: 8px;
}

.btn-zoom:hover {
  background: #333;
}

.btn-close {
  background: #d94040;
  color: #fff;
  margin-top: 12px;
}

.btn-close:hover {
  background: #c93030;
}

.btn-collapse {
  background: #2a2a2a;
  color: #e0e0e0;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-collapse:hover {
  background: #333;
}

.btn-expand {
  position: absolute;
  top: 24px;
  left: 24px;
  background: #1a1a1a;
  color: #e0e0e0;
  padding: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border: 1px solid #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.btn-expand:hover {
  background: #2a2a2a;
}

/* Controls Section */
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #ccc;
}

.control-value {
  color: #4a9eff;
  font-weight: 600;
}

.control-hint {
  font-size: 12px;
  color: #666;
  margin-top: -4px;
}

/* Sliders */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #2a2a2a;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4a9eff;
  cursor: pointer;
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #3a8eef;
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4a9eff;
  cursor: pointer;
  border: none;
}

/* Zoom Controls */
.zoom-controls {
  display: flex;
  gap: 8px;
}

/* Playback Controls */
.playback-controls {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.btn-play-pause {
  background: #2a2a2a;
  color: #e0e0e0;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.btn-play-pause:hover {
  background: #333;
}

.btn-play-pause svg {
  display: block;
}

/* Info Section */
.info-section {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid #333;
}

.info-section ol {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
  padding-left: 20px;
}

.info-section li {
  margin: 4px 0;
}

/* Canvas Area */
.canvas-area {
  flex: 1;
  display: grid;
  place-items: center;
  background: #0a0a0a;
  position: relative;
  overflow: auto;
  cursor: grab;
  padding: 50px;
}

.canvas-area.dragging {
  cursor: grabbing;
}

.canvas-area.panning {
  user-select: none;
}

#mainCanvas {
  image-rendering: crisp-edges;
  display: block;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 10, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid #2a2a2a;
  border-top-color: #4a9eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay p {
  font-size: 14px;
  color: #999;
}

/* Error Message */
.error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #2a1a1a;
  border: 1px solid #d94040;
  border-radius: 8px;
  padding: 24px;
  max-width: 400px;
  text-align: center;
  z-index: 101;
}

.error-message p {
  font-size: 14px;
  color: #ff6b6b;
  margin-bottom: 8px;
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #0f0f0f;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    max-height: 50vh;
  }

  .canvas-area {
    height: 50vh;
  }
}
