:root {
  --primary-color: #6c5ce7;
  --primary-dark: #5a4bcf;
  --secondary-color: #00cec9;
  --bg-color: #dfe6e9;
  --card-bg: #ffffff;
  --text-color: #2d3436;
  --text-light: #636e72;
  --font-title: 'Jua', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  --border-radius: 16px;
  --transition: 0.3s ease;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  background-image: linear-gradient(135deg, #a29bfe 0%, #74b9ff 100%);
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #fff;
  border-bottom: 1px solid #e9ecef;
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.main-nav a {
  text-decoration: none;
  color: #495057;
  font-weight: bold;
  font-size: 1rem;
  transition: var(--transition);
}

.main-nav a:hover {
  color: var(--primary-color);
}

.app-container {
  width: 100%;
  max-width: 500px;
  background-color: var(--card-bg);
  border-bottom-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

.screen {
  padding: 30px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  animation: fadeIn 0.5s ease;
  width: 100%;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Typography */
h1 {
  font-family: var(--font-title);
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
  line-height: 1.3;
}

h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 30px;
  line-height: 1.6;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 15px 30px;
  font-size: 1.2rem;
  font-family: var(--font-title);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
  max-width: 300px;
  margin-top: 20px;
}

.primary-btn {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.primary-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

.secondary-btn {
  background-color: var(--secondary-color);
  color: white;
}

.secondary-btn:hover {
  background-color: #00b5b0;
  transform: translateY(-2px);
}

/* Start Screen */
.hero-image {
  font-size: 5rem;
  margin: 20px 0;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

/* Quiz Screen */
.progress-container {
  width: 100%;
  height: 10px;
  background-color: #f1f2f6;
  border-radius: 5px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: var(--secondary-color);
  width: 0%;
  transition: width 0.3s ease;
}

.question-box {
  width: 100%;
}

.question-number {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--secondary-color);
  margin-bottom: 10px;
  display: block;
}

.question-text {
  font-size: 1.4rem;
  margin-bottom: 30px;
  word-break: keep-all;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

.option-btn {
  background-color: #f8f9fa;
  border: 2px solid #e9ecef;
  padding: 15px 20px;
  border-radius: 12px;
  font-size: 1.1rem;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
  font-family: var(--font-body);
}

.option-btn:hover {
  background-color: #e6e6fe;
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.option-btn:active {
  transform: scale(0.98);
}

/* Result Screen */
.result-header {
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 10px;
}

.result-title {
  color: var(--primary-color);
  font-size: 2.2rem;
  margin-bottom: 20px;
}

.result-emoji {
  font-size: 6rem;
  margin: 20px 0;
}

.result-desc {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 30px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 12px;
  word-break: keep-all;
}

.action-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  margin-top: 20px;
}

.action-buttons .btn {
  width: auto;
  flex: 1;
  font-size: 1rem;
  padding: 12px 10px;
  margin-top: 0;
}

/* Next Test Button */
.next-test-container {
  text-align: center;
  margin-top: 20px; /* Add margin-top for spacing from action-buttons */
  padding: 0; /* Remove horizontal padding */
}

#next-test-btn {
  background-color: var(--secondary-color);
  font-size: 1.1rem;
  max-width: 300px; /* Limit width to be consistent with other buttons */
  width: 100%;
}

#next-test-btn:hover {
  background-color: #00b5b0;
}

/* Footer Styles */
footer {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
}

footer a {
  color: var(--text-light);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Result Card Styles for Image Capture */
.result-card {
  width: 500px !important; /* Fixed width for consistent capture */
  height: 500px !important; /* Fixed height for 1:1 ratio */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px !important;
  box-sizing: border-box !important;
  border: 10px solid var(--primary-color);
  background: #fff;
}

/* --- Media Queries for Responsiveness --- */

/* For smaller mobile devices */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .app-container {
    min-height: 500px;
    border-radius: 0;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
  }

  .main-nav {
    border-radius: 0;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
  }

  .screen {
    padding: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 1rem;
    margin-bottom: 20px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 1rem;
    max-width: 280px;
    margin-top: 15px;
  }

  .hero-image {
    font-size: 4rem;
    margin: 15px 0;
  }

  .question-text {
    font-size: 1.2rem;
    margin-bottom: 20px;
  }

  .option-btn {
    padding: 12px 15px;
    font-size: 1rem;
  }

  .result-title {
    font-size: 1.8rem;
  }

  .result-emoji {
    font-size: 5rem;
    margin: 15px 0;
  }

  .result-desc {
    font-size: 1rem;
    padding: 15px;
  }

  footer {
    padding: 15px;
    font-size: 0.8rem;
  }
}

/* For tablets and larger mobile devices */
@media (min-width: 481px) and (max-width: 768px) {
  body {
    padding: 15px;
  }

  .app-container {
    min-height: 550px;
  }

  .screen {
    padding: 25px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 1.05rem;
    margin-bottom: 25px;
  }

  .btn {
    font-size: 1.1rem;
    max-width: 300px;
  }

  .hero-image {
    font-size: 4.5rem;
  }

  .question-text {
    font-size: 1.3rem;
  }

  .option-btn {
    font-size: 1.05rem;
  }

  .result-title {
    font-size: 2rem;
  }

  .result-emoji {
    font-size: 5.5rem;
  }

  .result-desc {
    font-size: 1.05rem;
  }
}

/* For larger screens (desktops) - can adjust if needed but current styles are generally for desktop */
@media (min-width: 769px) {
  .app-container {
    max-width: 500px; /* Keep consistent with base */
  }
}

