/* Particle Physics Sandbox — Dark theme */

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

body {
  background: #0a0a12;
  color: #d0d0e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ===== HUD (top center) ===== */

.hud {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  background: #12121ecc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #ffffff12;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 13px;
  font-family: 'Consolas', 'Monaco', monospace;
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-label {
  color: #666680;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-value {
  color: #c0c0e0;
  font-weight: 600;
}

.hud-value.time-paused {
  color: #ff6644;
}

/* ===== Left Panel — Particles + Tools ===== */

.left-panel {
  position: fixed;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.panel-section {
  background: #12121ecc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #ffffff12;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555570;
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px solid #ffffff08;
  margin-bottom: 2px;
}

/* Particle selector buttons */

.particle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a2a;
  border: 1px solid #ffffff0a;
  border-radius: 6px;
  padding: 6px 10px;
  color: #b0b0c0;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  min-width: 90px;
}

.particle-btn:hover {
  background: #222240;
  border-color: #ffffff20;
}

.particle-btn.active {
  background: #2a2a50;
  border-color: #ffffff30;
  color: #fff;
  box-shadow: 0 0 12px #ffffff10;
}

.particle-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.particle-label {
  flex: 1;
  font-family: 'Consolas', monospace;
}

.particle-key {
  font-size: 10px;
  color: #555570;
  background: #ffffff08;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Tool buttons */

.tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a2a;
  border: 1px solid #ffffff0a;
  border-radius: 6px;
  padding: 6px 10px;
  color: #b0b0c0;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  min-width: 90px;
}

.tool-btn:hover {
  background: #222240;
  border-color: #ffffff20;
}

.tool-btn.active {
  background: #2a2a50;
  border-color: #ffffff30;
  color: #fff;
  box-shadow: 0 0 12px #ffffff10;
}

.tool-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.tool-label {
  flex: 1;
  font-size: 12px;
}

.tool-key {
  font-size: 10px;
  color: #555570;
  background: #ffffff08;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ===== Time Controls (bottom center) ===== */

.time-controls {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: #12121ecc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #ffffff12;
  border-radius: 10px;
  padding: 6px 12px;
  z-index: 10;
  align-items: center;
}

.time-btn {
  background: #1a1a2a;
  border: 1px solid #ffffff0a;
  border-radius: 6px;
  padding: 6px 12px;
  color: #b0b0c0;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  line-height: 1;
}

.time-btn:hover {
  background: #222240;
  color: #fff;
}

.time-label {
  font-size: 11px;
  color: #555570;
  padding: 0 8px;
  font-family: monospace;
}

.clear-btn {
  background: #2a1a1a;
  border: 1px solid #ff444420;
  border-radius: 6px;
  padding: 6px 12px;
  color: #ff6644;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  margin-left: 8px;
}

.clear-btn:hover {
  background: #3a2020;
  border-color: #ff444444;
}

/* ===== Right Panel — Action Buttons ===== */

.right-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.action-btn {
  background: #12121ecc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #ffffff12;
  border-radius: 8px;
  padding: 8px 14px;
  color: #8888a0;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.action-btn:hover {
  background: #1a1a30cc;
  color: #c0c0e0;
  border-color: #ffffff20;
}

.action-btn .badge {
  background: #ffffff15;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-family: monospace;
}

/* ===== Discovery Notifications ===== */

.discovery-notifications {
  position: fixed;
  bottom: 60px;
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.discovery-notif {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a2eee;
  backdrop-filter: blur(10px);
  border: 1px solid #ffdd4444;
  border-radius: 10px;
  padding: 12px 16px;
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px #ffdd4422;
  min-width: 260px;
}

.discovery-notif.visible {
  transform: translateX(0);
  opacity: 1;
}

.discovery-notif-icon {
  font-size: 28px;
  line-height: 1;
}

.discovery-notif-title {
  font-weight: 700;
  font-size: 14px;
  color: #ffdd88;
}

.discovery-notif-desc {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

/* ===== Slide Panels (Help, Discoveries, Settings) ===== */

.slide-panel {
  position: fixed;
  top: 60px;
  right: 12px;
  width: 320px;
  max-height: calc(100vh - 120px);
  background: #12121eee;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid #ffffff15;
  border-radius: 12px;
  padding: 20px;
  z-index: 30;
  overflow-y: auto;
  transform: translateX(calc(100% + 20px));
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.slide-panel.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.slide-panel h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.panel-close:hover {
  color: #fff;
}

/* Help panel */

.help-section {
  margin-bottom: 16px;
}

.help-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666680;
  margin-bottom: 8px;
}

.help-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 13px;
}

.help-key {
  font-family: monospace;
  background: #ffffff10;
  padding: 1px 6px;
  border-radius: 3px;
  color: #aaa;
  font-size: 11px;
}

/* Discovery list */

.discovery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  background: #ffffff05;
  opacity: 0.4;
}

.discovery-item.unlocked {
  opacity: 1;
  background: #ffffff0a;
}

.discovery-icon {
  font-size: 22px;
  width: 30px;
  text-align: center;
}

.discovery-name {
  font-weight: 600;
  font-size: 13px;
}

.discovery-desc {
  font-size: 11px;
  color: #777;
}

/* Settings */

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #ffffff08;
}

.setting-row label {
  font-size: 13px;
}

.setting-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4488ff;
  cursor: pointer;
}

.setting-row input[type="range"] {
  width: 100px;
  accent-color: #4488ff;
  cursor: pointer;
}

/* ===== Scrollbar ===== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ffffff20;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ffffff40;
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  canvas {
    max-width: 100%;
  }

  .hud {
    gap: 10px;
    padding: 6px 12px;
    font-size: 11px;
  }

  .left-panel {
    position: fixed;
    top: auto;
    bottom: 60px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    flex-direction: row;
    width: auto;
    max-width: calc(100vw - 24px);
  }

  .panel-section {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .particle-btn, .tool-btn {
    min-width: auto;
    min-height: 44px;
    padding: 6px 10px;
  }

  .particle-label, .tool-label {
    display: none;
  }

  .particle-key, .tool-key {
    display: none;
  }

  .right-panel {
    top: auto;
    bottom: 12px;
    right: 12px;
  }

  .action-btn {
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
  }

  .time-controls {
    bottom: 12px;
    left: 12px;
    transform: none;
    right: auto;
  }

  .time-btn, .clear-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .slide-panel {
    width: calc(100vw - 24px);
    top: 60px;
    right: 12px;
    max-height: calc(100vh - 80px);
  }

  .panel-close {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .setting-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  .discovery-notifications {
    right: 12px;
    left: 12px;
    bottom: 70px;
  }

  .discovery-notif {
    min-width: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  canvas {
    max-width: 100%;
  }

  .hud {
    gap: 6px;
    padding: 4px 8px;
    font-size: 10px;
    width: calc(100vw - 24px);
    justify-content: center;
    flex-wrap: wrap;
  }

  .hud-label {
    font-size: 8px;
  }

  .left-panel {
    bottom: 56px;
    flex-direction: column;
    align-items: center;
    max-width: calc(100vw - 24px);
  }

  .panel-section {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 6px;
    gap: 4px;
  }

  .panel-title {
    display: none;
  }

  .particle-btn, .tool-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px;
    justify-content: center;
  }

  .particle-dot {
    width: 14px;
    height: 14px;
  }

  .tool-icon {
    font-size: 18px;
  }

  .right-panel {
    top: auto;
    bottom: 12px;
    right: 12px;
    gap: 4px;
  }

  .action-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 6px 8px;
    font-size: 12px;
    justify-content: center;
  }

  .action-btn .badge {
    display: none;
  }

  .time-controls {
    bottom: 12px;
    left: 12px;
    transform: none;
    padding: 4px 8px;
    gap: 4px;
  }

  .time-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 4px 8px;
    font-size: 14px;
  }

  .time-label {
    display: none;
  }

  .clear-btn {
    min-height: 44px;
    padding: 4px 10px;
    margin-left: 4px;
  }

  .slide-panel {
    width: calc(100vw - 16px);
    right: 8px;
    top: 50px;
    max-height: calc(100vh - 60px);
    padding: 14px;
  }

  .slide-panel h2 {
    font-size: 14px;
  }

  .help-row {
    font-size: 12px;
  }

  .discovery-notifications {
    right: 8px;
    left: 8px;
    bottom: 64px;
  }
}
