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

:root {
  --orange-primary: #FF6B35;
  --red-deep: #D32F2F;
  --yellow-golden: #FFB347;
  --charcoal-dark: #1a1a2e;
  --charcoal-medium: #252538;
  --charcoal-light: #2e2e45;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--charcoal-dark);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-container {
  min-height: 100vh;
  transition: background 1s ease;
  position: relative;
}

/* Particles */
.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.particle {
  position: absolute;
  bottom: -20px;
  background: radial-gradient(circle, var(--orange-primary) 0%, var(--red-deep) 70%, transparent 100%);
  border-radius: 50%;
  animation: float-up 3s ease-out forwards;
  opacity: 0.7;
}

@keyframes float-up {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-100vh) scale(0.2);
    opacity: 0;
  }
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--orange-primary) 0%, var(--red-deep) 100%);
  padding: 1.5rem 1rem;
  text-align: center;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.header-title {
  font-size: 2.5rem;
  font-weight: 900;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  position: relative;
}

.shimmer-text {
  background: linear-gradient(90deg, #fff 0%, var(--yellow-golden) 50%, #fff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer-text 3s infinite;
}

@keyframes shimmer-text {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.header-tagline {
  font-size: 1rem;
  opacity: 0.9;
  margin-top: 0.5rem;
  font-weight: 600;
}

/* Main content */
.main-content {
  padding: 1.5rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 5;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--yellow-golden);
  margin-bottom: 1rem;
  text-align: center;
}

/* Gauge section */
.gauge-section {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  margin-bottom: 2rem;
}

.gauge-container {
  position: relative;
  width: 200px;
  height: 200px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.gauge-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-value {
  font-size: 2.5rem;
  font-weight: 900;
  display: block;
  transition: color 0.5s ease;
}

.gauge-label {
  font-size: 0.75rem;
  opacity: 0.7;
  font-weight: 600;
  letter-spacing: 0.1em;
}

/* Flames */
.flames-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.flame {
  position: absolute;
  width: 30px;
  background: linear-gradient(180deg, transparent 0%, var(--yellow-golden) 30%, var(--orange-primary) 60%, var(--red-deep) 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  filter: blur(2px);
  animation: flicker 0.5s ease-in-out infinite alternate;
  transform-origin: bottom center;
}

@keyframes flicker {
  0% {
    transform: scaleY(1) scaleX(1) translateY(0);
    opacity: 0.9;
  }
  100% {
    transform: scaleY(1.1) scaleX(0.9) translateY(-5px);
    opacity: 1;
  }
}

/* Heat mode cards */
.mode-section {
  margin-bottom: 2rem;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.heat-mode-card {
  background: var(--charcoal-medium);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.heat-mode-card:hover {
  background: var(--charcoal-light);
  transform: translateY(-2px);
}

.heat-mode-card.active {
  border-color: var(--orange-primary);
  box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
  background: linear-gradient(180deg, var(--charcoal-light) 0%, rgba(255, 107, 53, 0.1) 100%);
}

.heat-mode-icon {
  font-size: 1.75rem;
}

.heat-mode-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.heat-mode-desc {
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Control panel */
.control-section {
  margin-bottom: 2rem;
}

.control-panel {
  background: var(--charcoal-medium);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.ignite-btn {
  width: 100%;
  padding: 1.25rem 2rem;
  font-size: 1.5rem;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--orange-primary) 0%, var(--red-deep) 100%);
  color: #fff;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-family: 'Nunito', sans-serif;
}

.ignite-btn::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ignite-btn:hover::before {
  opacity: 1;
}

.ignite-btn.heating {
  animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 107, 53, 0.8), 0 0 60px rgba(211, 47, 47, 0.4);
  }
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--yellow-golden);
}

.heat-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--charcoal-light);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.heat-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow-golden) 0%, var(--orange-primary) 100%);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.5);
  cursor: pointer;
}

