
/* ==========================================================================
   Mobile Polish V7 — Student + Admin
   الهدف: تجربة هاتف حقيقية، وليست نسخة Desktop مصغّرة.
   Desktop غير متأثر؛ كل التحسينات داخل breakpoints.
   ========================================================================== */

:root{
  --mobile-nav-height:72px;
  --mobile-safe-bottom:env(safe-area-inset-bottom,0px);
  --mobile-safe-top:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box}
html,body{max-width:100%;overflow-x:hidden}
img,video,iframe{max-width:100%}
button,a,input,select,textarea{touch-action:manipulation}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:3px solid color-mix(in srgb,var(--main-theme,#2563eb) 40%,transparent);
  outline-offset:2px;
}

/* Student mobile-only elements hidden by default */
.student-mobile-bottom-nav,
.student-mobile-overlay,
.student-mobile-drawer-head{display:none}

/* ==========================================================================
   TABLET / MOBILE — shared
   ========================================================================== */
@media (max-width: 992px){
  body{
    -webkit-text-size-adjust:100%;
    text-size-adjust:100%;
  }

  /* Real readable typography — override old "everything 12px" rules */
  body{font-size:15px}
  h1{font-size:clamp(24px,6vw,34px)!important;line-height:1.25!important}
  h2{font-size:clamp(20px,5vw,28px)!important;line-height:1.35!important}
  h3{font-size:clamp(17px,4.5vw,22px)!important;line-height:1.4!important}
  p,span,label,td,th,li,a{font-size:14px}
  small{font-size:12px}

  input,select,textarea,.form-control,.v2-field input,.v2-field select,.v2-field textarea{
    min-height:46px;
    font-size:16px!important; /* يمنع Zoom تلقائي في iPhone */
  }
  textarea,.v2-field textarea{min-height:120px}

  button,.btn,.primary-btn,.v2-btn,.danger-btn,.success-btn,.secondary-btn{
    min-height:44px;
  }

  /* Modal = mobile sheet */
  .modal-overlay{
    padding:12px 10px 0!important;
    align-items:flex-end!important;
  }
  .modal-content{
    width:100%!important;
    max-width:680px!important;
    max-height:92dvh!important;
    margin:0 auto!important;
    padding:22px 18px calc(20px + var(--mobile-safe-bottom))!important;
    border-radius:24px 24px 0 0!important;
    transform:translateY(24px)!important;
  }
  .modal-overlay.active .modal-content{transform:translateY(0)!important}
  .close-modal-btn{
    width:44px!important;height:44px!important;min-height:44px!important;
  }

  /* Tables stay readable and become swipeable */
  .admin-table-container,.table-container,.v2-table-wrap,.pc-table-wrap{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
    border-radius:14px;
  }
  .admin-table,.v2-table{
    min-width:720px;
  }
  .admin-table th,.admin-table td,.v2-table th,.v2-table td{
    white-space:nowrap;
    padding:11px 12px!important;
    font-size:12px!important;
  }

  /* Generic grids */
  .v2-form-grid,.comp-form-grid,.pc-toolbar{
    grid-template-columns:1fr!important;
  }
  .form-row{
    flex-direction:column!important;
    gap:12px!important;
  }
  .form-row > *{width:100%!important;max-width:100%!important}
}

/* ==========================================================================
   STUDENT — 768px and below
   ========================================================================== */
@media (max-width: 768px){

  /* Top navbar */
  .main-navbar{
    width:100%!important;
    min-height:62px!important;
    margin:0!important;
    padding:9px 11px!important;
    border-radius:0!important;
    top:0!important;
    gap:8px!important;
    box-shadow:0 5px 20px rgba(15,23,42,.08)!important;
  }
  .main-navbar .logo{
    min-width:0;
    flex:1 1 auto;
  }
  .main-navbar .logo h2{
    font-size:16px!important;
    margin:0!important;
    max-width:150px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .nav-actions{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    flex:0 0 auto;
  }
  .theme-toggle{
    width:44px!important;height:44px!important;min-width:44px!important;
    padding:0!important;
  }
  #auth-buttons{
    display:flex!important;
    gap:6px!important;
  }
  #auth-buttons .primary-btn{
    padding:8px 10px!important;
    font-size:12px!important;
    min-height:42px!important;
    white-space:nowrap;
  }
  #user-profile-menu{
    gap:7px!important;
  }
  #user-profile-menu .user-info{display:none!important}
  #user-profile-menu .profile-img{
    width:40px!important;height:40px!important;min-width:40px!important;
  }
  #user-profile-menu .primary-btn{
    min-height:40px!important;
    padding:7px 11px!important;
    font-size:12px!important;
  }
  .logout-btn-small{
    width:40px!important;height:40px!important;min-width:40px!important;
  }

  /* Visitor hero becomes a real mobile hero */
  .hero-section{
    width:calc(100% - 18px)!important;
    min-height:auto!important;
    height:auto!important;
    margin:12px auto 0!important;
    padding:32px 18px 24px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    gap:22px!important;
    text-align:center!important;
  }
  .hero-content{
    width:100%!important;
    max-width:100%!important;
    flex:0 0 auto!important;
    padding:0!important;
  }
  .hero-image-wrapper{
    width:100%!important;
    max-width:340px!important;
    min-height:0!important;
    flex:0 0 auto!important;
    margin:0 auto!important;
    justify-content:center!important;
  }
  .hero-image-wrapper img,
  .teacher-animated-img{
    width:auto!important;
    max-width:100%!important;
    max-height:260px!important;
    transform:none!important;
    margin:auto!important;
  }
  .huge-typography{
    font-size:clamp(30px,9vw,44px)!important;
    line-height:1.15!important;
    margin:8px 0 9px!important;
  }
  .teacher-name{
    font-size:clamp(22px,6.5vw,30px)!important;
    margin:0 0 12px!important;
  }
  .hero-description{
    font-size:15px!important;
    line-height:1.9!important;
    margin:0 auto 18px!important;
    max-width:560px!important;
  }
  .welcome-badge{
    font-size:12px!important;
    padding:8px 12px!important;
  }
  .hero-stats{
    justify-content:center!important;
    gap:7px!important;
    margin-bottom:18px!important;
  }
  .h-stat{
    font-size:12px!important;
    padding:8px 10px!important;
    min-height:38px;
  }
  .hero-cta{
    width:100%!important;
    max-width:420px!important;
    min-height:50px!important;
    font-size:15px!important;
    padding:12px 18px!important;
  }

  /* Public sections */
  .courses-section,
  .home-leaderboard-section{
    width:calc(100% - 18px)!important;
    margin:18px auto!important;
    padding:30px 12px!important;
    border-radius:22px!important;
  }
  .section-title{
    margin-bottom:22px!important;
  }
  .section-title h2{font-size:22px!important}
  .section-title p{font-size:13px!important;line-height:1.8!important}

  /* Course grids */
  .courses-horizontal-scroll,
  .courses-grid-student{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:12px!important;
    overflow:visible!important;
    padding:0!important;
  }
  .course-card{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
  }
  .course-thumb{
    height:145px!important;
  }
  .course-details{
    padding:14px!important;
  }
  .course-details h3{
    font-size:15px!important;
    line-height:1.6!important;
  }
  .course-details p{
    font-size:12px!important;
    line-height:1.7!important;
  }
  .course-actions{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:7px!important;
  }
  .course-actions .primary-btn,
  .course-card .primary-btn{
    width:100%!important;
    min-height:44px!important;
  }

  /* Leaderboard */
  .top-3-podium{
    gap:8px!important;
  }
  .podium-card{
    min-width:0!important;
  }
  .rank-item{
    gap:8px!important;
    padding:11px!important;
  }

  /* Student dashboard = content + bottom nav + offcanvas full menu */
  #student-dashboard .dashboard-layout{
    display:block!important;
    width:100%!important;
    overflow:visible!important;
  }
  #student-dashboard .main-content{
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    padding:14px 12px calc(var(--mobile-nav-height) + 26px + var(--mobile-safe-bottom))!important;
    min-height:100dvh;
  }

  .student-v3-sidebar{
    display:block!important;
    position:fixed!important;
    z-index:16020!important;
    top:0!important;
    right:0!important;
    bottom:0!important;
    left:auto!important;
    width:min(88vw,350px)!important;
    min-width:0!important;
    height:100dvh!important;
    max-height:100dvh!important;
    padding:calc(10px + var(--mobile-safe-top)) 8px calc(20px + var(--mobile-safe-bottom))!important;
    border:0!important;
    border-left:1px solid var(--border-color)!important;
    border-radius:0!important;
    background:var(--card-bg)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    white-space:normal!important;
    transform:translateX(105%)!important;
    transition:transform .28s ease!important;
    box-shadow:-22px 0 50px rgba(15,23,42,.20)!important;
  }
  .student-v3-sidebar.mobile-open{transform:translateX(0)!important}
  .student-v3-sidebar .student-v3-nav{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    padding:6px 0 24px!important;
  }
  .student-v3-sidebar .student-v3-group-shell{
    display:block!important;
    width:100%!important;
    margin:6px 0!important;
    background:transparent!important;
  }
  .student-v3-sidebar .student-v3-group-toggle{
    min-height:48px!important;
    width:100%!important;
    padding:11px 12px!important;
    font-size:14px!important;
  }
  .student-v3-sidebar .student-v3-submenu{
    display:block!important;
    width:100%!important;
  }
  .student-v3-sidebar .student-v3-submenu > li{
    width:100%!important;
    min-height:44px!important;
    margin:3px 0!important;
    padding:10px 12px!important;
    border-radius:12px!important;
    white-space:normal!important;
  }
  .student-v3-sidebar .student-v3-submenu > li span{
    font-size:13px!important;
  }

  .student-mobile-drawer-head{
    display:flex!important;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:8px 8px 14px;
    border-bottom:1px solid var(--border-color);
    margin-bottom:8px;
  }
  .student-mobile-drawer-head strong{
    display:block;font-size:17px;color:var(--text-dark)
  }
  .student-mobile-drawer-head small{
    display:block;margin-top:2px;color:var(--text-muted)
  }
  .student-mobile-drawer-close{
    width:44px;height:44px;min-width:44px;min-height:44px;
    border:1px solid var(--border-color);
    border-radius:14px;
    background:var(--bg-color-alt);
    color:var(--text-dark);
    font-size:18px;
  }

  .student-mobile-overlay{
    display:block;
    position:fixed;
    inset:0;
    z-index:16010;
    background:rgba(15,23,42,.54);
    backdrop-filter:blur(3px);
    opacity:0;
    visibility:hidden;
    transition:.25s ease;
  }
  .student-mobile-overlay.show{
    opacity:1;visibility:visible;
  }

  .student-mobile-bottom-nav{
    position:fixed;
    z-index:15990;
    right:8px;
    left:8px;
    bottom:calc(8px + var(--mobile-safe-bottom));
    height:var(--mobile-nav-height);
    padding:7px 5px;
    display:grid;
    grid-template-columns:repeat(5,1fr);
    align-items:center;
    gap:2px;
    border:1px solid color-mix(in srgb,var(--border-color) 85%,transparent);
    border-radius:20px;
    background:var(--card-bg);
    background:color-mix(in srgb,var(--card-bg) 94%,transparent);
    backdrop-filter:blur(18px) saturate(135%);
    -webkit-backdrop-filter:blur(18px) saturate(135%);
    box-shadow:0 12px 38px rgba(15,23,42,.18);
  }
  .student-mobile-bottom-nav button{
    min-width:0!important;
    min-height:54px!important;
    padding:5px 2px!important;
    border:0!important;
    border-radius:14px!important;
    background:transparent!important;
    color:var(--text-muted)!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:4px!important;
    font-family:'Cairo',sans-serif;
    box-shadow:none!important;
  }
  .student-mobile-bottom-nav button i{
    font-size:18px!important;
    line-height:1!important;
  }
  .student-mobile-bottom-nav button span{
    font-size:10px!important;
    font-weight:900!important;
    line-height:1.2!important;
    white-space:nowrap;
  }
  .student-mobile-bottom-nav button.active{
    background:var(--main-theme-light)!important;
    color:var(--main-theme)!important;
  }
  .student-mobile-bottom-nav button[data-mobile-more].active{
    background:var(--main-theme-light)!important;
  }

  /* Dashboard content */
  .welcome-banner{
    padding:16px!important;
    border-radius:20px!important;
    gap:10px!important;
    margin-bottom:14px!important;
    flex-direction:row!important;
    align-items:center!important;
  }
  .welcome-banner .welcome-text{min-width:0;flex:1}
  .welcome-banner .welcome-text h2{font-size:19px!important}
  .welcome-banner .welcome-text p{font-size:12px!important;line-height:1.7!important}
  .welcome-banner img{
    width:90px!important;
    height:auto!important;
    max-height:100px!important;
    object-fit:contain;
    margin:0!important;
  }

  .dashboard-header-cards{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .dashboard-header-cards .streak-card{
    grid-column:1/-1;
  }
  .dash-info-card{
    min-width:0!important;
    padding:14px!important;
    margin:0!important;
  }
  .dash-info-icon{
    width:42px!important;height:42px!important;min-width:42px!important;
  }
  .dash-info-text h4{font-size:11px!important;line-height:1.5!important}
  .dash-info-text h2{font-size:20px!important}

  #gamification-widget{
    padding:15px!important;
    border-radius:18px!important;
  }
  #gamification-widget > div:first-child{
    align-items:stretch!important;
  }

  .ai-diagnostic-box{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:14px!important;
    padding:18px!important;
  }
  .ai-diagnostic-box .primary-btn{
    width:100%!important;
    min-height:48px!important;
  }

  .badges-grid,.certificates-list{
    gap:10px!important;
  }

  /* Course details + lessons */
  .course-details-header{
    padding:18px!important;
    border-radius:20px!important;
  }
  .lessons-cards-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .lesson-card{
    min-width:0!important;
    margin:0!important;
    padding:0!important;
  }
  .lesson-thumb{height:120px!important}
  .lesson-details{padding:12px!important}
  .lesson-details h3{font-size:14px!important;line-height:1.6!important}
  .lesson-article{
    padding:20px 16px!important;
    border-radius:18px!important;
    font-size:15px!important;
    line-height:2!important;
  }
  #lesson-rich-text{
    overflow-wrap:anywhere;
  }
  #lesson-rich-text iframe{
    width:100%!important;
    aspect-ratio:16/9;
    height:auto!important;
  }

  /* Quiz: focus mode */
  .quiz-container{
    width:100%!important;
    max-width:100%!important;
    padding:18px 14px calc(82px + var(--mobile-safe-bottom))!important;
    border-radius:20px!important;
  }
  .quiz-header{
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    margin-bottom:18px!important;
    padding-bottom:14px!important;
  }
  .quiz-header h2{
    font-size:18px!important;
    margin:0!important;
  }
  .timer-box{
    min-width:0!important;
    padding:8px 10px!important;
    font-size:13px!important;
  }
  .quiz-question{
    font-size:18px!important;
    line-height:1.9!important;
  }
  .option-card{
    min-height:54px!important;
    padding:15px 14px!important;
    font-size:15px!important;
    line-height:1.7!important;
  }
  .quiz-footer{
    position:sticky!important;
    bottom:calc(var(--mobile-nav-height) + 18px + var(--mobile-safe-bottom))!important;
    z-index:30!important;
    margin:18px -4px 0!important;
    padding:10px 4px 0!important;
    background:linear-gradient(180deg,transparent,var(--card-bg) 28%)!important;
    border-top:0!important;
    text-align:stretch!important;
  }
  .quiz-footer #next-question-btn{
    width:100%!important;
    min-height:52px!important;
    font-size:15px!important;
  }
  .quiz-result-card{
    padding:22px 14px!important;
    border-radius:20px!important;
  }
  .quiz-review-host{
    margin:16px 0 20px!important;
  }

  /* Competition/mobile cards */
  .comp-stats,.season-detail-stats{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .comp-actions,.season-admin-actions,.challenge-admin-v1-item-actions,
  .team-student-actions,.challenge-card-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:7px!important;
  }
  .comp-actions > button,.season-admin-actions > button,
  .team-student-actions > button,.challenge-card-actions > button{
    flex:1 1 140px;
    min-height:44px;
  }
}

