* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 104px 20px 20px; /* 48px共通ヘッダー + 56pxツールヘッダー */
}

/* Controls bar */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

#controls .separator {
  width: 1px;
  height: 28px;
  background: #ccc;
  margin: 0 4px;
}

#controls select,
#controls button {
  font-size: 0.85rem;
  padding: 6px 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

#controls select:hover,
#controls button:hover {
  border-color: #888;
  background: #f0f0f0;
}

#controls button.active {
  background: #333;
  color: #fff;
  border-color: #333;
}

#controls button.active:hover {
  background: #555;
}

.controls-hint {
  font-size: 0.7rem;
  color: #aaa;
}

#csv-btn {
  background: #e8f4e8 !important;
  border-color: #6a6 !important;
  color: #363 !important;
}
#csv-btn:hover {
  background: #d0ecd0 !important;
}

.help-tip {
  font-size: 0.75rem;
  color: #888;
  cursor: help;
  position: relative;
}
.help-tip:hover .help-tooltip {
  display: block;
}
.help-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-line;
  width: 320px;
  z-index: 100;
  margin-bottom: 6px;
  pointer-events: none;
}

/* Chart container */
#chart-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 400px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  overflow: hidden;
}

#chart-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#chart-container.dragover {
  outline: 3px dashed #6a6;
  outline-offset: -3px;
}

/* Axis labels */
.axis-label {
  position: absolute;
  font-size: 0.7rem;
  color: #666;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.1s;
}
.axis-label.vertical {
  writing-mode: vertical-rl;
  white-space: nowrap;
  font-size: 0.6rem;
}
.axis-label.title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #444;
}

/* Legend */
#legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: #666;
}
#legend canvas {
  border-radius: 3px;
  border: 1px solid #ddd;
}
#legend .legend-label {
  min-width: 30px;
}

/* Data info */
#data-info {
  font-size: 0.75rem;
  color: #999;
  margin-top: 8px;
}

/* Drop overlay */
#drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(106,170,106,0.15);
  z-index: 50;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #363;
  font-weight: 600;
}

#chart-container.dragover #drop-overlay {
  display: flex;
}

/* Share button */
.share-section {
  text-align: center;
  margin-top: 24px;
}
.share-section button {
  padding: 10px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.share-section button:hover {
  background: #555;
}

/* Site links */
.site-links {
  text-align: center;
  margin-top: 32px;
  padding: 16px 0;
  font-size: 0.8rem;
  color: #999;
}
.site-links a {
  color: #888;
  text-decoration: none;
}
.site-links a:hover {
  color: #555;
  text-decoration: underline;
}
.site-links span {
  margin: 0 6px;
  color: #ccc;
}

/* Responsive */
@media (max-width: 640px) {
  #app { padding: 12px; }
  h1 { font-size: 1.2rem; }
  #controls { gap: 4px; }
  #controls select, #controls button { font-size: 0.75rem; padding: 5px 10px; }
  #chart-container { aspect-ratio: 4 / 3; min-height: 300px; }
}