.slider-marks {
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
}

.mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--charcoal-light);
  transition: background 0.3s ease;
}

.mark.active {
  background: var(--orange-primary);
}

.thread-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.thread-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--charcoal-light);
  border-radius: 8px;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.4;
}

.thread-btn.active {
  border-color: var(--orange-primary);
  opacity: 1;
  animation: flame-icon 1s ease-in-out infinite alternate;
}

@keyframes flame-icon {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.options-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange-primary);
}

/* Metrics */
.metrics-section {
  margin-bottom: 2rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.metric-card {
  background: var(--charcoal-medium);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-card.full-width {
  grid-column: span 2;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--orange-primary);
}

.metric-label {
  font-size: 0.75rem;
  opacity: 0.6;
  font-weight: 600;
}

.fan-status {
  font-size: 1.25rem;
}

/* Achievements */
.achievements-section {
  margin-bottom: 2rem;
}

.achievements-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.achievement-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--charcoal-medium);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.achievement-badge.locked {
  opacity: 0.4;
  filter: grayscale(100%);
}

.achievement-badge.unlocked {
  border: 1px solid var(--yellow-golden);
  box-shadow: 0 0 10px rgba(255, 179, 71, 0.2);
}

.achievement-icon {
  font-size: 2rem;
}

.achievement-info {
  display: flex;
  flex-direction: column;
}

.achievement-name {
  font-weight: 700;
  color: var(--yellow-golden);
}

.achievement-desc {
  font-size: 0.8rem;
  opacity: 0.6;
}

.lifetime-stats {
  text-align: center;
  margin-top: 1rem;
  opacity: 0.7;
  font-size: 0.9rem;
}

/* Share button */
.share-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--orange-primary);
  border-radius: 12px;
  background: transparent;
  color: var(--orange-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 2rem;
  font-family: 'Nunito', sans-serif;
}

.share-btn:hover {
  background: var(--orange-primary);
  color: #fff;
}

/* Safety section */
.safety-section {
  margin-bottom: 2rem;
}

.safety-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--charcoal-medium);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
}

.arrow {
  transition: transform 0.3s ease;
}

.arrow.open {
  transform: rotate(180deg);
}

.safety-content {
  background: var(--charcoal-light);
  border-radius: 0 0 12px 12px;
  padding: 1rem;
  margin-top: -8px;
}

.safety-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.safety-content li {
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.9rem;
  opacity: 0.8;
}

.safety-content li::before {
  content: '🔥';
  position: absolute;
  left: 0;
}

/* Footer */
.footer {
  background: var(--charcoal-medium);
  padding: 2rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  z-index: 10;
}

.footer a {
  color: var(--orange-primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.3s ease;
}

.footer a:hover {
  color: var(--yellow-golden);
}

.disclaimer {
  font-size: 0.75rem;
  opacity: 0.5;
  max-width: 400px;
  margin: 0.5rem auto 0;
  line-height: 1.4;
}

/* Responsive */
@media (min-width: 640px) {
  .header-title {
    font-size: 3.5rem;
  }
  
  .gauge-container {
    width: 250px;
    height: 250px;
  }
  
  .gauge-value {
    font-size: 3rem;
  }
  
  .mode-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .heat-mode-card {
    padding: 1.25rem;
  }
  
  .achievements-grid {
    flex-direction: row;
  }
  
  .achievement-badge {
    flex: 1;
    flex-direction: column;
    text-align: center;
  }
}

/* Heat distortion effect at high levels */
@media (prefers-reduced-motion: no-preference) {
  .app-container::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: transparent;
    animation: heat-wave 2s ease-in-out infinite;
    opacity: calc(var(--heat-intensity) * 0.15);
    z-index: 100;
  }
}

@keyframes heat-wave {
  0%, 100% {
    backdrop-filter: blur(0px);
  }
  50% {
    backdrop-filter: blur(0.5px);
  }
}