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

:root {
  --primary: #5BA4A4;
  --primary-dark: #2C7A7B;
  --primary-light: #B2D8D8;
  --bg: #F0F7F7;
  --text: #2D3436;
  --text-light: #636E72;
  --success: #27AE60;
  --success-light: #E8F8F0;
  --error: #E74C3C;
  --error-light: #FDEDEC;
  --white: #FFFFFF;
  --shadow: 0 4px 20px rgba(44, 122, 123, 0.15);
  --shadow-lg: 0 8px 40px rgba(44, 122, 123, 0.2);
  --radius: 20px;
  --radius-sm: 14px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease;
}

.hidden {
  display: none !important;
}

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

/* Header */
.header {
  text-align: center;
  padding: 12px 0 8px;
}

.header-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 4px;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.header h1 {
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

/* Task Card */
.task-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 12px 0;
  box-shadow: var(--shadow);
  border-left: 6px solid var(--primary);
  position: relative;
}

.task-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.task-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

/* Generic Card */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin: 20px 0;
  box-shadow: var(--shadow);
  text-align: center;
}

.card-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.card p {
  font-size: 16px;
  color: var(--text-light);
  line-height: 1.5;
}

/* Form Elements */
.form-section {
  margin: 10px 0;
}

.form-label {
  display: block;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.form-select {
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: 3px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232C7A7B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 24px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 164, 164, 0.2);
}

.form-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 18px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  border: 3px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  margin-top: 10px;
  transition: border-color 0.2s;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 18px 24px;
  font-size: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 60px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-icon {
  font-size: 26px;
}

.photo-buttons {
  display: flex;
  gap: 10px;
}

.photo-buttons .btn {
  flex: 1;
}

.btn-camera {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(91, 164, 164, 0.4);
}

.btn-camera:active {
  box-shadow: 0 2px 8px rgba(91, 164, 164, 0.3);
}

.btn-gallery {
  background: linear-gradient(135deg, #F39C12, #E67E22);
  color: white;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.35);
}

.btn-gallery:active {
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.25);
}

.btn-upload {
  background: linear-gradient(135deg, var(--success), #219A52);
  color: white;
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
  margin-top: 12px;
}

.btn-upload:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-another {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(91, 164, 164, 0.4);
  max-width: 300px;
  margin: 0 auto;
}

.btn-small {
  padding: 10px 20px;
  font-size: 14px;
  min-height: 44px;
  background: rgba(255,255,255,0.9);
  color: var(--primary-dark);
  border: 2px solid var(--primary-light);
  width: auto;
}

/* Photo Preview */
.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.photo-preview {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}

.photo-preview img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius-sm);
  background: #f0f0f0;
}

.photo-preview .btn-small {
  position: absolute;
  bottom: 10px;
  right: 10px;
  border-radius: 50px;
}

/* Progress Bar */
.progress {
  margin-top: 12px;
  border-radius: 50px;
  overflow: hidden;
  background: var(--primary-light);
  position: relative;
  height: 40px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 50px;
  transition: width 0.3s;
  width: 0%;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
}

/* Error Message */
.error-msg {
  background: var(--error-light);
  color: var(--error);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  margin-top: 12px;
  text-align: center;
  border: 2px solid var(--error);
}

/* Success Screen */
.success-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.success-emoji {
  font-size: 80px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-bottom: 16px;
}

@keyframes popIn {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.success-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--success);
  margin-bottom: 8px;
}

.success-text {
  font-size: 18px;
  color: var(--text-light);
  margin-bottom: 32px;
  font-weight: 700;
}

/* Confetti Animation */
.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Loading Spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  text-align: center;
  padding: 40px;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
