* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to bottom, #bae6fd, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.header {
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.guess-row {
  display: flex;
  gap: 0.5rem;
}

.guess-row input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
}

.guess-row button {
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  border: none;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.guess-row button:hover {
  background: #1d4ed8;
}

.results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.result-tile {
  border-radius: 0.75rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
}

.result-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.correct {
  background: #22c55e;
}

.partial {
  background: #eab308;
}

.wrong {
  background: #ef4444;
}

.higher {
  background: #3b82f6;
}

.lower {
  background: #8b5cf6;
}

.footer {
  text-align: center;
  font-size: 0.75rem;
  color: #6b7280;
}

@media (min-width: 640px) {
  .results {
    grid-template-columns: repeat(5, 1fr);
  }
}
.history-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.guess-block {
border-bottom: 1px solid #d1d5db;
padding-bottom: 0.75rem;
margin-bottom: 0.75rem;
align-items: center;
}

.history-row .attr-row:nth-child(4),
.history-row .attr-row:nth-child(5) {
grid-column: 2 / span 1; /* centers bottom two boxes */
justify-self: center;
}

@media (max-width: 480px) {
  .history-row {
    grid-template-columns: 1fr 1fr;
  }
}
.guess-counter {
  text-align: center;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151; /* dark gray */
  font-size: 0.875rem;
}
.autocomplete-dropdown {
  position: absolute;
  top: 100%;            /* places it BELOW the guess row */
  left: 0;
  width: 100%;
  margin-top: 0.25rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  max-height: 200px;
  overflow-y: auto;
  display: none;
  z-index: 50;
}

.autocomplete-item {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.autocomplete-item:hover {
  background-color: #e5edff;
}
.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb; /* separation bar */
}

.top-bar button {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar button:hover {
  background: #1d4ed8;
}
.autocomplete-item.active {
  background-color: #2563eb;
  color: white;
}
.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 14px;
  opacity: 0.9;
  pointer-events: none;
  animation: confetti-fall linear forwards;
  z-index: 2000;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}
.autocomplete-item.active {
  background-color: #c7d2fe;
}
.guess-header {
  display: flex;
  align-items: center;      /* vertically center */
  justify-content: center;  /* center horizontally */

  margin-bottom: 0.25rem;
}

.guess-cover {
  width: 96px;              /* smaller cover */
  height: auto;
  border-radius: 0.25rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.guess-title {
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  flex: 1;                  /* take remaining space */
}

.result-tile {
  perspective: 800px;

}

.result-tile-inner {
  width: 100%;
  height: 100%;
  border-radius: 0.75rem;
  min-height: 60px;
  padding: 0.5rem;
  text-align: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  background: #ef4444;

  transform-style: preserve-3d;
}

/* animation ONLY when flip class is present */
.result-tile-inner.flip {
  animation: flipTile 0.6s ease forwards;
}

@keyframes flipTile {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}
.result-tile-inner.correct { background: #22c55e; }
.result-tile-inner.wrong   { background: #ef4444; }
.result-tile-inner.higher  { background: #3b82f6; }
.result-tile-inner.lower   { background: #8b5cf6; }
