* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 50%, #f59e0b 100%);
  min-height: 100vh;
  margin: 0;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
}

form {
  background: #ffffff;
  width: 100%;
  max-width: 720px;
  padding: 48px;
  border-radius: 16px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
}

fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 28px;
}

fieldset:last-of-type {
  margin-bottom: 0;
}

legend {
  padding: 4px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #d97706;            
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #ffffff;
}

.personal-information,
.language-test,
.grammar-section,
.scenario-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.question-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.question-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1.5;
}

.language-test .question-label {
  font-size: 15px;
  color: #1f2937;
  font-weight: 500;
}

.question-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  outline: none;
}

textarea.question-input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.question-input::placeholder {
  color: #9ca3af;
}

.question-input:hover {
  border-color: #9ca3af;
}

.question-input:focus {
  border-color: #f59e0b;   
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);  
}

.question-input:invalid:not(:placeholder-shown) {
  border-color: #e53e3e;
}

.submit-button {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #1f2937;             
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  margin-top: 8px;
}

.submit-button:hover {
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.45);  
  transform: translateY(-1px);
}

.submit-button:active {
  transform: translateY(0);
  opacity: 0.95;
}

.form-message {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 20px;          
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease, padding 0.25s ease;
  padding-top: 0;
  padding-bottom: 0;
}

.form-message.is-visible {
  opacity: 1;
  max-height: 200px;
  transform: translateY(0);
  padding-top: 14px;
  padding-bottom: 14px;
}

.form-message.is-success {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.form-message.is-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.timer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: #ffffff;
  color: #1f2937;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.timer.is-warning {
  color: #b45309;
  background: #fffbeb;
}

.timer.is-critical {
  color: #b91c1c;
  background: #fef2f2;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@media (max-width: 600px) {
  body {
    padding: 20px 12px;
  }

  form {
    padding: 28px 20px;
    border-radius: 12px;
  }

  fieldset {
    padding: 22px 18px;
  }
}

/* --- Thank you page --- */
body:has(.thank-you-card) {
  align-items: center; 
}

.thank-you-card {
  background: #ffffff;
  width: 100%;
  max-width: 480px;
  padding: 64px 48px;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: fadeUp 0.5s ease-out;
}

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

.thank-you-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 46px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.45);
  animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

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

.thank-you-card h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px;
  letter-spacing: -0.3px;
}

.thank-you-card p {
  font-size: 16px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0 0 8px;
}

.thank-you-subtle {
  color: #9ca3af;
  font-size: 14px;
  margin-top: 28px;
}

/* --- Welcome page --- */
body:has(.welcome-card) {
  align-items: center;
}

.welcome-card {
  background: #ffffff;
  width: 100%;
  max-width: 560px;
  padding: 56px 48px;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  animation: fadeUp 0.5s ease-out;
}

.welcome-title {
  font-size: 36px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 14px;
  text-align: center;
  letter-spacing: -0.5px;
}

.welcome-intro {
  font-size: 16px;
  color: #4b5563;
  line-height: 1.65;
  margin: 0 0 40px;
  text-align: center;
}

.welcome-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.welcome-step {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.welcome-step-number {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.welcome-step-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 4px 0 6px;
}

.welcome-step-content p {
  font-size: 15px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
}

.welcome-step-content strong {
  color: #1f2937;
  font-weight: 600;
}

.welcome-ready {
  font-size: 14px;
  color: #9ca3af;
  text-align: center;
  margin: 0 0 16px;
  font-style: italic;
}

.welcome-button {
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #1f2937;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.welcome-button:hover {
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.45);
  transform: translateY(-1px);
}

.welcome-button:active {
  transform: translateY(0);
}

/* --- Multiple-choice options (grammar test) --- */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  cursor: pointer;
  font-size: 15px;
  color: #111827;
  line-height: 1.4;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.option:hover {
  border-color: #9ca3af;
  background-color: #f3f4f6;
}

.option:has(input:checked) {
  border-color: #f59e0b;
  background-color: #fffbeb;
}

.option input[type="radio"] {
  accent-color: #f59e0b;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* Question label as a <p> instead of <label> needs reset */
.grammar-section .question-label {
  margin: 0 0 4px;
}
.field-hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* --- Copy protection on the test section --- */
.language-test {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-touch-callout: none;
}

/* Re-enable text selection inside textareas so candidates can edit their own answers */
.language-test textarea {
  user-select: text;
  -webkit-user-select: text;
}

/* --- File input (CV upload) --- */
.file-input {
  padding: 8px 12px;
  cursor: pointer;
  background-color: #f9fafb;
  font-size: 14px;
}

.file-input::file-selector-button {
  margin-right: 14px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1f2937;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.file-input::file-selector-button:hover {
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.form-message.is-info {
  background-color: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.start-button {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #1f2937;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  margin-top: 8px;
}

.start-button:hover {
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.45);
  transform: translateY(-1px);
}

.start-button:active {
  transform: translateY(0);
}