/* Reset & Custom Sensory-Friendly Styles */
:root {
  --app-bg: #F8F6F0;
  --panel-bg: #FFFFFF;
  --accent-teal: #234E52;
  --soft-border: #E8E2D5;
}

body {
  background-color: var(--app-bg);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Accessible and readable typography */
button, input, select, textarea {
  font-family: 'Tajawal', sans-serif;
}

/* Custom Scrollbar for pills */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Sensory-Friendly Cards */
.sensory-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.sensory-card:active {
  transform: scale(0.97);
}

@keyframes scaleUp {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.animate-scale-up {
  animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.flashcard-media {
  transition: transform 0.25s ease;
}
.flashcard-media:hover {
  transform: scale(1.05);
}

/* Seriation & Ordering Game Styles */
.seriation-slot {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.seriation-slot.slot-empty {
  border-style: dashed;
  background-color: #FBFBFA;
}
.seriation-slot.slot-filled {
  border-style: solid;
  border-color: #0D9488;
  background-color: #F0FDFA;
}
.seriation-slot.slot-error {
  border-color: #F43F5E;
  background-color: #FFF1F2;
  animation: gentleShake 0.4s ease-in-out;
}
.seriation-slot.slot-correct {
  border-color: #10B981;
  background-color: #ECFDF5;
}

.seriation-item-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
}
.seriation-item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px -4px rgba(13, 148, 136, 0.2);
}
.seriation-item-card:active {
  transform: scale(0.96);
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Fine Motor & Drawing Studio */
.drawing-model-thumb {
  transition: all 0.2s ease;
}
.drawing-model-thumb.active {
  border-color: #0D9488;
  background-color: #F0FDFA;
  box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.15);
  transform: translateY(-2px);
}
.drawing-swatch {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.drawing-swatch.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px #0D9488;
}
.drawing-brush-btn.active {
  background-color: #0D9488;
  color: #FFFFFF;
  border-color: #0D9488;
}

/* Subtle glow for success */
@keyframes calmSuccess {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.pulse-calm {
  animation: calmSuccess 0.4s ease-out;
}

/* =========================================================
   حماية العرض الأفقي: لا شيء يوسّع الصفحة عن شاشة الهاتف
   (نستخدم clip حتى لا تتأثر شريط التنقل اللاصق)
   ========================================================= */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

#child-view,
#specialist-view,
#game-stage,
#game-content {
  max-width: 100%;
}

/* الشريط العلوي: يلتف بدل أن يدفع الصفحة للعرض الزائد */
.app-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
}

.app-brand-text {
  min-width: 0;
}

.app-tagline {
  display: none;
}

.app-header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
}

.app-select-wrap {
  min-width: 0;
  max-width: 100%;
}

#child-select {
  max-width: 46vw;
}

.mode-label-long {
  display: none;
}

.mode-label-short {
  display: inline;
}

@media (min-width: 640px) {
  .app-tagline {
    display: block;
  }
  #child-select {
    max-width: none;
  }
  .mode-label-long {
    display: inline;
  }
  .mode-label-short {
    display: none;
  }
}

@media (max-width: 360px) {
  .app-age-badge {
    display: none;
  }
}

/* رسومات لعبة الترتيب تبقى داخل عمودها ولا تدفع الصفحة */
.seriation-graphic {
  width: 100%;
  min-width: 0;
}

.seriation-graphic > div {
  max-width: 100%;
}

.seriation-graphic svg {
  max-width: 100%;
}

.seriation-slot {
  min-width: 0;
}

/* Print specific styles */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  header, #child-view, #mode-specialist-btn, #mode-child-btn, .spec-tab, #save-assessment-btn, #ai-rebuild-iep-btn, #btn-generate-iep, #btn-print-report {
    display: none !important;
  }
  #specialist-view {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  .spec-tab-content {
    display: block !important;
  }
  #tab-charts, #tab-iep, #tab-home, #tab-assessment {
    page-break-after: always;
  }
  #print-area {
    display: block !important;
  }
}

/* =========================================================
   لوحة اختيار الحرف / الرقم في مرسم الكتابة
   ========================================================= */
.writing-picker {
  display: grid;
  gap: 6px;
}

.writing-pick {
  min-height: 46px;
  min-width: 0;
  border-radius: 14px;
  border: 2px solid #E7E5E4;
  background: #FFFFFF;
  color: #44403C;
  font-weight: 900;
  font-size: 19px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease, background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.writing-pick:active {
  transform: scale(0.93);
}

.writing-pick:hover {
  border-color: #99F6E4;
  background: #F0FDFA;
}

.writing-pick.active,
.writing-pick.active:hover {
  background: #0D9488;
  border-color: #0D9488;
  color: #FFFFFF;
  box-shadow: 0 4px 10px -2px rgba(13, 148, 136, 0.45);
}

@media (min-width: 640px) {
  .writing-pick {
    font-size: 21px;
    min-height: 50px;
  }
}