/* Small phones */
@media (max-width: 480px){
  .main-navbar .logo h2{max-width:112px;font-size:14px!important}
  #auth-buttons .primary-btn{
    padding:7px 8px!important;
    font-size:11px!important;
  }
  #auth-buttons .primary-btn i{display:none}

  .hero-section{padding:26px 14px 20px!important}
  .hero-image-wrapper{max-width:270px!important}
  .teacher-animated-img{max-height:220px!important}
  .huge-typography{font-size:30px!important}
  .teacher-name{font-size:22px!important}
  .hero-description{font-size:14px!important}

  .courses-horizontal-scroll,
  .courses-grid-student{
    grid-template-columns:1fr!important;
  }
  .course-thumb{height:180px!important}

  .lessons-cards-grid{
    grid-template-columns:1fr!important;
  }
  .lesson-thumb{height:155px!important}

  .top-3-podium{
    flex-direction:column!important;
    align-items:stretch!important;
  }
  .podium-card,
  .podium-card.rank-1,
  .podium-card.rank-2,
  .podium-card.rank-3{
    width:100%!important;
    max-width:100%!important;
    flex:1 1 auto!important;
    order:initial!important;
  }
  .podium-card.rank-1{order:1!important}
  .podium-card.rank-2{order:2!important}
  .podium-card.rank-3{order:3!important}

  .dashboard-header-cards{
    grid-template-columns:1fr 1fr!important;
  }
  .dash-info-card{
    padding:12px!important;
  }
  .dash-info-icon{
    width:38px!important;height:38px!important;min-width:38px!important;
  }

  .welcome-banner img{
    width:72px!important;
  }

  .student-mobile-bottom-nav{
    right:5px;left:5px;bottom:calc(5px + var(--mobile-safe-bottom));
    border-radius:18px;
  }
  .student-mobile-bottom-nav button span{font-size:9px!important}
}

