/* 모바일 배치 (폭 760px 이하, 또는 휴대폰을 가로로 눕힌 낮은 화면). PC 화면에는 영향 없음
   위: 캔버스 + 재생 바 (스크롤해도 위에 고정) / 아래: 탭과 패널. 오른쪽 속성창은 "속성" 탭으로 */

@media (max-width: 760px), (max-height: 500px) and (max-width: 1000px) {
  body { overflow: auto; height: auto; min-height: 100%; }
  #app { display: flex; flex-direction: column; min-height: 0; }

  /* 상단 바 */
  /* 상단 바: 1줄 제목, 2줄 버튼 */
  #top { padding: 6px 10px; gap: 6px; position: relative; z-index: 6; flex-wrap: wrap; }
  #top h1 { font-size: 15px; flex: 1 1 100%; }
  #top small, #top .btn[disabled], #top .spacer { display: none; }
  #top .btn { padding: 6px 9px; font-size: 12.5px; white-space: nowrap; flex: 1 1 auto; }

  /* 캔버스 + 재생 바: 위에 고정 */
  #center { order: 1; position: sticky; top: 0; z-index: 5; background: var(--bg); box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
  #stagewrap { flex: none; height: min(calc(100vw * 9 / 16 + 12px), 55vh); }
  body.portrait #stagewrap { height: 58vh; } /* 세로형(1080x1920) 화면 */
  #timeline { padding: 6px 10px; gap: 8px; }
  .tlabel { min-width: 0; font-size: 12px; }

  /* 탭 + 패널 */
  #left { order: 2; border: 0; overflow: visible; }
  #right { order: 3; border: 0; overflow: visible; display: none; }
  #tabs { overflow-x: auto; position: static; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  .tab { display: block; flex: none; padding: 12px 14px; font-size: 14px; white-space: nowrap; }

  /* 손가락으로 누르기 쉽게 + 아이폰에서 입력칸 누를 때 화면 확대 방지(16px) */
  input, select, textarea { font-size: 16px; min-height: 36px; }
  input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
  input[type=color] { height: 36px; }
  .btn.sm, .btn.xs { padding: 7px 10px; font-size: 13px; }
  .frow { grid-template-columns: 104px 1fr; }
  .flabel { font-size: 13px; }
  .trow { flex-wrap: wrap; row-gap: 4px; }
  .trow select { min-height: 32px; font-size: 14px; }
  .slotgrid { grid-template-columns: repeat(2, 1fr); }
  .hint { font-size: 12.5px; }
  /* 레이어 아래에 펼쳐지는 속성 편집 */
  .ltog { margin-left: auto; color: var(--dim); padding: 0 4px; }
  .litem { padding: 10px; }
  .linsp { margin: 2px 0 8px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel); overflow: hidden; }
  .linsp .insp-title { padding: 10px 12px; font-size: 13px; }
}

/* 휴대폰을 가로로 눕힌 화면: 캔버스(왼쪽) + 설정(오른쪽) 나란히 */
@media (max-height: 500px) and (max-width: 1000px) and (orientation: landscape) {
  body { overflow: hidden; height: 100%; }
  #top { flex-wrap: nowrap; padding: 4px 8px; }
  #top h1 { flex: none; font-size: 13px; }
  #top .btn { flex: none; padding: 5px 8px; font-size: 12px; }
  #app { display: grid; grid-template-columns: 56% 44%; flex: 1; min-height: 0; }
  #center { position: static; box-shadow: none; min-height: 0; }
  #stagewrap, body.portrait #stagewrap { height: auto; flex: 1; }
  #left { overflow-y: auto; min-height: 0; border-left: 1px solid var(--line); }
}
