/* ==========================================================================
   رحلة داخل المعدة – The Stomach Adventure
   التجاوب مع الشاشات والأجهزة الذكية (Responsive Design)
   تصميم مريح ونقي وخالٍ من الازدحام على الموبايل والتابلت
   ========================================================================== */

/* شاشات الحواسيب المحمولة والشاشات المتوسطة (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --header-height: 60px;
    --nav-height: 70px;
  }

  .brand-titles h1 {
    font-size: 1.15rem;
  }

  .brand-titles p {
    display: none;
  }

  .mascot-container {
    bottom: 85px;
    left: 16px;
  }

  .mascot-dialog {
    max-width: 260px;
    padding: 10px 14px;
  }

  .mascot-avatar {
    width: 60px;
    height: 60px;
    font-size: 32px;
  }

  .scene-tools {
    top: 72px;
    left: 16px;
  }

  .stomach-action-bar {
    top: 72px;
    right: 16px;
  }

  .project-credits-card {
    bottom: 85px;
    right: 16px;
    padding: 10px 14px;
    min-width: 180px;
  }
}

/* الأجهزة اللوحية والموبايل (Tablets & Mobile <= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 48px;
    --nav-height: 60px;
  }

  /* الشريط العلوي */
  .top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    padding: 0 14px;
    background: rgba(10, 17, 40, 0.96);
  }

  .brand {
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
    padding-right: 2px;
  }

  .brand-icon {
    font-size: 20px;
  }

  .brand-titles h1 {
    font-size: 0.92rem;
    white-space: nowrap;
    color: #ffffff;
  }

  .brand-short {
    display: inline !important;
  }

  .brand-full {
    display: none !important;
  }

  .brand-titles p {
    display: none !important;
  }

  .top-bar-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .dialect-switch-pill {
    padding: 2px 3px;
    gap: 2px;
  }

  .dialect-btn {
    padding: 3px 6px;
    font-size: 0.74rem;
  }

  .dialect-btn .dialect-name {
    display: none !important;
  }

  .score-badge {
    padding: 4px 8px;
    font-size: 0.8rem;
    gap: 3px;
  }

  .score-badge span:not(.score-number):not(.score-icon) {
    display: none !important;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  /* إخفاء الأزرار المخصصة للشاشات الكبيرة في الموبايل لتوفير مساحة نقية للشاشة */
  #btn-toggle-teacher,
  #btn-fullscreen,
  #btn-toggle-sound,
  #btn-install-app {
    display: none !important;
  }

  /* شريط بيانات إعداد الطالب والإشراف: شريط أفقي أنيق ومستقل ومثبت أسفل الهيدر مباشرة */
  .project-credits-card {
    position: fixed !important;
    top: var(--header-height) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 28px;
    bottom: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    min-width: auto;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(0, 210, 211, 0.25);
    background: rgba(10, 16, 38, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: none !important;
  }

  .project-credits-card .credits-badge {
    display: none !important;
  }

  .project-credits-card .credits-section {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  .project-credits-card .credits-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: #a4b0be;
  }

  .project-credits-card .credits-label .role-icon {
    font-size: 0.8rem;
  }

  .project-credits-card .role-text-short {
    display: inline !important;
  }

  .project-credits-card .role-text-full {
    display: none !important;
  }

  .project-credits-card .credits-name {
    font-size: 0.78rem;
    font-weight: 800;
    margin-top: 0;
    padding-right: 0 !important;
    letter-spacing: 0;
  }

  .project-credits-card .credits-separator {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.25);
    margin: 0 6px;
  }

  /* لوحة الطبقات والأشعة: زر عائم أنيق (FAB) أعلى اليسار أسفل شريط الإعداد دون حجب المجسم */
  .scene-tools {
    top: calc(var(--header-height) + 36px);
    left: 10px;
    z-index: 25;
  }

  .mobile-tools-fab {
    display: inline-flex;
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .tool-card {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    min-width: 175px;
    padding: 10px 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.65), 0 0 15px var(--primary-glow);
    z-index: 30;
  }

  .tool-card.active {
    display: block;
    animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .tool-card-close {
    display: flex;
  }

  /* دكتور بطن: وضع هادئ وغير حاجب للشاشة مع إمكانية التوسيع والإغلاق بنقرة واحدة */
  .mascot-container {
    position: absolute;
    bottom: calc(var(--nav-height) + 10px);
    left: 10px;
    z-index: 20;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 8px;
    pointer-events: none;
  }

  .mascot-avatar {
    width: 48px;
    height: 48px;
    font-size: 26px;
    pointer-events: auto;
    flex-shrink: 0;
  }

  .mascot-dialog {
    display: none;
    max-width: calc(100vw - 28px);
    width: 310px;
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: 14px;
    pointer-events: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px var(--primary-glow);
  }

  .mascot-dialog::after {
    display: none;
  }

  .mascot-dialog.active {
    display: block;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .mascot-text {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }

  /* أزرار إجراءات المعدة الخاصة */
  .stomach-action-bar {
    position: fixed !important;
    top: calc(var(--header-height) + 36px) !important;
    right: 40px !important;
    left: auto !important;
    bottom: auto !important;
    width: max-content !important;
    max-width: 180px !important;
    gap: 6px;
    z-index: 25 !important;
  }

  .action-pill-btn {
    width: auto !important;
    padding: 5px 12px !important;
    font-size: 0.74rem !important;
    gap: 5px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .btn-label-short {
    display: inline !important;
  }

  .btn-label-full {
    display: none !important;
  }

  /* القائمة السفلية */
  .bottom-nav {
    position: fixed !important;
    bottom: 8px;
    left: 8px;
    right: 8px;
    margin: 0 auto;
    width: auto;
    max-width: 480px;
    transform: none !important;
    padding: 5px 8px;
    gap: 4px;
    border-radius: var(--radius-pill);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-tab {
    padding: 6px 10px;
    font-size: 0.82rem;
  }

  .nav-tab span {
    display: none;
  }

  .nav-tab.active span {
    display: inline;
  }

  .nav-tab .tab-icon {
    font-size: 1.25rem;
  }

  .modal-card {
    padding: 20px 16px;
    width: 95%;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 0.92rem;
  }

  .hero-mascot-circle {
    width: 75px;
    height: 75px;
    font-size: 42px;
  }

  .drag-slots-container {
    gap: 8px;
  }

  .drop-slot {
    min-width: 75px;
    height: 95px;
  }
}

/* الهواتف الذكية الصغيرة (Smartphones <= 480px) */
@media (max-width: 480px) {
  :root {
    --header-height: 46px;
    --nav-height: 58px;
  }

  .brand {
    gap: 4px;
  }

  .brand-icon {
    font-size: 18px;
  }

  .brand-titles h1 {
    font-size: 0.86rem;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }

  .project-credits-card {
    height: 26px;
    padding: 0 6px;
    gap: 4px;
  }

  .project-credits-card .role-text-short {
    font-size: 0.65rem;
  }

  .project-credits-card .credits-name {
    font-size: 0.72rem;
  }

  .scene-tools {
    top: calc(var(--header-height) + 32px);
    left: 8px;
  }

  .mobile-tools-fab {
    padding: 5px 10px;
    font-size: 0.74rem;
  }

  .stomach-action-bar {
    top: calc(var(--header-height) + 32px);
    right: 8px;
  }

  .hotspot-detail-modal {
    width: 92%;
    right: 4%;
    top: 65px;
  }

  .food-journey-panel {
    width: 95%;
    padding: 10px;
  }

  .food-options {
    flex-wrap: wrap;
  }
}

/* الشاشات الذكية للفصول (Smart Boards & Touch Displays >= 1600px) */
@media (min-width: 1600px) {
  .project-credits-card {
    bottom: 120px;
    right: 36px;
    padding: 16px 24px;
    min-width: 250px;
  }

  .project-credits-card .credits-name {
    font-size: 1.25rem;
  }

  :root {
    --font-size-base: 19px;
    --header-height: 86px;
    --nav-height: 96px;
  }

  .brand-titles h1 {
    font-size: 1.9rem;
  }

  .brand-icon {
    font-size: 44px;
  }

  .score-badge {
    padding: 10px 24px;
    font-size: 1.25rem;
  }

  .icon-btn {
    width: 54px;
    height: 54px;
    font-size: 1.5rem;
  }

  .nav-tab {
    padding: 14px 26px;
    font-size: 1.15rem;
  }

  .action-pill-btn {
    padding: 14px 28px;
    font-size: 1.15rem;
  }

  .mascot-avatar {
    width: 105px;
    height: 105px;
    font-size: 60px;
  }

  .mascot-dialog {
    max-width: 400px;
    padding: 18px 24px;
    font-size: 1.1rem;
  }

  .btn-hero {
    padding: 18px 32px;
    font-size: 1.35rem;
  }
}