/* Very small phones */
@media (max-width: 360px){
  .main-navbar{padding-inline:7px!important}
  .main-navbar .logo h2{max-width:92px}
  .theme-toggle{width:40px!important;height:40px!important;min-width:40px!important}
  #auth-buttons .primary-btn{min-height:40px!important}

  .dashboard-header-cards{
    grid-template-columns:1fr!important;
  }
  .dashboard-header-cards .streak-card{grid-column:auto}

  .qr-summary{display:grid!important;grid-template-columns:1fr!important}
}

/* ==========================================================================
   ADMIN — professional mobile control panel
   ========================================================================== */
@media (max-width: 992px){
  #main-dashboard-wrapper .main-content{
    margin-right:0!important;
    width:100%!important;
    max-width:100%!important;
    padding:10px 10px calc(20px + var(--mobile-safe-bottom))!important;
  }

  .admin-sidebar{
    position:fixed!important;
    top:0!important;
    right:0!important;
    bottom:0!important;
    left:auto!important;
    width:min(88vw,350px)!important;
    height:100dvh!important;
    max-height:100dvh!important;
    padding-top:var(--mobile-safe-top)!important;
    overflow-y:auto!important;
    transform:translateX(105%)!important;
    transition:transform .28s ease!important;
    box-shadow:-20px 0 50px rgba(15,23,42,.24)!important;
  }
  .admin-sidebar.open{transform:translateX(0)!important}
  .sidebar-overlay{
    z-index:9999!important;
    background:rgba(15,23,42,.55)!important;
    backdrop-filter:blur(4px)!important;
  }
  .admin-sidebar{z-index:10000!important}

  .top-header{
    position:sticky!important;
    top:0!important;
    z-index:500!important;
    min-height:62px!important;
    padding:9px 10px!important;
    margin:-10px -10px 12px!important;
    border-radius:0 0 16px 16px!important;
    background:var(--card-bg)!important;
    background:color-mix(in srgb,var(--card-bg) 94%,transparent)!important;
    backdrop-filter:blur(16px) saturate(130%);
    -webkit-backdrop-filter:blur(16px) saturate(130%);
    box-shadow:0 6px 20px rgba(15,23,42,.08)!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:8px!important;
    text-align:right!important;
  }
  .top-header > div:first-child{
    flex:1;min-width:0;
  }
  .menu-toggle{
    width:44px!important;height:44px!important;min-width:44px!important;
    padding:0!important;border-radius:13px!important;
    display:grid!important;place-items:center!important;
  }
  .top-header .welcome-text{
    min-width:0;
  }
  .top-header .welcome-text h1{
    font-size:18px!important;
    margin:0!important;
    white-space:nowrap;
  }
  .top-header .welcome-text p{
    display:none!important;
  }
  .admin-v3-header-actions{
    flex:0 0 auto!important;
    gap:5px!important;
    flex-wrap:nowrap!important;
  }
  .admin-v3-header-actions .admin-profile{
    display:none!important;
  }
  .admin-v3-page-help,
  .admin-v3-help-center-btn{
    width:42px!important;height:42px!important;min-width:42px!important;
    padding:0!important;
    display:grid!important;place-items:center!important;
    font-size:0!important;
    border-radius:12px!important;
  }
  .admin-v3-page-help i,
  .admin-v3-help-center-btn i{
    margin:0!important;font-size:16px!important;
  }

  .section-header{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    text-align:right!important;
    gap:10px!important;
    margin-bottom:14px!important;
  }
  .section-header h2{
    font-size:20px!important;
    margin:0!important;
  }
  .simple-section-note{
    font-size:12px!important;
    line-height:1.8!important;
  }

  .stats-grid,
  .pc-summary-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
  }
  .stat-card{
    min-width:0!important;
    padding:13px!important;
  }
  .stat-card h3,.stat-card h4{font-size:12px!important}
  .stat-card .stat-number,.stat-card h2{font-size:22px!important}

  .simple-start-panel{
    padding:14px!important;
    border-radius:18px!important;
  }
  .simple-start-head{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:10px!important;
  }
  .simple-start-grid{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px!important;
  }
  .simple-action-card{
    min-width:0!important;
    min-height:112px!important;
    padding:12px!important;
  }
  .simple-action-card strong{font-size:13px!important}
  .simple-action-card small{font-size:10px!important;line-height:1.6!important}

  .settings-container,.v2-form,.v2-card,.comp-panel,.pc-card{
    padding:14px!important;
    border-radius:16px!important;
  }

  .v2-form-grid,.comp-form-grid,.pc-toolbar,.pc-main-grid,.comp-admin-grid{
    grid-template-columns:1fr!important;
  }

  .search-box{
    width:100%!important;
    max-width:none!important;
  }

  /* Platform center */
  .pc-hero{
    padding:16px!important;
    border-radius:18px!important;
  }
  .pc-hero-top{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:12px!important;
  }
  .pc-quick-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .pc-item{
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  .pc-item-actions{
    justify-content:flex-start!important;
    flex-wrap:wrap!important;
  }
  .pc-item-actions button{
    flex:1 1 125px;
  }

  /* Appearance cards */
  .v2-theme-grid,.theme-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
  }
  .v2-theme-preview{
    min-height:120px!important;
    padding:14px!important;
  }

  /* Competition and season admin */
  .comp-form-grid,.comp-team-grid,.comp-source-picker,.comp-reward-grid{
    grid-template-columns:1fr!important;
  }
  .comp-actions,.season-admin-actions,.challenge-admin-v1-item-actions,.pc-item-actions{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:7px!important;
  }
  .comp-actions > button,.season-admin-actions > button,.challenge-admin-v1-item-actions > button{
    flex:1 1 130px!important;
    min-height:44px!important;
  }

  /* Quill editor */
  .ql-toolbar.ql-snow{
    overflow-x:auto!important;
    white-space:nowrap;
    display:block;
  }
  .ql-formats{
    margin-right:4px!important;
  }
  .ql-editor{
    min-height:180px!important;
    font-size:15px!important;
    line-height:1.9!important;
  }

  /* Help popup/drawers */
  .admin-v3-quick-pop{
    width:calc(100vw - 20px)!important;
    max-width:430px!important;
    right:10px!important;
    left:10px!important;
  }
}

@media (max-width: 560px){
  .section-header > button,
  .section-header > .danger-btn,
  .section-header .classic-simple-actions > button{
    width:100%!important;
  }

  .simple-start-grid{
    grid-template-columns:1fr 1fr!important;
  }
  .stats-grid,.pc-summary-grid{
    grid-template-columns:1fr 1fr!important;
  }
  .v2-theme-grid,.theme-grid{
    grid-template-columns:1fr!important;
  }

  .badge-select-item{
    width:calc(50% - 6px)!important;
  }

  .modal-header{
    gap:8px!important;
    align-items:flex-start!important;
  }
  .modal-header h2{
    font-size:18px!important;
  }
}

@media (max-width: 360px){
  .simple-start-grid,
  .stats-grid,
  .pc-summary-grid{
    grid-template-columns:1fr!important;
  }
}

/* Touch devices: no hover-only essential behavior */
@media (hover:none){
  .course-card:hover,.lesson-card:hover,.simple-action-card:hover,.stat-card:hover{
    transform:none!important;
  }
}
