/* ===== Variables — thème clair ===== */
:root {
  --bg:      #f0f4f8;
  --bg2:     #ffffff;
  --glass:   rgba(255, 255, 255, 0.93);
  --border:  rgba(51, 65, 85, 0.15);
  --text:    #1e293b;
  --text-muted: #64748b;
  --accent:  #2563eb;
  --accent2: #4f46e5;
  --shadow:  rgba(0, 0, 0, 0.10);
  --radius:  14px;
  --topbar-h: 52px;
  --font: 'Outfit', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px var(--shadow);
}

.top-bar-left { flex: 1; min-width: 0; }
.top-bar-controls { display: flex; gap: 5px; flex-wrap: wrap; }
.top-bar-right { margin-left: auto; }

.sim-title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#canvas-container { position: relative; flex: 1; overflow: hidden; }

#nz-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  outline: none;
}

/* ===== Boutons ===== */
.ctrl-btn {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.ctrl-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.ctrl-btn.active {
  background: #dbeafe;
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.close-btn {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color .12s, background .12s;
}
.close-btn:hover { color: var(--text); background: #e2e8f0; }

.coord-display {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Panneaux vitrés (fond clair) ===== */
.glass-panel {
  position: absolute;
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px var(--shadow);
  z-index: 20;
  padding: 18px 20px;
  overflow-y: auto;
}

/* ===== Panneau info nucléide ===== */
#info-panel {
  top: 66px;
  right: 14px;
  width: 274px;
  max-height: calc(100dvh - 86px);
}

.nuclide-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-right: 28px;
}

.nuclide-notation {
  font-size: 1.85rem;
  font-weight: 700;
  font-family: Georgia, serif;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.nuclide-name { font-size: 0.9rem; color: var(--text-muted); }

.info-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.info-label { color: var(--text-muted); font-size: 0.84rem; }
.info-value { font-weight: 600; font-size: 0.93rem; color: var(--text); }

.info-equation-section { margin-bottom: 10px; }
.info-equation-section .info-label { margin-bottom: 5px; display: block; }

.equation-display {
  background: rgba(241,245,249,0.8);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-family: Georgia, serif;
  font-size: 0.97rem;
  color: var(--text);
  text-align: center;
  line-height: 1.6;
  word-break: break-word;
}

.chain-hint {
  font-size: 0.77rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 5px;
}

/* ===== Panneau légende ===== */
#legend-panel {
  bottom: 14px;
  left: 14px;
  width: 296px;
  max-height: calc(100dvh - 86px);
}

.legend-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 9px;
  padding-right: 28px;
}

.legend-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }

.legend-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.87rem;
  color: var(--text);
}

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.12);
}

.legend-note {
  font-size: 0.81rem;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

.help-list .key {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  padding: 1px 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== Toast ===== */
.toast {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.92);
  border-radius: 9px;
  padding: 7px 16px;
  font-size: 0.87rem;
  color: #fff;
  pointer-events: none;
  z-index: 30;
  animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
  0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
  #info-panel {
    top: auto; right: 0; bottom: 0; left: 0;
    width: 100%; max-height: 46dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }
  #legend-panel {
    bottom: 0; left: 0; right: 0;
    width: 100%; max-height: 46dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
  }
  .sim-title { font-size: 0.85rem; }
  .ctrl-btn  { padding: 4px 7px; font-size: 12px; }
  #top-bar   { height: auto; padding: 7px 10px; }
}
