* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* MONKEY FACE ANIMATION */
/* MONKEY FACE - ON TOP OF PAGE NAME */
.monkey-container {
  position: absolute;
  top: 80px; /* Above h1 title */
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.monkey-face {
  position: relative;
  width: 200px;
  height: 120px;
}

.monkey-eye {
  position: absolute;
  width: 60px;
  height: 60px;
  background: #f6e05e;
  border: 6px solid #2d3748;
  border-radius: 50%;
  top: 20px;
  overflow: hidden;
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.2), 0 8px 20px rgba(0,0,0,0.3);
}

.left-eye { left: 20px; }
.right-eye { right: 20px; }

.eyeball {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, #f6e05e 60%, #f0932b 100%);
  position: relative;
  transition: transform 0.1s ease;
}

.pupil {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #2d3748 0%, #1a202c 70%);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* BLINK ANIMATION */
@keyframes blink {
  0%, 100% { height: 60px; transform: translateY(0); }
  50% { height: 10px; transform: translateY(25px); }
}

.monkey-eye.blink {
  animation: blink 0.2s ease-in-out;
}

.monkey-mouth {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 25px;
  background: #f6e05e;
  border-radius: 0 0 30px 30px;
  border: 4px solid #2d3748;
}

.container {
  background: white;
  border-radius: 25px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.15);
  max-width: 850px;
  width: 95%;
  margin: 50px auto;
  position: relative;
  z-index: 10;
  backdrop-filter: blur(10px);
}

/* LOGO */
.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 25px;
}

.header-spacer { flex: 1; }

#logo {
  max-width: 220px;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.screen {
  padding: 50px 40px;
  min-height: 500px;
  display: none;
  text-align: center;
  position: relative; /* Allows monkey positioning relative to screen */
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, #2d3748, #4a5568);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 15px;
  font-weight: 700;
  position: relative;
  z-index: 5; /* Below monkey */
}

.screen h2 {
  color: #4a5568;
  font-size: 1.4rem;
  margin: 25px 0 20px;
}

p {
  color: #718096;
  font-size: 1.1rem;
  margin-bottom: 35px;
  line-height: 1.6;
}

/* PASSWORD TOGGLE */
.password-wrapper {
  position: relative;
  max-width: 400px;
  margin: 12px auto;
  display: block;
}

#password {
  width: 100%;
  padding: 18px 50px 18px 20px;
  border: 3px solid #e2e8f0;
  border-radius: 15px;
  font-size: 16px;
  background: #f8fafc;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.password-toggle {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 20px;
  user-select: none;
  transition: opacity 0.2s ease;
  padding: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
}

.eye-icon { display: block; opacity: 1; }
.monkey-icon { display: none; opacity: 0; }

.password-wrapper.eye-mode .eye-icon { display: block; opacity: 1; }
.password-wrapper.eye-mode .monkey-icon { display: none; opacity: 0; }
.password-wrapper.monkey-mode .eye-icon { display: none; opacity: 0; }
.password-wrapper.monkey-mode .monkey-icon { display: block; opacity: 1; }

input:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 10px 30px rgba(102,126,234,0.15);
  transform: translateY(-2px);
}

/* FORM STYLES */
.form-group, .form-row {
  max-width: 450px;
  margin: 0 auto 30px;
}

.form-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.form-row input { flex: 1; min-width: 250px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  max-width: 700px;
  margin: 0 auto 40px;
}

select {
  width: 100%;
  max-width: 400px;
  padding: 18px 20px;
  margin: 12px auto;
  border: 3px solid #e2e8f0;
  border-radius: 15px;
  font-size: 16px;
  background: #f8fafc;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

/* ENHANCED PROFILE FORM */
#candidateForm .form-grid {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(248,250,252,0.98));
  padding: 40px;
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(102,126,234,0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(226,232,240,0.5);
}

#candidateForm input,
#candidateForm select {
  width: 100%;
  padding: 22px 20px;
  margin-bottom: 0;
  border: 3px solid #e2e8f0;
  border-radius: 20px;
  font-size: 16px;
  background: rgba(255,255,255,0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

#candidateForm input:focus,
#candidateForm select:focus {
  outline: none;
  border-color: #667eea;
  background: white;
  box-shadow: 0 15px 40px rgba(102,126,234,0.25);
  transform: translateY(-3px);
}

#candidateForm input::placeholder {
  color: #a0aec0;
  font-weight: 500;
}

