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

body {
  font-family: 'メイリオ', Meiryo, sans-serif;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ヘッダー */
.editor-header {
  background: linear-gradient(180deg, #4a90e2 0%, #357abd 100%);
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.editor-header h1 {
  font-size: 20px;
  font-weight: bold;
}

.header-buttons {
  display: flex;
  gap: 12px;
}

.header-btn {
  background: white;
  color: #357abd;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.header-btn:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.header-btn:active {
  transform: translateY(0);
}

/* エディターコンテナ */
.editor-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* サイドバー */
.sidebar {
  width: 160px;
  background: #5a5a5a;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.2);
}

.sidebar-tabs {
  display: flex;
  background: #4a4a4a;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  background: #4a4a4a;
  color: #aaa;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  background: #555;
  color: white;
}

.tab-btn.active {
  background: #5a5a5a;
  color: white;
  border-bottom: 3px solid #4a90e2;
}

/* タブコンテンツ */
.tab-content {
  display: none;
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}

.tab-content.active {
  display: block;
}

/* チップグリッド */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.chip-item {
  background: #4a4a4a;
  border: 2px solid #4a4a4a;
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-item:hover {
  background: #555;
  border-color: #666;
}

.chip-item.selected {
  border-color: #4a90e2;
  background: #555;
  box-shadow: 0 0 8px rgba(74, 144, 226, 0.5);
}

.chip-item img {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  display: block;
}

.chip-item .item-sprite {
  width: 37px;
  height: 37px;
  image-rendering: pixelated;
  display: block;
  background-image: url('../editor_images/item_chips.png');
  background-size: 148px 148px; /* 128px * (37/32) = 148px */
}

/* キャンバスエリア */
.canvas-area {
  flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
}

#map-canvas {
  background: #000;
  cursor: crosshair;
  image-rendering: pixelated;
}

/* カスタムドラッグプレビュー */
.custom-drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  display: none;
}

.custom-drag-preview.active {
  display: block;
}

.custom-drag-preview img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.custom-drag-preview .drag-delete-marker {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #f44336;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.custom-drag-preview.show-delete-marker .drag-delete-marker {
  display: flex;
}

/* スクロールバーのスタイル */
.tab-content::-webkit-scrollbar,
.canvas-area::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tab-content::-webkit-scrollbar-track,
.canvas-area::-webkit-scrollbar-track {
  background: #3a3a3a;
}

.tab-content::-webkit-scrollbar-thumb,
.canvas-area::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 4px;
}

.tab-content::-webkit-scrollbar-thumb:hover,
.canvas-area::-webkit-scrollbar-thumb:hover {
  background: #777;
}
