body {
  font-family: Inter, sans-serif;
}

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

@media (min-width: 1024px) {
  .tool-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
    padding: 2rem 4rem;
  }
}

/* Score pills */
.score-pill {
  background: #1f2937;
  border-radius: 8px;
  padding: 5px 10px;
  text-align: center;
  min-width: 60px;
}

.score-pill .label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9ca3af;
  text-transform: uppercase;
}

.score-pill .value {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

/* Mode tabs */
.mode-btn {
  border: 1px solid #e5e7eb;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.mode-btn:hover {
  border-color: #6ee7b7;
  color: #065f46;
  background: #f0fdf4;
}

.mode-btn.active {
  border-color: #059669;
  color: #065f46;
  background: #ecfdf5;
}

/* Periodic Table Grid */
.table-container {
  overflow-x: auto;
  margin: 1rem -1rem;
  padding: 0 1rem;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .table-container {
    overflow-x: visible;
    margin: 1rem 0;
    padding: 0;
  }
}

.pt-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(clamp(30px, 5vw, 70px), 1fr));
  gap: 2px;
  min-width: 0;
  margin: 0 auto;
  width: 100%;
}

.element-cell {
  aspect-ratio: 1;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: clamp(9px, 1.2vw, 14px);
  position: relative;
  background: #f9fafb;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.element-cell.empty {
  border: none;
  background: transparent;
}

.element-cell.guessed {
  border: none;
  color: #fff;
  font-weight: 700;
  animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pop-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  70% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.element-cell .symbol {
  font-size: clamp(10px, 1.5vw, 18px);
}

.element-cell .number {
  font-size: clamp(6px, 0.8vw, 10px);
  position: absolute;
  top: clamp(1px, 0.3vw, 4px);
  left: clamp(1px, 0.3vw, 4px);
  opacity: 0.6;
}

/* Categories Colors */
.cat-diatomic-nonmetal {
  background: #059669;
}

.cat-noble-gas {
  background: #7c3aed;
}

.cat-alkali-metal {
  background: #dc2626;
}

.cat-alkaline-earth-metal {
  background: #ea580c;
}

.cat-metalloid {
  background: #0891b2;
}

.cat-polyatomic-nonmetal {
  background: #059669;
}

.cat-post-transition-metal {
  background: #4b5563;
}

.cat-transition-metal {
  background: #2563eb;
}

.cat-lanthanide {
  background: #db2777;
}

.cat-actinide {
  background: #be185d;
}

.cat-unknown {
  background: #4b5563;
}

/* Input Styling */
#guess-input {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}

#guess-input:focus {
  border-color: #059669;
}

#guess-input.correct {
  border-color: #059669;
  background: #ecfdf5;
  animation:
    bounce 0.3s ease,
    success-flash 0.5s ease-out;
}

@keyframes success-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4);
  }

  100% {
    box-shadow: 0 0 0 20px rgba(5, 150, 105, 0);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

/* Modal / Overlay */
#end-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

#end-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.end-card {
  background: #fff;
  border-radius: 1.25rem;
  padding: 2rem;
  text-align: center;
  max-width: 350px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Scroll Indicator */
.scroll-hint {
  display: none;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .scroll-hint {
    display: block;
  }
}

/* Single toast — replaces text instead of stacking */
#toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}
#pt-toast {
  background: #1f2937;
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0);
  transition:
    opacity 0.2s,
    transform 0.2s;
}
#pt-toast.show {
  opacity: 1;
  transform: translateY(-8px);
}
