:root {
  --primary-blue: #0ea5e9;
  --primary-blue-dark: #0284c7;
  --secondary-teal: #14b8a6;
  --accent-blue: #3b82f6;
  --accent-orange: #f97316;
  --gradient-bg: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 12px 40px rgba(0, 0, 0, 0.15);
  --shadow-large: 0 20px 60px rgba(0, 0, 0, 0.2);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-radius: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  height: auto;
  font-family: 'Inter', sans-serif;
  background: var(--gradient-bg);
  overflow-x: hidden;
  position: relative;
}

/* Animated background particles */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 80%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(20, 184, 166, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-20px) rotate(1deg);
  }
  66% {
    transform: translateY(10px) rotate(-1deg);
  }
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  overflow: hidden;
}

.card {
  width: 100%;
  max-width: 600px;
  min-width: 400px;
  min-height: 90vh;
  max-height: 95vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-large);
  padding: 2rem;
  text-align: center;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  animation: slideUp 0.6s ease-out;
}

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

/* Subtle card glow effect */
.card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg,
      rgba(14, 165, 233, 0.2),
      rgba(59, 130, 246, 0.2),
      rgba(20, 184, 166, 0.2));
  border-radius: var(--border-radius);
  z-index: -1;
  opacity: 0;
  animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.3;
  }
}

.logo {
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 2rem auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  animation: logoFloat 3s ease-in-out infinite;
}

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

h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 1.5rem 0;
  line-height: 1.3;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 3s ease-in-out infinite;
}

@keyframes textShimmer {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.arabic {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 0.5rem;
}

.emoji-box {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  margin: 2rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
}

.emoji {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
  padding: 1rem 0.5rem;
  border-radius: 15px;
  position: relative;
  overflow: hidden;
  /* Mobile-first: Remove hover, add active state */
  -webkit-tap-highlight-color: transparent;
  animation: gentleFloat 3s ease-in-out infinite;
}
/* emoji animation */
.emoji:nth-child(1) { animation-delay: 0s; }
.emoji:nth-child(2) { animation-delay: 0.6s; }
.emoji:nth-child(3) { animation-delay: 1.2s; }
.emoji:nth-child(4) { animation-delay: 1.8s; }
.emoji:nth-child(5) { animation-delay: 2.4s; }

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}
.emoji::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.3) 100%);
  opacity: 0;
  transition: var(--transition);
  border-radius: 15px;
}

/* Mobile touch feedback - replaces hover */
.emoji:active {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-medium);
}

.emoji:active::before {
  opacity: 1;
}

/* New emoji image styles */
.emoji-img {
  width: clamp(35px, 8vw, 50px);
  height: clamp(35px, 8vw, 50px);
  margin-bottom: 8px;
  transition: var(--transition);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
  user-select: none;
  -webkit-user-drag: none;
}

.emoji:active .emoji-img {
  transform: scale(1.1);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.emoji-text {
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  font-weight: 600;
  white-space: nowrap;
  margin-top: 0;
  transition: var(--transition);
  user-select: none;
}

.emoji:active .emoji-text {
  transform: scale(1.05);
}

/* Keep color coding for text */
.emoji-very-bad .emoji-text {
  color: #dc2626;
}

.emoji-poor .emoji-text {
  color: #ef4444;
}

.emoji-okay .emoji-text {
  color: #f59e0b;
}

.emoji-good .emoji-text {
  color: #84cc16;
}

.emoji-excellent .emoji-text {
  color: #22c55e;
}

#subquestion {
  display: none;
}

form {
  display: none !important;
  margin-top: 1.5rem;
  flex: none;
  max-height: none;
  overflow: visible;
}

form.show {
  display: block !important;
  animation: formSlideIn 0.5s ease-out;
}

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

.input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

input,
textarea {
  width: 100%;
  padding: 16px 50px 16px 20px;
  border: 2px solid rgba(203, 213, 225, 0.6);
  border-radius: 15px;
  font-size: clamp(1rem, 3vw, 1.1rem);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  transition: var(--transition);
  resize: none;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
  background: rgba(255, 255, 255, 1);
  transform: translateY(-2px);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-secondary);
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-weight: 400;
}

.checkmark,
.xmark {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  display: none;
  transition: var(--transition);
}

.checkmark {
  color: #22c55e;
  animation: checkmarkPop 0.3s ease-out;
}

.xmark {
  color: #ef4444;
  animation: shake 0.3s ease-out;
}

@keyframes checkmarkPop {
  0% {
    transform: translateY(-50%) scale(0);
  }
  50% {
    transform: translateY(-50%) scale(1.2);
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateY(-50%) translateX(0);
  }
  25% {
    transform: translateY(-50%) translateX(-3px);
  }
  75% {
    transform: translateY(-50%) translateX(3px);
  }
}

.show-check {
  display: inline;
}

.button-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 2rem;
}

