@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&display=swap');

:root {
  --primary-color: #9b59b6;
  --secondary-color: #8e44ad;
  --text-color: #ecf0f1;
  --bg-color: #2c3e50;
  --container-bg: rgba(44, 62, 80, 0.75);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: linear-gradient(to right, #34495e, #2c3e50);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: flex-start; /* Align to start, not center vertically */
  min-height: 100vh;
  padding: 1rem;
}

#main-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center; /* Center children horizontally */
  max-width: 500px; /* Unified max-width for both containers */
  width: 100%;
}

.container {
  background: var(--container-bg);
  padding: 2.5rem;
  border-radius: 15px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%; /* Take full width of main-wrapper */
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#lotto-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-basis: calc(50% - 0.5rem);
}

label {
  margin-bottom: 0.5rem;
  font-weight: 400;
  font-size: 0.9rem;
}

.input-group.full-width {
  flex-basis: 100%;
}

input, select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 1rem;
  transition: background 0.3s, border-color 0.3s;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ecf0f1%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-13%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2013l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.6-3.7%205.4-8%205.4-13%200-5-1.8-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 0.7em top 50%, 0 0;
  background-size: .65em auto, 100%;
  padding-right: 2rem; /* Make space for arrow */
}

input:focus, select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary-color);
}

button[type="submit"] {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border: none;
  border-radius: 8px;
  color: var(--text-color);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button[type="submit"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(155, 89, 182, 0.4);
}

#result {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  min-height: 50px;
}

.fortune-container {
  margin-top: 2rem;
  min-height: 50px;
  font-size: 1.1rem;
  font-style: italic;
  color: #bdc3c7;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  transition: opacity 0.5s ease-in-out;
  opacity: 0;
  line-height: 1.6;
}

.details-container {
  display: none; /* Hidden by default */
  margin-top: 2rem;
  padding: 2.5rem;
  width: 100%; /* Take full width of main-wrapper */
  background: var(--container-bg);
  border-radius: 15px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.8s ease-in-out;
}

.details-container.visible {
    display: block;
}

.details-container h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

.details-container p {
    color: var(--text-color);
    line-height: 1.8;
    text-align: justify;
}


.lotto-ball {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.5s ease-in-out forwards;
  opacity: 0;
}

.lotto-ball:nth-child(1) { background-color: #f1c40f; animation-delay: 0.1s; }
.lotto-ball:nth-child(2) { background-color: #e67e22; animation-delay: 0.2s; }
.lotto-ball:nth-child(3) { background-color: #e74c3c; animation-delay: 0.3s; }
.lotto-ball:nth-child(4) { background-color: #3498db; animation-delay: 0.4s; }
.lotto-ball:nth-child(5) { background-color: #2ecc71; animation-delay: 0.5s; }
.lotto-ball:nth-child(6) { background-color: #9b59b6; animation-delay: 0.6s; }


@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 500px) {
  .input-group {
    flex-basis: 100%;
  }
  h1 {
    font-size: 2rem;
  }
  .container {
    padding: 1.5rem;
  }
}
