:root {
  --bg: #000;
  --panel: #000;
  --text: #fff;
  --accent: #aaf;
  --border: #aab;
}

body {
  margin: 0;
  font-family: sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

main {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 300px;
  background: var(--panel);
  padding: 20px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.board-section {
  flex: 1;
  position: relative;
  background: #0f172a;
  min-width: 0;
  overflow: auto;
}

#board {
  position: relative;
  width: 1080px;
  height: 930px;
  flex: none;
  transition: transform 0.1s ease-out; /* ズームを滑らかにする */
  will-change: transform;
}

#bond-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* style.css の修正 */
.atom {
  position: absolute;
  border-radius: 50%;
  /* 透過を禁止し、背景を不透明にする */
  opacity: 1 !important;
  background-color: #888888;
  /* デフォルトの背景色 */

  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.5rem;
  -webkit-text-stroke: 0.5px #000000;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  /* 結合線(Canvas)より上に表示 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  /* 立体感を出して重なりを明確にする */
  border: 2px solid rgba(255, 255, 255, 0.2);
  /* 境界線をはっきりさせる */


  touch-action: none; /* ブラウザ標準のスクロールやズームをこの要素上で無効化 */
  user-select: none;  /* テキスト選択を防ぐ */
  cursor: pointer;
  padding: 0;
}

.atom-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.atom-label .symbol {
  font-size: 1.1em;
}

.atom-label .bond-status {
  font-size: 0.65em;
}

.cell-number {
  position: absolute;
  top: 2px;
  right: 5px;
  font-size: 10px;
  line-height: 1;
  opacity: 0.8;
}

.coordinate-hint {
  color: #aaa;
  font-size: 0.85rem;
  line-height: 1.5;
}


/* 各元素ごとの色も不透明な色を指定 */
.atom.h {
  background-color: #ffffff;
}

.atom.c {
  background-color: #000000;
}

/* 濃い色 */
.atom.o {
  background-color: #ff0d0d;
}

.atom.n {
  background-color: #3050f8;
}

.atom.s {
  background-color: #ffff30;
}

/* 選択中のハイライトも不透明に */
.atom.selected {
  outline: 4px solid var(--accent);
  z-index: 20;
  /* 選択中の原子を最前面に */
}

#board.move-mode .atom {
  cursor: grab;
}

#board.move-mode .atom:active {
  cursor: grabbing;
}

.element-button {
  width: 100%;
  background: #374151;
  border: 1px solid var(--border);
  color: white;
  padding: 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.element-button.active {
  border-color: var(--accent);
  background: #4b5563;
}

.mode-button,
.bond-order-button,
#repair-board,
#clear-board {
  padding: 8px 12px;
  background: #374151;
  border: 1px solid var(--border);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  margin: 2px;
}

.mode-button.active,
.bond-order-button.active {
  background: var(--accent);
  color: #0f172a;
}

/* 消すボタン用のスタイル */
#mode-delete.active {
  background-color: #ef4444; /* 赤色 */
  border-color: #f87171;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* 消去モード時に原子にマウスを乗せた時の演出 */
.board-section.mode-delete .atom:hover {
  cursor: pointer;
  filter: brightness(1.2) saturate(1.5);
  box-shadow: 0 0 15px #ef4444;
}

.panel {
  margin-bottom: 24px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--accent);
}


.grid-highlight {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  /* 中心合わせ */
  opacity: 0.4;
  pointer-events: none;
  /* クリックを透過させる */
  z-index: 5;
  box-shadow: 0 0 10px var(--accent);
  animation: pulse-guide 1.5s infinite;
}


/* モーダル外側のオーバーレイ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

/* ダイアログ本体 */
.modal-content {
  background: var(--panel);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--accent);
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  min-width: 300px;
}


.modal-content h2 {
  color: var(--accent);
  margin-top: 0;
}

#modal-status {
  margin: 20px 0;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}
#modal-status sub {
  font-size: 0.6em;
  vertical-align: sub;
  margin-left: 1px;
  color: var(--accent);
}


@keyframes pulse-guide {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.2;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.5;
  }

  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.2;
  }



  
}