:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --primary-color: #4facfe;
}

body.dark {
  --bg-color: #1e1e1e;
  --text-color: #ffffff;
  --primary-color: #00f2fe;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.5s, color 0.5s;
  background-image: linear-gradient(-45deg, #4facfe, #00f2fe, #43e97b, #38f9d7);
  background-size: 400% 400%;
  animation: gradientBG 10s ease infinite;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.container {
  background: var(--bg-color);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  text-align: center;
  opacity: 0;
  transform: rotateY(-90deg);
  animation: flipIn 1s ease-out forwards;
  color: var(--text-color);
}

@keyframes flipIn {
  to {
    transform: rotateY(0deg);
    opacity: 1;
  }
}

h1 {
  margin-bottom: 20px;
}

#time {
  font-size: 48px;
  margin-bottom: 20px;
}

.buttons button {
  padding: 10px 15px;
  margin: 5px;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
}

#start { background: #28a745; color: white; }
#pause { background: #ffc107; color: black; }
#reset { background: #dc3545; color: white; }
#lap { background: #007bff; color: white; }
#theme-toggle { background: var(--primary-color); color: white; }

.buttons button:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#laps {
  margin-top: 20px;
  max-height: 200px;
  overflow-y: auto;
  list-style: none;
  padding: 0;
}

#laps li {
  background: rgba(255,255,255,0.1);
  border-bottom: 1px solid #ccc;
  padding: 8px;
  text-align: left;
  color: var(--text-color);
}
