@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap');

body {
  font-family: 'MedievalSharp', cursive;
  background: #f5e6d3;
  color: #3a2f2f;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

h1 {
  margin-bottom: 0.3rem;
  color: #b97c3b;
  text-shadow: 1px 1px 2px #fff3e0;
}

#monthHeader {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: #7c4b1d;
}

#habitTable {
  border-collapse: collapse;
  margin-top: 1rem;
  box-shadow: 0 0 12px #00000033;
  position: relative;
}

#habitTable th, #habitTable td {
  border: 1px solid #a88c70;
  padding: 0.4rem 0.6rem;
  text-align: center;
  min-width: 28px;
  background: #fff2e0;
  position: relative;
  overflow: visible;
}

#habitTable th {
  background: #efd1b0;
}

#habitTable td.done {
  background: #c7f0c7;
  box-shadow: 0 0 6px #b2f0b2;
  transform: scale(1.05);
}

#habitTable td.done::after {
  content: "✓";
  color: #2a4d2a;
  font-weight: bold;
}

#controls, #monthControls {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  background: #efd1b0;
  color: #3a2f2f;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 2px 2px 4px #00000033;
}

button:hover { transform: scale(1.05); }

.remove-btn {
  background: none;
  border: none;
  color: #a33;
  font-weight: bold;
  cursor: pointer;
  margin-left: 8px;
}

#addHabitInput {
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid #a88c70;
  background: #fff2e0;
  color: #3a2f2f;
}

.habit-name { text-align: left; font-weight: bold; padding-left: 0.6rem; }

.streak { font-size: 0.8rem; color: #b97c3b; }

progress {
  width: 150px;
  height: 14px;
  border-radius: 12px;
  overflow: hidden;
  background-color: #d6a770;
}

progress::-webkit-progress-bar { background-color: #d6a770; border-radius: 12px; }
progress::-webkit-progress-value { background-color: #7cc67c; border-radius: 12px; }

#leaderboard, #summaryPanel {
  margin-top: 2rem;
  background: #f3e0c2;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 0 12px #00000033;
  width: 320px;
}

#leaderboard h2, #summaryPanel h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: #b97c3b;
}

#leaderboard ol { list-style: none; padding: 0; margin: 0; }
#leaderboard li {
  background: #fff2e0;
  border-radius: 8px;
  margin: 0.3rem 0;
  padding: 0.4rem 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#leaderboard li:first-child {
  background: linear-gradient(90deg, #ffecb3, #ffd54f);
  color: #3a2f2f;
  font-weight: bold;
  box-shadow: 0 0 10px #ffecb355;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { box-shadow: 0 0 10px #ffecb355; }
  50% { box-shadow: 0 0 20px #ffecb3aa; }
}

.level-bar-container {
  width: 150px;
  background: #d6a770;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 2px;
}
.level-bar {
  height: 14px;
  background: #7cc67c;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 12px;
}

#summaryPanel ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
#summaryPanel li {
  padding: 4px 0;
  font-size: 0.95rem;
}

/* Floating XP animation */
.xp-float {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #3b6b1f;
  font-weight: bold;
  font-size: 0.9rem;
  opacity: 0;
  animation: floatUp 1.2s ease-out forwards;
  pointer-events: none;
  text-shadow: 0 0 4px #fff;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -20%); }
  100% { opacity: 0; transform: translate(-50%, -160%); }
}
