/* Öğretmen paneli — telefon/küçük tablet düzeni. Masaüstü görünümüne dokunmaz (yalnız ≤768px). */
@media (max-width:768px){
  html,body{max-width:100%;overflow-x:hidden}
  body{-webkit-text-size-adjust:100%}

  /* --- Üst başlık: tek satır — logo · sınıf çipi · ana sayfa · çıkış (selamlama gizli) --- */
  .header .container{flex-direction:row!important;height:auto!important;min-height:56px;padding:6px 10px!important;gap:8px!important;flex-wrap:nowrap}
  .logo{flex:none}
  .logo img{height:42px!important}
  .header .container > div{gap:6px!important;flex-wrap:nowrap;justify-content:flex-end;flex:1;min-width:0}
  .header .container > div > div[style*="border-radius:50px"]{display:none!important}
  .header .container > div > a[data-i18n="dash.home"]{padding:6px 9px!important;font-size:0!important;flex:none}
  .header .container > div > a[data-i18n="dash.home"]::before{content:'🏠';font-size:17px}
  .header .container > div > button[onclick="logout()"]{padding:8px 11px!important;font-size:13px!important;flex:none}
  .as-cip{min-width:0;flex:0 1 auto}
  .as-cip>button{font-size:14px!important;padding:4px 9px!important;max-width:100%;overflow:hidden;text-overflow:ellipsis}

  /* --- Genel kap/kenar boşlukları --- */
  .container{padding:10px!important}
  .header .container{padding:6px 10px!important}
  .dashboard{border-radius:16px!important}
  #dashboard-home{padding:14px 12px!important}
  .tab-content{padding:14px 12px!important}
  #reports-tab,#videos-tab,#kitaplar-tab,#paketler-tab,#calisma-kagitlari-tab,#araclar-tab{padding:14px 12px!important}
  .dashboard-header{padding:14px 12px!important;flex-wrap:wrap;gap:10px}
  .dashboard-header h2{font-size:19px!important}
  #error-message,#success-message{margin:0 12px 14px!important}

  /* --- Ana panel (yeni) --- */
  .ap-bant{grid-template-columns:auto 1fr!important;padding:0 12px!important;min-height:0!important;gap:10px!important;border-radius:20px!important}
  .ap-baykus{width:84px}
  .ap-balon{padding:9px 11px;border-radius:16px;margin:12px 0}
  .ap-balon b{font-size:18px}
  .ap-balon small{font-size:12.5px}
  .ap-basla{grid-column:1/-1;justify-content:center;font-size:20px;padding:12px 16px;margin-bottom:14px}
  .ap-basla img{height:40px}
  .ap-h{font-size:21px;flex-wrap:wrap;gap:4px 8px;margin:20px 0 10px}
  .ap-h small{font-size:12.5px;flex-basis:100%}
  .ap-bugun,.ap-siniflar{grid-template-columns:1fr!important;gap:10px}
  .ap-bolum{grid-template-columns:1fr!important;gap:12px}
  .ap-gk{flex-wrap:wrap}
  .ap-kart{padding:11px;gap:10px}
  .ap-ik{width:56px;height:56px;font-size:30px}
  .ap-kart b{font-size:18px}
  .ap-sonk{width:190px}
  #dash-eski > div[style*="grid"]{grid-template-columns:1fr!important;gap:12px!important}
  #dash-eski > div[style*="grid"] > div{padding:20px 18px!important}

  /* --- Ortak bölüm bandı (geri + başlık) --- */
  .pb-bant,.ogb-bant{margin:10px 10px 12px!important;padding:12px!important;min-height:0!important;grid-template-columns:1fr!important;gap:10px!important;border-radius:20px!important}
  .pb-sol,.ogb-sol{padding-top:0!important;min-width:0}
  .pb-baslik,.ogb-baslik{font-size:19px!important;padding:6px 12px!important;white-space:normal!important;min-width:0}
  .pb-geri,.ogb-geri{width:42px;height:42px;font-size:20px}
  .pb-bant.kucuk{margin:8px 10px 0!important;padding:6px 0!important}
  .ogb-orta,.pb-orta{display:none!important}
  .ogb-dugmeler{flex-direction:row!important;flex-wrap:wrap;padding-bottom:0!important;gap:8px!important}
  .ogb-ai,.ogb-yeni{flex:1 1 140px;font-size:16px;padding:10px 12px;white-space:normal}

  /* --- Oyunlarım --- */
  #teacher-stats-row{display:grid!important;grid-template-columns:repeat(3,1fr)!important;gap:8px!important}
  #teacher-stats-row > div{padding:10px 6px!important;min-width:0!important}
  #teacher-stats-row > div > div:first-child{font-size:22px!important}
  #teacher-stats-row > div > div:last-child{font-size:11.5px!important}
  #games-tab > div[style*="padding:0 28px 20px"]{padding:0 2px 14px!important}
  #subtab-my-games,#subtab-library{flex:1 1 0;padding:10px 8px!important;font-size:14px!important;white-space:nowrap}
  #my-games-list .game-grid,#library-games-list .game-grid,.game-grid{grid-template-columns:1fr!important;gap:14px!important}

  /* --- Genel: tablolar yatay kaysın, formlar tam genişlik --- */
  table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  input,select,textarea{max-width:100%;font-size:16px}
  img,video,iframe,canvas{max-width:100%}
  [style*="grid-template-columns: 1fr 1fr;"],[style*="grid-template-columns:1fr 1fr;"],[style$="grid-template-columns: 1fr 1fr"],[style$="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
  #students-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  #students-grid > div{padding:14px 8px!important;min-width:0}
  .tab-content [style*="white-space:nowrap"],.tab-content [style*="white-space: nowrap"]{white-space:normal!important}
  .tab-content [style*="display:flex"],.tab-content [style*="display: flex"]{flex-wrap:wrap}

  /* --- Akıllı tahta menüsü ve sınıf köyü --- */
  #sb-menu .sbm-izgara{grid-template-columns:1fr 1fr!important;gap:12px;padding:14px 10px 30px}
  #sb-menu .sbm-kart{padding:10px 8px 14px;border-radius:20px}
  #sb-menu .sbm-ikon{height:96px}
  #sb-menu .sbm-ad{font-size:19px}
  #sb-menu .sbm-alt{font-size:12px}
  #sb-menu .sbm-bant{height:150px}
  #sb-menu .sbm-baykus{width:90px}
  #sb-menu .sbm-balon{padding:8px 12px;margin-right:60px}
  #sb-menu .sbm-balon b{font-size:19px}
  .koy-secim{min-height:0}
  .koy-sahne{border-radius:18px}
  .koy-tahta{min-width:0;padding:3px 7px 4px;border-width:2px;border-radius:8px}
  .koy-tahta b{font-size:12.5px}
  .koy-tahta small{font-size:9.5px}
  .koy-direk{height:12px;width:5px}
  .koy-baykus{width:64px}

  /* --- Kazanım karnesi --- */
  #reports-tab .kk-bant{padding:0 10px;height:auto;min-height:120px}
  #reports-tab .kk-baykus{width:80px}
  #reports-tab .kk-balon b{font-size:18px}
  #reports-tab .kk-sinif{font-size:15px;padding:6px 11px}
  #reports-tab .kk-ogrenciler{grid-template-columns:repeat(2,1fr);gap:8px}

  /* --- Modallar (oyun oluştur, AI vb.) --- */
  #modal-overlay > div,#modal-overlay .upload-form{margin:10px auto!important;max-width:calc(100vw - 16px)!important;width:auto!important;padding:16px 14px!important;border-radius:18px!important}
  #create-form #form-title{font-size:21px}
  #create-form #form-title::before{width:48px}
  #create-form .ys-kartlar{grid-template-columns:repeat(3,1fr);max-height:300px;gap:8px}
  [style*="position:fixed"][style*="inset:0"] > div,[style*="position: fixed"] > div[style*="max-width"]{max-width:calc(100vw - 16px)!important}
  [style*="width:600px"],[style*="width: 600px"],[style*="width:700px"],[style*="width:800px"],[style*="width:500px"],[style*="width: 500px"]{width:auto!important;max-width:calc(100vw - 16px)!important}

  .sb-tamekran{display:none!important}
  /* hover kalkmaları dokunmatikte titretmesin */
  button:hover{transform:none}
}
@media (max-width:400px){
  .ap-bant{grid-template-columns:1fr!important}
  .ap-baykus{display:none}
  #create-form .ys-kartlar{grid-template-columns:repeat(2,1fr)}
}
@media (min-width:560px) and (max-width:768px){
  .ap-bolum,.ap-siniflar,.ap-bugun{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #students-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
