* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: 'Outfit', -apple-system, sans-serif;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #030508;
  color: #f0f4f8;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* --- Glassmorphism UI --- */
.glass-card {
  background: rgba(12, 18, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 255, 255, 0.1);
}

.glass-panel {
  background: rgba(10, 15, 25, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Start Screen Overlay --- */
#instructions {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  background: radial-gradient(circle at center, rgba(5, 10, 20, 0.7) 0%, rgba(2, 4, 8, 0.95) 100%);
}

.content {
  padding: 40px 50px;
  max-width: 540px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.badge {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  color: #030a16;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 20px;
  text-transform: uppercase;
}

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 0%, #a5c0ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: #94a3b8;
  font-size: 1rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin: 10px 0;
}

.feature-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  text-align: center;
}

.feature-item .icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 4px;
}

.glow-btn {
  background: linear-gradient(135deg, #00f2fe 0%, #0066ff 100%);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4);
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.glow-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 35px rgba(0, 242, 254, 0.6);
}

.controls-hint {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 5px;
}

.controls-hint strong {
  color: #cbd5e1;
}

/* --- HUD Container --- */
.hud-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  grid-template-rows: auto 1fr auto;
  padding: 16px;
  gap: 16px;
}

.hud-container.hidden {
  display: none !important;
}

.hud-container * {
  pointer-events: auto;
}

/* --- Top Bar --- */
.top-bar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: #00ffcc;
  border-radius: 50%;
  box-shadow: 0 0 10px #00ffcc;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.app-title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #00f2fe;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: rgba(0, 242, 254, 0.15);
  color: #00f2fe;
  border: 1px solid rgba(0, 242, 254, 0.3);
}

.hud-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hud-action-btn:hover, .hud-action-btn.active {
  background: #ff0055;
  border-color: #ff0055;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

/* --- Controls Panel (Left) --- */
.side-panel {
  grid-column: 1;
  grid-row: 2;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

.side-panel h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #38bdf8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.glass-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 6px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.glass-select option {
  background: #0f172a;
  color: #fff;
}

.control-group label {
  font-size: 0.82rem;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
}

.control-group label span {
  color: #38bdf8;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

input[type=range] {
  width: 100%;
  accent-color: #00f2fe;
  cursor: pointer;
}

.color-picker {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px currentColor;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: #cbd5e1;
  cursor: pointer;
}

/* --- Stats Panel (Right) --- */
.stats-panel {
  grid-column: 3;
  grid-row: 2;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
}

.stats-header {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00ffcc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
}

.stat-label {
  color: #94a3b8;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #f1f5f9;
}

.stat-value.highlight {
  color: #00f2fe;
}

.formula-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 242, 254, 0.2);
  border-radius: 10px;
  padding: 12px;
  margin-top: 6px;
}

.formula-title {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: #64748b;
  margin-bottom: 4px;
}

.formula-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #00f2fe;
}

/* --- Bottom Bar --- */
.bottom-bar {
  grid-column: 1 / -1;
  grid-row: 3;
  padding: 10px 20px;
  font-size: 0.88rem;
  color: #e2e8f0;
  text-align: center;
}
