body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(to right, #eef2f3, #dbe9f4);
  padding: 30px;
  margin: 0;
}

.container {
  max-width: 800px;
  margin: auto;
  background: white;
  border-radius: 16px;
  padding: 40px 50px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  animation: fadeIn 0.6s ease;
}

h1 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 35px;
  font-size: 28px;
}

h3 {
  color: #34495e;
  margin-bottom: 18px;
  border-left: 4px solid #4caf50;
  padding-left: 10px;
  font-size: 20px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #333;
}

input[type="number"],
input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  margin-bottom: 14px;
}

textarea {
  min-height: 100px;
  background: #f9f9f9;
  font-family: Consolas, monospace;
}

button {
  padding: 10px 22px;
  font-size: 15px;
  border: none;
  background: #4caf50;
  color: white;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  position: relative;
}

button:hover {
  background: #43a047;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 120%;
  left: 0;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 0.95;
}

.output {
  background: #fdfdfd;
  padding: 16px 20px;
  border: 1px solid #ddd;
  border-radius: 10px;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  color: #2c3e50;
  line-height: 1.6;
  min-height: 80px;
}

.output-line {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeLineIn 0.4s ease forwards;
}

@keyframes fadeLineIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

#guessedResult {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #2c3e50;
  text-align: center;
}

#guessedResult div {
  margin-bottom: 6px;
  font-size: 18px;
  text-align: center;
}

button[style*="background:#e53935"] {
  background: #e53935;
}

button[style*="background:#e53935"]:hover {
  background: #c62828;
}

/* ✅ Success Animation */
@keyframes popFadeSuccess {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    color: #888;
  }
  60% {
    transform: translateY(-2px) scale(1.05);
    color: #4caf50;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    color: #4caf50;
  }
}

/* ❌ Error Animation */
@keyframes popFadeError {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    color: #999;
  }
  60% {
    transform: translateY(-2px) scale(1.05);
    color: #e53935;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    color: #e53935;
  }
}

.key-success {
  animation: popFadeSuccess 0.6s ease-out;
  font-weight: bold;
}

.key-error {
  animation: popFadeError 0.6s ease-out;
  font-weight: bold;
}

/* Modal Dialog Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 99;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 15% auto;
  padding: 20px 30px;
  border: 1px solid #888;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: floatInBlur 0.5s ease-out;
}


.modal-content h4 {
  margin-top: 0;
  color: #2c3e50;
}

.modal-content p {
  line-height: 1.8;
  font-family: Consolas, monospace;
}

.close {
  color: #aaa;
  float: right;
  font-size: 26px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

.cute-btn {
  background-color: #ffd166;
  color: #333;
  border: none;
  padding: 4px 10px;
  font-size: 16px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
}

.cute-btn:hover {
  transform: rotate(20deg) scale(1.1);
  background-color: #ffe599;
}

/* ✅ Fix: hide sections completely unless visible */
.section {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ✅ Reset button section with minimal spacing */
.reset-section {
  margin-top: 30px;
  margin-bottom: 0px;
  text-align: center;
  padding-bottom: 20px;
}

.reset-btn {
  background: #e53935;
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 5px;
}

.reset-btn:hover {
  background: #c62828;
}
/* Add smooth transitions to all interactive elements */
.fade-in {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.4s ease-out forwards;
}

.fade-out {
  opacity: 1;
  transform: translateY(0);
  animation: fadeOutDown 0.4s ease-in forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutDown {
  to {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
  }
}

/* Optional: delay for staggered animation */
.stagger > * {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.4s ease-out forwards;
}

.stagger > *:nth-child(1) { animation-delay: 0s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.2s; }
.stagger > *:nth-child(4) { animation-delay: 0.3s; }
/* Reset transition enhancements */
.section.fade-out {
  animation: slideFadeOut 0.5s ease forwards;
}

@keyframes slideFadeOut {
  to {
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
  }
}

.section.fade-in {
  animation: slideFadeIn 0.5s ease forwards;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up-out {
  animation: slideUpOut 0.5s ease forwards;
}

@keyframes slideUpOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px);
  }
}

.slide-down-in {
  animation: slideDownIn 0.5s ease forwards;
}

@keyframes slideDownIn {
  0% {
    opacity: 0;
    transform: translateY(-30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.modal.fade-out {
  animation: fadeOutModal 0.4s ease forwards;
}

@keyframes fadeOutModal {
  to {
    opacity: 0;
    transform: translateY(-30px);
    pointer-events: none;
  }
}
@keyframes floatInBlur {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}
#guessedResult.fade-in {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.5s ease-out forwards;
}
