*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Arial, sans-serif;
  background: #1a1a1a;
  color: #f0f0ee;
  line-height: 1.5;
  padding: 24px 16px 60px;
}
.container { max-width: 1100px; margin: 0 auto; }

header { margin-bottom: 18px; }
h1 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 6px; font-weight: 600; color: #f0f0ee; }
.subtitle { color: #b0b0ad; font-size: 14px; margin: 0; max-width: 720px; }

.info-banner {
  background: #262624;
  border: 1px solid #3a3a36;
  border-left: 3px solid #ffaa00;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 22px;
  font-size: 13px;
  color: #d0d0cd;
}
.info-banner strong { color: #ffaa00; font-weight: 600; }

.metals-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.metal-btn {
  background: #262624;
  border: 1px solid #3a3a36;
  border-radius: 8px;
  padding: 14px 8px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.metal-btn:hover { transform: translateY(-2px); border-color: #ffaa00; }
.metal-btn.selected { background: #3a2d10; border-color: #ffaa00; }
.metal-sym {
  font-size: 22px;
  font-weight: 600;
  color: #f0f0ee;
  line-height: 1;
}
.metal-name {
  font-size: 11px;
  color: #b0b0ad;
  font-weight: 500;
}
.metal-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 2px;
  border: 1px solid rgba(255,255,255,0.2);
}

.lab-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (min-width: 720px) {
  .lab-area { grid-template-columns: 320px 1fr; }
}

.flame-container {
  background: #0d0d0d;
  border: 1px solid #3a3a36;
  border-radius: 10px;
  padding: 24px 20px;
  height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.bunsen {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}
.bunsen-body {
  width: 28px;
  height: 100px;
  background: linear-gradient(to right, #4a4a48, #6a6a68, #4a4a48);
  border-radius: 2px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}
.bunsen-base {
  width: 80px;
  height: 14px;
  background: linear-gradient(to bottom, #4a4a48, #2a2a28);
  border-radius: 4px 4px 8px 8px;
  margin-top: -2px;
}

.flame {
  width: 50px;
  height: 0;
  position: relative;
  margin-bottom: -8px;
  transition: height 0.6s ease, opacity 0.4s;
  opacity: 0;
}
.flame.lit {
  height: 130px;
  opacity: 1;
}

.flame-inner {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 100%;
  background: radial-gradient(ellipse at 50% 80%,
    var(--flame-color, #ff8c00) 0%,
    var(--flame-color, #ff8c00) 30%,
    rgba(255,140,0,0.7) 60%,
    transparent 100%);
  border-radius: 50% 50% 30% 30% / 70% 70% 30% 30%;
  filter: blur(2px);
  animation: flicker 0.8s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

.flame-core {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 40px;
  background: radial-gradient(ellipse at 50% 80%,
    rgba(100, 150, 255, 0.9) 0%,
    rgba(50, 100, 200, 0.5) 50%,
    transparent 100%);
  border-radius: 50% 50% 30% 30% / 70% 70% 30% 30%;
  filter: blur(1px);
  mix-blend-mode: screen;
}

@keyframes flicker {
  0% { transform: translateX(-50%) scale(1, 1) rotate(-1deg); opacity: 0.95; }
  100% { transform: translateX(-50%) scale(1.05, 0.97) rotate(1deg); opacity: 1; }
}

.metal-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: #b0b0ad;
  font-weight: 500;
  background: rgba(0,0,0,0.4);
  padding: 4px 12px;
  border-radius: 12px;
}

.info-panel {
  background: #262624;
  border: 1px solid #3a3a36;
  border-radius: 10px;
  padding: 20px 22px;
  min-height: 360px;
}
.info-empty {
  color: #888780;
  font-style: italic;
  text-align: center;
  padding: 40px 0;
}
.info-title {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 600;
  color: #f0f0ee;
}
.info-color-name {
  font-size: 14px;
  color: #b0b0ad;
  margin-bottom: 14px;
  font-weight: 500;
}
.info-section {
  margin-bottom: 12px;
}
.info-label {
  font-size: 11px;
  color: #888780;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 4px;
}
.info-value {
  font-size: 14px;
  color: #d0d0cd;
  line-height: 1.6;
}

.spectrum-section {
  background: #262624;
  border: 1px solid #3a3a36;
  border-radius: 10px;
  padding: 20px 22px;
}
.spectrum-section h2 {
  font-size: 16px;
  margin: 0 0 14px;
  font-weight: 600;
  color: #f0f0ee;
}
.spectrum-bar {
  height: 50px;
  border-radius: 4px;
  background: linear-gradient(to right,
    #4a0e8e 0%,
    #1f1fb0 12%,
    #008b8b 30%,
    #00b050 45%,
    #d4d400 58%,
    #ff8800 75%,
    #d50000 100%
  );
  position: relative;
  margin-bottom: 6px;
  overflow: hidden;
}
.spectrum-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.spectrum-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 8px currentColor;
}
.spectrum-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #888780;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.lines-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.line-pill {
  background: #1a1a1a;
  border: 1px solid #3a3a36;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  color: #d0d0cd;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.line-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid #3a3a36;
  font-size: 12.5px;
  color: #888780;
  line-height: 1.6;
}
footer .brand { color: #f0f0ee; font-weight: 600; }
