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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-right: 16px;
  border-right: 1px solid #0f3460;
}

.toolbar-group:last-child {
  border-right: none;
}

.format-label {
  font-size: 14px;
  color: #eee;
  font-weight: 500;
}

.format-select {
  padding: 6px 12px;
  background: #0f3460;
  color: #eee;
  border: 1px solid #1a4a7e;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.format-select:hover {
  background: #1a4a7e;
}

.format-select:focus {
  border-color: #e94560;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: #e94560;
  color: white;
}

.btn-primary:hover {
  background: #ff6b6b;
}

.btn-secondary {
  background: #0f3460;
  color: #eee;
}

.btn-secondary:hover {
  background: #1a4a7e;
}

.btn-secondary.active {
  background: #e94560;
}

.btn-success {
  background: #06d6a0;
  color: #111;
}

.btn-success:hover {
  background: #37e5b5;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1a1a2e;
  overflow: hidden;
}

.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  padding: 20px;
  background: #0d0d1a;
  position: relative;
}

.canvas-scroll-area {
  overflow: auto;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-wrapper {
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

#editor-canvas {
  display: block;
  cursor: crosshair;
}

.zoom-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(22, 33, 62, 0.9);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}

.zoom-label {
  font-size: 12px;
  color: #aaa;
  min-width: 50px;
  text-align: center;
}

.property-panel {
  width: 320px;
  background: #16213e;
  border-left: 1px solid #0f3460;
  overflow-y: auto;
  padding: 16px;
}

.panel-section {
  margin-bottom: 20px;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.annotation-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.annotation-item {
  padding: 10px 12px;
  background: #0f3460;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.annotation-item:hover {
  background: #1a4a7e;
}

.annotation-item.selected {
  background: #e94560;
}

.annotation-type {
  font-size: 11px;
  color: #aaa;
}

.annotation-item.selected .annotation-type {
  color: #ffb3b3;
}

.delete-btn {
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.delete-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #ff6b6b;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #0f3460;
  border-radius: 6px;
  background: #0d0d1a;
  color: #eee;
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: #e94560;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

select.form-input {
  cursor: pointer;
}

input[type="color"] {
  padding: 2px;
  height: 36px;
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.info-text {
  font-size: 12px;
  color: #666;
  padding: 12px;
  background: #0d0d1a;
  border-radius: 6px;
  text-align: center;
}

.preview-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #0f3460;
}

.format-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.format-btn {
  padding: 8px;
  font-size: 11px;
  text-align: center;
}

.drop-zone {
  border: 2px dashed #0f3460;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  transition: all 0.2s;
}

.drop-zone.drag-over {
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.drop-zone-text {
  color: #888;
  margin-bottom: 8px;
}

.hidden-input {
  display: none;
}

.depth-indicator {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.7);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
}

.status-dot.connected {
  background: #06d6a0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* プレビューウィンドウ用スタイル */
.preview-window {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #000;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
}

.preview-title {
  font-weight: 600;
}

.preview-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.preview-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #000;
  position: relative;
}

.preview-canvas {
  display: block;
}

.waiting-message {
  text-align: center;
  color: #666;
}

.waiting-message .icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.fullscreen-btn {
  padding: 8px 12px;
}

.preview-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #16213e;
  border-top: 1px solid #0f3460;
  flex-wrap: wrap;
}

.preview-window.fullscreen-mode {
  background: #000;
}

.preview-window.fullscreen-mode .preview-header,
.preview-window.fullscreen-mode .preview-footer {
  display: none;
}

.preview-window.fullscreen-mode .preview-content {
  width: 100vw;
  height: 100vh;
  padding: 0;
}

.format-btn.anaglyph {
  background: linear-gradient(90deg, #ff0000 0%, #ff0000 50%, #00ffff 50%, #00ffff 100%);
  color: #000;
  font-weight: bold;
}

.format-btn.anaglyph.active {
  box-shadow: 0 0 0 2px #fff;
}