#candidateForm label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group {
  position: relative;
}

button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 18px 40px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 25px rgba(102,126,234,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 200px;
}

button:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(102,126,234,0.4);
}

button:active { transform: translateY(-2px); }

.logout, .secondary-btn {
  background: linear-gradient(135deg, #f56565, #e53e3e) !important;
}

.logout:hover, .secondary-btn:hover {
  box-shadow: 0 15px 40px rgba(245,101,101,0.4) !important;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 20px;
  margin: 30px auto;
  max-width: 500px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #48bb78, #38a169, #2f855a);
  width: 0;
  border-radius: 20px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(72,187,120,0.4);
}

.answer-buttons {
  display: flex;
  gap: 30px;
  justify-content: center;
  margin: 60px 0;
  flex-wrap: wrap;
}

.btn-yes {
  background: linear-gradient(135deg, #48bb78, #38a169) !important;
  min-width: 160px;
  padding: 25px 20px;
  font-size: 20px;
}

.btn-no {
  background: linear-gradient(135deg, #f56565, #e53e3e) !important;
  min-width: 160px;
  padding: 25px 20px;
  font-size: 20px;
}

.quiz-nav {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 40px;
}

#prevQuizBtn {
  background: #a0aec0 !important;
  min-width: 140px;
}

#prevQuizBtn:hover:not(:disabled) {
  box-shadow: 0 10px 30px rgba(160,174,192,0.4) !important;
}

#prevQuizBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.question {
  font-size: 1.6rem;
  color: #2d3748;
  margin: 30px 0;
  line-height: 1.5;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.question-counter {
  font-size: 1.2rem;
  color: #667eea;
  font-weight: 600;
  margin-bottom: 10px;
}

.table-container {
  max-height: 400px;
  overflow-y: auto;
  margin: 25px 0;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 18px 15px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

td {
  padding: 15px;
  border-bottom: 1px solid #e2e8f0;
}

tr:hover td { background: #f7fafc; }

.result-header { margin: 40px 0; }

#mbtiCode {
  font-size: 6rem;
  font-weight: 900;
  background: linear-gradient(135deg, #667eea, #764ba2, #4a5568);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  text-shadow: 0 10px 30px rgba(102,126,234,0.3);
}

#mbtiName {
  font-size: 2rem;
  color: #2d3748;
  margin-bottom: 10px;
}

#personalityType {
  color: #718096;
  font-size: 1.2rem;
}

.result-content {
  text-align: left;
  max-width: 700px;
  margin: 0 auto 40px;
  background: #f8fafc;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.result-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.download-btn {
  background: linear-gradient(135deg, #48bb78, #38a169) !important;
  padding: 22px 50px !important;
  font-size: 18px !important;
  min-width: 250px !important;
}

/* SHAKE ANIMATION */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 768px) {
  .monkey-container {
    top: 70px;
    transform: translateX(-50%) scale(0.85);
  }
  
  .monkey-face { width: 160px; height: 100px; }
  .monkey-eye { width: 48px; height: 48px; top: 16px; }
  .left-eye { left: 16px; }
  .right-eye { right: 16px; }
  
  .container { margin: 20px 10px; width: calc(100% - 20px); }
  .screen { padding: 30px 20px; }
  h1 { font-size: 2rem; }
  .form-grid {
    grid-template-columns: 1fr;
    padding: 30px 20px;
  }
  .answer-buttons { flex-direction: column; align-items: center; gap: 20px; }
  .answer-buttons button { min-width: 250px; }
  #mbtiCode { font-size: 4rem; }
  .table-container { max-height: 300px; }
  th, td { padding: 12px 8px; font-size: 14px; }
}
