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

:root {
  --green-dark: #0a1f0a;
  --green-bg: #0d260d;
  --green-card: #122e12;
  --green-border: #1a4a1a;
  --green-accent: #4ade80;
  --green-glow: #22c55e;
  --green-light: #86efac;
  --purple-accent: #a855f7;
  --purple-glow: #7c3aed;
  --text-primary: #e8f5e8;
  --text-secondary: #8bc48b;
  --text-muted: #4a7a4a;
  --orange-warm: #f59e0b;
  --blue-cool: #38bdf8;
}

body {
  background: var(--green-dark);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background particles */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float linear infinite;
}

@keyframes float {
  0% {
    opacity: 0;
    transform: translateY(100vh) scale(0);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-10vh) scale(1);
  }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.leaf-icon {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 12px rgba(74, 222, 128, 0.4));
  animation: gentle-pulse 3s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(74, 222, 128, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.6)); }
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--green-accent), var(--green-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 2px;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-badge.online {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.12);
}

.status-badge.online .status-dot {
  background: var(--green-accent);
  box-shadow: 0 0 8px var(--green-accent);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Clock */
.clock-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.clock {
  font-size: 4rem;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(74, 222, 128, 0.15));
}

.date {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.card {
  background: var(--green-card);
  border: 1px solid var(--green-border);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 16px 16px 0 0;
}

.card-temp::before {
  background: linear-gradient(90deg, var(--orange-warm), #ef4444);
}

.card-humidity::before {
  background: linear-gradient(90deg, var(--blue-cool), var(--purple-accent));
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
}

.card-temp .card-icon {
  color: var(--orange-warm);
}

.card-humidity .card-icon {
  color: var(--blue-cool);
}

.card-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.card-value {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.1;
}

.card-temp .card-value {
  color: var(--orange-warm);
}

.card-humidity .card-value {
  color: var(--blue-cool);
}

.card-unit {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-left: 2px;
}

.card-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin-top: 1.2rem;
  overflow: hidden;
}

.card-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

.temp-bar {
  background: linear-gradient(90deg, #22c55e, var(--orange-warm), #ef4444);
}

.humidity-bar {
  background: linear-gradient(90deg, var(--blue-cool), var(--purple-accent));
}

.card-range {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Warning states */
.card-value.warn {
  animation: pulse-warn 1.5s ease-in-out infinite;
}

@keyframes pulse-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* History section */
.history-section {
  background: var(--green-card);
  border: 1px solid var(--green-border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.history-section h2 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-weight: 500;
}

#historyChart {
  width: 100%;
  height: auto;
}

/* Info section */
.info-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--green-card);
  border: 1px solid var(--green-border);
  border-radius: 12px;
  padding: 1.25rem;
}

.info-card h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.info-card code {
  display: inline-block;
  background: rgba(74, 222, 128, 0.1);
  color: var(--green-accent);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.info-card pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
  overflow-x: auto;
}

.optimal-ranges {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.range-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(74, 222, 128, 0.05);
  border-radius: 8px;
}

.range-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.range-value {
  font-size: 0.85rem;
  color: var(--green-accent);
  font-weight: 600;
}

/* Footer */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(74, 222, 128, 0.08);
}

/* Responsive */
@media (max-width: 640px) {
  .cards, .info-section {
    grid-template-columns: 1fr;
  }

  .clock {
    font-size: 2.8rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  .card-value {
    font-size: 2.5rem;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }
}