button {
  width: 100%;
  padding: 16px;
  font-size: clamp(1rem, 3vw, 1.1rem);
  font-weight: 600;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  min-height: 56px;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

button:active::before {
  left: 100%;
}

.skip-btn {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: var(--text-primary);
  border: 2px solid rgba(203, 213, 225, 0.5);
}

.skip-btn:active {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.submit-btn {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  color: white;
  box-shadow: var(--shadow-soft);
}

.submit-btn:active {
  background: linear-gradient(135deg, var(--primary-blue-dark) 0%, #0369a1 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.submit-btn:disabled {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.submit-btn:disabled:active {
  transform: none;
}

.loader {
  display: none;
  margin: 20px auto;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(14, 165, 233, 0.1);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#thankyou {
  display: none;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  font-weight: 700;
  margin-top: 3rem;
  background: linear-gradient(135deg, var(--secondary-teal) 0%, var(--primary-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: thankYouPulse 2s ease-in-out infinite;
}

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

#backArrow {
  position: fixed;
  top: clamp(20px, 4vw, 25px);
  left: clamp(20px, 4vw, 25px);
  font-size: clamp(1.8rem, 5vw, 2.2rem);
  cursor: pointer;
  color: white;
  display: none !important;
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
  border-radius: 50%;
  width: clamp(50px, 10vw, 60px);
  height: clamp(50px, 10vw, 60px);
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
  transition: var(--transition);
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}

#backArrow:active {
  background: linear-gradient(135deg, var(--primary-blue-dark) 0%, #2563eb 100%);
  transform: scale(1.1) translateX(-2px);
  box-shadow: var(--shadow-large);
}

#backArrow.show {
  display: flex !important;
  animation: backArrowSlide 0.3s ease-out;
}

@keyframes backArrowSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced Inactivity Warning Modal */
.inactivity-warning {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}

.inactivity-warning.show {
  display: flex;
  animation: modalFadeIn 0.4s ease-out;
}

.warning-modal {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: 3rem 2rem;
  border-radius: 25px;
  text-align: center;
  max-width: 90%;
  width: 450px;
  box-shadow: var(--shadow-large);
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.warning-modal::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--accent-orange), var(--primary-blue), var(--accent-blue));
  border-radius: 25px;
  z-index: -1;
  animation: warningGlow 2s ease-in-out infinite;
}

@keyframes warningGlow {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes modalFadeIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.card.blurred {
  filter: blur(5px);
  transition: filter 0.4s ease;
  pointer-events: none;
}

.form-disabled {
  pointer-events: none;
  user-select: none;
  touch-action: none;
}

.activity-pulse {
  animation: activityPulse 0.4s ease-out;
}

@keyframes activityPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 0 15px rgba(20, 184, 166, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

#backArrow.hidden-for-warning {
  display: none !important;
}

.warning-modal h2 {
  color: var(--accent-orange);
  margin: 0 0 1.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.warning-modal p {
  margin: 0 0 2rem 0;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 500;
}

.countdown-display {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 1.5rem 0;
  animation: countdownPulse 1s ease-in-out infinite;
}

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

.warning-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.char-count {
  position: absolute;
  bottom: 12px;
  right: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  pointer-events: none;
  font-weight: 500;
}

.char-count.warning {
  color: var(--accent-orange);
}

.char-count.danger {
  color: #dc2626;
  animation: charCountWarn 0.5s ease-in-out;
}

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

.warning-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.continue-btn {
  background: linear-gradient(135deg, var(--secondary-teal) 0%, #10b981 100%);
  color: white;
  box-shadow: var(--shadow-soft);
}

.continue-btn:active {
  background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

.restart-btn {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
  color: white;
  box-shadow: var(--shadow-soft);
}

.restart-btn:active {
  background: linear-gradient(135deg, var(--primary-blue-dark) 0%, #0369a1 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* Responsive Design Enhancements */
@media screen and (max-width: 480px) {
  .card {
    padding: 1.5rem;
    margin: 0.5rem;
    min-height: 95vh;
    border-radius: 15px;
  }

  .logo {
    max-width: 300px;
    margin-bottom: 1.5rem;
  }

  .emoji-box {
    gap: 5px;
    padding: 0.8rem;
    margin: 1.5rem 0;
  }

  .warning-modal {
    padding: 2rem 1.5rem;
    margin: 1rem;
    border-radius: 20px;
  }

  .warning-buttons {
    flex-direction: column;
  }

  .warning-btn {
    width: 100%;
  }

  .countdown-display {
    font-size: 2.5rem;
  }
}

@media screen and (max-height: 500px) and (orientation: landscape) {
  .card {
    padding: 1rem;
    padding-top: 80px;
    min-height: 95vh;
  }

  .logo {
    max-width: 250px;
    margin-bottom: 1rem;
  }

  .emoji-box {
    margin: 1rem 0;
    gap: 8px;
  }

  h1 {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    margin-bottom: 1rem;
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .card {
    max-width: 520px;
    padding: 2rem;
  }

  .emoji-box {
    gap: 18px;
    margin: 2.5rem 0;
  }
}

@media screen and (min-width: 769px) {
  .card {
    max-width: 650px;
    padding: 3rem;
  }

  .emoji-box {
    gap: 25px;
    margin: 3rem 0;
  }

  .button-container {
    gap: 20px;
    margin-top: 2.5rem;
  }
}

@media screen and (min-width: 1200px) {
  .card {
    max-width: 700px;
  }
}

/* Print styles */
@media print {
  body::before,
  .card::before,
  #backArrow,
  .inactivity-warning {
    display: none !important;
  }
}
