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

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #1a1a1a;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  touch-action: none;
}

canvas {
  display: block;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

/* 情報パネル */
.info-panel {
  position: fixed;
  right: 20px;
  bottom: 40px;
  background: rgba(30, 30, 30, 0.95);
  border: 2px solid #444;
  border-radius: 12px;
  padding: 16px;
  color: #fff;
  font-size: 14px;
  min-width: 200px;
  max-width: 220px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

/* 画面幅が狭い時の対応 */
@media (max-width: 768px) or (max-height: 600px) {
  .info-panel {
    right: 10px;
    bottom: 50px;
    min-width: 160px;
    max-width: 180px;
    padding: 12px;
    font-size: 12px;
  }
}

#resetBtn {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  background: #4a90e2;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

#resetBtn:hover {
  background: #357abd;
}

#resetBtn:active {
  background: #2d6aa3;
}

.norm-switch {
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(74, 144, 226, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(74, 144, 226, 0.3);
}

.norm-switch label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 12px;
  color: #ccc;
}

.norm-switch input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.norm-switch span {
  user-select: none;
}

.displacement-info {
  margin-top: 8px;
}

.info-label {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #4a90e2;
  text-align: center;
  border-bottom: 1px solid #444;
  padding-bottom: 6px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #333;
}

.info-row:last-child {
  border-bottom: none;
}

.info-key {
  font-weight: 600;
  color: #aaa;
}

.info-value {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
}

.info-value.blue {
  color: #4a90e2;
}

.info-value.green {
  color: #50c878;
}

.displacement-info + .displacement-info {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #444;
}

/* 履歴セクション */
.history-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #444;
}

.history-count {
  font-size: 12px;
  color: #888;
  font-weight: normal;
}

.history-list {
  height: 90px;
  overflow-y: auto;
  margin-top: 8px;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
  background: #666;
}

.history-item {
  padding: 6px 8px;
  margin: 4px 0;
  background: rgba(74, 144, 226, 0.1);
  border-left: 3px solid #4a90e2;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
}

.history-empty {
  padding: 12px;
  text-align: center;
  color: #666;
  font-size: 12px;
  font-style: italic;
}

.history-item .history-number {
  color: #4a90e2;
  font-weight: bold;
  margin-right: 4px;
}

.history-item .history-data {
  color: #ccc;
}

/* 説明バナー */
.instruction-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  z-index: 500;
  border-top: 2px solid #4a90e2;
  animation: slideUp 0.4s ease;
}

.instruction-banner.hidden {
  animation: slideDown 0.4s ease;
  transform: translateY(100%);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

.instruction-text {
  color: #fff;
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}

.instruction-text .separator {
  margin: 0 12px;
  color: #666;
}

.instruction-text .icon-red {
  color: #ff6b6b;
  font-weight: bold;
}

.instruction-text .icon-green {
  color: #50c878;
  font-weight: bold;
  letter-spacing: 2px;
}

.instruction-text .icon-blue {
  color: #4a90e2;
  font-weight: bold;
  font-size: 16px;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .instruction-banner {
    padding: 10px 15px;
  }
  
  .instruction-text {
    font-size: 11px;
  }
  
  .instruction-text .separator {
    margin: 0 8px;
  }
  


/* スクリーンショットボタン */
.screenshot-btn {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 50px;
  height: 50px;
  background: rgba(74, 144, 226, 0.9);
  border: 2px solid #4a90e2;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.screenshot-btn:hover {
  background: rgba(74, 144, 226, 1);
  transform: scale(1.05);
}

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

.screenshot-btn svg {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

@media (max-width: 768px) {
  .screenshot-btn {
    left: 10px;
    bottom: 10px;
    width: 45px;
    height: 45px;
  }
  
  .screenshot-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* 最終更新表示 */
.last-updated {
  position: fixed;
  right: 12px;
  bottom: 12px;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  user-select: none;
  pointer-events: none;
  z-index: 2;
}
